ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 07-21-2012
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default 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.
Attached Thumbnails
Click image for larger version
Name:	state_profiles_example.jpg
Views:	253
Size:	19.9 KB
ID:	1873  
Attached Files
File Type: fsm state_profiles example.fsm (95.2 KB, 174 views)
__________________
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  
Old 07-22-2012
Carsten Seehafer's Avatar
Carsten Seehafer Carsten Seehafer is offline
FlexSim Geek
 
Join Date: Oct 2008
Location: Ritterhude, Deutschland
Posts: 230
Downloads: 45
Uploads: 1
Thanks: 474
Thanked 320 Times in 143 Posts
Rep Power: 379
Carsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud of
Default

I've tried to open your model:

Quote:
Originally Posted by System Console
exception: Tree file format is not compatible with this version of Flexsim
I'm using Version 6.0.0.

Greetings

Carsten
The Following 2 Users Say Thank You to Carsten Seehafer For This Useful Post:
Jörg Vogel (07-23-2012)
  #3  
Old 07-23-2012
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Quote:
Originally Posted by AlanZhang View Post
The sample model was tested in Flexsim 6 (Engine version 6.0.0).
Quote:
Originally Posted by System Console
exception: Tree file format is not compatible with this version of Flexsim
In version 6, we made some changes to the tree structure that made it incompatible with previous versions of Flexsim, but we forgot to increment the tree version flag in the engine.

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  
Old 07-23-2012
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

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  
Old 07-25-2012
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

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  
Old 07-25-2012
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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)



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.