ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
How to use state_profiles
Collecting model-specific states is an import and frequent task for models. FlexSim 6 provided a new mechanism called state_profiles to allow modelers to accomplish this task much easier than before. However, it seems the help doc does not provide enough information on how to use this great feature. I could not find it in this user forum by searching "state_profiles". So I wrote some simple instructions and made a simple model to illustrate the feature.
The basic idea is to create a treenode state_profiles in object's attribute. Then using setstate command, you can specify which state_profile to use. A related good feature is that you can use Dashboard to view state statistics in the user-defined state profile on the fly. The secrete of using state_profiles is to create the right tree structure required. I created a simple sample model to illustrate the concept, as attached. Here are simple steps for creating the sample model using state_profiles (see a complete state_profiles treenode example in the attached picture.) 1. Right after the object's (in my sample model, Processor2) ">stats/state/state_profile", create a node called state_profiles 2. In state_profiles, you can create more than one profiles. 3. To create one profile, create a node in state_profiles, name it say “profile1”. 4. In profile1, create three subnodes. 5. Name the first subnode “state_current”, and add number data to the node 6. Name the second subnode “state_since”, and add number data to the node 7. Name the third subnode “state_profile”, add text data to the node and the text “States”. 8. In state_profile, you can add as many states as you want. Each state is one subnode under state_profile with the node name being state name and its number data being the cumulative time for that state. 9. In my example, I create a two states, namely "idle", and "busy". The sample model was tested in Flexsim 6 (Engine version 6.0.2). To using state_profiles, it requires models to manipulate FlexSim model tree in its expected way. Perhaps in the future, some command can be added to create user-specified state_profiles without manipulating the tree directly. Hope this can save some time for those models looking for help of this feature.
__________________
Best, Alan Last edited by AlanZhang; 07-23-2012 at 01:28 PM. |
The Following 9 Users Say Thank You to AlanZhang For This Useful Post: | ||
Steven Hamoen (07-21-2012) |
#2
|
||||
|
||||
I've tried to open your model:
Quote:
Greetings Carsten |
The Following 2 Users Say Thank You to Carsten Seehafer For This Useful Post: | ||
Jörg Vogel (07-23-2012) |
#3
|
||||
|
||||
Quote:
Quote:
On the stable branch in our development repository, I have fixed that bug by incrementing the version flag correctly. This makes it so that old versions of Flexsim properly give an error instead of crashing when trying to open new tree files. Anthony is using a branch of our development repository that has both stable bug fixes and new developments. My guess is that Alan built this sample model using this branch because he is working closely with Anthony right now. The "About FlexSim" screens in our development repository aren't updated until we create an installer so Alan's version probably still says 6.0.0 even though it isn't the 6.0.0 release. Alan's sample model will work properly with 6.0.2, which I plan to release by the end of this month. |
The Following 3 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Steven Hamoen (07-23-2012) |
#4
|
||||
|
||||
I changed the version in the original to 6.0.2. But I think you should be able to create your own model following the instructions in version 6.0.0 since it is a 6.0.0 feature. Sorry about the confusion.
__________________
Best, Alan |
#5
|
||||
|
||||
Thanks Alan,
The only thing I would add is, you probably shouldn't name the three sub-nodes of profile1 "state_current", "state_since", and "state_profile" because those are the same names as the default state attributes, which means if your state_profiles attribute just happens to appear before the standard state_profile, state_current, and state_since attributes in the attributes tree, the object will bind to those instead of the standard attributes, which would cause problems. I would instead just name them "current", "since", and "profile". |
#6
|
|||
|
|||
To get started, make the object you want to add these to 'so()', and then run the script:
createcopy(state_profiles(node("/MultiProcessor",library())),node(">stats/state",so()),1) Then start renaming /adding states as needed. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Jörg Vogel (06-14-2014) |