debug simevents models -凯发k8网页登录

main content

debug simevents models

a breakpoint is a point of interest in the simulation at which the debugger can suspend the simulation. simevents® debugger allows you to inspect entities, set breakpoints based on entities leaving or entering storage elements, and step to events.

to enable debugging for a simevents model, add the block to the model. when you click step forward in the simulink® toolstrip, the simevents debugger displays.

the explorer pane contains these nodes:

  • event calendar — maintains a list of current and pending events for the model. select the break before event execution check box to display event breakpoints on the breakpoints node.

  • breakpoints — lists the breakpoints previously set for the model. you can view breakpoints set for the block, on event calendar, and for watched entities.

  • storage — displays the entity inspector listing all the storage blocks in the model and check boxes that let you select breakpoints. blocks that contain entities are denoted with .

    to set breakpoints for post entry and pre-exit of entities, select the postentry break and preexit break check boxes.

  • entity queue — displays the entity inspector listing the entities and attributes associated with that block.

simevents debugger is used in the modeling hybrid systems - tank filling example to step through the model simulation, to set breakpoints, and to explore the event calendar.

the simevents software also provides an api that helps you to create your own visualization and debugging tools. for more information, see .

start the debugger

  1. open the modeling hybrid systems - tank filling example.

  2. into the simulink editor, add the simevents debugger block at the top of the tank filling station model.

  3. to start the debugger, in the simulink editor toolstrip, click the step forward button.

    the debugger displays in a paused state.

  4. to step to the next event, click .

    note

    you can also click continue () to have the debugger continue the simulation. however, doing so without setting breakpoints causes the simulation to complete and the debugger to close.

  5. the debugger pauses at the next event and displays it in the event calendar. the current event is highlighted in green.

step through model

  1. to look at the current and scheduled events, click the event calendar1 item. to set breakpoints, you can select the break before event execution check box. the debugger hits the breakpoint before the next scheduled event. this breakpoint is for any event type, including forward, generate, servicecomplete, gateway, destroy, and trigger. do not select this check box now.

  2. to inspect the attributes of an entity, click the fill this tank storage element in the explorer pane.

  3. the inspector pane shows a table with the entity sys.id. to track the entity as the model simulates, click the associated check box.

  4. to set breakpoints for when this entity enters and leaves the block, at the bottom of the inspector pane, select the two check boxes break upon entity entry and break prior to entity exit.

    alternatively, to set the breakpoints on storage blocks all at once, click the storage item in the explorer pane. notice that the fill this tank block is highlighted because it contains entities.

    select the postentry break check boxes for the blocks you want in this table.

  5. to progress to the next event, click .

  6. click continue. simulation continues until the next postentry or preexit event.

    the block associated with the breakpoint is highlighted.

  7. step to the next event.

    the next breakpoint at which the debugger stops is highlighted in the event calendar.

  8. continue the simulation.

    the simulation stops at the entity you opted to watch. as you continue the simulation or step through the model, the debugger stops at the various breakpoints and watchpoints that you set, letting you explore the model simulation.

  9. to inspect the entities in a currently selected block in the model, select the block in the model, then click the inspect gcb button ().

    the inspector pane displays the current details of the entities in this block.

    you can continue to set entity watchpoints and event breakpoints.

to list select blocks, events, or entities, type their names in the search boxes at the top of the explorer or inspector panes.

the simevents software also provides a programmatic interface that lets you create your own simulation observer or debugger. for more information, see .

see also

related topics

网站地图