I'm simulating a phase change material in Verilog-A and need to calculate the power across the material. The material is a resistor, so it satisfies Ohm's Law. Therefore, P = IV = (I^2)R = (V^2)/R should be satisfied. P = (V^2)/R works no matter what, but P = IV = (I^2)R = 0 when I assign current as:
I(p, n) <+ V(p, n) / R;
However, all three power expressions yield the same correct result when I instead assign voltage:
V(p, n) <+ I(p, n) * R;
Why does one of these lines work and the other doesn't? p and n are both conservative electrical inout nodes. I've tried different values of R and determined that the problem is not numerical. I don't use V or I anywhere else in the module except in the three power expressions.