A simple PWM circuit is simple to create using LTSPICE, such as:
VIN VSIN 0 SIN(0 1 10 0 0)
VP VTRI 0 PULSE(-1.5 1.5 0 9.998m 1u 1u 10m)
B1 VOUT 0 V=U(V(Vtri)-V(Vsin))*5
But voltage reflection simulations, i need the PWM rising edge to be more realistic, i.e. with a time delay on the rising edge like this:
I have tried using a PULSE, but its frequency and on-time is fixed.
What I need is something that activates a given pulse, or a behavioral voltage source that can create a pulse if a certain condition is true. The pulse has to be as long as the condition is true - as with conventional PWM.
An example of what I have tried, but which caused a syntax error:
The syntax error is that in the B2-element (to the right), cannot use "V1" as voltage output. It has to be 5 (volts) or something.
How to I solve this? I just started using SPICE two days ago, and I bet there is a few tricks I am not aware of yet
Answer
This works for me.
I had to change the prefix to BV for [B]V4. And also use net names; it doesn't seem to take the voltage sources' names in those behavioral expressions.
What I need is something that activates a given pulse, or a behavioral voltage source that can create a pulse if a certain condition is true.
What you seem to actually want however is a PWL triggered ramp like so:
Also what you're describing is not actually called PWM. If you somehow need to modulate the width instead of triggering then see this solution.
Well assuming you only want non-zero rise (as in your graph) but zero fall time, and you want that combined with PWM, then you basically have to combine the above two solutions:
No comments:
Post a Comment