- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Problem with the Flow Variable of a...
Problem with the Flow Variable of a Connector
Problem with the Flow Variable of a Connector
Hello
I am creating a custom library and have therefore created custom components and connectors for the same. I am facing a problem though. The flow variable in the connector does not seem to obey the flow equation (component1.flow_variable + component2.flow_variable = 0 ).
I am actually assigning the flow variable in component one by equating it to a parameter. The parameter value is positive and the equation I'm using is -
component2.flow_variable = - parameter_value ;
Then it gives the output of both the flow variables to be negative and does not obey the flow variable equation, the cause of which I am not able to understand.
But if I take the parameter to be negative and assign the flow variable as -
component2.flow_variable = parameter_value ;
Then it solves the system properly and obeys the flow variable equation.
I'm not able to understand as to why this is happening.
Any help on this is appreciated.
Thank You
Pratyush
Re: Problem with the Flow Variable of a Connector
I noticed that the problem didn't exist with that particular example alone.
Here's a elementary piece of code that I ran -
Code:
model Test
parameter Real a1(start =1);
Real a2;
Real a3;
equation
a2 = -a1;
a3 = -a2;
end Test;
Only to notice that the values of a3 and a2 are coming out to be the same.
If I change the multiplying factor of a2 in the 2nd equation from -1 to any other value, it solves and gives me the answer.
I do not face this problem when I use the algorithm.
Code:
model Test
parameter Real a1(start =1);
Real a2;
Real a3;
algorithm
a2 := -a1;
a3 := -a2;
end Test;
I tried finding out what the problem could be while solving the equation but couldn't do so.
Anyone has any idea as to what could be the problem ?
Thank You
Pratyush
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Problem with the Flow Variable of a...