version 2.x

ROOMLanguage

The Real Time Object Oriented Modeling (ROOM)

eTrice comprises several models:

  • the ROOM model (*.room) – defines model classes and the logical structure of the model
  • the Config model (*.config) – defines configuration values for attributes
  • the Physical model (*.etphys) – defines the structure and properties of the physical system
  • the Mapping model (*.etmap) – defines a mapping from logical elements to physical elements

In the following diagram the models and their relations are depicted. The meaning of the arrows is: uses/references.

Model overview

Features

Contains:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application

PhysicalModel

The PhysicalModel defines the setup of your nodes with their attributes like threads and mode of execution

MappingModel

The MappingModel describes the mapping of elements of the LogicalModel to elements of the PhysicalModel

ConfigModel

The ConfigModel describes the Attribute configuration of ActorInstances and PortInstances.

ConfigModel

The ConfigModel describes the Attribute configuration of ActorInstances and PortInstances.

The scope of this model is the configuration of Attributes of the LogicalModel.
Thus it provides enhanced capabilities for assigning default values to Attributes, which are:

  • type safe value assignment
  • setting on class level
  • setting on instance level

Values defined for class attributes are used for all instances unless there is an instance value configured for the same attribute.
The configuration is available for actors and ports, thus ActorClasses/ActorRefs and ProtocolClasses/Ports.

ConfigModel ExampleConfig {
	import Example.* from "Example.room"

	ActorClassConfig ActorClass1 {
		Attr attribute1 = 4
	}

	ActorInstanceConfig LogSys/subsysRef/actor1 {
		Attr attribute1 = 7
	}
}
Features

Uses:

Attribute

An Attribute is a member variable of a class


LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application

The ROOM model defines DataTypes, ProtocolClasses, ActorClasses, SubSystemClasses and LogicalSystems.
Thereby the three latter form a hierarchy. The LogicalSystem is the top level element of the structure.
It contains references to SubSystemClass elements. The SubSystemClass in turn contains
references to ActorClass elements which again contain (recursively) references to
ActorClass elements. The complete structural hierarchy implies a tree which has the
LogicalSystem as root and where each reference stands for a new node with possibly further
branches.

Features

Contains:

LogicalSystem

The LogicalSystem is the topmost structural class. It assembles a distributed system by means of sub systems

SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

ActorClass

An actor is the basic structural building block for building systems with ROOM

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

AnnotationType

AnnotationTypes can be used to tag ROOM classes for further custom processing


ActorClass

An actor is the basic structural building block for building systems with ROOM

An ActorClass consists of three main parts:

  • Interface (external interface) specifies the communication to ‘outside’ actors and consists of Ports.
  • Structure (internal interface) contains Ports, Attributes and ActorRefs. These elements are accessible from the Behavior part of the actor (in contrary to the external interface above). An ActorClass can be composed of other actors again by declaring ActorRefs. Also this part declares the connection of ports in form of Bindings and LayerConnections.
  • Behavior is described by the StateMachine. It can receive and send messages from the ports, declared in the Structure above. The Attributes can be used to store data during an state transition. Furthermore it is possible to declare Operations. They can be used to define reusable logic, that is invoked during a state transition.

ActorClass

 ActorClass ExampleActorClass {
	 Interface {
		 Port port1: ProtocolClass1
		 Port port4: ProtocolClass1
	 }
	 Structure {
		 external Port port1
		 conjugated Port port2: ProtocolClass1
		 conjugated Port port3: ProtocolClass1
		 
		 ActorRef ActorRef_A: ActorClass2
		 ActorRef ActorRef_B: ActorClass3
		 
		 Binding port2 and ActorRef_A.port5
		 // ...
	 }
	 Behavior {
		 // ...
	 }
 }
Features

Contains:

ExecutionType

Determines the execution type of an actor

ActorRef

An ActorRef is an instance of an ActorClass

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass

SAP

A Service Access Point is similar to a Port, but uses a LayerConnection for wiring

SPP

A Service Provision Point is the counterpart of a SAP

ServiceImplementation

The implementation of an Service Provision Point (SPP)

Binding

A Binding connects two Ports with each other

LayerConnection

A LayerConnection associates a SPP to an ActorRef, resulting in an connection of all SAPs on its instance hierarchy

Attribute

An Attribute is a member variable of a class

Operation

An Operation is a member function of a class

StateMachine

A StateMachine describes the state based, event driven behavior of an ActorClass

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Uses:

Inheritance

A class can specify a super class and inherits elements from the super class hierarchy

Feature Usage

Typecasts:

ActorRef

An ActorRef is an instance of an ActorClass

Is contained in:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application

Is edited by:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.

Example:


ActorRef

An ActorRef is an instance of an ActorClass

  • ActorClass: The type of the ActorRef
  • Multiplicity: The number of instances. A number greater than one can be seen as an array of instances
  • Reference Type: Can be fixed or optional. Fixed requires an integer multiplicity and results in an static instantiation with an fixed number of instances during runtime . Optional denotes an dynamic instantiation, where ActorRefs can be created in arbitrary number during runtime. In this case, the multiplicity has to be set to ’*’
Properties Values

multiplicity

1..n, *

Features

Is of type:

ActorClass

An actor is the basic structural building block for building systems with ROOM

Uses:

Replication

Replication is mechanism for multi-instantiation for ActorRefs and Ports

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

Is edited by:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.

