Setting Custom State which is not in the list?

Setting Custom State which is not in the list?

rajankur6494
Collaborator Collaborator
256 Views
8 Replies
Message 1 of 9

Setting Custom State which is not in the list?

rajankur6494
Collaborator
Collaborator

[ FlexSim 23.1.0 ]

Hi Team,

I am trying to set the AGV in the custom state "Charging" which is not available in the list. I am using custom code directly as below:

1689582333468.png

But my code is not making any impact.

What is the quickest way to do it?

0 Likes
Accepted solutions (1)
257 Views
8 Replies
Replies (8)
Message 2 of 9

moehlmann_fe
Advocate
Advocate
Accepted solution

You are probably missing a Breathe (0s delay) between the latest task and the activity that sets the state.

0 Likes
Message 3 of 9

jason_lightfoot_adsk
Autodesk
Autodesk
Note that using this method places 'Charging' as state 23 to which the STATE_FULL macro already refers. This is fine for a small model that you control completely but it should be documented that this has been repurposed. In a larger, collaborative model or library it might be better to avoid this method and use your own stateprofile where you define all the states, or write to the developers to suggest that new states are added after ALL the predefined ones (so 51 and on).
0 Likes
Message 4 of 9

rajankur6494
Collaborator
Collaborator

Hi @Felix Möhlmann,

I just checked it is setting the state, but it is not shown in bar chart as other preexisting states are shown.

1689586398430.png

Whether I am missing anything?

Thank you!

0 Likes
Message 5 of 9

jason_lightfoot_adsk
Autodesk
Autodesk

Check which state table it's using and edit that to show your state. If that doesn't fix it post your model so we can see what you're doing.

0 Likes
Message 6 of 9

rajankur6494
Collaborator
Collaborator

Hi @Jason Lightfoot,

It is showing "Accumulating" state in chart instead of charging.

1689596202372.png

1689596226593.png

Please have a look here.

17.07.2023_Setting_AGV_State.fsm

0 Likes
Message 7 of 9

moehlmann_fe
Advocate
Advocate

As Jason wrote, when you add a new state the way you did (by using a string value to set the state) this state will be added at the next available number in the state profile. By default, a task executer has 22 states (up to "busy"). Since you apparently already used "waiting", the states up to that were added to the TE along side it, so your TE had 49 states in its profile.

As such, the new "Charging" state was added as the 50th state.

capture.png

The Statistics Collectors that deal with states only use the numerical value from the profile. The name is taken from the connected State Table. The State Table in your model uses the defautl arrangement in which state 50 (the last default state) is called "Accumulating".

capture2.png

Again, as Jason already said, change the display name in the State Table to your desired value to have it show up in the chart.

0 Likes
Message 8 of 9

rajankur6494
Collaborator
Collaborator
Ok. @Felix Möhlmann


Thank you for the clarification!

0 Likes
Message 9 of 9

julie_weller
Not applicable

Hi @Ankur A3, 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