Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...
Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...
Ph.D. - geht es zur Homepage der Informatik des Fachbereiches 3 ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
7.5. Static Semantics for Models<br />
7.5.7. Undefinable Static Semantics<br />
A constraint type for the data flow graph typ<strong>es</strong> that is probably meaningful was not yet specified.<br />
It concerns to not used input and output ports of any data type in gMainFunctionBlock and<br />
gSubFunctionBlock graphs. It seems meaningful to require that any available port of objects<br />
in those graph typ<strong>es</strong> should be used or rather connected. The behaviour is that in cas<strong>es</strong>, in<br />
which inputs are not set, the corr<strong>es</strong>ponding output(s) cannot be directly defined. It can be<br />
an initial value but also the last value set in ETCS Mode or Application Level, in which the<br />
output was used last.<br />
The reason why a general OCL constraint cannot be defined for this purpose is that in<br />
MERL only ports that are in a connection are acc<strong>es</strong>sible. Unconnected ports are simply not<br />
visible to any generator. Therefore, unconnected ports cannot be found in the GOPPRR C++<br />
abstract syntax model, which is used for the constraint checking.<br />
The only currently possible work-around for this situation is to define an own constraint for<br />
each concrete object type with ports while using the knowledge about its port number in the<br />
constraint.<br />
For example, for the oAND type, which has two Boolean inputs and one Boolean output,<br />
the following statement is defined to require that all its input ports must be used,<br />
1 context CProject<br />
2 inv : m_GraphSet−>s e l e c t (m_Type = ’ gMainFunctionBlock ’ or m_Type =<br />
’ gSubFunctionBlock ’ )−>f o r A l l (<br />
3 f u n c t i o n |<br />
4 f u n c t i o n . m_ObjectSet−>s e l e c t (m_Type = ’oAND ’ )−>f o r A l l (<br />
5 o b j e c t |<br />
6 f u n c t i o n . m_BindingSet . m_Connection . m_Calls−>s e l e c t ( m_pObject = o b j e c t and m_pRole<br />
= ’ DataInput ’ ) . m_pPort−>s i z e ( ) = 2<br />
7 )<br />
8 )<br />
Listing 7.30: oAND input port constraint<br />
The requirement that all output ports are connected is not that crucial because those unconnected<br />
ports cannot cause an undefined calculation r<strong>es</strong>ult, but it might be useful to avoid unused<br />
objects in graphs. The corr<strong>es</strong>ponding constraint for the oAND type is defined as follows.<br />
1 context CProject<br />
2 inv : m_GraphSet−>s e l e c t (m_Type = ’ gMainFunctionBlock ’ or m_Type =<br />
’ gSubFunctionBlock ’ )−>f o r A l l (<br />
3 f u n c t i o n |<br />
4 f u n c t i o n . m_ObjectSet−>s e l e c t (m_Type = ’oAND ’ )−>f o r A l l (<br />
5 o b j e c t |<br />
6 f u n c t i o n . m_BindingSet . m_Connection . m_Calls−>s e l e c t ( m_pObject = o b j e c t and m_pRole<br />
= ’ DataOutput ’ ) . m_pPort−>a s S e t ( )−>s i z e ( ) = 1<br />
7 )<br />
8 )<br />
Listing 7.31: oAND output port constraint<br />
The main difference to the input port constraint is that output ports can be connected more<br />
than once. Therefore, a multiple tim<strong>es</strong> connected port may only be counted once. This is done<br />
by the OCL asSet() [63, p. 158] statement. Because those constraints only differ in the object<br />
type name and the number of input and output ports, those are not pr<strong>es</strong>ented here for other<br />
object typ<strong>es</strong>.<br />
107