ActorRefPropertyDialog

A dialog to edit properties of an ActorRef.

Example:

SubSystemClass SubSystemExample {
	ActorRef mainActor : ActorClassExample
	
	LogicalThread default_thread
}

ActorClass ActorClassExample {
	Structure {
		ActorRef sender : Sender
		ActorRef receiver : Receiver
		
		Binding receiver.port and sender.port
	}
}

ActorClass ActorClassExampleReplicated {
	Structure {
		ActorRef sender[3]: Sender
		ActorRef receiver[3] : Receiver
		
		Binding receiver.port and sender.port
		/* Equivalent to:
		 *  Binding receiver[1].port and sender[1].port
		 *  Binding receiver[2].port and sender[2].port
		 * ....
		 */		
	}
}

ActorRef instance diagram

Instance hierarchy of ActorRef Example (*System(System)* not shown in code snippet)


Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

It refers to an AnnotationType and may have to pass key value pairs. Its notation is similar to Java:

@AnnotationType1
@AnnotationType2(key1="STRING", key2=3, ...)

See section Annotations for further reading.

Features

Is of type:

AnnotationType

AnnotationTypes can be used to tag ROOM classes for further custom processing

Feature Usage

Is contained in:

LogicalSystem

The LogicalSystem is the topmost structural class. It assembles a distributed system by means of sub systems

ActorClass

An actor is the basic structural building block for building systems with ROOM

SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

DataClass

A DataClass is a composition of Attributes

Is used by:

DataLogging

Runtime logger for data-driven Messages with primitive data.

Example:

import room.basic.annotations.* from "../../org.eclipse.etrice.modellib.c/model/Annotations.room"

ActorClass ComponentAbstraction {
	Interface {
		conjugated Port port1: Protocol1
	}
	Structure {
		external Port port1
	}
	Behavior {
		// custom/external state machine implementation
		@BehaviorManual
	}
}

AnnotationType

AnnotationTypes can be used to tag ROOM classes for further custom processing

They provide the ability to associate custom properties to ROOM classes, that adjust or toogle features, like generation or the runtime behavior.
eTrice has some built-in annotations, which can be found in Annotations.room within the eTrice modellib.

See section Annotations for further reading.

Feature Usage

Typecasts:

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Is contained in:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application


Attribute

An Attribute is a member variable of a class

An Attribute can be be used to store arbitrary data. There are two common conceptual purpose of use:

  • model current system state (state machine variable)
  • store reference to more fine-grained components (e.g. c pointer to handle)

Attributes can be defined in several ROOM classes.

Properties Values

defaultValueLiteral

target code

multiplicity

1..n

ref

Features

Is of type:

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

DataClass

A DataClass is a composition of Attributes

Is used by:

ConfigModel

The ConfigModel describes the Attribute configuration of ActorInstances and PortInstances.

Example:

import room.basic.types.* from "../../../org.eclipse.etrice.modellib.c/model/Types.room"

DataClass SimpleDataClass {
	Attribute attribute1: int16
	Attribute attribute2: uint32
}

ActorClass ActorClassWithAttributes {
	Structure {
		Attribute attribute1: int32 			["attribute of a PrimitiveType" ]
		Attribute attribute2: SimpleDataClass 	[ "attribute of a DataClass" ]
	}
}

ActorClass ActorClassWithAttributes2 {
	Structure {
		Attribute arrayAttribute[8] : uint32 [ "attribute with multiplicity"]
		Attribute refAttribue : voidType ref [ "attribute as a reference (void pointer)"]
	}
}

ActorClass ActorClassWithAttributeInitialization {
	Structure {
		Attribute attribute1: uint32 = "3"
		Attribute attribute2: SimpleDataClass = "{1, 2}"
		Attribute arrayAttribute[8] : uint32 = "0" // or {0,0,0, ...}
		Attribute refAttribue : voidType ref = "NULL" // set reference in constructor or in state machine
	}
}

Binding

A Binding connects two Ports with each other

In essence, a binding is a abstraction for an underlying communication channel whose function is to convey messages from one port to the other.
The precise semantics of these channels are not defined in the Binding. Instead, they are determined by the ProtocolClasses that are associated with the Ports at the end of the Binding.

ActorClass ExampleActorClass {
	Structure {
		conjugated Port sender: ProtocolClass1
		ActorRef actorRef: ActorClass2
		
		Binding sender and actorRef.receiver
	}
}
Features

Uses:

Port
: endpoint1

A Port is an instance of a ProtocolClass and the interface for an ActorClass

Port
: endpoint2

A Port is an instance of a ProtocolClass and the interface for an ActorClass

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

Is edited by:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.


CommunicationType

The CommunicationType defines the communication semantics of a ProtocolClass

Since from ROOM models executable code can be generated, it is important to define the way the actors are executed and communicate with each other.
The combination of communication and execution is called the execution model. Therefore the ExecutionType of an actor and the CommunicationType of the ports has to be considered.

The CommunicationType of a ProtocolClass (and thus of a Port) specifies in which way the communication should happen:

  • message driven – asynchronous, non blocking, no return value: Usually the message driven communication is implemented with message queues. Message queues are inherently asynchronous and enable a very good decoupling of the communicating parties.
  • data driven – asynchronous, non blocking, no return value: In data driven communication sender and receiver often have a shared block of data. The sender writes the data and the receiver polls the data.
  • function call – synchronous, blocking, return value: Regular function call as known in most programming languages. (not supported yet)

