question

martin.j avatar image
1 Like"
martin.j asked jing.c commented

How to read nodes with the DATATYPE_SIMPLE

I am attempting to read statistics information form a process flow activity. see image below

In the stats/instances/[instance] I find a number of nodes with DATATYPE_SIMPLE that contain statistics data for the activity. Using getnodenum(node) I can read the Input and Output nodes, but the tokens node contains the information seen above, and a getnodenum() call returns only 0.

Is there a way to read this information, to get the Size: value for instance? I am not only interested in this specific situation but more generally on how to acces the DATATYPE_SIMPLE. I see it used several places throughout Flexsim, but so far much of it is inaccessible.

FlexSim 16.2.0
statisticsdatatypegetnodenumread simple data
datatype-simple.png (10.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

Matt Long avatar image
4 Likes"
Matt Long answered jing.c commented

Generally we would recommend not reading data directly from these nodes as their structure and naming could change, breaking old models. For gathering statistics, you should use the getstat() command.

However, there are two commands that can be used to get and set data on a SimpleDataType (SDT).

getsdtvalue(sdtNode, "valName");
setsdtvalue(sdtNode, "valName", value);
· 3
5 |100000

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

martin.j avatar image martin.j commented ·

So based on the above example, the code should be:

getsdtvalue(sdtNode,"Size"); 
or getsdtvalue(sdtNode,"Size:");

I have tried It - it doesn't work it always returns 0.

0 Likes 0 ·
Matt Long avatar image Matt Long martin.j commented ·

Yes, looks like nothing is accessible in that SDT node. As stated before, you should use the getstat() command which would look like this:

treenode activity = getactivity("FixedResource", "ActivityName");
getstat(activity, "Content", STAT_CURRENT, current);

Where current is the instance owner object, which in your case is Line 2 - RWA.

0 Likes 0 ·
jing.c avatar image jing.c martin.j commented ·

Hi Martin, this answer may help you ☺How to get RN data?

0 Likes 0 ·