<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

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

<html>
	<head>
		<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 Hierarchical State Automaton</title>
	</head>

	<body>
		<div class="header">
			<div class="box">
				<div class="navbar">
					<div class="dropdown">
						<a href="../getting_started.html" style="padding:0;">
							<button class="btn" id="hamburger" onclick="javascript:window.location.href='../getting_started.html'">
								<label for="hamburger" class="hamburger">
									<span class="hamburgerLine"></span>
									<span class="hamburgerLine"></span>
									<span class="hamburgerLine"></span>
								</label>
							</button>
						</a>
						<div class="dropdown-content"> 
						       <button class="dropdown-btn">Getting Started<i class="caret-down"></i></button>
							<div class="dropdown-container">
								<a href=".././managing_projects.html"> Create, Import, Export and Load AF3-Projects</a>
								<button class="dropdown-btn">Examples<i class="caret-down"></i></button>
									<div class="dropdown-container">
										<a href=".././example_co-simulation.html">FMI-based Co-Simulation</a>
									</div>
								<a href=".././tipsAndTricks.html">Tips & Tricks</a>
								<a href=".././af3_faq.html">FAQs</a>
							</div>
							
							<button class="dropdown-btn">Requirements Engineering<i class="caret-down"></i></button>
							<div class="dropdown-container">
								<a href="../requirements/MIRA.requirements_analysis.html"> Requirements Analysis Node</a>
								<a href="../requirements/MIRA.glossary.html">Glossary</a>
								<a href="../requirements/MIRA.requirements.html">Requirements</a>
							</div>

							
							<button class="dropdown-btn">Modeling and Simulation<i class="caret-down"></i></button>
							  <div class="dropdown-container">
								<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="refactoring.html">Refactoring</a>
								<a href="model_markers_view.html">On-the-fly Checks</a>
								<button class="dropdown-btn">Behavior Modeling<i class="caret-down"></i></button>
									<div class="dropdown-container">
										<a href="code_specification.html">Code Specification</a>
										<a href="state_automaton.html">State Automata</a>
										<a style="background-color:#f2f2f2;">Hierarchical State Automata</a>
										<a href="mode_automaton.html"> Mode Automata</a>
									</div>
								<button class="dropdown-btn">Simulation<i class="caret-down"></i></button>
									<div class="dropdown-container">
										<a href="simulation_with_af3.html">Simulation</a>
										<a href="operatorpanels.html">Operator Panels</a>
										<a href="operatorpanels_advanced.html">Advanced Operator Panels</a>
										<a href="cosimulation_with_af3.html"> Co-Simulation and FMI Support</a>
									</div>

							  </div>
							
							<button class="dropdown-btn">Deployment and Code Generation<i class="caret-down"></i></button>
							   <div class="dropdown-container">
								<button class="dropdown-btn">Modeling Technical Architectures<i class="caret-down"></i></button>
									<div class="dropdown-container">
										<a href="../ta/platform_architecture.html">Platform Architecture</a>
											<button class="dropdown-btn">Supported Platform Architectures<i class="caret-down"></i></button>
  												<div class="dropdown-container">
    													<a href="../ta/platform_architecture_generic.html">Generic Platform Architecture</a>
													<a href="../ta/platform_architecture_hierarchical.html">Hierarchical Platform Architecture</a>
													<a href="../ta/platform_architecture_raspberrypi.html">RaspberryPi Platform Architecture</a>
								</div>
										<a href="../ta/task_architecture.html">Task Architecture</a>
										<a href="../ta/partition_architecture.html"> Partition Architecture</a>
										<a href="../ta/allocations.html"> Deployments/Allocations</a>
										<a href="../ta/system_schedule.html"> System Schedule</a>
									</div>
								<a href="../ta/code_generation.html">Code Generation</a>
							   </div>
							
							<button class="dropdown-btn">Design Space Exploration (DSE)<i class="caret-down"></i></button>
							   <div class="dropdown-container">

									<a href="../dse/dse_perspective.html">DSE Perspective Overview</a>
									<a href="../dse/dse_dashboard.html">DSE Dashboard</a>
									<a href="../dse/constraints.html">Constraint Modeling</a>
									<a href="../dse/objectives.html">Objective Modeling</a>
									<a href="../dse/synthesis.html">Deployment/Schedule Synthesis (Exploration)</a>

									<a href="../dse/visualization.html">Solution Visualization</a>
							   </div>
							<button class="dropdown-btn">Assurance Case Modeling<i class="caret-down"></i></button>
							   <div class="dropdown-container">
									<a href="../assuranceCases/creation.html">Modeling GSN-based Assurance Cases</a>
									<a href="../assuranceCases/assessment.html">Quantitative Assessment of Assurance Cases</a>
									<a href="../assuranceCases/maintenance.html">Change Impact Analysis</a>
							   </div>
							<a href=".././furtherResources.MainPage.html">Further Resources</a>
						</div>
					</div> 
					<div class="topnav-right">
						<a href="mailto:af_user@lists.fortiss.org?subject=Reporting 'state_automaton.html' Documentation Problem!&body= Dear AutoFOCUS3 team, I am reporting an issue related to 'modelling and simulation'. 
       {Please specify the problem precisely here.}.">Report a Problem?</a>
					</div>
				</div>
			</div>
		</div>
		<div class="box">

			<button onclick="topFunction()" id="upBtn" title="Go to top">Top</button>


			<h1>Creating a Hierarchical State Automaton</h1>

			<p><i>Hierarchical State Automatons</i> ("HSA") are an extension of <a href="state_automaton.html"><i>State Automatons</i></a> whose states can themselves contain state automatons.</p>

			<p>