CommunicationType relates with the ExecutionType of an ActorClass, e.g. a data-driven port needs a cyclic thread, that polls the shared data.

Properties Values

type

eventdriven, datadriven, sync

Feature Usage

Is contained in:

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

Is used by:

ExecutionType

Determines the execution type of an actor

Example:


import room.basic.types.* from "../../../org.eclipse.etrice.modellib.c/model/Types.room"

ProtocolClass EventdrivenProtocolClass1 [ "default is eventdriven" ] {
	// explicit: eventdriven ProtocolClass EventdrivenProtocolClass {
	incoming {
		Message msg1() ["message without data"]
		Message msg2(int32) ["message with data"]
	}
	outgoing {
		Message msg4()  ["eventdriven ProtocolClass can have message into two directions"]
	}
}

datadriven ProtocolClass DatadrivenProtocolClass {
	incoming {
		Message signal1 (int32) ["a datadriven message needs data"]
	}
	// datadriven ProtocolClass can only have incoming messages (signals)
}

//  sync is not supported yet
//	sync ProtocolClass SyncProtcolClass { 
//		
//	}

DataClass

A DataClass is a composition of Attributes

Intended to model a type that primarily consists of data, which is usually grouped together in some manner. DataClasses roughly translate to Java classes without interaction or C structs.

DataClass TCPConnectionData {
	Attribute IPAddr: string
	Attribute TcpPort: int32
}
Features

Is a:

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Contains:

Attribute

An Attribute is a member variable of a class

Operation

An Operation is a member function of a class

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Uses:

Inheritance

A class can specify a super class and inherits elements from the super class hierarchy

Example:

¦¦¦
```room<br/> DataClass SimpleDataClass {<br/> Attribute attribute1: uint16<br/> Attribute attribute2: uint32<br/> }</p> <pre><code> DataClass DataClassExample { Attribute attribute1: uint32 Attribute attribute2: SimpleDataClass Attribute attribute3: voidType ref Operation operation1(param1: uint32, param2: uint16): boolean &#39;&#39;&#39; return true; &#39;&#39;&#39; } ``` ¦¦¦


DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Feature Usage

Inheriting features:

PrimitiveType

A PrimitiveType is an abstraction of a target language’s basic type (e.g. integer or boolean)

Enumeration

An EnumerationType declares an enumeration similar to most well-known languages

DataClass

A DataClass is a composition of Attributes

ExternalType

An ExternalType is used to make an target language type accessible in ROOM

Typecasts:

Attribute

An Attribute is a member variable of a class

Is contained in:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application

Is used by:

Operation

An Operation is a member function of a class


Enumeration

An EnumerationType declares an enumeration similar to most well-known languages

Properties Values

literals

name
Features

Is a:

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Example:

Enumeration EOnOff {
	Off = 0, // explicit value=0
	On = 1 // explicit value=1 
}

Enumeration EDay {
	SUN,
	MON,
	TUE,
	WED,
	THU,
	FRI,
	SAT // implicit enumeration 0..6
}

ExecutionType

Determines the execution type of an actor

Since from ROOM models executable code can be generated, it is important to define the way the actors are
executed and communicate with each other. The combination of communication and execution is called the
execution model. Therefore the ExecutionType of an actor and the CommunicationType of the ports has to be considered.

The ExecutionType of an ActorClass specifies in which way its instance (ActorRef) should be executed:

  • execution by receive event: The message queue or the event dispatcher calls a receive event function of the message receiver and thereby executes the processing of the event.
  • polled execution: The objects are processed by a cyclic execute call
  • execution by function call: The caller executes the called object via function call (not supported yet)
  • mixture: An asynchronous execution combines an event dispatcher and a polled execution.

Thereby the ExecutionType determines the execution mode of the actor’s logical thread:

Thread of Control

The actual execution of the underlying physical thread can be specified in the PhysicalModel in conjunction with the MappingModel.

ExecutionType relates to the CommunicationType, e.g. if an actor uses data-driven ports, it should support an polled execution.

Properties Values

mode

eventdriven, datadriven, async, sync

Features

Uses:

CommunicationType

The CommunicationType defines the communication semantics of a ProtocolClass

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

Example:

eventdriven ActorClass EventdrivenActor ["default is eventdriven"] {
	// only event-driven Ports and ActorRefs allowed
}

datadriven ActorClass DatadrivenActor {
	// only data-driven Ports and ActorRefs allowed
}

async ActorClass MixedActor{
	// both data/event-driven Ports and ActorRefs allowed
}

ExternalEndPort

A ExternalEndPort is an interface Port, that is made accessible to the internal interface of an ActorClass

ActorClass ExternalEndPortExample {
	Interface {
		// externalEndPort is connect from 'outside' and thus needs a Binding from containing ActorClass
		Port externalEndPort : PSimpleProtocol
	}
	Structure {
		external Port externalEndPort
	}
	Behavior {
		// send/receive messages from externalEndPort
	}
}
Features

Is a:

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass


ExternalType

An ExternalType is used to make an target language type accessible in ROOM

Properties Values

targetName

identifier name
Features

Is a:

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Example:

