Tip #004 - How To Debug A Model? index

When building complex models it’s almost impossible to get them exactly right the first time. The following tips can help you discover the errors and pinpoint the problem areas.

  • Set the screen refresh rate to every 1 unit in View | Animation. This allows you to see the clock update and slow the model down.


  • Toggle the ‘Repetitive’ button ON in the Model | Random Generators window. Using the same random number stream over and over makes the behaviour of the model exactly the same every time. This way you will know that any changes in observed behaviour are a result of modifications you made to the model and not the effect of a different random number stream.


  • Stop the simulation run by clicking the TLI button on the Simulation control dialog box. Use the following TLI variables and others to check the operation of the model:
    • status[x] (1=busy, 2=idle, 3=blocked, etc.)
    • att1[x]
    • produced[x]
    • time
    • elqueue[x]
    • laststagesend[x]
    • curcycle[x]
    • timespent[x]


  • Write a function called usertli which can be executed on command during the simulation. Be sure to toggle the ‘Popup’ button in Settings | Simulate. This function can display several TLI variables at once so that you do not need to keep typing in the same variables over and over during the simulation. The following is an example of a usertli function that returns information about transporters. To execute the usertli function you simply click the "user" button in the simulation control box that pops up during a simulation run.

  • function usertli

    • p1:=input["Transporter element number"]
    • tspassigned[p1]
    • spelemdest[p1]
    • tspelemdestloc[p1]
    • curpath[p1]
    • curpathpos[p1]