This is a very frustrating recurring problem. I only use flow rates in cubic meter per hour throughout my model. All Valve's flow rates are set dynamically, using various functions. Thus we use valve.set_openRate(flowm3h / 3.6)
to have flow in liter/sec and valve.set_openRate(flowm3h / 3600)
to have flow in cubic meter/sec.
However Anylogic seems to at random decide whether the set_openRate()
function uses units of liter/s or cubic_meter/s. For example I drop a valve Rate_when_open = openRate/3.6 liter/s and Initially closed
(using a parameter openRate). I set the parameter openRate = 1200. from here it goes to two fluid splits, splitting the fluid three ways. Each branch controlled via a valve - (outvalve_0 .. 2) no limits. Run the model, open outvalve_1, close it, open outvalve_0... all works fine; the flow rate is 0.333 (m3/s which is 333.33 liter/s, no problem). Save the model. Close Anylogic. Re-open Anylogic and load the model. Now modify the model, add a button and split the flow 0.2, 0.3 and 0.5 through the three valves, using a function outvalve_0.set_openRate(1200*0.2/3.6); outvalve_1.set_openRate(1200*0.3/3.6); outvalve_2.set_openRate(1200*0.5/3.6); outvalve_0.open();outvalve_1.open();outvalve_2.open();
Run. The flow is limited to 0.333 cubic meter/s and all flow goes out via outvalve_0. Run model in debug mode, it shows the openRate for outvalve_0 is set to 66.667 m3/s; outvalve_1 to 100 m3/s and outvalve_2 to 166.67 m3/s. Since the invalve limits flow to (1200/3.6) = 0.333 cubic meter/s, the rate on the three outvalves are too high (therefore Anylogic interpreted the initial (1200/3.6) as 0.333 m3/s and the subsequent (1200*0.2/3.6) as 66.67 m3/s and not as liter/s (0.067m3/s). You have to change the code to outvalve_0.set_openRate(1200*0.2/3600)..etc.
for it to work
Problem is this is not consequent. For in the next model, slightly different setup, if you use (1200*0.2/3600) it now interprets this as 0.000067 m3/s and you have to change the code back to (1200*0.2/3.6).
So the question: How do you know the units that Anylogic is going to use when you pass a flow-rate through the valve.set_openRate()
function? On what basis does it decide what the unit is? OR... Is there a way to force the unit?