¦¦¦
```room<br/> // Include is needed when used (e.g. in ActorClassWithExternalType)<br/> ExternalType someStructType -&gt; &ldquo;struct FILE_HANDLE&rdquo;</p> <pre><code> ActorClass ActorClassWithExternalType{ Structure { usercode1 &#39;&#39;&#39; // #include &lt;___.h&gt; /* User includes here*/ &#39;&#39;&#39; Attribute someHandle : someStructType ref // needs include } Behavior { Operation operation1(param1: charPtr) &#39;&#39;&#39; // external calls or casts may need includes write(someHandle, param1); &#39;&#39;&#39; } } ``` ¦¦¦


Inheritance

A class can specify a super class and inherits elements from the super class hierarchy

When a ROOM class specifies a super class, it generally inherits all elements and properties.
In several cases, it is possible, to override these inherited elements. Generally, eTrice has two semantics of overriding: refinement and replacement.
Refinement is used in most cases (e.g. StateMachine) and realizes an extension of the overridden elements.
In this case, if a sub class overrides a piece of logic from a super class, it will always be executed subsequently to the inherited.
Contrary to this, replacement is applied to overridden Operations, similar to programming languages C++ and Java.

A formal definition of overriding is given below:

  • early or late resolve - if element is overridden, which one should super class use by default - own or override ?
  • replacing or refinement - ignore inherited code or prepend inherited code automatically ?
  • (non-)accessible - if element is overridden, is super class’ original accessible from sub class ? e.g. super.foo()
  • implicit or explicit - does it use distinct model element / keyword?

Examples programming languages:
c++ virtual function and java override <==> accessible explicit late replacing
c++ function redefine <==> accessible implicit early replacing
c++ dtor <==> late refinement\

eTrice override of model elements:
Operations (C generation) <==> non_accessible explicit late replacing
Operations (Java generation) <==> accessible explicit late replacing
State and Transitions <==> non-accessible explicit late refinement
ctor/dtor <==> non_accessible implicit late refinement
StateMachine <==> non-accessible implicit late refinement
UserCode <==> non-accessible implicit late refinement

Feature Usage

Is used by:

ActorClass

An actor is the basic structural building block for building systems with ROOM

StateMachine

A StateMachine describes the state based, event driven behavior of an ActorClass

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

DataClass

A DataClass is a composition of Attributes

Example:

¦¦¦
```room<br/> ActorClass ActorSubClass extends ActorBaseClass {<br/> // inherits all elements from super type hierarchy<br/> }</p> <pre><code> ActorClass ActorBaseClass { Interface { Port port1 : ProtocolBaseClass } Structure { Attribute attribute1 : uint32 } Behavior { Operation operation1() &#39;&#39;&#39; return; &#39;&#39;&#39; } } ProtocolClass ProtocolSubClass extends ProtocolBaseClass { // inherits all elements from super type hierarchy } ProtocolClass ProtocolBaseClass { incoming { Message message1() } } DataClass DataSubClass extends DataBaseClass { // inherits all elements from super type hierarchy } DataClass DataBaseClass { Attribute attribute1 : uint32 } ``` ¦¦¦


InternalEndPort

A InternalEndPort is an local Port, that is declared in the internal interface of an ActorClass

ActorClass InternalEndPortExample {
	Structure {
		Port internalEndPort : PSimpleProtocol
		ActorRef actorRef1 : SimpleActorClass
		
		// internalEndPort lives 'local' and
		// thus needs a Binding to port of a ActorRef
		Binding internalEndPort and actorRef1.externalPort2 
	}
	Behavior {
		// send/receive messages from internalEndPorts
	}
}

InternalEndPort

Features

Is a:

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass


LayerConnection

A LayerConnection associates a SPP to an ActorRef, resulting in an connection of all SAPs on its instance hierarchy

  • An actor class can define a Service Provision Point (SPP) to publish a specific service, defined by a protocol class
  • An actor class can define a Service Access Point (SAP) if it needs a service, defined by a protocol class
  • For a given actor hierarchy, a LayerConnection defines which SAP will be satisfied by (connected to) which SPP
Features

Uses:

SAP
: SAPoint

A Service Access Point is similar to a Port, but uses a LayerConnection for wiring

SPP
: SPPoint

A Service Provision Point is the counterpart of a SAP

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

Is edited by:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.


LogicalSystem

The LogicalSystem is the topmost structural class. It assembles a distributed system by means of sub systems

It describes the logical topology of your distributed system and is composed of sub systems (SubSystemRefs). Thus it is the notationally root of every instance path or actor hierarchy.

Features

Contains:

SubSystemRef

A Sub System Reference is an instance of an SubSystemClass

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Feature Usage

Is contained in:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application

Is used by:

MappingModel

The MappingModel describes the mapping of elements of the LogicalModel to elements of the PhysicalModel


Operation

An Operation is a member function of a class

Operations can be used to define a piece of reusable logic. The definition consists of:

  • Arbitrary amount of arguments
  • Return type
  • User code body, which can access the structural part of the containing class (e.g. attributes)
  • ‘override’ keyword, replaces the logic of the inherited operation having the same signature
Properties Values

returnType

DataType

arguments

name : DataType
Features

Uses:

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

DataClass

A DataClass is a composition of Attributes

Example:

¦¦¦
```room<br/> import room.basic.types.* from &ldquo;../../../org.eclipse.etrice.modellib.c/model/Types.room&rdquo;</p> <pre><code> DataClass DataClassWithOperation { Attribute attribute1 : uint32 Operation operation1(param1: uint32, param2: int32): boolean &#39;&#39;&#39; return attribute1 &gt; (param1 - param2); &#39;&#39;&#39; } ActorClass ActorClassWithOperation { Structure { Attribute attribute1 : uint32 } Behavior { Operation operation1(param1: uint32, param2: int32): boolean &#39;&#39;&#39; return attribute1 &gt; (param1 - param2); &#39;&#39;&#39; } } ActorClass ActorClassWithOperation2 { Structure { usercode1 &#39;&#39;&#39; // #include &lt;___.h&gt; /* User includes here */ &#39;&#39;&#39; Attribute someHandle : voidType ref } Behavior { Operation operation1(param1: charPtr) &#39;&#39;&#39; // external calls or casts may need includes write(someHandle, param1); &#39;&#39;&#39; } } ``` ¦¦¦


Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass

Once a ProtocolClass has been created, it can be used to define actor interfaces. This is accomplished by means of Ports.
A Port is a declaration that the set of messages defined by its ProtocolClass is now part of the actor’s interface.
It provides strong decoupling of ActorClasses from each other, thus enabling easy testability, reusability and deployment of actors to different threads or nodes.

ActorClass Example {
	Structure{
		Port port0 : ProtocolClass1
	}
	Behavior {
		// send/receive message from port0
	}
}

For communication between two actors to take place, a connection must be established between a port on one of the actors and a port on the other.
One condition is, that both Ports have compatible ProtocolClasses. In most cases the Ports simply refer to the same protocol.
In addition, a ProtocolClass has an imposed directionality - it defines one subset of messages as incoming and the complementary subset as outgoing.
Which subset is labeled as incoming and outgoing is arbitrary, it simply depends on the point of view, that was taken when defining.
Therefore Ports can be ‘regular’ and ‘conjugated’. When two actors communicate by a connected pair of Ports, one Port has to be regular and the other conjugated.
The ProtocolClass’ incoming messages are on one side received by the regular Port and on the other sent by the conjugated Port (outgoing message vice versa).

A connection of Ports is denoted by a Binding.

Properties Values

conjugated

regular, conjugated

multiplicity

1..n, *

Features

Is of type:

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

Uses:

Replication

Replication is mechanism for multi-instantiation for ActorRefs and Ports

Feature Usage

Inheriting features:

RelayPort

A RelayPort forwards its messages without exposing them to the internal interface of the ActorClass

ExternalEndPort

A ExternalEndPort is an interface Port, that is made accessible to the internal interface of an ActorClass

InternalEndPort

A InternalEndPort is an local Port, that is declared in the internal interface of an ActorClass

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

Is edited by:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.

PortPropertyDialog

A dialog to edit properties of an Port.

Is used by:

Binding
: endpoint1

A Binding connects two Ports with each other

Binding
: endpoint2

A Binding connects two Ports with each other


PrimitiveType

A PrimitiveType is an abstraction of a target language’s basic type (e.g. integer or boolean)

Properties Values

targetName

identifier name
Features

Is a:

DataType

A DataType can take 4 forms and types data elements like an Attribute or Operation argument

Example:

The eTrice built-in types can be found in the org.eclipse.etrice.modellib project. In most cases the Types.room is already included:

// Follow import by Open Declaration (F3)
import room.basic.types.* from "../../../org.eclipse.etrice.modellib.c/model/Types.room"

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

A ProtocolClass provides a reusable interface specification for ports. It defines a set of incoming and outgoing Messages that can be exchanged between two ports.
The exact semantics of a message is defined by the CommunicationType.
Protocol classes have only textual notation.

ProtocolClass SimpleProtocolClass {
	incoming {
		Message msg1(int32}
		Message msg2()
	}
	outgoing {
		Message msg3(DataClass1}
		Message msg4()
	}
}
Features

Contains:

CommunicationType

The CommunicationType defines the communication semantics of a ProtocolClass

Attribute

An Attribute is a member variable of a class

Operation

An Operation is a member function of a class

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Uses:

Inheritance

A class can specify a super class and inherits elements from the super class hierarchy

Feature Usage

Typecasts:

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass

SAP

A Service Access Point is similar to a Port, but uses a LayerConnection for wiring

SPP

A Service Provision Point is the counterpart of a SAP

Is contained in:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application

Example:

import room.basic.types.* from "../../../org.eclipse.etrice.modellib.c/model/Types.room"

// eventdriven ProtocolClass (asynchronous message passing, bidirectional)
eventdriven ProtocolClass ProtocolClassEvt {
	// ProtocolClass ProtocolClassEvt { // same like above because eventdriven is default 
	incoming {
		// incoming means incoming for a regular port and outgoing for a conjugated port
		Message message1() // message without data
		Message message2(int32) // message with simple data
		Message message3(DMessageData) // message with complex data (DataClass)

	}
	outgoing {
	// outgoing means outgoing for a regular port and incoming for a conjugated port
		Message message1(int32) // incoming and outgoing Messages can have the same name to enable symmetric protocols
	}
}

// DataClass for sending complex data via message
DataClass DMessageData {
	Attribute SomeData: int16
	Attribute SomeMoreData: int32
}

// datadriven ProtocolClass (asynchronous data flow, unidirectional)
datadriven ProtocolClass ProtocolClassData {
	incoming {
		// incoming means incoming for a regular port and outgoing for a conjugated port
		Message value1(int32) // a datadriven message (signal) always needs data
		Message value2(int16) // datadriven message with simple data
		Message value3(DMessageData) // datadriven message with complex data (DataClass)

	}
	// no outgoing messages for datadriven ports allowed 
}

