-
Simon Barner authored
Issue-Ref: 3835 Issue-Url: https://af3-developer.fortiss.org/issues/3835 Signed-off-by:
Simon Barner <barner@fortiss.org>
Simon Barner authoredIssue-Ref: 3835 Issue-Url: https://af3-developer.fortiss.org/issues/3835 Signed-off-by:
Simon Barner <barner@fortiss.org>
component_architecture.html 7.22 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
Documentation of Creating a Component Architecture.
@author becker
@ConQAT.Rating GREEN Hash: 589F754EB8ACFD8E12013E9DBE185BCA
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Creating a Component Architecture using AutoFOCUS3 (AF3)</title>
</head>
<body>
<h2><u><font color="#336699">Creating a Component Architecture</font></u></h2>
<h4><font color="#336699">Introduction</font></h4>
To create a component architecture inside an empty new project, open the context menu of the project and select <i>Component Architecture</i>.
<br><br>
<img src="./pictures/Components.NewArchitecture.png">
<br><br>
In the same way, you can add more component architectures to your project.
<h4><font color="#336699">Modeling a Component Architecture</font></h4>
Once you have created a component architecture, you can specify the contained components as well as channels between them.
To add a component, drag&drop a component from the <i>Model Elements</i> view on the right side to your diagram. In the same way, you can add Input or Output-Ports to your components.
<br><br>
<img src="./pictures/Components.AddComponent.png">
<br><br>
To move a component, just pick the component somewhere in the middle and move.
To resize a component, pick it in the lower right corner and move the mouse to resize.
<br><br>
In order to create channels between your components, press the <b><alt>-Key</b> (<b><ctrl>-Key</b> under Linux) on your keyboard and drag the channel from one component to another.
If you drag from one component to another, new ports will be created automatically and the channel will be created between the new ports.
If you drag from one port to another, the channel will be created between these ports.
Invalid channels (e.g., between two Output-Ports) are avoided by disabling the dragging.
<br><br>
<img src="./pictures/Components.Channels.png">
<br><br>
You can drop ports either on shown Components or into the free space around the Components.
In the latter case, the ports are added implicitly to the Parent-Component of the Component-Hierarchy.
<br><br>
Notice that Input-Ports of Sub-Components have a different color than Input-Ports of the Parent-Component.
This is, because from the inner point of view, the Input-Ports of the Parent-Component are sending (delegating) data.
Hence, these Input-Ports are black (like the Output-Ports of Sub-Components).
<br><br>
<img src="./pictures/Components.Ports.png">
<br><br>
You can change the route of channels by selecting it, pick the point shown in the middle and move it.
Afterwards, two new points are shown between the moved middle point and the two ports. By moving these points, you can further define the route more precisely.
<br><br>
In the <i>Properties View</i>, you can edit the names of selected components, channels and ports. You can also specify comments.
<br><br>
<img src="./pictures/Components.Properties.png">
<br><br>
<h4><font color="#336699">Causality</font></h4>
Each component is declared to be <i>weakly causal</i> or <i>strongly causal</i>.
Weak causality models instantaneous reaction, while strong causality models a delayed reaction.
This means that in a weak causal component a value arrived at an Input-Port is directly accessible in the same time step,
whereas in a strongly causal component such an input value is accessible only at the next time step.
This indicates that for a strongly causal component, there is a delay of at least one time step before input has any effect on output.
<br><br>
If you add a component, it is per default weakly causal. You can change the causality in the Properties-View of a component.
<br><br>
<img src="./pictures/Components.Causality.png">
<br><br>
The color of a component indicates its causality. There is also a difference in the colors of composite components and atomic components.
However the causality of a composite component depends on its sub-components, therefore composite components all have the same color.
<h4><font color="#336699">Causality and Cycles</font></h4>
Cycles which contain only weakly causal components can entail infinitely many system state modifications at once:
one component of the cycle makes a change, which triggers <i>immediately</i> (due to weak causality)
a change in the next component, which also immediately triggers a change in the next component, etc.
Since we have a cycle, these changes will at one point reach the first component,
thus yielding an infinite loop of changes.
This can be the source of many theoretical and practical problems, therefore,
to avoid this, AF3 only allows cycles which contain <i>at least one strongly causal component:</i>
this way, the infinite loop of changes cannot occur during a single time unit,
but instead spreads on several time instants.
<p>
When a cycle does not have this property, one gets the error "Component ... is part of a weakly causal cycle":
<br><br>
<img src="./pictures/Weak.Cycle.png">
<br><br>
If it is indeed a property of the model to have such a cycle then one has no other choice than modifying
the design of the model so as to satisfy the strong-causal-cycle requirements.
However, most of the time, the error happens in the process of building a model, when the components are not marked yet
as strongly causal, or when they are composite components whose (not yet provided) implementation is intended to be
made only of strongly causal components.
In such cases one can either accept the error until one provides a strongly-causal implementation, or fix the error
by just marking (at least) one of the components among the path as strongly causal:
<br><br>
<img src="./pictures/Strong.Cycle.png">
<br><br>
<h4><font color="#336699">Initial Message</font></h4>
The field initial message provides the first message delivered by the port.
If a port is of type array, it can be initialized by the expression "[value_0, value_1, ..., value_N]".
If a port is of type structure, it can be initialized by the expression "{MEMBER_x:value_x, MEMBER_y:value_y, ..., MEMBER_z:value_z}".
<h4><font color="#336699">Propagate Data</font></h4>
AutoFOCUS provides some mechanisms to make development easier and faster.
For instance, if you have already connected two Ports by a Channel and want subsequently change the type of the Ports,
you have to do this only at one of the both connected Ports.
Instead of doing the same at the other Port again, you should use the <i>backward</i> and <i>forward</i> buttons in the Properties-View of a Port.
<br><br>
<i>Forward</i> copies the Port-Settings (Name, Type and initial message) to all Ports connected by an outgoing channel.<br>
<i>Backward</i> copies the Port-Settings to all Ports connected by an incoming channel.<br>
<br><br>
<img src="./pictures/Components.Propagation.png">
<br><br>
In the shown example the settings of the selected Output-Port are propagated to the connected Input-Port. Also the channel is renamed by this.
<h4><font color="#336699">Behavior</font></h4>
In order to specify the behavior of your components, you might add either <a href="code_specification.html"><i>Code Specifications</i></a> or <a href="state_automaton.html"><i>Automaton Specifications</i></a> to these.
<br><br>
<br><br>
</body>
</html>