Skip to content

Automatic animation

Zhentao Lu edited this page Mar 30, 2018 · 7 revisions

This section is showing how to do automatic animation.

  1. Create a new project and add a new block in BDD (Block definition diagram)

  2. Add a new state diagram to the block (right click the block and select Add New -> Statechart)

  3. Add a new reception in the block (right click the block in browser and select Add New -> Blocks -> Reception)

  4. Fill in the reception event name and select Yes to create new one

  5. Create two more using the same method (right click the Operation package and select Add New -> Reception)

  6. Add four state in the state diagram and one initial point and end point

  7. Connect the state and set the trigger (add transition line then right click and select Feature… then select a reception in Trigger)

  8. Add trigger in same method to another two transition lines

  9. Initialize the block (in BDD right click the block and select Make an Object)

  10. Open the component configuration window (expand the Component package and right click the DefaultConfig then select Feature…)

  11. Choose correct settings (click the Settings label and select Animation for Instrumentation mode and select Web Enabling then click OK)

  12. Execute the model (click the Generate/Make/Run button and click Yes to create the directory)

  1. Run the model (click the run button)

  2. Open the animated diagram (select Tools -> Animated Statechart and select initialized block in the new window then click OK)

  3. Verify the action (click the Event Generator and select the first reception to trigger the transition of state then click Generate)

  4. Verify the other two actions (select second and third reception then click Generate)

  5. End the animation (click Stop button)

  6. Add an configuration file for automatic animation (create a file - omanimator.cfg in Rhapsody project folder)

  7. Add code for automatic animation in the file (use text editor to open the file and add code then save it and close the file)

Code:

//================================================

// Run with animation off to create all objects

go idle

// Switch animation back on

display

System->GEN(sysevent1())

go idle

System->GEN(sysevent2())

go idle

System->GEN(sysevent3())

//go event

go idle

go idle

// Run continuously

go

  1. Run Rhapsody model again (click the Run button then model will be executed and all events will be automatically triggered)

Reference: https://www.ibm.com/support/knowledgecenter/SSB2MU_8.2.1/com.ibm.rhp.animation.doc/topics/rhp_r_dm_animtn_scripts_cmmd_types.html

Clone this wiki locally