RelayPort

A RelayPort forwards its messages without exposing them to the internal interface of the ActorClass

ActorClass RelayPortExample{
	Interface {
		Port relayPort : PSimpleProtocol
	}
	Structure {
		ActorRef actorRef1 : SimpleActorClass2
		
		// relayPort can be directed to port of an ActorRef
		Binding relayPort and actorRef1.externalPort
	}
	Behavior {
		// relayPort not available !
	}
}

RelayPort

Features

Is a:

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass


Replication

Replication is mechanism for multi-instantiation for ActorRefs and Ports

ActorRefs and Ports can be instantiated several times under the same name. The notation is similar to arrays in programming languages.

This possibility provides an elegant way of scaling of your system without redundancy.

ActorRef sensor : Sensor 			// one instance
ActorRef sensor[1] : Sensor			// one instance
ActorRef sensorArray[5] : Sensor	// five instances  

Replication can also applied to Ports. One use case is to establish a communication with multiple actors through one port interface.

Port service[5] : TimingService 	// five instances
Port service[*] : TimingService		// automatic, as many as needed
Feature Usage

Is used by:

ActorRef

An ActorRef is an instance of an ActorClass

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass


SAP

A Service Access Point is similar to a Port, but uses a LayerConnection for wiring

  • An actor class can define a Service Provision Point (SPP) to publish a specific service, defined by a protocol class
  • An actor class can define a Service Access Point (SAP) if it needs a service, defined by a protocol class
  • For a given actor hierarchy, a LayerConnection defines which SAP will be satisfied by (connected to) which SPP
Features

Is of type:

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

Is edited by:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.

Is used by:

LayerConnection
: SAPoint

A LayerConnection associates a SPP to an ActorRef, resulting in an connection of all SAPs on its instance hierarchy


SPP

A Service Provision Point is the counterpart of a SAP

  • An actor class can define a Service Provision Point (SPP) to publish a specific service, defined by a protocol class
  • An actor class can define a Service Access Point (SAP) if it needs a service, defined by a protocol class
  • For a given actor hierarchy, a LayerConnection defines which SAP will be satisfied by (connected to) which SPP
Features

Is of type:

ProtocolClass

A ProtocolClass defines messages and is the interface specification for a Port

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

Is edited by:

SPPPropertyDialog

A dialog to edit properties of a SPP.

Is used by:

LayerConnection
: SPPoint

A LayerConnection associates a SPP to an ActorRef, resulting in an connection of all SAPs on its instance hierarchy

ServiceImplementation

The implementation of an Service Provision Point (SPP)


ServiceImplementation

The implementation of an Service Provision Point (SPP)

Features

Uses:

SPP

A Service Provision Point is the counterpart of a SAP

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM


StateMachine

A StateMachine describes the state based, event driven behavior of an ActorClass

In ROOM each actor class can implement its behavior using a state machine. Events occurring at the end ports of an actor will be forwarded to and processed by the state machine. Events possibly trigger state transitions.

PingPongReceiverFSM

Features

Uses:

Inheritance

A class can specify a super class and inherits elements from the super class hierarchy

Feature Usage

Is contained in:

ActorClass

An actor is the basic structural building block for building systems with ROOM

Is edited by:

GraphicalBehaviorEditor

The GraphicalBehaviorEditor allows to edit the ActorClass’ StateMachine. It is possible to create (hierarchical) states and transitions to model complex behavior in a convenient way.


SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

It represents a class for an logical node in a distributed system. An instantiation translates to an executable application, that runs on a node or process.
A SubSystemClass is the structural starting point of an ROOM application. Thus it declares the topmost actor instances (ActorRefs).

Features

Contains:

ActorRef

An ActorRef is an instance of an ActorClass

Binding

A Binding connects two Ports with each other

LayerConnection

A LayerConnection associates a SPP to an ActorRef, resulting in an connection of all SAPs on its instance hierarchy

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Feature Usage

Typecasts:

SubSystemRef

A Sub System Reference is an instance of an SubSystemClass

Is contained in:

LogicalModel

The LogicalModel describes the logical structure and behavior of a ROOM application


SubSystemRef

A Sub System Reference is an instance of an SubSystemClass

It represent a logical node in the structural view of a distributed system. An instantiation translates to an executable application, that runs on a node or process.

To be executable, a SubSystemRef has first to be mapped to a physical node, which defines the executional properties.
A physical node is denoted by a NodeClass and NodeRef in the PhysicalModel. The mapping is defined in the MappingModel.

Features

Is of type:

SubSystemClass

A SubSystem is the topmost building block of the executable part of an system

Feature Usage

Is contained in:

LogicalSystem

The LogicalSystem is the topmost structural class. It assembles a distributed system by means of sub systems

Is used by:

MappingModel

The MappingModel describes the mapping of elements of the LogicalModel to elements of the PhysicalModel


MappingModel

The MappingModel describes the mapping of elements of the LogicalModel to elements of the PhysicalModel

It enables the complete decoupling of the LogicalModel and the PhysicalModel, thus providing a maximum flexibility and reuse for the models.

