Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Using if-else clause in defining a connector

Using if-else clause in defining a connector

I have two connectors with different elements namely, mol_port and energy_port . In a model, I use the first connector and I add an if-else clause after it as:
>>Chemical.Interfaces.mol_port In[nin](n = system.set_n) if not system.use_EnergyBal
Now, I inherit this model into a second one and I use the second connector as:
>>Chemical.Interfaces.energy_port In[nin](n = system.set_n)
Here, "system" is used as inner-outer connector and "use_EnergyBal" is a parameter in it.

The first model is working fine if I give "use_EnergyBal" as false in "system". But, when I tried simulating the second model by giving  "use_EnergyBal" as true, the Connect equations are not generated and hence number of equations are less than the number of variables.

Kindly suggest if it is a bug or it is not possible to do this in OM.

There are 0 guests and 0 other users also viewing this topic
You are here: