Help - Search - Members - Calendar
Full Version: connected or not connected
Modelica Forum > Modelica > Modelica
David
Hi Modelica-folks,

Question I:
in my model I would like to check whether a input-connector is connected from the outside or not. If not I have to provide an additional equation within the model. I do not know how to check this. The use of this is: the component should be usable in both cases: being or not being connected. In case of not being connected, i.e. not getting a signal from this input-connector, a standard value should be used.

Question II:
Apart from this: I experimented with the when-expression. If a boolean variable is set to TRUE, an additional equation is provided. But when checking in both cases (TRUE and FALSE) Dymola counts the same number of equations and thus complains about too many equations.

My idea was

when not (connected) then (additional equation) end when;

Or something like this.
I would be pleased with some of your great ideas.
Thank you!

david.





wagner
Hello David,

for your first question I provided a sample model to this post which explains how to adapt your model for a varying number of connections using the cardinality command.

For the second question I don't really get what you want to do. But in general the when-constructs are a little bit special. Equations inside a when-clause are only evaluated at a single point, i.e. the moment when the when-condition becomes true. That's why the number of equations does not change. For periods of time only the equations outside the when-clause are used. Maybe you should take a look at this topic which also deals with when and events: "provide event signal"

I use when-clauses to reset state variables. Maybe you can post a simplified physical example that you want to model.

Regards

Florian



David
Hello Wagner,

thank you very much. Your answer No. 1 solves my problem. Sorry for my delayed answer.

Regards,
david.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.