The model starts with an import part, where you can import .room and .etphys models. They must contain at least one LogicalSystem and one PhysicalSystem.
A Mapping entry puts both in relation, meaning that all sub systems of the LogicalSystem will be distributed to the nodes of the PhysicalSystem.
This is carried out by a SubSystemMapping, that maps a SubSystemRef (logical node) to a NodeRef (physical node).
In the next step, ThreadMappings provide the same action for the logical and physical threads.

MappingModel PingPongMapping {
	import PingPong_Model.* from "PingPong.room"
	import GenericPhysicalModel.* from "GenericPhysical.etphys"

	Mapping LogSys -> PhysSys1 {
		SubSystemMapping subSystemRef -> nodeRef1 {
			ThreadMapping defaultThread -> PhysicalThread1
		}
	}

}
Features

Uses:

LogicalSystem

The LogicalSystem is the topmost structural class. It assembles a distributed system by means of sub systems

SubSystemRef

A Sub System Reference is an instance of an SubSystemClass

PhysicalModel

The PhysicalModel defines the setup of your nodes with their attributes like threads and mode of execution


PhysicalModel

The PhysicalModel defines the setup of your nodes with their attributes like threads and mode of execution

The model describes the physical view of your system:

PhysicalSystem PhysSys1 {
	NodeRef nodeRef1 : NodeClass1
	NodeRef nodeRef2 : NodeClass2
}

The central element is a NodeClass, that models the executional aspects of a device (node).
At first, it can be associated with a RuntimeClass, which specifies if your device supports multiple threads.
‘priomin’ and ‘priomax’ define the range of priorities, that can be assigned to threads.

NodeClass NodeClass1 {
	runtime = RuntimeClass1
	priomin = -10
	priomax = 10

	// Thread definitions ...
}

RuntimeClass RuntimeClass1 {
	model = multiThreaded // or singleThreaded
}

A thread has to specify the following properties:

  • execmode: defines the execution type, see more at ExecutionType

    • blocked: message-driven only, thread wakes up if message arrives and is put to sleep after all action is done
    • polled: data-driven only, thread is executed cyclic. The ‘interval’ property is mandatory in this case.
    • mixed: combines both execution types
  • msgblocksize: the size in bytes of a message

  • msgpoolsize: the amount of messages, that the thread’s message queue can store

Note: ‘msgblocksize’ and ‘msgpoolsize’ also apply to the polled execution due the internal implementation via message passing.
The size of the message queue can be calculated as follows: msgpoolsize * msgblocksize bytes

DefaultThread ThreadMessaging {
	execmode = polled
	prio = 0
	stacksize = 1024
	msgblocksize = 32
	msgpoolsize = 10
}

Thread ThreadPolled {
	execmode = polled
	prio = 0
	interval = 100ms
	stacksize = 1024
	msgblocksize = 32
	msgpoolsize = 10
}

Overview of PhysicalModel

Feature Usage

Is used by:

MappingModel

The MappingModel describes the mapping of elements of the LogicalModel to elements of the PhysicalModel


ModelEditors

All aspects of the ROOMLanguage can be edited by full-blown textual editors. In addition, graphical editing is provided for the structural and behavioral part of ActorClasses.

Features

Contains:

TextualROOMEditor

Textual model editor

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.

GraphicalBehaviorEditor

The GraphicalBehaviorEditor allows to edit the ActorClass’ StateMachine. It is possible to create (hierarchical) states and transitions to model complex behavior in a convenient way.

GraphicalBehaviorEditor

The GraphicalBehaviorEditor allows to edit the ActorClass’ StateMachine. It is possible to create (hierarchical) states and transitions to model complex behavior in a convenient way.

GraphicalBehaviorEditor

Features

Edits:

StateMachine

A StateMachine describes the state based, event driven behavior of an ActorClass


GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.

GraphicalStructureEditor

Features

Contains:

StructureEditorPalette

The palette creates central structural elements of an ActorClass.

ActorRefPropertyDialog

A dialog to edit properties of an ActorRef.

PortPropertyDialog

A dialog to edit properties of an Port.

SPPPropertyDialog

A dialog to edit properties of a SPP.

Edits:

ActorClass

An actor is the basic structural building block for building systems with ROOM

ActorRef

An ActorRef is an instance of an ActorClass

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass

SAP

A Service Access Point is similar to a Port, but uses a LayerConnection for wiring

Binding

A Binding connects two Ports with each other

LayerConnection

A LayerConnection associates a SPP to an ActorRef, resulting in an connection of all SAPs on its instance hierarchy


ActorRefPropertyDialog

A dialog to edit properties of an ActorRef.

The dialog is used to edit an existing ActorRef of an ActorClass. It is also shown when creating a new one.

ActorRefDialog

Features

Edits:

ActorRef

An ActorRef is an instance of an ActorClass

Feature Usage

Is contained in:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.


PortPropertyDialog

A dialog to edit properties of an Port.

The dialog is used to edit an existing Port of an ActorClass. It is also shown when creating a new one.

PortDialog

Features

Edits:

Port

A Port is an instance of a ProtocolClass and the interface for an ActorClass

Feature Usage

Is contained in:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.


SPPPropertyDialog

A dialog to edit properties of a SPP.

The dialog is used to edit an existing SPP of an ActorClass. It is also shown when creating a new one.

SPPDialog

Features

Edits:

SPP

A Service Provision Point is the counterpart of a SAP

Feature Usage

Is contained in:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.


StructureEditorPalette

The palette creates central structural elements of an ActorClass.

