question

Shankar Narayan avatar image
5 Likes"
Shankar Narayan asked Ben Wilson edited

How can I debug a crashing FlexSim model?

Like clockwork, my FlexSim model crashes abruptly and predictably at about simulation time 7800 seconds.

Unfortunately I cannot attach the model file.

Do you have any tips for debugging a crashing model? Any help is appreciated.

crashcrashingdebugbest practicesrepeatable
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Ben Wilson avatar image
19 Likes"
Ben Wilson answered Ben Wilson edited

Here is what our standard procedure would be if we had access to the model:

1) clean up known issues/errors. Are there ever any warnings or exceptions in the system console? If so, we track down the source of the problems and get them fixed. The Event Log may help in fixing these issues. Even though these warnings or exceptions may occur well before the time of the crash, they could still be related, and it's good practice to clean up any issues even if they are not related.

2) make the model repeatable. From FlexSim's main menu, turn on Statistics > Repeat Random Streams. Save the model with it turned on. With Repeat Random Streams turned on, make sure that the model crashes at a consistent time and note the time of the crash. If your model doesn't crash every time at the same time, your model is not repeatable. Follow the suggestions in the User Manual under Simulation Best Practices > Model Repeatability to make your model repeatable. Save the model with whatever changes were necessary to make the model repeatable.

3) find the simulation time of the crash. Open the model again, and set a stop time for some small amount of time before the crash. Run up to that point, slow the run speed, and run again, noting how far you can get before the crash. You may need to do this several times to get closer and closer to narrowing in on the exact crash time.

4) run up to the moment of the crash. Once you have pinpointed the moment of the crash, and you have run the model to some small amount of time just prior to the crash (ie. if your model crashes at time 7800.00, then set the stop time to 7799.99) - once you've run to that time just prior to the crash, open Debug > Event List to see a list of the upcoming events.

5) step to the event of the crash. Step through each scheduled event using the run controls' Step button, carefully noting which event is at the top of the list about to execute.

6) note the crash event. On one of the events, FlexSim should crash. Hopefully you took careful note of which event that was.

7) find and debug the event. Repeat steps 4-5, up until the very next step will crash FlexSim. What is the crashing event? Is there any custom code that fires as a result of that event? If so, put a breakpoint at the top of that code and then hit step to execute the next event, then debug the code.

8) track down a hiding issue. If there is no code that fires on that specific event, does that event spawn other events that happen simultaneously where there may be custom code? For instance, if the event is entry to a queue, the exit to the queue and entry to the next object down stream can all happen on the same event. Mentally follow the execution path of the event known to crash FlexSim - what else does it cause to happen immediately? Is there any custom logic along any step of that execution trail?

After you go through these steps, if you still haven't found the bug, you will at least be much closer and have a good idea of the origination of the problem. It may be that you could create a smaller sample model to send in that exhibits the same problem. Or it may be a good foundation in starting a web meeting with a member of our team to find the issue. Please contact us if you get to that point and are ready to schedule something.

· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.