Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modelica.Electrical.Analog.Examples.Resistor is not very simple #4471

Open
HansOlsson opened this issue Oct 1, 2024 · 9 comments
Open

Modelica.Electrical.Analog.Examples.Resistor is not very simple #4471

HansOlsson opened this issue Oct 1, 2024 · 9 comments
Labels
documentation Issue addresses the documentation example Issue only addresses example(s) L: Electrical.Analog Issue addresses Modelica.Electrical.Analog
Milestone

Comments

@HansOlsson
Copy link
Contributor

The documentation of Modelica.Electrical.Analog.Examples.Resistor says

This is a very simple circuit consisting of a voltage source and a resistor.

I don't agree with that.
Clearly the model looks simple and the electrical part is in itself simple, but the thermal coupling makes the behavior more complicated:

If you look at the code generated by Dymola you see that there's a non-linear system of equations!

The reason is that the thermal part isn't connected to a heat capacitor as one would naïvely expect, but only to a linear thermal conductor. Since the resistor's resistance depend on temperature we therefore have a non-linear system of equations keeping the loss-power (that is v*i or v^2/R(T) right?) in balance with conducted heat power ( G*(T-293.15) ).

I see a number of possibilities:

  • Just don't say that it is "very simple".
  • Add a small heat-capacitor simplifying the model behavior, while keeping the thermal conductor (without the thermal conductor it would just keep heating until it burned).

The current model would be limit if we in the second possibility have a an epsilon-heat capacitor and let epsilon go to zero.

@HansOlsson HansOlsson added L: Electrical.Analog Issue addresses Modelica.Electrical.Analog discussion Discussion issue that it not necessarily related to a concrete bug or feature labels Oct 1, 2024
@HansOlsson HansOlsson added this to the MSL4.2.0 milestone Oct 1, 2024
@HansOlsson HansOlsson added documentation Issue addresses the documentation and removed discussion Discussion issue that it not necessarily related to a concrete bug or feature labels Oct 1, 2024
@HansOlsson
Copy link
Contributor Author

(oops - wrong labels, both started on 'd').

@casella
Copy link
Contributor

casella commented Oct 1, 2024

Well, the electrical circuit is simple, I can't imagine anything simpler than a resistor connected to an ideal voltage source. The circuit behaviour maybe is not completely trivial because of the dependency of the resistance on the quadratic losses, but the circuit and its behaviour are two different concepts.

Surfing the web I even found "A simple chaotic circuit with a light-emitting diode", so it seems that a simple circuit can even show chaotic behaviour with strange attractors.

Maybe we should include it the Modelica.Electrical examples 😃

@AHaumer
Copy link
Contributor

AHaumer commented Oct 1, 2024

@HansOlsson what's the problem with a nonlinear set of algebraic equations?
@casella To be honest: The "simple chaotic circuit with a light-emitting diode" is not simple, it consists of 4 OpAmps besides the diode. Anyway, yes we could implement that circuit.

@beutlich beutlich added the example Issue only addresses example(s) label Oct 1, 2024
@HansOlsson
Copy link
Contributor Author

@HansOlsson what's the problem with a nonlinear set of algebraic equations?

There's no problem with the equations.
However, if a new user looks at the examples and sees a "very simple" circuit, and think that it will be a good starting point to understand models and then sees algebraic equations, they might be a bit surprised.

@AHaumer
Copy link
Contributor

AHaumer commented Oct 2, 2024

@HansOlsson What's easier with an additional ODE?

IMHO the example is simple and demonstrates:

  • Ohm's law
  • power dissipation of a resistor
  • (linear) temperature dependency of the resistance

It can even be solved analytically - witt a linear temperature dependency of resistance it leads to a quadratic equation for temperature.

The new user sees a circuit in the diagram layer which is nearly self-explanatory. Looking into the used components, he could obtain the above mentioned (quadratic) equation.
ExamplesResistor

@HansOlsson
Copy link
Contributor Author

Ok, but even if "simple" could we drop the "very"?

@casella
Copy link
Contributor

casella commented Oct 2, 2024

No big deal, feel free to open a PR for that 😃

@AHaumer
Copy link
Contributor

AHaumer commented Oct 2, 2024

@HansOlsson yes we can drop the "very". I admit the circuit is simple but not very simple.

@AHaumer
Copy link
Contributor

AHaumer commented Oct 2, 2024

@casella here you go: have a preview on the PR.
Feel free to comment / change ...
I'm not familiar with optoelectronics and chaotic circuits, but I suppose it's a nice test example ;-)
Now an ever nicer solution:
ChaoticDiodeCircuit.zip
For b=1 you can see the same chaotic behavior and for b=1.6 the same periodic behavior as shown in the paper.
Hint: In OpenModelica use solver = cvode (works much better than dassl).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issue addresses the documentation example Issue only addresses example(s) L: Electrical.Analog Issue addresses Modelica.Electrical.Analog
Projects
None yet
Development

No branches or pull requests

4 participants