0
\$\begingroup\$

I have PULSE(0 123 0 0.0000001 0.0000001 0.0000333 0.0000666) and I want to change the sixth parameter according to a voltage source output. I need to alter the parameter to make sine wave.

How could I do that?

I would imagine something like PULSE(0 123 0 0.0000001 0.0000001 V1+0.0000333 0.0000666)

TV1 is SINE(0 0.0000333 50 0)

\$\endgroup\$
2
  • \$\begingroup\$ Just add two voltage sources, one a PULSE the other a SINE. Neither of those accepts time dependent variables as parameters, but they can accept .param. \$\endgroup\$ Aug 20, 2021 at 14:37
  • \$\begingroup\$ but can .param be time dependant? i simply need to change pulse value to simulate sine wave with pwm \$\endgroup\$
    – Ri Di
    Aug 21, 2021 at 13:21

1 Answer 1

2
\$\begingroup\$

All .param statements are evaluated prior to simulation start, therefore time, which starts at zero with the simulation, cannot be a parameter. A .func can be time dependent, but then its evaluation will only be done during the simulation. Implicitly, if the PULSE and the SINE sources can accept .param but not time-dependent .func definitions then they can't have variable parameters.

However, put like that it's an XY problem. What you describe is a PWM, since you need to vary the 6th term (Ton) in a PULSE, according to a SINE. For that, there already are solutions.

\$\endgroup\$
8
  • \$\begingroup\$ I tried that example in link. How is it supposed to change that pulse parameter? How could I apply it to mine? \$\endgroup\$
    – Ri Di
    Aug 22, 2021 at 7:16
  • \$\begingroup\$ @RiDi You'll have to think for yourself a bit, otherwise how do you expect to get on in life with problems: by asking at every step? What is depicted in the linked answer is the basic configuration for generating a PWM. If it's that difficult, here is a practical example. \$\endgroup\$ Aug 22, 2021 at 8:12
  • \$\begingroup\$ your example give this result - shouldnt PWM be like this? \$\endgroup\$
    – Ri Di
    Aug 22, 2021 at 10:59
  • \$\begingroup\$ @RiDi It looks like you used a fixed voltage for the reference, not a sine. Either that or you didn't run it for a long enough time span. There is a third possibility: that you don't know what PWM means or does, but surely this is not the case, no? \$\endgroup\$ Aug 22, 2021 at 11:23
  • \$\begingroup\$ sorry, I mean it is not pwm on switches, but their control signals. I do not understand why they (switches) should be controlled like this \$\endgroup\$
    – Ri Di
    Aug 22, 2021 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.