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.

  1. Object mfc = Model.find("MFC1");
  2. token.labels.assert("gfr", 60);
  3. token.gfr *= 2;
  4. mfc.setProperty("GenerativeFlowRate",token.gfr);
  5. 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.