I made my second model simulating a gas pipe where we want to simulate the pipe filling by gas to validate our tightness test sequence. The idea was to connect this model to our PLC program using OPC UA interface already included in OpenModelica. When I run the model in Interactive mode, the OPC UA embedded server is well started. I am able to browse model objects using OPC expert as OPC client and data are refreshed following my simulation. For internal validation of my model, I triggered the valve based on condition related to simulation time but
i would like these opening to be written depending on boolean variable written through OPC UA by my PLC.
Real leak ;
equation
leak = if (time > 20) then 0.01 else 0.0;// no leak at staring up to help init
CO0011_FSV02.opening = if (time > 60) and (time < 70) then 0.05 else if time > 110 then 1 else leak;
CO0011_FSV03.opening = if (time > 20) and (time < 30) or ( time > 110 ) then 1 else leak;
CO0011_FSV04.opening = if (time > 10) and (time < 100) then 1 else leak;
becomes
//valves commands from PLC
Boolean YV01;
Boolean YV02;
Boolean YV03;
Boolean YV04;
equation
leak = if (time > 20) then 0.01 else 0.0;// no leak at staring up to help init
// CO0011_FSV02.opening = if (time > 60) and (time < 70) then 0.05 else if time > 110 then 1 else leak;
// CO0011_FSV03.opening = if (time > 20) and (time < 30) or ( time > 110 ) then 1 else leak;
// CO0011_FSV04.opening = if (time > 10) and (time < 100) then 1 else leak;
CO0011_FSV02.opening = if YV02 then 0.05 else if YV01 then 1 else leak;
CO0011_FSV03.opening = if YV03 then 1 else leak;
CO0011_FSV04.opening = if YV04 then 1 else leak;
but this give me the following errors messages:
[2] 18:59:41 Symbolique Erreur Too few equations, under-determined system. The model has 239 equation(s) and 243 variable(s).
[3] 18:59:41 Symbolique Avertissement [Gas_supply_test: 34:3-34:15]: Variable YV01 does not have any remaining equation to be solved in. The original equations were: Equation 204: CO0011_FSV02.opening = if YV02 then 0.05 else if YV01 then 1.0 else leak, which needs to solve for YV02
What is the good way to declare these command variables that will be changed online during interactive simulation but do not need to be solved and count by the compiler?
When i define them as parameters, they are no listed nor visible by OPC browser. thanks for any good idea