question

Jouky D avatar image
0 Likes"
Jouky D asked Felix Möhlmann commented

How to link StateTables with state_current>profile of an object?

Hello,

I have created a StateTable with 8 states. However, when I want to change the state in the Process Flow of an element, I can only use the Default table.

How can I use my new State table? I tried to write the following script to change the state:

#define Default 0

Object object1 = token.MotorElevacion;

int state = 2;

int profile = Default;

object1.setState(state, profile);


changing the Default 0 value into 1 or 2 and using object1.stats.state("NewStateTable").valueString = "State3"; or object1.stats.state("NewStateTable").value = 1;

Could someone help me please?:)

FlexSim 23.0.3
statesstatetableprofile
· 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.

Andrew O avatar image Andrew O commented ·

Hi @Jouky D, 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 unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

A state table only used to influence how states are displayed/interpreted in dashboard charts. In the background the object still uses the default state profile, but the names of the states are "overwritten" by the state table in the chart.

If you want to a add an actual second state profile to an object (that runs in parallel, the object will have a state in each profile) you can follow the description in this post.

· 4
5 |100000

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

Jouky D avatar image Jouky D commented ·

I tried. I have put state_profiles inside the TaskExecuter, and when I change using setstate(object, state, profile) the state_profiles current changes, however, the name associated into that state is not shown on TaskExecuter state (it shows idle or whatever the default state_current is).

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Jouky D commented ·

The statistics panel in the properties will always show the current state in the default state profile with the name set in that profile node.

You can edit the default profile for a given object in the tree.

1677584799935.png

1677584828499.png

1677584876817.png

0 Likes 0 ·
1677584799935.png (28.1 KiB)
1677584828499.png (8.3 KiB)
1677584876817.png (6.6 KiB)
Jouky D avatar image Jouky D Felix Möhlmann commented ·
Thank you Felix for your answer. But is there a way to set the state_current table as a created State Table? Or do I have to copy and paste that table into the state_current/profile in every object?
1 Like 1 ·
Show more comments

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.