Plotting C++ block variables

Hello,
Is there any way to plot a variable of the C++ block directly on the waveform viewer without having to add an output to the C++ block?
Thanks!

Hi, Marcos.

I don’t think so. QSpice has no knowledge of what goes on inside the compiled C-Block DLL code, i.e, no access to component variables. I suppose that there might be some way to have the DLL push data into the waveform data but I think that would be much more complex than adding an output port to the component.

–robert

1 Like

Thank you, Robert.
It’s OK. The only issue is that I have experienced a strange behavior when adding new pins once the C++ sheet has been created. I added the new variable definition to the sheet and it compiles OK but it seems that the signals go to different outputs. At the end, I had to create a new sheet and paste all the code on it. I would like to know if someone have had the same issue.
Thanks

The problem is the port number is not sorted on geographical order. it is instead based on the sequence which pin is created first.

Its a bit inconvenient honestly

@Engelhardt , do you have any suggestion to make it a bit more convenient?

1 Like

Marcos,

Yes, any time you edit the ports, you should regenerate the template and copy the uData stuff from the new one to your code. I usually edit the component DLL name attribute temporarily to prevent overwriting my development code and then restore the name after generating the temporary template.

I suspect that it’s possible to use the netlist to determine the uData parameter order but I’ve not verified that.

–robert

2 Likes

If you just add output port, it will be easy…

But, if you add input or param, then all the naming of the output port will change.

Anyway, @Engelhardt, will it be possible to show the number of each port and param next to each port location…?

1 Like

First the inputs are on the netlist line, then the outputs, then the parameters.

But I think the only non-error-prone way of dealing with this is as RDunn suggested. Generate the .cpp template anew, but keep a copy of the old one if you added code. That’s how I do it.

–Mike

2 Likes