Selecting an entry from the palette and clicking into the diagram, creates the element at the current position.

StructurePalette

Feature Usage

Is contained in:

GraphicalStructureEditor

The Structure Editor allows to edit the ActorClass’ Structure in a convenient way. It is possible to create and arrange actor references and ports and to create bindings and layer connections.


TextualROOMEditor

Textual model editor

TextualROOMEditor

Features

Contains:

OutlineView

Displays an overview of all elements in the textual editor.

Edits:

ROOMLanguage

The Real Time Object Oriented Modeling (ROOM)


OutlineView

Displays an overview of all elements in the textual editor.

Shows the structure of the current opened model in the textual editor. Select the ‘Link with Editor’ option to synchronize the selection of elements between editor and outline view. This enables a convenient navigation.

OutlineView

Feature Usage

Is contained in:

TextualROOMEditor

Textual model editor


CodeGenerators

Features

Contains:

CCodeGenerator

JavaCodeGenerator

CPPCodeGenerator

CCodeGenerator

Features

Contains:

GenerationOptions

Mechanism to adjust the generation.

MSCLogging

Runtime logger for event-driven Messages, represented as a Message Sequence Chart.

DataLogging

Runtime logger for data-driven Messages with primitive data.


DataLogging

Runtime logger for data-driven Messages with primitive data.

The DataLogging uses an annotation to configure the generated instrumentation:

@DataLogging(pathlist = "/portInstancePath,/portInstancePath,..")

Where pathlist is a string specifying a list of port instances which should be instrumented for data logging:

  • the path of a port instance starts with the name of the LogicalSystem and thus consists of at least 4 following segments
    /portInstancePath = /LogicalSystem/SubSystemRef/ActorRef/Port
  • multiple paths are separated through comma (,), but avoid any whitespace
  • the Port must be conjugated and it´s ProtocolClass has to be data-driven
  • only the first Message having primitive or enum typed data is considered

The logging status can be verified in the generation console. It will output an overview of all accepted ports. In the GenerationOptions is possible to (de)activate the data logging and thus ignoring the presence of the annotation.

At runtime the data values will then be logged

  • into a file log/SubSystemRef.data.csv
  • it contains one column for each port instance
  • and a new row for every polling cycle, containing all readout data values
  • the first column is used to number the cycles

Multi-Threading is not supported, the system must have not more than one polled/async physical thread.

The built-in Gnuplot script generator provides a convenient way to visualize the logged data. It generates a gnuplot script that can be used to create graphs from the logged data values.

  • Download Gnuplot from www.gnuplot.info and add it to the environment variable PATH (e.g. C:\Program Files\gnuplot\bin;)
  • Use the @Gnuplot and @GnuplotGraph to configure the script generation (see example)
  • The generated artifacts can be found in src-gen/gnuplot:
    • xxx.csv-script.plt - the gnuplot script, the resulting images are place in folder log/
    • create_gnuplot.launch - a launch configuration to call gnuplot executable with above script
Features

Uses:

Annotation

An Annotation can be attached to a ROOM classes to apply the properties of its AnnotationType

Feature Usage

Is contained in:

CCodeGenerator

Example:

import room.basic.annotations.* from "../../org.eclipse.etrice.modellib.c/model/Annotations.room"

LogicalSystem Logging {
 	SubSystemRef main: MainSubSystem
}

SubSystemClass MainSubSystem {
 	@DataLogging(pathlist = "/Logging/main/actorRef1/port1")
 	@Gnuplot(format="pngcairo", outputfile="main.data.png", width=1800, height=600, fontsize=10)
	@GnuplotGraph(
		paths="/Logging/main/actorRef1/port1",
		xtics=100, mxtics=4, ymin=-1.2, ymax=1.2
	)

Logged data values in .csv format:

 , /LogSys/subSystemRef/rootActor/serverInst/output, /LogSys/subSystemRef/rootActor/clientInst/output
0, 0.000000											,0.000000
1, 0.000000											,0.100000
2, 0.099833											,0.200000
3, 0.198669											,0.300000
4, 0.295520											,0.400000
5, 0.389418											,0.500000
[...]

Resulting graph created from generated gnuplot script:
Gnuplot example


CPPCodeGenerator


GenerationOptions

Mechanism to adjust the generation.

Options for generation are configured in the launch configuration or in case of standalone generation via command line.
A list of available options:

  • generate as library
  • generate documentation
  • generate instrumentation for MSC generation
  • generate instrumentation for data logging
  • override output directories
  • debug options
Feature Usage

Is contained in:

CCodeGenerator

JavaCodeGenerator

Is used by:

MSCLogging

Runtime logger for event-driven Messages, represented as a Message Sequence Chart.


JavaCodeGenerator

Features

Contains:

GenerationOptions

Mechanism to adjust the generation.

MSCLogging

Runtime logger for event-driven Messages, represented as a Message Sequence Chart.


MSCLogging

Runtime logger for event-driven Messages, represented as a Message Sequence Chart.

The MSCLogging is activated by default, but can be set manually in the GenerationOptions. The output file is created upon regular termination of the application. The resulting file can be found in the logging directory and has the name msc.seq, which can be open with the free open source tool Trace2UML.

MSCLogging

Features

Uses:

GenerationOptions

Mechanism to adjust the generation.

Feature Usage

Is contained in:

CCodeGenerator

JavaCodeGenerator



back to top version 2.x