Is it possible to resolve this problem in QSPICE for the case with stop time of 10ms for example, but still using behavioral voltage source?
Changing maximum time step (=10ns) to a smaller value in QSPICE does not help, but only making stop time smaller…
Now adding Maximum Time Step: 10ns in .tran fix the problem
Untitled.qsch (3.0 KB)
Is Maximum Time Step useless in QSPICE?
I would have expected that even if Stop Time = 10ms while Maximum Time Step = 10ns, then the graph/calculation would show the points corresponding to Maximum Time Step, and not the points corresponding to Stop Time…
What îs wrong?
What is wrong is that B-sources do not implement temporal tolerance (TTOL), because it was not anticipated they would be used for this purpose. KSKelvin, in a recent thread has suggested some workarounds that do not involve stop time or maximum timestep.
I found it for you:
TTOL device to Interface analog and digital - QSPICE - Qorvo Tech Forum
This thread also has additional insights.
TRIPDT and TRIPDV Parameters - QSPICE - Qorvo Tech Forum
I am wondering if it will not be possible to implement in B source this temporal tolerance (of course, this is a question for @Engelhardt)… because many use in B source logic. It will be helpful if this is considered to be added.
Based on previous threads on this subject, I’m thinking it is unlikely.
Your .tran syntax in Qspice is incorrect and that why maxstep is not in effect.
If you compare your LTspice and Qspice .tran, you will find that different.
I answered this similar question before and you can refer to this post.
Refer to two of my reply in this link
Why are the simulation results different after updating the program? - QSPICE - Qorvo Tech Forum
My understanding of TTOL is a temporary timestep control during simulation. Qspice calcuation is correct in every @Cornel example, but visually we just don’t like the look of the waveform as no extra points to make a vertical line in plot. Therefore, in this particular case, this is more like a “Visual Problem”.
With that, I don’t think it is B-source problem. B-source handle all kind of mathematic formula, and the challenge is only when we operate a B-source in a “logic” condition (e.g. using if function)
Learning when and how to use TTOL is an important key in Qspice. This parameter is not in LTspice, once you understand that, you will find Qspice can run a switching circuit much faster and TTOL in many ways play an important role to that.
@KSKelvin This with .tran syntax (including MAXSTEP correctly in the syntax) fixes the problem:
When limiting the MAXSTEP in .tran syntax results in a slower(or more) simulation time required for the simulation than the variant using a TTOL device (a buffer). See total elapsed time.
The thing with using a TTOL device is that:
It seems that the supply voltage of the TTOL device must be lower than the comparison value in if statement to properly work. But as you can see the amplitude of V(pwm1) does not change if you put in if statement any value greater than the supply voltage of TTOL device.
If you refer to help, ¥-device has an instance parameter REF. This is logic reference voltage to determine input threshold of HIGH and LOW of logic. In default, REF=(Vdd+Vss)/2.