Creating a Component Architecture

Introduction

To create a component architecture inside an empty new project, open the context menu of the project and select Component Architecture.



In the same way, you can add more component architectures to your project.

Modeling a Component Architecture

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 Model Elements view on the right side to your diagram. In the same way, you can add Input or Output-Ports to your components.



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.

In order to create channels between your components, press the <alt>-Key (<ctrl>-Key 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.



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.

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).



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.

In the Properties View, you can edit the names of selected components, channels and ports. You can also specify comments.



Causality

Each component is declared to be weakly causal or strongly causal. 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.

If you add a component, it is per default weakly causal. You can change the causality in the Properties-View of a component.



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.

Causality and Cycles

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 immediately (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 at least one strongly causal component: this way, the infinite loop of changes cannot occur during a single time unit, but instead spreads on several time instants.

When a cycle does not have this property, one gets the error "Component ... is part of a weakly causal cycle":



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:



Initial Message

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}".

Propagate Data

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 backward and forward buttons in the Properties-View of a Port.

Forward copies the Port-Settings (Name, Type and initial message) to all Ports connected by an outgoing channel.
Backward copies the Port-Settings to all Ports connected by an incoming channel.




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.

Behavior

In order to specify the behavior of your components, you might add either Code Specifications or Automaton Specifications to these.