Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.etrice.tutorials.simulators.trafficlight.example/demomodel/step3/trafficlight.room')
-rw-r--r--examples/org.eclipse.etrice.tutorials.simulators.trafficlight.example/demomodel/step3/trafficlight.room358
1 files changed, 0 insertions, 358 deletions
diff --git a/examples/org.eclipse.etrice.tutorials.simulators.trafficlight.example/demomodel/step3/trafficlight.room b/examples/org.eclipse.etrice.tutorials.simulators.trafficlight.example/demomodel/step3/trafficlight.room
deleted file mode 100644
index 7aea04317..000000000
--- a/examples/org.eclipse.etrice.tutorials.simulators.trafficlight.example/demomodel/step3/trafficlight.room
+++ /dev/null
@@ -1,358 +0,0 @@
-RoomModel TrafficlightModel {
-
- import room.basic.types.* from "../../../org.eclipse.etrice.modellib.java/model/Types.room"
- import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib.java/model/TimingService.room"
- import room.basic.service.tcp.* from "../../../org.eclipse.etrice.modellib.java/model/TcpService.room"
-
- LogicalSystem TrafficlightLogSys {
- SubSystemRef subsystem:SubSys
- }
- SubSystemClass SubSys {
- ActorRef application:Application
- ActorRef timingService: ATimingService
- LayerConnection ref application satisfied_by timingService.timer
- LogicalThread defaultThread
- }
- ActorClass Application {
- Structure {
- ActorRef controller: TrafficLightController
- ActorRef coordinator: TrafficLightCoordinator
- ActorRef tsCommands: TrafficLightCommands
- Binding coordinator.controller and controller.fct
- Binding controller.tlCommands and tsCommands.fct
- }
- Behavior { }
- }
-
- ActorClass TrafficLightCoordinator {
- Interface {
- conjugated Port controller [*]: PTrafficLightController
- }
- Structure {
- external Port controller
- SAP timeout: PTimer
-
- }
- Behavior {
- StateMachine {
- Transition init: initial -> Idle { }
- Transition tr0: Idle -> Running {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr1: Running -> Off {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr2: Off -> Running {
- triggers {
- <timeout: timeout>
- }
- }
- State Idle {
- entry {
- "timeout.startTimeout(3000);"
- }
- }
- State Running {
- entry {
- "timeout.startTimeout(20000);"
- "controller.setOn();"
- }
- }
- State Off {
- entry {
- "timeout.startTimeout(20000);"
- "controller.setOff();"
- }
- }
- }
- }
- }
-
- ActorClass TrafficLightController {
- Interface {
- Port fct: PTrafficLightController
- conjugated Port tlCommands: PTrafficLightCommands
- }
- Structure {
- external Port fct
- external Port tlCommands
- SAP timeout: PTimer
- }
- Behavior {
- StateMachine {
- Transition init: initial -> InitCommands { }
- Transition tr0: InitCommands -> tp0 of Blinking {
- triggers {
- <doneInit: tlCommands>
- }
- }
- Transition tr1: Blinking -> tp0 of Working {
- triggers {
- <setOn: fct>
- }
- }
- Transition tr2: Working -> tp0 of Blinking {
- triggers {
- <setOff: fct>
- }
- }
- State InitCommands {
- entry {
- "tlCommands.startInit();"
- }
- }
- State Blinking {
- entry {
- "tlCommands.carYellow();"
- }
- exit {
- "timeout.kill();"
- }
- subgraph {
- Transition tr0: my tp0 -> On
- Transition tr1: On -> Off {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr2: Off -> On {
- triggers {
- <timeout: timeout>
- }
- }
- EntryPoint tp0
- State On {
- entry {
- "tlCommands.carYellow();"
- "tlCommands.pedRed();"
- "timeout.startTimeout(500);"
- }
- exit {
- "tlCommands.carOff();"
- "tlCommands.pedOff();"
- }
- }
- State Off {
- entry {
- "timeout.startTimeout(500);"
- }
- }
- }
- }
- State Working {
- subgraph {
- Transition tr0: my tp0 -> AllRed
- Transition tr1: AllRed -> CarGreen {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr2: PedGreen -> AllRed {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr3: CarGreen -> CarYellow {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr4: CarYellow -> CarRed {
- triggers {
- <timeout: timeout>
- }
- }
- Transition tr5: CarRed -> PedGreen {
- triggers {
- <timeout: timeout>
- }
- }
- EntryPoint tp0
- State AllRed {
- entry {
- "tlCommands.carRed();"
- "tlCommands.pedRed();"
- "timeout.startTimeout(1000);"
- }
- }
- State CarGreen {
- entry {
- "tlCommands.carGreen();"
- "timeout.startTimeout(3000);"
- }
- }
- State CarYellow {
- entry {
- "tlCommands.carYellow();"
- "timeout.startTimeout(1000);"
- }
- }
- State CarRed {
- entry {
- "tlCommands.carRed();"
- "timeout.startTimeout(1000);"
- }
- }
- State PedGreen {
- entry {
- "tlCommands.pedGreen();"
- "timeout.startTimeout(3000);"
- }
- }
- }
- }
- }
- }
- }
-
- ActorClass TrafficLightCommands {
- Interface {
- Port fct: PTrafficLightCommands
- }
- Structure {
- external Port fct
- conjugated Port socketControl: PTcpControl
- conjugated Port socketPayload: PTcpPayload
- ActorRef socket: ATcpClient
- Binding socketPayload and socket.PayloadPort
- Binding socketControl and socket.ControlPort
- Attribute socketConfig: DTcpControl
-
- }
- Behavior {
- StateMachine {
- Transition init: initial -> NotInitialized {
- action {
- "socketConfig = new DTcpControl(\"localhost\", 4441);"
- }
- }
- Transition tr0: ConfigSocket -> SocketOpen {
- triggers {
- <established: socketControl>
- }
- action {
- "fct.doneInit();"
- }
- }
- Transition tr1: SocketOpen -> SocketOpen {
- triggers {
- <carRed: fct>
- }
- action {
- "String payload = new String(\"carLights=red\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr2: SocketOpen -> SocketOpen {
- triggers {
- <carYellow: fct>
- }
- action {
- "String payload = new String(\"carLights=yellow\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr3: SocketOpen -> SocketOpen {
- triggers {
- <carGreen: fct>
- }
- action {
- "String payload = new String(\"carLights=green\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr4: SocketOpen -> SocketOpen {
- triggers {
- <carOff: fct>
- }
- action {
- "String payload = new String(\"carLights=off\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr5: SocketOpen -> SocketOpen {
- triggers {
- <pedRed: fct>
- }
- action {
- "String payload = new String(\"pedLights=red\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr6: SocketOpen -> SocketOpen {
- triggers {
- <pedGreen: fct>
- }
- action {
- "String payload = new String(\"pedLights=green\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr7: SocketOpen -> SocketOpen {
- triggers {
- <pedOff: fct>
- }
- action {
- "String payload = new String(\"pedLights=off\\n\");"
- "socketPayload.send(new DTcpPayload(0, payload.length(), payload.getBytes() ));"
- }
- }
- Transition tr8: SocketOpen -> SocketOpen {
- triggers {
- <receive: socketPayload>
- }
- action {
- "fct.pressedButton();"
- }
- }
- Transition tr9: NotInitialized -> ConfigSocket {
- triggers {
- <startInit: fct>
- }
- }
- State ConfigSocket {
- entry {
- "socketControl.open(socketConfig);"
- ""
- "System.out.println(\"ConfigSocket: open\");"
- }
- }
- State SocketOpen
- State NotInitialized
- }
- }
- }
-
- ProtocolClass PTrafficLightController {
- incoming {
- Message setOn()
- Message setOff()
- }
- }
-
- ProtocolClass PTrafficLightCommands {
- incoming {
- Message startInit()
-
- Message carRed()
- Message carYellow()
- Message carYellowRed()
- Message carGreen()
- Message carOff()
-
- Message pedRed()
- Message pedGreen()
- Message pedOff()
-
- }
- outgoing {
- Message doneInit()
-
- Message pressedButton()
- }
- }
-} \ No newline at end of file

Back to the top