Beruflich Dokumente
Kultur Dokumente
Requirements Patterns For Embedded Systems - Sascha Konrad, Betty H.C. Cheng
Requirements Patterns For Embedded Systems - Sascha Konrad, Betty H.C. Cheng
Actuator-Sensor: Structural Pattern Each active sensor must have capabilities to broadcast update
messages when its value changes.
Intent:
How to specify various kinds of sensors and actuators in an Each active sensor should send a life tick, a status message
embedded system. issued within a specified time frame, to detect malfunctions.
Motivation: Each actuator must have some method to invoke the appro-
Embedded systems usually have various kinds of sensors and priate response determined by the ComputingComponent.
actuators. These sensors and actuators are all either directly or Each sensor and actuator should have a function imple-
indirectly connected to the control unit. Although many of the mented to check its own operation state.
sensors and actuators look quite different, their behavior is sim-
ilar enough to structure them into a pattern. The pattern shows Each sensor and actuator should be able to test the validity
how to specify the sensors and actuators for a system, including of the values received or sent and set its operation state if the
attributes and operations. The Actuator-Sensor Pattern is us- values are outside of the specifications.
ing a pull mechanism (explicit request for information) for Pas-
siveSensors and a push mechanism (broadcast of information) Applicability:
for the ActiveSensors. Additional information about pull and Actuator-Sensor pattern is applicable
push mechanism can be found elsewhere [13]. in all embedded systems, especially when many actuators
Figure 1 shows the problem frame diagram for the Actuator- and sensors are present.
Sensor Pattern. This pattern can be used to build the Input-
/Output-Modeler, meaning this Input-/Output Modeler translates Structure:
the data of the actuators and sensors from the environment into a A UML class diagram for the Actuator-Sensor Pattern can be
model for which the system was designed. For example, a value of found in Figure 2. Actuator, PassiveSensor and ActiveSensor
a temperature sensor is transformed into a five-digit integer num- are abstract classes and denoted in italics. There are four different
ber or a transformation from Celsius to Fahrenheit. Explicitly, types of sensors and actuators in this pattern. The boolean, integer
the diagram shows the requirement ComputingComponent - Model and real classes represent the most common types of sensors and
in a dashed circle, from which arrows point to the Input-/Output actuators. The complex classes are sensors or actuators that use
Model and the ComputingComponent domain, meaning that the values that cannot be easily represented in terms of primitive data
requirement constrains both of those domains because data can types, such as a radar device. Nonetheless, these devices should
ActiveBoolean ActiveReal
Sensor Sensor
ActiveInteger ActiveComplex
Sensor Sensor
still inherit the interface from the abstract classes since they should RealActuator: Defines real actuators.
have basic functionalities such as querying the operation states. ComputingComponent: The central part of the controller;
Behavior: it gets the data from the sensors and computes the required
Figure 3 shows a UML sequence diagram for an example of response for the actuators.
the Actuator-Sensor Pattern in a climate control system. Here the ActiveComplexSensor: Complex active sensors have the
ComputingComponent queries a sensor (a passive temperature basic functionality of the abstract ActiveSensor class, but
sensor) and an actuator (one radiator valve) to check the opera- additional, more elaborate, methods and attributes, need to
tion state for diagnostic purposes before reading or setting a value. be specified.
The messages “Set Physical Value” and “Get Physical Value” are
not messages between objects, instead, they describe the interac- PassiveComplexSensor: Complex passive sensors have the
tion between the physical devices of the system and their software basic functionality of the abstract PassiveSensor class, but
counterparts. In the lower part of the diagram, below the horizon- additional, more elaborate, methods and attributes need to be
tal line, the TemperatureSensor reports that the operation state specified.
is zero. The ComputingComponent then sends the error code for ComplexActuator: Complex actuators also have the base
a temperature sensor failure to the FaultHandler that will decide functionality of the abstract Actuator class, but additional,
how this error affects the system and what actions are required. more elaborate methods and attributes need to be specified.
Participants: Collaborations:
PassiveSensor fabstractg: Defines an interface for passive When the ComputingComponent needs to update the value
sensors. of a PassiveSensor, it queries the sensors, requesting the
PassiveBooleanSensor: Defines passive boolean sensors. value by sending the appropriate message.
PassiveIntegerSensor: Defines passive integer sensors. ActiveSensors are not queried. They initiate the transmis-
PassiveRealSensor: Defines passive real sensors. sion of sensor values to the computing unit, using the ap-
propriate method to set the value in the ComputingCompo-
ActiveSensor fabstractg: Defines an interface for active nent. They send a life tick at least once during a specified
sensors. time frame in order to update their timestamps with the sys-
ActiveBooleanSensor: Defines active boolean sensors. tem clock’s time.
ActiveIntegerSensor: Defines active integer sensors. When the ComputingComponent needs to set the value of
ActiveRealSensor: Defines active real sensors. an actuator, it sends the value to the actuator.
Actuator fabstractg: Defines an interface for actuators. The ComputingComponent can query and set the operation
state of the sensors and actuators using the appropriate meth-
BooleanActuator: Defines boolean actuators. ods. If an operation state is found to be zero then the error
IntegerActuator: Defines integer actuators. is sent to the FaultHandler who is responsible for handling
Set Value
error messages, such as starting a more elaborate recovery Channel Pattern: This pattern shows several ways to in-
mechanism or a backup device. If no recovery is possible, crease safety by using different strategies to add sensors and
then the system can only use the last known value for the actuators to a system.
sensor or the default value. Monitor-Actuator Pattern: The Monitor-Actuator Pattern
The ActiveSensors offer methods to add or remove the ad- shows how to use redundant sensors to add a monitor chan-
dresses or address ranges of the components that want to re- nel.
ceive the messages in case of a value change.
sends erros to
1 ac
The centralized safety control facilitates the verification and po
rts 1
1 iv
at
e
re s
validation of the safety measures and eases the reuse of the fault
handler in different systems. 0..* 0..* 0..*
Due to space constraints the problem frame diagram is not in- monitors
1
backs up
0..*
1
cluded [13]. Watchdog Device FailSafeDevice
1
reports
Constraints:
monitors
1
Manual/External Control
Manual()[]/
Hold()[]/
Error()[]/
ShutdownES[]/
ShutdownES()[]/ Reset()[]/
Production Stop
ShutdownPdS[]/
do/complete current task ShutdownPdS()[]/
Reset
Reset()[]/ PowerOn()[]/
ShutdownPtS()[]/
Protection Stop Reset()[]/
ShutdownPtS[]/
Power Off
PowerOff()[]/ [Initialization failed]/PowerOff()
PowerOff()[]/
[]/PowerOff()
[]/PowerOff()
Figure 5. UML State Diagram of the ComputingComponent in the Fault Handler Pattern
UserInterface: Class offering functionality to notify user 4. Hardware and software redundancies exist in the system,
about errors. thus meaning higher system costs.
Device: Device monitored by watchdog(s) and/or moni- 5. Overall safety of the system is usually significantly im-
tor(s). proved.
Watchdog: Watchdog monitoring the device.
Design Patterns:
Monitor: Monitor monitoring device actuation.
Singleton Design Pattern [6]: Use this pattern to assure
FailSafeDevice: Device activated in case of failure of the
only one fault handler exists in the system.
main device.
Also Known As:
Collaborations:
To be determined.
The FaultHandler receives all error messages and stores Related Requirements Patterns:
them in an error list.
Controller Decompose Pattern: This requirements pattern
It also decides, depending on the safety measures and poli-
defines the need for a fault handler in an embedded system.
cies, if a fail-safe state should be entered, or whether the user
interface or recovery device should be activated. User Interface Pattern: This pattern can be used for the user
interface described in the Fault Handler pattern.
Watchdog and Monitor monitor the device.
FailSafeChannel is activated to recover from faults.
4. Validation
Consequences:
1. Required safety states should be implemented in the compo- This section briefly overviews how the patterns have
nent. been applied to two systems from the automotive domain,
2. Only one fault handler should exist in the system and should and it describes how these patterns affected the structure and
handle all error messages to avoid inconsistent handling of the behavior of the systems. The first system is an Adaptive
faults [3]. Cruise Control System [10]. In this system, radar was added
3. The fault handler becomes one of the most crucial parts in to a standard cruise control system to provide automated
the system concerning safety issues, so the development and support for collision avoidance when encountering slower
the testing should be thorough. targets. The class diagram of the system is shown in Figure
ing System that uses the current car speed, in an embedded Computing Component
Normal Behavior Reset
system to continuously compute the amount of torque as-
sistance needed from an electrical motor as the driver turns [Initialization OK]/Automatic()
1
1
sends errors to
1
1 fault handling 1
1 1 1
1 1
1 1 1
1
monitors collaborate
Computing EngineControl
Watchdog UserInterface FaultHandler Actuator
Component Module
1 1 1 1
1 1 1 1 1 1
ts 1 1 activates
rru p
collaborate
PassiveSensor
inte
1 controls
t
1 1 0..*
rge
0..*
1
ds ta
controls reads
s en
ComplexRadar
* Not all indicators
1 Concrete shown due to space
IntervalAdjust Indicators constraints
1
(*)
ElectronicSteeringSystem
1
1
sends errors to
1
1 fault handling reads errors
1 1 1
1 1 1
1 1 1 1 1
1
monitors collaborate
Computing Communicaton
Watchdog UserInterface FaultHandler Actuator
1 1 Component 1 1
Module
1 1 1 1 activates 1 1
controls/reads 1
1 collaborate
controls
PassiveSensor 0..*
1
1 1
SpeedSensor PID
Indicator SerialStatusLink
sets
controls
TorqueSensor 1 1
BatteryVoltage
DCMotor 1 Malfunction
Sensor
IndicatorLight
TorqueSensor2
TorqueSensor1