SIMUL8 Tip – Remember the current Work Item
(Relevant for advanced SIMUL8 users)
When working on a simulation, there may be some instances when some of the code you write changes the focus of your Work Item. Commands such as ‘copy current Work Item to queue’, ‘Add work to queue’ and ‘Select current Work Item’ change the focus of your Work Item. If that is the case, you may need to return to the original Work Item for additional logic.There is a very simple and fast way of doing so in SIMUL8.
- Create a variable (of type number), e.g. gblWorkItem
- Remember the original work item using the following command ‘SET gblWorkItem = Current Work Item’
- Typing ‘Current work item’ is a special command that will return a unique number that identifies the currently selected Work Item
- So if you then run some logic that changes the focus of your work item (i.e. unselects that Work Item) then simply run the inverse command to change the focus back to the original work item: ‘SET Current Work Item = gblWorkItem’