Note that HSAs are experimental, thus not all features of state automata are supported.
In particular, the support for verification is limited (e.g., reachability analysis is not supported).
The simulation of HSAs is possible.</p>

			<h3>When to use HSAs?</h3>

			<p>HSAs are useful when a usual state automaton becomes too big to be handled conveniently.
In this case, one can often decompose the state automaton into a HSA.
Note that <i>HSAs are not more powerful than state automata</i>, i.e., one cannot use a HSA to model a behavior which
cannot be modeled by a state automaton.</p>

			<h3>Create a Hierarchical State Automaton</h3>

			<p>To create a HSA, simply model the top state automaton like any other automaton:</p>

			<img width=900px src="./pictures/HSA.Base.Automaton.png"/>

			<p>Then simply drag&drop a state from the Model Elements View to <i>some existing state</i> of your diagram:</p>

			<img width=900px src="./pictures/HSA.Drag.Drop.png"/>

			<p>This will create a state automaton inside the existing state:</p>

			<img width=900px src="./pictures/HSA.Built.png"/>

			<p>You can then double click the state to open this inner automaton:</p>

			<img width=900px src="./pictures/HSA.Inside.png"/>

			<p>And start building the inside automaton as any <a href="state_automaton.html">state automaton</a>:</p>

			<img width=900px src="./pictures/HSA.Inner.Built.png"/>

			<p>When modeling the inner automaton, one can notice that some ports are automatically added, disconnected from any state.
See, e.g., Input, Input1, and Output below:</p>

			<img width=900px src="./pictures/HSA.Inside.Ports.png"/>

			<p>Just as any other port, these ports can be connected to the states, thus allowing to make a connection between the behavior
of the inner state automaton and the outer state automaton.</p>

			<h3>Semantics and Behavior of the Inner Automaton</h3>

			<p>The inner automaton is connected to the outer one through the ports of the outer state.
The semantics of the HSA are as follows:
assume a transition followed in the outer state automaton goes to a hierarchical state through some port "Input":</p>

			<img width=900px src="./pictures/HSA.Base.Automaton.Behavior.png"/>

			<p>Then the focus switches to the inside automaton by following any suitable transition from "Input":</p>

			<img width=900px src="./pictures/HSA.Inner.Automaton.Behavior.png"/>

			<p>Once inside this automaton, the usual behavior of state automaton applies.
Note that, meanwhile, the outer automaton is "frozen" in its current state.
This is until an output port is reached in the inner automaton:</p>

			<img width=900px src="./pictures/HSA.Inner.Automaton.Out.png"/>

			<p>In that case the focus gets back to the outer automaton, which follows the appropriate transition:</p>

			<img width=900px src="./pictures/HSA.Base.Automaton.Out.png"/>

		</div>

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

		<div class="footer">
			<p>
					&copy; 2020 <a href="https://www.fortiss.org/">fortiss GmbH</a> &nbsp;&nbsp;&bull;&nbsp;&nbsp;
				<a href="https://www.fortiss.org/en/publications/software/autofocus-3#c2007">Contact</a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
				<a href="https://www.fortiss.org/en/imprint">Imprint</a>
			</p>
		</div>
	</body>
</html>