SpiceSharp / SpiceSharpBehavioral

This library extends Spice# components with behavioral sources for modelling electronics circuits.
MIT License
6 stars 5 forks source link

Current through resistor issue #56

Closed marcin-golebiowski closed 3 years ago

marcin-golebiowski commented 3 years ago

There is an issue with I(Resistor) in expressions. Please find the unit test.

svenboulanger commented 3 years ago

At the moment, this doesn't work by design. A resistor does not define a branch current, so the behavioral source cannot compute derivatives for it...

marcin-golebiowski commented 3 years ago

Any plans to change that? I think that could be nice feature.

svenboulanger commented 3 years ago

The thing is that I don't know how to go about this correctly. Maybe I could add a optional flag that you can override the 'fully correct' behavior. You will in a lot of cases still get agreeable results, however it is hard to predict what it does for more complex stuff.

I will also take a look how they do it in ngSpice for example.

svenboulanger commented 3 years ago

It should be possible with v3.1.