question

Gui Vaccaro avatar image
0 Likes"
Gui Vaccaro asked Jeanette F commented

Get the current state of a timetable

Hello,

I have a model that has multiple time tables. How can I know, via flexscript, what is the current state of each timetable? I tried to use something like

for( int i = 1; i <= timeTablesFolder.subnodes.length; i++ ) {
    print(timeTablesFolder.subnodes[i].as(Object).stats.state().value);
};

but I was unsuccessful.

Thank you for your support.

FlexSim 24.2.2
statetimetable
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

@Gui Vaccaro, please look into your model tree. Identify which state nodes are involved in collecting statistically data. You don’t need to guess. You need only to look into your tree structure to understand what happens. If you want a more complete understanding then open the event viewer and the event list while a model run. Maybe you step through your model run in model run dashboard.

0 Likes 0 ·
Gui Vaccaro avatar image Gui Vaccaro Joerg Vogel commented ·
Thank you, @Joerg Vogel . I did all that before posting the question. When the model starts, the time tables will schedule the down events, but there is no initialization event at time zero. This means a time table starting as uptime when the simulation starts will not schedule a state change when the model starts. After the first down event, the problem has an easy solution, but not when the model starts.
0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Gui Vaccaro, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

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

On model reset the time table schedules an event for start of the first downtime. Afterwards, at the start of the downtime, it will schedule two more events, one to end the current down item and one to start the next.

capture1.png

In theory you could query the event list to find pending events of the time table and read the state from the involved table row.

In practive I would just use the On Down and On Resume function to store the new state somewhere from where you can read it whenever needed (Global Variable, (Global) Tracked Variable, Node you add to the time table's tree, ...).


capture1.png (7.3 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.

Gui Vaccaro avatar image Gui Vaccaro commented ·
Thank you, @Felix Möhlmann , I tried that before posting the question. Your comment "in theory" worries me. Precise control and clarity of the states of objects such as time-tables is something that should be easy in FlexSim, as it is in many simulation software. I am still trying to figure it out, though.
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Gui Vaccaro commented ·

I used "in theory" because I personally have not done this before but know that it should be possible. I agree that having easier access to the current status of time tables would be great. But for now this sadly requires a custom solution from the user.

You can always post this as an idea to the forum. If enough people show interest the developers will see the demand and might implement improvements.

0 Likes 0 ·