0
votes

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?

1

1 Answers

0
votes

I don't think AnyLogic is being inconsistent in the units it uses... Nevertheless from your description I would suggest this:

1) always use the units every time you change a rate or anything that requires units, in the case of set_openRate you can do

valve.set_openRate(4, CUBIC_METER_PER_SECOND);

check in the help documentation the units available: https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Ffunctions%2FConstants_Time_Units.html

2) The output you see beside each fluid library block is ALWAYS in cubic meters per second, and I'm pretty sure you can't change that (unless they made some update recently). It is sometimes confusing to define everything in liters/second and see the outputs during simulation runtime in cubic meters per second, but that's the way it is.

3) Make a revision on whether you are actually using the correct units in your blocks... you have to define the units in your blocks and sometimes it's easy to make a mistake there.