C++ DLL Output Issue: Hardcoded 1.0f output appears as ~0.909 (1/1.1)

Hi Mike and everyone,

I am experiencing a strange scaling issue with a C++ DLL block in QSPICE.

I have a specific output variable named PWMBUCK. To test the interface, I simplified my code to force this output to exactly 1.0.

Code Snippet:

C++// Forcing output to 1.0 for testing *PWMBUCK = 1.0f;

The Issue: Even though the code explicitly assigns 1.0f, when I probe the PWMBUCK node in the simulation waveform, it settles at approximately 0.90909… (which corresponds exactly to 1/1.1). It never reaches 1.0.

  • I have checked that the variable is defined correctly in the port list.
  • Is there an implicit output impedance or a default scaling factor of 1.1 applied to DLL analog outputs?
  • Could this be related to how the DLL drives the node (Voltage Source vs Current Source behavior)?

Any advice on why this specific attenuation occurs would be helpful.

Thanks,
Yaşar

Is it possible that this is due to the loading effect? The DLL block by default has a 1 kohm resistance at each of its output pins. You can add an attribute ROUT=<value> to adjust this impedance. Alternatively, you can buffer your output with an E-source.

2 Likes

@BLTeX ,

Check @KSKelvin post.

If you have a load on the output, the ROUT driving series resistance will make it act as a resistor divider network.

This is why I prefer to set ROUT=1n ohms. This is very close to 0 ohms without causing problems with the analog solver in QSpice.

Len

@KSKelvin @lpoma

The issue is resolved. Removing the 10k resistor at the DLL output fixed the problem, and the value now correctly reaches 1.0. Thank you for your support.

Yaşar

1 Like