With breakpoints, you can specify where and when you want a system to pause during a simulation.
To place a breakpoint you need to Switch to Simulation Mode. Once you are in Simulation Mode you can turn on Breakpoints with the appropriate toolbar button. Right-click on the model instance where you would like to place the breakpoint and select Add Breakpoint.
There are a number of types of breakpoints. The following types are implemented in MLDesigner:
A list of all breakpoints in the active system is displayed in the Breakpoints panel in the Console View when the system is in Simulation Mode and Breakpoints are on. When you select an entry in the Breakpoints panel the model instance is highlighted in the Model Editor window. Each breakpoint has a unique ID and an Object Name. The entries Enabled and Ignore Count are editable entries. To change the settings or disable the breakpoint right-click on the item in the Breakpoints panel and choose one of the following options.
It is possible to place unconditional breakpoints on ports, modules, primitives and shared model elements such as resources and memories when MLDesigner is in simulation mode. The simulation pauses as soon as a model instance containing a breakpoint fires or an event is produced at the specified point in the simulation. You can adjust the breakpoints to ignore a certain number of firings or events before pausing the simulation by setting the value in the Ignore Count input field.
The input field Ignore Count sets the amount of times a model instance or port fires before stopping the simulation. Once the instance has fired the specified number of times, the simulation is paused. Thereafter the simulation pauses every time the model instance fires.
Sometimes a module is instantiated in a system more than once. Consider the Sine Modulator example. This demo system contains two instances of the same module. The Sine Generator module is instantiated in the Sine Modulator module and in the Sine Modulator System. Both instances of the module contain the same two primitives namely Ramp#1 and Sin#1. When you place a breakpoint on either of these two primitives, the simulation will be stopped every time the module fires. You may want the simulation to stop when the primitive in question fires within a specific model instance of the module. This means you need to change the type of breakpoint.
To change the breakpoint type, click on the appropriate breakpoint to activate the Breakpoint Properties window. Change the Module Breakpoint property from Yes to No. After that you have to select the Source Models. They define the instances where the simulation will stop in case the breakpoint is hit. If you select all then you essentially have a Module Breakpoint.
We already built a simple system containing two instances of the same module in Modeling→Developing Models. In case you skipped that part, you may use a similar system which is located at MLD Libraries→SDF→Demo and is called sinMod.
The system pauses only when the Ramp primitive in the Sine Generator contained in the Sine Modulator System fires. The module that contains the breakpoint is highlighted in the Model Editor window. In simulation mode the tool tip text facility no longer displays a name and description for the model instance but rather displays values and parameters of the model instance or input/output port. When the system is paused at a breakpoint you can see what values are on which ports in order to analyze the system or a suspected bug.
Breakpoints are, by default, set to stop the simulation every time a Dynamic Instance of a module fires. This behavior is determined by the Breakpoint Properties parameter Module Breakpoint which is set to Yes. There are two approaches to change this behavior so that the simulation only stops when specific instances fire.
The first approach is more comfortable but also takes more time, which might be a problem with long running simulations. At first you leave the Module Breakpoint parameter set to Yes, set Ignore Count to -1 and run the simulation once. Now, you set the Module Breakpoint to No which enables the Source Models property. To define the Source Models property click on the button on the right side of its input field. The Select source models dialog should now contain a list of all possible instances.
Each entry is in the form of SystemName.ModuleName#1.ModuleName#*.ModelInstance#1.port, where the asterisk (*) is replaced by an instance number. You can select one or more entries and click OK. Reset the Ignore Count to 0 or another value that applies to your needs and run the simulation again.
The other approach requires to know the possible number of instances the Dynamic Instance represents. After adding the breakpoint set the Module Breakpoint property to No. This enables the Source Models property. Open the Select source models dialog by clicking the button on the right side of the Source Models input field. The Select source models list should be empty but the Supposed model patterns list should contain entries in the form of SystemName.ModuleName#1.ModuleName#*.ModelInstance#1.port, select an entry and click Add supposed. The entry will now be in the list of source models, select it there and click OK. The final step is to edit the Source Models input field, replace the asterisk with an appropriate instance number. The instance number should be between zero and the maximum number of instances that will be instantiated during the simulation. Remove the (supposed) at the end and run the simulation.
Only entries that are selected (highlighted) when the OK button is clicked are active breakpoints.
There are a number of FSM breakpoints that can be used to stop a FSM simulation when certain model items change their state or when an entry action occurs. Each breakpoint has options that can be set in the Breakpoint Properties window. By default all options are active. To deactivate certain breakpoint conditions select NO from the drop down menu in the appropriate item in the Breakpoint Properties window.
The following options are available for State Breakpoints:
The following options are available for Transition Breakpoints:
The following options are available for History Breakpoints: