I am getting an error saying to try profiling the Task Sequence profiletasksequence(). I did a search on this command and find no reference in the index. Any idea what this is and how to use it?
I am getting an error saying to try profiling the Task Sequence profiletasksequence(). I did a search on this command and find no reference in the index. Any idea what this is and how to use it?
Thanks @Kari Payton seems like we are working through similar issues!
You can find command documentation using the menu options Help > Commands or Help > Command Helper.
I'll add a case to the dev list to improve the User Manual's search so that you can find command documentation from there as well.
Attached is a sample model that I built with ProcessFlow to demonstrate how you can get these types of errors and how you can debug them.
If you open the attached model and run it, you will see exceptions in the System Console. This is the first debugging tool that FlexSim gives you to alert you that something bad happened in your model. The exceptions may look cryptic, but there is a lot of useful information printed in them that can help you debug what is wrong and give you a hint as to how to fix it.
For example, this model prints:
time: 67.325266 exception: Exception Caught in FixedResource::getItemInfo(treenode flowitem) time: 67.325266 exception: Exception Caught in FixedResource::setItemState(treenode flowitem, int state) time: 67.325266 exception: Exception Caught in FixedResource::releaseItem(treenode item) object: /Processor1 time: 67.325266 exception: Exception Caught in Processor::onTimerEvent(treenode involved, int code, char *datastr) object: /Processor1 time: 67.325266 exception: Exception Caught in ObjectFunction251__project_library_FlexSimObject_behaviour_eventfunctions_OnTimerEvent object: /Processor1 class: /Processor1
That exception print is a call stack. It has lots of interesting information in it:
When you take that information together, we can get a picture that at time 67.325266, Processor1 is trying to release an item, but it can't access that item's properties. The release could be happening due to a number of different things. If we set a stoptime of 67.32 and run to that time, we can look at the processor and see that it has no items in it. If we open Debug > Event List, we can see that the Processor has a Process Finish event at time 67.325266. When we step through that event, the exception fires.
So what happened to the item?
This is the point where knowledge of what you were just changing in your model is helpful. I built this model so I know that I just recently added a Process Flow that had task sequences that load partially finished items from Processor1 and unloads them to Processor2. As it turns out, the way I'm doing that is causing an exception when Processor1 tries to finish processing the item that I stole from it using ProcessFlow before it was finished processing. That item has subsequently finished processing at Processor2 and been dropped into a sink, destroying it. This then leaves an empty reference to the item when Processor1 tries to execute its event to finish processing that item, which throws an exception. So I should change the logic in my model to avoid this error. Perhaps I shouldn't be taking items out of a processor mid-process. Or if I do, I need to somehow tell the Processor to destroy the events it has pending for that item.
But what does this have to do with profiletasksequence()?
If we run the model longer, we will see this error message appear:
What is happening here, now?
Again, we have some clues to figure out what is going on:
To get more information, we have a few options.
First, we could open Debug > Output Console and Debug > Script Console. In the Script window, we can execute the following code to profile Operator1's active task sequence:
profiletasksequence(gettasksequence(model().find("Operator1"),0));
This prints the following information in the Output Console:
Task Sequence: Total number of tasks = 3, Priority = 0, Preempt = None Currently active task = 3, Tasks left to finish = 1 Load involved1: invalid pointer involved2: Processor1 var1: 0.00 var2: 0.00 var3: 0.00 var4: 0.00 Travel involved1: Processor2 involved2: NULL var1: 0.00 var2: 0.00 var3: 0.00 var4: 0.00 ACTIVE >>> Unload involved1: invalid pointer involved2: Processor2 var1: 0.00 var2: 0.00 var3: 0.00 var4: 0.00
Second, we could go look at that same information directly in the tree. We can use the Tree view to look at Operator1's active task sequence:
This gives us the same information, but without using the script window to execute commands.
So what clues do we get here? Almost the same information as the error message with one key detail: we have the whole task sequence instead of just the erroneous task.
We can see that this task sequence is a Load > Travel > Unload task sequence, and that the Load is to Processor1 and the Unload is to Processor2.
This is the point where knowledge of what you were just changing in your model is helpful. If we go look at the process flow, we can see where we create a task sequence that looks like this. The involved1 as an "invalid pointer" is not what we want. We are trying to load an item. So what's wrong?
The same thing is wrong here that was wrong above, except now it is on the other end. We are trying to load and unload an item that was previously processed at Processor1 and then sent to the Sink. That item has been destroyed so the task is throwing an error message. We need to adjust the model's logic so that we're not trying to do things to items that might have already been destroyed.
This is just an example to help teach how to debug such error messages. Hopefully this is helpful to you and anyone else who may be struggling with how to debug such errors.
If you still can't figure out what is happening in your model by following similar steps to those I showed here, please post your model (or a small sample model showing the issue) and we can help you debug it. You can post it in a private question if it contains sensitive information.
10 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved