0

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)

JRE
  • 67,678
  • 8
  • 104
  • 179
Ri Di
  • 753
  • 4
  • 15
  • 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`. – a concerned citizen Aug 20 '21 at 14:37
  • but can .param be time dependant? i simply need to change pulse value to simulate sine wave with pwm – Ri Di Aug 21 '21 at 13:21

1 Answers1

2

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.

a concerned citizen
  • 21,167
  • 1
  • 20
  • 40
  • I tried that example in link. How is it supposed to change that pulse parameter? How could I apply it to mine? – Ri Di Aug 22 '21 at 07:16
  • @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](https://en.wikipedia.org/wiki/Pulse-width_modulation). If it's that difficult, [here](https://electronics.stackexchange.com/a/372170/95619) is a practical example. – a concerned citizen Aug 22 '21 at 08:12
  • your example give [this](https://ibb.co/yQV4s6Y) result - shouldnt PWM be like [this](https://upload.wikimedia.org/wikipedia/commons/8/8e/PWM%2C_3-level.svg)? – Ri Di Aug 22 '21 at 10:59
  • @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? – a concerned citizen Aug 22 '21 at 11:23
  • 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 – Ri Di Aug 22 '21 at 11:36
  • @RiDi That would depend on the context and, as such, deserves a new question. When you do ask again, though, be sure to ask what you *need*, not what you *think* you need, along with a context and -- preferably -- schematics to show exactly what/who/where. This is needed to avoid people trying to guess and, instead, give a precise answer (this being a Q&A site, not a forum). – a concerned citizen Aug 22 '21 at 12:03
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/128826/discussion-between-ri-di-and-a-concerned-citizen). – Ri Di Aug 22 '21 at 12:17
  • also - why is current smooth (sine). but voltage not? – Ri Di Aug 25 '21 at 14:56