question

AMIT KUMAR avatar image
0 Likes"
AMIT KUMAR asked Jeanette F commented

On State Change - Processor

In processor while working with trigger on state change i am not getting the option to write on global table which is there for other options like On Entry or On Exit

1681471179242.png

FlexSim 20.0.10
onstatechange
1681471179242.png (300.9 KiB)
· 1
5 |100000

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

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @AMIT KUMAR, was one of Jason Lightfoot's or Joerg Vogel's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. 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 unaccept and comment back to reopen your question.

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

Then you can try to copy the template source code from a trigger that supports this picklist item.

· 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.

AMIT KUMAR avatar image AMIT KUMAR commented ·

How should we do that? I want all the options which are available for On Entry trigger or specific one like add row column and add data to global table


Thanks

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ AMIT KUMAR commented ·

Use a code snippet and refer to the methods and examples of the Table class - it's much simpler than you might think.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel AMIT KUMAR commented ·
@AMIT KUMAR, You add this picklist option to the on entry trigger. You open the parchment roll icon to open the source code editor. You copy the source code. Then you add an On State Change trigger. You open the source code editor for this trigger by the parchment roll icon. You paste the copied source code.
0 Likes 0 ·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered AMIT KUMAR commented

How to reference tables and write to their cells. The syntax is :

Table(<tablename>)[<row>][<col>]=<value>

//example:
Table("MyGlobalTable")[1][4]=10;   //writes the value 10 into row 1 column 4 of the global table "MyGlobalTable"

Be careful with onStateChange as you may get many different values being written at the same time. If you're overwriting a cell each time then it should not matter.

· 1
5 |100000

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

AMIT KUMAR avatar image AMIT KUMAR commented ·

I want to write down every time a processor goes into breakdown or blocked mode also want to capture the start time & end time of that state for the machine in a global table

e.g

machin name col1.

state col2

start time col3

end time col4


and number of rows will be added every time the machine goes to blocked or breakdown row is added to global table

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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