Skip to content
Snippets Groups Projects
mode_automaton.html 7.52 KiB
Newer Older
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!--  Documentation of Creating a Hierarchical State Automaton. -->

	<link rel="stylesheet" type="text/css" href="../layout/stylesheet.css">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title>Creating a Mode Automaton using AutoFOCUS3 (AF3)</title>
</head>
<div class="header">
<div class="box">
<div class="navbar">
<!--a href="https://www.fortiss.org/" align="left">
<img src="fortiss-logo.png" width="90px" height="20px" align="left">
</a-->
 <div class="dropdown">
    <button class="btn" id="hamburger">
    <label for="hamburger" class="hamburger">
        <span class="hamburgerLine"></span>
        <span class="hamburgerLine"></span>
        <span class="hamburgerLine"></span>
    </label>
    </button>
    <div class="dropdown-content">  
      <a href="../getting_started.html"> Main Page</a>
      <a href="../requirements/MIRA.requirements.html">Requirements Engineering</a>
      <a href="#">Deployment and Code Generation</a>
       <a href="#">Design Space Exploration (DSE)</a>
       <a href="#">Assurance Case Modeling</a>
       <a href="#">Further Resources</a>
    </div>
   </div> 
    <div class="dropdown">
    <button class="dropbtn">Modeling and Simulation <i class="triangle"></i></button>
    <div class="dropdown-content">
	   
	<a href="model_element_attributes.html">Introduction to Graphical Modeling Interface</a>
	<a href="component_architecture.html">Component Architecture Modeling</a>
    <a href="data_dictionary.html">Data Dictionary: Types and Functions</a>
    <a href="code_specification.html">Behavior Modeling -> Code Specifications</a>
	<a href="state_automaton.html">Behavior Modeling -> State Automata</a>
	<a href="hierarchical_state_automaton.html">Behavior Modeling -> Hierarchical State Automata</a>
	<a href="simulation_with_af3.html">Simulation -> Simulation</a>
	<a href="operatorpanels.html">Simulation -> Operator Panels</a>
	<a href="operatorpanels_advanced.html">Simulation -> Advanced interface</a>
	<a href="cosimulation_with_af3.html">Simulation -> Co-Simulation and FMI Support</a>
	<a href="refactoring.html">Refactoring</a>
	<a href="model_markers_view.html">On-the-fly Checks</a>
    </div>
   </div>
<div class="topnav-right">
      <a href="mailto:af_user@lists.fortiss.org?subject=Reporting 'mode_automaton.html' Documentation Problem!&body= Dear Af3 team, I am reporting an issue related to 'modelling and simulation'. 
       {Please specify the problem precisely here.}.">Report a Problem?</a>
    </div>
  </div>
</head>
</div>
</div>
<div class="box">
<button onclick="topFunction()" id="upBtn" title="Go to top">Top</button>
<h2>Creating a Mode Automaton</h2>
<p>Following sections discuss motivation and steps to create Mode Automaton in AF3.</p>
<h4>Motivation and Introduction</h4>
<p>Beside the usage of <a href="state_automaton.html"><i>State Automaton</i></a>, there exists another way to model the behavior of components in a graphical Mode Automaton Diagram.</p>
<p>A component may contain some running modes, which should be used in distinct periods of the time. The control model for such modes is <b>mode automaton</b>. 
The usage of the mode automaton my have consequences on the code efficiency as well as on the correctness of the design. There are four kinds of the model elements in mode automaton.</p>
<p><b>Mode</b>: A mode automaton contains at least one mode. A mode describes the current configuration of computational data flow a component is in. 
This configuration computes outputs for given component depending on the current inputs as well as the state of the local variables. A mode must have a sub component structure, in order to describe the current computation for the component.
An initial mode, which the mode automaton starts with, is required in mode automaton.</p>
<p><b>Switch</b>: Switch controls the change of the mode to execute. Switch element contains the <i>Guards</i>, which takes cares of the switch conditions.</p>
<p><b>Input and Output Ports</b>: A port belongs to a mode, and is the start and the end of a switch.</p>
<p><b>Mode Component Structure</b>: This model element contains the component architecture, which is used to compute the outputs when the corresponding mode active is. Every mode must contain one sub component structure.
A mode component structure must have the same ports with the component, which contains this mode automaton.</p>
<p>The mode automaton editor is very similar to state automaton editor. You can add a mode automaton to your component as shown in figure 1. In mode automaton editor, you might drag&drop a mode from the right Model Elements View to your diagram. In the same way you can add ports and mode component structure to your modes.</p>

<img src="./pictures/modes.add_mode_automaton.png">

<p>You can select the mode and drag it to everywhere in the editor. Same for ports, just pick them and move around the border of the mode.
To resize a mode, pick the lower, the right, or the lower-right point of its bounding-box and then move it.</p>
<p>In order to create switches between your modes, press the <b>&lt;alt&gt;-Key</b> on your keyboard and drag the switch from one port to another port of different I/O-kind. 
You can also create the switch from one mode to another mode, new ports will be created automatically and the switch will be created between the new ports.
Invalid switches (e.g., between two Output-Ports) are avoided by disabling the dragging.</p>

<img src="./pictures/modes.mode_automaton_editor.png">

<p>A mode automaton requires an <b>initial mode</b>. This can be done in the <i>Properties View</i> after you selected a mode. 
This mode is marked with a little black dot afterwards(see the following figure).

<img src="./pictures/modes.initial_mode.png">

<p>In the <i>Properties View</i>, you can also edit the names of selected modes and also specify comments.</p>
<p>Just like transition in state automaton, you can change the route of switches 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.
The conditions for switch between modes are done by specifying <i>Guards</i> of a switch. If no Guard of an outgoing switch is fulfilled, the current mode remains active. 
If a switch can be fired, then new mode will be active, and the sub component architecture of this mode will take over the computation job.</p>

<img src="./pictures/modes.switch_blendpoint.png">

<p> Note that, unlike transitions of a state automaton, mode switches do not have <i>actions</i>.
Modifying the outputs should be done instead through <i>component structure inside a mode</i>.</p>
<h4>Mode Component Structure</h4>
<p> A mode generally contains a component structure.
Editing such a structure is done in the same way as for <a href="component_architecture.html"><i>Component Architectures</i></a>.
You can add a mode component structure as shown in the following figure. 

<img src="./pictures/modes.add_mode_component_structure.png">

The following figure shows an example of a mode component structure.
You can drag and drop the component and channels and like a component architecture.
The ports, which are highlighted in blue rectangles, should correspond to the ports of the component of the mode automaton.

<img src="./pictures/modes.example_mode_component_struct.png">

<script src="../layout/jsscript/topBtn.js">
</script>