How to read nodes with the DATATYPE_SIMPLE

How to read nodes with the DATATYPE_SIMPLE

MBJEBZSRG
Advocate Advocate
44 Views
4 Replies
Message 1 of 5

How to read nodes with the DATATYPE_SIMPLE

MBJEBZSRG
Advocate
Advocate

[ FlexSim 16.2.0 ]

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

3107-datatype-simple.png

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.

Accepted solutions (1)
45 Views
4 Replies
Replies (4)
Message 2 of 5

matt_long
Not applicable
Accepted solution

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);
Message 3 of 5

MBJEBZSRG
Advocate
Advocate

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
Message 4 of 5

matt_long
Not applicable

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
Message 5 of 5

jing_chen
Not applicable

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

0 Likes