Presentation on theme: "NCKU EE RTES LAB.1 Unified Modeling Language - Events and State Machines."— Presentation transcript:
NCKU EE RTES LAB.1 Unified Modeling Language - Events and State Machines
NCKU EE RTES LAB. 2 Events An events is the specification of a significant occurrence that has a location in time and space. In the UML, there are four kinds of events: signals calls the passing of time a change in state
NCKU EE RTES LAB. 3 A signal represents a named object that is dispatched asynchronously by one object and then received by another. Signals have a lot in common with plain classes. A call event represents the dispatch of an operation. A call event is synchronous. Signals an Call Events
NCKU EE RTES LAB. 4 Signals and Call Events A signals may be sent as the action of a state transition in a state machine or the sending of a message in an interaction. When an object invokes an operation on another object, control passes from the sender to the receiver, the operation is completed, control returns to the sender. MovementAgent position velocity moveTo() > Collision force:Float > Manual Automatic startAuotopilot(normal)
NCKU EE RTES LAB. 5 Signals and Call Events Any instance of any class can send a signal to or invoke an operation of a receiving object. When an object sends a signal, the sender dispatches the signal and then continues along its flow of control, not waiting for any return from the receiver. When an object calls an operation, the sender dispatches the operation and then waits for the receiver.
NCKU EE RTES LAB. 6 Time and Change Events after - A time event is an event that represents the passage of time. when - A change event is an event that represents a change in state or the satisfaction of some condition. Idle Active after (2 seconds) / dropConnection() when (11:49PM) / selfTest()
NCKU EE RTES LAB. 7 State Machine Interaction can model the behavior of a society of objects that work together. State machine can model the behavior of an individual object. A state machine is a behavior that specifies the sequences of states an object goes through during its lifetime in response to events.
NCKU EE RTES LAB. 8 Terms A state is a condition or situation during the life of an object during which it satisfies some condition, performs some activity, or waits for some event. In the context of state machines, an event is an occurrence of a stimulus that can trigger a state transition. A transition is a relationship between two states indicating that an object in the first state will enter the second state.
NCKU EE RTES LAB. 9 States Name – a textual string Entry/exit actions – actions executed on entering and exiting the state Internal transitions – transitions that are handled without causing a change in state Substates – the nested structure of a state Defferred events – a list of events that are not handled in that state but, are postponed and queued for handling by the object in another state Initial and final states
NCKU EE RTES LAB. 10 Transitions Source state – the state affected by the transition Event trigger – the event whose reception by the object in the source state makes the transition eligible to fire Guard condition – a boolean expression that is evaluated when the transition is triggered by the reception of the event trigger Action – an executable atomic computation Target state – the state that is after the completion of the transition Note: A change of state is said to fire.
NCKU EE RTES LAB. 11 IdleSearchingEngaging Tracking Engaging After (2 seconds) / send c.isAlive noise contact targetAt(p) [isThreat] / t.addTarget(p) time event send signal self-transition event trigger triggeriess transition event trigger with parameters guard condition action
NCKU EE RTES LAB. 12 Cooling Idle Activating Active tooCold(desiredTemp) shutDown tooHot(desiredTemp) atTemp tooHot(desiredTemp) tooCold(desiredTemp) atTemp Heating ready/turnOn() event initial state state final state event parameter event state transition nested state