question

Shinya O avatar image
0 Likes"
Shinya O asked Shinya O commented

Unit of Mass Flow Conveyor Generative Rate

Hi,

I am executing the following code to change the Generative Rate of the mass flow conveyor, but there is a difference between the value displayed on the GUI and the value obtained by the getProperty method. The value on the GUI is multiplied by 60, probably because the unit was changed from seconds to minutes.

Object mfc = Model.find("MFC1");
token.labels.assert("gfr", 60);
token.gfr *= 2;
mfc.setProperty("GenerativeFlowRate",token.gfr);
print(Model.time, "MFC", token.gfr, mfc.getProperty("GenerativeFlowRate"));


When I change the MaxSpeed of the operator in the same way, the value that can be confirmed on the GUI and the value that can be obtained with the getProperty method match without any problems.

1730968286468.png

Until this issue is resolved, we will need to select the same units as your model units.

Thanks in advance.mfc-sample.fsm

FlexSim 24.0.4
massflowconveyormass flow conveyorgenerative rate
1730968286468.png (267.3 KiB)
mfc-sample.fsm (45.4 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Shinya O commented

I am pretty sure this is working as intended. Property values are always stored in terms of model time and length units. If you select a different unit in the properties window, all that does is add a subnode that denotes as what the value should be displayed.

1730980278044.png

It works the same for task executers and fixed resources. Though if you use "setProperty()" on those, it actually removes the displayUnits node (at least in 24.2.2, maybe that is a bug).

So as you say, when setting any values in code, you always have to think in model units. There are commands to convert common units into model units to help with the math and make it apparent at a glance what the value is being set to.

https://docs.flexsim.com/en/24.2/Reference/CodingInFlexSim/CommandReference/CommandGroups.html#minutes


1730980278044.png (2.6 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

For properties that correspond to measured units, such as distance, speed, acceleration, time, etc., Object.setProperty() can take an array which specifies the units. It isn't a bug that the display units are being removed if you specify a value without display units. If you want to specify a value with display units, then pass that accordingly. Object.getProperty() also has a flag for getting the value back as an array with its units abbreviation string.

See Property Tables / Types of Properties / Unit

The GenerativeFlowRate property is a little different though. It isn't a normal Unit property. Only its denominator has a unit. The GernerativeFlowRate property is stored in model units and the Properties window converts what is displayed based on the specified display units. You need to set that property's value in model units.

Object mfc = Model.find("MFC1");
double unitsPerMin = 5.0;
mfc.setProperty("GenerativeFlowRate", unitsPerMin / minutes(1));
1 Like 1 ·
Shinya O avatar image Shinya O Phil BoBo ♦♦ commented ·

Thank you both. Both answers were helpful.

0 Likes 0 ·