Attached is a super dummied down version of the circuitI have a power electronic inverter, and I want to make the duty cycle of the PWM dependent on the ratio of "vout/vin", where vout is an AC power source.

Unfortunately, setting .param D= IF(V(vout)/V(vin) < 0.5, 1, 0) doesn't work. In fact, even just setting D to be a sine-wave source doesn't work.

Does this mean that LTSpice params need to be constant, and that a "control circuit" needs to be implemented to get something that can change on the fly?

  • \$\begingroup\$ You can sweep sources and use the sweeps value to set up other values. \$\endgroup\$ – jonk Aug 16 at 18:09
  • \$\begingroup\$ @jonk would this mean setting up a sweep analysis, and then using the results from that to setup the other values? \$\endgroup\$ – RonaldB Aug 16 at 18:23
  • 1
    \$\begingroup\$ Yes. If you provide sufficient details -- a reduced schematic that illustrates your issue well would be okay -- I can help. I don't have enough info now, though. And a sweep isn't necessarily the only way to go. It is just one of several. \$\endgroup\$ – jonk Aug 16 at 18:27
  • \$\begingroup\$ A bit of shameful self-advertising, but maybe these can help? I'm sure there are others. In fact, I'm surprised you didn't see any when you wrote your question. \$\endgroup\$ – a concerned citizen Aug 16 at 18:59
  • \$\begingroup\$ @RonaldB Your "IF" appears to want just 1 or 0 -- it digitizes the ratio. But your other words appear to suggest that you want a smooth duty cycle calculation, without it being digitized like that. Is this a switcher of some kind? \$\endgroup\$ – jonk Aug 16 at 22:13

Your Answer

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

Browse other questions tagged or ask your own question.