tasks.textile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. h1. Tasks
  2. h2. Modeling a statemachine
  3. # Make sure the YAKINDU Modeling perspective is active.
  4. # Create a new project.
  5. # Click *File* > *New* > *Other...* > *YAKINDU* > *YAKINDU Statechart Model*.
  6. # Click *Next* name the sct file and click *Finish*
  7. # The YAKINDU statechart editor opens on the statechart model. It already has an initial state and an unnamed simple state connected by a transition.
  8. # Now you can add states and transitions from the palette.
  9. To edit the states and transitions you can use the properties view. It has an integrated Xtext support. This makes correct editing easier. You can also change the appearance of the model elements.
  10. On the palette you will also find a composite submachine state. This is a state that contains a complete statemachine. You can choose an existing statemachine or create a new one.
  11. h3. Related topics
  12. "Xtext JFace Integration":http://127.0.0.1:50304/help/topic/org.yakindu.sct.doc.user/help/02_Getting_Started/getting_started.html?path=0_1_9#XJI
  13. "Statemachine Elements reference":http://127.0.0.1:50304/help/topic/org.yakindu.sct.doc.user/help/05_Reference/reference.html?path=0_4_0#Statechartelements
  14. "SText Reference":http://127.0.0.1:50304/help/topic/org.yakindu.sct.doc.user/help/05_Reference/reference.html?path=0_4_1#SText
  15. h2. Validating a statemachine
  16. The statemachine is validated automatically during build. The elements that cause problems get error markers. You can find the details about the problems on the problems view.
  17. h2. Simulating a statemachine
  18. The YAKINDU simulation engine supports simulation modes:
  19. * event driven
  20. * cycle based
  21. The default setting is _cycle based_ with a cycle period of 300 ms. In this mode the simulation engine processes the state machine transitions in steps of the given cycle duration. The following statechart illustrates this. It is simulated cycle based with a cycle period of 3 seconds.
  22. !images/cycleBasedVsEventDriven.png!
  23. What happend during simulation is the following:
  24. # After 3s *init* switches to *pre1*
  25. # After 3 further seconds recursive transition to *pre1* is processed (not after 2s the transition says)
  26. # After 3 further seconds recursive transition to *pre1* is processed again and the condition becomes *true* so *result* gets activated
  27. In contrast to cycle based the event driven simulation mode concentrates on the events of a state machine. The same state machine above could be simulated as follows:
  28. # Immediately *init* switches to *pre1*
  29. # Immediately the event *touch* is raised twice
  30. # The condition becomes true so that the *result* state is reached after 2 or 3 seconds instead of 9
  31. Start a simulation with the different modes as follows
  32. # Make sure the YAKINDU Simulation Perspectiv is opened.
  33. # Start the simulation by clicking *Run* > *Run Configurations...*.
  34. # Select the statechart you want to simulate and the simulation mode.
  35. # *Apply* the setting and *Run* the simulation.
  36. !images/simulationRunConfiguration.png!
  37. "Simulation Concept":http://127.0.0.1:50051/help/topic/org.yakindu.sct.doc.user/help/03_Concepts/concepts.html?path=0_2_1#Simulation
  38. "Simulation perspective":http://127.0.0.1:50051/help/topic/org.yakindu.sct.doc.user/help/02_Getting_Started/getting_started.html?path=0_1_2#YakinduSCSimulationperspective
  39. "Simulation View":http://127.0.0.1:50051/help/topic/org.yakindu.sct.doc.user/help/02_Getting_Started/getting_started.html?path=0_1_6#SimulationView
  40. h2. Generating C code
  41. * creating project
  42. * modifying genmodel
  43. h2. Generating Java code
  44. * creating project
  45. * modifying genmodel