Mismatch Between Diode Current Flag and Branch Current Reading in PSIM
Mismatch Between Diode Current Flag and Branch Current Reading
Sometimes, when simple things don't work as expected, it can be unsettling. This was my experience when initially testing the following simple circuit:
-
Step source
-
Resistor
-
Ideal diode
The step source output is:
We have a voltage transitioning from 0V to 50V at 5ms. Given this and the circuit configuration above, we should expect that the ideal diode model won't conduct current at any point in time.
Indeed, by enabling the diode's “current flag”, we observe a zero amp current waveform:
We’d expect the current meter in series with the diode to show the same reading, assuming no parallel paths. However, PSIM results beg to differ:
Is PSIM broken? Is the current meter or the diode model at fault?
Actually, everything is fine! We just discovered that an ideal switch is modeled with a very small resistance (R_switch_on, default 10µΩ) when on, and a very large resistance (R_switch_off, default 10MΩ) when off. These values can be changed in Simulation Control:
For example, an ideal diode is modeled as:
Please note that R_switch_off isn’t always added. If there’s already an RLC branch across it, R_switch_off won’t be added.
Historically, the displayed switch current only shows the current through the switch and R_switch_on, not including the current through R_switch_off. For example, the displayed current is onlyI(D1), not i(sw) from the image above.
Changing this behavior to include the parallel resistor current in the switch current could confuse things more, as the display would show a small negative current when the switch is off.
Thus, the above phenomenon is a feature, not a bug!