<!DOCTYPE html
SYSTEM "about:legacy-compat">
-<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="tutorial-advanced-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Advanced System Dynamics Modelling</title></head><body id="tutorial-advanced-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Advanced System Dynamics Modelling</h1><div class="body"><div class="div hr">
-</div><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#creating-model-and-modules">1 Creating model and modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#initial-configuration">2 Initial configuration</a></p></li><li class="li"><p class="p"><a class="xref" href="#workforce-module">3 Workforce module</a></p></li><li class="li"><p class="p"><a class="xref" href="#work-module">4 Work module</a></p></li><li class="li"><p class="p"><a class="xref" href="#connecting-modules">5 Connecting modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulating-the-model">6 Simulating the model</a></p></li></ul><p class="p">In this tutorial, we are going to bild a work model with two projects and shared workforce. Both the workforce and a separate project (work) are going to be created as modules, so they can be reused several times. Actually the model doesn't limit the number of projects at all. A <a class="xref" href="BasicTutorial.html">basic tutorial</a> is also available. This tutorial is part of the <a class="xref" href="sysdyn.html">sysdyn documentation</a>.</p></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="creating-model-and-modules"><h2 class="title topictitle2" id="ariaid-title2">Creating model and modules</h2><div class="body"><div class="div hr">
-</div><p class="p">Let's start by creating the work model and the needed modules. First create a new model by right-clicking on the model browser and selecting New->Model. Alternatively you can select File->New Model from the main menu.</p><p class="p">Then create two new modules to your model. Right-click on the Modules folder and select New->Module.</p><p class="p">Name your model WorkModel and modules WorkforceModule and WorkModule. You can rename them by right-clicking on the item on the model browser and selecting Rename.</p><div class="div imageBorder">
+<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="topic"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="tutorial-advanced-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Advanced System Dynamics Modelling</title></head><body id="tutorial-advanced-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Advanced System Dynamics Modelling</h1><div class="body"><div class="div hr">
+</div><p class="p">This tutorial goes more in-depth on the advanced features of the Simantics System Dynamic tool. Namely modules, custom Modelica functions, special variables and enumerations (i.e. vector variables). We are going to build a model that simulates how a shared workforce works on several overlapping projects. You can think of the resulting model as a framework on which to build models that, for example, simulate a project portfolio of a company. It is advised that you complete the <a class="xref" href="BasicTutorial.html">basic tutorial</a> before starting. If you find yourself stuck, seek help from the <a class="xref" href="sysdyn.html">documentation</a>.</p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#Creating-model-and-modules">1 Creating model and modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#Initial-configuration">2 Initial configuration</a></p></li><li class="li"><p class="p"><a class="xref" href="#Workforce-module">3 Workforce module</a></p></li><li class="li"><p class="p"><a class="xref" href="#Project-module">4 Project module</a></p></li><li class="li"><p class="p"><a class="xref" href="#Connecting-modules">5 Connecting modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#Simulating-the-model">6 Simulating the model</a></p></li><li class="li"><p class="p"><a class="xref" href="#Adding-modules">7 Adding modules</a></p></li></ul></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="creating-model-and-modules"><h2 class="title topictitle2" id="ariaid-title2">Creating model and modules</h2><div class="body"><div class="div hr">
+</div><p class="p">Start by creating a new model from File→New→SD Model, rename the model to WorkModel. Then create two new modules by right-clicking on the Modules folder under the WorkModel tree and selecting New→Module. Rename the modules to Workforce and Project by selecting them in the Model Browser and using the properties view.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/NewModel.png"><br>
<p class="p imageText">Creating a new model</p>
</div><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ModelStructure2.png"><br>
<p class="p imageText">Model after renaming</p>
</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title3" id="initial-configuration"><h2 class="title topictitle2" id="ariaid-title3">Initial configuration</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+</div><p class="p">We will use a top-down approach in creating our model - focusing first on the bigger picture of the model and implementing the internal structure of the modules later.</p><p class="p">Open the model configuration by double-clicking Configuration in your model browser. Drag one Workforce and one Project from your Model Browser to the WorkModel diagram. The modules are automatically named with a suffix number.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/TwoModules.png"><br>
- <p class="p imageText">Workforce and Work modules</p>
-</div><p class="p">We will use a top-down approach in our model, so first we will make a simple model configuration with our modules. Open our model configuration by double-clicking Configuration in your model browser.</p><p class="p">Drag one WorkforceModule and one WorkModule from your model browser to the WorkModel diagram. The modules are automatically named with a suffix number. Rename the modules to Workforce and Work1. You can rename objects on the diagram by double-clicking them or selecting them with one click and renaming them on the properties view below the diagram.</p><div class="div imageBorder">
+ <p class="p imageText">Workforce and Project modules</p>
+</div><p class="p">You can think of modules as user made components that communicate with rest of the model by having some input(s) and output(s). In this model the internal implementation of Workforce module should handle resourcing people to projects according to their needs. The Project module should simulate how the people that are assigned to that specific project are advancing the project.</p><p class="p">While not used in this tutorial, Simantics System Dynamics supports nested modules, i.e. modules inside modules. Modules can also be exported and imported independent of the model.</p><p class="p">Let's consider what kind of information we need to pass between the modules. First of all, the Project needs to tell the Workforce module how much workforce it needs. Create an input variable and name it to RequestedWorkingSpeed to pass this information along. Connect Project1 module to RequestedWorkingSpeed and RequestedWorkingSpeed to Workforce1 with a dependency arrow.</p><p class="p">Input variable is a special type of symbol that acts as an interface between modules and the rest of the model. They are the only symbol type that can be connected directly to module outputs and they also act as the only way of creating inputs inside modules, as we will see later.</p><p class="p">We also need to assign people to work for the project - the Workforce module needs to tell the Project module how well we can respond to the request. Create a new input variable called ResponsedWorkingSpeed and connect it to the modules with dependency arrows.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ConfigurationStart.png"><br>
<p class="p imageText">Workforce and Work modules, first inputs and connections</p>
-</div><p class="p">When the modules are on the diagram, we should think what values we would like to get from the modules and what values we would like to use in the modules.</p><p class="p">Workforce needs to know, how much work is required and it should provide information on how much work can be done. To provide the information on how much work can be done, we need an Input variable. Variables can be dragged to the diagram from Symbols view or by using <a class="xref" href="sysdyn.html#shortcut-and-control-keys">shortcut keys</a> (Shift+I for Input variable). Drag an input variable to the diagram and name it TotalPossibleWorkingSpeed.</p><p class="p">Work module on the other hand provides information on how much work is required in it and it needs to know when the work has to be ready. Create an input variable RequiredWorkingSpeed1 and an Auxiliary variable Work1CompletionTime and place all variables like in the picture on the right.</p><p class="p">Connect the variables to modules using dependency connections (arrows). Connections are created by holding down Alt key and first clicking on the variable where to start the connection and then clicking on the variable where to end.</p><p class="p">Now we have the initial idea of the model, so let's configure the modules.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title4" id="workforce-module"><h2 class="title topictitle2" id="ariaid-title4">Workforce module</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+</div><p class="p">Now we have the first version of the top-level model structure completed, we can start configuring the modules.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title4" id="workforce-module"><h2 class="title topictitle2" id="ariaid-title4">Workforce module</h2><div class="body"><div class="div hr">
+</div><p class="p">Open the Workforce module by double-clicking it under the Modules folder.</p><p class="p">First, create an input variable and name it to RequestedNumberOfPeople, this variable receives the request provided by the Project module. Then, create 3 auxiliary variables and name them NumberOfEmployees, EmployeesAssigned and NumberOfFreeEmployees. Lastly connect the variables as shown in the picture. The unit of these variables is number of people.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/NetResourcing1.png"><br>
- <p class="p imageText">Cloud, Valve, Flow and Stock</p>
-</div><p class="p">Open Workforce module by selecting it from the diagram, right-clicking it and selecting Show Module.</p><p class="p">Create a Stock variable and name it WorkforceStock. Stock variables are created the same way as Input and Auxiliary variables. The level of the stock is controlled with a valve and a flow. To create the flow, hold down Alt and right-click on an empty space left of the stock. Then left-click on the stock. A cloud, valve and a flow is created. Rename the valve to NetResourcing.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/NetResourcing2.png"><br>
- <p class="p imageText">Cloud, Valve, Flow and Stock. Flow works both on directions.</p>
-</div><p class="p">NetResourcing works both ways. To display this also visually, delete the cloud by selecting it and pressing delete on your keyboard. Then create a flow starting from NetResourcing valve and ending on an empty space next to it.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/WorkforceAuxiliaries.png"><br>
- <p class="p imageText">Auxiliaries in Workforce module</p>
-</div><p class="p">Now you have used all the basic components and connections. From now on the instructions will be a more simplified.</p><p class="p">Next we will create four Auxiliary variables: TimeToAllocateResources, WorkforceRequired, Productivity and PossibleWorkingSpeed. Place and connect them according to the picture on the right.</p><p class="p">To be able to simulate the model, all variables must have valid equations. To configure an equation, select a variable. Variable's properties are shown in the Property view and you can input the required equations in the text fields. You can copy the equations directly from here or type them manually. Variables connected to the selected variable are shown in the Variables list. To speed up typing, you can double click on a variable name and it will be inserted to the equation.</p><pre class="pre">WorkforceStock
-Initial value: 0
-
-NetResourcing
-= (WorkforceRequired - WorkforceStock)/TimeToAllocateResources
-
-TimeToAllocateResources
-= 2
-
-Productivity
-= 1
-
-PossibleWorkingSpeed
-= WorkforceStock * Productivity
-Is Output
-</pre><p class="p">Variables can be set as output by selecting Is Output option from the Equation tab.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/RequiredWorkingSpeedInput.png"><br>
- <p class="p imageText">RequiredWorkingSpeedInput</p>
-</div><p class="p">On a previous phase, we wanted to give the value of RequiredWorkingSpeed1 to this workforce module. To get that value, we need to create an input. Create input RequiredWorkingSpeedInput, connect it to WorkforceRequired and write the following equation to WorkforceRequired.</p><pre class="pre">WorkForceRequired
-= RequiredWorkingSpeedInput/Productivity
-</pre><p class="p">Now this module is ready to be used as a part of the model.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title5" id="work-module"><h2 class="title topictitle2" id="ariaid-title5">Work module</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+ <p class="p imageText">Internal structure of the Workforce module</p>
+</div><p class="p">Now we need to give the symbols equations, these are written below. To configure an equation, select a variable and write (or copy-paste) the corresponding equation to the text field in the Properties view. Connected variables are shown in the Variables list on the right side of the properties view. You can double-click on a variable name to insert it to the equation.</p><pre class="pre">NumberOfEmployees
+= 10
+
+NumberOfFreeEmployees
+= NumberOfEmployees-EmployeesAssigned
+
+EmployeesAssigned
+= min(RequestedNumberOfPeople, NumberOfEmployees)
+</pre><p class="p">Also, we need to decide what value(s) we want the module to output. Make sure that the Is Output checkbox is ticked on the EmployeesAssigned variable, as this is the variable that tells how many people can be provided for the project.</p><p class="p">We are using a built-in function min() for calculating how many employees we are going to assign. You can find a list of these in the Model Browser under WorkModel→Functions→Built-in Functions.</p><p class="p">On the first iteration of this model, we are going to have 10 fulltime employees that get assigned to a single project according to the request. We are going to expand the structure of this module to handle several projects later on in the tutorial. This module is now ready to be used as a part of the first iteration of the model.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title5" id="work-module"><h2 class="title topictitle2" id="ariaid-title5">Work module</h2><div class="body"><div class="div hr">
+</div><p class="p">Open Project module by double-clicking it on the Model Browser.</p><p class="p">Create a flow of work with stocks and flows like in the picture. This loop says that there is some initial amount of work that is done at a certain speed, gradually becoming completed work. However, our workers are not perfect, as such errors can occur during work. These errors are first undiscovered, and as they are found they become work that needs to be completed.</p><p class="p">You will see red exclamation mark next to the symbols due to empty equation fields, these are omitted from the tutorial images for clarity reasons. We will return to fill in these fields later.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/WorkStocks.png"><br>
<p class="p imageText">Basic work with errors</p>
-</div><p class="p">Open Work1 module by selecting it from the WorkModel diagram, right-clicking it and selecting Show Module. Alternatively you can double click Work1 on the model browser.</p><p class="p">Create the basic flow of work with stocks and flows like in the picture on the right.</p><p class="p">The idea of the model is that first there is work. Work is done at a certain speed. When working, errors are also made. When errors are found, the amount of Errors is reduced, errors are removed from WorkDone and moved back to WorkToDo.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ProjectIsReady.png"><br>
- <p class="p imageText">Smoothener for work is done</p>
-</div><p class="p">Work needs to be stopped when the project is ready. Since the simulator might face some difficulties to determine the projects readyness when project is almost ready, we need to implement some smoothing to the limit. OpenModelica doesn't yet have a builtin function for smoothing, so we need to implement our own. Create variables and connections according to the picture on the right.</p><p class="p">Use the following equations for variables:</p><pre class="pre">ProjectIsReady
-Initial value: 0
-
-ProjectReadyness
-= (xidz(WorkDone, ProjectWorkAmount, 0.0) - ProjectIsReady) / 0.08
-</pre><p class="p">xidz is short for function X if devided by zero. This means that the simulation calculates ''WorkDone / ProjectWorkAmount''. If ProjectWorkAmount is zero, the result is the third argument ''0.0''.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ProjectWorkAmount.png"><br>
- <p class="p imageText">ProjectWorkAmount input variable</p>
-</div><p class="p">As you can see, ProjectWorkAmount is highlighted. Your model doesn't contain such variable and it is not connected to ProjectReadyness. Create an Input variable ProjectWorkAmount with default value 1000 and connect it to ProjectReadyness. The reason we are using input variable is that you can determine the default size of a project, but if you want to change it, you can change it from outside the module.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ErrorsVariables.png"><br>
- <p class="p imageText">Variables needed for error handling</p>
-</div><p class="p">Next we need to define how errors are found. For that we need new variables: WorkQuality and ErrorsFoundTime. Create the variables and connections according to the picture and give variables their equations.</p><pre class="pre">ErrorsGenerated
-= (1-WorkQuality) * WorkingSpeed
+</div><p class="p">Next let's create variables that control the parameters of a project and handle the request of asking people for work. Create auxiliary variables: StartTime, Deadline, ProjectDuration, TimeToStartTime, TimeToDeadline, RequestedWorkingSpeed, ProjectWorkAmount and NumberOfWorkdaysInProject. Connect the symbols as in the picture and write the following expression to their expression fields. Click the checkbox Is Output on RequestedWorkingSpeed variable to make the module output the value of this variable.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ProjectRequestPeople.png"><br>
+ <p class="p imageText">Structure of requesting people to work</p>
+</div><pre class="pre">StartTime
+= 5
-ErrorsFoundRate
-= Errors/ErrorsFoundTime
+Deadline
+= 20
-WorkQuality
-= 0.9
+ProjectDuration
+= Deadline-StartTime
-ErrorsFoundTime
-Type: WithLookup
-With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0)
-Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
-</pre><p class="p">WithLookup is a variable type where the value is interpolated from a 2-dimensional table (Lookup table) using the value determined in the "With Lookup" field. Type can be changed from the drop-down menu Type.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/WorkAllocation.png"><br>
- <p class="p imageText">WorkAllocation and RequiredWorkingSpeed</p>
-</div><p class="p">To calculate our own need for workforce we need to create and connect WorkCompletionTime input variable and the following auxliary variables:</p><pre class="pre">RequiredWorkingSpeed
-= if ProjectIsReady < 1 then xidz(WorkToDo, TimeToDeadline, MaximumWorkingSpeed) else 0
-Is Output
-
-MaximumWorkingSpeed
+TimeToStartTime
+= max(0, StartTime-time)
+
+TimeToDeadline
+= Deadline-time
+
+RequestedWorkingSpeed
+= if WorkToDo > 0 and TimeToStartTime == 0 then NumberOfWorkdaysInProject/ProjectDuration else 0
+
+ProjectWorkAmount
= 500
-TimeToDeadline
-= max(0, WorkCompletionTime-time)
-</pre><p class="p">time is a universal variable that gives the current simulation time.</p><p class="p">We need to decide how the workforce is allocated between all the work modules that are using the same workforce. For that we need to know how much work can be done and how much workforce other works require.</p><p class="p">Create two Inputs, RequiredWorkingSpeedTotalInput and PossibleWorkingSpeedInput, and an auxiliary variable WorkAllocation. Connect the variables like int the picture.</p><pre class="pre">WorkAllocation
-= xidz(RequiredWorkingSpeed, RequiredWorkingSpeedTotalInput, 0.0) * PossibleWorkingSpeedInput
-</pre><p class="p">Finally let's give initial values for all the remaining variables:</p><pre class="pre">WorkingSpeed
-= if ProjectIsReady < 1 then WorkAllocation else 0
+NumberOfWorkdaysInProject
+= ProjectWorkAmount/7
+</pre><p class="p">The project has parameters for starting time, deadline and budgeted hours of work. Based on these we calculate how many people the project needs, assuming that an average worker works for 7 hours per day. The number of people is handled as a floating point integer, meaning that one worker can work on multiple different projects.</p><p class="p">Now let's create an input variable to take in the information of how much workforce we got from our request. Create an input variable and name it ResponseWorkingSpeedInput. We are also going to calculate how many hours a day the workers need to work in order to get the project ready in time and limit the result between 7 and 9 hours a day. Create two auxiliary variables and name them RequiredWorkHoursPerDay and TotalWorkHoursPerDay, connect them to other variables as in the image.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ResponsedWorkingSpeedInput.png"><br>
+ <p class="p imageText">Input for responsed working speed</p>
+</div><p class="p">Write the following expression to the equation fields of the new auxiliary variables:</p><pre class="pre">RequiredWorkHoursPerDay
+= if ResponseWorkingSpeedInput == 0 then 0 else if TimeToDeadline < 0 then 9 else minmax(WorkToDo/ResponseWorkingSpeedInput/TimeToDeadline, 7, 9)
+
+TotalWorkHoursPerDay
+= RequiredWorkHoursPerDay*ResponseWorkingSpeedInput
+
+WorkingSpeed
+= TotalWorkHoursPerDay
+</pre><p class="p">Next we focus on completing the structure of the work loop. Create 2 auxiliary variables and name them WorkQuality and ErrorsFoundTime. Also, create two Shadow variables and select WorkQuality and ProjectWorkAmount as the referred variables. Shadow variable is a special type of variable, whose role is to pass along the referred variable value to a place where drawing a dependency arrow from the original symbol would make the graph difficult to read. Place the new symbols as in the image and make the dependency connections.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/WorkLoop.png"><br>
+ <p class="p imageText">Completed work loop structure</p>
+</div><p class="p">Now that the structure of the work loop is completed let's input equations to the variables.</p><pre class="pre">WorkToDo
+Integral: ErrorsFoundRate - WorkingSpeed
+Initial Value: ProjectWorkAmount
+
+WorkDone
+Integral: WorkingSpeed - ErrorsFoundRate
+Initial Value: 0
+
+ErrorsGenerated
+= (1-WorkQuality) * WorkingSpeed
-WorkToDo
-Initial value: ProjectWorkAmount
+UndiscoveredErrors
+Integral: ErrorsGenerated - ErrorsFoundRate
+Initial Value: 0
-WorkDone
-Initial value: 0
+ErrorsFoundRate
+= UndiscoveredErrors/ErrorsFoundTime
+</pre><p class="p">For ErrorsFoundTime we are going to use a special type of auxiliary variable called WithLookup. WithLookup is a variable type where the value is interpolated from a 2-dimensional (Lookup) table using the value determined in the "With Lookup" field. Input the following values.</p><pre class="pre">ErrorsFoundTime
+Type: WithLookup
+With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0)
+Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
+</pre><p class="p">This variable makes it so that the less we have completed work the larger the variable value is and vice versa. And as we use this value in ErrorsFoundRate variable to divide the number of undiscovered errors, a practical interpretation would be that when we start working on a project we don't discover errors easily. But, as the project gets more and more completed we start to discover more and more errors made earlier on in the project.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ErrorsFoundTimeWithLookUp.png"><br>
+ <p class="p imageText">Choosing WithLookup as the auxiliary type</p>
+</div><p class="p">Now we are going to create a small feedback structure around WorkQuality. The purpose is to simulate how working overtime for a prolonged period causes fatigue. Create a stock variable called Fatigue and two flows, WorkingOverTime and SlowRecovery. Also create a shadow variable of RequiredWorkingHoursPerDay. Connect the variables as shown in the image.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/WorkQualityStructure.png"><br>
+ <p class="p imageText">Structure around WorkQuality</p>
+</div><p class="p">Input the following equations to the variables:</p><pre class="pre">WorkingOverTime
+= if RequiredWorkHoursPerDay == 0 then 0 else (RequiredWorkHoursPerDay-7)*0.025
+
+SlowRecovery
+= if Fatigue >= 0 then 0.03 else 0
+
+Fatigue
+Integral: WorkingOverTime - SlowRecovery
+Initial Value: 0
-Errors
-Initial value: 0
-</pre></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="connecting-modules"><h2 class="title topictitle2" id="ariaid-title6">Connecting modules</h2><div class="body"><div class="div hr">
-</div><p class="p">Our modules are complete. Let's get back to the WorkModel Configuration.</p><pre class="pre">Set Work1CompletionTime to 10.
-</pre><div class="div imageBorder">
+WorkQuality
+= max(0.95*(1-Fatigue), 0.7)
+</pre><p class="p">Now working overtime causes fatigue to build up slowly, and fatigue in return causes work quality to decrease. This in return makes the workers more prone to do errors while working, causing more work to do, increasing the need for overtime work.</p><p class="p">There is only one thing left to do for this module, we are going to create variables that tell when the project was completed. An intuitive approach would be to claim that a project is complete when the value of WorkToDo goes to zero. However, due to the structure of the work loop we are likely to find some errors even after the WorkToDo goes to zero. We solve this by recording the time when WorkToDo is zero (or under) for the first time.</p><p class="p">Create a ghost variables of WorkToDo and Deadline. Then, create three auxiliary variables called ProjectIsCompleted, ProjectCompletitionTime and DaysLateOnDeadline. Connect the variables as in the image.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/DaysLateOnDeadlineStructure.png"><br>
+ <p class="p imageText">Structure of DaysLateOnDeadline</p>
+</div><p class="p">The variables use the following equations:</p><pre class="pre">ProjectIsCompleted
+= if time == 0 then 0 else if WorkToDo > 0 and ProjectIsCompleted == 0 then 0 else 1
+
+ProjectCompletitionTime
+= if ProjectIsCompleted == 0 then time else ProjectCompletitionTime
+
+DaysLateOnDeadline
+= ProjectCompletitionTime-Deadline
+</pre><p class="p">You can think of ProjectIsCompleted as a Boolean variable that goes to 1 and stays there when WorkToDo goes to 0 for the first time. ProjectCompletitionTime keeps track of time until the project is completed.</p><p class="p">Now the Project module is complete.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/CompletedProjectModule.png"><br>
+ <p class="p imageText">Completed Project module</p>
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="connecting-modules"><h2 class="title topictitle2" id="ariaid-title6">Connecting modules</h2><div class="body"><div class="div hr">
+</div><p class="p">Now that our modules are complete, let's get back to the WorkModel Configuration and connect the inputs and outputs of the modules. Select Project1 and then select Outputs tab from the properties view. Select the only available variable as the connection. Do the same in the Inputs tab. And repeat this process for Workforce1 also.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ModuleConnections1.png"><br>
<p class="p imageText">Module input connections</p>
-</div><p class="p">Connections between modules are made in the properties of the module. Select Work1 and open tab Inputs from the properties. The table lists all input variables in the module that are available. Clicking on the Refers to output column will open a drop-down menu that shows all available variables that are connected to the module. By selecting a variable, you connect that variable to the input.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ModuleConnections2.png"><br>
- <p class="p imageText">Module input connections</p>
-</div><p class="p">Work1 need also information on how much working speed is required by all works. Since Work1 is the only work, create a dependency connection from RequiredWorkingSpeed1 to Work1 and in Work1's properties connect it to RequiredWorkingSpeedTotalInput.</p><p class="p">In Outputs tab, make the only possible connection: from RequiredWorkingSpeed to RequiredWorkingSpeed1.</p><p class="p">Workforce module has only one input and one output. Create the only possible connections:
-(Inputs) RequiredWorkingSpeedInput -> RequiredWorkingSpeed1
-(Outputs) PossibleWorkingSpeed -> TotalPossibleWorkingSpeed</p><p class="p">Now your model is ready for simulation!</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title7" id="simulating-the-model"><h2 class="title topictitle2" id="ariaid-title7">Simulating the model</h2><div class="body"><div class="div hr">
-</div><p class="p">To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 24.0</p><div class="div imageBorder">
+</div><p class="p">Now your model is ready for simulation!</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title7" id="simulating-the-model"><h2 class="title topictitle2" id="ariaid-title7">Simulating the model</h2><div class="body"><div class="div hr">
+</div><p class="p">To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 50.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ActivateExperiment.png"><br>
<p class="p imageText">Experiment activation</p>
-</div><div class="p">To run simulations, you must activate an experiment. Expand the experiments folder on your model browser. There is one ready-made experiment. Double click on the experiment and the experiment control buttons appear on the toolbar. To simulate the model, press the play button: <div class="div image">
-<img class="image" src="AdvancedTutorialImages/ExperimentPlay.png"><br><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen.</p><div class="div image">
+</div><p class="p">To run simulations, you must activate an experiment. Expand the experiments folder on your model browser. There is one ready-made experiment. Double-click on the experiment and the experiment control buttons appear on the toolbar. To simulate the model, press the play button:</p><div class="div image">
+ <img class="image" src="AdvancedTutorialImages/ExperimentPlay.png"><br>
+</div><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen.</p><div class="div image">
<img class="image" src="AdvancedTutorialImages/SimulationProgress.png"><br>
-</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">If the Console view pops up and shows an error "Error: Too few equations, underdetermined system. The model has X equation(s) and Y variable(s)", the simulation has failed. The reason might be that you forgot to assign an equation to some variable or some connection in modules. See through all the variables, write the missing equation and simulate again.</p><p class="p">After the simulation is succesfully run, you can select a variable and see its simulation results in the trend view. For example WorkDone variable in Work1 module will give the following graph.</p><div class="div image">
+</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">If the Console view pops up and shows an error "Error: Too few equations, underdetermined system. The model has X equation(s) and Y variable(s)", the simulation has failed. The reason might be that you forgot to assign an equation to some variable or some connection in modules. See through all the variables, write the missing equation and simulate again.</p><p class="p">After the simulation has successfully completed, you can select a variable from model browser under Configuration to see its values over time in the trend view. You can also right-click on a module and select Show Module. This brings up a view of the internal structure of the module instance used in the simulation. Selecting a variable from there will show its values in the trend view.</p><div class="div image">
+ <img class="image" src="AdvancedTutorialImages/ShowModule.png"><br>
+</div><p class="p">For example, RequiredWorkingHoursPerDay variable in Project1 module should give the following graph. At first assigned workers are working 7 hours per day, but they start working more when the deadline starts closing in. After the project is completed, a few undiscovered errors are found and workers return to correct them.</p><div class="div image">
<img class="image" src="AdvancedTutorialImages/FirstSimulation.png"><br>
-</div></div></div><article class="topic nested2" aria-labelledby="ariaid-title8" id="adding-modules"><h3 class="title topictitle3" id="ariaid-title8">Adding modules</h3><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ModulesFinal.png"><br>
- <p class="p imageText">Final configuration with two modules</p>
-</div><p class="p">We created the WorkModule to be reusable. To use two WorkModules in the model, you must do the following.</p><p class="p">Populate a second WorkModule to WorkModel configuration and name it Work2.</p><p class="p">Create RequiredWorkingSpeed2 input variable and Work2CompletionTime auxiliary variable.</p><p class="p">We need a sum of all working speed requirements to give to the work modules. For this purpose, create an auxiliary variable RequiredWorkingSpeedTotal which sums the requirements.</p><p class="p">You can also have a different size work. To make Work2 smaller, create an auxiliary variable Work2Amount.</p><p class="p">Use the following equations:</p><pre class="pre">Work2CompletionTime
-= 13
-
-Work2Amount
-= 800
-
-RequiredWorkingSpeedTotal
-= RequiredWorkingSpeed1 + RequiredWorkingSpeed2
-</pre><p class="p">Update connections to match connections shown in the picture and connect the inputs and outputs to the modules.</p><pre class="pre">Workforce
-RequiredWorkingSpeedInput -> RequiredWorkingSpeedTotal
-
-Work1 Inputs
-RequiredWorkingSpeedTotalInput -> RequiredWorkingSpeedTotal
-
-Work2 Outputs
-RequiredWorkingSpeed -> RequiredWorkingSpeed2
-
-Work2 Inputs
-</pre><div class="div image">
- <img class="image" src="AdvancedTutorialImages/Module2Inputs.png"><br>
-</div><p class="p">When all the connections are made, you can simulate the model again. Now you have model with two work modules. Select variables from both modules in model browser to display them in trend view.</p><div class="div image">
- <img class="image" src="AdvancedTutorialImages/SecondSimulation.png"><br>
-</div></div></article></div></article></article></main></body></html>
\ No newline at end of file
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title8" id="adding-modules"><h2 class="title topictitle2" id="ariaid-title8">Adding modules</h2><div class="body"><div class="div hr">
+</div><p class="p">Now that we have a model with one Project module we are going to expand the model to support as many Projects as we want. First, we need to make some restructuring on the top level. Delete the dependency arrow that goes from ResponsedWorkingSpeed to Project1 module, also delete RequestedWorkingSpeed symbol entirely. Now create two new auxiliary variables and name them RequestedWorkingSpeed and WorkforceProject1. Connect the new auxiliaries as in the picture, remember make the connection inside the module properties as well.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddingModules1.png"><br>
+ <p class="p imageText">Updated model structure</p>
+</div><p class="p">Write the following equations inside the new variables:</p><pre class="pre">RequestedWorkingSpeed
+= Project1.RequestedWorkingSpeed
+
+WorkforceProject1
+= ResponsedWorkingSpeed
+</pre><p class="p">Notice that we can access variable values without having dependency arrows connected, we are given a warning next to the symbol as this should be done only when you know exactly what you are doing. Also, note that we can access values inside modules by using a dot notation modulename.variablename.</p><p class="p">Simulate the model once to make sure nothing broke.</p><p class="p">Next create a new Project module and a corresponding auxiliary variable WorkforceProject2, connect the auxiliary variable to the module and make the input connection in the module settings.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddingModules2.png"><br>
+ <p class="p imageText">Updated model structure</p>
+</div><p class="p">Now we need to make the Workforce1 module to work with several projects at the same time, for this we use enumerations. You can think of enumerations as indices of a vector variable. To create an enumeration right-click on Configuration and select New→Enumeration.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/NewEnumeration.png"><br>
+ <p class="p imageText">Creating a new enumeration</p>
+</div><p class="p">Select the newly created enumeration under Configuration and rename it to Projects. Then, select the enumeration and from properties view click twice on Add, rename index and index2 to Project1 and Project2 respectively.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddEnumerations.png"><br>
+ <p class="p imageText">Creating new indices for Projects enumeration</p>
+</div><p class="p">Now we have created the needed enumeration for the top level model. We need to create one for the Workforce module as well. Under the Modules folder in the model browser right-click on Workforce, select New→Enumeration, name it Projects and add a single dummy enumeration. Then make sure the checkbox Can be replaced by parent module is checked. Then select Workforce1 module and from Module Properties overwrite enumeration Projects with Projects. This way we only have to update enumerations in one place when adding new projects to the model.</p><p class="p">Now we need to select which variables use the enumerations, i.e. what scalar variables we need to turn into vector variables. In the top-level model select RequestedWorkingSpeed and ResponsedWorkingSpeed by holding down ctrl while left-clicking on the symbols, this should bring up a view that allows you to add enumerations to the selected symbols. From the left select Projects by left-clicking and click on the arrow, Projects enumeration should appear on the right side.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddEnumerationToSymbols.png"><br>
+ <p class="p imageText">Adding enumerations to symbols</p>
+</div><p class="p">We need to change the equations of RequestedWorkingSpeed, WorkforceProject1 and WorkforceProject2. RequestedWorkingSpeed needs information from both Project modules and WorkforceProject variables should be scalars. Input the following equations:</p><pre class="pre">RequestedWorkingSpeed
+= {Project1.RequestedWorkingSpeed, Project2.RequestedWorkingSpeed}
+
+WorkforceProject1
+= ResponsedWorkingSpeed[Project1]
+
+WorkforceProject2
+= ResponsedWorkingSpeed[Project2]
+</pre><p class="p">Next we need to update the structure of Workforce module so that it handles vector variables. Open the module by right-clicking on Workforce1 and selecting Show Module.</p><p class="p">Select variables EmployeesAssigned and RequestedNumberOfPeople and add the Projects enumeration to them as before.</p><p class="p">Now we are going to create a custom function that allocates people to projects. To create a custom function, in the Model Browser right-click on Functions folder and select new→Function. Now click on the newly created function and rename it to AssignWorkersToProjects.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/NewFunction.png"><br>
+ <p class="p imageText">Creating a new function</p>
+</div><p class="p">Write (or copy-paste) the following Modelica code to the empty text field. When working with custom Modelica functions note that you need to press shift+enter to create new lines.</p><pre class="pre">public input Real requestedhr[:];
+public input Real totalrequestedhr;
+public input Real availablehr;
+public output Real allocatedhr[size(requestedhr, 1)];
+algorithm
+requestaspercentage := zeros(size(requestedhr, 1));
+nofpeople := zeros(size(requestedhr, 1));
+for i in 1:size(requestedhr, 1) loop
+ requestaspercentage[i] := xidz(requestedhr[i], totalrequestedhr, 0);
+ nofpeople[i] := min(availablehr*requestaspercentage[i], requestedhr[i]);
+ allocatedhr[i] := nofpeople[i];
+end for;
+</pre><p class="p">To give you a quick rundown of the code logic, we have 3 input variables. First one tells how much workforce each projects wants, the second tells what the total number of requested people is and the third tells how many employees we have. The function outputs a vector that tells how many people it assigned to which project. In case there is more demand than available workforce, we calculate what percentage of the whole demand each project contributes and assign people accordingly.</p><p class="p">Now that our custom Modelica function is ready we are going to use it in the EmployeesAssigned variable. Select EmployeesAssigned and on the right of the properties view select Function tab, double-click on the custom function to make it appear in the equation field. Give the function following parameters: RequestedNumberOfPeople, sum(RequestedNumberOfPeople), NumberOfEmployees.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/CustomFunctionInPropertiesView.png"><br>
+ <p class="p imageText">Our custom function in variable properties view</p>
+</div><p class="p">Finally we need to change the calculation logic of NumberOfFreeEmployees. As EmployeesAssigned is now a vector variable just add sum() function around it in the equation field.</p><pre class="pre">NumberOfFreeEmployees
+= NumberOfEmployees-sum(EmployeesAssigned)
+</pre><p class="p">Now the Workforce module is completed!</p><p class="p">Finally, we are going to give the projects different parameters. Select Project2 and from the properties view select Parameters tab. By slowly double-clicking on a value you can change the starting time, deadline and work amount of a project.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ProjectParameters.png"><br>
+ <p class="p imageText">Parameters of Project2</p>
+</div><p class="p">Set the following parameters.</p><pre class="pre">Deadline: 40
+ProjectWorkAmount : 900
+StartTime: 0
+</pre><p class="p">Now we have completed a model with two Project modules, simulate to make sure your model is working.</p><p class="p">By following the steps below you can add a new project module to the model. Our current implementation supports any number of projects.</p><pre class="pre">1. Add a new Project module to the diagram
+2. Add a new auxiliary variable and name it WorkforceProject3
+3. Connect the new auxiliary variable with the module using a dependency arrow and connect it to the module in the input tab
+4. Update the equation field of RequestedWorkingSpeed to {Project1.RequestedWorkingSpeed, Project2.RequestedWorkingSpeed, Project3.RequestedWorkingSpeed}
+5. Choose Project enumeration under configuration and add click add, name the new index to Project3
+6. Write ResponsedWorkingSpeed[Project3] as the equation for the new auxiliary variable
+7. Finally, customize the parameters of Project3 module in the Parameters tab
+</pre><p class="p">Create a third Project module using the instructions above with the following parameters.</p><pre class="pre">Deadline: 20
+ProjectWorkAmount : 300
+StartTime: 10
+</pre><p class="p">To make the results of the simulation more readable we can add auxiliary variables that collect information from each of the Project modules. For example, we might be interested the behaviour of WorkQuality, RequiredWorkingHoursPerDay and DaysLateOnDeadline. Create an auxiliary variable for each of these, add Project enumeration to them and input the following equations.</p><pre class="pre">DaysLateOnDeadline
+ = {Project1.DaysLateOnDeadline, Project2.DaysLateOnDeadline, Project3.DaysLateOnDeadline}
+
+ RequiredWorkHoursPerDay
+ = {Project1.RequiredWorkHoursPerDay, Project2.RequiredWorkHoursPerDay, Project3.RequiredWorkHoursPerDay}
+
+ WorkQuality
+ = {Project1.WorkQuality, Project2.WorkQuality, Project3.WorkQuality}
+</pre><p class="p">Remember to update these variables also if you intend to use more than 3 projects.</p><p class="p">If you now simulate the model the results of RequiredWorkHoursPerDay should look like this.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/RequiredWorkHoursPerDayResults.png"><br>
+ <p class="p imageText">RequiredWorkHoursPerDay results</p>
+</div><p class="p">And WorkQuality should look like this.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/WorkQualityResults.png"><br>
+ <p class="p imageText">WorkQuality results</p>
+</div><p class="p">Reading results from DaysLateOnDeadline variable is hard as the variable keeps track of time before the deadline. To see the results more clearly we are going to create a custom bar chart. Right-click on Charts folder under the WorkModel and select New→Bar Chart, rename the chart to Project deadlines and rename the Title to Days late on deadline. Then choose the tab Variables, click on Add, select Write variable name and write DaysLateOnDeadline to the field. Bar charts automatically use the last time step of the simulation when retrieving variable values. The chart should like this.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/DaysLateOnDeadlineResults.png"><br>
+ <p class="p imageText">DaysLateOnDeadline results</p>
+</div><p class="p">Now you have completed the advanced Simantics System Dynamics tutorial.</p><p class="p">There are some features that neither of the tutorials cover that can be found in the <a class="xref" href="sysdyn.html">documentation</a>.</p><p class="p">If you still want to practice using the tool, here are some ideas on how to further develop the model we just made.</p><pre class="pre">1. The number of employees is currently a static variable, think of ways to simulate the hiring procedure of a company using stocks and flows
+2. Add more projects and think of ways to optimize project scheduling
+3. Add wages to employees and an external workforce that is used in case internal workforce isn't enough, minimize total costs
+</pre><p class="p">Happy simulating!</p></div></article></article></main></body></html>
\ No newline at end of file
<!DOCTYPE html
SYSTEM "about:legacy-compat">
-<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="tutorial-basic-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Basic System Dynamics Modelling</title></head><body id="tutorial-basic-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Basic System Dynamics Modelling</h1><div class="body"><div class="div hr">
-</div><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#model">1 Model</a></p></li><li class="li"><p class="p"><a class="xref" href="#configuring-the-model-structure">2 Configuring the model structure</a></p></li><li class="li"><p class="p"><a class="xref" href="#equations">3 Equations</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulating-the-model">4 Simulating the model</a></p></li></ul><p class="p">This tutorial introduces you to the basic components and concepts of the System dynamics modelling tool for Simantics. After completing this tutorial, you know how to configure and simulate a system dynamics model. An <a class="xref" href="AdvancedTutorial.html">advanced tutorial</a> is also available. This tutorial is part of the <a class="xref" href="sysdyn.html">sysdyn documentation</a>.</p></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="model"><h2 class="title topictitle2" id="ariaid-title2">Model</h2><div class="body"><div class="div hr">
-</div><p class="p">We are going to create a simple population model. The model consists of the basic components: Auxiliaries, valves, stocks, dependencies and flows.</p><p class="p">Start by creating a new model. Right-click on the model browser and select New -> Model.</p><div class="div imageBorder">
+<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="topic"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="tutorial-basic-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Basic System Dynamics Modelling</title></head><body id="tutorial-basic-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Basic System Dynamics Modelling</h1><div class="body"><div class="div hr">
+</div><p class="p">This tutorial gives an introduction to the Simantics System Dynamic Tool. We will go over how to create, simulate and analyze a simple system dynamic model. After completing this tutorial, if you wish, there is an <a class="xref" href="AdvancedTutorial.html">advanced tutorial</a> that goes more in-depth on the advanced features of the tool. It is recommended that you give a quick glance at first few chapters of the <a class="xref" href="sysdyn.html">documentation</a> before starting. You should especially familiarize yourself with the <a class="xref" href="sysdyn.html#workbench">workbench</a> of the tool to know the terminology used in the tutorials.</p><p class="p">We are going to create the classic prey-predator model. In our case the model will describe how the population sizes of mice (prey) and owls (predator) change over time. The basic idea around the model is to capture the dynamics of two different population sizes. Let's assume a starting scenario where there is a large mice population and a small owl population. Owls start eating mice decreasing their population, and in turn, giving the owl population the opportunity to grow due to good food availability. However, as the mice population is decreasing and the owl population increasing, at some point there won't be enough food for the entire owl population, leading to starvation and consequently to a decrease in owl population size. The decreased owl population size then allows the mice population to regrow, as they have a smaller number of natural predators on the hunt.</p><p class="p">This tutorial is a walkthrough for creating and analyzing such a model.</p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#model">1 Creating a new model</a></p></li><li class="li"><p class="p"><a class="xref" href="#configuring-the-model-structure">2 Configuring the model structure</a></p></li><li class="li"><p class="p"><a class="xref" href="#equations">3 Equations</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulating-the-model">4 Simulating the model</a></p></li><li class="li"><p class="p"><a class="xref" href="#result-analysis">5 Result analysis</a></p></li></ul></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="creating-a-new-model"><h2 class="title topictitle2" id="ariaid-title2">Creating a new model</h2><div class="body"><div class="div hr">
+</div><p class="p">Start by creating a new model from File→New→SD Model.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/NewModel.png"><br>
<p class="p imageText">Creating a new model</p>
-</div><p class="p">Rename the model to Population. Right-click on Model1 and select Rename.</p><p class="p">Expand the model tree and double-click on Configuration. The model configuration diagram opens in a new editor.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title3" id="configuring-the-model-structure"><h2 class="title topictitle2" id="ariaid-title3">Configuring the model structure</h2><div class="body"><div class="div hr">
-</div><p class="p">Our model is now empty. Let's build a population model for mice.</p><p class="p">Open Symbols view and expand BasicSymbols. If BasicSymbols are not visible, make sure that you have the diagram open. The contents of the Symbols view depends on the active diagram editor.</p><div class="div imageBorder">
+</div><p class="p">Rename the model to Population by slowly clicking twice on the model name in the Model Browser or by clicking the model once and changing the name from the properties view at the bottom of the tool. Then, expand the model tree and open the model diagram by double-clicking the Population model from Model Browser.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title3" id="configuring-the-model-structure"><h2 class="title topictitle2" id="ariaid-title3">Configuring the model structure</h2><div class="body"><div class="div hr">
+</div><p class="p">Let's start by building a population model for the mice.</p><p class="p">Drag the Symbols view from right of the Model Browser to underneath it and expand BasicSymbols for easier use. If BasicSymbols is not visible, make sure that you have the diagram open as the contents of the Symbols view depends on the active diagram editor.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/SymbolsView.png"><br>
<p class="p imageText">Symbols view</p>
-</div><p class="p">These are the basic symbols in System dynamics modelling. We will use these to create the model.</p><p class="p">Drag one stock variable from Symbols view to the diagram. You can zoom and move on the diagram using <a class="xref" href="sysdyn.html#shortcut-and-control-keys">shortcut keys</a></p><p class="p">Select the variable. Properties view on the bottom of the screen shows the properties of the selected variable. Change the name to Mice and press enter.</p><div class="div imageBorder">
+</div><p class="p">These are the basic symbols in System dynamic modelling that will be used to create the model.</p><p class="p">Drag one stock variable from Symbols view to the diagram. You can zoom and move on the diagram using the middle mouse button.</p><p class="p">Select the variable to bring up Properties view on the bottom of the tool. Change the name to Mice and press enter. You should have a red exclamation mark next to the symbol telling that the variable needs to have expressions for Integral and Initial Value fields. These are not shown in the pictures of this tutorial for visual clarity. We will write expressions to these fields later. You can find a collection of warnings and errors related to the model from the Issues tab right of the Properties tab.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/Mice.png"><br>
- <p class="p imageText">Stock variable Mice</p>
-</div><p class="p">Next we will draw flows in and out of Mice. Drag one cloud variable from Symbols view to the left hand side of Mice. Hold down Alt and right-click on the cloud. Move cursor on top of Mice and left-click. The system creates a flow from the cloud to Mice and a valve in the middle of the flow. The valve controls the speed of the flow. Flow from Mice is created the same way. Drag one cloud variable from Symbols view to the right hand side of Mice. Hold down Alt and right-click on Mice. Move cursor on top of the cloud and left-click. Rename the valves to MouseBirths and MouseDeaths.</p><div class="div imageBorder">
+ <p class="p imageText">Stock variable Mice with the Properties view open, issues can be found on the third tab from the left</p>
+</div><p class="p">Next we will draw flows in and out of Mice. Drag one cloud variable from Symbols view to the left hand side of Mice. Hold down Alt and right-click on the cloud, then move your cursor on top of Mice and left-click. The system creates a flow from the cloud to Mice and a valve in between. The valve controls the speed of the flow, in this case the birthrate of Mice. We also need a flow going out from Mice to control the death rate. Let's create this using a shortcut. Right-click Mice while holding Alt down, then drag your mouse right of the Mice and press left-click while holding Alt down. Rename the valves to MouseBirths and MouseDeaths.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceFlows.png"><br>
<p class="p imageText">Flows in and out of Mice</p>
-</div><p class="p">Of course mice are not alone in the world. There are also owls that hunt mice. Create a similar structure below mice for owls.</p><div class="div imageBorder">
+</div><p class="p">Of course mice are not alone in our imaginary world. We also need owls that hunt mice. Create a similar structure for owls by copy-pasting and renaming. You can copy by drag selecting components and using the all familiar Ctrl+C and Ctrl+V.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceAndOwls.png"><br>
<p class="p imageText">Owls and mice</p>
-</div><p class="p">To control the births and deaths, we need auxiliary variables. Auxiliary variables can be dragged from Symbols view just like Stock variables. We need one variable for each valve to control it. Drag the variables and rename them according to the picture below.</p><div class="div imageBorder">
+</div><p class="p">To control births and deaths we use auxiliary variables. Auxiliary variables can be dragged from Symbols view just like Stock variables. We need one variable for each valve. Drag the variables and rename them according to the picture below.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/Auxiliaries.png"><br>
<p class="p imageText">Auxiliaries for valves</p>
-</div><p class="p">Arrow connections, dependencies, are created almost like flows. The difference is that the connection is started and ended with a left click and the connection can only be made between two existing variables. Connect the auxiliary variables and valves like in the picture below.</p><div class="div imageBorder">
+</div><p class="p">Next we need to draw dependency arrows to tell which components of the system have an interaction. Dependency arrows are created by Alt+left-clicking on a symbol and then clicking on another symbol. Connect components like in the picture below.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/Dependency_connections.png"><br>
<p class="p imageText">Dependency connections</p>
</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title4" id="equations"><h2 class="title topictitle2" id="ariaid-title4">Equations</h2><div class="body"><div class="div hr">
-</div><p class="p">As you can see from the model, we have made some shortcuts in our model to make it more simple. In reality, there are lots of other factors that affect mouse and owl populations. Let's however use this model as an example.</p><p class="p">For the model to be simulated, each variable needs to have an equation. Equations can be configured from the property view, like the names. Input the following equations into the corresponding variables:</p><pre class="pre">MouseBirths
+</div><p class="p">Now we need to give each variable an equation, stock variables also need a value for initial population. Like names, equations can be configured from the property view. Input the following equations into the corresponding variables:</p><pre class="pre">MouseBirths
= MouseBirthRate * Mice
MouseDeaths
OwlDeathRate
= 0.09
-</pre><p class="p">Finally we need initial values for our populations.</p><pre class="pre">Mice
+</pre><p class="p">Finally input initial population values for Mice and Owls.</p><pre class="pre">Mice
Initial Value: 700
Owls
Initial Value: 10
</pre></div></article><article class="topic nested1" aria-labelledby="ariaid-title5" id="simulating-the-model"><h2 class="title topictitle2" id="ariaid-title5">Simulating the model</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+</div><p class="p">Now the model is configured and ready for simulation. An experiment needs to be activated before a model can be simulated. Expand the Experiments folder of your model and double-click on Experiment to activate it. This adds experiment control buttons to the toolbar.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/ActivatePopulationExperiment.png"><br>
<p class="p imageText">Experiment activation</p>
-</div><div class="p">Now the model is configured and ready for simulation. Switch Symbols view back to Model Browser. Expand the Experiments folder on your model and double-click on Experiment. This activates the experiment. Experiment needs to be active before the model can be simulated. Experiment activations adds experiment control buttons to the toolbar. To simulate the model, press the play button: <div class="div image">
-<img class="image" src="BasicTutorialImages/ExperimentPlay.png"><br><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen.</p><div class="div image">
+</div><p class="p">To simulate the model, press the play button:</p><div class="div image">
+ <img class="image" src="BasicTutorialImages/ExperimentPlay.png"><br>
+</div><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen. As our model is very simple the progress bar will most likely go by faster that you can see it.</p><div class="div image">
<img class="image" src="BasicTutorialImages/SimulationProgress.png"><br>
-</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">After the simulation has run, you can select variables from the diagram or model browser and their values over the simulation time will be shown on Trend View. You can select multiple variables from the diagram by holding down Ctrl key. Select Mice and Owls.</p><div class="div imageBorder">
+</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">After the simulation has been completed, you can select variables from the diagram or Model Browser and their values over the simulation time will be shown on Trend view. You can select multiple variables from the diagram by holding down Ctrl key or by drag selecting. Select Mice and Owls.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceAndOwlResults1.png"><br>
<p class="p imageText">Results for Mice and Owls</p>
-</div><p class="p">As you can see, the simulation is complete, but the results do not reveal any interesting behavior. Let's extend the simulation time.</p><p class="p">Select Configuration from the model browser. In the properties-view change stop time to 300.0 and simulate again.</p><p class="p">After the simualtion is complete, Select Mice and Owls again.</p><div class="div imageBorder">
+</div><p class="p">As you can see, the simulation is complete, but the results do not reveal anything interesting. We need to extend the simulation time.</p><p class="p">Select Configuration from the Model Browser. In the properties view change stop time to 300.0 and simulate again.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/Configuration1.png"><br>
+ <p class="p imageText">Model configuration</p>
+</div><p class="p">After the simulation is complete, Select Mice and Owls again.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceAndOwlResults2.png"><br>
- <p class="p imageText">Results for Mice and Owls, Extended simulation time</p>
-</div><p class="p">Now the simulation reveals the traditional behavior of predator-prey models. Feel free to adjust the parameters and try the simulations again.</p></div></div></div></article></article></main></body></html>
\ No newline at end of file
+ <p class="p imageText">Results for Mice and Owls, extended simulation time</p>
+</div><p class="p">Now we can see the wanted behavior. As the mice population reaches a certain point the number of owls start to increase as they have more food. The increase in owl population lowers the mice population, leading to starvation between owls. The lowered owl population in turn allows the mice population grow back, and the cycle continues. In fact this model simulates the behavior of a pair of first-order nonlinear differential equations also known as Lotka-Volterra equations.</p><p class="p">However, we can see that there is something wrong with the results; the peaks of the mice population are not on the same level. We are using a step-size that is too long. On default the step size is calculated by dividing the simulation time to 500 equal steps, meaning that the previous results were obtained using a step size of (300-0)/500=0.6. (For a more bizarre behavior try simulating with a stop time of 950 using the default step size.)</p><p class="p">To combat this we can set the step size manually from the model configuration, the same place where we changed the simulation stop time. Change the step size to 0.01 and output interval to 1. Output interval allows us to manually configure the step size of the results, meaning that we can make the numerical errors arbitrarily small by lowering the simulation step size, while only having to handle a part of the steps used for the simulation. With these new parameters we now get the correct results.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/MiceAndOwlResults3.png"><br>
+ <p class="p imageText">Results for Mice and Owls with a simulation step size of 0.01</p>
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="result-analysis"><h2 class="title topictitle2" id="ariaid-title6">Result analysis</h2><div class="body"><div class="div hr">
+</div><p class="p">In this chapter we are going to go over how to analyze the resulting model structure, use comment symbols, create and export graphs in form of charts and export the simulated dataset. Let's start with the model structure analysis.</p><p class="p">Often in system dynamics we are interested in how different feedback loops are formed inside of a model. There is a built in tool analyzing these. Open Structure view that is located between Trend and Values views, then select Loops tab. The contents update depending on the active selection, select OwlBirths symbol.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/OwlBirthsLoopStructure.png"><br>
+ <p class="p imageText">The loop structure of OwlBirths</p>
+</div><p class="p">We can see a feedback loop of 3 variables. You could interpret this loop as follows: owl births increase the number of owls, the more owls there are the more mice are going to get eaten, the more mice that end up as food the more owls can breed.</p><p class="p">To make a visual representation of this feedback loop on the diagram we can utilize a comment symbol called Loop. Expand the CommentSymbols from Symbols and drag the symbol between Mice and Owls symbols. Then, from the properties view select Owls→MouseDeaths→OwlBirths from Loop Items and change the Direction of Rotation to counterclockwise. The Comment option is used for telling if the loop is reinforcing (R) or balancing (B). The symbol automatically detects this behavior, but you can also choose this manually or write your own explanation, if you wish. When you make the Loop symbol as your active selection it automatically highlights the symbols that are included in the loop to visualize how it is formed.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/LoopCommentSymbol.png"><br>
+ <p class="p imageText">Loop comment symbol</p>
+</div><p class="p">The other comment symbol, called Comment, is purely for writing text in the diagram. It is useful, for example, when you want to have memos inside the diagram, or when you want to write an explanation for a design choice.</p><p class="p">Let's move on to graphs. There are two ways of creating them, Trend view (that we have used before) and Charts. Trend view allows you to export the graph as .svg and .png file formats from the top-right controls. However, the built in graph tool has much more options for customizing a graph. Let's create a phase-space plot of the model.</p><p class="p">Start by creating a new chart by right-clicking on the folder Charts under your model, then select New→Line Chart.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/newChart.png"><br>
+ <p class="p imageText">Creating a new chart</p>
+</div><p class="p">Double click the newly made chart to open it and keep the chart selected to access its properties. Name the chart Phase-space plot, tick hide title and hide legend options, type Owls as the x-axis variable and change the label name to Alive owls.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/ChartProperties1.png"><br>
+ <p class="p imageText">Chart general properties</p>
+</div><p class="p">Then, select the Axis and Variables tab on the bottom, click on y-axis and rename label to Alive mice, then click Add variable. Select the <Write variable name> and write Mice as the variable name.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/ChartAxisAndVariables.png"><br>
+ <p class="p imageText">Chart Axis and Variables properties</p>
+</div><p class="p">Now you should have a completed phase-space plot of the prey-predator model. To export a graph right click on it and select either Save as→PNG or Print... and select the pdf printer of your choice. Notice that in order to see results on the graph you need to have an active experiment that has finished a simulation.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/PhaseSpacePlotAndExport.png"><br>
+ <p class="p imageText">Completed phase-space plot and export options</p>
+</div><p class="p">You might also want to export the simulated data. Currently the easiest way is to copy it to your clipboard. First, select all components by clicking on the diagram and pressing Ctrl+A on the keyboard. Then, select Values view from the bottom left, click on any numerical value to put the field in focus, finally Ctrl+A and Ctrl+C. Now you have all of the numerical data on your clipboard for pasting to the tool of your choosing.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/ValuesView.png"><br>
+ <p class="p imageText">Values view</p>
+</div><p class="p">This concludes the basic tutorial. If you wish to learn more about the advanced features of the tool, please refer to the <a class="xref" href="sysdyn.html">wiki</a> or the <a class="xref" href="AdvancedTutorial.html">advanced tutorial</a>.</p><p class="p">Happy simulating!</p></div></article></article></main></body></html>
\ No newline at end of file
<!DOCTYPE html
SYSTEM "about:legacy-compat">
-<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="simantics-system-dynamics"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Simantics System Dynamics</title></head><body><main role="main"><article role="article" aria-labelledby="ariaid-title1"><article class="nested0" aria-labelledby="ariaid-title1" id="simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title1">Simantics System Dynamics</h1><div class="body"></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="contents"><h2 class="title topictitle2" id="ariaid-title2">Contents</h2><div class="body"><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#what-is-simantics-system-dynamics">1 What is Simantics System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#introduction-to-system-dynamics-simulation">2 Introduction to System Dynamics Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#system-dynamics">2.1 System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#model">2.2 Model</a></p></li><li class="li"><p class="p"><a class="xref" href="#components">2.3 Components</a></p></li><li class="li"><p class="p"><a class="xref" href="#modeling-principles">2.4 Modeling Principles</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#installation-instructions">3 Installation Instructions</a></p></li><li class="li"><p class="p"><a class="xref" href="#workbench">4 Workbench</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#global-preferences">4.1 Global Preferences</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#modelling">5 Modelling</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#basic-modelling">5.1 Basic Modelling</a></p></li><li class="li"><p class="p"><a class="xref" href="#model-properties">5.2 Model Properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#special-variables">5.3 Special Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#withlookup">5.3.1 WithLookup</a></p></li><li class="li"><p class="p"><a class="xref" href="#delay">5.3.2 Delay</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#shortcut-and-control-keys">5.4 Shortcut and Control Keys</a></p></li><li class="li"><p class="p"><a class="xref" href="#unit-validation">5.5 Unit Validation</a></p></li><li class="li"><p class="p"><a class="xref" href="#diagram-profiles">5.6 Diagram Profiles</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#visual-model-elements">6 Visual model elements</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#fonts-and-colors">6.1 Fonts and colors</a></p></li><li class="li"><p class="p"><a class="xref" href="#dependency-properties">6.2 Dependency properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#loops">6.3 Loops</a></p></li><li class="li"><p class="p"><a class="xref" href="#comments">6.4 Comments</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation">7 Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#experiments">7.1 Experiments</a></p></li><li class="li"><p class="p"><a class="xref" href="#solvers">7.2 Solvers</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">8 Simulation Result and Model Structure Analysis</a></p></li><li class="li"><p class="p"><a class="xref" href="#custom-charts">9 Custom Charts</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#line-chart">9.1 Line Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#sensitivity-chart">9.2 Sensitivity Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#bar-chart">9.3 Bar Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#pie-chart">9.4 Pie Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#chart-panel">9.5 Chart Panel</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#multidimensional-variables">10 Multidimensional Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#modeling">10.1 Modeling</a></p></li><li class="li"><p class="p"><a class="xref" href="#expressions">10.2 Expressions</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-slices">10.3 Array Slices</a></p></li><li class="li"><p class="p"><a class="xref" href="#arithmetic-operators">10.4 Arithmetic Operators</a></p></li><li class="li"><p class="p"><a class="xref" href="#builtin-modelica-functions">10.5 Builtin Modelica Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulation-results">10.6 Simulation Results</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-variables-in-modules">10.7 Array Variables in Modules</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#functions">11 Functions</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#creating-functions">11.1 Creating Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#function-libraries">11.2 Function Libraries</a></p></li><li class="li"><p class="p"><a class="xref" href="#external-functions">11.3 External Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#modelica-functions">11.4 Modelica Functions</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#spreadsheets">12 Spreadsheets</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#variable-values">12.1 Variable Values</a></p></li><li class="li"><p class="p"><a class="xref" href="#history-data">12.2 History Data</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#vensim-model-import">13 Vensim Model Import</a></p></li><li class="li"><p class="p"><a class="xref" href="#sample-models-and-molecules">14 Sample Models and Molecules</a></p></li></ul></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title3" id="what-is-simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title3">What is Simantics System Dynamics</h1><div class="body"><div class="div hr">
-</div><p class="p"><em class="ph i">Simantics System Dynamics</em> is currently the only open source modelling and simulating tool for Simantics. Simantics System Dynamics is under development and will go through some changes in the future. New features will be added and old ones improved according to the needs of the modellers.</p><p class="p">This documentation introduces you to the current version of Simantics System Dynamics. Documentation includes the basic modelling principles and a guide on how to model system dynamics models with Simantics System Dynamics. If you like to get to know the tool better and try modelling and simulating yourself, <a class="xref" href="#installation-instructions">install</a> the software and try our <a class="xref" href="BasicTutorial.html">basic</a> and <a class="xref" href="AdvancedTutorial.html">advanced</a> tutorials!</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title4" id="introduction-to-system-dynamics-simulation"><h1 class="title topictitle1" id="ariaid-title4">Introduction to System Dynamics Simulation</h1><div class="body"><div class="div hr">
+<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="topic"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="simantics-system-dynamics"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Simantics System Dynamics</title></head><body><main role="main"><article role="article" aria-labelledby="ariaid-title1"><article class="nested0" aria-labelledby="ariaid-title1" id="simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title1">Simantics System Dynamics</h1><div class="body"></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="contents"><h2 class="title topictitle2" id="ariaid-title2">Contents</h2><div class="body"><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#what-is-simantics-system-dynamics">1 What is Simantics System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#introduction-to-system-dynamics-simulation">2 Introduction to System Dynamics Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#system-dynamics">2.1 System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#model">2.2 Model</a></p></li><li class="li"><p class="p"><a class="xref" href="#components">2.3 Components</a></p></li><li class="li"><p class="p"><a class="xref" href="#modeling-principles">2.4 Modeling Principles</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#installation-instructions">3 Installation Instructions</a></p></li><li class="li"><p class="p"><a class="xref" href="#workbench">4 Workbench</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#global-preferences">4.1 Global Preferences</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#modelling">5 Modelling</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#basic-modelling">5.1 Basic Modelling</a></p></li><li class="li"><p class="p"><a class="xref" href="#model-properties">5.2 Model Properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#special-variables">5.3 Special Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#withlookup">5.3.1 WithLookup</a></p></li><li class="li"><p class="p"><a class="xref" href="#delay">5.3.2 Delay</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#shortcut-and-control-keys">5.4 Shortcut and Control Keys</a></p></li><li class="li"><p class="p"><a class="xref" href="#unit-validation">5.5 Unit Validation</a></p></li><li class="li"><p class="p"><a class="xref" href="#diagram-profiles">5.6 Diagram Profiles</a></p></li><li class="li"><p class="p"><a class="xref" href="#debugging-a-model">5.7 Debugging a model</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#visual-model-elements">6 Visual model elements</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#fonts-and-colors">6.1 Fonts and colors</a></p></li><li class="li"><p class="p"><a class="xref" href="#dependency-properties">6.2 Dependency properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#loops">6.3 Loops</a></p></li><li class="li"><p class="p"><a class="xref" href="#comments">6.4 Comments</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation">7 Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#experiments">7.1 Experiments</a></p></li><li class="li"><p class="p"><a class="xref" href="#solvers">7.2 Solvers</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">8 Simulation Result and Model Structure Analysis</a></p></li><li class="li"><p class="p"><a class="xref" href="#custom-charts">9 Custom Charts</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#line-chart">9.1 Line Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#sensitivity-chart">9.2 Sensitivity Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#bar-chart">9.3 Bar Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#pie-chart">9.4 Pie Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#chart-panel">9.5 Chart Panel</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#multidimensional-variables">10 Multidimensional Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#modeling">10.1 Modeling</a></p></li><li class="li"><p class="p"><a class="xref" href="#expressions">10.2 Expressions</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-slices">10.3 Array Slices</a></p></li><li class="li"><p class="p"><a class="xref" href="#arithmetic-operators">10.4 Arithmetic Operators</a></p></li><li class="li"><p class="p"><a class="xref" href="#Built-in-modelica-functions">10.5 Built-in Modelica Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulation-results">10.6 Simulation Results</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-variables-in-modules">10.7 Array Variables in Modules</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#functions">11 Functions</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#creating-functions">11.1 Creating Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#function-libraries">11.2 Function Libraries</a></p></li><li class="li"><p class="p"><a class="xref" href="#external-functions">11.3 External Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#modelica-functions">11.4 Modelica Functions</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#spreadsheets">12 Spreadsheets</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#variable-values">12.1 Variable Values</a></p></li><li class="li"><p class="p"><a class="xref" href="#history-data">12.2 History Data</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#vensim-model-import">13 Vensim Model Import</a></p></li><li class="li"><p class="p"><a class="xref" href="#sample-models-and-molecules">14 Sample Models and Molecules</a></p></li></ul></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title3" id="what-is-simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title3">What is Simantics System Dynamics</h1><div class="body"><div class="div hr">
+</div><p class="p"><em class="ph i">Simantics System Dynamics</em> is currently the only open source modelling and simulating tool for Simantics. Simantics System Dynamics is under development and will go through changes in the future. New features will be added and old ones improved according to the needs of modellers.</p><p class="p">This documentation introduces you to the current version of Simantics System Dynamics. The documentation includes basic modelling principles and a guide on how to model system dynamics models with Simantics System Dynamics. If you like to get to know the tool better and try modelling and simulating yourself, <a class="xref" href="#installation-instructions">install</a> the software and try our <a class="xref" href="BasicTutorial.html">basic</a> and <a class="xref" href="AdvancedTutorial.html">advanced</a> tutorials!</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title4" id="introduction-to-system-dynamics-simulation"><h1 class="title topictitle1" id="ariaid-title4">Introduction to System Dynamics Simulation</h1><div class="body"><div class="div hr">
</div></div><article class="topic nested1" aria-labelledby="ariaid-title5" id="system-dynamics"><h2 class="title topictitle2" id="ariaid-title5">System Dynamics</h2><div class="body"><p class="p">System dynamics is an approach to understanding different organizations, markets and other complex systems and their dynamic behavior. Simantics System Dynamics is a free modelling tool for system dynamics modeling and simulation. See <a class="xref" href="#installation-instructions">installation instructions</a>.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="model"><h2 class="title topictitle2" id="ariaid-title6">Model</h2><div class="body"><p class="p">System dynamics model is generally understood as the model configuration. In this tool, the model contains also other components: <a class="xref" href="#experiments">Experiments</a> are the way to simulate the model. You can have experiments with different configurations, for example different initial values for some parameters. In that way, you don't have to always configure the model for different scenarios. <a class="xref" href="#basic-modelling">Module types</a> allow user to create reusable component types which can be instantiated as Modules. The Modules folder contains all the different module types in your model and you can create new module types there. The <a class="xref" href="#functions">Functions</a> folder contains built-in and user-defined functions.</p><div class="div imageBorder">
<img class="image" src="Images/ModelStructure.png"><br>
<p class="p imageText">Model structure</p>
</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title7" id="components"><h2 class="title topictitle2" id="ariaid-title7">Components</h2><div class="body"><p class="p">Most of the components you can use in your models are basic system dynamics components. The modularity of the models introduces two additional components, Modules and Inputs. All the components are explained below.</p><div class="div imageBorder">
<img class="image" src="Images/ComponentTypes.png"><br>
<p class="p imageText">Component types</p>
-</div><p class="p"><strong class="ph b">Auxiliary</strong></p><p class="p">Auxiliary is the most basic variable you can use. It represents a single value or a mathematical expression. There are different types of auxiliary variables currently in the system: <em class="ph i">Auxiliary</em>, <em class="ph i">Parameter</em>, <em class="ph i">Constant</em>, <a class="xref" href="#delay"><em class="ph i">Delay</em></a> and <a class="xref" href="#withlookup"><em class="ph i">WithLookup</em></a>. Auxiliary is the default type. Parameters are static values that the user can change. When only parameters are changed, the model simulates faster, because the system does not have to recompile the model. WithLookup and Delay are special variables. WithLookup has an expression and a lookup table. The expression defines what value is taken from the defined table. Delay variable delays an equation a given time with a given delay order.</p><p class="p"><strong class="ph b">Dependency</strong></p><p class="p">Dependency is an arrow that connects two components. It means that the value of the variable from which the arrow starts is used to calculate the value of the variable where the arrow ends. Dependencies that are used for a stock initial value only are colored grey by default, in contrast to the regular blue dependency arrows.</p><p class="p"><strong class="ph b">Flow</strong></p><p class="p">Flow connects clouds, valves and stocks. Flow represents an actual flow of something from stocks or clouds to stocks or clouds. There has to be at least one valve in a flow and the system creates it automatically, if none of the ends of the flow is a valve.</p><p class="p"><strong class="ph b">Valve</strong></p><p class="p">Valve regulates the rate of a flow. The value of a valve is automatically used in calculating the level of an adjacent stock. Valves behave just like Auxiliary variables but look different and you can connect also flows to them.</p><p class="p"><strong class="ph b">Stock</strong></p><p class="p">The value of a stock variable is an integral of flows leaving and flows arriving to the variable. The integral is calculated automatically from the valves that are connected to the variable with flow connections. Alternatively, the equation that is integrated can be defined manually by user. A stock must be given an initial value. Initial value can be a single value or an equation. You can use values of other variables to calculate the initial value.</p><p class="p"><strong class="ph b">Cloud</strong></p><p class="p">Cloud is not a variable. It represents a starting or ending point of a flow, if it is not in the scope of the model.</p><p class="p"><strong class="ph b">Module</strong></p><p class="p">Modules enable structural modeling. Modules are defined just like the basic model configuration, but the module component hides the actual configuration. You can only connect dependency connections into the module and dependency connections from the module must end to Input variables. The interface of the module is defined using input and output variables in the configuration of the module. All variable types can be set as output variables. If a variable is an output variable, its font is bold.</p><p class="p"><strong class="ph b">Input</strong></p><p class="p">Input variables are the way of getting values from other modules. Inputs look like auxiliary variables except their font is italics. You can set a default value to the input variable in case it is not connected to any variable. Connections are made from the modules properties, when the module is populated. Input doesn't have to be connected with an arrow to a module. If the variable has no connections, it can get values from a higher level in the hierarchy. If an input is connected to an output, the output and its module are shown below the variable using dot notation.</p><p class="p"><strong class="ph b">Shadow</strong></p><p class="p">A shadow variable is a reference to a variable defined elsewhere on the diagram. The referred variable can be an auxiliary, a valve, a stock, or an input. Dependency and flow arrows can be drawn out of a shadow variable, but no arrows can be drawn into a shadow variable. Shadow variables are used to improve the readability of the model.</p><p class="p"><strong class="ph b">Loop</strong></p><p class="p">A loop element is a graphical component for highlighting selected feedback loops in a model.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">A comment element is a string of text on diagram.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title8" id="modeling-principles"><h2 class="title topictitle2" id="ariaid-title8">Modeling Principles</h2><div class="body"><p class="p">System dynamics modelling is much more than just mathematical formulas and nice graphs. Models are ways of communicating. There are some basic principles in system dynamics modelling that make the models easier to read and understand. You do not have to apply these principles to simulate models, but using them makes it easier for you to communicate your model to others.</p><p class="p"><strong class="ph b">Variable names</strong></p><p class="p">Variables names should be nouns, not verbs. The names should be positive: for example it is easier to understand that satisfaction decreases than dissatisfaction rises. Variable names can and should have multiple words, if they are needed. Note that due to the reserved words in Modelica, variable names such as <em class="ph i">Carbon in Atmosphere</em> cannot be used (<em class="ph i">in</em> is a reserved word). Capitalizing the reserved (<em class="ph i">in</em> --> <em class="ph i">In</em>) word can be used to sidestep the problem.</p><p class="p"><strong class="ph b">Connections</strong></p><p class="p">You should usually try to avoid overlapping dependency arrows. Organizing the variables on the diagram and using shadow variables can be used for that purpose. Dependencies should also form distinctive loops, if there is a loop. It makes it easier to read and understand the model and its behavior.</p><p class="p"><strong class="ph b">Graphical annotations</strong></p><p class="p">System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important, for communicating the behavior of the model.</p></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title9" id="installation-instructions"><h1 class="title topictitle1" id="ariaid-title9">Installation Instructions</h1><div class="body"><div class="div hr">
-</div><p class="p">System dynamics tool is provided with the Simantics platform.</p><ol class="ol"><li class="li"><p class="p"><a class="xref" href="http://sysdyn.simantics.org/" target="_blank">Download installer from the tool's download page</a></p></li><li class="li"><p class="p">Install the program to a directory without spaces (limitation inherited from OpenModelica).</p></li><li class="li"><p class="p">Run the application through the launcher generated by the installer</p><p class="p">(default: Simantics\Simantics-1.8.0-Sysdyn-32\Simantics-1.8.0-Sysdyn-32)</p></li></ol><p class="p"><a class="xref" href="http://www.openmodelica.org/" target="_blank">OpenModelica</a> is used to build and simulate the models. Simantics platform has integrated OpenModelica 1.9.0 beta4 for Windows environments. For other versions and other environments you need to install <a class="xref" href="https://www.openmodelica.org/download/download-windows" target="_blank">OpenModelica</a>. In addition to OpenModelica, a development version of a <a class="xref" href="#solvers">purpose-built Modelica solver</a> is embedded in the tool.</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title10" id="workbench"><h1 class="title topictitle1" id="ariaid-title10">Workbench</h1><div class="body"><div class="div hr">
+</div><p class="p"><strong class="ph b">Auxiliary</strong></p><p class="p">Auxiliary is the most basic variable you can use. It represents a single value or a mathematical expression. There are different types of auxiliary variables currently in the system: <em class="ph i">Auxiliary</em>, <em class="ph i">Parameter</em>, <em class="ph i">Constant</em>, <a class="xref" href="#delay"><em class="ph i">Delay</em></a> and <a class="xref" href="#withlookup"><em class="ph i">WithLookup</em></a>. Auxiliary is the default type. Parameters are static values that the user can change. When only parameters are changed, the model simulates faster, because the system does not have to recompile the model. WithLookup and Delay are special variables. WithLookup has an expression and a lookup table. The expression defines what value is taken from the defined table. Delay variable delays an equation a given time with a given delay order.</p><p class="p"><strong class="ph b">Dependency</strong></p><p class="p">Dependency is an arrow that connects two components. It means that the value of the variable from which the arrow starts is used to calculate the value of the variable where the arrow ends. Dependencies that are used for a stock initial value only are colored grey by default, in contrast to the regular blue dependency arrows.</p><p class="p"><strong class="ph b">Flow</strong></p><p class="p">Flow connects clouds, valves and stocks. Flow represents an actual flow of something from stocks or clouds to stocks or clouds. There has to be at least one valve in a flow and the system creates it automatically, if none of the ends of the flow is a valve.</p><p class="p"><strong class="ph b">Valve</strong></p><p class="p">Valve regulates the rate of a flow. The value of a valve is automatically used in calculating the level of an adjacent stock. Valves behave just like Auxiliary variables but look different and you can connect also flows to them.</p><p class="p"><strong class="ph b">Stock</strong></p><p class="p">The value of a stock variable is an integral of flows leaving and flows arriving to the variable. The integral is calculated automatically from the valves that are connected to the variable with flow connections. Alternatively, the equation that is integrated can be defined manually by user. A stock must be given an initial value. Initial value can be a single value or an equation. You can use values of other variables to calculate the initial value.</p><p class="p"><strong class="ph b">Cloud</strong></p><p class="p">Cloud is not a variable. It represents a starting or ending point of a flow, if it is not in the scope of the model.</p><p class="p"><strong class="ph b">Module</strong></p><p class="p">Modules enable structural modeling. Modules are defined just like the basic model configuration, but the module component hides the actual configuration. You can only connect dependency connections into the module and dependency connections from the module must end to Input variables. The interface of the module is defined using input and output variables in the configuration of the module. All variable types can be set as output variables. If a variable is an output variable, its font is bold.</p><p class="p"><strong class="ph b">Input</strong></p><p class="p">Input variables are the way of getting values from other modules. Inputs look like auxiliary variables except their font is italics. You can set a default value to the input variable in case it is not connected to any variable. Connections are made from the modules properties, when the module is populated. Input doesn't have to be connected with an arrow to a module. If the variable has no connections, it can get values from a higher level in the hierarchy. If an input is connected to an output, the output and its module are shown below the variable using dot notation.</p><p class="p"><strong class="ph b">Shadow</strong></p><p class="p">Shadow variable is a reference to a variable defined elsewhere on the diagram. The referred variable can be an auxiliary, a valve, a stock, or an input. Dependency and flow arrows can be drawn out of a shadow variable, but no arrows can be drawn into a shadow variable. Shadow variables are used to improve the readability of the model.</p><p class="p"><strong class="ph b">Loop</strong></p><p class="p">Loop element is a graphical component for highlighting selected feedback loops in a model.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">Comment element is a string of text on diagram.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title8" id="modeling-principles"><h2 class="title topictitle2" id="ariaid-title8">Modeling Principles</h2><div class="body"><p class="p">System dynamics modelling is much more than just mathematical formulas and nice graphs. Models are ways of communicating. There are some basic principles in system dynamics modelling that make the models easier to read and understand. You do not have to apply these principles to simulate models, but using them makes it easier for you to communicate your model to others.</p><p class="p"><strong class="ph b">Variable names</strong></p><p class="p">Variables names should be nouns, not verbs. The names should be positive: for example it is easier to understand that satisfaction decreases than dissatisfaction rises. Variable names can and should have multiple words, if they are needed. Note that due to the reserved words in Modelica, variable names such as <em class="ph i">Carbon in Atmosphere</em> cannot be used (<em class="ph i">in</em> is a reserved word). Capitalizing the reserved (<em class="ph i">in</em> → <em class="ph i">In</em>) word can be used to sidestep the problem.</p><p class="p"><strong class="ph b">Connections</strong></p><p class="p">You should usually try to avoid overlapping dependency arrows. Organizing the variables on the diagram and using shadow variables can be used for that purpose. Dependencies should also form distinctive loops, if there is a loop. It makes it easier to read and understand the model and its behavior.</p><p class="p"><strong class="ph b">Graphical annotations</strong></p><p class="p">System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important for communicating the behavior of the model.</p></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title9" id="installation-instructions"><h1 class="title topictitle1" id="ariaid-title9">Installation Instructions</h1><div class="body"><div class="div hr">
+</div><p class="p">System dynamics tool is provided with the Simantics platform.</p><ol class="ol"><li class="li"><p class="p"><a class="xref" href="http://sysdyn.simantics.org/" target="_blank" rel="external noopener">Download installer from the tool's download page</a></p></li><li class="li"><p class="p">Install the program to a directory without spaces or special characters (limitation inherited from OpenModelica).</p></li><li class="li"><p class="p">Run the application through the launcher generated by the installer</p></li></ol><p class="p"><a class="xref" href="http://www.openmodelica.org/" target="_blank" rel="external noopener">OpenModelica</a> is used to build and simulate the models. Simantics platform has integrated OpenModelica 1.9.0 beta4 for Windows environments. For other versions and other environments you need to install the latest official 64bit release of <a class="xref" href="https://www.openmodelica.org/download/download-windows" target="_blank" rel="external noopener">OpenModelica</a>. In addition to OpenModelica, a development version of a <a class="xref" href="#solvers">purpose-built Modelica solver</a> is embedded in the tool.</p><p class="p">If you plan on creating large models or using a long simulation time with a small step size, it is advised that you give the tool more memory by increasing the numerical value of property -Xmx in the file Simantics-Sysdyn.ini.</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title10" id="workbench"><h1 class="title topictitle1" id="ariaid-title10">Workbench</h1><div class="body"><div class="div hr">
</div><div class="div image">
<img class="image" src="Images/BasicWorkbench.png"><br>
-</div><p class="p">1 <strong class="ph b">Diagram</strong></p><p class="p">Diagram is the area where you will graphically modify your model. Diagrams are built from elements that can be dragged from Symbols view or populated using shortcut keys.</p><p class="p">2 <strong class="ph b">Model Browser</strong></p><p class="p">Model browser shows the structure of your model and all items related to it.</p><p class="p"><strong class="ph b">Symbols</strong></p><p class="p">Symbols view (stacked with the model browser) is used for dragging elements to diagrams.</p><p class="p"><strong class="ph b">Search</strong></p><p class="p">Search view (stacked with the model browser) is used for searching elements in all models. Search can be launched also from the search field in the bottom right corner or by Ctrl+F.</p><p class="p">3 <strong class="ph b">Properties</strong></p><p class="p">Property view shows the selected variable's properties. Property view has a different layout depending on the type of the selected component. The view can also have different tabs depending on the component type. Basic tabs for variables are Equation, Indexes, and Additional information.</p><p class="p"><strong class="ph b">Console</strong></p><p class="p">Console view (stacked with the property view) shows console messages from the simulator. Console can be used for debugging models simulated using OpenModelica.</p><p class="p"><strong class="ph b">Issues</strong></p><p class="p">Issue view (stacked with the property view) shows the errors and warnings in all models.</p><p class="p"><strong class="ph b">Profiles</strong></p><p class="p"><a class="xref" href="#diagram-profiles">Profiles</a> view (stacked with the property view) allows enabling/disabling some visual diagram effects.</p><p class="p"><strong class="ph b">Trend</strong></p><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">Trend</a> view shows the graphical representation of the values of the selected value over time. For the trend to be shown, a simulation has to be run. The view shows always the results of the latest run, but you can save results of a simulation and show them in the same trend with results from another simulation.</p><p class="p"><strong class="ph b">Structure</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">structure</a> view (stacked with the trend view) can be used for analyzing the varaible dependencies, loops, and the structure of the model.</p><p class="p"><strong class="ph b">Values</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">values</a> view (stacked with the trend view) shows the values of the selected value over time. For the values to be shown, a simulation has to be run.</p><p class="p">5 <strong class="ph b">Save and save as...</strong></p><p class="p">Save buttons can be used to export the selected model as .sysdyn file. The buttons save that model which is selected in the model browser or, if the focus is on the diagram, the model that is currently open on the diagram.</p><p class="p">6 <strong class="ph b">Diagram tool mode</strong></p><p class="p">With the diagram tool mode, you can select how the elements on the diagram are edited. The Lock mode prohibits editing diagram elements, the pointer mode allows moving and editing diagram elements, and with the dependency and flow modes arrows can be drawn using only mouse1 and mouse2.</p><p class="p">7 <strong class="ph b">Experiment controls</strong></p><p class="p">Experiment controls are shown when an experiment is active. Experiment is activated by double clicking an experiment in the model browser. With the experiment control, you can start simulation runs and save simulation results.</p><p class="p">8 <strong class="ph b">Perspectives</strong></p><div class="p">Perspectives allow changing between different layouts of the views. On start-up, only the default perspective is open. Try adding the two predefined perspectives by clicking the Open Perspective button: <div class="div image">
-<img class="image" src="Images/OpenPerspective.png"><br><p class="p">9 <strong class="ph b">Chart Panel</strong></p><p class="p"><a class="xref" href="#chart-panel">Chart panel</a> is able to house multiple <a class="xref" href="#custom-charts">charts</a> at the same time. Charts are added to the panel by dragging from model browser.</p><p class="p"><strong class="ph b">TIP!</strong> If you accidentally close a view, you can reopen them from Window->Show View->Other...</p><p class="p"><strong class="ph b">TIP!</strong> Try dragging the views to different positions (e.g. the property view to the right pane).</p></div><article class="topic nested1" aria-labelledby="ariaid-title11" id="global-preferences"><h2 class="title topictitle2" id="ariaid-title11">Global Preferences</h2><div class="body"><p class="p">Global preferences of Simantics System Dynamics are located under Window -> Preferences. Feel free to browse the contents yourself. A few notable items on the list are described below.</p><div class="div image">
- <img class="image" src="Images/Preferences.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="global-preferences__entry__1"><strong class="ph b">Category</strong></th><th class="entry" id="global-preferences__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">General -> Keys</strong></td><td class="entry" headers="global-preferences__entry__2 ">All <a class="xref" href="#shortcut-and-control-keys">keyboard shortcuts</a> available.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">Modelica</strong></td><td class="entry" headers="global-preferences__entry__2 ">The location of OpenModelica solver on file system.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">Solver</strong></td><td class="entry" headers="global-preferences__entry__2 "><a class="xref" href="#solvers">Solver</a> to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">Sysdyn Diagrams</strong></td><td class="entry" headers="global-preferences__entry__2 ">Sysdyn Diagrams allows customize default colors and fonts of diagram elements.</td></tr></tbody></table></div></article></div><article class="topic nested1" aria-labelledby="ariaid-title12" id="modelling"><h2 class="title topictitle2" id="ariaid-title12">Modelling</h2><div class="body"><div class="div hr">
+</div><p class="p">1 <strong class="ph b">Diagram</strong></p><p class="p">Diagram is the area where you will graphically modify your model. Diagrams are built from elements that can be dragged from Symbols view or populated using shortcut keys.</p><p class="p">2 <strong class="ph b">Model Browser</strong></p><p class="p">Model browser shows the structure of your model and all items related to it.</p><p class="p"><strong class="ph b">Symbols</strong></p><p class="p">Symbols view (stacked with the model browser) is used for dragging elements to diagrams.</p><p class="p">3 <strong class="ph b">Properties (MouseBirths in the image above)</strong></p><p class="p">Property view shows the selected variable's properties. Property view has a different layout depending on the type of the selected component. The view can also have different tabs depending on the component type. Basic tabs for variables are Equation, indices, and Additional information.</p><p class="p"><strong class="ph b">Console</strong></p><p class="p">Console view (stacked with the property view) shows console messages from the simulator. Console can be used for debugging models simulated using OpenModelica.</p><p class="p"><strong class="ph b">Issues</strong></p><p class="p">Issue view (stacked with the property view) shows the errors and warnings in all models.</p><p class="p"><strong class="ph b">Profiles</strong></p><p class="p"><a class="xref" href="#diagram-profiles">Profiles</a> view (stacked with the property view) allows enabling/disabling some visual diagram effects.</p><p class="p">4 <strong class="ph b">Trend</strong></p><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">Trend</a> view shows the graphical representation of the values of the selected value over time. For the trend to be shown, a simulation has to be run. The view shows always the results of the latest run, but you can save results of a simulation and show them in the same trend with results from another simulation.</p><p class="p"><strong class="ph b">Structure</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">structure</a> view (stacked with the trend view) can be used for analyzing the variable dependencies, loops, and the structure of the model.</p><p class="p"><strong class="ph b">Values</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">values</a> view (stacked with the trend view) shows the values of the selected value over time. For the values to be shown, a simulation has to be run.</p><p class="p">5 <strong class="ph b">Save and save as...</strong></p><p class="p">Save buttons can be used to export the selected model as .sysdyn file. The buttons save that model which is selected in the model browser or, if the focus is on the diagram, the model that is currently open on the diagram.</p><p class="p">6 <strong class="ph b">Diagram tool mode</strong></p><p class="p">With the diagram tool mode, you can select how the elements on the diagram are edited. The Lock mode prohibits editing diagram elements, the pointer mode allows moving and editing diagram elements, and with the dependency and flow modes arrows can be drawn using only mouse1 and mouse2.</p><p class="p">7 <strong class="ph b">Experiment controls</strong></p><p class="p">Experiment controls are shown when an experiment is active. Experiment is activated by double clicking an experiment in the model browser. With the experiment control, you can start simulation runs and save simulation results.</p><p class="p">8 <strong class="ph b">Perspectives</strong></p><div class="p">Perspectives allow changing between different layouts of the views. On start-up, only the default perspective is open. Try adding the two predefined perspectives by clicking the Open Perspective button: <div class="div image">
+<img class="image" src="Images/OpenPerspective.png"><br><p class="p">9 <strong class="ph b">Chart Panel</strong></p><p class="p"><a class="xref" href="#chart-panel">Chart panel</a> is able to house multiple <a class="xref" href="#custom-charts">charts</a> at the same time. Charts are added to the panel by dragging from model browser.</p><p class="p"><strong class="ph b">TIP!</strong> If you accidentally close a view, you can reopen them from Window→Show View→Other...</p><p class="p"><strong class="ph b">TIP!</strong> Try dragging the views to different positions (e.g. the property view to the right pane).</p></div><article class="topic nested1" aria-labelledby="ariaid-title11" id="global-preferences"><h2 class="title topictitle2" id="ariaid-title11">Global Preferences</h2><div class="body"><p class="p">Global preferences of Simantics System Dynamics are located under Window → Preferences. Feel free to browse the contents yourself. A few notable items on the list are described below.</p><div class="div image">
+ <img class="image" src="Images/PreferencesNew.png"><br>
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="global-preferences__entry__1"><strong class="ph b">Category</strong></th><th class="entry" id="global-preferences__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">General → Keys</strong></td><td class="entry" headers="global-preferences__entry__2">All <a class="xref" href="#shortcut-and-control-keys">keyboard shortcuts</a> available.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">Modelica</strong></td><td class="entry" headers="global-preferences__entry__2">The location of OpenModelica solver on file system.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">Solver</strong></td><td class="entry" headers="global-preferences__entry__2"><a class="xref" href="#solvers">Solver</a> to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">Sysdyn Diagrams</strong></td><td class="entry" headers="global-preferences__entry__2">Sysdyn Diagrams allows customize default colors and fonts of diagram elements.</td></tr></tbody></table></div></article></div><article class="topic nested1" aria-labelledby="ariaid-title12" id="modelling"><h2 class="title topictitle2" id="ariaid-title12">Modelling</h2><div class="body"><div class="div hr">
</div></div><article class="topic nested2" aria-labelledby="ariaid-title13" id="basic-modelling"><h3 class="title topictitle3" id="ariaid-title13">Basic Modelling</h3><div class="body"><p class="p">Basic modelling functions enable you to create and configure models. System dynamics modeling is basically pretty simple, so with these instructions you can build small and also very large models. The tricky part is writing all the expressions and adjusting the model so that it actually tells you something.</p><div class="div image">
- <img class="image" src="Images/Basic_1.png"><br>
-</div><p class="p"><strong class="ph b">Creating a new model</strong></p><p class="p">Start a new model by right-clicking the model browser and selecting New -> Model or from the main menu File -> New -> SD Model.</p><div class="div image">
- <img class="image" src="Images/Basic_2.png"><br>
-</div><p class="p"><strong class="ph b">Creating a new module type</strong></p><p class="p">Create a new module type by right-clicking on the Modules-folder and selecting New -> Module type. This creates a new module type that you can populate to your other modules and the model configuration.</p><p class="p"><strong class="ph b">Configuring a model</strong></p><p class="p">Model configuration can be opened by double clicking Configuration in the model browser.</p><p class="p"><strong class="ph b">Configuring modules</strong></p><p class="p">Configuration of a module type can be opened by double clicking the module type you want to configure. You can also open the configuration of a module from a diagram, when a module has been populated to that diagram, by right-clicking the module and selecting Show Module. When opening modules from diagram, the opened diagram knows to which diagram the module has been populated and can show the connections between the modules. Keep in mind that when making changes to a module, the changes apply to all instances of the respective module type!</p><p class="p"><strong class="ph b">Populate variables</strong></p><p class="p">You can drag variables to a diagram from symbol view. You can also populate variables using <a class="xref" href="#shortcut-and-control-keys">shortcut keys</a>. Variables can be divided into multiple lines by resizing the variable on diagram.</p><p class="p"><strong class="ph b">Populate modules</strong></p><p class="p">Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram.</p><p class="p"><strong class="ph b">Create connections</strong></p><p class="p">There are two types of connections: dependencies and flows. Both are created basically the same way. Hold Alt down and click on a variable. Left click starts a dependency, right click starts a flow. Both are ended to another variable with a left click. Dependencies and flows can also be created without Alt key by selecting dependency or flow mode on the toolbar.</p><p class="p">Flows can also be started and ended to an empty spot in the diagram. If there is no start or end variable, a cloud will be created. Also if start or end is not a valve, a new valve is created in the middle of the flow.</p><p class="p">There are some restrictions on what connections can be made, but don't worry, the user interface won't let you do connections that are not allowed.</p><p class="p"><strong class="ph b">Connections between modules</strong></p><p class="p"><strong class="ph b">Outside the module</strong></p><p class="p">You can connect variables to variables in modules like this:</p><pre class="pre">MODULE -----> INPUT
+ <img class="image" src="Images/NewModel.png"><br>
+</div><p class="p"><strong class="ph b">Creating a new model</strong></p><p class="p">Start a new model by right-clicking the model browser and selecting New → Model or from the main menu File → New → SD Model.</p><div class="div image">
+ <img class="image" src="Images/NewModule.png"><br>
+</div><p class="p"><strong class="ph b">Creating a new module type</strong></p><p class="p">Create a new module type by right-clicking on the Modules-folder and selecting New → Module type. This creates a new module type that you can populate to your other modules and the model configuration.</p><p class="p"><strong class="ph b">Configuring a model</strong></p><p class="p">Model configuration can be opened by double clicking Configuration in the model browser.</p><p class="p"><strong class="ph b">Configuring modules</strong></p><p class="p">Configuration of a module type can be opened by double clicking the module type you want to configure. You can also open the configuration of a module from a diagram, when a module has been populated to that diagram, by right-clicking the module and selecting Show Module. When opening modules from diagram, the opened diagram knows to which diagram the module has been populated and can show the connections between the modules. Keep in mind that when making changes to a module, the changes apply to all instances of the respective module type!</p><p class="p"><strong class="ph b">Populate variables</strong></p><p class="p">You can drag variables to a diagram from symbol view. You can also populate variables using <a class="xref" href="#shortcut-and-control-keys">shortcut keys</a>. Variables can be divided into multiple lines by resizing the variable on diagram.</p><p class="p"><strong class="ph b">Populate modules</strong></p><p class="p">Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram.</p><p class="p"><strong class="ph b">Create connections</strong></p><p class="p">There are two types of connections: dependencies and flows. Both are created basically the same way. Hold Alt down and click on a variable. Left click starts a dependency, right click starts a flow. Both are ended to another variable with a left click. Dependencies and flows can also be created without Alt key by selecting dependency or flow mode on the toolbar.</p><p class="p">Flows can also be started and ended to an empty spot in the diagram. If there is no start or end variable, a cloud will be created. Also if start or end is not a valve, a new valve is created in the middle of the flow.</p><p class="p">There are some restrictions on what connections can be made, but don't worry, the user interface won't let you do connections that are not allowed.</p><p class="p"><strong class="ph b">Connections between modules</strong></p><p class="p"><strong class="ph b">Outside the module</strong></p><p class="p">You can connect variables to modules like this:</p><pre class="pre">MODULE -----> INPUT
or
-ANY VARIABLE -----> MODULE
-</pre><p class="p">This is just the visual configuration, but you need those connections to really connect variables in the module's properties.</p><p class="p">In the <em class="ph i">Inputs</em> tab stacked under <em class="ph i">Module Properties</em> you can select which variables you connect to inputs inside the module. In the <em class="ph i">Outputs</em> tab you can select which variables you lift from the module to inputs outside it.</p><p class="p"><strong class="ph b">Inside the module</strong></p><p class="p">Input variables get values from outside the module</p><p class="p">Output variables can send their values outside the module. From the variable properties, select Additional Information and press Is Output</p><p class="p"><strong class="ph b">Configure variables</strong></p><p class="p">Select a single variable from diagram or model browser. The properties of the variables are shown in the equation view and you can modify them.</p><p class="p"><strong class="ph b">Export model</strong></p><p class="p">To export your model to a file, select your model from the model browser, right-click and from the context menu choose Export->Model. Select the folder where to export your model, give the file a name and press Save. You do not need to export a model to Save it, the model is automatically saved in your database. Export can be used, for example, to create different versions of a model, create backups or to transport a model to another database.</p><p class="p"><strong class="ph b">Import model</strong></p><p class="p">Right-click on the model browser and select Import->Model. Browse to your .sysdyn file and select open. The model is added to your model browser.</p><p class="p"><strong class="ph b">Export module</strong></p><p class="p">To export a module to a file, select the module from the model browser, right-click and from the context menu choose Export->Module. Select the folder where to export your model, give the file a name and press Save. Module export can be used, for example, to transport a module to another model or another database.</p><p class="p"><strong class="ph b">Import module</strong></p><p class="p">Right-click the Modules folder of a model and select Import->Module. Browse to your .sysdynModule file and select open. The module is added to your model.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title14" id="model-properties"><h3 class="title topictitle3" id="ariaid-title14">Model Properties</h3><div class="body"><p class="p">Model properties can be viewed by selecting either the model or its configuration on the model browser.</p><div class="div image">
+ANY VARIABLE -----> MODULE
+</pre><p class="p">This is just the visual configuration, but you need those connections to really connect variables in the module's properties.</p><p class="p">In the <em class="ph i">Inputs</em> tab stacked under <em class="ph i">Module Properties</em> you can select which variables you connect to inputs inside the module. In the <em class="ph i">Outputs</em> tab you can select which variables you lift from the module to inputs outside it.</p><p class="p"><strong class="ph b">Inside the module</strong></p><p class="p">Input variables get values from outside the module.</p><p class="p">Output variables send their values outside the module. To make a variable output its values, from the properties view make sure the Is Output checkbox is ticked.</p><p class="p"><strong class="ph b">Configure variables</strong></p><p class="p">Select a single variable from diagram or model browser. The properties of the variables are shown in the properties view where you can also modify them.</p><p class="p"><strong class="ph b">Export model</strong></p><p class="p">To export your model to a file, select your model from the model browser, right-click and from the context menu choose Export→Model. Select the folder where to export your model, give the file a name and press Save. You do not need to export a model to Save it, the model is automatically saved in your database. Export can be used, for example, to create different versions of a model, create backups or to transport a model to another database.</p><p class="p"><strong class="ph b">Import model</strong></p><p class="p">Select File→Import Model, browse to your .sysdyn file and select open. The model is added to your model browser.</p><p class="p"><strong class="ph b">Export module</strong></p><p class="p">To export a module to a file, select the module from the model browser, right-click and from the context menu choose Export→Module. Select the folder where to export your model, give the file a name and press Save. Module export can be used, for example, to transport a module to another model or another database.</p><p class="p"><strong class="ph b">Import module</strong></p><p class="p">Right-click the Modules folder of a model and select Import→Module. Browse to your .sysdynModule file and select open. The module is added to your model.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title14" id="model-properties"><h3 class="title topictitle3" id="ariaid-title14">Model Properties</h3><div class="body"><p class="p">Model properties can be viewed by selecting either the model or its configuration on the model browser.</p><div class="div image">
<img class="image" src="Images/ModelProperties.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="model-properties__entry__1"><strong class="ph b">Property</strong></th><th class="entry" id="model-properties__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Name</strong></td><td class="entry" headers="model-properties__entry__2 ">The name of the model</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Start time</strong></td><td class="entry" headers="model-properties__entry__2 ">The start time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Stop time</strong></td><td class="entry" headers="model-properties__entry__2 ">The stop time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Step length</strong></td><td class="entry" headers="model-properties__entry__2 ">The length of the simulation step.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Output interval</strong></td><td class="entry" headers="model-properties__entry__2 ">Interval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Method</strong></td><td class="entry" headers="model-properties__entry__2 ">The simulation solver (only OpenModelica).</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Validate units</strong></td><td class="entry" headers="model-properties__entry__2 "><a class="xref" href="#unit-validation">Unit validation</a> on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Unit equivalents</strong></td><td class="entry" headers="model-properties__entry__2 ">Define if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Tolerance</strong></td><td class="entry" headers="model-properties__entry__2 ">Integrator error tolerance (only OpenModelica)</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Variable filter</strong></td><td class="entry" headers="model-properties__entry__2 ">Define which variables are presented (only OpenModelica)</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title15" id="special-variables"><h3 class="title topictitle3" id="ariaid-title15">Special Variables</h3><div class="body"><p class="p">Auxiliary and valve variables have two special types: WithLookup and Delay. These types are selected from Type drop down menu in the variable's properties. The variable types offer more specific functionalities than normal variables, but the same functionality could be achieved using normal variables.</p></div><article class="topic nested3" aria-labelledby="ariaid-title16" id="withlookup"><h4 class="title topictitle4" id="ariaid-title16">WithLookup</h4><div class="body"><p class="p">WithLookup variable has two equation fields, WithLookup and Lookup table. Lookup table has a table from which the value of the variable is interpolated using the value of WithLookup field.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="model-properties__entry__1"><strong class="ph b">Property</strong></th><th class="entry" id="model-properties__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Name</strong></td><td class="entry" headers="model-properties__entry__2">The name of the model</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Start time</strong></td><td class="entry" headers="model-properties__entry__2">The start time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Stop time</strong></td><td class="entry" headers="model-properties__entry__2">The stop time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Step length</strong></td><td class="entry" headers="model-properties__entry__2">The length of the simulation step.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Output interval</strong></td><td class="entry" headers="model-properties__entry__2">Interval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Method</strong></td><td class="entry" headers="model-properties__entry__2">The simulation solver (only OpenModelica).</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Validate units</strong></td><td class="entry" headers="model-properties__entry__2"><a class="xref" href="#unit-validation">Unit validation</a> on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Unit equivalents</strong></td><td class="entry" headers="model-properties__entry__2">Define if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Tolerance</strong></td><td class="entry" headers="model-properties__entry__2">Integrator error tolerance (only OpenModelica)</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Variable filter</strong></td><td class="entry" headers="model-properties__entry__2">Define which variables are presented (only OpenModelica)</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title15" id="special-variables"><h3 class="title topictitle3" id="ariaid-title15">Special Variables</h3><div class="body"><p class="p">Auxiliary and valve variables have two special types: WithLookup and Delay. These types are selected from Type drop down menu in the variable's properties. The variable types offer more specific functionalities than normal variables, but the same functionality could be achieved using normal variables.</p></div><article class="topic nested3" aria-labelledby="ariaid-title16" id="withlookup"><h4 class="title topictitle4" id="ariaid-title16">WithLookup</h4><div class="body"><p class="p">WithLookup variable has two equation fields, WithLookup and Lookup table. Lookup table has a table from which the value of the variable is interpolated using the value of WithLookup field.</p><div class="div image">
<img class="image" src="Images/WithLookup1.png"><br>
-</div><p class="p">You do not need to manually input the Lookup table. WithLookup variable type offers an additional Lookup table tab in the property view. In this view you can add and modify points in the lookup table. Points can be added either by clickin on the chart or by using the input fields and Add button. Points can be modified by dragging them on the chart or modifying values in the table. Points are removed by clicking them with right mouse click.</p><div class="div image">
+</div><p class="p">You do not need to manually input the Lookup table. WithLookup variable type offers an additional Lookup table tab in the property view. In this view you can add and modify points in the lookup table. Points can be added either by clicking on the chart or by using the input fields and Add button. Points can be modified by dragging them on the chart or modifying values in the table. Points are removed by clicking them with right mouse click.</p><div class="div image">
<img class="image" src="Images/WithLookup2.png"><br>
</div></div></article><article class="topic nested3" aria-labelledby="ariaid-title17" id="delay"><h4 class="title topictitle4" id="ariaid-title17">Delay</h4><div class="body"><p class="p">Delay variables build equations for Nth order delays. Users can set the equation for the value that is to be delayed, the time and order of the delay and a possible start value. If start value is empty, the start value is set automatically.</p><div class="div image">
<img class="image" src="Images/Delay1.png"><br>
end Delay3_delayClass;
</pre><p class="p">The above definitions can be seen as a line of stocks and valves. The first valve, delay0, is given the value of the delayed expression. Delay3 is given the value of the valve that is coming from the last stock.</p><p class="p">Equations:</p><pre class="pre">Delay3_delayClass_instance.delay0 = Step1;
Delay3 = Delay3_delayClass_instance.delay3;
-</pre></div></article></article><article class="topic nested2" aria-labelledby="ariaid-title18" id="shortcut-and-control-keys"><h3 class="title topictitle3" id="ariaid-title18">Shortcut and Control Keys</h3><div class="body"><p class="p">Shortcut keys for configuring a model on diagram.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="shortcut-and-control-keys__entry__1">Key</th><th class="entry" id="shortcut-and-control-keys__entry__2">Action</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Esc</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Cancel operations (e.g. connection and rename).</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + A</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Auxiliary at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + S</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Stock at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Cloud at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Valve at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + I</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Input at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + G</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Shadow (Ghost) variable at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Alt + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Start an arrow from a variable. End to another variable by clicking left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Alt + right mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Start flow from a variable. End by clicking left mouse button. If a flow is not started or ended on to a variable, a cloud will be created to that end. If a new flow does not have a valve at either end, a valve will be created in the middle of the flow.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Delete</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Remove selected variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">F2</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Rename selected variable</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Select multiple variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Mouse wheel or + or -</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram zoom</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">drag(mouse3)</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">drag(shift + any mouse button)</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">↓, ←, ↑, → (arrow keys)</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Copy selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + X</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Cut selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Paste copied or cut elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + F</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Find element in current diagram or all models</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">G</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Show / hide grid</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">R</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Show / hide ruler</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">1</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Fit diagram contents to screen</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + Space</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Content assist in equation editor</td></tr></tbody></table><p class="p">Other shortcut keys can be found selecting Window -> Preferences from the main menu. Keys are located in General -> Keys.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title19" id="unit-validation"><h3 class="title topictitle3" id="ariaid-title19">Unit Validation</h3><div class="body"><p class="p">Unit validation is useful for finding errors in the model. With unit validation, the consistency of the measurement units of variables is checked. For unit validation, the units of all variables in the model must be defined. If a variable is dimensionless, use 1 as the unit. In certain constructs, a dimensionless variable can be used as "a wild card", e.g., adding a dimensionless variable with a dimensioned one is OK.</p><p class="p">Common error sources of unit validation include the following. The respective issues are shown in the picture below.</p><div class="div image">
+</pre></div></article></article><article class="topic nested2" aria-labelledby="ariaid-title18" id="shortcut-and-control-keys"><h3 class="title topictitle3" id="ariaid-title18">Shortcut and Control Keys</h3><div class="body"><p class="p">Shortcut keys for configuring a model on diagram.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="shortcut-and-control-keys__entry__1">Key</th><th class="entry" id="shortcut-and-control-keys__entry__2">Action</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Esc</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Cancel operations (e.g. connection and rename).</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + A</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Auxiliary at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + S</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Stock at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Cloud at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Valve at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + I</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Input at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + G</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Shadow (Ghost) variable at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Alt + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Start an arrow from a variable. End to another variable by clicking left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Alt + right mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Start flow from a variable. End by clicking left mouse button. If a flow is not started or ended on to a variable, a cloud will be created to that end. If a new flow does not have a valve at either end, a valve will be created in the middle of the flow.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Delete</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Remove selected variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">F2</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Rename selected variable</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Select multiple variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Mouse wheel or + or -</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram zoom</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">drag(mouse3)</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">drag(shift + right mouse button)</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">↓, ←, ↑, → (arrow keys)</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Copy selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + X</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Cut selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Paste copied or cut elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + F</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Find element in current diagram or all models</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">G</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Show / hide grid</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">R</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Show / hide ruler</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">1</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Fit diagram contents to screen</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + Space</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Content assist in equation editor</td></tr></tbody></table><p class="p">Other shortcut keys can be found selecting Window → Preferences from the main menu. Keys are located in General → Keys.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title19" id="unit-validation"><h3 class="title topictitle3" id="ariaid-title19">Unit Validation</h3><div class="body"><p class="p">Unit validation is useful for finding errors in the model. Unit validation checks the consistency of units. To use this feature you need to define units for every variable used in the model. If a variable is dimensionless, use 1 as the unit. In certain constructs, a dimensionless variable can be used as "a wild card", e.g., adding a dimensionless variable with a dimensioned one is OK.</p><p class="p">Common error sources of unit validation include the following. The respective issues are shown in the picture below.</p><div class="div image">
<img class="image" src="Images/UnitValidation.png"><br>
</div><ul class="ul"><li class="li"><p class="p">The equation of a variable yields a different unit than that defined for the variable.</p></li><li class="li"><p class="p">Two variables which have different units are added (+), subtracted (-), or compared (>, <, =, ...).</p></li><li class="li"><p class="p">The output unit of a function is used in an inconsistent manner. (The unit validation for the output unit of a function behaves equivalently to the unit of a variable.)</p></li><li class="li"><p class="p">A function is called with an argument of a prohibited unit.</p></li><li class="li"><p class="p">A variable has an empty unit.</p></li><li class="li"><p class="p">A variable has a misspelled unit.</p></li></ul><p class="p">Unit validation is enabled for a model by selecting the model or its configuration on the model browser and enabling "Validate units" on the properties tab. The unit warnings are shown on Issues view and, supposing the respective profile has been enabled, on the diagram as well. Warnings from unit validation do not prevent simulation.</p><p class="p">For models that have stocks (i.e., integration), the simulation time unit must be selected from the pull-down menu next to the "Validate units" checkbox in Model Properties tab.</p><p class="p">Unit validation can also cope with certain different forms of units, e.g., you can write dollars, dollar, or $ and the validator considers these equal. This functionality can be disabled from Model Properties tab checkbox "Unit equivalents".</p><p class="p">As there may be cases for which the unit validation is for some reason not working as desired, the unitCast() function can be used in the equation of a variable to cast the unit of any expression within the equation to a wildcard. E.g., if expression</p><pre class="pre"> Aux1 + time
</pre><p class="p">yields a warning, it can be fixed be changing the expression to</p><pre class="pre"> unitCast(Aux1) + time
-</pre><p class="p">, in which case the unit of the expression is that of time, or to</p><pre class="pre"> Aux1 + unitCast(time)
-</pre><p class="p">, in which case the unit of the expression is that of Aux1.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title20" id="diagram-profiles"><h3 class="title topictitle3" id="ariaid-title20">Diagram Profiles</h3><div class="body"><p class="p">Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used:</p><p class="p"><strong class="ph b">Default</strong></p><p class="p"><strong class="ph b">Issue warnings</strong></p><p class="p">When enabled, an error or a warning symbol is attached to diagram elements in which there are errors or warnings (usually in the equations).</p><p class="p"><strong class="ph b">Shadow variable visualizations</strong></p><p class="p">When enabled, the original and all the shadow variables are highlighted when one is selected.</p><p class="p"><strong class="ph b">Simulation Playback</strong></p><p class="p"><strong class="ph b">Playback Colors</strong></p><p class="p">When enabled, colors of the elements on diagram change during a playback experiment.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title21" id="visual-model-elements"><h2 class="title topictitle2" id="ariaid-title21">Visual model elements</h2><div class="body"><div class="div hr">
-</div><p class="p">The visual appearance of the elements on diagram can be modified in various ways. In addition, the tool offers are comment symbols which do not affect simulation but help the understandability of models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title22" id="fonts-and-colors"><h3 class="title topictitle3" id="ariaid-title22">Fonts and colors</h3><div class="body"><p class="p">Fonts and colors of diagram elements can be changed by right-clicking the element and selecting Font... The default fonts and colors for each diagram element type can be changed in Window -> Preferences -> Sysdyn Diagrams.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title23" id="dependency-properties"><h3 class="title topictitle3" id="ariaid-title23">Dependency properties</h3><div class="body"><p class="p">Dependency arrow properties can be changed on the property view:</p><p class="p"><strong class="ph b">Polarity</strong></p><p class="p">Polarity sign can be used to indicate whether the dependency increases or decreases the variable it is pointing to. The polarities serve no function for simulation, however, they are used in loop type automatic determination.</p><p class="p"><strong class="ph b">Location</strong></p><p class="p">Location of the polarity mark</p><p class="p"><strong class="ph b">Arrowhead</strong></p><p class="p">Toggle for showing arrowhead</p><p class="p"><strong class="ph b">Delay mark</strong></p><p class="p">Delay mark is a visual cue for helping understandability of the dynamics of the model when there are (information) delays. A delay mark is usually added to the dependency arrow when the effect the tail of the dependency has on the head of the dependency is delayed.</p><p class="p"><strong class="ph b">Line thickness</strong></p><p class="p">Thickness of the arrow</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title24" id="loops"><h3 class="title topictitle3" id="ariaid-title24">Loops</h3><div class="body"><p class="p">A loop element is a graphical component for highlighting feedback loops in a model. Usually the most interesting feedback loops that affect the behaviour of the model most are marked with a loop symbol.</p><p class="p"><strong class="ph b">Loop Items</strong></p><p class="p">The loop of variables which the loop symbol refers can be selected for visualization purposes.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">Comment inside the loop. Usually characters 'B' and 'R' are used to denote balancing and reinforcing loops, respectfully. A feedback loop is reinforcing if and only if it has an even number of negative dependencies. Selecting 'Auto' determines automatically the type of the loop.</p><p class="p"><strong class="ph b">Direction of Rotation</strong></p><p class="p">Direction to which the loop rotates on diagram.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title25" id="comments"><h3 class="title topictitle3" id="ariaid-title25">Comments</h3><div class="body"><p class="p">Comments are just strings of text.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title26" id="simulation"><h2 class="title topictitle2" id="ariaid-title26">Simulation</h2><div class="body"><div class="div hr">
-</div></div><article class="topic nested2" aria-labelledby="ariaid-title27" id="experiments"><h3 class="title topictitle3" id="ariaid-title27">Experiments</h3><div class="body"><p class="p">There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics.</p><p class="p">Experiments are created from the context menu of experiments folder in a model.</p><div class="div image">
+</pre><p class="p">in which case the unit of the expression is that of time, or to</p><pre class="pre"> Aux1 + unitCast(time)
+</pre><p class="p">in which case the unit of the expression is that of Aux1.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title20" id="diagram-profiles"><h3 class="title topictitle3" id="ariaid-title20">Diagram Profiles</h3><div class="body"><p class="p">Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used:</p><p class="p"><strong class="ph b">Default</strong></p><p class="p"><strong class="ph b">Issue warnings</strong></p><p class="p">When enabled, an error or a warning symbol is attached to diagram elements in which there are errors or warnings (usually in the equations).</p><p class="p"><strong class="ph b">Shadow variable visualizations</strong></p><p class="p">When enabled, the original and all the shadow variables are highlighted when one is selected.</p><p class="p"><strong class="ph b">Simulation Playback</strong></p><p class="p"><strong class="ph b">Playback Colors</strong></p><p class="p">When enabled, colors of the elements on diagram change during a playback experiment.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title21" id="debugging-a-model"><h3 class="title topictitle3" id="ariaid-title21">Debugging a model</h3><div class="body"><p class="p">If you find yourself with a model that doesn't simulate or has bizarre behavior, there are several places to look for clues for what went wrong. Firstly, if you got an error message and can't infer the problem straight from the message, look at the issues view if it can tell you what is wrong in different words. If you know how to read Modelica code, right click Configuration under the broken model and choose Open With → Modelica Code Viewer. The tool works by generating Modelica code from the graphical model and then solving it. Therefore, if something is broken it means that there is a problem with the generated Modelica code (or, very rarely, a bug in the solver you are using). You can also refer to the list below, if you still find yourself stuck.</p><p class="p">Some of the most common errors include:</p><ul class="ul"><li class="li"><p class="p">In a model that uses modules, you forget to connect inputs and/or outputs in the module properties</p></li><li class="li"><p class="p">You forgot to add an enumeration to a variable, i.e. trying to put a vector to a scalar variable (or vice versa)</p></li><li class="li"><p class="p">You increased the enumeration indices you are using, but forget to update a variable that depend on it</p></li><li class="li"><p class="p">You wrote a custom Modelica function, but it is broken</p></li><li class="li"><p class="p">You are comparing two numbers for equality while using OpenModelica solver (forbidden, allowed by the internal solver)</p></li><li class="li"><p class="p">You have a variable that refers to itself in the equation, making the solver unable find an initial value</p></li></ul><p class="p">If you are using OpenModelica solver it can be very useful to google error messages printed in the console of the tool.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title22" id="visual-model-elements"><h2 class="title topictitle2" id="ariaid-title22">Visual model elements</h2><div class="body"><div class="div hr">
+</div><p class="p">The visual appearance of the elements on diagram can be modified in various ways. In addition, the tool has comment symbols which do not affect simulation but help the understandability of models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title23" id="fonts-and-colors"><h3 class="title topictitle3" id="ariaid-title23">Fonts and colors</h3><div class="body"><p class="p">Fonts and colors of diagram elements can be changed by right-clicking the element and selecting Font... The default fonts and colors for each diagram element type can be changed in Window → Preferences → Sysdyn Diagrams.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title24" id="dependency-properties"><h3 class="title topictitle3" id="ariaid-title24">Dependency properties</h3><div class="body"><p class="p">Dependency arrow properties can be changed on the property view:</p><p class="p"><strong class="ph b">Polarity</strong></p><p class="p">Polarity sign can be used to indicate whether the dependency increases or decreases the variable it is pointing to. The polarities serve no function for simulation, however, they are used in loop type automatic determination.</p><p class="p"><strong class="ph b">Location</strong></p><p class="p">Location of the polarity mark</p><p class="p"><strong class="ph b">Arrowhead</strong></p><p class="p">Toggle for showing arrowhead</p><p class="p"><strong class="ph b">Delay mark</strong></p><p class="p">Delay mark is a visual cue for helping understandability of the dynamics of the model when there are (information) delays. A delay mark is usually added to the dependency arrow when the effect the tail of the dependency has on the head of the dependency is delayed.</p><p class="p"><strong class="ph b">Line thickness</strong></p><p class="p">Thickness of the arrow</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title25" id="loops"><h3 class="title topictitle3" id="ariaid-title25">Loops</h3><div class="body"><p class="p">A loop element is a graphical component for highlighting feedback loops in a model. Usually the most interesting feedback loops that affect the behaviour of the model most are marked with a loop symbol.</p><p class="p"><strong class="ph b">Loop Items</strong></p><p class="p">The loop of variables which the loop symbol refers can be selected for visualization purposes.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">Comment inside the loop. Usually characters 'B' and 'R' are used to denote balancing and reinforcing loops, respectfully. A feedback loop is reinforcing if and only if it has an even number of negative dependencies. Selecting 'Auto' determines automatically the type of the loop.</p><p class="p"><strong class="ph b">Direction of Rotation</strong></p><p class="p">Direction to which the loop rotates on diagram.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title26" id="comments"><h3 class="title topictitle3" id="ariaid-title26">Comments</h3><div class="body"><p class="p">Comments are just strings of text.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title27" id="simulation"><h2 class="title topictitle2" id="ariaid-title27">Simulation</h2><div class="body"><div class="div hr">
+</div></div><article class="topic nested2" aria-labelledby="ariaid-title28" id="experiments"><h3 class="title topictitle3" id="ariaid-title28">Experiments</h3><div class="body"><p class="p">There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics. Currently some of the experiment and solver combinations are still in development.</p><p class="p">Experiments are created from the context menu of experiments folder in a model.</p><div class="div image">
<img class="image" src="Images/NewExperiment.png"><br>
-</div><p class="p">Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar.</p><p class="p"><strong class="ph b">Normal simulation</strong></p><p class="p">Experiment is the basic simulation type. It simulates a model from start time to end time and results can be viewed after the simulation has been run.</p><p class="p"><strong class="ph b">Game simulation</strong></p><p class="p">Game simulations allow simulating an arbitrary number of steps, changing parameter values and continuing simulation with the new values from where it previously ended.</p><p class="p"><strong class="ph b">Simulation playback</strong></p><p class="p">Simulation playback works essentially as the basic experiment, but it offers some additional visualization options.</p><p class="p"><strong class="ph b">Sensitivity analysis simulation</strong></p><p class="p">Sensitivity analysis allows running <a class="xref" href="http://en.wikipedia.org/wiki/Multivariate_analysis" target="_blank">multivariate</a> <a class="xref" href="http://en.wikipedia.org/wiki/Monte_Carlo_method" target="_blank">Monte Carlo simulations</a> with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters.</p><div class="div image">
+</div><p class="p">Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar.</p><p class="p"><strong class="ph b">Normal simulation</strong></p><p class="p">Experiment is the basic simulation type. It simulates a model from start time to end time and results can be viewed after the simulation has been run. Works on both the internal and OpenModelica solvers.</p><p class="p"><strong class="ph b">Game simulation</strong></p><p class="p">Game simulations allow simulating an arbitrary number of steps, changing parameter values and continuing simulation with the new values from where it previously ended. Works on the internal solver, OpenModelica version still in development.</p><p class="p"><strong class="ph b">Simulation playback</strong></p><p class="p">Simulation playback works essentially as the basic experiment, but it offers some additional visualization options. Works on both solvers.</p><p class="p"><strong class="ph b">Sensitivity analysis simulation</strong></p><p class="p">Sensitivity analysis allows running <a class="xref" href="http://en.wikipedia.org/wiki/Multivariate_analysis" target="_blank" rel="external noopener">multivariate</a> <a class="xref" href="http://en.wikipedia.org/wiki/Monte_Carlo_method" target="_blank" rel="external noopener">Monte Carlo simulations</a> with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters. Works on OpenModelica solver, internal solver implementation still in development.</p><div class="div image">
<img class="image" src="Images/SensitivityExperiment.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="experiments__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="experiments__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="experiments__entry__1 ">Name</td><td class="entry" headers="experiments__entry__2 ">The name of the sensitivity analysis experiment. Displayed in e.g. model browser.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Number of runs</td><td class="entry" headers="experiments__entry__2 ">The total amount of individual simulation runs</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Method</td><td class="entry" headers="experiments__entry__2 ">The method of how the parameter values are selected from the distribution(s). Selecting "Random" yields <a class="xref" href="http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers" target="_blank">pseudo-random</a> values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a <a class="xref" href="http://en.wikipedia.org/wiki/Quasi-random" target="_blank">quasi-random</a> <a class="xref" href="http://en.wikipedia.org/wiki/Halton_sequence" target="_blank">Halton sequence</a> of values selected deterministically to represent the distribution(s) better than a pseudo-random series.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Seed</td><td class="entry" headers="experiments__entry__2 ">The seed number for pseudo-random generator</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Add parameter</td><td class="entry" headers="experiments__entry__2 ">Adds a new parameter to be varied</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Remove</td><td class="entry" headers="experiments__entry__2 ">Removes a parameter</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 "><strong class="ph b">Parameter properties</strong></td><td class="entry" headers="experiments__entry__2 ">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Variable</td><td class="entry" headers="experiments__entry__2 ">The full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Range</td><td class="entry" headers="experiments__entry__2 ">Used with multidimensional values to select which dimensions are varied.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Distribution</td><td class="entry" headers="experiments__entry__2 ">Probability distribution for the varied parameter. "Normal" is for <a class="xref" href="http://en.wikipedia.org/wiki/Truncated_normal_distribution" target="_blank">truncated normal distribution</a> and "Uniform" for <a class="xref" href="http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)" target="_blank">uniform distribution</a>. With "Interval" the values have equal intervals between each other and are selected in increasing order. In multivariate sensitivity analyses, it is recommended to select either "Normal" or "Uniform".</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 "><strong class="ph b">Distribution properties</strong></td><td class="entry" headers="experiments__entry__2 ">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Min value</td><td class="entry" headers="experiments__entry__2 ">Minimum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Max value</td><td class="entry" headers="experiments__entry__2 ">Maximum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Mean</td><td class="entry" headers="experiments__entry__2 ">Mean of the normal distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Standard deviation</td><td class="entry" headers="experiments__entry__2 ">Standard deviation of the normal distribution</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title28" id="solvers"><h3 class="title topictitle3" id="ariaid-title28">Solvers</h3><div class="body"><p class="p">Simantics System Dynamics allows using the multiple solvers provided by OpenModelica, like Euler, Runge-Kutta, DASSL, etc. OpenModelica is currently the main simulation environment behind the tool and all functionalities are supported with OpenModelica.</p><p class="p">Alternatively to OpenModelica, an internal custom Modelica solver is included in Simantics System Dynamics. The custom solver is currently at an experimental state, and thus all functionalities of the tool are not yet supported, e.g., only the basic experiment can be run with it. The advantage of the custom solver is, however, that simulation is usually a lot faster than with OpenModelica. Try out yourself which solver suits best for your needs.</p><p class="p">The solver can be changed in Windows -> Preferences -> Solver.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title29" id="simulation-result-and-model-structure-analysis"><h2 class="title topictitle2" id="ariaid-title29">Simulation Result and Model Structure Analysis</h2><div class="body"><div class="div hr">
-</div><p class="p">Simulation results can be viewed as trends in the trend view or as plain numbers in the values view. The views display results of variables that are selected in the workbench. Users can also create <a class="xref" href="#custom-charts">custom charts</a>.</p><p class="p">Model structure can be examined in the Structure view. There are three options: dependency structures of individual variables, the complete hierarchy structure of the model, or the feedback loops which individual variables belong to.</p><p class="p"><strong class="ph b">Trend</strong></p><p class="p">Shows you the values of the selected variable(s) graphically over the simulation time. You can modify the trend and zoom it using the context menu (right-click) of the trend.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="experiments__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="experiments__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="experiments__entry__1">Name</td><td class="entry" headers="experiments__entry__2">The name of the sensitivity analysis experiment. Displayed in e.g. model browser.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Number of runs</td><td class="entry" headers="experiments__entry__2">The total amount of individual simulation runs</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Method</td><td class="entry" headers="experiments__entry__2">The method of how the parameter values are selected from the distribution(s). Selecting "Random" yields <a class="xref" href="http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers" target="_blank" rel="external noopener">pseudo-random</a> values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a <a class="xref" href="http://en.wikipedia.org/wiki/Quasi-random" target="_blank" rel="external noopener">quasi-random</a> <a class="xref" href="http://en.wikipedia.org/wiki/Halton_sequence" target="_blank" rel="external noopener">Halton sequence</a> of values selected deterministically to represent the distribution(s) better than a pseudo-random series.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Seed</td><td class="entry" headers="experiments__entry__2">The seed number for pseudo-random generator</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Add parameter</td><td class="entry" headers="experiments__entry__2">Adds a new parameter to be varied</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Remove</td><td class="entry" headers="experiments__entry__2">Removes a parameter</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1"><strong class="ph b">Parameter properties</strong></td><td class="entry" headers="experiments__entry__2">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Variable</td><td class="entry" headers="experiments__entry__2">The full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Range</td><td class="entry" headers="experiments__entry__2">Used with multidimensional values to select which dimensions are varied.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Distribution</td><td class="entry" headers="experiments__entry__2">Probability distribution for the varied parameter. "Normal" is for <a class="xref" href="http://en.wikipedia.org/wiki/Truncated_normal_distribution" target="_blank" rel="external noopener">truncated normal distribution</a> and "Uniform" for <a class="xref" href="http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)" target="_blank" rel="external noopener">uniform distribution</a>. With "Interval" the values have equal intervals between each other and are selected in increasing order. In multivariate sensitivity analyses, it is recommended to select either "Normal" or "Uniform".</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1"><strong class="ph b">Distribution properties</strong></td><td class="entry" headers="experiments__entry__2">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Min value</td><td class="entry" headers="experiments__entry__2">Minimum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Max value</td><td class="entry" headers="experiments__entry__2">Maximum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Mean</td><td class="entry" headers="experiments__entry__2">Mean of the normal distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Standard deviation</td><td class="entry" headers="experiments__entry__2">Standard deviation of the normal distribution</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title29" id="solvers"><h3 class="title topictitle3" id="ariaid-title29">Solvers</h3><div class="body"><p class="p">Simantics System Dynamics allows using the multiple solvers provided by OpenModelica, like Euler, Runge-Kutta, DASSL, etc. OpenModelica is currently the main simulation environment behind the tool and all functionalities are supported with OpenModelica.</p><p class="p">Alternatively to OpenModelica, an internal custom Modelica solver is included in Simantics System Dynamics. The custom solver is currently at an experimental state, and thus all functionalities of the tool are not yet supported, e.g., only the basic experiment can be run with it. The advantage of the custom solver is, however, that simulation is usually a lot faster than with OpenModelica. Try out yourself which solver suits best for your needs.</p><p class="p">The solver can be changed in Windows → Preferences → Solver.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title30" id="simulation-result-and-model-structure-analysis"><h2 class="title topictitle2" id="ariaid-title30">Simulation Result and Model Structure Analysis</h2><div class="body"><div class="div hr">
+</div><p class="p">Simulation results can be viewed as trends in the trend view or as plain numbers in the values view. The views display results of variables that are selected in the workbench. Users can also create <a class="xref" href="#custom-charts">custom charts</a>.</p><p class="p">Model structure can be examined in the Structure view. There are three options: dependency structures of individual variables, the complete hierarchy structure of the model, or the feedback loops which individual variables belong to.</p><p class="p"><strong class="ph b">Trend</strong></p><p class="p">Shows you the values of the selected variable(s) graphically over the simulation time. You can modify the trend and zoom it using the context menu (right-click) of the trend. You can also export the trend using controls in the upper right corner.</p><div class="div image">
<img class="image" src="Images/Trend.png"><br>
</div><p class="p"><strong class="ph b">Values</strong></p><p class="p">Shows you the values of the selected variable(s) in a table form. If the value has a star (*) at the end, it means that the value is an approximate. There is no value for that variable for the given time step. Selected values can be copied to other software in csv format.</p><div class="div image">
<img class="image" src="Images/Values.png"><br>
-</div><p class="p"><strong class="ph b">Compare results</strong></p><p class="p">You can compare different results of the same model by saving simulation results and displaying the saved results side by side with other results. You can save your results after simulating by clicking the Save Results button:</p><div class="div image">
+</div><p class="p"><strong class="ph b">Compare results</strong></p><p class="p">You can compare different results of the same model by saving simulation results and displaying the saved results side by side with other results. This functionality currently only works for the OpenModelica solver, internal solver implementation is in development. You can save your results after simulating by clicking the Save Results button:</p><div class="div image">
<img class="image" src="Images/Saveresults.png"><br>
-</div><p class="p">on your experiment controls. The saved results appear to model browser under the active experiment. To show the results on trends and tables, right-click on the result and select Show on charts.</p><div class="div image">
+</div><p class="p">on your experiment controls. The saved results appear to model browser under the active experiment. To show the results on trends and tables, double click on the result to activate it.</p><div class="div image">
<img class="image" src="Images/CompareTrend.png"><br>
</div><p class="p"><strong class="ph b">Dependencies</strong></p><p class="p">Dependencies display which variables affect and which are affected by the selected variable. The direction and number of steps that are traveled from the selected variable can be configured at the bottom of the view.</p><div class="div image">
<img class="image" src="Images/Dependencies.png"><br>
<img class="image" src="Images/ModelHierarchy.png"><br>
</div><p class="p"><strong class="ph b">Loops</strong></p><p class="p">Loops display all feedback loops which the selected variable belongs to.</p><div class="div image">
<img class="image" src="Images/Loops.png"><br>
-</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title30" id="custom-charts"><h2 class="title topictitle2" id="ariaid-title30">Custom Charts</h2><div class="body"><div class="div hr">
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title31" id="custom-charts"><h2 class="title topictitle2" id="ariaid-title31">Custom Charts</h2><div class="body"><div class="div hr">
</div><p class="p">Custom charts are user-defined displays of simulation result data. They can be used and re-used in various places. The four types of custom charts (line, sensitivity, bar, and pie charts) provide model developers means for examining and developing their models and communicating the simulation results to others.</p><p class="p">Custom charts are created to the Charts folder in model browser.</p><div class="div image">
<img class="image" src="Images/NewChart.png"><br>
-</div><p class="p">Charts are configured the same way as variables: first select the chart from model browser and then configure it in the property view. Charts can be viewed in the same active trend view as any variable by selecting the chart from model browser. In addition to trend view, charts can be populated directly to the model diagram by dragging them from the model browser. Charts can also be added to a separate chart panel which can contain multiple charts.</p></div><article class="topic nested2" aria-labelledby="ariaid-title31" id="line-chart"><h3 class="title topictitle3" id="ariaid-title31">Line Chart</h3><div class="body"><p class="p">Line chart shows the time series of a variable. It is capable of displaying multiple multi-dimensional variables at the same time. Simulation playback mode adds a marker to the chart to display the current time in playback simulation. Below is an example chart and its settings.</p><div class="div image">
+</div><p class="p">Charts are configured the same way as variables: first select the chart from model browser and then configure it in the property view. Charts can be viewed in the same active trend view as any variable by selecting the chart from model browser. In addition to trend view, charts can be populated directly to the model diagram by dragging them from the model browser. Charts can also be added to a separate chart panel which can contain multiple charts.</p></div><article class="topic nested2" aria-labelledby="ariaid-title32" id="line-chart"><h3 class="title topictitle3" id="ariaid-title32">Line Chart</h3><div class="body"><p class="p">Line chart shows the time series of a variable. It is capable of displaying multiple multi-dimensional variables at the same time. Simulation playback mode adds a marker to the chart to display the current time in playback simulation. Below is an example chart and its settings.</p><div class="div image">
<img class="image" src="Images/LineChart.png"><br>
</div><div class="div image">
<img class="image" src="Images/LineChartGeneral.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="line-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Name</td><td class="entry" headers="line-chart__entry__2 ">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Title</td><td class="entry" headers="line-chart__entry__2 ">The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Type</td><td class="entry" headers="line-chart__entry__2 ">Line chart (default) or area chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Hide</td><td class="entry" headers="line-chart__entry__2 ">Options to hide chart grid, title or legend</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 "><strong class="ph b">X-axis</strong></td><td class="entry" headers="line-chart__entry__2 ">-</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Variable</td><td class="entry" headers="line-chart__entry__2 ">A variable that is used as the x-axis variable. The default variable is time and it needs not to be typed in the field.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Label</td><td class="entry" headers="line-chart__entry__2 ">Optional other label for the variable than its name</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Min</td><td class="entry" headers="line-chart__entry__2 ">Minimum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Max</td><td class="entry" headers="line-chart__entry__2 ">Maximum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Hide</td><td class="entry" headers="line-chart__entry__2 ">Options to hide x-axis label, line, tick marks and tick labels</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="line-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__1">Name</td><td class="entry" headers="line-chart__entry__2">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Title</td><td class="entry" headers="line-chart__entry__2">The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Type</td><td class="entry" headers="line-chart__entry__2">Line chart (default) or area chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Hide</td><td class="entry" headers="line-chart__entry__2">Options to hide chart grid, title or legend</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1"><strong class="ph b">X-axis</strong></td><td class="entry" headers="line-chart__entry__2">-</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Variable</td><td class="entry" headers="line-chart__entry__2">A variable that is used as the x-axis variable. The default variable is time and it needs not to be typed in the field.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Label</td><td class="entry" headers="line-chart__entry__2">Optional other label for the variable than its name</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Min</td><td class="entry" headers="line-chart__entry__2">Minimum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Max</td><td class="entry" headers="line-chart__entry__2">Maximum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Hide</td><td class="entry" headers="line-chart__entry__2">Options to hide x-axis label, line, tick marks and tick labels</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/LineChartAxisAndVariables.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__23"><strong class="ph b">Variable</strong></th><th class="entry" id="line-chart__entry__24">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Variable</td><td class="entry" headers="line-chart__entry__24 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Range</td><td class="entry" headers="line-chart__entry__24 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Label</td><td class="entry" headers="line-chart__entry__24 ">Optional label for the variable. If label is empty, the variable name is displayed.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Color</td><td class="entry" headers="line-chart__entry__24 ">Color for the lines of this variable</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Line width</td><td class="entry" headers="line-chart__entry__24 ">The width of the lines drawn for this variable</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__35"><strong class="ph b">Y-axis</strong></th><th class="entry" id="line-chart__entry__36">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Label</td><td class="entry" headers="line-chart__entry__36 ">Label of the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Min</td><td class="entry" headers="line-chart__entry__36 ">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Max</td><td class="entry" headers="line-chart__entry__36 ">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Color</td><td class="entry" headers="line-chart__entry__36 ">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Hide</td><td class="entry" headers="line-chart__entry__36 ">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title32" id="sensitivity-chart"><h3 class="title topictitle3" id="ariaid-title32">Sensitivity Chart</h3><div class="body"><p class="p">Sensitivity chart shows the time series of a variable with confidence bounds. Below is an example chart and its settings. The general settings are defined similarly to those of a line chart explained above.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__23"><strong class="ph b">Variable</strong></th><th class="entry" id="line-chart__entry__24">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__23">Variable</td><td class="entry" headers="line-chart__entry__24">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Range</td><td class="entry" headers="line-chart__entry__24">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Label</td><td class="entry" headers="line-chart__entry__24">Optional label for the variable. If label is empty, the variable name is displayed.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Color</td><td class="entry" headers="line-chart__entry__24">Color for the lines of this variable</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Line width</td><td class="entry" headers="line-chart__entry__24">The width of the lines drawn for this variable</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__35"><strong class="ph b">Y-axis</strong></th><th class="entry" id="line-chart__entry__36">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__35">Label</td><td class="entry" headers="line-chart__entry__36">Label of the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Min</td><td class="entry" headers="line-chart__entry__36">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Max</td><td class="entry" headers="line-chart__entry__36">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Color</td><td class="entry" headers="line-chart__entry__36">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Hide</td><td class="entry" headers="line-chart__entry__36">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title33" id="sensitivity-chart"><h3 class="title topictitle3" id="ariaid-title33">Sensitivity Chart</h3><div class="body"><p class="p">Sensitivity chart shows the time series of a variable with confidence bounds. Below is an example chart and its settings. The general settings are defined similarly to those of a line chart explained above.</p><div class="div image">
<img class="image" src="Images/SensitivityChart.png"><br>
</div><div class="div image">
<img class="image" src="Images/SensitivityChartAxisAndVariables.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__1"><strong class="ph b">Axis and Variables</strong></th><th class="entry" id="sensitivity-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Variable</td><td class="entry" headers="sensitivity-chart__entry__2 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Range</td><td class="entry" headers="sensitivity-chart__entry__2 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Display median</td><td class="entry" headers="sensitivity-chart__entry__2 ">Display the median value of the variable at each time step.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Confidence bounds and colors</td><td class="entry" headers="sensitivity-chart__entry__2 ">The confidence bounds in percents and colors for them.</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__11"><strong class="ph b">Y-axis</strong></th><th class="entry" id="sensitivity-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Label</td><td class="entry" headers="sensitivity-chart__entry__12 ">Label of the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Min</td><td class="entry" headers="sensitivity-chart__entry__12 ">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Max</td><td class="entry" headers="sensitivity-chart__entry__12 ">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Color</td><td class="entry" headers="sensitivity-chart__entry__12 ">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Hide</td><td class="entry" headers="sensitivity-chart__entry__12 ">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title33" id="bar-chart"><h3 class="title topictitle3" id="ariaid-title33">Bar Chart</h3><div class="body"><p class="p">Bar charts display variables in a certain point in time. The point can be defined for the complete chart in chart's general settings and individually for each variable in variable's settings. If no time is defined, the last simulation step is shown in game or normal simulation mode. Playback mode displays the current playback time.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__1"><strong class="ph b">Axis and Variables</strong></th><th class="entry" id="sensitivity-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Variable</td><td class="entry" headers="sensitivity-chart__entry__2">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Range</td><td class="entry" headers="sensitivity-chart__entry__2">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Display median</td><td class="entry" headers="sensitivity-chart__entry__2">Display the median value of the variable at each time step.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Confidence bounds and colors</td><td class="entry" headers="sensitivity-chart__entry__2">The confidence bounds in percentages and colors for them.</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__11"><strong class="ph b">Y-axis</strong></th><th class="entry" id="sensitivity-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Label</td><td class="entry" headers="sensitivity-chart__entry__12">Label of the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Min</td><td class="entry" headers="sensitivity-chart__entry__12">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Max</td><td class="entry" headers="sensitivity-chart__entry__12">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Color</td><td class="entry" headers="sensitivity-chart__entry__12">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Hide</td><td class="entry" headers="sensitivity-chart__entry__12">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title34" id="bar-chart"><h3 class="title topictitle3" id="ariaid-title34">Bar Chart</h3><div class="body"><p class="p">Bar charts display variables in a certain point in time. The point can be defined for the complete chart in chart's general settings and individually for each variable in variable's settings. If no time is defined, the last simulation step is shown in game or normal simulation mode. Playback mode displays the current playback time.</p><div class="div image">
<img class="image" src="Images/BarChartGeneral.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="bar-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Name</td><td class="entry" headers="bar-chart__entry__2 ">The name of the chart. Name is displayed in model browser.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Title</td><td class="entry" headers="bar-chart__entry__2 ">The title of the chart. Title is displayed in the chart, if not hidden</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Type</td><td class="entry" headers="bar-chart__entry__2 ">Normal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Time</td><td class="entry" headers="bar-chart__entry__2 ">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Hide</td><td class="entry" headers="bar-chart__entry__2 ">Option for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed.</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="bar-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__1">Name</td><td class="entry" headers="bar-chart__entry__2">The name of the chart. Name is displayed in model browser.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Title</td><td class="entry" headers="bar-chart__entry__2">The title of the chart. Title is displayed in the chart, if not hidden</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Type</td><td class="entry" headers="bar-chart__entry__2">Normal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Time</td><td class="entry" headers="bar-chart__entry__2">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Hide</td><td class="entry" headers="bar-chart__entry__2">Option for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed.</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/BarChartInDiagram.png"><br>
</div><p class="p">Charts can be added to model diagrams simply by dragging the chart from model browser to diagram.</p><div class="div image">
<img class="image" src="Images/BarChartVariable.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__13"><strong class="ph b">Variable</strong></th><th class="entry" id="bar-chart__entry__14">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Add / Remove</td><td class="entry" headers="bar-chart__entry__14 ">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Variable</td><td class="entry" headers="bar-chart__entry__14 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Range</td><td class="entry" headers="bar-chart__entry__14 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Label</td><td class="entry" headers="bar-chart__entry__14 ">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Time</td><td class="entry" headers="bar-chart__entry__14 ">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__13"><strong class="ph b">Variable</strong></th><th class="entry" id="bar-chart__entry__14">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__13">Add / Remove</td><td class="entry" headers="bar-chart__entry__14">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Variable</td><td class="entry" headers="bar-chart__entry__14">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Range</td><td class="entry" headers="bar-chart__entry__14">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Label</td><td class="entry" headers="bar-chart__entry__14">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Time</td><td class="entry" headers="bar-chart__entry__14">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/BarChartAxis.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__25"><strong class="ph b">Domain axis</strong></th><th class="entry" id="bar-chart__entry__26">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Label</td><td class="entry" headers="bar-chart__entry__26 ">An optional label for x axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Label angle</td><td class="entry" headers="bar-chart__entry__26 ">Axis labels can be displayed in an angle. This value determines the angle in degrees.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Color</td><td class="entry" headers="bar-chart__entry__26 ">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Hide</td><td class="entry" headers="bar-chart__entry__26 ">Options for hiding axis label, line, tick marks and tick labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 "><strong class="ph b">Range axis</strong></td><td class="entry" headers="bar-chart__entry__26 ">-</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Label</td><td class="entry" headers="bar-chart__entry__26 ">An optional label for y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Min</td><td class="entry" headers="bar-chart__entry__26 ">Minimum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Max</td><td class="entry" headers="bar-chart__entry__26 ">Maximum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Color</td><td class="entry" headers="bar-chart__entry__26 ">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Hide</td><td class="entry" headers="bar-chart__entry__26 ">Options for hiding axis label, line, tick marks and tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title34" id="pie-chart"><h3 class="title topictitle3" id="ariaid-title34">Pie Chart</h3><div class="body"><p class="p">Pie charts display proportions of variables at a certain time. The time, similar to bar charts, can be configured for the whole chart and individually for each variable. If no time is configured, the value at the latest time step (or the time of simulation playback) is displayed.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__25"><strong class="ph b">Domain axis</strong></th><th class="entry" id="bar-chart__entry__26">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__25">Label</td><td class="entry" headers="bar-chart__entry__26">An optional label for x axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Label angle</td><td class="entry" headers="bar-chart__entry__26">Axis labels can be displayed in an angle. This value determines the angle in degrees.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Color</td><td class="entry" headers="bar-chart__entry__26">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Hide</td><td class="entry" headers="bar-chart__entry__26">Options for hiding axis label, line, tick marks and tick labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25"><strong class="ph b">Range axis</strong></td><td class="entry" headers="bar-chart__entry__26">-</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Label</td><td class="entry" headers="bar-chart__entry__26">An optional label for y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Min</td><td class="entry" headers="bar-chart__entry__26">Minimum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Max</td><td class="entry" headers="bar-chart__entry__26">Maximum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Color</td><td class="entry" headers="bar-chart__entry__26">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Hide</td><td class="entry" headers="bar-chart__entry__26">Options for hiding axis label, line, tick marks and tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title35" id="pie-chart"><h3 class="title topictitle3" id="ariaid-title35">Pie Chart</h3><div class="body"><p class="p">Pie charts display proportions of variables at a certain time. The time, similar to bar charts, can be configured for the whole chart and individually for each variable. If no time is configured, the value at the latest time step (or the time of simulation playback) is displayed.</p><div class="div image">
<img class="image" src="Images/PieChartGeneral.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="pie-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Name</td><td class="entry" headers="pie-chart__entry__2 ">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Title</td><td class="entry" headers="pie-chart__entry__2 ">Title The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Time</td><td class="entry" headers="pie-chart__entry__2 ">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Hide</td><td class="entry" headers="pie-chart__entry__2 ">Options for hiding title, section labels and legend</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="pie-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__1">Name</td><td class="entry" headers="pie-chart__entry__2">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1">Title</td><td class="entry" headers="pie-chart__entry__2">Title The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1">Time</td><td class="entry" headers="pie-chart__entry__2">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1">Hide</td><td class="entry" headers="pie-chart__entry__2">Options for hiding title, section labels and legend</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/PieChartVariable.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__11"><strong class="ph b">Variables</strong></th><th class="entry" id="pie-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Add / Remove</td><td class="entry" headers="pie-chart__entry__12 ">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Variable</td><td class="entry" headers="pie-chart__entry__12 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Range</td><td class="entry" headers="pie-chart__entry__12 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Label</td><td class="entry" headers="pie-chart__entry__12 ">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Color</td><td class="entry" headers="pie-chart__entry__12 ">Color for the sector of this variable</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Time</td><td class="entry" headers="pie-chart__entry__12 ">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Exploded</td><td class="entry" headers="pie-chart__entry__12 ">If set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__11"><strong class="ph b">Variables</strong></th><th class="entry" id="pie-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__11">Add / Remove</td><td class="entry" headers="pie-chart__entry__12">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Variable</td><td class="entry" headers="pie-chart__entry__12">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Range</td><td class="entry" headers="pie-chart__entry__12">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Label</td><td class="entry" headers="pie-chart__entry__12">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Color</td><td class="entry" headers="pie-chart__entry__12">Color for the sector of this variable</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Time</td><td class="entry" headers="pie-chart__entry__12">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Exploded</td><td class="entry" headers="pie-chart__entry__12">If set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/PieChartChartPanel.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title35" id="chart-panel"><h3 class="title topictitle3" id="ariaid-title35">Chart Panel</h3><div class="body"><p class="p">Chart panel is able to house multiple charts at the same time. Chart panel is a normal view in the workbench, which means it can be resized and located anywhere in the workbench. Eclipse also allows detaching the tab completely from the workbench, which means that the chart panel can be dragged to another screen.</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title36" id="chart-panel"><h3 class="title topictitle3" id="ariaid-title36">Chart Panel</h3><div class="body"><p class="p">Chart panel is able to house multiple charts at the same time. Chart panel is a normal view in the workbench, which means it can be resized and located anywhere in the workbench. Eclipse also allows detaching the tab completely from the workbench, which means that the chart panel can be dragged to another screen.</p><div class="div image">
<img class="image" src="Images/ChartPanel.png"><br>
</div><p class="p">Chart panel can be either horizontally or vertically oriented. Different orientations help in configuring the workbench perspective.</p><div class="div image">
<img class="image" src="Images/ChartPanelOrientation.png"><br>
-</div><p class="p">Charts are added to the panel by dragging from model browser. The order of the charts is easily changed by dragging charts from their header. Charts can be minimized or completely removed from the buttons in their headers.</p><p class="p">By default, chart panel is hidden in the upper-right corner of the system dynamics perspective.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title36" id="multidimensional-variables"><h2 class="title topictitle2" id="ariaid-title36">Multidimensional Variables</h2><div class="body"><div class="div hr">
-</div></div><article class="topic nested2" aria-labelledby="ariaid-title37" id="modeling"><h3 class="title topictitle3" id="ariaid-title37">Modeling</h3><div class="body"><p class="p">Models with multidimensional variables look just like any other models. The structure of the models is replicated givin multiple indexes to variables. For users with programming background, notation Variable<span class="xref"></span> may be familiar. In system dynamic modeling we need to give names to the indexes. Instead of using numbers to define the indexes, like in normal programming, we use enumerations. The steps to create a model with multidimensional variables are as follows (with examples):</p><p class="p">1 <strong class="ph b">Create the model structure</strong></p><p class="p">Model with multidimensional variables looks just like any other model.</p><div class="div image">
+</div><p class="p">Charts are added to the panel by dragging from model browser. The order of the charts is easily changed by dragging charts from their header. Charts can be minimized or completely removed from the buttons in their headers.</p><p class="p">By default, chart panel is hidden in the upper-right corner of the system dynamics perspective.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title37" id="multidimensional-variables"><h2 class="title topictitle2" id="ariaid-title37">Multidimensional Variables</h2><div class="body"><div class="div hr">
+</div></div><article class="topic nested2" aria-labelledby="ariaid-title38" id="modeling"><h3 class="title topictitle3" id="ariaid-title38">Modeling</h3><div class="body"><p class="p">Models with multidimensional variables look just like any other models. The structure of the models is replicated giving multiple indices to variables. For users with programming background, notation Variable<span class="xref"></span> may be familiar. In system dynamic modeling we need to give names to the indices. Instead of using numbers to define the indices, like in normal programming, we use enumerations. The steps to create a model with multidimensional variables are as follows (with examples):</p><p class="p">1 <strong class="ph b">Create the model structure</strong></p><p class="p">Model with multidimensional variables looks just like any other model.</p><div class="div image">
<img class="image" src="Images/ModelWithMultidimensionalVariables.png"><br>
-</div><p class="p">2 <strong class="ph b">Create Enumerations and define the indexes</strong></p><p class="p">Enumerations are created by right-clicking configuration and selecting New->Enumeration.</p><div class="div image">
+</div><p class="p">2 <strong class="ph b">Create Enumerations and define the indices</strong></p><p class="p">Enumerations are created by right-clicking configuration and selecting New→Enumeration.</p><div class="div image">
<img class="image" src="Images/NewEnumeration.png"><br>
-</div><p class="p">Define enumeration indexes by adding as many indexes as you want. Rename the indexes by selecting them and then clicking on them again.</p><div class="div image">
+</div><p class="p">Define enumeration indices by adding as many indices as you want. Rename the indices by selecting them and then clicking on them again.</p><div class="div image">
<img class="image" src="Images/DefineIndexes.png"><br>
-</div><p class="p">3 <strong class="ph b">Add Enumerations for variables</strong></p><p class="p">Select the variable that you want to be multidimensional. From the Indexes -tab in the property view, move the wanted enumerations to the right. The order of the enumerations does matter.</p><div class="div image">
+</div><p class="p">3 <strong class="ph b">Add Enumerations for variables</strong></p><p class="p">Select the variable that you want to be multidimensional. From the indices -tab in the property view, move the wanted enumerations to the right. The order of the enumerations <strong class="ph b">does</strong> matter.</p><div class="div image">
<img class="image" src="Images/SelectEnumerations.png"><br>
-</div><p class="p">4 <strong class="ph b">Define equations for all possible indexes</strong></p><p class="p">Multidimensional variable can be thought as a multidimensional table. Each cell of the table needs to have an expression or a value. A cell cannot have multiple definitions. All cells can be defined in one expression like in the following example. E1 and E2 have both three indexes, so the resulting definition can be {{1,2,3},{4,5,6},{7,8,9}}.</p><div class="div image">
+</div><p class="p">4 <strong class="ph b">Define equations for all possible indices</strong></p><p class="p">Multidimensional variable can be thought as a multidimensional table. Each cell of the table needs to have an expression or a value. A cell cannot have multiple definitions. All cells can be defined in one expression like in the following example. E1 and E2 have both three indices, so the resulting definition can be {{1,2,3},{4,5,6},{7,8,9}}.</p><div class="div image">
<img class="image" src="Images/DefineEquations.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title38" id="expressions"><h3 class="title topictitle3" id="ariaid-title38">Expressions</h3><div class="body"><p class="p">Values for all cells in the variable matrix can be defined in a single expression.</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title39" id="expressions"><h3 class="title topictitle3" id="ariaid-title39">Expressions</h3><div class="body"><p class="p">Values for all cells in the variable matrix can be defined in a single expression.</p><div class="div image">
<img class="image" src="Images/DefineEquations.png"><br>
</div><div class="div image">
<img class="image" src="Images/DefineEquations2.png"><br>
<img class="image" src="Images/CreateNewExpression.png"><br>
</div><p class="p">4 <strong class="ph b">Select the new expression</strong></p><div class="div image">
<img class="image" src="Images/SelectNewExpression.png"><br>
-</div><p class="p">Repeat until there is value for each cell. There must be exactly one value for each cell.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title39" id="array-slices"><h3 class="title topictitle3" id="ariaid-title39">Array Slices</h3><div class="body"><p class="p">Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable:</p><pre class="pre"> enumeration E1 = one, two, three
+</div><p class="p">Repeat until there is value for each cell. There must be exactly one value for each cell.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title40" id="array-slices"><h3 class="title topictitle3" id="ariaid-title40">Array Slices</h3><div class="body"><p class="p">Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable:</p><pre class="pre"> enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
</pre><p class="p">The whole variable can be accessed in three different ways:</p><ol class="ol"><li class="li"><p class="p"><code class="ph codeph">Auxiliary</code></p></li><li class="li"><p class="p"><code class="ph codeph">Auxiliary[E1, E2]</code></p></li><li class="li"><p class="p"><code class="ph codeph">Auxiliary[:, :]</code></p></li></ol><p class="p">The following explains different methods for accessing parts of the variable</p><pre class="pre"> // Single cell
</pre><pre class="pre"> // Slices
Auxiliary[one, E2] = {1,2,3}
Auxiliary[E1, zwei] = {{2},{5},{8}}
-
+
// In addition to single cells and the whole enumeration range, a subrange of the enumeration can be used
Auxiliary[two : three, E2] = {{4,5,6},{7,8,9}}
Auxiliary[one : two, zwei : drei] = {{2,3},{5,6}}
-</pre><p class="p">The syntax for accessing parts of variables can be used in both expression range definitions and in expressions.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title40" id="arithmetic-operators"><h3 class="title topictitle3" id="ariaid-title40">Arithmetic Operators</h3><div class="body"><p class="p">Arithmetic operations are defined in Modelica. Below are examples of different operations.</p><p class="p"><strong class="ph b">Addition and substraction</strong></p><p class="p">Addition and substraction are calculated elementwise</p><pre class="pre"> {1,2,3} - {0,2,3} = {1,0,0}
+</pre><p class="p">The syntax for accessing parts of variables can be used in both expression range definitions and in expressions.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title41" id="arithmetic-operators"><h3 class="title topictitle3" id="ariaid-title41">Arithmetic Operators</h3><div class="body"><p class="p">Arithmetic operations are defined in Modelica. Below are examples of different operations.</p><p class="p"><strong class="ph b">Addition and substraction</strong></p><p class="p">Addition and substraction are calculated elementwise</p><pre class="pre"> {1,2,3} - {0,2,3} = {1,0,0}
{{2,2},{4,4}} + {{8,8},{1,1}} = {{10,10},{5,5}}
{1,2,3} - {1,2} = ERROR! Different array sizes
</pre><p class="p"><strong class="ph b">Division</strong></p><p class="p">Division with a scalar</p><pre class="pre"> {5,10,15} / 5 = {1,2,3}
5 / {5,10,15} = ERROR! not allowed
</pre><p class="p">Division with an array</p><pre class="pre"> {1,2,3} / {1,2,3} = ERROR! not allowed
-
+
// Elementwise
{1,2,3} ./ {1,2,3} = {1,1,1}
</pre><p class="p"><strong class="ph b">Multiplication</strong></p><p class="p">Multiplication with a scalar</p><pre class="pre"> {1,2,3} * 2 = {2,4,6}
5 * {1,2,3} = {5,10,15}
</pre><p class="p">Matrix multiplication with an array</p><pre class="pre"> {{3,4},{5,6}} * {1,2} = {11,17}
{{3,4},{5,6}} * {1,2,3} = ERROR! incompatible array sizes
-
+
//Elementwise
{1,2} .* {1,2} = {1,4}
-
- Real[3,2] c = {{1,2},{3,4},{5,6}};
+
+ Real[3,2] c = {{1,2},{3,4},{5,6}};
Real[2,2] d = {{3,4},{5,6}};
Real[2,2] cd;
cd = c[2:3, :] .* d; // Result: {{9,16},{25,36}}
</pre><p class="p"><strong class="ph b">Power</strong></p><p class="p">Elementwise power of array variable</p><pre class="pre"> {1,2} .^ 2 = {1,4}
-</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title41" id="builtin-modelica-functions"><h3 class="title topictitle3" id="ariaid-title41">Builtin Modelica Functions</h3><div class="body"><p class="p">Modelica has some builtin functions that help using multidimensional variables. This chapter introduces some of the builtin functions.</p><p class="p"><strong class="ph b">Dimension and size functions</strong></p><p class="p">We will use the same example variable as previously.</p><pre class="pre"> enumeration E1 = one, two, three
+</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title42" id="built-in-modelica-functions"><h3 class="title topictitle3" id="ariaid-title42">Built-in Modelica Functions</h3><div class="body"><p class="p">Modelica has some built-in functions that help using multidimensional variables. You can find the functions under any model inside the folder Functions→Built-in Functions. This chapter introduces some of the built-in functions.</p><p class="p"><strong class="ph b">Dimension and size functions</strong></p><p class="p">We will use the same example variable as previously.</p><pre class="pre"> enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
-
+
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
</pre><p class="p"><strong class="ph b">ndims(A)</strong></p><p class="p">The number of dimensions in array A</p><pre class="pre"> ndims(Auxiliary) = 2
</pre><p class="p"><strong class="ph b">size(A, i)</strong></p><p class="p">The size of dimension i in array A</p><pre class="pre"> size(Auxiliary, 2) = 3
1 0 0
0 2 0
0 0 3
-</pre><p class="p"><strong class="ph b">linspace(x1,x2,n)</strong></p><p class="p">Constracts a Real vector from x1 to x2 with n equally spaced elements.</p><pre class="pre"> linspace(2,5,4) = {2,3,4,5}
+</pre><p class="p"><strong class="ph b">linspace(x1,x2,n)</strong></p><p class="p">Constructs a Real vector from x1 to x2 with n equally spaced elements.</p><pre class="pre"> linspace(2,5,4) = {2,3,4,5}
</pre><p class="p"><strong class="ph b">Reduction functions</strong></p><p class="p">Reduction functions reduce arrays to scalars.</p><p class="p"><strong class="ph b">min(A)</strong></p><p class="p">Returns the minimum value in array A.</p><pre class="pre"> Real A = {{1,2},{3,4}}
min(A) = 1
</pre><p class="p"><strong class="ph b">max(A)</strong></p><p class="p">Returns the maximum value in array A.</p><pre class="pre"> Real A = {{1,2},{3,4}}
</pre><p class="p"><strong class="ph b">Using functions with iterators</strong></p><p class="p">Functions min(A), max(A), sum(A) and product(A) reduce arrays to scalars. When you use multidimensional variables, you will most probably like to reduce less dimensions. This can be achieved using iterators with reduction functions. The result is constructed as an array, if curly brackets {} are used to enclose the expression.</p><pre class="pre"> enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
-
+
AuxiliarySum[E1] = {sum( Auxiliary[ i , E2 ] ) for i in E1} // Result: {6, 15, 24}
-
+
/* Same as:
{sum(Auxiliary[one, E2]), sum(Auxiliary[two, E2]), sum(Auxiliary[three, E2])}
{sum({1,2,3}), sum({4,5,6}), sum({7,8,9})}
</pre><p class="p">One expression can have multiple iterators. The Modelica specification defines the following format, but it is NOT yet supported in OpenModelica:</p><pre class="pre"> {sum(Array[ i, j, E3]) for i in E1, j in E2} // Dimensions reduced from 3 to 2
</pre><p class="p">To use multiple iterators, use the following format (NOTE the reversed order of iterators!):</p><pre class="pre"> {{sum(Array[ i, j, E3]) for j in E2} for i in E1} // Dimensions reduced from 3 to 2
</pre><p class="p">The range doesn't have to be the whole enumeration. Subranges can also be used.</p><pre class="pre"> {sum( Auxiliary[ i , eins : zwei ] ) for i in E1.one : E1.two} // Result: {3, 9}
-
+
/* Same as
{sum(Auxiliary[one, eins : zwei]), sum(Auxiliary[two, eins : zwei])}
{sum({1,2}), sum({4,5})}
*/
-</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title42" id="simulation-results"><h3 class="title topictitle3" id="ariaid-title42">Simulation Results</h3><div class="body"><p class="p">Multidimensional variables provide multiple results for the same variable. One result for each index. The trend view clutters very quickly when you add dimensions to the variables.</p><div class="div image">
+</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title43" id="simulation-results"><h3 class="title topictitle3" id="ariaid-title43">Simulation Results</h3><div class="body"><p class="p">Multidimensional variables provide multiple results for the same variable. One result for each index. The trend view clutters very quickly when you add dimensions to the variables.</p><div class="div image">
<img class="image" src="Images/3x3trend.png"><br>
-</div><p class="p">The clutter can be reduced by selecting which enumeration indexes are shown in charts. Select an enumeration and tick the indexes that you want to show. The same settings apply to each variable that uses the enumeration. This way you can follow an interesting index throughout the model.</p><div class="div image">
+</div><p class="p">The clutter can be reduced by selecting which enumeration indices are shown in charts. Select an enumeration and tick the indices that you want to show. The same settings apply to each variable that uses the enumeration. This way you can follow an interesting index throughout the model.</p><div class="div image">
<img class="image" src="Images/ShowInCharts.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title43" id="array-variables-in-modules"><h3 class="title topictitle3" id="ariaid-title43">Array Variables in Modules</h3><div class="body"><div class="div imageBorder">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title44" id="array-variables-in-modules"><h3 class="title topictitle3" id="ariaid-title44">Array Variables in Modules</h3><div class="body"><div class="div imageBorder">
<img class="image" src="Images/Replaceable.png"><br>
<p class="p imageText">Replaceable enumeration inside a module</p>
-</div><p class="p">You can also use array variables inside modules. Enumeration need to be defined separately for each module type and added to all necessary variables, also inputs and outputs (see <a class="xref" href="#modeling">Modeling</a>).</p><p class="p">When defining a module, modeler may not want to restrict the size of the array variable. In many cases the same module structure could be used for both large and small arrays. For example if the module is a project, a project may have three or even twenty phases. In this case the enumerations inside modules need to be set as replaceable.</p><p class="p">In this example, the original enumeration that the modeler used had two indexes. We are using an instance of this module, but we need to use array variables that have three indexes instead of two. We are using two variables and an instance of the module.</p><div class="div imageBorder">
+</div><p class="p">You can also use array variables inside modules. Enumeration need to be defined separately for each module type and added to all necessary variables, also inputs and outputs (see <a class="xref" href="#modeling">Modeling</a>).</p><p class="p">When defining a module, modeler may not want to restrict the size of the array variable. In many cases the same module structure could be used for both large and small arrays. For example if the module is a project, a project may have three or even twenty phases. In this case the enumerations inside modules need to be set as replaceable.</p><p class="p">In this example, the original enumeration that the modeler used had two indices. We are using an instance of this module, but we need to use array variables that have three indices instead of two. We are using two variables and an instance of the module.</p><div class="div imageBorder">
<img class="image" src="Images/ReplacingEnumerationConfiguration.png"><br>
<p class="p imageText">Module configuration for replacing enumerations inside the module</p>
-</div><p class="p">In the parent configuration, we have used an enumeration with three indexes in the two variables.</p><div class="div imageBorder">
+</div><p class="p">In the parent configuration, we have used an enumeration with three indices in the two variables.</p><div class="div imageBorder">
<img class="image" src="Images/Replacing.png"><br>
<p class="p imageText">Enumeration in the parent configuration that will replace the enumeration in the module</p>
-</div><p class="p">The replacement can be defined in the properties of the module instance. When the module instance is selected, a table with all the replaceable enumerations is shown. By clickin on the cell next to the enumeration, a drop-down box is shown with all the enumerations in the parent module. If an enumeration is selected, it will replace the enumeration inside the module during simulation. The replacement will not, however, show elsewhere in the model.</p><div class="div imageBorder">
+</div><p class="p">The replacement can be defined in the properties of the module instance. When the module instance is selected, a table with all the replaceable enumerations is shown. By clicking on the cell next to the enumeration, a drop-down box is shown with all the enumerations in the parent module. If an enumeration is selected, it will replace the enumeration inside the module during simulation. The replacement will not, however, show elsewhere in the model.</p><div class="div imageBorder">
<img class="image" src="Images/ReplacingEnumeration.png"><br>
<p class="p imageText">Enumeration in the parent configuration that will replace the enumeration in the module</p>
-</div><p class="p">When creating replaceable enumerations in modules, modelers need to be very careful. Direct references to single enumeration elements are not allowed, since the enumeration elements will change, if the enumeration is replaced for simulation!</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title44" id="functions"><h2 class="title topictitle2" id="ariaid-title44">Functions</h2><div class="body"><div class="div hr">
-</div><p class="p">Modelica provides a convenient way to use functions in your models. You can create your own functions, export and import complete function libraries and share function libraries to be used in all of your models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title45" id="creating-functions"><h3 class="title topictitle3" id="ariaid-title45">Creating Functions</h3><div class="body"><div class="div image">
+</div><p class="p">When creating replaceable enumerations in modules, modelers need to be very careful. Direct references to single enumeration elements are not allowed, since the enumeration elements will change, if the enumeration is replaced for simulation!</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title45" id="functions"><h2 class="title topictitle2" id="ariaid-title45">Functions</h2><div class="body"><div class="div hr">
+</div><p class="p">Modelica provides a convenient way to use functions in your models. You can create your own functions, export and import complete function libraries and share function libraries to be used in all of your models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title46" id="creating-functions"><h3 class="title topictitle3" id="ariaid-title46">Creating Functions</h3><div class="body"><div class="div image">
<img class="image" src="Images/NewFunction.png"><br>
-</div><p class="p">You can create new functions to the Functions -folder in your model or to function library folders. Right-click on the folder and select New->Function.</p><p class="p">Functions that can be found from Functions -folder can be used in your variable definitions.</p><p class="p">Functions are defined using Modelica language. The variables used in the function are defined in the declaration section. Function needs an output and an arbitrary number of inputs. Modelica specification enables use of multiple outputs, but this feature is not supported. The inputs are given in the same order as they are used in calling the function.</p><p class="p">Algorithm section defines the actual functionality of the function. In algorithm sections you must use assignments ":=" instead of just plain "=". All the assignments are calculated in the order they are written.</p><p class="p">Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and <a class="xref" href="https://www.modelica.org/documents/" target="_blank">Modelica specifications</a>.</p><div class="div image">
+</div><p class="p">You can create new functions to the Functions -folder in your model or to function library folders. Right-click on the folder and select New→Function.</p><p class="p">Functions that can be found from Functions -folder can be used in your variable definitions.</p><p class="p">Functions are defined using Modelica language. The variables used in the function are defined in the declaration section. Function needs an output and an arbitrary number of inputs. Modelica specification enables use of multiple outputs, but this feature is not supported. The inputs are given in the same order as they are used in calling the function.</p><p class="p">Algorithm section defines the actual functionality of the function. In algorithm sections you must use assignments ":=" instead of just plain "=". All the assignments are calculated in the order they are written.</p><p class="p">Also, take note that creating new lines in the Modelica code text box is done via shift+enter.</p><p class="p">Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and <a class="xref" href="https://www.modelica.org/documents/" target="_blank" rel="external noopener">Modelica specifications</a>.</p><div class="div image">
<img class="image" src="Images/ExampleFunction.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title46" id="function-libraries"><h3 class="title topictitle3" id="ariaid-title46">Function Libraries</h3><div class="body"><p class="p">Functions can be collected into libraries. This is a good way of organizing your functions. If function is located in a library, you need to append the library name to the function call (e.g. ExampleFunctionLibrary.ExampleFunction(arg1, arg2)). With libraries, you can also have functions with same names (e.g. library1.func(arg) and library2.func(arg)).</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title47" id="function-libraries"><h3 class="title topictitle3" id="ariaid-title47">Function Libraries</h3><div class="body"><p class="p">Functions can be collected into libraries. This is a good way of organizing your functions. If function is located in a library, you need to append the library name to the function call (e.g. ExampleFunctionLibrary.ExampleFunction(arg1, arg2)). With libraries, you can also have functions with same names (e.g. library1.func(arg) and library2.func(arg)).</p><div class="div image">
<img class="image" src="Images/NewFunctionLibrary.png"><br>
-</div><p class="p">There are three types of function libraries: normal function library, built-in function library and shared function library. Normal function libraries can be created to a model and are available only in that model. Built-in libraries are available in all models and calls to built-in functions should not include the library name. Shared functions are available to all models in your workspace, but you need to enable them to each model individually.</p><p class="p">Create a new function library by right-clicking on Functions folder, Shared functions folder or other module library.</p><p class="p">A function library can be exported by right clicking the function library and selecting Export -> Function library. A function library can be imported by right clicking the Functions folder and selecting Import -> Function library. Functions themselves cannot be exported or imported. To export a function, add it into a function library and export that function library.</p><p class="p">If you create a shared function library, the library can be added to other models or removed from current model by selecting the Shared Functions -folder and using the properties view.</p><div class="div image">
+</div><p class="p">There are three types of function libraries: normal function library, built-in function library and shared function library. Normal function libraries can be created to a model and are available only in that model. Built-in libraries are available in all models and calls to built-in functions should not include the library name. Shared functions are available to all models in your workspace, but you need to enable them to each model individually.</p><p class="p">Create a new function library by right-clicking on Functions folder, Shared functions folder or other module library.</p><p class="p">A function library can be exported by right clicking the function library and selecting Export → Function library. A function library can be imported by right clicking the Functions folder and selecting Import → Function library. Functions themselves cannot be exported or imported. To export a function, add it into a function library and export that function library.</p><p class="p">If you create a shared function library, the library can be added to other models or removed from current model by selecting the Shared Functions -folder and using the properties view.</p><div class="div image">
<img class="image" src="Images/SharedFunctions.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title47" id="external-functions"><h3 class="title topictitle3" id="ariaid-title47">External Functions</h3><div class="body"><p class="p">Modelica allows you to use external functions that are programmed using C language. To use this feature, you need to have the Sysdyn version with OpenModelica included and OpenModelica set as the solver in the Preferences (Window -> Preferences -> Solver). The installation package with OpenModelica has also MinGW C compiler included that allows to build object files from C source code.</p><p class="p">Below is a simple example of using a function that returns the sum of two arguments.</p><pre class="pre"> double exampleCFunction(double x, double y)
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title48" id="external-functions"><h3 class="title topictitle3" id="ariaid-title48">External Functions</h3><div class="body"><p class="p">Modelica allows you to use external functions that are programmed using C language. To use this feature, you need to have the Sysdyn version with OpenModelica included and OpenModelica set as the solver in the Preferences (Window → Preferences → Solver). The installation package with OpenModelica has also MinGW C compiler included that allows to build object files from C source code.</p><p class="p">Below is a simple example of using a function that returns the sum of two arguments.</p><pre class="pre"> double exampleCFunction(double x, double y)
{
double res;
res = x + y;
return res;
}");
end ExampleExternalFunction;
-</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title48" id="modelica-functions"><h3 class="title topictitle3" id="ariaid-title48">Modelica Functions</h3><div class="body"><p class="p">Modelica has built-in functions that can be used anywhere and are not visible in function libraries. This section covers a large number of those functions. For functions related to array variables, see see <a class="xref" href="#builtin-modelica-functions">builtin functions for arrays</a>.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="modelica-functions__entry__1"><strong class="ph b">Function</strong></th><th class="entry" id="modelica-functions__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">abs(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">acos(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Inverse cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">asin(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Inverse sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">atan(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">atan2(x1,x2)</td><td class="entry" headers="modelica-functions__entry__2 ">four quadrant inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cat(n,A,B,...)</td><td class="entry" headers="modelica-functions__entry__2 ">General concatenation function that concatenates arrays A,B,... along the nth dimension.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">ceil(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the smallest integer not less than x, the closest integer above x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cos(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cosh(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Hyperbolic cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cross(x,y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the 3-vector cross product of the 3-vectors x and y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">delay(expr, delayTime)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the value of expr at the time time-delayTime. The value of expr is returned when time <= time.start + delayTime.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">der(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Time derivative of x. X must be have continuous-time variability.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">div(x, y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the algebraic quotient x/y with any fractional part discarted. E.g. div(10,3) = 3.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">edge(b)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true when the value of the boolean expression b changes. Expanded into (b and not pre(b)).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">exp(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Exponential, base e.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">floor(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the largest integer not greater than x, the closest integer below x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">initial()</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true at the beginning of the simulation.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">integer(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the largest integer not greater than x as an integer.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">log(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Natural logarithm. (base e, x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">log10(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Base 10 logarithm. (x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">mod(x, y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the integer modulus of x/y: mod(x,y) = x - floor(x/y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">noEvent(expr)</td><td class="entry" headers="modelica-functions__entry__2 ">noEvent around an expression causes the expression to NOT generate event. <strong class="ph b">Important:</strong> If you want a condition to be checked only on time steps, use noEvent. (e.g. if noEvent(value >= 1) then ... else ...)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">pre(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the preceding value of y from time event that has occured before current time.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">rem(x, y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the integer remainder of x/y: rem(x,y) = x - div(x,y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sample(start, interval)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true and triggers time events at times start + i * interval (i=0,1,...).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sign(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns -1 if x is negative, 1 if x is positive. Expanded into "(if x > 0 then 1 else if x < 0 then -1 else 0)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sin(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sinh(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Hyperbolic sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sqrt(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">tan(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">tanh(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Hyperbolic tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">terminal()</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true at the end of a successful simulation.</td></tr></tbody></table></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title49" id="spreadsheets"><h2 class="title topictitle2" id="ariaid-title49">Spreadsheets</h2><div class="body"><div class="div hr">
-</div><p class="p">Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality.</p></div><article class="topic nested2" aria-labelledby="ariaid-title50" id="variable-values"><h3 class="title topictitle3" id="ariaid-title50">Variable Values</h3><div class="body"><p class="p">Spreadsheets are an easy way to import and manage parameter values. Sheet shells can be referenced to in models with the syntax SheetName(CellReference). Below is an example of getting a value for Auxiliary. The text "Auxiliary" is not necessary in the spreadsheet, but it helps maintaining the sheet.</p><div class="div image">
+</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title49" id="modelica-functions"><h3 class="title topictitle3" id="ariaid-title49">Modelica Functions</h3><div class="body"><p class="p">Modelica has built-in functions that can be used anywhere and are not visible in function libraries. This section covers a large number of those functions. For functions related to array variables, see see <a class="xref" href="#Built-in-modelica-functions">Built-in functions for arrays</a>.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="modelica-functions__entry__1"><strong class="ph b">Function</strong></th><th class="entry" id="modelica-functions__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="modelica-functions__entry__1">abs(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">acos(x)</td><td class="entry" headers="modelica-functions__entry__2">Inverse cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">asin(x)</td><td class="entry" headers="modelica-functions__entry__2">Inverse sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">atan(x)</td><td class="entry" headers="modelica-functions__entry__2">Inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">atan2(x1,x2)</td><td class="entry" headers="modelica-functions__entry__2">four quadrant inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cat(n,A,B,...)</td><td class="entry" headers="modelica-functions__entry__2">General concatenation function that concatenates arrays A,B,... along the nth dimension.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">ceil(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the smallest integer not less than x, the closest integer above x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cos(x)</td><td class="entry" headers="modelica-functions__entry__2">Cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cosh(x)</td><td class="entry" headers="modelica-functions__entry__2">Hyperbolic cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cross(x,y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the 3-vector cross product of the 3-vectors x and y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">delay(expr, delayTime)</td><td class="entry" headers="modelica-functions__entry__2">Returns the value of expr at the time time-delayTime. The value of expr is returned when time <= time.start + delayTime.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">der(x)</td><td class="entry" headers="modelica-functions__entry__2">Time derivative of x. X must be have continuous-time variability.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">div(x, y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the algebraic quotient x/y with any fractional part discarded. E.g. div(10,3) = 3.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">edge(b)</td><td class="entry" headers="modelica-functions__entry__2">Returns true when the value of the Boolean expression b changes. Expanded into (b and not pre(b)).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">exp(x)</td><td class="entry" headers="modelica-functions__entry__2">Exponential, base e.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">floor(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the largest integer not greater than x, the closest integer below x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">initial()</td><td class="entry" headers="modelica-functions__entry__2">Returns true at the beginning of the simulation.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">integer(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the largest integer not greater than x as an integer.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">log(x)</td><td class="entry" headers="modelica-functions__entry__2">Natural logarithm. (base e, x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">log10(x)</td><td class="entry" headers="modelica-functions__entry__2">Base 10 logarithm. (x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">mod(x, y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the integer modulus of x/y: mod(x,y) = x - floor(x/y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">noEvent(expr)</td><td class="entry" headers="modelica-functions__entry__2">noEvent around an expression causes the expression to NOT generate event. <strong class="ph b">Important:</strong> If you want a condition to be checked only on time steps, use noEvent. (e.g. if noEvent(value >= 1) then ... else ...)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">pre(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the preceding value of y from time event that has occurred before current time.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">rem(x, y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the integer remainder of x/y: rem(x,y) = x - div(x,y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sample(start, interval)</td><td class="entry" headers="modelica-functions__entry__2">Returns true and triggers time events at times start + i * interval (i=0,1,...).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sign(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns -1 if x is negative, 1 if x is positive. Expanded into "(if x > 0 then 1 else if x < 0 then -1 else 0)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sin(x)</td><td class="entry" headers="modelica-functions__entry__2">Sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sinh(x)</td><td class="entry" headers="modelica-functions__entry__2">Hyperbolic sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sqrt(x)</td><td class="entry" headers="modelica-functions__entry__2">Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">tan(x)</td><td class="entry" headers="modelica-functions__entry__2">Tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">tanh(x)</td><td class="entry" headers="modelica-functions__entry__2">Hyperbolic tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">terminal()</td><td class="entry" headers="modelica-functions__entry__2">Returns true at the end of a successful simulation.</td></tr></tbody></table></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title50" id="spreadsheets"><h2 class="title topictitle2" id="ariaid-title50">Spreadsheets</h2><div class="body"><div class="div hr">
+</div><p class="p">Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality.</p></div><article class="topic nested2" aria-labelledby="ariaid-title51" id="variable-values"><h3 class="title topictitle3" id="ariaid-title51">Variable Values</h3><div class="body"><p class="p">Spreadsheets are an easy way to import and manage parameter values. Sheet shells can be referenced to in models with the syntax SheetName(CellReference). Below is an example of getting a value for Auxiliary. The text "Auxiliary" is not necessary in the spreadsheet, but it helps maintaining the sheet.</p><div class="div image">
<img class="image" src="Images/AuxiliarySheetReference.png"><br>
<img class="image" src="Images/AuxiliarySheet.png"><br>
-</div><p class="p">You can also refer to sheets with array variables. Reference is simple with one and two dimensional array variables. Below is an example of a sheet with values for two different variables. The names of the indexes are not mandatory, but help reading and maintaining the sheet.</p><div class="div image">
+</div><p class="p">You can also refer to sheets with array variables. Reference is simple with one and two dimensional array variables. Below is an example of a sheet with values for two different variables. The names of the indices are not mandatory, but help reading and maintaining the sheet.</p><div class="div image">
<img class="image" src="Images/SheetForMultidim.png"><br>
</div><p class="p">Reference to a sheet range creates an array variable.</p><div class="div image">
<img class="image" src="Images/SheetMultidim1.png"><br>
-</div><p class="p">ArrayTest2 has two dimensions. Reference to a larger range creates a two-dimensional variable. By default, the indexes are ordered as in this example. However, if you wish to present the indexes in a different order in the spreadsheet, you can transpose the sheet reference (e.g. transpose(ArrayTestSheet(E2:G3)))</p><div class="div image">
+</div><p class="p">ArrayTest2 has two dimensions. Reference to a larger range creates a two-dimensional variable. By default, the indices are ordered as in this example. However, if you wish to present the indices in a different order in the spreadsheet, you can transpose the sheet reference (e.g. transpose(ArrayTestSheet(E2:G3)))</p><div class="div image">
<img class="image" src="Images/SheetMultidim2.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title51" id="history-data"><h3 class="title topictitle3" id="ariaid-title51">History Data</h3><div class="body"><p class="p">Spreadsheets can be used to store and display external history data e.g. from some statistics. The history data should be arranged as columns or rows and include a time variable. Reference variables need to be given the exactly same name as their counterparts in model.</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title52" id="history-data"><h3 class="title topictitle3" id="ariaid-title52">History Data</h3><div class="body"><p class="p">Spreadsheets can be used to store and display external history data e.g. from some statistics. The history data should be arranged as columns or rows and include a time variable. Reference variables need to be given the exactly same name as their counterparts in model.</p><div class="div image">
<img class="image" src="Images/Sheet.png"><br>
</div><p class="p">History data is used by creating a History dataset to an experiment. The dataset is activated and deactivated in charts by double-clicking the dataset. History data reference is set in the properties of the history dataset.</p><div class="div image">
<img class="image" src="Images/HistoryDataSettings.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="history-data__entry__1"><strong class="ph b">History data properties</strong></th><th class="entry" id="history-data__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="history-data__entry__1 ">Name</td><td class="entry" headers="history-data__entry__2 ">Name of the history dataset</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Sheet</td><td class="entry" headers="history-data__entry__2 ">Combo box for selecting a sheet where the history data is located</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Orientation</td><td class="entry" headers="history-data__entry__2 ">Columns or rows. How the data is arranged in the sheet.</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Range start</td><td class="entry" headers="history-data__entry__2 ">The upper-left corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Range end</td><td class="entry" headers="history-data__entry__2 ">The lower-right corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Time variable</td><td class="entry" headers="history-data__entry__2 ">The name of the time variable in the history data, if it is different than "time"</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Variables in range</td><td class="entry" headers="history-data__entry__2 ">This text field displays the found variables in the given sheet and range</td></tr></tbody></table><p class="p">If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="history-data__entry__1"><strong class="ph b">History data properties</strong></th><th class="entry" id="history-data__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="history-data__entry__1">Name</td><td class="entry" headers="history-data__entry__2">Name of the history dataset</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Sheet</td><td class="entry" headers="history-data__entry__2">Combo box for selecting a sheet where the history data is located</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Orientation</td><td class="entry" headers="history-data__entry__2">Columns or rows. How the data is arranged in the sheet.</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Range start</td><td class="entry" headers="history-data__entry__2">The upper-left corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Range end</td><td class="entry" headers="history-data__entry__2">The lower-right corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Time variable</td><td class="entry" headers="history-data__entry__2">The name of the time variable in the history data, if it is different than "time"</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Variables in range</td><td class="entry" headers="history-data__entry__2">This text field displays the found variables in the given sheet and range</td></tr></tbody></table><p class="p">If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart.</p><div class="div image">
<img class="image" src="Images/HistoryData.png"><br>
-</div></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title52" id="vensim-model-import"><h2 class="title topictitle2" id="ariaid-title52">Vensim Model Import</h2><div class="body"><div class="div hr">
-</div><p class="p">The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool <a class="xref" href="http://vensim.com/" target="_blank">Vensim</a>. This functionality is used similarly to the regular model import, so by right-clicking the browser and selecting "Import" -> "Vensim Model (.mdl)".</p><p class="p">The import process has several known limitations:</p><ul class="ul"><li class="li"><p class="p">The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported.</p></li><li class="li"><p class="p">Only variables and connections are imported.</p></li><li class="li"><p class="p">Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported.</p></li><li class="li"><p class="p">Variable value range data is not always imported correctly.</p></li><li class="li"><p class="p">Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent.</p></li><li class="li"><p class="p">Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant).</p></li><li class="li"><p class="p">Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine.</p></li><li class="li"><p class="p">Only a limited subset of Vensim functions is currently implemented in Simantics System Dynamics, so some equations might require additional work before they can be evaluated correctly.</p></li></ul></div></article><article class="topic nested1" aria-labelledby="ariaid-title53" id="sample-models-and-molecules"><h2 class="title topictitle2" id="ariaid-title53">Sample Models and Molecules</h2><div class="body"><div class="div hr">
-</div><p class="p">There are some sample models located in the sampleModels folder found in the installation folder. The sample models can be imported by right-clicking on the model browser and select Import->Model.</p><p class="p"><a class="xref" href="https://www.simantics.org/end_user_wiki/index.php/Introduction_to_Simantics" target="_blank">Simantics</a> | <em class="ph i">System Dynamics Modelling</em></p><div class="div hr">
+</div></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title53" id="vensim-model-import"><h2 class="title topictitle2" id="ariaid-title53">Vensim Model Import</h2><div class="body"><div class="div hr">
+</div><p class="p">The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool <a class="xref" href="http://vensim.com/" target="_blank" rel="external noopener">Vensim</a>. This functionality is used similarly to the regular model import, so by right-clicking the browser and selecting "Import" → "Vensim Model (.mdl)".</p><p class="p">The import process has several known limitations:</p><ul class="ul"><li class="li"><p class="p">The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported.</p></li><li class="li"><p class="p">Only variables and connections are imported.</p></li><li class="li"><p class="p">Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported.</p></li><li class="li"><p class="p">Variable value range data is not always imported correctly.</p></li><li class="li"><p class="p">Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent.</p></li><li class="li"><p class="p">Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant).</p></li><li class="li"><p class="p">Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine.</p></li><li class="li"><p class="p">Only a limited subset of Vensim functions is currently implemented in Simantics System Dynamics, so some equations might require additional work before they can be evaluated correctly.</p></li></ul></div></article><article class="topic nested1" aria-labelledby="ariaid-title54" id="sample-models-and-molecules"><h2 class="title topictitle2" id="ariaid-title54">Sample Models and Molecules</h2><div class="body"><div class="div hr">
+</div><p class="p">There are some sample models located in the sampleModels folder found in the installation folder. The sample models can be imported by right-clicking on the model browser and select Import→Model.</p><p class="p"><a class="xref" href="https://www.simantics.org/end_user_wiki/index.php/Introduction_to_Simantics" target="_blank" rel="external noopener">Simantics</a> | <em class="ph i">System Dynamics Modelling</em></p><div class="div hr">
</div><p class="p"><a class="xref" href="BasicTutorial.html"><strong class="ph b">Tutorial: Basic System Dynamics Modelling</strong></a></p><p class="p">System dynamics modelling in Simantics is a free modelling tool that is included into the basic installation. This tutorial introduces the basic features of the system dynamics modelling tool.</p><p class="p"><a class="xref" href="AdvancedTutorial.html"><strong class="ph b">Tutorial: Advanced System Dynamics Modelling</strong></a></p><p class="p">This tutorial introduces the more advanced features of the system dynamics modelling tool: Modules and Operating interfaces</p></div></article></div></article></article></main></body></html>
\ No newline at end of file
.warningtitle {
font-weight: bold;
}
+.hazardstatement td,
+.hazardstatement th {
+ padding: 0.5rem;
+}
+.hazardstatement th {
+ text-align: center;
+ text-transform: uppercase;
+}
+.hazardstatement--caution {
+ background-color: #ffd100;
+}
+.hazardstatement--danger {
+ background-color: #c8102e;
+ color: #fff;
+}
+.hazardstatement--warning {
+ background-color: #ff8200;
+}
+.hazardstatement--attention, .hazardstatement--fastpath, .hazardstatement--important, .hazardstatement--note, .hazardstatement--notice, .hazardstatement--other, .hazardstatement--remember, .hazardstatement--restriction, .hazardstatement--tip {
+ background-color: #0072ce;
+ color: #fff;
+ font-style: italic;
+}
/* Simple lists do not get a bullet */
ul.simple {
list-style-type: none;
font-family: monospace;
}
+/* flagging styles */
+
+.flag__style--italics {
+ font-style: italic;
+}
+.flag__style--bold {
+ font-weight: bold;
+}
+.flag__style--underline {
+ text-decoration: underline;
+}
+.flag__style--double-underline {
+ text-decoration: double-underline;
+}
+.flag__style--overline {
+ text-decoration: overline;
+}
+
/*!
* Custom CSS declarations, to be appended to the end of existing declarations
*/
.warningtitle {
font-weight: bold;
}
+.hazardstatement td,
+.hazardstatement th {
+ padding: 0.5rem;
+}
+.hazardstatement th {
+ text-align: center;
+ text-transform: uppercase;
+}
+.hazardstatement--caution {
+ background-color: #ffd100;
+}
+.hazardstatement--danger {
+ background-color: #c8102e;
+ color: #fff;
+}
+.hazardstatement--warning {
+ background-color: #ff8200;
+}
+.hazardstatement--attention, .hazardstatement--fastpath, .hazardstatement--important, .hazardstatement--note, .hazardstatement--notice, .hazardstatement--other, .hazardstatement--remember, .hazardstatement--restriction, .hazardstatement--tip {
+ background-color: #0072ce;
+ color: #fff;
+ font-style: italic;
+}
/* Simple lists do not get a bullet */
ul.simple {
list-style-type: none;
font-family: monospace;
}
+/* flagging styles */
+
+.flag__style--italics {
+ font-style: italic;
+}
+.flag__style--bold {
+ font-weight: bold;
+}
+.flag__style--underline {
+ text-decoration: underline;
+}
+.flag__style--double-underline {
+ text-decoration: double-underline;
+}
+.flag__style--overline {
+ text-decoration: overline;
+}
+
/*!
* Custom CSS declarations, to be appended to the end of existing declarations
*/
<!DOCTYPE html
SYSTEM "about:legacy-compat">
-<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="tutorial-advanced-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Advanced System Dynamics Modelling</title></head><body id="tutorial-advanced-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Advanced System Dynamics Modelling</h1><div class="body"><div class="div hr">
-</div><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#creating-model-and-modules">1 Creating model and modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#initial-configuration">2 Initial configuration</a></p></li><li class="li"><p class="p"><a class="xref" href="#workforce-module">3 Workforce module</a></p></li><li class="li"><p class="p"><a class="xref" href="#work-module">4 Work module</a></p></li><li class="li"><p class="p"><a class="xref" href="#connecting-modules">5 Connecting modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulating-the-model">6 Simulating the model</a></p></li></ul><p class="p">In this tutorial, we are going to bild a work model with two projects and shared workforce. Both the workforce and a separate project (work) are going to be created as modules, so they can be reused several times. Actually the model doesn't limit the number of projects at all. A <a class="xref" href="BasicTutorial.html">basic tutorial</a> is also available. This tutorial is part of the <a class="xref" href="sysdyn.html">sysdyn documentation</a>.</p></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="creating-model-and-modules"><h2 class="title topictitle2" id="ariaid-title2">Creating model and modules</h2><div class="body"><div class="div hr">
-</div><p class="p">Let's start by creating the work model and the needed modules. First create a new model by right-clicking on the model browser and selecting New->Model. Alternatively you can select File->New Model from the main menu.</p><p class="p">Then create two new modules to your model. Right-click on the Modules folder and select New->Module.</p><p class="p">Name your model WorkModel and modules WorkforceModule and WorkModule. You can rename them by right-clicking on the item on the model browser and selecting Rename.</p><div class="div imageBorder">
+<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="topic"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="tutorial-advanced-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Advanced System Dynamics Modelling</title></head><body id="tutorial-advanced-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Advanced System Dynamics Modelling</h1><div class="body"><div class="div hr">
+</div><p class="p">This tutorial goes more in-depth on the advanced features of the Simantics System Dynamic tool. Namely modules, custom Modelica functions, special variables and enumerations (i.e. vector variables). We are going to build a model that simulates how a shared workforce works on several overlapping projects. You can think of the resulting model as a framework on which to build models that, for example, simulate a project portfolio of a company. It is advised that you complete the <a class="xref" href="BasicTutorial.html">basic tutorial</a> before starting. If you find yourself stuck, seek help from the <a class="xref" href="sysdyn.html">documentation</a>.</p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#Creating-model-and-modules">1 Creating model and modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#Initial-configuration">2 Initial configuration</a></p></li><li class="li"><p class="p"><a class="xref" href="#Workforce-module">3 Workforce module</a></p></li><li class="li"><p class="p"><a class="xref" href="#Project-module">4 Project module</a></p></li><li class="li"><p class="p"><a class="xref" href="#Connecting-modules">5 Connecting modules</a></p></li><li class="li"><p class="p"><a class="xref" href="#Simulating-the-model">6 Simulating the model</a></p></li><li class="li"><p class="p"><a class="xref" href="#Adding-modules">7 Adding modules</a></p></li></ul></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="creating-model-and-modules"><h2 class="title topictitle2" id="ariaid-title2">Creating model and modules</h2><div class="body"><div class="div hr">
+</div><p class="p">Start by creating a new model from File→New→SD Model, rename the model to WorkModel. Then create two new modules by right-clicking on the Modules folder under the WorkModel tree and selecting New→Module. Rename the modules to Workforce and Project by selecting them in the Model Browser and using the properties view.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/NewModel.png"><br>
<p class="p imageText">Creating a new model</p>
</div><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ModelStructure2.png"><br>
<p class="p imageText">Model after renaming</p>
</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title3" id="initial-configuration"><h2 class="title topictitle2" id="ariaid-title3">Initial configuration</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+</div><p class="p">We will use a top-down approach in creating our model - focusing first on the bigger picture of the model and implementing the internal structure of the modules later.</p><p class="p">Open the model configuration by double-clicking Configuration in your model browser. Drag one Workforce and one Project from your Model Browser to the WorkModel diagram. The modules are automatically named with a suffix number.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/TwoModules.png"><br>
- <p class="p imageText">Workforce and Work modules</p>
-</div><p class="p">We will use a top-down approach in our model, so first we will make a simple model configuration with our modules. Open our model configuration by double-clicking Configuration in your model browser.</p><p class="p">Drag one WorkforceModule and one WorkModule from your model browser to the WorkModel diagram. The modules are automatically named with a suffix number. Rename the modules to Workforce and Work1. You can rename objects on the diagram by double-clicking them or selecting them with one click and renaming them on the properties view below the diagram.</p><div class="div imageBorder">
+ <p class="p imageText">Workforce and Project modules</p>
+</div><p class="p">You can think of modules as user made components that communicate with rest of the model by having some input(s) and output(s). In this model the internal implementation of Workforce module should handle resourcing people to projects according to their needs. The Project module should simulate how the people that are assigned to that specific project are advancing the project.</p><p class="p">While not used in this tutorial, Simantics System Dynamics supports nested modules, i.e. modules inside modules. Modules can also be exported and imported independent of the model.</p><p class="p">Let's consider what kind of information we need to pass between the modules. First of all, the Project needs to tell the Workforce module how much workforce it needs. Create an input variable and name it to RequestedWorkingSpeed to pass this information along. Connect Project1 module to RequestedWorkingSpeed and RequestedWorkingSpeed to Workforce1 with a dependency arrow.</p><p class="p">Input variable is a special type of symbol that acts as an interface between modules and the rest of the model. They are the only symbol type that can be connected directly to module outputs and they also act as the only way of creating inputs inside modules, as we will see later.</p><p class="p">We also need to assign people to work for the project - the Workforce module needs to tell the Project module how well we can respond to the request. Create a new input variable called ResponsedWorkingSpeed and connect it to the modules with dependency arrows.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ConfigurationStart.png"><br>
<p class="p imageText">Workforce and Work modules, first inputs and connections</p>
-</div><p class="p">When the modules are on the diagram, we should think what values we would like to get from the modules and what values we would like to use in the modules.</p><p class="p">Workforce needs to know, how much work is required and it should provide information on how much work can be done. To provide the information on how much work can be done, we need an Input variable. Variables can be dragged to the diagram from Symbols view or by using <a class="xref" href="sysdyn.html#shortcut-and-control-keys">shortcut keys</a> (Shift+I for Input variable). Drag an input variable to the diagram and name it TotalPossibleWorkingSpeed.</p><p class="p">Work module on the other hand provides information on how much work is required in it and it needs to know when the work has to be ready. Create an input variable RequiredWorkingSpeed1 and an Auxiliary variable Work1CompletionTime and place all variables like in the picture on the right.</p><p class="p">Connect the variables to modules using dependency connections (arrows). Connections are created by holding down Alt key and first clicking on the variable where to start the connection and then clicking on the variable where to end.</p><p class="p">Now we have the initial idea of the model, so let's configure the modules.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title4" id="workforce-module"><h2 class="title topictitle2" id="ariaid-title4">Workforce module</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+</div><p class="p">Now we have the first version of the top-level model structure completed, we can start configuring the modules.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title4" id="workforce-module"><h2 class="title topictitle2" id="ariaid-title4">Workforce module</h2><div class="body"><div class="div hr">
+</div><p class="p">Open the Workforce module by double-clicking it under the Modules folder.</p><p class="p">First, create an input variable and name it to RequestedNumberOfPeople, this variable receives the request provided by the Project module. Then, create 3 auxiliary variables and name them NumberOfEmployees, EmployeesAssigned and NumberOfFreeEmployees. Lastly connect the variables as shown in the picture. The unit of these variables is number of people.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/NetResourcing1.png"><br>
- <p class="p imageText">Cloud, Valve, Flow and Stock</p>
-</div><p class="p">Open Workforce module by selecting it from the diagram, right-clicking it and selecting Show Module.</p><p class="p">Create a Stock variable and name it WorkforceStock. Stock variables are created the same way as Input and Auxiliary variables. The level of the stock is controlled with a valve and a flow. To create the flow, hold down Alt and right-click on an empty space left of the stock. Then left-click on the stock. A cloud, valve and a flow is created. Rename the valve to NetResourcing.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/NetResourcing2.png"><br>
- <p class="p imageText">Cloud, Valve, Flow and Stock. Flow works both on directions.</p>
-</div><p class="p">NetResourcing works both ways. To display this also visually, delete the cloud by selecting it and pressing delete on your keyboard. Then create a flow starting from NetResourcing valve and ending on an empty space next to it.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/WorkforceAuxiliaries.png"><br>
- <p class="p imageText">Auxiliaries in Workforce module</p>
-</div><p class="p">Now you have used all the basic components and connections. From now on the instructions will be a more simplified.</p><p class="p">Next we will create four Auxiliary variables: TimeToAllocateResources, WorkforceRequired, Productivity and PossibleWorkingSpeed. Place and connect them according to the picture on the right.</p><p class="p">To be able to simulate the model, all variables must have valid equations. To configure an equation, select a variable. Variable's properties are shown in the Property view and you can input the required equations in the text fields. You can copy the equations directly from here or type them manually. Variables connected to the selected variable are shown in the Variables list. To speed up typing, you can double click on a variable name and it will be inserted to the equation.</p><pre class="pre">WorkforceStock
-Initial value: 0
-
-NetResourcing
-= (WorkforceRequired - WorkforceStock)/TimeToAllocateResources
-
-TimeToAllocateResources
-= 2
-
-Productivity
-= 1
-
-PossibleWorkingSpeed
-= WorkforceStock * Productivity
-Is Output
-</pre><p class="p">Variables can be set as output by selecting Is Output option from the Equation tab.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/RequiredWorkingSpeedInput.png"><br>
- <p class="p imageText">RequiredWorkingSpeedInput</p>
-</div><p class="p">On a previous phase, we wanted to give the value of RequiredWorkingSpeed1 to this workforce module. To get that value, we need to create an input. Create input RequiredWorkingSpeedInput, connect it to WorkforceRequired and write the following equation to WorkforceRequired.</p><pre class="pre">WorkForceRequired
-= RequiredWorkingSpeedInput/Productivity
-</pre><p class="p">Now this module is ready to be used as a part of the model.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title5" id="work-module"><h2 class="title topictitle2" id="ariaid-title5">Work module</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+ <p class="p imageText">Internal structure of the Workforce module</p>
+</div><p class="p">Now we need to give the symbols equations, these are written below. To configure an equation, select a variable and write (or copy-paste) the corresponding equation to the text field in the Properties view. Connected variables are shown in the Variables list on the right side of the properties view. You can double-click on a variable name to insert it to the equation.</p><pre class="pre">NumberOfEmployees
+= 10
+
+NumberOfFreeEmployees
+= NumberOfEmployees-EmployeesAssigned
+
+EmployeesAssigned
+= min(RequestedNumberOfPeople, NumberOfEmployees)
+</pre><p class="p">Also, we need to decide what value(s) we want the module to output. Make sure that the Is Output checkbox is ticked on the EmployeesAssigned variable, as this is the variable that tells how many people can be provided for the project.</p><p class="p">We are using a built-in function min() for calculating how many employees we are going to assign. You can find a list of these in the Model Browser under WorkModel→Functions→Built-in Functions.</p><p class="p">On the first iteration of this model, we are going to have 10 fulltime employees that get assigned to a single project according to the request. We are going to expand the structure of this module to handle several projects later on in the tutorial. This module is now ready to be used as a part of the first iteration of the model.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title5" id="work-module"><h2 class="title topictitle2" id="ariaid-title5">Work module</h2><div class="body"><div class="div hr">
+</div><p class="p">Open Project module by double-clicking it on the Model Browser.</p><p class="p">Create a flow of work with stocks and flows like in the picture. This loop says that there is some initial amount of work that is done at a certain speed, gradually becoming completed work. However, our workers are not perfect, as such errors can occur during work. These errors are first undiscovered, and as they are found they become work that needs to be completed.</p><p class="p">You will see red exclamation mark next to the symbols due to empty equation fields, these are omitted from the tutorial images for clarity reasons. We will return to fill in these fields later.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/WorkStocks.png"><br>
<p class="p imageText">Basic work with errors</p>
-</div><p class="p">Open Work1 module by selecting it from the WorkModel diagram, right-clicking it and selecting Show Module. Alternatively you can double click Work1 on the model browser.</p><p class="p">Create the basic flow of work with stocks and flows like in the picture on the right.</p><p class="p">The idea of the model is that first there is work. Work is done at a certain speed. When working, errors are also made. When errors are found, the amount of Errors is reduced, errors are removed from WorkDone and moved back to WorkToDo.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ProjectIsReady.png"><br>
- <p class="p imageText">Smoothener for work is done</p>
-</div><p class="p">Work needs to be stopped when the project is ready. Since the simulator might face some difficulties to determine the projects readyness when project is almost ready, we need to implement some smoothing to the limit. OpenModelica doesn't yet have a builtin function for smoothing, so we need to implement our own. Create variables and connections according to the picture on the right.</p><p class="p">Use the following equations for variables:</p><pre class="pre">ProjectIsReady
-Initial value: 0
-
-ProjectReadyness
-= (xidz(WorkDone, ProjectWorkAmount, 0.0) - ProjectIsReady) / 0.08
-</pre><p class="p">xidz is short for function X if devided by zero. This means that the simulation calculates ''WorkDone / ProjectWorkAmount''. If ProjectWorkAmount is zero, the result is the third argument ''0.0''.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ProjectWorkAmount.png"><br>
- <p class="p imageText">ProjectWorkAmount input variable</p>
-</div><p class="p">As you can see, ProjectWorkAmount is highlighted. Your model doesn't contain such variable and it is not connected to ProjectReadyness. Create an Input variable ProjectWorkAmount with default value 1000 and connect it to ProjectReadyness. The reason we are using input variable is that you can determine the default size of a project, but if you want to change it, you can change it from outside the module.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ErrorsVariables.png"><br>
- <p class="p imageText">Variables needed for error handling</p>
-</div><p class="p">Next we need to define how errors are found. For that we need new variables: WorkQuality and ErrorsFoundTime. Create the variables and connections according to the picture and give variables their equations.</p><pre class="pre">ErrorsGenerated
-= (1-WorkQuality) * WorkingSpeed
+</div><p class="p">Next let's create variables that control the parameters of a project and handle the request of asking people for work. Create auxiliary variables: StartTime, Deadline, ProjectDuration, TimeToStartTime, TimeToDeadline, RequestedWorkingSpeed, ProjectWorkAmount and NumberOfWorkdaysInProject. Connect the symbols as in the picture and write the following expression to their expression fields. Click the checkbox Is Output on RequestedWorkingSpeed variable to make the module output the value of this variable.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ProjectRequestPeople.png"><br>
+ <p class="p imageText">Structure of requesting people to work</p>
+</div><pre class="pre">StartTime
+= 5
-ErrorsFoundRate
-= Errors/ErrorsFoundTime
+Deadline
+= 20
-WorkQuality
-= 0.9
+ProjectDuration
+= Deadline-StartTime
-ErrorsFoundTime
-Type: WithLookup
-With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0)
-Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
-</pre><p class="p">WithLookup is a variable type where the value is interpolated from a 2-dimensional table (Lookup table) using the value determined in the "With Lookup" field. Type can be changed from the drop-down menu Type.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/WorkAllocation.png"><br>
- <p class="p imageText">WorkAllocation and RequiredWorkingSpeed</p>
-</div><p class="p">To calculate our own need for workforce we need to create and connect WorkCompletionTime input variable and the following auxliary variables:</p><pre class="pre">RequiredWorkingSpeed
-= if ProjectIsReady < 1 then xidz(WorkToDo, TimeToDeadline, MaximumWorkingSpeed) else 0
-Is Output
-
-MaximumWorkingSpeed
+TimeToStartTime
+= max(0, StartTime-time)
+
+TimeToDeadline
+= Deadline-time
+
+RequestedWorkingSpeed
+= if WorkToDo > 0 and TimeToStartTime == 0 then NumberOfWorkdaysInProject/ProjectDuration else 0
+
+ProjectWorkAmount
= 500
-TimeToDeadline
-= max(0, WorkCompletionTime-time)
-</pre><p class="p">time is a universal variable that gives the current simulation time.</p><p class="p">We need to decide how the workforce is allocated between all the work modules that are using the same workforce. For that we need to know how much work can be done and how much workforce other works require.</p><p class="p">Create two Inputs, RequiredWorkingSpeedTotalInput and PossibleWorkingSpeedInput, and an auxiliary variable WorkAllocation. Connect the variables like int the picture.</p><pre class="pre">WorkAllocation
-= xidz(RequiredWorkingSpeed, RequiredWorkingSpeedTotalInput, 0.0) * PossibleWorkingSpeedInput
-</pre><p class="p">Finally let's give initial values for all the remaining variables:</p><pre class="pre">WorkingSpeed
-= if ProjectIsReady < 1 then WorkAllocation else 0
+NumberOfWorkdaysInProject
+= ProjectWorkAmount/7
+</pre><p class="p">The project has parameters for starting time, deadline and budgeted hours of work. Based on these we calculate how many people the project needs, assuming that an average worker works for 7 hours per day. The number of people is handled as a floating point integer, meaning that one worker can work on multiple different projects.</p><p class="p">Now let's create an input variable to take in the information of how much workforce we got from our request. Create an input variable and name it ResponseWorkingSpeedInput. We are also going to calculate how many hours a day the workers need to work in order to get the project ready in time and limit the result between 7 and 9 hours a day. Create two auxiliary variables and name them RequiredWorkHoursPerDay and TotalWorkHoursPerDay, connect them to other variables as in the image.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ResponsedWorkingSpeedInput.png"><br>
+ <p class="p imageText">Input for responsed working speed</p>
+</div><p class="p">Write the following expression to the equation fields of the new auxiliary variables:</p><pre class="pre">RequiredWorkHoursPerDay
+= if ResponseWorkingSpeedInput == 0 then 0 else if TimeToDeadline < 0 then 9 else minmax(WorkToDo/ResponseWorkingSpeedInput/TimeToDeadline, 7, 9)
+
+TotalWorkHoursPerDay
+= RequiredWorkHoursPerDay*ResponseWorkingSpeedInput
+
+WorkingSpeed
+= TotalWorkHoursPerDay
+</pre><p class="p">Next we focus on completing the structure of the work loop. Create 2 auxiliary variables and name them WorkQuality and ErrorsFoundTime. Also, create two Shadow variables and select WorkQuality and ProjectWorkAmount as the referred variables. Shadow variable is a special type of variable, whose role is to pass along the referred variable value to a place where drawing a dependency arrow from the original symbol would make the graph difficult to read. Place the new symbols as in the image and make the dependency connections.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/WorkLoop.png"><br>
+ <p class="p imageText">Completed work loop structure</p>
+</div><p class="p">Now that the structure of the work loop is completed let's input equations to the variables.</p><pre class="pre">WorkToDo
+Integral: ErrorsFoundRate - WorkingSpeed
+Initial Value: ProjectWorkAmount
+
+WorkDone
+Integral: WorkingSpeed - ErrorsFoundRate
+Initial Value: 0
+
+ErrorsGenerated
+= (1-WorkQuality) * WorkingSpeed
-WorkToDo
-Initial value: ProjectWorkAmount
+UndiscoveredErrors
+Integral: ErrorsGenerated - ErrorsFoundRate
+Initial Value: 0
-WorkDone
-Initial value: 0
+ErrorsFoundRate
+= UndiscoveredErrors/ErrorsFoundTime
+</pre><p class="p">For ErrorsFoundTime we are going to use a special type of auxiliary variable called WithLookup. WithLookup is a variable type where the value is interpolated from a 2-dimensional (Lookup) table using the value determined in the "With Lookup" field. Input the following values.</p><pre class="pre">ErrorsFoundTime
+Type: WithLookup
+With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0)
+Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
+</pre><p class="p">This variable makes it so that the less we have completed work the larger the variable value is and vice versa. And as we use this value in ErrorsFoundRate variable to divide the number of undiscovered errors, a practical interpretation would be that when we start working on a project we don't discover errors easily. But, as the project gets more and more completed we start to discover more and more errors made earlier on in the project.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ErrorsFoundTimeWithLookUp.png"><br>
+ <p class="p imageText">Choosing WithLookup as the auxiliary type</p>
+</div><p class="p">Now we are going to create a small feedback structure around WorkQuality. The purpose is to simulate how working overtime for a prolonged period causes fatigue. Create a stock variable called Fatigue and two flows, WorkingOverTime and SlowRecovery. Also create a shadow variable of RequiredWorkingHoursPerDay. Connect the variables as shown in the image.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/WorkQualityStructure.png"><br>
+ <p class="p imageText">Structure around WorkQuality</p>
+</div><p class="p">Input the following equations to the variables:</p><pre class="pre">WorkingOverTime
+= if RequiredWorkHoursPerDay == 0 then 0 else (RequiredWorkHoursPerDay-7)*0.025
+
+SlowRecovery
+= if Fatigue >= 0 then 0.03 else 0
+
+Fatigue
+Integral: WorkingOverTime - SlowRecovery
+Initial Value: 0
-Errors
-Initial value: 0
-</pre></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="connecting-modules"><h2 class="title topictitle2" id="ariaid-title6">Connecting modules</h2><div class="body"><div class="div hr">
-</div><p class="p">Our modules are complete. Let's get back to the WorkModel Configuration.</p><pre class="pre">Set Work1CompletionTime to 10.
-</pre><div class="div imageBorder">
+WorkQuality
+= max(0.95*(1-Fatigue), 0.7)
+</pre><p class="p">Now working overtime causes fatigue to build up slowly, and fatigue in return causes work quality to decrease. This in return makes the workers more prone to do errors while working, causing more work to do, increasing the need for overtime work.</p><p class="p">There is only one thing left to do for this module, we are going to create variables that tell when the project was completed. An intuitive approach would be to claim that a project is complete when the value of WorkToDo goes to zero. However, due to the structure of the work loop we are likely to find some errors even after the WorkToDo goes to zero. We solve this by recording the time when WorkToDo is zero (or under) for the first time.</p><p class="p">Create a ghost variables of WorkToDo and Deadline. Then, create three auxiliary variables called ProjectIsCompleted, ProjectCompletitionTime and DaysLateOnDeadline. Connect the variables as in the image.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/DaysLateOnDeadlineStructure.png"><br>
+ <p class="p imageText">Structure of DaysLateOnDeadline</p>
+</div><p class="p">The variables use the following equations:</p><pre class="pre">ProjectIsCompleted
+= if time == 0 then 0 else if WorkToDo > 0 and ProjectIsCompleted == 0 then 0 else 1
+
+ProjectCompletitionTime
+= if ProjectIsCompleted == 0 then time else ProjectCompletitionTime
+
+DaysLateOnDeadline
+= ProjectCompletitionTime-Deadline
+</pre><p class="p">You can think of ProjectIsCompleted as a Boolean variable that goes to 1 and stays there when WorkToDo goes to 0 for the first time. ProjectCompletitionTime keeps track of time until the project is completed.</p><p class="p">Now the Project module is complete.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/CompletedProjectModule.png"><br>
+ <p class="p imageText">Completed Project module</p>
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="connecting-modules"><h2 class="title topictitle2" id="ariaid-title6">Connecting modules</h2><div class="body"><div class="div hr">
+</div><p class="p">Now that our modules are complete, let's get back to the WorkModel Configuration and connect the inputs and outputs of the modules. Select Project1 and then select Outputs tab from the properties view. Select the only available variable as the connection. Do the same in the Inputs tab. And repeat this process for Workforce1 also.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ModuleConnections1.png"><br>
<p class="p imageText">Module input connections</p>
-</div><p class="p">Connections between modules are made in the properties of the module. Select Work1 and open tab Inputs from the properties. The table lists all input variables in the module that are available. Clicking on the Refers to output column will open a drop-down menu that shows all available variables that are connected to the module. By selecting a variable, you connect that variable to the input.</p><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ModuleConnections2.png"><br>
- <p class="p imageText">Module input connections</p>
-</div><p class="p">Work1 need also information on how much working speed is required by all works. Since Work1 is the only work, create a dependency connection from RequiredWorkingSpeed1 to Work1 and in Work1's properties connect it to RequiredWorkingSpeedTotalInput.</p><p class="p">In Outputs tab, make the only possible connection: from RequiredWorkingSpeed to RequiredWorkingSpeed1.</p><p class="p">Workforce module has only one input and one output. Create the only possible connections:
-(Inputs) RequiredWorkingSpeedInput -> RequiredWorkingSpeed1
-(Outputs) PossibleWorkingSpeed -> TotalPossibleWorkingSpeed</p><p class="p">Now your model is ready for simulation!</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title7" id="simulating-the-model"><h2 class="title topictitle2" id="ariaid-title7">Simulating the model</h2><div class="body"><div class="div hr">
-</div><p class="p">To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 24.0</p><div class="div imageBorder">
+</div><p class="p">Now your model is ready for simulation!</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title7" id="simulating-the-model"><h2 class="title topictitle2" id="ariaid-title7">Simulating the model</h2><div class="body"><div class="div hr">
+</div><p class="p">To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 50.</p><div class="div imageBorder">
<img class="image" src="AdvancedTutorialImages/ActivateExperiment.png"><br>
<p class="p imageText">Experiment activation</p>
-</div><div class="p">To run simulations, you must activate an experiment. Expand the experiments folder on your model browser. There is one ready-made experiment. Double click on the experiment and the experiment control buttons appear on the toolbar. To simulate the model, press the play button: <div class="div image">
-<img class="image" src="AdvancedTutorialImages/ExperimentPlay.png"><br><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen.</p><div class="div image">
+</div><p class="p">To run simulations, you must activate an experiment. Expand the experiments folder on your model browser. There is one ready-made experiment. Double-click on the experiment and the experiment control buttons appear on the toolbar. To simulate the model, press the play button:</p><div class="div image">
+ <img class="image" src="AdvancedTutorialImages/ExperimentPlay.png"><br>
+</div><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen.</p><div class="div image">
<img class="image" src="AdvancedTutorialImages/SimulationProgress.png"><br>
-</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">If the Console view pops up and shows an error "Error: Too few equations, underdetermined system. The model has X equation(s) and Y variable(s)", the simulation has failed. The reason might be that you forgot to assign an equation to some variable or some connection in modules. See through all the variables, write the missing equation and simulate again.</p><p class="p">After the simulation is succesfully run, you can select a variable and see its simulation results in the trend view. For example WorkDone variable in Work1 module will give the following graph.</p><div class="div image">
+</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">If the Console view pops up and shows an error "Error: Too few equations, underdetermined system. The model has X equation(s) and Y variable(s)", the simulation has failed. The reason might be that you forgot to assign an equation to some variable or some connection in modules. See through all the variables, write the missing equation and simulate again.</p><p class="p">After the simulation has successfully completed, you can select a variable from model browser under Configuration to see its values over time in the trend view. You can also right-click on a module and select Show Module. This brings up a view of the internal structure of the module instance used in the simulation. Selecting a variable from there will show its values in the trend view.</p><div class="div image">
+ <img class="image" src="AdvancedTutorialImages/ShowModule.png"><br>
+</div><p class="p">For example, RequiredWorkingHoursPerDay variable in Project1 module should give the following graph. At first assigned workers are working 7 hours per day, but they start working more when the deadline starts closing in. After the project is completed, a few undiscovered errors are found and workers return to correct them.</p><div class="div image">
<img class="image" src="AdvancedTutorialImages/FirstSimulation.png"><br>
-</div></div></div><article class="topic nested2" aria-labelledby="ariaid-title8" id="adding-modules"><h3 class="title topictitle3" id="ariaid-title8">Adding modules</h3><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
- <img class="image" src="AdvancedTutorialImages/ModulesFinal.png"><br>
- <p class="p imageText">Final configuration with two modules</p>
-</div><p class="p">We created the WorkModule to be reusable. To use two WorkModules in the model, you must do the following.</p><p class="p">Populate a second WorkModule to WorkModel configuration and name it Work2.</p><p class="p">Create RequiredWorkingSpeed2 input variable and Work2CompletionTime auxiliary variable.</p><p class="p">We need a sum of all working speed requirements to give to the work modules. For this purpose, create an auxiliary variable RequiredWorkingSpeedTotal which sums the requirements.</p><p class="p">You can also have a different size work. To make Work2 smaller, create an auxiliary variable Work2Amount.</p><p class="p">Use the following equations:</p><pre class="pre">Work2CompletionTime
-= 13
-
-Work2Amount
-= 800
-
-RequiredWorkingSpeedTotal
-= RequiredWorkingSpeed1 + RequiredWorkingSpeed2
-</pre><p class="p">Update connections to match connections shown in the picture and connect the inputs and outputs to the modules.</p><pre class="pre">Workforce
-RequiredWorkingSpeedInput -> RequiredWorkingSpeedTotal
-
-Work1 Inputs
-RequiredWorkingSpeedTotalInput -> RequiredWorkingSpeedTotal
-
-Work2 Outputs
-RequiredWorkingSpeed -> RequiredWorkingSpeed2
-
-Work2 Inputs
-</pre><div class="div image">
- <img class="image" src="AdvancedTutorialImages/Module2Inputs.png"><br>
-</div><p class="p">When all the connections are made, you can simulate the model again. Now you have model with two work modules. Select variables from both modules in model browser to display them in trend view.</p><div class="div image">
- <img class="image" src="AdvancedTutorialImages/SecondSimulation.png"><br>
-</div></div></article></div></article></article></main></body></html>
\ No newline at end of file
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title8" id="adding-modules"><h2 class="title topictitle2" id="ariaid-title8">Adding modules</h2><div class="body"><div class="div hr">
+</div><p class="p">Now that we have a model with one Project module we are going to expand the model to support as many Projects as we want. First, we need to make some restructuring on the top level. Delete the dependency arrow that goes from ResponsedWorkingSpeed to Project1 module, also delete RequestedWorkingSpeed symbol entirely. Now create two new auxiliary variables and name them RequestedWorkingSpeed and WorkforceProject1. Connect the new auxiliaries as in the picture, remember make the connection inside the module properties as well.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddingModules1.png"><br>
+ <p class="p imageText">Updated model structure</p>
+</div><p class="p">Write the following equations inside the new variables:</p><pre class="pre">RequestedWorkingSpeed
+= Project1.RequestedWorkingSpeed
+
+WorkforceProject1
+= ResponsedWorkingSpeed
+</pre><p class="p">Notice that we can access variable values without having dependency arrows connected, we are given a warning next to the symbol as this should be done only when you know exactly what you are doing. Also, note that we can access values inside modules by using a dot notation modulename.variablename.</p><p class="p">Simulate the model once to make sure nothing broke.</p><p class="p">Next create a new Project module and a corresponding auxiliary variable WorkforceProject2, connect the auxiliary variable to the module and make the input connection in the module settings.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddingModules2.png"><br>
+ <p class="p imageText">Updated model structure</p>
+</div><p class="p">Now we need to make the Workforce1 module to work with several projects at the same time, for this we use enumerations. You can think of enumerations as indices of a vector variable. To create an enumeration right-click on Configuration and select New→Enumeration.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/NewEnumeration.png"><br>
+ <p class="p imageText">Creating a new enumeration</p>
+</div><p class="p">Select the newly created enumeration under Configuration and rename it to Projects. Then, select the enumeration and from properties view click twice on Add, rename index and index2 to Project1 and Project2 respectively.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddEnumerations.png"><br>
+ <p class="p imageText">Creating new indices for Projects enumeration</p>
+</div><p class="p">Now we have created the needed enumeration for the top level model. We need to create one for the Workforce module as well. Under the Modules folder in the model browser right-click on Workforce, select New→Enumeration, name it Projects and add a single dummy enumeration. Then make sure the checkbox Can be replaced by parent module is checked. Then select Workforce1 module and from Module Properties overwrite enumeration Projects with Projects. This way we only have to update enumerations in one place when adding new projects to the model.</p><p class="p">Now we need to select which variables use the enumerations, i.e. what scalar variables we need to turn into vector variables. In the top-level model select RequestedWorkingSpeed and ResponsedWorkingSpeed by holding down ctrl while left-clicking on the symbols, this should bring up a view that allows you to add enumerations to the selected symbols. From the left select Projects by left-clicking and click on the arrow, Projects enumeration should appear on the right side.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/AddEnumerationToSymbols.png"><br>
+ <p class="p imageText">Adding enumerations to symbols</p>
+</div><p class="p">We need to change the equations of RequestedWorkingSpeed, WorkforceProject1 and WorkforceProject2. RequestedWorkingSpeed needs information from both Project modules and WorkforceProject variables should be scalars. Input the following equations:</p><pre class="pre">RequestedWorkingSpeed
+= {Project1.RequestedWorkingSpeed, Project2.RequestedWorkingSpeed}
+
+WorkforceProject1
+= ResponsedWorkingSpeed[Project1]
+
+WorkforceProject2
+= ResponsedWorkingSpeed[Project2]
+</pre><p class="p">Next we need to update the structure of Workforce module so that it handles vector variables. Open the module by right-clicking on Workforce1 and selecting Show Module.</p><p class="p">Select variables EmployeesAssigned and RequestedNumberOfPeople and add the Projects enumeration to them as before.</p><p class="p">Now we are going to create a custom function that allocates people to projects. To create a custom function, in the Model Browser right-click on Functions folder and select new→Function. Now click on the newly created function and rename it to AssignWorkersToProjects.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/NewFunction.png"><br>
+ <p class="p imageText">Creating a new function</p>
+</div><p class="p">Write (or copy-paste) the following Modelica code to the empty text field. When working with custom Modelica functions note that you need to press shift+enter to create new lines.</p><pre class="pre">public input Real requestedhr[:];
+public input Real totalrequestedhr;
+public input Real availablehr;
+public output Real allocatedhr[size(requestedhr, 1)];
+algorithm
+requestaspercentage := zeros(size(requestedhr, 1));
+nofpeople := zeros(size(requestedhr, 1));
+for i in 1:size(requestedhr, 1) loop
+ requestaspercentage[i] := xidz(requestedhr[i], totalrequestedhr, 0);
+ nofpeople[i] := min(availablehr*requestaspercentage[i], requestedhr[i]);
+ allocatedhr[i] := nofpeople[i];
+end for;
+</pre><p class="p">To give you a quick rundown of the code logic, we have 3 input variables. First one tells how much workforce each projects wants, the second tells what the total number of requested people is and the third tells how many employees we have. The function outputs a vector that tells how many people it assigned to which project. In case there is more demand than available workforce, we calculate what percentage of the whole demand each project contributes and assign people accordingly.</p><p class="p">Now that our custom Modelica function is ready we are going to use it in the EmployeesAssigned variable. Select EmployeesAssigned and on the right of the properties view select Function tab, double-click on the custom function to make it appear in the equation field. Give the function following parameters: RequestedNumberOfPeople, sum(RequestedNumberOfPeople), NumberOfEmployees.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/CustomFunctionInPropertiesView.png"><br>
+ <p class="p imageText">Our custom function in variable properties view</p>
+</div><p class="p">Finally we need to change the calculation logic of NumberOfFreeEmployees. As EmployeesAssigned is now a vector variable just add sum() function around it in the equation field.</p><pre class="pre">NumberOfFreeEmployees
+= NumberOfEmployees-sum(EmployeesAssigned)
+</pre><p class="p">Now the Workforce module is completed!</p><p class="p">Finally, we are going to give the projects different parameters. Select Project2 and from the properties view select Parameters tab. By slowly double-clicking on a value you can change the starting time, deadline and work amount of a project.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/ProjectParameters.png"><br>
+ <p class="p imageText">Parameters of Project2</p>
+</div><p class="p">Set the following parameters.</p><pre class="pre">Deadline: 40
+ProjectWorkAmount : 900
+StartTime: 0
+</pre><p class="p">Now we have completed a model with two Project modules, simulate to make sure your model is working.</p><p class="p">By following the steps below you can add a new project module to the model. Our current implementation supports any number of projects.</p><pre class="pre">1. Add a new Project module to the diagram
+2. Add a new auxiliary variable and name it WorkforceProject3
+3. Connect the new auxiliary variable with the module using a dependency arrow and connect it to the module in the input tab
+4. Update the equation field of RequestedWorkingSpeed to {Project1.RequestedWorkingSpeed, Project2.RequestedWorkingSpeed, Project3.RequestedWorkingSpeed}
+5. Choose Project enumeration under configuration and add click add, name the new index to Project3
+6. Write ResponsedWorkingSpeed[Project3] as the equation for the new auxiliary variable
+7. Finally, customize the parameters of Project3 module in the Parameters tab
+</pre><p class="p">Create a third Project module using the instructions above with the following parameters.</p><pre class="pre">Deadline: 20
+ProjectWorkAmount : 300
+StartTime: 10
+</pre><p class="p">To make the results of the simulation more readable we can add auxiliary variables that collect information from each of the Project modules. For example, we might be interested the behaviour of WorkQuality, RequiredWorkingHoursPerDay and DaysLateOnDeadline. Create an auxiliary variable for each of these, add Project enumeration to them and input the following equations.</p><pre class="pre">DaysLateOnDeadline
+ = {Project1.DaysLateOnDeadline, Project2.DaysLateOnDeadline, Project3.DaysLateOnDeadline}
+
+ RequiredWorkHoursPerDay
+ = {Project1.RequiredWorkHoursPerDay, Project2.RequiredWorkHoursPerDay, Project3.RequiredWorkHoursPerDay}
+
+ WorkQuality
+ = {Project1.WorkQuality, Project2.WorkQuality, Project3.WorkQuality}
+</pre><p class="p">Remember to update these variables also if you intend to use more than 3 projects.</p><p class="p">If you now simulate the model the results of RequiredWorkHoursPerDay should look like this.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/RequiredWorkHoursPerDayResults.png"><br>
+ <p class="p imageText">RequiredWorkHoursPerDay results</p>
+</div><p class="p">And WorkQuality should look like this.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/WorkQualityResults.png"><br>
+ <p class="p imageText">WorkQuality results</p>
+</div><p class="p">Reading results from DaysLateOnDeadline variable is hard as the variable keeps track of time before the deadline. To see the results more clearly we are going to create a custom bar chart. Right-click on Charts folder under the WorkModel and select New→Bar Chart, rename the chart to Project deadlines and rename the Title to Days late on deadline. Then choose the tab Variables, click on Add, select Write variable name and write DaysLateOnDeadline to the field. Bar charts automatically use the last time step of the simulation when retrieving variable values. The chart should like this.</p><div class="div imageBorder">
+ <img class="image" src="AdvancedTutorialImages/DaysLateOnDeadlineResults.png"><br>
+ <p class="p imageText">DaysLateOnDeadline results</p>
+</div><p class="p">Now you have completed the advanced Simantics System Dynamics tutorial.</p><p class="p">There are some features that neither of the tutorials cover that can be found in the <a class="xref" href="sysdyn.html">documentation</a>.</p><p class="p">If you still want to practice using the tool, here are some ideas on how to further develop the model we just made.</p><pre class="pre">1. The number of employees is currently a static variable, think of ways to simulate the hiring procedure of a company using stocks and flows
+2. Add more projects and think of ways to optimize project scheduling
+3. Add wages to employees and an external workforce that is used in case internal workforce isn't enough, minimize total costs
+</pre><p class="p">Happy simulating!</p></div></article></article></main></body></html>
\ No newline at end of file
<!DOCTYPE html
SYSTEM "about:legacy-compat">
-<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="tutorial-basic-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Basic System Dynamics Modelling</title></head><body id="tutorial-basic-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Basic System Dynamics Modelling</h1><div class="body"><div class="div hr">
-</div><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#model">1 Model</a></p></li><li class="li"><p class="p"><a class="xref" href="#configuring-the-model-structure">2 Configuring the model structure</a></p></li><li class="li"><p class="p"><a class="xref" href="#equations">3 Equations</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulating-the-model">4 Simulating the model</a></p></li></ul><p class="p">This tutorial introduces you to the basic components and concepts of the System dynamics modelling tool for Simantics. After completing this tutorial, you know how to configure and simulate a system dynamics model. An <a class="xref" href="AdvancedTutorial.html">advanced tutorial</a> is also available. This tutorial is part of the <a class="xref" href="sysdyn.html">sysdyn documentation</a>.</p></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="model"><h2 class="title topictitle2" id="ariaid-title2">Model</h2><div class="body"><div class="div hr">
-</div><p class="p">We are going to create a simple population model. The model consists of the basic components: Auxiliaries, valves, stocks, dependencies and flows.</p><p class="p">Start by creating a new model. Right-click on the model browser and select New -> Model.</p><div class="div imageBorder">
+<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="topic"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="tutorial-basic-system-dynamics-modelling"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Tutorial: Basic System Dynamics Modelling</title></head><body id="tutorial-basic-system-dynamics-modelling"><main role="main"><article role="article" aria-labelledby="ariaid-title1"><h1 class="title topictitle1" id="ariaid-title1">Tutorial: Basic System Dynamics Modelling</h1><div class="body"><div class="div hr">
+</div><p class="p">This tutorial gives an introduction to the Simantics System Dynamic Tool. We will go over how to create, simulate and analyze a simple system dynamic model. After completing this tutorial, if you wish, there is an <a class="xref" href="AdvancedTutorial.html">advanced tutorial</a> that goes more in-depth on the advanced features of the tool. It is recommended that you give a quick glance at first few chapters of the <a class="xref" href="sysdyn.html">documentation</a> before starting. You should especially familiarize yourself with the <a class="xref" href="sysdyn.html#workbench">workbench</a> of the tool to know the terminology used in the tutorials.</p><p class="p">We are going to create the classic prey-predator model. In our case the model will describe how the population sizes of mice (prey) and owls (predator) change over time. The basic idea around the model is to capture the dynamics of two different population sizes. Let's assume a starting scenario where there is a large mice population and a small owl population. Owls start eating mice decreasing their population, and in turn, giving the owl population the opportunity to grow due to good food availability. However, as the mice population is decreasing and the owl population increasing, at some point there won't be enough food for the entire owl population, leading to starvation and consequently to a decrease in owl population size. The decreased owl population size then allows the mice population to regrow, as they have a smaller number of natural predators on the hunt.</p><p class="p">This tutorial is a walkthrough for creating and analyzing such a model.</p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#model">1 Creating a new model</a></p></li><li class="li"><p class="p"><a class="xref" href="#configuring-the-model-structure">2 Configuring the model structure</a></p></li><li class="li"><p class="p"><a class="xref" href="#equations">3 Equations</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulating-the-model">4 Simulating the model</a></p></li><li class="li"><p class="p"><a class="xref" href="#result-analysis">5 Result analysis</a></p></li></ul></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="creating-a-new-model"><h2 class="title topictitle2" id="ariaid-title2">Creating a new model</h2><div class="body"><div class="div hr">
+</div><p class="p">Start by creating a new model from File→New→SD Model.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/NewModel.png"><br>
<p class="p imageText">Creating a new model</p>
-</div><p class="p">Rename the model to Population. Right-click on Model1 and select Rename.</p><p class="p">Expand the model tree and double-click on Configuration. The model configuration diagram opens in a new editor.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title3" id="configuring-the-model-structure"><h2 class="title topictitle2" id="ariaid-title3">Configuring the model structure</h2><div class="body"><div class="div hr">
-</div><p class="p">Our model is now empty. Let's build a population model for mice.</p><p class="p">Open Symbols view and expand BasicSymbols. If BasicSymbols are not visible, make sure that you have the diagram open. The contents of the Symbols view depends on the active diagram editor.</p><div class="div imageBorder">
+</div><p class="p">Rename the model to Population by slowly clicking twice on the model name in the Model Browser or by clicking the model once and changing the name from the properties view at the bottom of the tool. Then, expand the model tree and open the model diagram by double-clicking the Population model from Model Browser.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title3" id="configuring-the-model-structure"><h2 class="title topictitle2" id="ariaid-title3">Configuring the model structure</h2><div class="body"><div class="div hr">
+</div><p class="p">Let's start by building a population model for the mice.</p><p class="p">Drag the Symbols view from right of the Model Browser to underneath it and expand BasicSymbols for easier use. If BasicSymbols is not visible, make sure that you have the diagram open as the contents of the Symbols view depends on the active diagram editor.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/SymbolsView.png"><br>
<p class="p imageText">Symbols view</p>
-</div><p class="p">These are the basic symbols in System dynamics modelling. We will use these to create the model.</p><p class="p">Drag one stock variable from Symbols view to the diagram. You can zoom and move on the diagram using <a class="xref" href="sysdyn.html#shortcut-and-control-keys">shortcut keys</a></p><p class="p">Select the variable. Properties view on the bottom of the screen shows the properties of the selected variable. Change the name to Mice and press enter.</p><div class="div imageBorder">
+</div><p class="p">These are the basic symbols in System dynamic modelling that will be used to create the model.</p><p class="p">Drag one stock variable from Symbols view to the diagram. You can zoom and move on the diagram using the middle mouse button.</p><p class="p">Select the variable to bring up Properties view on the bottom of the tool. Change the name to Mice and press enter. You should have a red exclamation mark next to the symbol telling that the variable needs to have expressions for Integral and Initial Value fields. These are not shown in the pictures of this tutorial for visual clarity. We will write expressions to these fields later. You can find a collection of warnings and errors related to the model from the Issues tab right of the Properties tab.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/Mice.png"><br>
- <p class="p imageText">Stock variable Mice</p>
-</div><p class="p">Next we will draw flows in and out of Mice. Drag one cloud variable from Symbols view to the left hand side of Mice. Hold down Alt and right-click on the cloud. Move cursor on top of Mice and left-click. The system creates a flow from the cloud to Mice and a valve in the middle of the flow. The valve controls the speed of the flow. Flow from Mice is created the same way. Drag one cloud variable from Symbols view to the right hand side of Mice. Hold down Alt and right-click on Mice. Move cursor on top of the cloud and left-click. Rename the valves to MouseBirths and MouseDeaths.</p><div class="div imageBorder">
+ <p class="p imageText">Stock variable Mice with the Properties view open, issues can be found on the third tab from the left</p>
+</div><p class="p">Next we will draw flows in and out of Mice. Drag one cloud variable from Symbols view to the left hand side of Mice. Hold down Alt and right-click on the cloud, then move your cursor on top of Mice and left-click. The system creates a flow from the cloud to Mice and a valve in between. The valve controls the speed of the flow, in this case the birthrate of Mice. We also need a flow going out from Mice to control the death rate. Let's create this using a shortcut. Right-click Mice while holding Alt down, then drag your mouse right of the Mice and press left-click while holding Alt down. Rename the valves to MouseBirths and MouseDeaths.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceFlows.png"><br>
<p class="p imageText">Flows in and out of Mice</p>
-</div><p class="p">Of course mice are not alone in the world. There are also owls that hunt mice. Create a similar structure below mice for owls.</p><div class="div imageBorder">
+</div><p class="p">Of course mice are not alone in our imaginary world. We also need owls that hunt mice. Create a similar structure for owls by copy-pasting and renaming. You can copy by drag selecting components and using the all familiar Ctrl+C and Ctrl+V.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceAndOwls.png"><br>
<p class="p imageText">Owls and mice</p>
-</div><p class="p">To control the births and deaths, we need auxiliary variables. Auxiliary variables can be dragged from Symbols view just like Stock variables. We need one variable for each valve to control it. Drag the variables and rename them according to the picture below.</p><div class="div imageBorder">
+</div><p class="p">To control births and deaths we use auxiliary variables. Auxiliary variables can be dragged from Symbols view just like Stock variables. We need one variable for each valve. Drag the variables and rename them according to the picture below.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/Auxiliaries.png"><br>
<p class="p imageText">Auxiliaries for valves</p>
-</div><p class="p">Arrow connections, dependencies, are created almost like flows. The difference is that the connection is started and ended with a left click and the connection can only be made between two existing variables. Connect the auxiliary variables and valves like in the picture below.</p><div class="div imageBorder">
+</div><p class="p">Next we need to draw dependency arrows to tell which components of the system have an interaction. Dependency arrows are created by Alt+left-clicking on a symbol and then clicking on another symbol. Connect components like in the picture below.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/Dependency_connections.png"><br>
<p class="p imageText">Dependency connections</p>
</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title4" id="equations"><h2 class="title topictitle2" id="ariaid-title4">Equations</h2><div class="body"><div class="div hr">
-</div><p class="p">As you can see from the model, we have made some shortcuts in our model to make it more simple. In reality, there are lots of other factors that affect mouse and owl populations. Let's however use this model as an example.</p><p class="p">For the model to be simulated, each variable needs to have an equation. Equations can be configured from the property view, like the names. Input the following equations into the corresponding variables:</p><pre class="pre">MouseBirths
+</div><p class="p">Now we need to give each variable an equation, stock variables also need a value for initial population. Like names, equations can be configured from the property view. Input the following equations into the corresponding variables:</p><pre class="pre">MouseBirths
= MouseBirthRate * Mice
MouseDeaths
OwlDeathRate
= 0.09
-</pre><p class="p">Finally we need initial values for our populations.</p><pre class="pre">Mice
+</pre><p class="p">Finally input initial population values for Mice and Owls.</p><pre class="pre">Mice
Initial Value: 700
Owls
Initial Value: 10
</pre></div></article><article class="topic nested1" aria-labelledby="ariaid-title5" id="simulating-the-model"><h2 class="title topictitle2" id="ariaid-title5">Simulating the model</h2><div class="body"><div class="div hr">
-</div><div class="div imageBorder">
+</div><p class="p">Now the model is configured and ready for simulation. An experiment needs to be activated before a model can be simulated. Expand the Experiments folder of your model and double-click on Experiment to activate it. This adds experiment control buttons to the toolbar.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/ActivatePopulationExperiment.png"><br>
<p class="p imageText">Experiment activation</p>
-</div><div class="p">Now the model is configured and ready for simulation. Switch Symbols view back to Model Browser. Expand the Experiments folder on your model and double-click on Experiment. This activates the experiment. Experiment needs to be active before the model can be simulated. Experiment activations adds experiment control buttons to the toolbar. To simulate the model, press the play button: <div class="div image">
-<img class="image" src="BasicTutorialImages/ExperimentPlay.png"><br><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen.</p><div class="div image">
+</div><p class="p">To simulate the model, press the play button:</p><div class="div image">
+ <img class="image" src="BasicTutorialImages/ExperimentPlay.png"><br>
+</div><p class="p">System shows the simulation progress in the progress bar on the lower right corner of the screen. As our model is very simple the progress bar will most likely go by faster that you can see it.</p><div class="div image">
<img class="image" src="BasicTutorialImages/SimulationProgress.png"><br>
-</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">After the simulation has run, you can select variables from the diagram or model browser and their values over the simulation time will be shown on Trend View. You can select multiple variables from the diagram by holding down Ctrl key. Select Mice and Owls.</p><div class="div imageBorder">
+</div><p class="p">When the progress indicator disappears, the simulation is complete.</p><p class="p">After the simulation has been completed, you can select variables from the diagram or Model Browser and their values over the simulation time will be shown on Trend view. You can select multiple variables from the diagram by holding down Ctrl key or by drag selecting. Select Mice and Owls.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceAndOwlResults1.png"><br>
<p class="p imageText">Results for Mice and Owls</p>
-</div><p class="p">As you can see, the simulation is complete, but the results do not reveal any interesting behavior. Let's extend the simulation time.</p><p class="p">Select Configuration from the model browser. In the properties-view change stop time to 300.0 and simulate again.</p><p class="p">After the simualtion is complete, Select Mice and Owls again.</p><div class="div imageBorder">
+</div><p class="p">As you can see, the simulation is complete, but the results do not reveal anything interesting. We need to extend the simulation time.</p><p class="p">Select Configuration from the Model Browser. In the properties view change stop time to 300.0 and simulate again.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/Configuration1.png"><br>
+ <p class="p imageText">Model configuration</p>
+</div><p class="p">After the simulation is complete, Select Mice and Owls again.</p><div class="div imageBorder">
<img class="image" src="BasicTutorialImages/MiceAndOwlResults2.png"><br>
- <p class="p imageText">Results for Mice and Owls, Extended simulation time</p>
-</div><p class="p">Now the simulation reveals the traditional behavior of predator-prey models. Feel free to adjust the parameters and try the simulations again.</p></div></div></div></article></article></main></body></html>
\ No newline at end of file
+ <p class="p imageText">Results for Mice and Owls, extended simulation time</p>
+</div><p class="p">Now we can see the wanted behavior. As the mice population reaches a certain point the number of owls start to increase as they have more food. The increase in owl population lowers the mice population, leading to starvation between owls. The lowered owl population in turn allows the mice population grow back, and the cycle continues. In fact this model simulates the behavior of a pair of first-order nonlinear differential equations also known as Lotka-Volterra equations.</p><p class="p">However, we can see that there is something wrong with the results; the peaks of the mice population are not on the same level. We are using a step-size that is too long. On default the step size is calculated by dividing the simulation time to 500 equal steps, meaning that the previous results were obtained using a step size of (300-0)/500=0.6. (For a more bizarre behavior try simulating with a stop time of 950 using the default step size.)</p><p class="p">To combat this we can set the step size manually from the model configuration, the same place where we changed the simulation stop time. Change the step size to 0.01 and output interval to 1. Output interval allows us to manually configure the step size of the results, meaning that we can make the numerical errors arbitrarily small by lowering the simulation step size, while only having to handle a part of the steps used for the simulation. With these new parameters we now get the correct results.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/MiceAndOwlResults3.png"><br>
+ <p class="p imageText">Results for Mice and Owls with a simulation step size of 0.01</p>
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="result-analysis"><h2 class="title topictitle2" id="ariaid-title6">Result analysis</h2><div class="body"><div class="div hr">
+</div><p class="p">In this chapter we are going to go over how to analyze the resulting model structure, use comment symbols, create and export graphs in form of charts and export the simulated dataset. Let's start with the model structure analysis.</p><p class="p">Often in system dynamics we are interested in how different feedback loops are formed inside of a model. There is a built in tool analyzing these. Open Structure view that is located between Trend and Values views, then select Loops tab. The contents update depending on the active selection, select OwlBirths symbol.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/OwlBirthsLoopStructure.png"><br>
+ <p class="p imageText">The loop structure of OwlBirths</p>
+</div><p class="p">We can see a feedback loop of 3 variables. You could interpret this loop as follows: owl births increase the number of owls, the more owls there are the more mice are going to get eaten, the more mice that end up as food the more owls can breed.</p><p class="p">To make a visual representation of this feedback loop on the diagram we can utilize a comment symbol called Loop. Expand the CommentSymbols from Symbols and drag the symbol between Mice and Owls symbols. Then, from the properties view select Owls→MouseDeaths→OwlBirths from Loop Items and change the Direction of Rotation to counterclockwise. The Comment option is used for telling if the loop is reinforcing (R) or balancing (B). The symbol automatically detects this behavior, but you can also choose this manually or write your own explanation, if you wish. When you make the Loop symbol as your active selection it automatically highlights the symbols that are included in the loop to visualize how it is formed.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/LoopCommentSymbol.png"><br>
+ <p class="p imageText">Loop comment symbol</p>
+</div><p class="p">The other comment symbol, called Comment, is purely for writing text in the diagram. It is useful, for example, when you want to have memos inside the diagram, or when you want to write an explanation for a design choice.</p><p class="p">Let's move on to graphs. There are two ways of creating them, Trend view (that we have used before) and Charts. Trend view allows you to export the graph as .svg and .png file formats from the top-right controls. However, the built in graph tool has much more options for customizing a graph. Let's create a phase-space plot of the model.</p><p class="p">Start by creating a new chart by right-clicking on the folder Charts under your model, then select New→Line Chart.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/newChart.png"><br>
+ <p class="p imageText">Creating a new chart</p>
+</div><p class="p">Double click the newly made chart to open it and keep the chart selected to access its properties. Name the chart Phase-space plot, tick hide title and hide legend options, type Owls as the x-axis variable and change the label name to Alive owls.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/ChartProperties1.png"><br>
+ <p class="p imageText">Chart general properties</p>
+</div><p class="p">Then, select the Axis and Variables tab on the bottom, click on y-axis and rename label to Alive mice, then click Add variable. Select the <Write variable name> and write Mice as the variable name.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/ChartAxisAndVariables.png"><br>
+ <p class="p imageText">Chart Axis and Variables properties</p>
+</div><p class="p">Now you should have a completed phase-space plot of the prey-predator model. To export a graph right click on it and select either Save as→PNG or Print... and select the pdf printer of your choice. Notice that in order to see results on the graph you need to have an active experiment that has finished a simulation.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/PhaseSpacePlotAndExport.png"><br>
+ <p class="p imageText">Completed phase-space plot and export options</p>
+</div><p class="p">You might also want to export the simulated data. Currently the easiest way is to copy it to your clipboard. First, select all components by clicking on the diagram and pressing Ctrl+A on the keyboard. Then, select Values view from the bottom left, click on any numerical value to put the field in focus, finally Ctrl+A and Ctrl+C. Now you have all of the numerical data on your clipboard for pasting to the tool of your choosing.</p><div class="div imageBorder">
+ <img class="image" src="BasicTutorialImages/ValuesView.png"><br>
+ <p class="p imageText">Values view</p>
+</div><p class="p">This concludes the basic tutorial. If you wish to learn more about the advanced features of the tool, please refer to the <a class="xref" href="sysdyn.html">wiki</a> or the <a class="xref" href="AdvancedTutorial.html">advanced tutorial</a>.</p><p class="p">Happy simulating!</p></div></article></article></main></body></html>
\ No newline at end of file
<!DOCTYPE html
SYSTEM "about:legacy-compat">
-<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="DC.Format" content="HTML5"><meta name="DC.Identifier" content="simantics-system-dynamics"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Simantics System Dynamics</title></head><body><main role="main"><article role="article" aria-labelledby="ariaid-title1"><article class="nested0" aria-labelledby="ariaid-title1" id="simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title1">Simantics System Dynamics</h1><div class="body"></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="contents"><h2 class="title topictitle2" id="ariaid-title2">Contents</h2><div class="body"><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#what-is-simantics-system-dynamics">1 What is Simantics System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#introduction-to-system-dynamics-simulation">2 Introduction to System Dynamics Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#system-dynamics">2.1 System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#model">2.2 Model</a></p></li><li class="li"><p class="p"><a class="xref" href="#components">2.3 Components</a></p></li><li class="li"><p class="p"><a class="xref" href="#modeling-principles">2.4 Modeling Principles</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#installation-instructions">3 Installation Instructions</a></p></li><li class="li"><p class="p"><a class="xref" href="#workbench">4 Workbench</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#global-preferences">4.1 Global Preferences</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#modelling">5 Modelling</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#basic-modelling">5.1 Basic Modelling</a></p></li><li class="li"><p class="p"><a class="xref" href="#model-properties">5.2 Model Properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#special-variables">5.3 Special Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#withlookup">5.3.1 WithLookup</a></p></li><li class="li"><p class="p"><a class="xref" href="#delay">5.3.2 Delay</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#shortcut-and-control-keys">5.4 Shortcut and Control Keys</a></p></li><li class="li"><p class="p"><a class="xref" href="#unit-validation">5.5 Unit Validation</a></p></li><li class="li"><p class="p"><a class="xref" href="#diagram-profiles">5.6 Diagram Profiles</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#visual-model-elements">6 Visual model elements</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#fonts-and-colors">6.1 Fonts and colors</a></p></li><li class="li"><p class="p"><a class="xref" href="#dependency-properties">6.2 Dependency properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#loops">6.3 Loops</a></p></li><li class="li"><p class="p"><a class="xref" href="#comments">6.4 Comments</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation">7 Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#experiments">7.1 Experiments</a></p></li><li class="li"><p class="p"><a class="xref" href="#solvers">7.2 Solvers</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">8 Simulation Result and Model Structure Analysis</a></p></li><li class="li"><p class="p"><a class="xref" href="#custom-charts">9 Custom Charts</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#line-chart">9.1 Line Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#sensitivity-chart">9.2 Sensitivity Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#bar-chart">9.3 Bar Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#pie-chart">9.4 Pie Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#chart-panel">9.5 Chart Panel</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#multidimensional-variables">10 Multidimensional Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#modeling">10.1 Modeling</a></p></li><li class="li"><p class="p"><a class="xref" href="#expressions">10.2 Expressions</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-slices">10.3 Array Slices</a></p></li><li class="li"><p class="p"><a class="xref" href="#arithmetic-operators">10.4 Arithmetic Operators</a></p></li><li class="li"><p class="p"><a class="xref" href="#builtin-modelica-functions">10.5 Builtin Modelica Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulation-results">10.6 Simulation Results</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-variables-in-modules">10.7 Array Variables in Modules</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#functions">11 Functions</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#creating-functions">11.1 Creating Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#function-libraries">11.2 Function Libraries</a></p></li><li class="li"><p class="p"><a class="xref" href="#external-functions">11.3 External Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#modelica-functions">11.4 Modelica Functions</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#spreadsheets">12 Spreadsheets</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#variable-values">12.1 Variable Values</a></p></li><li class="li"><p class="p"><a class="xref" href="#history-data">12.2 History Data</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#vensim-model-import">13 Vensim Model Import</a></p></li><li class="li"><p class="p"><a class="xref" href="#sample-models-and-molecules">14 Sample Models and Molecules</a></p></li></ul></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title3" id="what-is-simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title3">What is Simantics System Dynamics</h1><div class="body"><div class="div hr">
-</div><p class="p"><em class="ph i">Simantics System Dynamics</em> is currently the only open source modelling and simulating tool for Simantics. Simantics System Dynamics is under development and will go through some changes in the future. New features will be added and old ones improved according to the needs of the modellers.</p><p class="p">This documentation introduces you to the current version of Simantics System Dynamics. Documentation includes the basic modelling principles and a guide on how to model system dynamics models with Simantics System Dynamics. If you like to get to know the tool better and try modelling and simulating yourself, <a class="xref" href="#installation-instructions">install</a> the software and try our <a class="xref" href="BasicTutorial.html">basic</a> and <a class="xref" href="AdvancedTutorial.html">advanced</a> tutorials!</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title4" id="introduction-to-system-dynamics-simulation"><h1 class="title topictitle1" id="ariaid-title4">Introduction to System Dynamics Simulation</h1><div class="body"><div class="div hr">
+<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="topic"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="simantics-system-dynamics"><link rel="stylesheet" type="text/css" href="../commonltr.css"><title>Simantics System Dynamics</title></head><body><main role="main"><article role="article" aria-labelledby="ariaid-title1"><article class="nested0" aria-labelledby="ariaid-title1" id="simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title1">Simantics System Dynamics</h1><div class="body"></div><article class="topic nested1" aria-labelledby="ariaid-title2" id="contents"><h2 class="title topictitle2" id="ariaid-title2">Contents</h2><div class="body"><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#what-is-simantics-system-dynamics">1 What is Simantics System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#introduction-to-system-dynamics-simulation">2 Introduction to System Dynamics Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#system-dynamics">2.1 System Dynamics</a></p></li><li class="li"><p class="p"><a class="xref" href="#model">2.2 Model</a></p></li><li class="li"><p class="p"><a class="xref" href="#components">2.3 Components</a></p></li><li class="li"><p class="p"><a class="xref" href="#modeling-principles">2.4 Modeling Principles</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#installation-instructions">3 Installation Instructions</a></p></li><li class="li"><p class="p"><a class="xref" href="#workbench">4 Workbench</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#global-preferences">4.1 Global Preferences</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#modelling">5 Modelling</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#basic-modelling">5.1 Basic Modelling</a></p></li><li class="li"><p class="p"><a class="xref" href="#model-properties">5.2 Model Properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#special-variables">5.3 Special Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#withlookup">5.3.1 WithLookup</a></p></li><li class="li"><p class="p"><a class="xref" href="#delay">5.3.2 Delay</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#shortcut-and-control-keys">5.4 Shortcut and Control Keys</a></p></li><li class="li"><p class="p"><a class="xref" href="#unit-validation">5.5 Unit Validation</a></p></li><li class="li"><p class="p"><a class="xref" href="#diagram-profiles">5.6 Diagram Profiles</a></p></li><li class="li"><p class="p"><a class="xref" href="#debugging-a-model">5.7 Debugging a model</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#visual-model-elements">6 Visual model elements</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#fonts-and-colors">6.1 Fonts and colors</a></p></li><li class="li"><p class="p"><a class="xref" href="#dependency-properties">6.2 Dependency properties</a></p></li><li class="li"><p class="p"><a class="xref" href="#loops">6.3 Loops</a></p></li><li class="li"><p class="p"><a class="xref" href="#comments">6.4 Comments</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation">7 Simulation</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#experiments">7.1 Experiments</a></p></li><li class="li"><p class="p"><a class="xref" href="#solvers">7.2 Solvers</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">8 Simulation Result and Model Structure Analysis</a></p></li><li class="li"><p class="p"><a class="xref" href="#custom-charts">9 Custom Charts</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#line-chart">9.1 Line Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#sensitivity-chart">9.2 Sensitivity Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#bar-chart">9.3 Bar Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#pie-chart">9.4 Pie Chart</a></p></li><li class="li"><p class="p"><a class="xref" href="#chart-panel">9.5 Chart Panel</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#multidimensional-variables">10 Multidimensional Variables</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#modeling">10.1 Modeling</a></p></li><li class="li"><p class="p"><a class="xref" href="#expressions">10.2 Expressions</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-slices">10.3 Array Slices</a></p></li><li class="li"><p class="p"><a class="xref" href="#arithmetic-operators">10.4 Arithmetic Operators</a></p></li><li class="li"><p class="p"><a class="xref" href="#Built-in-modelica-functions">10.5 Built-in Modelica Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#simulation-results">10.6 Simulation Results</a></p></li><li class="li"><p class="p"><a class="xref" href="#array-variables-in-modules">10.7 Array Variables in Modules</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#functions">11 Functions</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#creating-functions">11.1 Creating Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#function-libraries">11.2 Function Libraries</a></p></li><li class="li"><p class="p"><a class="xref" href="#external-functions">11.3 External Functions</a></p></li><li class="li"><p class="p"><a class="xref" href="#modelica-functions">11.4 Modelica Functions</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#spreadsheets">12 Spreadsheets</a></p><ul class="ul"><li class="li"><p class="p"><a class="xref" href="#variable-values">12.1 Variable Values</a></p></li><li class="li"><p class="p"><a class="xref" href="#history-data">12.2 History Data</a></p></li></ul></li><li class="li"><p class="p"><a class="xref" href="#vensim-model-import">13 Vensim Model Import</a></p></li><li class="li"><p class="p"><a class="xref" href="#sample-models-and-molecules">14 Sample Models and Molecules</a></p></li></ul></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title3" id="what-is-simantics-system-dynamics"><h1 class="title topictitle1" id="ariaid-title3">What is Simantics System Dynamics</h1><div class="body"><div class="div hr">
+</div><p class="p"><em class="ph i">Simantics System Dynamics</em> is currently the only open source modelling and simulating tool for Simantics. Simantics System Dynamics is under development and will go through changes in the future. New features will be added and old ones improved according to the needs of modellers.</p><p class="p">This documentation introduces you to the current version of Simantics System Dynamics. The documentation includes basic modelling principles and a guide on how to model system dynamics models with Simantics System Dynamics. If you like to get to know the tool better and try modelling and simulating yourself, <a class="xref" href="#installation-instructions">install</a> the software and try our <a class="xref" href="BasicTutorial.html">basic</a> and <a class="xref" href="AdvancedTutorial.html">advanced</a> tutorials!</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title4" id="introduction-to-system-dynamics-simulation"><h1 class="title topictitle1" id="ariaid-title4">Introduction to System Dynamics Simulation</h1><div class="body"><div class="div hr">
</div></div><article class="topic nested1" aria-labelledby="ariaid-title5" id="system-dynamics"><h2 class="title topictitle2" id="ariaid-title5">System Dynamics</h2><div class="body"><p class="p">System dynamics is an approach to understanding different organizations, markets and other complex systems and their dynamic behavior. Simantics System Dynamics is a free modelling tool for system dynamics modeling and simulation. See <a class="xref" href="#installation-instructions">installation instructions</a>.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title6" id="model"><h2 class="title topictitle2" id="ariaid-title6">Model</h2><div class="body"><p class="p">System dynamics model is generally understood as the model configuration. In this tool, the model contains also other components: <a class="xref" href="#experiments">Experiments</a> are the way to simulate the model. You can have experiments with different configurations, for example different initial values for some parameters. In that way, you don't have to always configure the model for different scenarios. <a class="xref" href="#basic-modelling">Module types</a> allow user to create reusable component types which can be instantiated as Modules. The Modules folder contains all the different module types in your model and you can create new module types there. The <a class="xref" href="#functions">Functions</a> folder contains built-in and user-defined functions.</p><div class="div imageBorder">
<img class="image" src="Images/ModelStructure.png"><br>
<p class="p imageText">Model structure</p>
</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title7" id="components"><h2 class="title topictitle2" id="ariaid-title7">Components</h2><div class="body"><p class="p">Most of the components you can use in your models are basic system dynamics components. The modularity of the models introduces two additional components, Modules and Inputs. All the components are explained below.</p><div class="div imageBorder">
<img class="image" src="Images/ComponentTypes.png"><br>
<p class="p imageText">Component types</p>
-</div><p class="p"><strong class="ph b">Auxiliary</strong></p><p class="p">Auxiliary is the most basic variable you can use. It represents a single value or a mathematical expression. There are different types of auxiliary variables currently in the system: <em class="ph i">Auxiliary</em>, <em class="ph i">Parameter</em>, <em class="ph i">Constant</em>, <a class="xref" href="#delay"><em class="ph i">Delay</em></a> and <a class="xref" href="#withlookup"><em class="ph i">WithLookup</em></a>. Auxiliary is the default type. Parameters are static values that the user can change. When only parameters are changed, the model simulates faster, because the system does not have to recompile the model. WithLookup and Delay are special variables. WithLookup has an expression and a lookup table. The expression defines what value is taken from the defined table. Delay variable delays an equation a given time with a given delay order.</p><p class="p"><strong class="ph b">Dependency</strong></p><p class="p">Dependency is an arrow that connects two components. It means that the value of the variable from which the arrow starts is used to calculate the value of the variable where the arrow ends. Dependencies that are used for a stock initial value only are colored grey by default, in contrast to the regular blue dependency arrows.</p><p class="p"><strong class="ph b">Flow</strong></p><p class="p">Flow connects clouds, valves and stocks. Flow represents an actual flow of something from stocks or clouds to stocks or clouds. There has to be at least one valve in a flow and the system creates it automatically, if none of the ends of the flow is a valve.</p><p class="p"><strong class="ph b">Valve</strong></p><p class="p">Valve regulates the rate of a flow. The value of a valve is automatically used in calculating the level of an adjacent stock. Valves behave just like Auxiliary variables but look different and you can connect also flows to them.</p><p class="p"><strong class="ph b">Stock</strong></p><p class="p">The value of a stock variable is an integral of flows leaving and flows arriving to the variable. The integral is calculated automatically from the valves that are connected to the variable with flow connections. Alternatively, the equation that is integrated can be defined manually by user. A stock must be given an initial value. Initial value can be a single value or an equation. You can use values of other variables to calculate the initial value.</p><p class="p"><strong class="ph b">Cloud</strong></p><p class="p">Cloud is not a variable. It represents a starting or ending point of a flow, if it is not in the scope of the model.</p><p class="p"><strong class="ph b">Module</strong></p><p class="p">Modules enable structural modeling. Modules are defined just like the basic model configuration, but the module component hides the actual configuration. You can only connect dependency connections into the module and dependency connections from the module must end to Input variables. The interface of the module is defined using input and output variables in the configuration of the module. All variable types can be set as output variables. If a variable is an output variable, its font is bold.</p><p class="p"><strong class="ph b">Input</strong></p><p class="p">Input variables are the way of getting values from other modules. Inputs look like auxiliary variables except their font is italics. You can set a default value to the input variable in case it is not connected to any variable. Connections are made from the modules properties, when the module is populated. Input doesn't have to be connected with an arrow to a module. If the variable has no connections, it can get values from a higher level in the hierarchy. If an input is connected to an output, the output and its module are shown below the variable using dot notation.</p><p class="p"><strong class="ph b">Shadow</strong></p><p class="p">A shadow variable is a reference to a variable defined elsewhere on the diagram. The referred variable can be an auxiliary, a valve, a stock, or an input. Dependency and flow arrows can be drawn out of a shadow variable, but no arrows can be drawn into a shadow variable. Shadow variables are used to improve the readability of the model.</p><p class="p"><strong class="ph b">Loop</strong></p><p class="p">A loop element is a graphical component for highlighting selected feedback loops in a model.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">A comment element is a string of text on diagram.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title8" id="modeling-principles"><h2 class="title topictitle2" id="ariaid-title8">Modeling Principles</h2><div class="body"><p class="p">System dynamics modelling is much more than just mathematical formulas and nice graphs. Models are ways of communicating. There are some basic principles in system dynamics modelling that make the models easier to read and understand. You do not have to apply these principles to simulate models, but using them makes it easier for you to communicate your model to others.</p><p class="p"><strong class="ph b">Variable names</strong></p><p class="p">Variables names should be nouns, not verbs. The names should be positive: for example it is easier to understand that satisfaction decreases than dissatisfaction rises. Variable names can and should have multiple words, if they are needed. Note that due to the reserved words in Modelica, variable names such as <em class="ph i">Carbon in Atmosphere</em> cannot be used (<em class="ph i">in</em> is a reserved word). Capitalizing the reserved (<em class="ph i">in</em> --> <em class="ph i">In</em>) word can be used to sidestep the problem.</p><p class="p"><strong class="ph b">Connections</strong></p><p class="p">You should usually try to avoid overlapping dependency arrows. Organizing the variables on the diagram and using shadow variables can be used for that purpose. Dependencies should also form distinctive loops, if there is a loop. It makes it easier to read and understand the model and its behavior.</p><p class="p"><strong class="ph b">Graphical annotations</strong></p><p class="p">System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important, for communicating the behavior of the model.</p></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title9" id="installation-instructions"><h1 class="title topictitle1" id="ariaid-title9">Installation Instructions</h1><div class="body"><div class="div hr">
-</div><p class="p">System dynamics tool is provided with the Simantics platform.</p><ol class="ol"><li class="li"><p class="p"><a class="xref" href="http://sysdyn.simantics.org/" target="_blank">Download installer from the tool's download page</a></p></li><li class="li"><p class="p">Install the program to a directory without spaces (limitation inherited from OpenModelica).</p></li><li class="li"><p class="p">Run the application through the launcher generated by the installer</p><p class="p">(default: Simantics\Simantics-1.8.0-Sysdyn-32\Simantics-1.8.0-Sysdyn-32)</p></li></ol><p class="p"><a class="xref" href="http://www.openmodelica.org/" target="_blank">OpenModelica</a> is used to build and simulate the models. Simantics platform has integrated OpenModelica 1.9.0 beta4 for Windows environments. For other versions and other environments you need to install <a class="xref" href="https://www.openmodelica.org/download/download-windows" target="_blank">OpenModelica</a>. In addition to OpenModelica, a development version of a <a class="xref" href="#solvers">purpose-built Modelica solver</a> is embedded in the tool.</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title10" id="workbench"><h1 class="title topictitle1" id="ariaid-title10">Workbench</h1><div class="body"><div class="div hr">
+</div><p class="p"><strong class="ph b">Auxiliary</strong></p><p class="p">Auxiliary is the most basic variable you can use. It represents a single value or a mathematical expression. There are different types of auxiliary variables currently in the system: <em class="ph i">Auxiliary</em>, <em class="ph i">Parameter</em>, <em class="ph i">Constant</em>, <a class="xref" href="#delay"><em class="ph i">Delay</em></a> and <a class="xref" href="#withlookup"><em class="ph i">WithLookup</em></a>. Auxiliary is the default type. Parameters are static values that the user can change. When only parameters are changed, the model simulates faster, because the system does not have to recompile the model. WithLookup and Delay are special variables. WithLookup has an expression and a lookup table. The expression defines what value is taken from the defined table. Delay variable delays an equation a given time with a given delay order.</p><p class="p"><strong class="ph b">Dependency</strong></p><p class="p">Dependency is an arrow that connects two components. It means that the value of the variable from which the arrow starts is used to calculate the value of the variable where the arrow ends. Dependencies that are used for a stock initial value only are colored grey by default, in contrast to the regular blue dependency arrows.</p><p class="p"><strong class="ph b">Flow</strong></p><p class="p">Flow connects clouds, valves and stocks. Flow represents an actual flow of something from stocks or clouds to stocks or clouds. There has to be at least one valve in a flow and the system creates it automatically, if none of the ends of the flow is a valve.</p><p class="p"><strong class="ph b">Valve</strong></p><p class="p">Valve regulates the rate of a flow. The value of a valve is automatically used in calculating the level of an adjacent stock. Valves behave just like Auxiliary variables but look different and you can connect also flows to them.</p><p class="p"><strong class="ph b">Stock</strong></p><p class="p">The value of a stock variable is an integral of flows leaving and flows arriving to the variable. The integral is calculated automatically from the valves that are connected to the variable with flow connections. Alternatively, the equation that is integrated can be defined manually by user. A stock must be given an initial value. Initial value can be a single value or an equation. You can use values of other variables to calculate the initial value.</p><p class="p"><strong class="ph b">Cloud</strong></p><p class="p">Cloud is not a variable. It represents a starting or ending point of a flow, if it is not in the scope of the model.</p><p class="p"><strong class="ph b">Module</strong></p><p class="p">Modules enable structural modeling. Modules are defined just like the basic model configuration, but the module component hides the actual configuration. You can only connect dependency connections into the module and dependency connections from the module must end to Input variables. The interface of the module is defined using input and output variables in the configuration of the module. All variable types can be set as output variables. If a variable is an output variable, its font is bold.</p><p class="p"><strong class="ph b">Input</strong></p><p class="p">Input variables are the way of getting values from other modules. Inputs look like auxiliary variables except their font is italics. You can set a default value to the input variable in case it is not connected to any variable. Connections are made from the modules properties, when the module is populated. Input doesn't have to be connected with an arrow to a module. If the variable has no connections, it can get values from a higher level in the hierarchy. If an input is connected to an output, the output and its module are shown below the variable using dot notation.</p><p class="p"><strong class="ph b">Shadow</strong></p><p class="p">Shadow variable is a reference to a variable defined elsewhere on the diagram. The referred variable can be an auxiliary, a valve, a stock, or an input. Dependency and flow arrows can be drawn out of a shadow variable, but no arrows can be drawn into a shadow variable. Shadow variables are used to improve the readability of the model.</p><p class="p"><strong class="ph b">Loop</strong></p><p class="p">Loop element is a graphical component for highlighting selected feedback loops in a model.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">Comment element is a string of text on diagram.</p></div></article><article class="topic nested1" aria-labelledby="ariaid-title8" id="modeling-principles"><h2 class="title topictitle2" id="ariaid-title8">Modeling Principles</h2><div class="body"><p class="p">System dynamics modelling is much more than just mathematical formulas and nice graphs. Models are ways of communicating. There are some basic principles in system dynamics modelling that make the models easier to read and understand. You do not have to apply these principles to simulate models, but using them makes it easier for you to communicate your model to others.</p><p class="p"><strong class="ph b">Variable names</strong></p><p class="p">Variables names should be nouns, not verbs. The names should be positive: for example it is easier to understand that satisfaction decreases than dissatisfaction rises. Variable names can and should have multiple words, if they are needed. Note that due to the reserved words in Modelica, variable names such as <em class="ph i">Carbon in Atmosphere</em> cannot be used (<em class="ph i">in</em> is a reserved word). Capitalizing the reserved (<em class="ph i">in</em> → <em class="ph i">In</em>) word can be used to sidestep the problem.</p><p class="p"><strong class="ph b">Connections</strong></p><p class="p">You should usually try to avoid overlapping dependency arrows. Organizing the variables on the diagram and using shadow variables can be used for that purpose. Dependencies should also form distinctive loops, if there is a loop. It makes it easier to read and understand the model and its behavior.</p><p class="p"><strong class="ph b">Graphical annotations</strong></p><p class="p">System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important for communicating the behavior of the model.</p></div></article></article><article class="topic nested0" aria-labelledby="ariaid-title9" id="installation-instructions"><h1 class="title topictitle1" id="ariaid-title9">Installation Instructions</h1><div class="body"><div class="div hr">
+</div><p class="p">System dynamics tool is provided with the Simantics platform.</p><ol class="ol"><li class="li"><p class="p"><a class="xref" href="http://sysdyn.simantics.org/" target="_blank" rel="external noopener">Download installer from the tool's download page</a></p></li><li class="li"><p class="p">Install the program to a directory without spaces or special characters (limitation inherited from OpenModelica).</p></li><li class="li"><p class="p">Run the application through the launcher generated by the installer</p></li></ol><p class="p"><a class="xref" href="http://www.openmodelica.org/" target="_blank" rel="external noopener">OpenModelica</a> is used to build and simulate the models. Simantics platform has integrated OpenModelica 1.9.0 beta4 for Windows environments. For other versions and other environments you need to install the latest official 64bit release of <a class="xref" href="https://www.openmodelica.org/download/download-windows" target="_blank" rel="external noopener">OpenModelica</a>. In addition to OpenModelica, a development version of a <a class="xref" href="#solvers">purpose-built Modelica solver</a> is embedded in the tool.</p><p class="p">If you plan on creating large models or using a long simulation time with a small step size, it is advised that you give the tool more memory by increasing the numerical value of property -Xmx in the file Simantics-Sysdyn.ini.</p></div></article><article class="topic nested0" aria-labelledby="ariaid-title10" id="workbench"><h1 class="title topictitle1" id="ariaid-title10">Workbench</h1><div class="body"><div class="div hr">
</div><div class="div image">
<img class="image" src="Images/BasicWorkbench.png"><br>
-</div><p class="p">1 <strong class="ph b">Diagram</strong></p><p class="p">Diagram is the area where you will graphically modify your model. Diagrams are built from elements that can be dragged from Symbols view or populated using shortcut keys.</p><p class="p">2 <strong class="ph b">Model Browser</strong></p><p class="p">Model browser shows the structure of your model and all items related to it.</p><p class="p"><strong class="ph b">Symbols</strong></p><p class="p">Symbols view (stacked with the model browser) is used for dragging elements to diagrams.</p><p class="p"><strong class="ph b">Search</strong></p><p class="p">Search view (stacked with the model browser) is used for searching elements in all models. Search can be launched also from the search field in the bottom right corner or by Ctrl+F.</p><p class="p">3 <strong class="ph b">Properties</strong></p><p class="p">Property view shows the selected variable's properties. Property view has a different layout depending on the type of the selected component. The view can also have different tabs depending on the component type. Basic tabs for variables are Equation, Indexes, and Additional information.</p><p class="p"><strong class="ph b">Console</strong></p><p class="p">Console view (stacked with the property view) shows console messages from the simulator. Console can be used for debugging models simulated using OpenModelica.</p><p class="p"><strong class="ph b">Issues</strong></p><p class="p">Issue view (stacked with the property view) shows the errors and warnings in all models.</p><p class="p"><strong class="ph b">Profiles</strong></p><p class="p"><a class="xref" href="#diagram-profiles">Profiles</a> view (stacked with the property view) allows enabling/disabling some visual diagram effects.</p><p class="p"><strong class="ph b">Trend</strong></p><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">Trend</a> view shows the graphical representation of the values of the selected value over time. For the trend to be shown, a simulation has to be run. The view shows always the results of the latest run, but you can save results of a simulation and show them in the same trend with results from another simulation.</p><p class="p"><strong class="ph b">Structure</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">structure</a> view (stacked with the trend view) can be used for analyzing the varaible dependencies, loops, and the structure of the model.</p><p class="p"><strong class="ph b">Values</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">values</a> view (stacked with the trend view) shows the values of the selected value over time. For the values to be shown, a simulation has to be run.</p><p class="p">5 <strong class="ph b">Save and save as...</strong></p><p class="p">Save buttons can be used to export the selected model as .sysdyn file. The buttons save that model which is selected in the model browser or, if the focus is on the diagram, the model that is currently open on the diagram.</p><p class="p">6 <strong class="ph b">Diagram tool mode</strong></p><p class="p">With the diagram tool mode, you can select how the elements on the diagram are edited. The Lock mode prohibits editing diagram elements, the pointer mode allows moving and editing diagram elements, and with the dependency and flow modes arrows can be drawn using only mouse1 and mouse2.</p><p class="p">7 <strong class="ph b">Experiment controls</strong></p><p class="p">Experiment controls are shown when an experiment is active. Experiment is activated by double clicking an experiment in the model browser. With the experiment control, you can start simulation runs and save simulation results.</p><p class="p">8 <strong class="ph b">Perspectives</strong></p><div class="p">Perspectives allow changing between different layouts of the views. On start-up, only the default perspective is open. Try adding the two predefined perspectives by clicking the Open Perspective button: <div class="div image">
-<img class="image" src="Images/OpenPerspective.png"><br><p class="p">9 <strong class="ph b">Chart Panel</strong></p><p class="p"><a class="xref" href="#chart-panel">Chart panel</a> is able to house multiple <a class="xref" href="#custom-charts">charts</a> at the same time. Charts are added to the panel by dragging from model browser.</p><p class="p"><strong class="ph b">TIP!</strong> If you accidentally close a view, you can reopen them from Window->Show View->Other...</p><p class="p"><strong class="ph b">TIP!</strong> Try dragging the views to different positions (e.g. the property view to the right pane).</p></div><article class="topic nested1" aria-labelledby="ariaid-title11" id="global-preferences"><h2 class="title topictitle2" id="ariaid-title11">Global Preferences</h2><div class="body"><p class="p">Global preferences of Simantics System Dynamics are located under Window -> Preferences. Feel free to browse the contents yourself. A few notable items on the list are described below.</p><div class="div image">
- <img class="image" src="Images/Preferences.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="global-preferences__entry__1"><strong class="ph b">Category</strong></th><th class="entry" id="global-preferences__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">General -> Keys</strong></td><td class="entry" headers="global-preferences__entry__2 ">All <a class="xref" href="#shortcut-and-control-keys">keyboard shortcuts</a> available.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">Modelica</strong></td><td class="entry" headers="global-preferences__entry__2 ">The location of OpenModelica solver on file system.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">Solver</strong></td><td class="entry" headers="global-preferences__entry__2 "><a class="xref" href="#solvers">Solver</a> to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1 "><strong class="ph b">Sysdyn Diagrams</strong></td><td class="entry" headers="global-preferences__entry__2 ">Sysdyn Diagrams allows customize default colors and fonts of diagram elements.</td></tr></tbody></table></div></article></div><article class="topic nested1" aria-labelledby="ariaid-title12" id="modelling"><h2 class="title topictitle2" id="ariaid-title12">Modelling</h2><div class="body"><div class="div hr">
+</div><p class="p">1 <strong class="ph b">Diagram</strong></p><p class="p">Diagram is the area where you will graphically modify your model. Diagrams are built from elements that can be dragged from Symbols view or populated using shortcut keys.</p><p class="p">2 <strong class="ph b">Model Browser</strong></p><p class="p">Model browser shows the structure of your model and all items related to it.</p><p class="p"><strong class="ph b">Symbols</strong></p><p class="p">Symbols view (stacked with the model browser) is used for dragging elements to diagrams.</p><p class="p">3 <strong class="ph b">Properties (MouseBirths in the image above)</strong></p><p class="p">Property view shows the selected variable's properties. Property view has a different layout depending on the type of the selected component. The view can also have different tabs depending on the component type. Basic tabs for variables are Equation, indices, and Additional information.</p><p class="p"><strong class="ph b">Console</strong></p><p class="p">Console view (stacked with the property view) shows console messages from the simulator. Console can be used for debugging models simulated using OpenModelica.</p><p class="p"><strong class="ph b">Issues</strong></p><p class="p">Issue view (stacked with the property view) shows the errors and warnings in all models.</p><p class="p"><strong class="ph b">Profiles</strong></p><p class="p"><a class="xref" href="#diagram-profiles">Profiles</a> view (stacked with the property view) allows enabling/disabling some visual diagram effects.</p><p class="p">4 <strong class="ph b">Trend</strong></p><p class="p"><a class="xref" href="#simulation-result-and-model-structure-analysis">Trend</a> view shows the graphical representation of the values of the selected value over time. For the trend to be shown, a simulation has to be run. The view shows always the results of the latest run, but you can save results of a simulation and show them in the same trend with results from another simulation.</p><p class="p"><strong class="ph b">Structure</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">structure</a> view (stacked with the trend view) can be used for analyzing the variable dependencies, loops, and the structure of the model.</p><p class="p"><strong class="ph b">Values</strong></p><p class="p">The <a class="xref" href="#simulation-result-and-model-structure-analysis">values</a> view (stacked with the trend view) shows the values of the selected value over time. For the values to be shown, a simulation has to be run.</p><p class="p">5 <strong class="ph b">Save and save as...</strong></p><p class="p">Save buttons can be used to export the selected model as .sysdyn file. The buttons save that model which is selected in the model browser or, if the focus is on the diagram, the model that is currently open on the diagram.</p><p class="p">6 <strong class="ph b">Diagram tool mode</strong></p><p class="p">With the diagram tool mode, you can select how the elements on the diagram are edited. The Lock mode prohibits editing diagram elements, the pointer mode allows moving and editing diagram elements, and with the dependency and flow modes arrows can be drawn using only mouse1 and mouse2.</p><p class="p">7 <strong class="ph b">Experiment controls</strong></p><p class="p">Experiment controls are shown when an experiment is active. Experiment is activated by double clicking an experiment in the model browser. With the experiment control, you can start simulation runs and save simulation results.</p><p class="p">8 <strong class="ph b">Perspectives</strong></p><div class="p">Perspectives allow changing between different layouts of the views. On start-up, only the default perspective is open. Try adding the two predefined perspectives by clicking the Open Perspective button: <div class="div image">
+<img class="image" src="Images/OpenPerspective.png"><br><p class="p">9 <strong class="ph b">Chart Panel</strong></p><p class="p"><a class="xref" href="#chart-panel">Chart panel</a> is able to house multiple <a class="xref" href="#custom-charts">charts</a> at the same time. Charts are added to the panel by dragging from model browser.</p><p class="p"><strong class="ph b">TIP!</strong> If you accidentally close a view, you can reopen them from Window→Show View→Other...</p><p class="p"><strong class="ph b">TIP!</strong> Try dragging the views to different positions (e.g. the property view to the right pane).</p></div><article class="topic nested1" aria-labelledby="ariaid-title11" id="global-preferences"><h2 class="title topictitle2" id="ariaid-title11">Global Preferences</h2><div class="body"><p class="p">Global preferences of Simantics System Dynamics are located under Window → Preferences. Feel free to browse the contents yourself. A few notable items on the list are described below.</p><div class="div image">
+ <img class="image" src="Images/PreferencesNew.png"><br>
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="global-preferences__entry__1"><strong class="ph b">Category</strong></th><th class="entry" id="global-preferences__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">General → Keys</strong></td><td class="entry" headers="global-preferences__entry__2">All <a class="xref" href="#shortcut-and-control-keys">keyboard shortcuts</a> available.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">Modelica</strong></td><td class="entry" headers="global-preferences__entry__2">The location of OpenModelica solver on file system.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">Solver</strong></td><td class="entry" headers="global-preferences__entry__2"><a class="xref" href="#solvers">Solver</a> to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.</td></tr><tr class="row"><td class="entry" headers="global-preferences__entry__1"><strong class="ph b">Sysdyn Diagrams</strong></td><td class="entry" headers="global-preferences__entry__2">Sysdyn Diagrams allows customize default colors and fonts of diagram elements.</td></tr></tbody></table></div></article></div><article class="topic nested1" aria-labelledby="ariaid-title12" id="modelling"><h2 class="title topictitle2" id="ariaid-title12">Modelling</h2><div class="body"><div class="div hr">
</div></div><article class="topic nested2" aria-labelledby="ariaid-title13" id="basic-modelling"><h3 class="title topictitle3" id="ariaid-title13">Basic Modelling</h3><div class="body"><p class="p">Basic modelling functions enable you to create and configure models. System dynamics modeling is basically pretty simple, so with these instructions you can build small and also very large models. The tricky part is writing all the expressions and adjusting the model so that it actually tells you something.</p><div class="div image">
- <img class="image" src="Images/Basic_1.png"><br>
-</div><p class="p"><strong class="ph b">Creating a new model</strong></p><p class="p">Start a new model by right-clicking the model browser and selecting New -> Model or from the main menu File -> New -> SD Model.</p><div class="div image">
- <img class="image" src="Images/Basic_2.png"><br>
-</div><p class="p"><strong class="ph b">Creating a new module type</strong></p><p class="p">Create a new module type by right-clicking on the Modules-folder and selecting New -> Module type. This creates a new module type that you can populate to your other modules and the model configuration.</p><p class="p"><strong class="ph b">Configuring a model</strong></p><p class="p">Model configuration can be opened by double clicking Configuration in the model browser.</p><p class="p"><strong class="ph b">Configuring modules</strong></p><p class="p">Configuration of a module type can be opened by double clicking the module type you want to configure. You can also open the configuration of a module from a diagram, when a module has been populated to that diagram, by right-clicking the module and selecting Show Module. When opening modules from diagram, the opened diagram knows to which diagram the module has been populated and can show the connections between the modules. Keep in mind that when making changes to a module, the changes apply to all instances of the respective module type!</p><p class="p"><strong class="ph b">Populate variables</strong></p><p class="p">You can drag variables to a diagram from symbol view. You can also populate variables using <a class="xref" href="#shortcut-and-control-keys">shortcut keys</a>. Variables can be divided into multiple lines by resizing the variable on diagram.</p><p class="p"><strong class="ph b">Populate modules</strong></p><p class="p">Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram.</p><p class="p"><strong class="ph b">Create connections</strong></p><p class="p">There are two types of connections: dependencies and flows. Both are created basically the same way. Hold Alt down and click on a variable. Left click starts a dependency, right click starts a flow. Both are ended to another variable with a left click. Dependencies and flows can also be created without Alt key by selecting dependency or flow mode on the toolbar.</p><p class="p">Flows can also be started and ended to an empty spot in the diagram. If there is no start or end variable, a cloud will be created. Also if start or end is not a valve, a new valve is created in the middle of the flow.</p><p class="p">There are some restrictions on what connections can be made, but don't worry, the user interface won't let you do connections that are not allowed.</p><p class="p"><strong class="ph b">Connections between modules</strong></p><p class="p"><strong class="ph b">Outside the module</strong></p><p class="p">You can connect variables to variables in modules like this:</p><pre class="pre">MODULE -----> INPUT
+ <img class="image" src="Images/NewModel.png"><br>
+</div><p class="p"><strong class="ph b">Creating a new model</strong></p><p class="p">Start a new model by right-clicking the model browser and selecting New → Model or from the main menu File → New → SD Model.</p><div class="div image">
+ <img class="image" src="Images/NewModule.png"><br>
+</div><p class="p"><strong class="ph b">Creating a new module type</strong></p><p class="p">Create a new module type by right-clicking on the Modules-folder and selecting New → Module type. This creates a new module type that you can populate to your other modules and the model configuration.</p><p class="p"><strong class="ph b">Configuring a model</strong></p><p class="p">Model configuration can be opened by double clicking Configuration in the model browser.</p><p class="p"><strong class="ph b">Configuring modules</strong></p><p class="p">Configuration of a module type can be opened by double clicking the module type you want to configure. You can also open the configuration of a module from a diagram, when a module has been populated to that diagram, by right-clicking the module and selecting Show Module. When opening modules from diagram, the opened diagram knows to which diagram the module has been populated and can show the connections between the modules. Keep in mind that when making changes to a module, the changes apply to all instances of the respective module type!</p><p class="p"><strong class="ph b">Populate variables</strong></p><p class="p">You can drag variables to a diagram from symbol view. You can also populate variables using <a class="xref" href="#shortcut-and-control-keys">shortcut keys</a>. Variables can be divided into multiple lines by resizing the variable on diagram.</p><p class="p"><strong class="ph b">Populate modules</strong></p><p class="p">Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram.</p><p class="p"><strong class="ph b">Create connections</strong></p><p class="p">There are two types of connections: dependencies and flows. Both are created basically the same way. Hold Alt down and click on a variable. Left click starts a dependency, right click starts a flow. Both are ended to another variable with a left click. Dependencies and flows can also be created without Alt key by selecting dependency or flow mode on the toolbar.</p><p class="p">Flows can also be started and ended to an empty spot in the diagram. If there is no start or end variable, a cloud will be created. Also if start or end is not a valve, a new valve is created in the middle of the flow.</p><p class="p">There are some restrictions on what connections can be made, but don't worry, the user interface won't let you do connections that are not allowed.</p><p class="p"><strong class="ph b">Connections between modules</strong></p><p class="p"><strong class="ph b">Outside the module</strong></p><p class="p">You can connect variables to modules like this:</p><pre class="pre">MODULE -----> INPUT
or
-ANY VARIABLE -----> MODULE
-</pre><p class="p">This is just the visual configuration, but you need those connections to really connect variables in the module's properties.</p><p class="p">In the <em class="ph i">Inputs</em> tab stacked under <em class="ph i">Module Properties</em> you can select which variables you connect to inputs inside the module. In the <em class="ph i">Outputs</em> tab you can select which variables you lift from the module to inputs outside it.</p><p class="p"><strong class="ph b">Inside the module</strong></p><p class="p">Input variables get values from outside the module</p><p class="p">Output variables can send their values outside the module. From the variable properties, select Additional Information and press Is Output</p><p class="p"><strong class="ph b">Configure variables</strong></p><p class="p">Select a single variable from diagram or model browser. The properties of the variables are shown in the equation view and you can modify them.</p><p class="p"><strong class="ph b">Export model</strong></p><p class="p">To export your model to a file, select your model from the model browser, right-click and from the context menu choose Export->Model. Select the folder where to export your model, give the file a name and press Save. You do not need to export a model to Save it, the model is automatically saved in your database. Export can be used, for example, to create different versions of a model, create backups or to transport a model to another database.</p><p class="p"><strong class="ph b">Import model</strong></p><p class="p">Right-click on the model browser and select Import->Model. Browse to your .sysdyn file and select open. The model is added to your model browser.</p><p class="p"><strong class="ph b">Export module</strong></p><p class="p">To export a module to a file, select the module from the model browser, right-click and from the context menu choose Export->Module. Select the folder where to export your model, give the file a name and press Save. Module export can be used, for example, to transport a module to another model or another database.</p><p class="p"><strong class="ph b">Import module</strong></p><p class="p">Right-click the Modules folder of a model and select Import->Module. Browse to your .sysdynModule file and select open. The module is added to your model.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title14" id="model-properties"><h3 class="title topictitle3" id="ariaid-title14">Model Properties</h3><div class="body"><p class="p">Model properties can be viewed by selecting either the model or its configuration on the model browser.</p><div class="div image">
+ANY VARIABLE -----> MODULE
+</pre><p class="p">This is just the visual configuration, but you need those connections to really connect variables in the module's properties.</p><p class="p">In the <em class="ph i">Inputs</em> tab stacked under <em class="ph i">Module Properties</em> you can select which variables you connect to inputs inside the module. In the <em class="ph i">Outputs</em> tab you can select which variables you lift from the module to inputs outside it.</p><p class="p"><strong class="ph b">Inside the module</strong></p><p class="p">Input variables get values from outside the module.</p><p class="p">Output variables send their values outside the module. To make a variable output its values, from the properties view make sure the Is Output checkbox is ticked.</p><p class="p"><strong class="ph b">Configure variables</strong></p><p class="p">Select a single variable from diagram or model browser. The properties of the variables are shown in the properties view where you can also modify them.</p><p class="p"><strong class="ph b">Export model</strong></p><p class="p">To export your model to a file, select your model from the model browser, right-click and from the context menu choose Export→Model. Select the folder where to export your model, give the file a name and press Save. You do not need to export a model to Save it, the model is automatically saved in your database. Export can be used, for example, to create different versions of a model, create backups or to transport a model to another database.</p><p class="p"><strong class="ph b">Import model</strong></p><p class="p">Select File→Import Model, browse to your .sysdyn file and select open. The model is added to your model browser.</p><p class="p"><strong class="ph b">Export module</strong></p><p class="p">To export a module to a file, select the module from the model browser, right-click and from the context menu choose Export→Module. Select the folder where to export your model, give the file a name and press Save. Module export can be used, for example, to transport a module to another model or another database.</p><p class="p"><strong class="ph b">Import module</strong></p><p class="p">Right-click the Modules folder of a model and select Import→Module. Browse to your .sysdynModule file and select open. The module is added to your model.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title14" id="model-properties"><h3 class="title topictitle3" id="ariaid-title14">Model Properties</h3><div class="body"><p class="p">Model properties can be viewed by selecting either the model or its configuration on the model browser.</p><div class="div image">
<img class="image" src="Images/ModelProperties.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="model-properties__entry__1"><strong class="ph b">Property</strong></th><th class="entry" id="model-properties__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Name</strong></td><td class="entry" headers="model-properties__entry__2 ">The name of the model</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Start time</strong></td><td class="entry" headers="model-properties__entry__2 ">The start time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Stop time</strong></td><td class="entry" headers="model-properties__entry__2 ">The stop time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Step length</strong></td><td class="entry" headers="model-properties__entry__2 ">The length of the simulation step.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Output interval</strong></td><td class="entry" headers="model-properties__entry__2 ">Interval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Method</strong></td><td class="entry" headers="model-properties__entry__2 ">The simulation solver (only OpenModelica).</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Validate units</strong></td><td class="entry" headers="model-properties__entry__2 "><a class="xref" href="#unit-validation">Unit validation</a> on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Unit equivalents</strong></td><td class="entry" headers="model-properties__entry__2 ">Define if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Tolerance</strong></td><td class="entry" headers="model-properties__entry__2 ">Integrator error tolerance (only OpenModelica)</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1 "><strong class="ph b">Variable filter</strong></td><td class="entry" headers="model-properties__entry__2 ">Define which variables are presented (only OpenModelica)</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title15" id="special-variables"><h3 class="title topictitle3" id="ariaid-title15">Special Variables</h3><div class="body"><p class="p">Auxiliary and valve variables have two special types: WithLookup and Delay. These types are selected from Type drop down menu in the variable's properties. The variable types offer more specific functionalities than normal variables, but the same functionality could be achieved using normal variables.</p></div><article class="topic nested3" aria-labelledby="ariaid-title16" id="withlookup"><h4 class="title topictitle4" id="ariaid-title16">WithLookup</h4><div class="body"><p class="p">WithLookup variable has two equation fields, WithLookup and Lookup table. Lookup table has a table from which the value of the variable is interpolated using the value of WithLookup field.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="model-properties__entry__1"><strong class="ph b">Property</strong></th><th class="entry" id="model-properties__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Name</strong></td><td class="entry" headers="model-properties__entry__2">The name of the model</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Start time</strong></td><td class="entry" headers="model-properties__entry__2">The start time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Stop time</strong></td><td class="entry" headers="model-properties__entry__2">The stop time of the simulation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Step length</strong></td><td class="entry" headers="model-properties__entry__2">The length of the simulation step.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Output interval</strong></td><td class="entry" headers="model-properties__entry__2">Interval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Method</strong></td><td class="entry" headers="model-properties__entry__2">The simulation solver (only OpenModelica).</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Validate units</strong></td><td class="entry" headers="model-properties__entry__2"><a class="xref" href="#unit-validation">Unit validation</a> on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Unit equivalents</strong></td><td class="entry" headers="model-properties__entry__2">Define if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation.</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Tolerance</strong></td><td class="entry" headers="model-properties__entry__2">Integrator error tolerance (only OpenModelica)</td></tr><tr class="row"><td class="entry" headers="model-properties__entry__1"><strong class="ph b">Variable filter</strong></td><td class="entry" headers="model-properties__entry__2">Define which variables are presented (only OpenModelica)</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title15" id="special-variables"><h3 class="title topictitle3" id="ariaid-title15">Special Variables</h3><div class="body"><p class="p">Auxiliary and valve variables have two special types: WithLookup and Delay. These types are selected from Type drop down menu in the variable's properties. The variable types offer more specific functionalities than normal variables, but the same functionality could be achieved using normal variables.</p></div><article class="topic nested3" aria-labelledby="ariaid-title16" id="withlookup"><h4 class="title topictitle4" id="ariaid-title16">WithLookup</h4><div class="body"><p class="p">WithLookup variable has two equation fields, WithLookup and Lookup table. Lookup table has a table from which the value of the variable is interpolated using the value of WithLookup field.</p><div class="div image">
<img class="image" src="Images/WithLookup1.png"><br>
-</div><p class="p">You do not need to manually input the Lookup table. WithLookup variable type offers an additional Lookup table tab in the property view. In this view you can add and modify points in the lookup table. Points can be added either by clickin on the chart or by using the input fields and Add button. Points can be modified by dragging them on the chart or modifying values in the table. Points are removed by clicking them with right mouse click.</p><div class="div image">
+</div><p class="p">You do not need to manually input the Lookup table. WithLookup variable type offers an additional Lookup table tab in the property view. In this view you can add and modify points in the lookup table. Points can be added either by clicking on the chart or by using the input fields and Add button. Points can be modified by dragging them on the chart or modifying values in the table. Points are removed by clicking them with right mouse click.</p><div class="div image">
<img class="image" src="Images/WithLookup2.png"><br>
</div></div></article><article class="topic nested3" aria-labelledby="ariaid-title17" id="delay"><h4 class="title topictitle4" id="ariaid-title17">Delay</h4><div class="body"><p class="p">Delay variables build equations for Nth order delays. Users can set the equation for the value that is to be delayed, the time and order of the delay and a possible start value. If start value is empty, the start value is set automatically.</p><div class="div image">
<img class="image" src="Images/Delay1.png"><br>
end Delay3_delayClass;
</pre><p class="p">The above definitions can be seen as a line of stocks and valves. The first valve, delay0, is given the value of the delayed expression. Delay3 is given the value of the valve that is coming from the last stock.</p><p class="p">Equations:</p><pre class="pre">Delay3_delayClass_instance.delay0 = Step1;
Delay3 = Delay3_delayClass_instance.delay3;
-</pre></div></article></article><article class="topic nested2" aria-labelledby="ariaid-title18" id="shortcut-and-control-keys"><h3 class="title topictitle3" id="ariaid-title18">Shortcut and Control Keys</h3><div class="body"><p class="p">Shortcut keys for configuring a model on diagram.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="shortcut-and-control-keys__entry__1">Key</th><th class="entry" id="shortcut-and-control-keys__entry__2">Action</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Esc</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Cancel operations (e.g. connection and rename).</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + A</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Auxiliary at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + S</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Stock at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Cloud at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Valve at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + I</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Input at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Shift + G</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Hover Shadow (Ghost) variable at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Alt + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Start an arrow from a variable. End to another variable by clicking left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Alt + right mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Start flow from a variable. End by clicking left mouse button. If a flow is not started or ended on to a variable, a cloud will be created to that end. If a new flow does not have a valve at either end, a valve will be created in the middle of the flow.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Delete</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Remove selected variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">F2</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Rename selected variable</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Select multiple variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Mouse wheel or + or -</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram zoom</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">drag(mouse3)</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">drag(shift + any mouse button)</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">↓, ←, ↑, → (arrow keys)</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Copy selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + X</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Cut selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Paste copied or cut elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + F</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Find element in current diagram or all models</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">G</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Show / hide grid</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">R</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Show / hide ruler</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">1</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Fit diagram contents to screen</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1 ">Ctrl + Space</td><td class="entry" headers="shortcut-and-control-keys__entry__2 ">Content assist in equation editor</td></tr></tbody></table><p class="p">Other shortcut keys can be found selecting Window -> Preferences from the main menu. Keys are located in General -> Keys.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title19" id="unit-validation"><h3 class="title topictitle3" id="ariaid-title19">Unit Validation</h3><div class="body"><p class="p">Unit validation is useful for finding errors in the model. With unit validation, the consistency of the measurement units of variables is checked. For unit validation, the units of all variables in the model must be defined. If a variable is dimensionless, use 1 as the unit. In certain constructs, a dimensionless variable can be used as "a wild card", e.g., adding a dimensionless variable with a dimensioned one is OK.</p><p class="p">Common error sources of unit validation include the following. The respective issues are shown in the picture below.</p><div class="div image">
+</pre></div></article></article><article class="topic nested2" aria-labelledby="ariaid-title18" id="shortcut-and-control-keys"><h3 class="title topictitle3" id="ariaid-title18">Shortcut and Control Keys</h3><div class="body"><p class="p">Shortcut keys for configuring a model on diagram.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="shortcut-and-control-keys__entry__1">Key</th><th class="entry" id="shortcut-and-control-keys__entry__2">Action</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Esc</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Cancel operations (e.g. connection and rename).</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + A</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Auxiliary at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + S</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Stock at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Cloud at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Valve at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + I</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Input at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Shift + G</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Hover Shadow (Ghost) variable at the cursor position, populate with left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Alt + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Start an arrow from a variable. End to another variable by clicking left mouse button.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Alt + right mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Start flow from a variable. End by clicking left mouse button. If a flow is not started or ended on to a variable, a cloud will be created to that end. If a new flow does not have a valve at either end, a valve will be created in the middle of the flow.</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Delete</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Remove selected variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">F2</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Rename selected variable</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + left mouse button</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Select multiple variables</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Mouse wheel or + or -</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram zoom</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">drag(mouse3)</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">drag(shift + right mouse button)</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">↓, ←, ↑, → (arrow keys)</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Diagram pan</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + C</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Copy selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + X</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Cut selected elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + V</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Paste copied or cut elements</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + F</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Find element in current diagram or all models</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">G</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Show / hide grid</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">R</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Show / hide ruler</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">1</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Fit diagram contents to screen</td></tr><tr class="row"><td class="entry" headers="shortcut-and-control-keys__entry__1">Ctrl + Space</td><td class="entry" headers="shortcut-and-control-keys__entry__2">Content assist in equation editor</td></tr></tbody></table><p class="p">Other shortcut keys can be found selecting Window → Preferences from the main menu. Keys are located in General → Keys.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title19" id="unit-validation"><h3 class="title topictitle3" id="ariaid-title19">Unit Validation</h3><div class="body"><p class="p">Unit validation is useful for finding errors in the model. Unit validation checks the consistency of units. To use this feature you need to define units for every variable used in the model. If a variable is dimensionless, use 1 as the unit. In certain constructs, a dimensionless variable can be used as "a wild card", e.g., adding a dimensionless variable with a dimensioned one is OK.</p><p class="p">Common error sources of unit validation include the following. The respective issues are shown in the picture below.</p><div class="div image">
<img class="image" src="Images/UnitValidation.png"><br>
</div><ul class="ul"><li class="li"><p class="p">The equation of a variable yields a different unit than that defined for the variable.</p></li><li class="li"><p class="p">Two variables which have different units are added (+), subtracted (-), or compared (>, <, =, ...).</p></li><li class="li"><p class="p">The output unit of a function is used in an inconsistent manner. (The unit validation for the output unit of a function behaves equivalently to the unit of a variable.)</p></li><li class="li"><p class="p">A function is called with an argument of a prohibited unit.</p></li><li class="li"><p class="p">A variable has an empty unit.</p></li><li class="li"><p class="p">A variable has a misspelled unit.</p></li></ul><p class="p">Unit validation is enabled for a model by selecting the model or its configuration on the model browser and enabling "Validate units" on the properties tab. The unit warnings are shown on Issues view and, supposing the respective profile has been enabled, on the diagram as well. Warnings from unit validation do not prevent simulation.</p><p class="p">For models that have stocks (i.e., integration), the simulation time unit must be selected from the pull-down menu next to the "Validate units" checkbox in Model Properties tab.</p><p class="p">Unit validation can also cope with certain different forms of units, e.g., you can write dollars, dollar, or $ and the validator considers these equal. This functionality can be disabled from Model Properties tab checkbox "Unit equivalents".</p><p class="p">As there may be cases for which the unit validation is for some reason not working as desired, the unitCast() function can be used in the equation of a variable to cast the unit of any expression within the equation to a wildcard. E.g., if expression</p><pre class="pre"> Aux1 + time
</pre><p class="p">yields a warning, it can be fixed be changing the expression to</p><pre class="pre"> unitCast(Aux1) + time
-</pre><p class="p">, in which case the unit of the expression is that of time, or to</p><pre class="pre"> Aux1 + unitCast(time)
-</pre><p class="p">, in which case the unit of the expression is that of Aux1.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title20" id="diagram-profiles"><h3 class="title topictitle3" id="ariaid-title20">Diagram Profiles</h3><div class="body"><p class="p">Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used:</p><p class="p"><strong class="ph b">Default</strong></p><p class="p"><strong class="ph b">Issue warnings</strong></p><p class="p">When enabled, an error or a warning symbol is attached to diagram elements in which there are errors or warnings (usually in the equations).</p><p class="p"><strong class="ph b">Shadow variable visualizations</strong></p><p class="p">When enabled, the original and all the shadow variables are highlighted when one is selected.</p><p class="p"><strong class="ph b">Simulation Playback</strong></p><p class="p"><strong class="ph b">Playback Colors</strong></p><p class="p">When enabled, colors of the elements on diagram change during a playback experiment.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title21" id="visual-model-elements"><h2 class="title topictitle2" id="ariaid-title21">Visual model elements</h2><div class="body"><div class="div hr">
-</div><p class="p">The visual appearance of the elements on diagram can be modified in various ways. In addition, the tool offers are comment symbols which do not affect simulation but help the understandability of models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title22" id="fonts-and-colors"><h3 class="title topictitle3" id="ariaid-title22">Fonts and colors</h3><div class="body"><p class="p">Fonts and colors of diagram elements can be changed by right-clicking the element and selecting Font... The default fonts and colors for each diagram element type can be changed in Window -> Preferences -> Sysdyn Diagrams.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title23" id="dependency-properties"><h3 class="title topictitle3" id="ariaid-title23">Dependency properties</h3><div class="body"><p class="p">Dependency arrow properties can be changed on the property view:</p><p class="p"><strong class="ph b">Polarity</strong></p><p class="p">Polarity sign can be used to indicate whether the dependency increases or decreases the variable it is pointing to. The polarities serve no function for simulation, however, they are used in loop type automatic determination.</p><p class="p"><strong class="ph b">Location</strong></p><p class="p">Location of the polarity mark</p><p class="p"><strong class="ph b">Arrowhead</strong></p><p class="p">Toggle for showing arrowhead</p><p class="p"><strong class="ph b">Delay mark</strong></p><p class="p">Delay mark is a visual cue for helping understandability of the dynamics of the model when there are (information) delays. A delay mark is usually added to the dependency arrow when the effect the tail of the dependency has on the head of the dependency is delayed.</p><p class="p"><strong class="ph b">Line thickness</strong></p><p class="p">Thickness of the arrow</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title24" id="loops"><h3 class="title topictitle3" id="ariaid-title24">Loops</h3><div class="body"><p class="p">A loop element is a graphical component for highlighting feedback loops in a model. Usually the most interesting feedback loops that affect the behaviour of the model most are marked with a loop symbol.</p><p class="p"><strong class="ph b">Loop Items</strong></p><p class="p">The loop of variables which the loop symbol refers can be selected for visualization purposes.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">Comment inside the loop. Usually characters 'B' and 'R' are used to denote balancing and reinforcing loops, respectfully. A feedback loop is reinforcing if and only if it has an even number of negative dependencies. Selecting 'Auto' determines automatically the type of the loop.</p><p class="p"><strong class="ph b">Direction of Rotation</strong></p><p class="p">Direction to which the loop rotates on diagram.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title25" id="comments"><h3 class="title topictitle3" id="ariaid-title25">Comments</h3><div class="body"><p class="p">Comments are just strings of text.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title26" id="simulation"><h2 class="title topictitle2" id="ariaid-title26">Simulation</h2><div class="body"><div class="div hr">
-</div></div><article class="topic nested2" aria-labelledby="ariaid-title27" id="experiments"><h3 class="title topictitle3" id="ariaid-title27">Experiments</h3><div class="body"><p class="p">There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics.</p><p class="p">Experiments are created from the context menu of experiments folder in a model.</p><div class="div image">
+</pre><p class="p">in which case the unit of the expression is that of time, or to</p><pre class="pre"> Aux1 + unitCast(time)
+</pre><p class="p">in which case the unit of the expression is that of Aux1.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title20" id="diagram-profiles"><h3 class="title topictitle3" id="ariaid-title20">Diagram Profiles</h3><div class="body"><p class="p">Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used:</p><p class="p"><strong class="ph b">Default</strong></p><p class="p"><strong class="ph b">Issue warnings</strong></p><p class="p">When enabled, an error or a warning symbol is attached to diagram elements in which there are errors or warnings (usually in the equations).</p><p class="p"><strong class="ph b">Shadow variable visualizations</strong></p><p class="p">When enabled, the original and all the shadow variables are highlighted when one is selected.</p><p class="p"><strong class="ph b">Simulation Playback</strong></p><p class="p"><strong class="ph b">Playback Colors</strong></p><p class="p">When enabled, colors of the elements on diagram change during a playback experiment.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title21" id="debugging-a-model"><h3 class="title topictitle3" id="ariaid-title21">Debugging a model</h3><div class="body"><p class="p">If you find yourself with a model that doesn't simulate or has bizarre behavior, there are several places to look for clues for what went wrong. Firstly, if you got an error message and can't infer the problem straight from the message, look at the issues view if it can tell you what is wrong in different words. If you know how to read Modelica code, right click Configuration under the broken model and choose Open With → Modelica Code Viewer. The tool works by generating Modelica code from the graphical model and then solving it. Therefore, if something is broken it means that there is a problem with the generated Modelica code (or, very rarely, a bug in the solver you are using). You can also refer to the list below, if you still find yourself stuck.</p><p class="p">Some of the most common errors include:</p><ul class="ul"><li class="li"><p class="p">In a model that uses modules, you forget to connect inputs and/or outputs in the module properties</p></li><li class="li"><p class="p">You forgot to add an enumeration to a variable, i.e. trying to put a vector to a scalar variable (or vice versa)</p></li><li class="li"><p class="p">You increased the enumeration indices you are using, but forget to update a variable that depend on it</p></li><li class="li"><p class="p">You wrote a custom Modelica function, but it is broken</p></li><li class="li"><p class="p">You are comparing two numbers for equality while using OpenModelica solver (forbidden, allowed by the internal solver)</p></li><li class="li"><p class="p">You have a variable that refers to itself in the equation, making the solver unable find an initial value</p></li></ul><p class="p">If you are using OpenModelica solver it can be very useful to google error messages printed in the console of the tool.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title22" id="visual-model-elements"><h2 class="title topictitle2" id="ariaid-title22">Visual model elements</h2><div class="body"><div class="div hr">
+</div><p class="p">The visual appearance of the elements on diagram can be modified in various ways. In addition, the tool has comment symbols which do not affect simulation but help the understandability of models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title23" id="fonts-and-colors"><h3 class="title topictitle3" id="ariaid-title23">Fonts and colors</h3><div class="body"><p class="p">Fonts and colors of diagram elements can be changed by right-clicking the element and selecting Font... The default fonts and colors for each diagram element type can be changed in Window → Preferences → Sysdyn Diagrams.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title24" id="dependency-properties"><h3 class="title topictitle3" id="ariaid-title24">Dependency properties</h3><div class="body"><p class="p">Dependency arrow properties can be changed on the property view:</p><p class="p"><strong class="ph b">Polarity</strong></p><p class="p">Polarity sign can be used to indicate whether the dependency increases or decreases the variable it is pointing to. The polarities serve no function for simulation, however, they are used in loop type automatic determination.</p><p class="p"><strong class="ph b">Location</strong></p><p class="p">Location of the polarity mark</p><p class="p"><strong class="ph b">Arrowhead</strong></p><p class="p">Toggle for showing arrowhead</p><p class="p"><strong class="ph b">Delay mark</strong></p><p class="p">Delay mark is a visual cue for helping understandability of the dynamics of the model when there are (information) delays. A delay mark is usually added to the dependency arrow when the effect the tail of the dependency has on the head of the dependency is delayed.</p><p class="p"><strong class="ph b">Line thickness</strong></p><p class="p">Thickness of the arrow</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title25" id="loops"><h3 class="title topictitle3" id="ariaid-title25">Loops</h3><div class="body"><p class="p">A loop element is a graphical component for highlighting feedback loops in a model. Usually the most interesting feedback loops that affect the behaviour of the model most are marked with a loop symbol.</p><p class="p"><strong class="ph b">Loop Items</strong></p><p class="p">The loop of variables which the loop symbol refers can be selected for visualization purposes.</p><p class="p"><strong class="ph b">Comment</strong></p><p class="p">Comment inside the loop. Usually characters 'B' and 'R' are used to denote balancing and reinforcing loops, respectfully. A feedback loop is reinforcing if and only if it has an even number of negative dependencies. Selecting 'Auto' determines automatically the type of the loop.</p><p class="p"><strong class="ph b">Direction of Rotation</strong></p><p class="p">Direction to which the loop rotates on diagram.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title26" id="comments"><h3 class="title topictitle3" id="ariaid-title26">Comments</h3><div class="body"><p class="p">Comments are just strings of text.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title27" id="simulation"><h2 class="title topictitle2" id="ariaid-title27">Simulation</h2><div class="body"><div class="div hr">
+</div></div><article class="topic nested2" aria-labelledby="ariaid-title28" id="experiments"><h3 class="title topictitle3" id="ariaid-title28">Experiments</h3><div class="body"><p class="p">There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics. Currently some of the experiment and solver combinations are still in development.</p><p class="p">Experiments are created from the context menu of experiments folder in a model.</p><div class="div image">
<img class="image" src="Images/NewExperiment.png"><br>
-</div><p class="p">Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar.</p><p class="p"><strong class="ph b">Normal simulation</strong></p><p class="p">Experiment is the basic simulation type. It simulates a model from start time to end time and results can be viewed after the simulation has been run.</p><p class="p"><strong class="ph b">Game simulation</strong></p><p class="p">Game simulations allow simulating an arbitrary number of steps, changing parameter values and continuing simulation with the new values from where it previously ended.</p><p class="p"><strong class="ph b">Simulation playback</strong></p><p class="p">Simulation playback works essentially as the basic experiment, but it offers some additional visualization options.</p><p class="p"><strong class="ph b">Sensitivity analysis simulation</strong></p><p class="p">Sensitivity analysis allows running <a class="xref" href="http://en.wikipedia.org/wiki/Multivariate_analysis" target="_blank">multivariate</a> <a class="xref" href="http://en.wikipedia.org/wiki/Monte_Carlo_method" target="_blank">Monte Carlo simulations</a> with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters.</p><div class="div image">
+</div><p class="p">Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar.</p><p class="p"><strong class="ph b">Normal simulation</strong></p><p class="p">Experiment is the basic simulation type. It simulates a model from start time to end time and results can be viewed after the simulation has been run. Works on both the internal and OpenModelica solvers.</p><p class="p"><strong class="ph b">Game simulation</strong></p><p class="p">Game simulations allow simulating an arbitrary number of steps, changing parameter values and continuing simulation with the new values from where it previously ended. Works on the internal solver, OpenModelica version still in development.</p><p class="p"><strong class="ph b">Simulation playback</strong></p><p class="p">Simulation playback works essentially as the basic experiment, but it offers some additional visualization options. Works on both solvers.</p><p class="p"><strong class="ph b">Sensitivity analysis simulation</strong></p><p class="p">Sensitivity analysis allows running <a class="xref" href="http://en.wikipedia.org/wiki/Multivariate_analysis" target="_blank" rel="external noopener">multivariate</a> <a class="xref" href="http://en.wikipedia.org/wiki/Monte_Carlo_method" target="_blank" rel="external noopener">Monte Carlo simulations</a> with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters. Works on OpenModelica solver, internal solver implementation still in development.</p><div class="div image">
<img class="image" src="Images/SensitivityExperiment.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="experiments__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="experiments__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="experiments__entry__1 ">Name</td><td class="entry" headers="experiments__entry__2 ">The name of the sensitivity analysis experiment. Displayed in e.g. model browser.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Number of runs</td><td class="entry" headers="experiments__entry__2 ">The total amount of individual simulation runs</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Method</td><td class="entry" headers="experiments__entry__2 ">The method of how the parameter values are selected from the distribution(s). Selecting "Random" yields <a class="xref" href="http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers" target="_blank">pseudo-random</a> values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a <a class="xref" href="http://en.wikipedia.org/wiki/Quasi-random" target="_blank">quasi-random</a> <a class="xref" href="http://en.wikipedia.org/wiki/Halton_sequence" target="_blank">Halton sequence</a> of values selected deterministically to represent the distribution(s) better than a pseudo-random series.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Seed</td><td class="entry" headers="experiments__entry__2 ">The seed number for pseudo-random generator</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Add parameter</td><td class="entry" headers="experiments__entry__2 ">Adds a new parameter to be varied</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Remove</td><td class="entry" headers="experiments__entry__2 ">Removes a parameter</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 "><strong class="ph b">Parameter properties</strong></td><td class="entry" headers="experiments__entry__2 ">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Variable</td><td class="entry" headers="experiments__entry__2 ">The full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Range</td><td class="entry" headers="experiments__entry__2 ">Used with multidimensional values to select which dimensions are varied.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Distribution</td><td class="entry" headers="experiments__entry__2 ">Probability distribution for the varied parameter. "Normal" is for <a class="xref" href="http://en.wikipedia.org/wiki/Truncated_normal_distribution" target="_blank">truncated normal distribution</a> and "Uniform" for <a class="xref" href="http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)" target="_blank">uniform distribution</a>. With "Interval" the values have equal intervals between each other and are selected in increasing order. In multivariate sensitivity analyses, it is recommended to select either "Normal" or "Uniform".</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 "><strong class="ph b">Distribution properties</strong></td><td class="entry" headers="experiments__entry__2 ">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Min value</td><td class="entry" headers="experiments__entry__2 ">Minimum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Max value</td><td class="entry" headers="experiments__entry__2 ">Maximum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Mean</td><td class="entry" headers="experiments__entry__2 ">Mean of the normal distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1 ">Standard deviation</td><td class="entry" headers="experiments__entry__2 ">Standard deviation of the normal distribution</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title28" id="solvers"><h3 class="title topictitle3" id="ariaid-title28">Solvers</h3><div class="body"><p class="p">Simantics System Dynamics allows using the multiple solvers provided by OpenModelica, like Euler, Runge-Kutta, DASSL, etc. OpenModelica is currently the main simulation environment behind the tool and all functionalities are supported with OpenModelica.</p><p class="p">Alternatively to OpenModelica, an internal custom Modelica solver is included in Simantics System Dynamics. The custom solver is currently at an experimental state, and thus all functionalities of the tool are not yet supported, e.g., only the basic experiment can be run with it. The advantage of the custom solver is, however, that simulation is usually a lot faster than with OpenModelica. Try out yourself which solver suits best for your needs.</p><p class="p">The solver can be changed in Windows -> Preferences -> Solver.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title29" id="simulation-result-and-model-structure-analysis"><h2 class="title topictitle2" id="ariaid-title29">Simulation Result and Model Structure Analysis</h2><div class="body"><div class="div hr">
-</div><p class="p">Simulation results can be viewed as trends in the trend view or as plain numbers in the values view. The views display results of variables that are selected in the workbench. Users can also create <a class="xref" href="#custom-charts">custom charts</a>.</p><p class="p">Model structure can be examined in the Structure view. There are three options: dependency structures of individual variables, the complete hierarchy structure of the model, or the feedback loops which individual variables belong to.</p><p class="p"><strong class="ph b">Trend</strong></p><p class="p">Shows you the values of the selected variable(s) graphically over the simulation time. You can modify the trend and zoom it using the context menu (right-click) of the trend.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="experiments__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="experiments__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="experiments__entry__1">Name</td><td class="entry" headers="experiments__entry__2">The name of the sensitivity analysis experiment. Displayed in e.g. model browser.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Number of runs</td><td class="entry" headers="experiments__entry__2">The total amount of individual simulation runs</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Method</td><td class="entry" headers="experiments__entry__2">The method of how the parameter values are selected from the distribution(s). Selecting "Random" yields <a class="xref" href="http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers" target="_blank" rel="external noopener">pseudo-random</a> values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a <a class="xref" href="http://en.wikipedia.org/wiki/Quasi-random" target="_blank" rel="external noopener">quasi-random</a> <a class="xref" href="http://en.wikipedia.org/wiki/Halton_sequence" target="_blank" rel="external noopener">Halton sequence</a> of values selected deterministically to represent the distribution(s) better than a pseudo-random series.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Seed</td><td class="entry" headers="experiments__entry__2">The seed number for pseudo-random generator</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Add parameter</td><td class="entry" headers="experiments__entry__2">Adds a new parameter to be varied</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Remove</td><td class="entry" headers="experiments__entry__2">Removes a parameter</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1"><strong class="ph b">Parameter properties</strong></td><td class="entry" headers="experiments__entry__2">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Variable</td><td class="entry" headers="experiments__entry__2">The full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Range</td><td class="entry" headers="experiments__entry__2">Used with multidimensional values to select which dimensions are varied.</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Distribution</td><td class="entry" headers="experiments__entry__2">Probability distribution for the varied parameter. "Normal" is for <a class="xref" href="http://en.wikipedia.org/wiki/Truncated_normal_distribution" target="_blank" rel="external noopener">truncated normal distribution</a> and "Uniform" for <a class="xref" href="http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)" target="_blank" rel="external noopener">uniform distribution</a>. With "Interval" the values have equal intervals between each other and are selected in increasing order. In multivariate sensitivity analyses, it is recommended to select either "Normal" or "Uniform".</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1"><strong class="ph b">Distribution properties</strong></td><td class="entry" headers="experiments__entry__2">-</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Min value</td><td class="entry" headers="experiments__entry__2">Minimum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Max value</td><td class="entry" headers="experiments__entry__2">Maximum value of the distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Mean</td><td class="entry" headers="experiments__entry__2">Mean of the normal distribution</td></tr><tr class="row"><td class="entry" headers="experiments__entry__1">Standard deviation</td><td class="entry" headers="experiments__entry__2">Standard deviation of the normal distribution</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title29" id="solvers"><h3 class="title topictitle3" id="ariaid-title29">Solvers</h3><div class="body"><p class="p">Simantics System Dynamics allows using the multiple solvers provided by OpenModelica, like Euler, Runge-Kutta, DASSL, etc. OpenModelica is currently the main simulation environment behind the tool and all functionalities are supported with OpenModelica.</p><p class="p">Alternatively to OpenModelica, an internal custom Modelica solver is included in Simantics System Dynamics. The custom solver is currently at an experimental state, and thus all functionalities of the tool are not yet supported, e.g., only the basic experiment can be run with it. The advantage of the custom solver is, however, that simulation is usually a lot faster than with OpenModelica. Try out yourself which solver suits best for your needs.</p><p class="p">The solver can be changed in Windows → Preferences → Solver.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title30" id="simulation-result-and-model-structure-analysis"><h2 class="title topictitle2" id="ariaid-title30">Simulation Result and Model Structure Analysis</h2><div class="body"><div class="div hr">
+</div><p class="p">Simulation results can be viewed as trends in the trend view or as plain numbers in the values view. The views display results of variables that are selected in the workbench. Users can also create <a class="xref" href="#custom-charts">custom charts</a>.</p><p class="p">Model structure can be examined in the Structure view. There are three options: dependency structures of individual variables, the complete hierarchy structure of the model, or the feedback loops which individual variables belong to.</p><p class="p"><strong class="ph b">Trend</strong></p><p class="p">Shows you the values of the selected variable(s) graphically over the simulation time. You can modify the trend and zoom it using the context menu (right-click) of the trend. You can also export the trend using controls in the upper right corner.</p><div class="div image">
<img class="image" src="Images/Trend.png"><br>
</div><p class="p"><strong class="ph b">Values</strong></p><p class="p">Shows you the values of the selected variable(s) in a table form. If the value has a star (*) at the end, it means that the value is an approximate. There is no value for that variable for the given time step. Selected values can be copied to other software in csv format.</p><div class="div image">
<img class="image" src="Images/Values.png"><br>
-</div><p class="p"><strong class="ph b">Compare results</strong></p><p class="p">You can compare different results of the same model by saving simulation results and displaying the saved results side by side with other results. You can save your results after simulating by clicking the Save Results button:</p><div class="div image">
+</div><p class="p"><strong class="ph b">Compare results</strong></p><p class="p">You can compare different results of the same model by saving simulation results and displaying the saved results side by side with other results. This functionality currently only works for the OpenModelica solver, internal solver implementation is in development. You can save your results after simulating by clicking the Save Results button:</p><div class="div image">
<img class="image" src="Images/Saveresults.png"><br>
-</div><p class="p">on your experiment controls. The saved results appear to model browser under the active experiment. To show the results on trends and tables, right-click on the result and select Show on charts.</p><div class="div image">
+</div><p class="p">on your experiment controls. The saved results appear to model browser under the active experiment. To show the results on trends and tables, double click on the result to activate it.</p><div class="div image">
<img class="image" src="Images/CompareTrend.png"><br>
</div><p class="p"><strong class="ph b">Dependencies</strong></p><p class="p">Dependencies display which variables affect and which are affected by the selected variable. The direction and number of steps that are traveled from the selected variable can be configured at the bottom of the view.</p><div class="div image">
<img class="image" src="Images/Dependencies.png"><br>
<img class="image" src="Images/ModelHierarchy.png"><br>
</div><p class="p"><strong class="ph b">Loops</strong></p><p class="p">Loops display all feedback loops which the selected variable belongs to.</p><div class="div image">
<img class="image" src="Images/Loops.png"><br>
-</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title30" id="custom-charts"><h2 class="title topictitle2" id="ariaid-title30">Custom Charts</h2><div class="body"><div class="div hr">
+</div></div></article><article class="topic nested1" aria-labelledby="ariaid-title31" id="custom-charts"><h2 class="title topictitle2" id="ariaid-title31">Custom Charts</h2><div class="body"><div class="div hr">
</div><p class="p">Custom charts are user-defined displays of simulation result data. They can be used and re-used in various places. The four types of custom charts (line, sensitivity, bar, and pie charts) provide model developers means for examining and developing their models and communicating the simulation results to others.</p><p class="p">Custom charts are created to the Charts folder in model browser.</p><div class="div image">
<img class="image" src="Images/NewChart.png"><br>
-</div><p class="p">Charts are configured the same way as variables: first select the chart from model browser and then configure it in the property view. Charts can be viewed in the same active trend view as any variable by selecting the chart from model browser. In addition to trend view, charts can be populated directly to the model diagram by dragging them from the model browser. Charts can also be added to a separate chart panel which can contain multiple charts.</p></div><article class="topic nested2" aria-labelledby="ariaid-title31" id="line-chart"><h3 class="title topictitle3" id="ariaid-title31">Line Chart</h3><div class="body"><p class="p">Line chart shows the time series of a variable. It is capable of displaying multiple multi-dimensional variables at the same time. Simulation playback mode adds a marker to the chart to display the current time in playback simulation. Below is an example chart and its settings.</p><div class="div image">
+</div><p class="p">Charts are configured the same way as variables: first select the chart from model browser and then configure it in the property view. Charts can be viewed in the same active trend view as any variable by selecting the chart from model browser. In addition to trend view, charts can be populated directly to the model diagram by dragging them from the model browser. Charts can also be added to a separate chart panel which can contain multiple charts.</p></div><article class="topic nested2" aria-labelledby="ariaid-title32" id="line-chart"><h3 class="title topictitle3" id="ariaid-title32">Line Chart</h3><div class="body"><p class="p">Line chart shows the time series of a variable. It is capable of displaying multiple multi-dimensional variables at the same time. Simulation playback mode adds a marker to the chart to display the current time in playback simulation. Below is an example chart and its settings.</p><div class="div image">
<img class="image" src="Images/LineChart.png"><br>
</div><div class="div image">
<img class="image" src="Images/LineChartGeneral.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="line-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Name</td><td class="entry" headers="line-chart__entry__2 ">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Title</td><td class="entry" headers="line-chart__entry__2 ">The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Type</td><td class="entry" headers="line-chart__entry__2 ">Line chart (default) or area chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Hide</td><td class="entry" headers="line-chart__entry__2 ">Options to hide chart grid, title or legend</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 "><strong class="ph b">X-axis</strong></td><td class="entry" headers="line-chart__entry__2 ">-</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Variable</td><td class="entry" headers="line-chart__entry__2 ">A variable that is used as the x-axis variable. The default variable is time and it needs not to be typed in the field.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Label</td><td class="entry" headers="line-chart__entry__2 ">Optional other label for the variable than its name</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Min</td><td class="entry" headers="line-chart__entry__2 ">Minimum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Max</td><td class="entry" headers="line-chart__entry__2 ">Maximum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1 ">Hide</td><td class="entry" headers="line-chart__entry__2 ">Options to hide x-axis label, line, tick marks and tick labels</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="line-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__1">Name</td><td class="entry" headers="line-chart__entry__2">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Title</td><td class="entry" headers="line-chart__entry__2">The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Type</td><td class="entry" headers="line-chart__entry__2">Line chart (default) or area chart</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Hide</td><td class="entry" headers="line-chart__entry__2">Options to hide chart grid, title or legend</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1"><strong class="ph b">X-axis</strong></td><td class="entry" headers="line-chart__entry__2">-</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Variable</td><td class="entry" headers="line-chart__entry__2">A variable that is used as the x-axis variable. The default variable is time and it needs not to be typed in the field.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Label</td><td class="entry" headers="line-chart__entry__2">Optional other label for the variable than its name</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Min</td><td class="entry" headers="line-chart__entry__2">Minimum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Max</td><td class="entry" headers="line-chart__entry__2">Maximum value of the x-axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__1">Hide</td><td class="entry" headers="line-chart__entry__2">Options to hide x-axis label, line, tick marks and tick labels</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/LineChartAxisAndVariables.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__23"><strong class="ph b">Variable</strong></th><th class="entry" id="line-chart__entry__24">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Variable</td><td class="entry" headers="line-chart__entry__24 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Range</td><td class="entry" headers="line-chart__entry__24 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Label</td><td class="entry" headers="line-chart__entry__24 ">Optional label for the variable. If label is empty, the variable name is displayed.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Color</td><td class="entry" headers="line-chart__entry__24 ">Color for the lines of this variable</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23 ">Line width</td><td class="entry" headers="line-chart__entry__24 ">The width of the lines drawn for this variable</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__35"><strong class="ph b">Y-axis</strong></th><th class="entry" id="line-chart__entry__36">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Label</td><td class="entry" headers="line-chart__entry__36 ">Label of the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Min</td><td class="entry" headers="line-chart__entry__36 ">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Max</td><td class="entry" headers="line-chart__entry__36 ">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Color</td><td class="entry" headers="line-chart__entry__36 ">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35 ">Hide</td><td class="entry" headers="line-chart__entry__36 ">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title32" id="sensitivity-chart"><h3 class="title topictitle3" id="ariaid-title32">Sensitivity Chart</h3><div class="body"><p class="p">Sensitivity chart shows the time series of a variable with confidence bounds. Below is an example chart and its settings. The general settings are defined similarly to those of a line chart explained above.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__23"><strong class="ph b">Variable</strong></th><th class="entry" id="line-chart__entry__24">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__23">Variable</td><td class="entry" headers="line-chart__entry__24">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Range</td><td class="entry" headers="line-chart__entry__24">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Label</td><td class="entry" headers="line-chart__entry__24">Optional label for the variable. If label is empty, the variable name is displayed.</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Color</td><td class="entry" headers="line-chart__entry__24">Color for the lines of this variable</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__23">Line width</td><td class="entry" headers="line-chart__entry__24">The width of the lines drawn for this variable</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="line-chart__entry__35"><strong class="ph b">Y-axis</strong></th><th class="entry" id="line-chart__entry__36">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="line-chart__entry__35">Label</td><td class="entry" headers="line-chart__entry__36">Label of the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Min</td><td class="entry" headers="line-chart__entry__36">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Max</td><td class="entry" headers="line-chart__entry__36">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Color</td><td class="entry" headers="line-chart__entry__36">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="line-chart__entry__35">Hide</td><td class="entry" headers="line-chart__entry__36">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title33" id="sensitivity-chart"><h3 class="title topictitle3" id="ariaid-title33">Sensitivity Chart</h3><div class="body"><p class="p">Sensitivity chart shows the time series of a variable with confidence bounds. Below is an example chart and its settings. The general settings are defined similarly to those of a line chart explained above.</p><div class="div image">
<img class="image" src="Images/SensitivityChart.png"><br>
</div><div class="div image">
<img class="image" src="Images/SensitivityChartAxisAndVariables.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__1"><strong class="ph b">Axis and Variables</strong></th><th class="entry" id="sensitivity-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Variable</td><td class="entry" headers="sensitivity-chart__entry__2 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Range</td><td class="entry" headers="sensitivity-chart__entry__2 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Display median</td><td class="entry" headers="sensitivity-chart__entry__2 ">Display the median value of the variable at each time step.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1 ">Confidence bounds and colors</td><td class="entry" headers="sensitivity-chart__entry__2 ">The confidence bounds in percents and colors for them.</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__11"><strong class="ph b">Y-axis</strong></th><th class="entry" id="sensitivity-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Label</td><td class="entry" headers="sensitivity-chart__entry__12 ">Label of the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Min</td><td class="entry" headers="sensitivity-chart__entry__12 ">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Max</td><td class="entry" headers="sensitivity-chart__entry__12 ">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Color</td><td class="entry" headers="sensitivity-chart__entry__12 ">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11 ">Hide</td><td class="entry" headers="sensitivity-chart__entry__12 ">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title33" id="bar-chart"><h3 class="title topictitle3" id="ariaid-title33">Bar Chart</h3><div class="body"><p class="p">Bar charts display variables in a certain point in time. The point can be defined for the complete chart in chart's general settings and individually for each variable in variable's settings. If no time is defined, the last simulation step is shown in game or normal simulation mode. Playback mode displays the current playback time.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__1"><strong class="ph b">Axis and Variables</strong></th><th class="entry" id="sensitivity-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Variable</td><td class="entry" headers="sensitivity-chart__entry__2">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Range</td><td class="entry" headers="sensitivity-chart__entry__2">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Display median</td><td class="entry" headers="sensitivity-chart__entry__2">Display the median value of the variable at each time step.</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__1">Confidence bounds and colors</td><td class="entry" headers="sensitivity-chart__entry__2">The confidence bounds in percentages and colors for them.</td></tr></tbody></table><p class="p">There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="sensitivity-chart__entry__11"><strong class="ph b">Y-axis</strong></th><th class="entry" id="sensitivity-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Label</td><td class="entry" headers="sensitivity-chart__entry__12">Label of the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Min</td><td class="entry" headers="sensitivity-chart__entry__12">Minimum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Max</td><td class="entry" headers="sensitivity-chart__entry__12">Maximum value in the axis</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Color</td><td class="entry" headers="sensitivity-chart__entry__12">The color of the axis lines, ticks and labels</td></tr><tr class="row"><td class="entry" headers="sensitivity-chart__entry__11">Hide</td><td class="entry" headers="sensitivity-chart__entry__12">Options to hide parts of the axis: label, axis line, tick marks, tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title34" id="bar-chart"><h3 class="title topictitle3" id="ariaid-title34">Bar Chart</h3><div class="body"><p class="p">Bar charts display variables in a certain point in time. The point can be defined for the complete chart in chart's general settings and individually for each variable in variable's settings. If no time is defined, the last simulation step is shown in game or normal simulation mode. Playback mode displays the current playback time.</p><div class="div image">
<img class="image" src="Images/BarChartGeneral.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="bar-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Name</td><td class="entry" headers="bar-chart__entry__2 ">The name of the chart. Name is displayed in model browser.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Title</td><td class="entry" headers="bar-chart__entry__2 ">The title of the chart. Title is displayed in the chart, if not hidden</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Type</td><td class="entry" headers="bar-chart__entry__2 ">Normal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Time</td><td class="entry" headers="bar-chart__entry__2 ">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1 ">Hide</td><td class="entry" headers="bar-chart__entry__2 ">Option for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed.</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="bar-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__1">Name</td><td class="entry" headers="bar-chart__entry__2">The name of the chart. Name is displayed in model browser.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Title</td><td class="entry" headers="bar-chart__entry__2">The title of the chart. Title is displayed in the chart, if not hidden</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Type</td><td class="entry" headers="bar-chart__entry__2">Normal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Time</td><td class="entry" headers="bar-chart__entry__2">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__1">Hide</td><td class="entry" headers="bar-chart__entry__2">Option for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed.</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/BarChartInDiagram.png"><br>
</div><p class="p">Charts can be added to model diagrams simply by dragging the chart from model browser to diagram.</p><div class="div image">
<img class="image" src="Images/BarChartVariable.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__13"><strong class="ph b">Variable</strong></th><th class="entry" id="bar-chart__entry__14">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Add / Remove</td><td class="entry" headers="bar-chart__entry__14 ">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Variable</td><td class="entry" headers="bar-chart__entry__14 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Range</td><td class="entry" headers="bar-chart__entry__14 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Label</td><td class="entry" headers="bar-chart__entry__14 ">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13 ">Time</td><td class="entry" headers="bar-chart__entry__14 ">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__13"><strong class="ph b">Variable</strong></th><th class="entry" id="bar-chart__entry__14">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__13">Add / Remove</td><td class="entry" headers="bar-chart__entry__14">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Variable</td><td class="entry" headers="bar-chart__entry__14">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Range</td><td class="entry" headers="bar-chart__entry__14">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Label</td><td class="entry" headers="bar-chart__entry__14">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__13">Time</td><td class="entry" headers="bar-chart__entry__14">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/BarChartAxis.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__25"><strong class="ph b">Domain axis</strong></th><th class="entry" id="bar-chart__entry__26">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Label</td><td class="entry" headers="bar-chart__entry__26 ">An optional label for x axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Label angle</td><td class="entry" headers="bar-chart__entry__26 ">Axis labels can be displayed in an angle. This value determines the angle in degrees.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Color</td><td class="entry" headers="bar-chart__entry__26 ">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Hide</td><td class="entry" headers="bar-chart__entry__26 ">Options for hiding axis label, line, tick marks and tick labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 "><strong class="ph b">Range axis</strong></td><td class="entry" headers="bar-chart__entry__26 ">-</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Label</td><td class="entry" headers="bar-chart__entry__26 ">An optional label for y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Min</td><td class="entry" headers="bar-chart__entry__26 ">Minimum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Max</td><td class="entry" headers="bar-chart__entry__26 ">Maximum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Color</td><td class="entry" headers="bar-chart__entry__26 ">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25 ">Hide</td><td class="entry" headers="bar-chart__entry__26 ">Options for hiding axis label, line, tick marks and tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title34" id="pie-chart"><h3 class="title topictitle3" id="ariaid-title34">Pie Chart</h3><div class="body"><p class="p">Pie charts display proportions of variables at a certain time. The time, similar to bar charts, can be configured for the whole chart and individually for each variable. If no time is configured, the value at the latest time step (or the time of simulation playback) is displayed.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="bar-chart__entry__25"><strong class="ph b">Domain axis</strong></th><th class="entry" id="bar-chart__entry__26">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="bar-chart__entry__25">Label</td><td class="entry" headers="bar-chart__entry__26">An optional label for x axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Label angle</td><td class="entry" headers="bar-chart__entry__26">Axis labels can be displayed in an angle. This value determines the angle in degrees.</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Color</td><td class="entry" headers="bar-chart__entry__26">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Hide</td><td class="entry" headers="bar-chart__entry__26">Options for hiding axis label, line, tick marks and tick labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25"><strong class="ph b">Range axis</strong></td><td class="entry" headers="bar-chart__entry__26">-</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Label</td><td class="entry" headers="bar-chart__entry__26">An optional label for y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Min</td><td class="entry" headers="bar-chart__entry__26">Minimum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Max</td><td class="entry" headers="bar-chart__entry__26">Maximum value of y axis</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Color</td><td class="entry" headers="bar-chart__entry__26">The color of the axis line, tick lines and labels</td></tr><tr class="row"><td class="entry" headers="bar-chart__entry__25">Hide</td><td class="entry" headers="bar-chart__entry__26">Options for hiding axis label, line, tick marks and tick labels</td></tr></tbody></table></div></article><article class="topic nested2" aria-labelledby="ariaid-title35" id="pie-chart"><h3 class="title topictitle3" id="ariaid-title35">Pie Chart</h3><div class="body"><p class="p">Pie charts display proportions of variables at a certain time. The time, similar to bar charts, can be configured for the whole chart and individually for each variable. If no time is configured, the value at the latest time step (or the time of simulation playback) is displayed.</p><div class="div image">
<img class="image" src="Images/PieChartGeneral.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="pie-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Name</td><td class="entry" headers="pie-chart__entry__2 ">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Title</td><td class="entry" headers="pie-chart__entry__2 ">Title The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Time</td><td class="entry" headers="pie-chart__entry__2 ">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1 ">Hide</td><td class="entry" headers="pie-chart__entry__2 ">Options for hiding title, section labels and legend</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__1"><strong class="ph b">General</strong></th><th class="entry" id="pie-chart__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__1">Name</td><td class="entry" headers="pie-chart__entry__2">The name of the chart. Displayed in e.g. model browser</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1">Title</td><td class="entry" headers="pie-chart__entry__2">Title The title of the chart. Displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1">Time</td><td class="entry" headers="pie-chart__entry__2">A general time setting for the entire chart. The values at this time are displayed in the chart</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__1">Hide</td><td class="entry" headers="pie-chart__entry__2">Options for hiding title, section labels and legend</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/PieChartVariable.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__11"><strong class="ph b">Variables</strong></th><th class="entry" id="pie-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Add / Remove</td><td class="entry" headers="pie-chart__entry__12 ">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Variable</td><td class="entry" headers="pie-chart__entry__12 ">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Range</td><td class="entry" headers="pie-chart__entry__12 ">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Label</td><td class="entry" headers="pie-chart__entry__12 ">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Color</td><td class="entry" headers="pie-chart__entry__12 ">Color for the sector of this variable</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Time</td><td class="entry" headers="pie-chart__entry__12 ">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11 ">Exploded</td><td class="entry" headers="pie-chart__entry__12 ">If set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart</td></tr></tbody></table><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="pie-chart__entry__11"><strong class="ph b">Variables</strong></th><th class="entry" id="pie-chart__entry__12">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="pie-chart__entry__11">Add / Remove</td><td class="entry" headers="pie-chart__entry__12">Add or remove variables</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Variable</td><td class="entry" headers="pie-chart__entry__12">The full path of the variable. This field has content assistant, which shows the possible variables as you type.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Range</td><td class="entry" headers="pie-chart__entry__12">If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Label</td><td class="entry" headers="pie-chart__entry__12">Optional label for the variable. If label is empty, the variable name is displayed</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Color</td><td class="entry" headers="pie-chart__entry__12">Color for the sector of this variable</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Time</td><td class="entry" headers="pie-chart__entry__12">The time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.</td></tr><tr class="row"><td class="entry" headers="pie-chart__entry__11">Exploded</td><td class="entry" headers="pie-chart__entry__12">If set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart</td></tr></tbody></table><div class="div image">
<img class="image" src="Images/PieChartChartPanel.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title35" id="chart-panel"><h3 class="title topictitle3" id="ariaid-title35">Chart Panel</h3><div class="body"><p class="p">Chart panel is able to house multiple charts at the same time. Chart panel is a normal view in the workbench, which means it can be resized and located anywhere in the workbench. Eclipse also allows detaching the tab completely from the workbench, which means that the chart panel can be dragged to another screen.</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title36" id="chart-panel"><h3 class="title topictitle3" id="ariaid-title36">Chart Panel</h3><div class="body"><p class="p">Chart panel is able to house multiple charts at the same time. Chart panel is a normal view in the workbench, which means it can be resized and located anywhere in the workbench. Eclipse also allows detaching the tab completely from the workbench, which means that the chart panel can be dragged to another screen.</p><div class="div image">
<img class="image" src="Images/ChartPanel.png"><br>
</div><p class="p">Chart panel can be either horizontally or vertically oriented. Different orientations help in configuring the workbench perspective.</p><div class="div image">
<img class="image" src="Images/ChartPanelOrientation.png"><br>
-</div><p class="p">Charts are added to the panel by dragging from model browser. The order of the charts is easily changed by dragging charts from their header. Charts can be minimized or completely removed from the buttons in their headers.</p><p class="p">By default, chart panel is hidden in the upper-right corner of the system dynamics perspective.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title36" id="multidimensional-variables"><h2 class="title topictitle2" id="ariaid-title36">Multidimensional Variables</h2><div class="body"><div class="div hr">
-</div></div><article class="topic nested2" aria-labelledby="ariaid-title37" id="modeling"><h3 class="title topictitle3" id="ariaid-title37">Modeling</h3><div class="body"><p class="p">Models with multidimensional variables look just like any other models. The structure of the models is replicated givin multiple indexes to variables. For users with programming background, notation Variable<span class="xref"></span> may be familiar. In system dynamic modeling we need to give names to the indexes. Instead of using numbers to define the indexes, like in normal programming, we use enumerations. The steps to create a model with multidimensional variables are as follows (with examples):</p><p class="p">1 <strong class="ph b">Create the model structure</strong></p><p class="p">Model with multidimensional variables looks just like any other model.</p><div class="div image">
+</div><p class="p">Charts are added to the panel by dragging from model browser. The order of the charts is easily changed by dragging charts from their header. Charts can be minimized or completely removed from the buttons in their headers.</p><p class="p">By default, chart panel is hidden in the upper-right corner of the system dynamics perspective.</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title37" id="multidimensional-variables"><h2 class="title topictitle2" id="ariaid-title37">Multidimensional Variables</h2><div class="body"><div class="div hr">
+</div></div><article class="topic nested2" aria-labelledby="ariaid-title38" id="modeling"><h3 class="title topictitle3" id="ariaid-title38">Modeling</h3><div class="body"><p class="p">Models with multidimensional variables look just like any other models. The structure of the models is replicated giving multiple indices to variables. For users with programming background, notation Variable<span class="xref"></span> may be familiar. In system dynamic modeling we need to give names to the indices. Instead of using numbers to define the indices, like in normal programming, we use enumerations. The steps to create a model with multidimensional variables are as follows (with examples):</p><p class="p">1 <strong class="ph b">Create the model structure</strong></p><p class="p">Model with multidimensional variables looks just like any other model.</p><div class="div image">
<img class="image" src="Images/ModelWithMultidimensionalVariables.png"><br>
-</div><p class="p">2 <strong class="ph b">Create Enumerations and define the indexes</strong></p><p class="p">Enumerations are created by right-clicking configuration and selecting New->Enumeration.</p><div class="div image">
+</div><p class="p">2 <strong class="ph b">Create Enumerations and define the indices</strong></p><p class="p">Enumerations are created by right-clicking configuration and selecting New→Enumeration.</p><div class="div image">
<img class="image" src="Images/NewEnumeration.png"><br>
-</div><p class="p">Define enumeration indexes by adding as many indexes as you want. Rename the indexes by selecting them and then clicking on them again.</p><div class="div image">
+</div><p class="p">Define enumeration indices by adding as many indices as you want. Rename the indices by selecting them and then clicking on them again.</p><div class="div image">
<img class="image" src="Images/DefineIndexes.png"><br>
-</div><p class="p">3 <strong class="ph b">Add Enumerations for variables</strong></p><p class="p">Select the variable that you want to be multidimensional. From the Indexes -tab in the property view, move the wanted enumerations to the right. The order of the enumerations does matter.</p><div class="div image">
+</div><p class="p">3 <strong class="ph b">Add Enumerations for variables</strong></p><p class="p">Select the variable that you want to be multidimensional. From the indices -tab in the property view, move the wanted enumerations to the right. The order of the enumerations <strong class="ph b">does</strong> matter.</p><div class="div image">
<img class="image" src="Images/SelectEnumerations.png"><br>
-</div><p class="p">4 <strong class="ph b">Define equations for all possible indexes</strong></p><p class="p">Multidimensional variable can be thought as a multidimensional table. Each cell of the table needs to have an expression or a value. A cell cannot have multiple definitions. All cells can be defined in one expression like in the following example. E1 and E2 have both three indexes, so the resulting definition can be {{1,2,3},{4,5,6},{7,8,9}}.</p><div class="div image">
+</div><p class="p">4 <strong class="ph b">Define equations for all possible indices</strong></p><p class="p">Multidimensional variable can be thought as a multidimensional table. Each cell of the table needs to have an expression or a value. A cell cannot have multiple definitions. All cells can be defined in one expression like in the following example. E1 and E2 have both three indices, so the resulting definition can be {{1,2,3},{4,5,6},{7,8,9}}.</p><div class="div image">
<img class="image" src="Images/DefineEquations.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title38" id="expressions"><h3 class="title topictitle3" id="ariaid-title38">Expressions</h3><div class="body"><p class="p">Values for all cells in the variable matrix can be defined in a single expression.</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title39" id="expressions"><h3 class="title topictitle3" id="ariaid-title39">Expressions</h3><div class="body"><p class="p">Values for all cells in the variable matrix can be defined in a single expression.</p><div class="div image">
<img class="image" src="Images/DefineEquations.png"><br>
</div><div class="div image">
<img class="image" src="Images/DefineEquations2.png"><br>
<img class="image" src="Images/CreateNewExpression.png"><br>
</div><p class="p">4 <strong class="ph b">Select the new expression</strong></p><div class="div image">
<img class="image" src="Images/SelectNewExpression.png"><br>
-</div><p class="p">Repeat until there is value for each cell. There must be exactly one value for each cell.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title39" id="array-slices"><h3 class="title topictitle3" id="ariaid-title39">Array Slices</h3><div class="body"><p class="p">Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable:</p><pre class="pre"> enumeration E1 = one, two, three
+</div><p class="p">Repeat until there is value for each cell. There must be exactly one value for each cell.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title40" id="array-slices"><h3 class="title topictitle3" id="ariaid-title40">Array Slices</h3><div class="body"><p class="p">Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable:</p><pre class="pre"> enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
</pre><p class="p">The whole variable can be accessed in three different ways:</p><ol class="ol"><li class="li"><p class="p"><code class="ph codeph">Auxiliary</code></p></li><li class="li"><p class="p"><code class="ph codeph">Auxiliary[E1, E2]</code></p></li><li class="li"><p class="p"><code class="ph codeph">Auxiliary[:, :]</code></p></li></ol><p class="p">The following explains different methods for accessing parts of the variable</p><pre class="pre"> // Single cell
</pre><pre class="pre"> // Slices
Auxiliary[one, E2] = {1,2,3}
Auxiliary[E1, zwei] = {{2},{5},{8}}
-
+
// In addition to single cells and the whole enumeration range, a subrange of the enumeration can be used
Auxiliary[two : three, E2] = {{4,5,6},{7,8,9}}
Auxiliary[one : two, zwei : drei] = {{2,3},{5,6}}
-</pre><p class="p">The syntax for accessing parts of variables can be used in both expression range definitions and in expressions.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title40" id="arithmetic-operators"><h3 class="title topictitle3" id="ariaid-title40">Arithmetic Operators</h3><div class="body"><p class="p">Arithmetic operations are defined in Modelica. Below are examples of different operations.</p><p class="p"><strong class="ph b">Addition and substraction</strong></p><p class="p">Addition and substraction are calculated elementwise</p><pre class="pre"> {1,2,3} - {0,2,3} = {1,0,0}
+</pre><p class="p">The syntax for accessing parts of variables can be used in both expression range definitions and in expressions.</p></div></article><article class="topic nested2" aria-labelledby="ariaid-title41" id="arithmetic-operators"><h3 class="title topictitle3" id="ariaid-title41">Arithmetic Operators</h3><div class="body"><p class="p">Arithmetic operations are defined in Modelica. Below are examples of different operations.</p><p class="p"><strong class="ph b">Addition and substraction</strong></p><p class="p">Addition and substraction are calculated elementwise</p><pre class="pre"> {1,2,3} - {0,2,3} = {1,0,0}
{{2,2},{4,4}} + {{8,8},{1,1}} = {{10,10},{5,5}}
{1,2,3} - {1,2} = ERROR! Different array sizes
</pre><p class="p"><strong class="ph b">Division</strong></p><p class="p">Division with a scalar</p><pre class="pre"> {5,10,15} / 5 = {1,2,3}
5 / {5,10,15} = ERROR! not allowed
</pre><p class="p">Division with an array</p><pre class="pre"> {1,2,3} / {1,2,3} = ERROR! not allowed
-
+
// Elementwise
{1,2,3} ./ {1,2,3} = {1,1,1}
</pre><p class="p"><strong class="ph b">Multiplication</strong></p><p class="p">Multiplication with a scalar</p><pre class="pre"> {1,2,3} * 2 = {2,4,6}
5 * {1,2,3} = {5,10,15}
</pre><p class="p">Matrix multiplication with an array</p><pre class="pre"> {{3,4},{5,6}} * {1,2} = {11,17}
{{3,4},{5,6}} * {1,2,3} = ERROR! incompatible array sizes
-
+
//Elementwise
{1,2} .* {1,2} = {1,4}
-
- Real[3,2] c = {{1,2},{3,4},{5,6}};
+
+ Real[3,2] c = {{1,2},{3,4},{5,6}};
Real[2,2] d = {{3,4},{5,6}};
Real[2,2] cd;
cd = c[2:3, :] .* d; // Result: {{9,16},{25,36}}
</pre><p class="p"><strong class="ph b">Power</strong></p><p class="p">Elementwise power of array variable</p><pre class="pre"> {1,2} .^ 2 = {1,4}
-</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title41" id="builtin-modelica-functions"><h3 class="title topictitle3" id="ariaid-title41">Builtin Modelica Functions</h3><div class="body"><p class="p">Modelica has some builtin functions that help using multidimensional variables. This chapter introduces some of the builtin functions.</p><p class="p"><strong class="ph b">Dimension and size functions</strong></p><p class="p">We will use the same example variable as previously.</p><pre class="pre"> enumeration E1 = one, two, three
+</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title42" id="built-in-modelica-functions"><h3 class="title topictitle3" id="ariaid-title42">Built-in Modelica Functions</h3><div class="body"><p class="p">Modelica has some built-in functions that help using multidimensional variables. You can find the functions under any model inside the folder Functions→Built-in Functions. This chapter introduces some of the built-in functions.</p><p class="p"><strong class="ph b">Dimension and size functions</strong></p><p class="p">We will use the same example variable as previously.</p><pre class="pre"> enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
-
+
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
</pre><p class="p"><strong class="ph b">ndims(A)</strong></p><p class="p">The number of dimensions in array A</p><pre class="pre"> ndims(Auxiliary) = 2
</pre><p class="p"><strong class="ph b">size(A, i)</strong></p><p class="p">The size of dimension i in array A</p><pre class="pre"> size(Auxiliary, 2) = 3
1 0 0
0 2 0
0 0 3
-</pre><p class="p"><strong class="ph b">linspace(x1,x2,n)</strong></p><p class="p">Constracts a Real vector from x1 to x2 with n equally spaced elements.</p><pre class="pre"> linspace(2,5,4) = {2,3,4,5}
+</pre><p class="p"><strong class="ph b">linspace(x1,x2,n)</strong></p><p class="p">Constructs a Real vector from x1 to x2 with n equally spaced elements.</p><pre class="pre"> linspace(2,5,4) = {2,3,4,5}
</pre><p class="p"><strong class="ph b">Reduction functions</strong></p><p class="p">Reduction functions reduce arrays to scalars.</p><p class="p"><strong class="ph b">min(A)</strong></p><p class="p">Returns the minimum value in array A.</p><pre class="pre"> Real A = {{1,2},{3,4}}
min(A) = 1
</pre><p class="p"><strong class="ph b">max(A)</strong></p><p class="p">Returns the maximum value in array A.</p><pre class="pre"> Real A = {{1,2},{3,4}}
</pre><p class="p"><strong class="ph b">Using functions with iterators</strong></p><p class="p">Functions min(A), max(A), sum(A) and product(A) reduce arrays to scalars. When you use multidimensional variables, you will most probably like to reduce less dimensions. This can be achieved using iterators with reduction functions. The result is constructed as an array, if curly brackets {} are used to enclose the expression.</p><pre class="pre"> enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
-
+
AuxiliarySum[E1] = {sum( Auxiliary[ i , E2 ] ) for i in E1} // Result: {6, 15, 24}
-
+
/* Same as:
{sum(Auxiliary[one, E2]), sum(Auxiliary[two, E2]), sum(Auxiliary[three, E2])}
{sum({1,2,3}), sum({4,5,6}), sum({7,8,9})}
</pre><p class="p">One expression can have multiple iterators. The Modelica specification defines the following format, but it is NOT yet supported in OpenModelica:</p><pre class="pre"> {sum(Array[ i, j, E3]) for i in E1, j in E2} // Dimensions reduced from 3 to 2
</pre><p class="p">To use multiple iterators, use the following format (NOTE the reversed order of iterators!):</p><pre class="pre"> {{sum(Array[ i, j, E3]) for j in E2} for i in E1} // Dimensions reduced from 3 to 2
</pre><p class="p">The range doesn't have to be the whole enumeration. Subranges can also be used.</p><pre class="pre"> {sum( Auxiliary[ i , eins : zwei ] ) for i in E1.one : E1.two} // Result: {3, 9}
-
+
/* Same as
{sum(Auxiliary[one, eins : zwei]), sum(Auxiliary[two, eins : zwei])}
{sum({1,2}), sum({4,5})}
*/
-</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title42" id="simulation-results"><h3 class="title topictitle3" id="ariaid-title42">Simulation Results</h3><div class="body"><p class="p">Multidimensional variables provide multiple results for the same variable. One result for each index. The trend view clutters very quickly when you add dimensions to the variables.</p><div class="div image">
+</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title43" id="simulation-results"><h3 class="title topictitle3" id="ariaid-title43">Simulation Results</h3><div class="body"><p class="p">Multidimensional variables provide multiple results for the same variable. One result for each index. The trend view clutters very quickly when you add dimensions to the variables.</p><div class="div image">
<img class="image" src="Images/3x3trend.png"><br>
-</div><p class="p">The clutter can be reduced by selecting which enumeration indexes are shown in charts. Select an enumeration and tick the indexes that you want to show. The same settings apply to each variable that uses the enumeration. This way you can follow an interesting index throughout the model.</p><div class="div image">
+</div><p class="p">The clutter can be reduced by selecting which enumeration indices are shown in charts. Select an enumeration and tick the indices that you want to show. The same settings apply to each variable that uses the enumeration. This way you can follow an interesting index throughout the model.</p><div class="div image">
<img class="image" src="Images/ShowInCharts.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title43" id="array-variables-in-modules"><h3 class="title topictitle3" id="ariaid-title43">Array Variables in Modules</h3><div class="body"><div class="div imageBorder">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title44" id="array-variables-in-modules"><h3 class="title topictitle3" id="ariaid-title44">Array Variables in Modules</h3><div class="body"><div class="div imageBorder">
<img class="image" src="Images/Replaceable.png"><br>
<p class="p imageText">Replaceable enumeration inside a module</p>
-</div><p class="p">You can also use array variables inside modules. Enumeration need to be defined separately for each module type and added to all necessary variables, also inputs and outputs (see <a class="xref" href="#modeling">Modeling</a>).</p><p class="p">When defining a module, modeler may not want to restrict the size of the array variable. In many cases the same module structure could be used for both large and small arrays. For example if the module is a project, a project may have three or even twenty phases. In this case the enumerations inside modules need to be set as replaceable.</p><p class="p">In this example, the original enumeration that the modeler used had two indexes. We are using an instance of this module, but we need to use array variables that have three indexes instead of two. We are using two variables and an instance of the module.</p><div class="div imageBorder">
+</div><p class="p">You can also use array variables inside modules. Enumeration need to be defined separately for each module type and added to all necessary variables, also inputs and outputs (see <a class="xref" href="#modeling">Modeling</a>).</p><p class="p">When defining a module, modeler may not want to restrict the size of the array variable. In many cases the same module structure could be used for both large and small arrays. For example if the module is a project, a project may have three or even twenty phases. In this case the enumerations inside modules need to be set as replaceable.</p><p class="p">In this example, the original enumeration that the modeler used had two indices. We are using an instance of this module, but we need to use array variables that have three indices instead of two. We are using two variables and an instance of the module.</p><div class="div imageBorder">
<img class="image" src="Images/ReplacingEnumerationConfiguration.png"><br>
<p class="p imageText">Module configuration for replacing enumerations inside the module</p>
-</div><p class="p">In the parent configuration, we have used an enumeration with three indexes in the two variables.</p><div class="div imageBorder">
+</div><p class="p">In the parent configuration, we have used an enumeration with three indices in the two variables.</p><div class="div imageBorder">
<img class="image" src="Images/Replacing.png"><br>
<p class="p imageText">Enumeration in the parent configuration that will replace the enumeration in the module</p>
-</div><p class="p">The replacement can be defined in the properties of the module instance. When the module instance is selected, a table with all the replaceable enumerations is shown. By clickin on the cell next to the enumeration, a drop-down box is shown with all the enumerations in the parent module. If an enumeration is selected, it will replace the enumeration inside the module during simulation. The replacement will not, however, show elsewhere in the model.</p><div class="div imageBorder">
+</div><p class="p">The replacement can be defined in the properties of the module instance. When the module instance is selected, a table with all the replaceable enumerations is shown. By clicking on the cell next to the enumeration, a drop-down box is shown with all the enumerations in the parent module. If an enumeration is selected, it will replace the enumeration inside the module during simulation. The replacement will not, however, show elsewhere in the model.</p><div class="div imageBorder">
<img class="image" src="Images/ReplacingEnumeration.png"><br>
<p class="p imageText">Enumeration in the parent configuration that will replace the enumeration in the module</p>
-</div><p class="p">When creating replaceable enumerations in modules, modelers need to be very careful. Direct references to single enumeration elements are not allowed, since the enumeration elements will change, if the enumeration is replaced for simulation!</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title44" id="functions"><h2 class="title topictitle2" id="ariaid-title44">Functions</h2><div class="body"><div class="div hr">
-</div><p class="p">Modelica provides a convenient way to use functions in your models. You can create your own functions, export and import complete function libraries and share function libraries to be used in all of your models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title45" id="creating-functions"><h3 class="title topictitle3" id="ariaid-title45">Creating Functions</h3><div class="body"><div class="div image">
+</div><p class="p">When creating replaceable enumerations in modules, modelers need to be very careful. Direct references to single enumeration elements are not allowed, since the enumeration elements will change, if the enumeration is replaced for simulation!</p></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title45" id="functions"><h2 class="title topictitle2" id="ariaid-title45">Functions</h2><div class="body"><div class="div hr">
+</div><p class="p">Modelica provides a convenient way to use functions in your models. You can create your own functions, export and import complete function libraries and share function libraries to be used in all of your models.</p></div><article class="topic nested2" aria-labelledby="ariaid-title46" id="creating-functions"><h3 class="title topictitle3" id="ariaid-title46">Creating Functions</h3><div class="body"><div class="div image">
<img class="image" src="Images/NewFunction.png"><br>
-</div><p class="p">You can create new functions to the Functions -folder in your model or to function library folders. Right-click on the folder and select New->Function.</p><p class="p">Functions that can be found from Functions -folder can be used in your variable definitions.</p><p class="p">Functions are defined using Modelica language. The variables used in the function are defined in the declaration section. Function needs an output and an arbitrary number of inputs. Modelica specification enables use of multiple outputs, but this feature is not supported. The inputs are given in the same order as they are used in calling the function.</p><p class="p">Algorithm section defines the actual functionality of the function. In algorithm sections you must use assignments ":=" instead of just plain "=". All the assignments are calculated in the order they are written.</p><p class="p">Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and <a class="xref" href="https://www.modelica.org/documents/" target="_blank">Modelica specifications</a>.</p><div class="div image">
+</div><p class="p">You can create new functions to the Functions -folder in your model or to function library folders. Right-click on the folder and select New→Function.</p><p class="p">Functions that can be found from Functions -folder can be used in your variable definitions.</p><p class="p">Functions are defined using Modelica language. The variables used in the function are defined in the declaration section. Function needs an output and an arbitrary number of inputs. Modelica specification enables use of multiple outputs, but this feature is not supported. The inputs are given in the same order as they are used in calling the function.</p><p class="p">Algorithm section defines the actual functionality of the function. In algorithm sections you must use assignments ":=" instead of just plain "=". All the assignments are calculated in the order they are written.</p><p class="p">Also, take note that creating new lines in the Modelica code text box is done via shift+enter.</p><p class="p">Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and <a class="xref" href="https://www.modelica.org/documents/" target="_blank" rel="external noopener">Modelica specifications</a>.</p><div class="div image">
<img class="image" src="Images/ExampleFunction.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title46" id="function-libraries"><h3 class="title topictitle3" id="ariaid-title46">Function Libraries</h3><div class="body"><p class="p">Functions can be collected into libraries. This is a good way of organizing your functions. If function is located in a library, you need to append the library name to the function call (e.g. ExampleFunctionLibrary.ExampleFunction(arg1, arg2)). With libraries, you can also have functions with same names (e.g. library1.func(arg) and library2.func(arg)).</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title47" id="function-libraries"><h3 class="title topictitle3" id="ariaid-title47">Function Libraries</h3><div class="body"><p class="p">Functions can be collected into libraries. This is a good way of organizing your functions. If function is located in a library, you need to append the library name to the function call (e.g. ExampleFunctionLibrary.ExampleFunction(arg1, arg2)). With libraries, you can also have functions with same names (e.g. library1.func(arg) and library2.func(arg)).</p><div class="div image">
<img class="image" src="Images/NewFunctionLibrary.png"><br>
-</div><p class="p">There are three types of function libraries: normal function library, built-in function library and shared function library. Normal function libraries can be created to a model and are available only in that model. Built-in libraries are available in all models and calls to built-in functions should not include the library name. Shared functions are available to all models in your workspace, but you need to enable them to each model individually.</p><p class="p">Create a new function library by right-clicking on Functions folder, Shared functions folder or other module library.</p><p class="p">A function library can be exported by right clicking the function library and selecting Export -> Function library. A function library can be imported by right clicking the Functions folder and selecting Import -> Function library. Functions themselves cannot be exported or imported. To export a function, add it into a function library and export that function library.</p><p class="p">If you create a shared function library, the library can be added to other models or removed from current model by selecting the Shared Functions -folder and using the properties view.</p><div class="div image">
+</div><p class="p">There are three types of function libraries: normal function library, built-in function library and shared function library. Normal function libraries can be created to a model and are available only in that model. Built-in libraries are available in all models and calls to built-in functions should not include the library name. Shared functions are available to all models in your workspace, but you need to enable them to each model individually.</p><p class="p">Create a new function library by right-clicking on Functions folder, Shared functions folder or other module library.</p><p class="p">A function library can be exported by right clicking the function library and selecting Export → Function library. A function library can be imported by right clicking the Functions folder and selecting Import → Function library. Functions themselves cannot be exported or imported. To export a function, add it into a function library and export that function library.</p><p class="p">If you create a shared function library, the library can be added to other models or removed from current model by selecting the Shared Functions -folder and using the properties view.</p><div class="div image">
<img class="image" src="Images/SharedFunctions.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title47" id="external-functions"><h3 class="title topictitle3" id="ariaid-title47">External Functions</h3><div class="body"><p class="p">Modelica allows you to use external functions that are programmed using C language. To use this feature, you need to have the Sysdyn version with OpenModelica included and OpenModelica set as the solver in the Preferences (Window -> Preferences -> Solver). The installation package with OpenModelica has also MinGW C compiler included that allows to build object files from C source code.</p><p class="p">Below is a simple example of using a function that returns the sum of two arguments.</p><pre class="pre"> double exampleCFunction(double x, double y)
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title48" id="external-functions"><h3 class="title topictitle3" id="ariaid-title48">External Functions</h3><div class="body"><p class="p">Modelica allows you to use external functions that are programmed using C language. To use this feature, you need to have the Sysdyn version with OpenModelica included and OpenModelica set as the solver in the Preferences (Window → Preferences → Solver). The installation package with OpenModelica has also MinGW C compiler included that allows to build object files from C source code.</p><p class="p">Below is a simple example of using a function that returns the sum of two arguments.</p><pre class="pre"> double exampleCFunction(double x, double y)
{
double res;
res = x + y;
return res;
}");
end ExampleExternalFunction;
-</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title48" id="modelica-functions"><h3 class="title topictitle3" id="ariaid-title48">Modelica Functions</h3><div class="body"><p class="p">Modelica has built-in functions that can be used anywhere and are not visible in function libraries. This section covers a large number of those functions. For functions related to array variables, see see <a class="xref" href="#builtin-modelica-functions">builtin functions for arrays</a>.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="modelica-functions__entry__1"><strong class="ph b">Function</strong></th><th class="entry" id="modelica-functions__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">abs(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">acos(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Inverse cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">asin(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Inverse sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">atan(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">atan2(x1,x2)</td><td class="entry" headers="modelica-functions__entry__2 ">four quadrant inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cat(n,A,B,...)</td><td class="entry" headers="modelica-functions__entry__2 ">General concatenation function that concatenates arrays A,B,... along the nth dimension.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">ceil(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the smallest integer not less than x, the closest integer above x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cos(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cosh(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Hyperbolic cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">cross(x,y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the 3-vector cross product of the 3-vectors x and y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">delay(expr, delayTime)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the value of expr at the time time-delayTime. The value of expr is returned when time <= time.start + delayTime.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">der(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Time derivative of x. X must be have continuous-time variability.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">div(x, y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the algebraic quotient x/y with any fractional part discarted. E.g. div(10,3) = 3.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">edge(b)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true when the value of the boolean expression b changes. Expanded into (b and not pre(b)).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">exp(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Exponential, base e.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">floor(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the largest integer not greater than x, the closest integer below x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">initial()</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true at the beginning of the simulation.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">integer(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the largest integer not greater than x as an integer.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">log(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Natural logarithm. (base e, x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">log10(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Base 10 logarithm. (x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">mod(x, y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the integer modulus of x/y: mod(x,y) = x - floor(x/y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">noEvent(expr)</td><td class="entry" headers="modelica-functions__entry__2 ">noEvent around an expression causes the expression to NOT generate event. <strong class="ph b">Important:</strong> If you want a condition to be checked only on time steps, use noEvent. (e.g. if noEvent(value >= 1) then ... else ...)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">pre(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the preceding value of y from time event that has occured before current time.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">rem(x, y)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns the integer remainder of x/y: rem(x,y) = x - div(x,y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sample(start, interval)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true and triggers time events at times start + i * interval (i=0,1,...).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sign(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Returns -1 if x is negative, 1 if x is positive. Expanded into "(if x > 0 then 1 else if x < 0 then -1 else 0)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sin(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sinh(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Hyperbolic sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">sqrt(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">tan(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">tanh(x)</td><td class="entry" headers="modelica-functions__entry__2 ">Hyperbolic tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1 ">terminal()</td><td class="entry" headers="modelica-functions__entry__2 ">Returns true at the end of a successful simulation.</td></tr></tbody></table></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title49" id="spreadsheets"><h2 class="title topictitle2" id="ariaid-title49">Spreadsheets</h2><div class="body"><div class="div hr">
-</div><p class="p">Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality.</p></div><article class="topic nested2" aria-labelledby="ariaid-title50" id="variable-values"><h3 class="title topictitle3" id="ariaid-title50">Variable Values</h3><div class="body"><p class="p">Spreadsheets are an easy way to import and manage parameter values. Sheet shells can be referenced to in models with the syntax SheetName(CellReference). Below is an example of getting a value for Auxiliary. The text "Auxiliary" is not necessary in the spreadsheet, but it helps maintaining the sheet.</p><div class="div image">
+</pre></div></article><article class="topic nested2" aria-labelledby="ariaid-title49" id="modelica-functions"><h3 class="title topictitle3" id="ariaid-title49">Modelica Functions</h3><div class="body"><p class="p">Modelica has built-in functions that can be used anywhere and are not visible in function libraries. This section covers a large number of those functions. For functions related to array variables, see see <a class="xref" href="#Built-in-modelica-functions">Built-in functions for arrays</a>.</p><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="modelica-functions__entry__1"><strong class="ph b">Function</strong></th><th class="entry" id="modelica-functions__entry__2"><strong class="ph b">Description</strong></th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="modelica-functions__entry__1">abs(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">acos(x)</td><td class="entry" headers="modelica-functions__entry__2">Inverse cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">asin(x)</td><td class="entry" headers="modelica-functions__entry__2">Inverse sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">atan(x)</td><td class="entry" headers="modelica-functions__entry__2">Inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">atan2(x1,x2)</td><td class="entry" headers="modelica-functions__entry__2">four quadrant inverse tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cat(n,A,B,...)</td><td class="entry" headers="modelica-functions__entry__2">General concatenation function that concatenates arrays A,B,... along the nth dimension.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">ceil(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the smallest integer not less than x, the closest integer above x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cos(x)</td><td class="entry" headers="modelica-functions__entry__2">Cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cosh(x)</td><td class="entry" headers="modelica-functions__entry__2">Hyperbolic cosine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">cross(x,y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the 3-vector cross product of the 3-vectors x and y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">delay(expr, delayTime)</td><td class="entry" headers="modelica-functions__entry__2">Returns the value of expr at the time time-delayTime. The value of expr is returned when time <= time.start + delayTime.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">der(x)</td><td class="entry" headers="modelica-functions__entry__2">Time derivative of x. X must be have continuous-time variability.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">div(x, y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the algebraic quotient x/y with any fractional part discarded. E.g. div(10,3) = 3.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">edge(b)</td><td class="entry" headers="modelica-functions__entry__2">Returns true when the value of the Boolean expression b changes. Expanded into (b and not pre(b)).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">exp(x)</td><td class="entry" headers="modelica-functions__entry__2">Exponential, base e.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">floor(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the largest integer not greater than x, the closest integer below x.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">initial()</td><td class="entry" headers="modelica-functions__entry__2">Returns true at the beginning of the simulation.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">integer(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the largest integer not greater than x as an integer.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">log(x)</td><td class="entry" headers="modelica-functions__entry__2">Natural logarithm. (base e, x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">log10(x)</td><td class="entry" headers="modelica-functions__entry__2">Base 10 logarithm. (x > 0)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">mod(x, y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the integer modulus of x/y: mod(x,y) = x - floor(x/y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">noEvent(expr)</td><td class="entry" headers="modelica-functions__entry__2">noEvent around an expression causes the expression to NOT generate event. <strong class="ph b">Important:</strong> If you want a condition to be checked only on time steps, use noEvent. (e.g. if noEvent(value >= 1) then ... else ...)</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">pre(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns the preceding value of y from time event that has occurred before current time.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">rem(x, y)</td><td class="entry" headers="modelica-functions__entry__2">Returns the integer remainder of x/y: rem(x,y) = x - div(x,y) * y.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sample(start, interval)</td><td class="entry" headers="modelica-functions__entry__2">Returns true and triggers time events at times start + i * interval (i=0,1,...).</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sign(x)</td><td class="entry" headers="modelica-functions__entry__2">Returns -1 if x is negative, 1 if x is positive. Expanded into "(if x > 0 then 1 else if x < 0 then -1 else 0)".</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sin(x)</td><td class="entry" headers="modelica-functions__entry__2">Sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sinh(x)</td><td class="entry" headers="modelica-functions__entry__2">Hyperbolic sine.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">sqrt(x)</td><td class="entry" headers="modelica-functions__entry__2">Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">tan(x)</td><td class="entry" headers="modelica-functions__entry__2">Tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">tanh(x)</td><td class="entry" headers="modelica-functions__entry__2">Hyperbolic tangent.</td></tr><tr class="row"><td class="entry" headers="modelica-functions__entry__1">terminal()</td><td class="entry" headers="modelica-functions__entry__2">Returns true at the end of a successful simulation.</td></tr></tbody></table></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title50" id="spreadsheets"><h2 class="title topictitle2" id="ariaid-title50">Spreadsheets</h2><div class="body"><div class="div hr">
+</div><p class="p">Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality.</p></div><article class="topic nested2" aria-labelledby="ariaid-title51" id="variable-values"><h3 class="title topictitle3" id="ariaid-title51">Variable Values</h3><div class="body"><p class="p">Spreadsheets are an easy way to import and manage parameter values. Sheet shells can be referenced to in models with the syntax SheetName(CellReference). Below is an example of getting a value for Auxiliary. The text "Auxiliary" is not necessary in the spreadsheet, but it helps maintaining the sheet.</p><div class="div image">
<img class="image" src="Images/AuxiliarySheetReference.png"><br>
<img class="image" src="Images/AuxiliarySheet.png"><br>
-</div><p class="p">You can also refer to sheets with array variables. Reference is simple with one and two dimensional array variables. Below is an example of a sheet with values for two different variables. The names of the indexes are not mandatory, but help reading and maintaining the sheet.</p><div class="div image">
+</div><p class="p">You can also refer to sheets with array variables. Reference is simple with one and two dimensional array variables. Below is an example of a sheet with values for two different variables. The names of the indices are not mandatory, but help reading and maintaining the sheet.</p><div class="div image">
<img class="image" src="Images/SheetForMultidim.png"><br>
</div><p class="p">Reference to a sheet range creates an array variable.</p><div class="div image">
<img class="image" src="Images/SheetMultidim1.png"><br>
-</div><p class="p">ArrayTest2 has two dimensions. Reference to a larger range creates a two-dimensional variable. By default, the indexes are ordered as in this example. However, if you wish to present the indexes in a different order in the spreadsheet, you can transpose the sheet reference (e.g. transpose(ArrayTestSheet(E2:G3)))</p><div class="div image">
+</div><p class="p">ArrayTest2 has two dimensions. Reference to a larger range creates a two-dimensional variable. By default, the indices are ordered as in this example. However, if you wish to present the indices in a different order in the spreadsheet, you can transpose the sheet reference (e.g. transpose(ArrayTestSheet(E2:G3)))</p><div class="div image">
<img class="image" src="Images/SheetMultidim2.png"><br>
-</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title51" id="history-data"><h3 class="title topictitle3" id="ariaid-title51">History Data</h3><div class="body"><p class="p">Spreadsheets can be used to store and display external history data e.g. from some statistics. The history data should be arranged as columns or rows and include a time variable. Reference variables need to be given the exactly same name as their counterparts in model.</p><div class="div image">
+</div></div></article><article class="topic nested2" aria-labelledby="ariaid-title52" id="history-data"><h3 class="title topictitle3" id="ariaid-title52">History Data</h3><div class="body"><p class="p">Spreadsheets can be used to store and display external history data e.g. from some statistics. The history data should be arranged as columns or rows and include a time variable. Reference variables need to be given the exactly same name as their counterparts in model.</p><div class="div image">
<img class="image" src="Images/Sheet.png"><br>
</div><p class="p">History data is used by creating a History dataset to an experiment. The dataset is activated and deactivated in charts by double-clicking the dataset. History data reference is set in the properties of the history dataset.</p><div class="div image">
<img class="image" src="Images/HistoryDataSettings.png"><br>
-</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="history-data__entry__1"><strong class="ph b">History data properties</strong></th><th class="entry" id="history-data__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="history-data__entry__1 ">Name</td><td class="entry" headers="history-data__entry__2 ">Name of the history dataset</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Sheet</td><td class="entry" headers="history-data__entry__2 ">Combo box for selecting a sheet where the history data is located</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Orientation</td><td class="entry" headers="history-data__entry__2 ">Columns or rows. How the data is arranged in the sheet.</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Range start</td><td class="entry" headers="history-data__entry__2 ">The upper-left corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Range end</td><td class="entry" headers="history-data__entry__2 ">The lower-right corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Time variable</td><td class="entry" headers="history-data__entry__2 ">The name of the time variable in the history data, if it is different than "time"</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1 ">Variables in range</td><td class="entry" headers="history-data__entry__2 ">This text field displays the found variables in the given sheet and range</td></tr></tbody></table><p class="p">If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart.</p><div class="div image">
+</div><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead"><tr class="row"><th class="entry" id="history-data__entry__1"><strong class="ph b">History data properties</strong></th><th class="entry" id="history-data__entry__2">-</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry" headers="history-data__entry__1">Name</td><td class="entry" headers="history-data__entry__2">Name of the history dataset</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Sheet</td><td class="entry" headers="history-data__entry__2">Combo box for selecting a sheet where the history data is located</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Orientation</td><td class="entry" headers="history-data__entry__2">Columns or rows. How the data is arranged in the sheet.</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Range start</td><td class="entry" headers="history-data__entry__2">The upper-left corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Range end</td><td class="entry" headers="history-data__entry__2">The lower-right corner cell of the history data range</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Time variable</td><td class="entry" headers="history-data__entry__2">The name of the time variable in the history data, if it is different than "time"</td></tr><tr class="row"><td class="entry" headers="history-data__entry__1">Variables in range</td><td class="entry" headers="history-data__entry__2">This text field displays the found variables in the given sheet and range</td></tr></tbody></table><p class="p">If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart.</p><div class="div image">
<img class="image" src="Images/HistoryData.png"><br>
-</div></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title52" id="vensim-model-import"><h2 class="title topictitle2" id="ariaid-title52">Vensim Model Import</h2><div class="body"><div class="div hr">
-</div><p class="p">The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool <a class="xref" href="http://vensim.com/" target="_blank">Vensim</a>. This functionality is used similarly to the regular model import, so by right-clicking the browser and selecting "Import" -> "Vensim Model (.mdl)".</p><p class="p">The import process has several known limitations:</p><ul class="ul"><li class="li"><p class="p">The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported.</p></li><li class="li"><p class="p">Only variables and connections are imported.</p></li><li class="li"><p class="p">Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported.</p></li><li class="li"><p class="p">Variable value range data is not always imported correctly.</p></li><li class="li"><p class="p">Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent.</p></li><li class="li"><p class="p">Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant).</p></li><li class="li"><p class="p">Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine.</p></li><li class="li"><p class="p">Only a limited subset of Vensim functions is currently implemented in Simantics System Dynamics, so some equations might require additional work before they can be evaluated correctly.</p></li></ul></div></article><article class="topic nested1" aria-labelledby="ariaid-title53" id="sample-models-and-molecules"><h2 class="title topictitle2" id="ariaid-title53">Sample Models and Molecules</h2><div class="body"><div class="div hr">
-</div><p class="p">There are some sample models located in the sampleModels folder found in the installation folder. The sample models can be imported by right-clicking on the model browser and select Import->Model.</p><p class="p"><a class="xref" href="https://www.simantics.org/end_user_wiki/index.php/Introduction_to_Simantics" target="_blank">Simantics</a> | <em class="ph i">System Dynamics Modelling</em></p><div class="div hr">
+</div></div></article></article><article class="topic nested1" aria-labelledby="ariaid-title53" id="vensim-model-import"><h2 class="title topictitle2" id="ariaid-title53">Vensim Model Import</h2><div class="body"><div class="div hr">
+</div><p class="p">The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool <a class="xref" href="http://vensim.com/" target="_blank" rel="external noopener">Vensim</a>. This functionality is used similarly to the regular model import, so by right-clicking the browser and selecting "Import" → "Vensim Model (.mdl)".</p><p class="p">The import process has several known limitations:</p><ul class="ul"><li class="li"><p class="p">The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported.</p></li><li class="li"><p class="p">Only variables and connections are imported.</p></li><li class="li"><p class="p">Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported.</p></li><li class="li"><p class="p">Variable value range data is not always imported correctly.</p></li><li class="li"><p class="p">Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent.</p></li><li class="li"><p class="p">Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant).</p></li><li class="li"><p class="p">Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine.</p></li><li class="li"><p class="p">Only a limited subset of Vensim functions is currently implemented in Simantics System Dynamics, so some equations might require additional work before they can be evaluated correctly.</p></li></ul></div></article><article class="topic nested1" aria-labelledby="ariaid-title54" id="sample-models-and-molecules"><h2 class="title topictitle2" id="ariaid-title54">Sample Models and Molecules</h2><div class="body"><div class="div hr">
+</div><p class="p">There are some sample models located in the sampleModels folder found in the installation folder. The sample models can be imported by right-clicking on the model browser and select Import→Model.</p><p class="p"><a class="xref" href="https://www.simantics.org/end_user_wiki/index.php/Introduction_to_Simantics" target="_blank" rel="external noopener">Simantics</a> | <em class="ph i">System Dynamics Modelling</em></p><div class="div hr">
</div><p class="p"><a class="xref" href="BasicTutorial.html"><strong class="ph b">Tutorial: Basic System Dynamics Modelling</strong></a></p><p class="p">System dynamics modelling in Simantics is a free modelling tool that is included into the basic installation. This tutorial introduces the basic features of the system dynamics modelling tool.</p><p class="p"><a class="xref" href="AdvancedTutorial.html"><strong class="ph b">Tutorial: Advanced System Dynamics Modelling</strong></a></p><p class="p">This tutorial introduces the more advanced features of the system dynamics modelling tool: Modules and Operating interfaces</p></div></article></div></article></article></main></body></html>
\ No newline at end of file
*
* See the accompanying LICENSE file for applicable license.
*/
+.hazardstatement td,
+.hazardstatement th {
+ padding: 0.5rem;
+}
+
+.hazardstatement th {
+ text-align: center;
+ text-transform: uppercase;
+}
+
+.hazardstatement--caution {
+ background-color: #ffd100;
+}
+
+.hazardstatement--danger {
+ background-color: #c8102e;
+ color: #fff;
+}
+
+.hazardstatement--warning {
+ background-color: #ff8200;
+}
+
+.hazardstatement--attention, .hazardstatement--fastpath, .hazardstatement--important, .hazardstatement--note, .hazardstatement--notice, .hazardstatement--other, .hazardstatement--remember, .hazardstatement--restriction, .hazardstatement--tip {
+ background-color: #0072ce;
+ color: #fff;
+ font-style: italic;
+}
+
.codeblock {
font-family: monospace;
}
font-family: monospace;
}
-div.tasklabel {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-
-h2.tasklabel,
-h3.tasklabel,
-h4.tasklabel,
-h5.tasklabel,
-h6.tasklabel {
+.tasklabel {
font-size: 100%;
+ margin-bottom: 1em;
+ margin-top: 1em;
}
.screen {
- padding: 5px 5px 5px 5px;
+ background-color: #ccc;
border: outset;
- background-color: #CCCCCC;
- margin-top: 2px;
margin-bottom: 2px;
+ margin-top: 2px;
+ padding: 5px;
white-space: pre;
}
}
.numcharref {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.parameterentity {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.textentity {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlatt {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlelement {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlnsname {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlpi {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
margin-top: 1em;
}
+.indexterm {
+ background-color: #fdf;
+ border: 1pt #000 solid;
+ margin: 1pt;
+}
+
/* Most link groups are created with <div>. Ensure they have space before and after. */
.ullinks {
list-style-type: none;
margin-top: 1em;
}
+/* flagging styles */
+.flag__style--italics {
+ font-style: italic;
+}
+
+.flag__style--bold {
+ font-weight: bold;
+}
+
+.flag__style--underline {
+ text-decoration: underline;
+}
+
+.flag__style--double-underline {
+ text-decoration: double-underline;
+}
+
+.flag__style--overline {
+ text-decoration: overline;
+}
+
/*!
* Custom CSS declarations, to be appended to the end of existing declarations
*/
*
* See the accompanying LICENSE file for applicable license.
*/
+.hazardstatement td,
+.hazardstatement th {
+ padding: 0.5rem;
+}
+
+.hazardstatement th {
+ text-align: center;
+ text-transform: uppercase;
+}
+
+.hazardstatement--caution {
+ background-color: #ffd100;
+}
+
+.hazardstatement--danger {
+ background-color: #c8102e;
+ color: #fff;
+}
+
+.hazardstatement--warning {
+ background-color: #ff8200;
+}
+
+.hazardstatement--attention, .hazardstatement--fastpath, .hazardstatement--important, .hazardstatement--note, .hazardstatement--notice, .hazardstatement--other, .hazardstatement--remember, .hazardstatement--restriction, .hazardstatement--tip {
+ background-color: #0072ce;
+ color: #fff;
+ font-style: italic;
+}
+
.codeblock {
font-family: monospace;
}
font-family: monospace;
}
-div.tasklabel {
- margin-top: 1em;
- margin-bottom: 1em;
-}
-
-h2.tasklabel,
-h3.tasklabel,
-h4.tasklabel,
-h5.tasklabel,
-h6.tasklabel {
+.tasklabel {
font-size: 100%;
+ margin-bottom: 1em;
+ margin-top: 1em;
}
.screen {
- padding: 5px 5px 5px 5px;
+ background-color: #ccc;
border: outset;
- background-color: #CCCCCC;
- margin-top: 2px;
margin-bottom: 2px;
+ margin-top: 2px;
+ padding: 5px;
white-space: pre;
}
}
.numcharref {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.parameterentity {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.textentity {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlatt {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlelement {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlnsname {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
.xmlpi {
- color: #663399;
+ color: #639;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
margin-top: 1em;
}
+.indexterm {
+ background-color: #fdf;
+ border: 1pt #000 solid;
+ margin: 1pt;
+}
+
/* Most link groups are created with <div>. Ensure they have space before and after. */
.ullinks {
list-style-type: none;
margin-top: 1em;
}
+/* flagging styles */
+.flag__style--italics {
+ font-style: italic;
+}
+
+.flag__style--bold {
+ font-weight: bold;
+}
+
+.flag__style--underline {
+ text-decoration: underline;
+}
+
+.flag__style--double-underline {
+ text-decoration: double-underline;
+}
+
+.flag__style--overline {
+ text-decoration: overline;
+}
+
.linklist {
margin-bottom: 1em;
}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
- <meta name="copyright" content="(C) Copyright 2018">
- <meta name="DC.rights.owner" content="(C) Copyright 2018">
- <meta name="DC.Type" content="map">
- <meta name="DC.Format" content="HTML5">
- <meta name="DC.Identifier" content="org.simantics.sysdyn.ditamap">
+ <meta name="copyright" content="(C) Copyright 2020">
+ <meta name="DC.rights.owner" content="(C) Copyright 2020">
+ <meta name="DC.type" content="map">
+ <meta name="DC.format" content="HTML5">
+ <meta name="DC.identifier" content="org.simantics.sysdyn.ditamap">
<link rel="stylesheet" type="text/css" href="commonltr.css">
<title>Simantics System Dynamics</title>
</head>
# Tutorial: Advanced System Dynamics Modelling
<div outputclass="hr"/>
-In this tutorial, we are going to bild a work model with two projects and shared workforce. Both the workforce and a separate project (work) are going to be created as modules, so they can be reused several times. Actually the model doesn't limit the number of projects at all. A [basic tutorial](BasicTutorial.md) is also available. This tutorial is part of the [sysdyn documentation](sysdyn.md).
+This tutorial goes more in-depth on the advanced features of the Simantics System Dynamic tool. Namely modules, custom Modelica functions, special variables and enumerations (i.e. vector variables). We are going to build a model that simulates how a shared workforce works on several overlapping projects. You can think of the resulting model as a framework on which to build models that, for example, simulate a project portfolio of a company. It is advised that you complete the [basic tutorial](BasicTutorial.md) before starting. If you find yourself stuck, seek help from the [documentation](sysdyn.md).
+
+* [1 Creating model and modules](#Creating-model-and-modules)
+* [2 Initial configuration](#Initial-configuration)
+* [3 Workforce module](#Workforce-module)
+* [4 Project module](#Project-module)
+* [5 Connecting modules](#Connecting-modules)
+* [6 Simulating the model](#Simulating-the-model)
+* [7 Adding modules](#Adding-modules)
## Creating model and modules
<div outputclass="hr"/>
-Let's start by creating the work model and the needed modules. First create a new model by right-clicking on the model browser and selecting New->Model. Alternatively you can select File->New Model from the main menu.
-
-Then create two new modules to your model. Right-click on the Modules folder and select New->Module.
-
-Name your model WorkModel and modules WorkforceModule and WorkModule. You can rename them by right-clicking on the item on the model browser and selecting Rename.
+Start by creating a new model from File→New→SD Model, rename the model to WorkModel. Then create two new modules by right-clicking on the Modules folder under the WorkModel tree and selecting New→Module. Rename the modules to Workforce and Project by selecting them in the Model Browser and using the properties view.
<div class="imageBorder">
<img src="AdvancedTutorialImages/NewModel.png">
## Initial configuration
<div outputclass="hr"/>
+We will use a top-down approach in creating our model - focusing first on the bigger picture of the model and implementing the internal structure of the modules later.
+
+Open the model configuration by double-clicking Configuration in your model browser. Drag one Workforce and one Project from your Model Browser to the WorkModel diagram. The modules are automatically named with a suffix number.
+
<div class="imageBorder">
<img src="AdvancedTutorialImages/TwoModules.png">
- <p class="imageText">Workforce and Work modules</p>
+ <p class="imageText">Workforce and Project modules</p>
</div>
-We will use a top-down approach in our model, so first we will make a simple model configuration with our modules. Open our model configuration by double-clicking Configuration in your model browser.
+You can think of modules as user made components that communicate with rest of the model by having some input(s) and output(s). In this model the internal implementation of Workforce module should handle resourcing people to projects according to their needs. The Project module should simulate how the people that are assigned to that specific project are advancing the project.
-Drag one WorkforceModule and one WorkModule from your model browser to the WorkModel diagram. The modules are automatically named with a suffix number. Rename the modules to Workforce and Work1. You can rename objects on the diagram by double-clicking them or selecting them with one click and renaming them on the properties view below the diagram.
+While not used in this tutorial, Simantics System Dynamics supports nested modules, i.e. modules inside modules. Modules can also be exported and imported independent of the model.
+
+Let's consider what kind of information we need to pass between the modules. First of all, the Project needs to tell the Workforce module how much workforce it needs. Create an input variable and name it to RequestedWorkingSpeed to pass this information along. Connect Project1 module to RequestedWorkingSpeed and RequestedWorkingSpeed to Workforce1 with a dependency arrow.
+
+Input variable is a special type of symbol that acts as an interface between modules and the rest of the model. They are the only symbol type that can be connected directly to module outputs and they also act as the only way of creating inputs inside modules, as we will see later.
+
+We also need to assign people to work for the project - the Workforce module needs to tell the Project module how well we can respond to the request. Create a new input variable called ResponsedWorkingSpeed and connect it to the modules with dependency arrows.
<div class="imageBorder">
<img src="AdvancedTutorialImages/ConfigurationStart.png">
<p class="imageText">Workforce and Work modules, first inputs and connections</p>
</div>
-When the modules are on the diagram, we should think what values we would like to get from the modules and what values we would like to use in the modules.
-
-Workforce needs to know, how much work is required and it should provide information on how much work can be done. To provide the information on how much work can be done, we need an Input variable. Variables can be dragged to the diagram from Symbols view or by using [shortcut keys](sysdyn.md#shortcut-and-control-keys) (Shift+I for Input variable). Drag an input variable to the diagram and name it TotalPossibleWorkingSpeed.
-
-Work module on the other hand provides information on how much work is required in it and it needs to know when the work has to be ready. Create an input variable RequiredWorkingSpeed1 and an Auxiliary variable Work1CompletionTime and place all variables like in the picture on the right.
-
-Connect the variables to modules using dependency connections (arrows). Connections are created by holding down Alt key and first clicking on the variable where to start the connection and then clicking on the variable where to end.
-
-Now we have the initial idea of the model, so let's configure the modules.
-
+Now we have the first version of the top-level model structure completed, we can start configuring the modules.
## Workforce module
<div outputclass="hr"/>
-<div class="imageBorder">
- <img src="AdvancedTutorialImages/NetResourcing1.png">
- <p class="imageText">Cloud, Valve, Flow and Stock</p>
-</div>
-
-Open Workforce module by selecting it from the diagram, right-clicking it and selecting Show Module.
+Open the Workforce module by double-clicking it under the Modules folder.
-Create a Stock variable and name it WorkforceStock. Stock variables are created the same way as Input and Auxiliary variables. The level of the stock is controlled with a valve and a flow. To create the flow, hold down Alt and right-click on an empty space left of the stock. Then left-click on the stock. A cloud, valve and a flow is created. Rename the valve to NetResourcing.
+First, create an input variable and name it to RequestedNumberOfPeople, this variable receives the request provided by the Project module. Then, create 3 auxiliary variables and name them NumberOfEmployees, EmployeesAssigned and NumberOfFreeEmployees. Lastly connect the variables as shown in the picture. The unit of these variables is number of people.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/NetResourcing2.png">
- <p class="imageText">Cloud, Valve, Flow and Stock. Flow works both on directions.</p>
+ <img src="AdvancedTutorialImages/NetResourcing1.png">
+ <p class="imageText">Internal structure of the Workforce module</p>
</div>
-NetResourcing works both ways. To display this also visually, delete the cloud by selecting it and pressing delete on your keyboard. Then create a flow starting from NetResourcing valve and ending on an empty space next to it.
+Now we need to give the symbols equations, these are written below. To configure an equation, select a variable and write (or copy-paste) the corresponding equation to the text field in the Properties view. Connected variables are shown in the Variables list on the right side of the properties view. You can double-click on a variable name to insert it to the equation.
-<div class="imageBorder">
- <img src="AdvancedTutorialImages/WorkforceAuxiliaries.png">
- <p class="imageText">Auxiliaries in Workforce module</p>
-</div>
+<pre>
+NumberOfEmployees
+= 10
-Now you have used all the basic components and connections. From now on the instructions will be a more simplified.
+NumberOfFreeEmployees
+= NumberOfEmployees-EmployeesAssigned
-Next we will create four Auxiliary variables: TimeToAllocateResources, WorkforceRequired, Productivity and PossibleWorkingSpeed. Place and connect them according to the picture on the right.
+EmployeesAssigned
+= min(RequestedNumberOfPeople, NumberOfEmployees)
+</pre>
-To be able to simulate the model, all variables must have valid equations. To configure an equation, select a variable. Variable's properties are shown in the Property view and you can input the required equations in the text fields. You can copy the equations directly from here or type them manually. Variables connected to the selected variable are shown in the Variables list. To speed up typing, you can double click on a variable name and it will be inserted to the equation.
+Also, we need to decide what value(s) we want the module to output. Make sure that the Is Output checkbox is ticked on the EmployeesAssigned variable, as this is the variable that tells how many people can be provided for the project.
-<pre>
-WorkforceStock
-Initial value: 0
+We are using a built-in function min() for calculating how many employees we are going to assign. You can find a list of these in the Model Browser under WorkModel→Functions→Built-in Functions.
-NetResourcing
-= (WorkforceRequired - WorkforceStock)/TimeToAllocateResources
+On the first iteration of this model, we are going to have 10 fulltime employees that get assigned to a single project according to the request. We are going to expand the structure of this module to handle several projects later on in the tutorial. This module is now ready to be used as a part of the first iteration of the model.
-TimeToAllocateResources
-= 2
+## Work module
+<div outputclass="hr"/>
-Productivity
-= 1
+Open Project module by double-clicking it on the Model Browser.
-PossibleWorkingSpeed
-= WorkforceStock * Productivity
-Is Output
-</pre>
+Create a flow of work with stocks and flows like in the picture. This loop says that there is some initial amount of work that is done at a certain speed, gradually becoming completed work. However, our workers are not perfect, as such errors can occur during work. These errors are first undiscovered, and as they are found they become work that needs to be completed.
-Variables can be set as output by selecting Is Output option from the Equation tab.
+You will see red exclamation mark next to the symbols due to empty equation fields, these are omitted from the tutorial images for clarity reasons. We will return to fill in these fields later.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/RequiredWorkingSpeedInput.png">
- <p class="imageText">RequiredWorkingSpeedInput</p>
+ <img src="AdvancedTutorialImages/WorkStocks.png">
+ <p class="imageText">Basic work with errors</p>
</div>
-On a previous phase, we wanted to give the value of RequiredWorkingSpeed1 to this workforce module. To get that value, we need to create an input. Create input RequiredWorkingSpeedInput, connect it to WorkforceRequired and write the following equation to WorkforceRequired.
+Next let's create variables that control the parameters of a project and handle the request of asking people for work. Create auxiliary variables: StartTime, Deadline, ProjectDuration, TimeToStartTime, TimeToDeadline, RequestedWorkingSpeed, ProjectWorkAmount and NumberOfWorkdaysInProject. Connect the symbols as in the picture and write the following expression to their expression fields. Click the checkbox Is Output on RequestedWorkingSpeed variable to make the module output the value of this variable.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/ProjectRequestPeople.png">
+ <p class="imageText">Structure of requesting people to work</p>
+</div>
<pre>
-WorkForceRequired
-= RequiredWorkingSpeedInput/Productivity
-</pre>
+StartTime
+= 5
-Now this module is ready to be used as a part of the model.
+Deadline
+= 20
-## Work module
-<div outputclass="hr"/>
+ProjectDuration
+= Deadline-StartTime
-<div class="imageBorder">
- <img src="AdvancedTutorialImages/WorkStocks.png">
- <p class="imageText">Basic work with errors</p>
-</div>
+TimeToStartTime
+= max(0, StartTime-time)
-Open Work1 module by selecting it from the WorkModel diagram, right-clicking it and selecting Show Module. Alternatively you can double click Work1 on the model browser.
+TimeToDeadline
+= Deadline-time
-Create the basic flow of work with stocks and flows like in the picture on the right.
+RequestedWorkingSpeed
+= if WorkToDo > 0 and TimeToStartTime == 0 then NumberOfWorkdaysInProject/ProjectDuration else 0
-The idea of the model is that first there is work. Work is done at a certain speed. When working, errors are also made. When errors are found, the amount of Errors is reduced, errors are removed from WorkDone and moved back to WorkToDo.
+ProjectWorkAmount
+= 500
+
+NumberOfWorkdaysInProject
+= ProjectWorkAmount/7
+</pre>
+
+The project has parameters for starting time, deadline and budgeted hours of work. Based on these we calculate how many people the project needs, assuming that an average worker works for 7 hours per day. The number of people is handled as a floating point integer, meaning that one worker can work on multiple different projects.
+
+Now let's create an input variable to take in the information of how much workforce we got from our request. Create an input variable and name it ResponseWorkingSpeedInput. We are also going to calculate how many hours a day the workers need to work in order to get the project ready in time and limit the result between 7 and 9 hours a day. Create two auxiliary variables and name them RequiredWorkHoursPerDay and TotalWorkHoursPerDay, connect them to other variables as in the image.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/ProjectIsReady.png">
- <p class="imageText">Smoothener for work is done</p>
+ <img src="AdvancedTutorialImages/ResponsedWorkingSpeedInput.png">
+ <p class="imageText">Input for responsed working speed</p>
</div>
-Work needs to be stopped when the project is ready. Since the simulator might face some difficulties to determine the projects readyness when project is almost ready, we need to implement some smoothing to the limit. OpenModelica doesn't yet have a builtin function for smoothing, so we need to implement our own. Create variables and connections according to the picture on the right.
-
-Use the following equations for variables:
+Write the following expression to the equation fields of the new auxiliary variables:
<pre>
-ProjectIsReady
-Initial value: 0
+RequiredWorkHoursPerDay
+= if ResponseWorkingSpeedInput == 0 then 0 else if TimeToDeadline < 0 then 9 else minmax(WorkToDo/ResponseWorkingSpeedInput/TimeToDeadline, 7, 9)
+
+TotalWorkHoursPerDay
+= RequiredWorkHoursPerDay*ResponseWorkingSpeedInput
-ProjectReadyness
-= (xidz(WorkDone, ProjectWorkAmount, 0.0) - ProjectIsReady) / 0.08
+WorkingSpeed
+= TotalWorkHoursPerDay
</pre>
-xidz is short for function X if devided by zero. This means that the simulation calculates ''WorkDone / ProjectWorkAmount''. If ProjectWorkAmount is zero, the result is the third argument ''0.0''.
+Next we focus on completing the structure of the work loop. Create 2 auxiliary variables and name them WorkQuality and ErrorsFoundTime. Also, create two Shadow variables and select WorkQuality and ProjectWorkAmount as the referred variables. Shadow variable is a special type of variable, whose role is to pass along the referred variable value to a place where drawing a dependency arrow from the original symbol would make the graph difficult to read. Place the new symbols as in the image and make the dependency connections.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/ProjectWorkAmount.png">
- <p class="imageText">ProjectWorkAmount input variable</p>
+ <img src="AdvancedTutorialImages/WorkLoop.png">
+ <p class="imageText">Completed work loop structure</p>
</div>
-As you can see, ProjectWorkAmount is highlighted. Your model doesn't contain such variable and it is not connected to ProjectReadyness. Create an Input variable ProjectWorkAmount with default value 1000 and connect it to ProjectReadyness. The reason we are using input variable is that you can determine the default size of a project, but if you want to change it, you can change it from outside the module.
+Now that the structure of the work loop is completed let's input equations to the variables.
-<div class="imageBorder">
- <img src="AdvancedTutorialImages/ErrorsVariables.png">
- <p class="imageText">Variables needed for error handling</p>
-</div>
+<pre>
+WorkToDo
+Integral: ErrorsFoundRate - WorkingSpeed
+Initial Value: ProjectWorkAmount
-Next we need to define how errors are found. For that we need new variables: WorkQuality and ErrorsFoundTime. Create the variables and connections according to the picture and give variables their equations.
+WorkDone
+Integral: WorkingSpeed - ErrorsFoundRate
+Initial Value: 0
-<pre>
ErrorsGenerated
= (1-WorkQuality) * WorkingSpeed
+UndiscoveredErrors
+Integral: ErrorsGenerated - ErrorsFoundRate
+Initial Value: 0
+
ErrorsFoundRate
-= Errors/ErrorsFoundTime
+= UndiscoveredErrors/ErrorsFoundTime
+</pre>
-WorkQuality
-= 0.9
+For ErrorsFoundTime we are going to use a special type of auxiliary variable called WithLookup. WithLookup is a variable type where the value is interpolated from a 2-dimensional (Lookup) table using the value determined in the "With Lookup" field. Input the following values.
+<pre>
ErrorsFoundTime
Type: WithLookup
-With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0)
+With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0)
Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
</pre>
-WithLookup is a variable type where the value is interpolated from a 2-dimensional table (Lookup table) using the value determined in the "With Lookup" field. Type can be changed from the drop-down menu Type.
+This variable makes it so that the less we have completed work the larger the variable value is and vice versa. And as we use this value in ErrorsFoundRate variable to divide the number of undiscovered errors, a practical interpretation would be that when we start working on a project we don't discover errors easily. But, as the project gets more and more completed we start to discover more and more errors made earlier on in the project.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/ErrorsFoundTimeWithLookUp.png">
+ <p class="imageText">Choosing WithLookup as the auxiliary type</p>
+</div>
+
+Now we are going to create a small feedback structure around WorkQuality. The purpose is to simulate how working overtime for a prolonged period causes fatigue. Create a stock variable called Fatigue and two flows, WorkingOverTime and SlowRecovery. Also create a shadow variable of RequiredWorkingHoursPerDay. Connect the variables as shown in the image.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/WorkAllocation.png">
- <p class="imageText">WorkAllocation and RequiredWorkingSpeed</p>
+ <img src="AdvancedTutorialImages/WorkQualityStructure.png">
+ <p class="imageText">Structure around WorkQuality</p>
</div>
-To calculate our own need for workforce we need to create and connect WorkCompletionTime input variable and the following auxliary variables:
+Input the following equations to the variables:
<pre>
-RequiredWorkingSpeed
-= if ProjectIsReady < 1 then xidz(WorkToDo, TimeToDeadline, MaximumWorkingSpeed) else 0
-Is Output
+WorkingOverTime
+= if RequiredWorkHoursPerDay == 0 then 0 else (RequiredWorkHoursPerDay-7)*0.025
-MaximumWorkingSpeed
-= 500
+SlowRecovery
+= if Fatigue >= 0 then 0.03 else 0
-TimeToDeadline
-= max(0, WorkCompletionTime-time)
+Fatigue
+Integral: WorkingOverTime - SlowRecovery
+Initial Value: 0
+
+WorkQuality
+= max(0.95*(1-Fatigue), 0.7)
</pre>
-time is a universal variable that gives the current simulation time.
+Now working overtime causes fatigue to build up slowly, and fatigue in return causes work quality to decrease. This in return makes the workers more prone to do errors while working, causing more work to do, increasing the need for overtime work.
-We need to decide how the workforce is allocated between all the work modules that are using the same workforce. For that we need to know how much work can be done and how much workforce other works require.
+There is only one thing left to do for this module, we are going to create variables that tell when the project was completed. An intuitive approach would be to claim that a project is complete when the value of WorkToDo goes to zero. However, due to the structure of the work loop we are likely to find some errors even after the WorkToDo goes to zero. We solve this by recording the time when WorkToDo is zero (or under) for the first time.
-Create two Inputs, RequiredWorkingSpeedTotalInput and PossibleWorkingSpeedInput, and an auxiliary variable WorkAllocation. Connect the variables like int the picture.
+Create a ghost variables of WorkToDo and Deadline. Then, create three auxiliary variables called ProjectIsCompleted, ProjectCompletitionTime and DaysLateOnDeadline. Connect the variables as in the image.
-<pre>
-WorkAllocation
-= xidz(RequiredWorkingSpeed, RequiredWorkingSpeedTotalInput, 0.0) * PossibleWorkingSpeedInput
-</pre>
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/DaysLateOnDeadlineStructure.png">
+ <p class="imageText">Structure of DaysLateOnDeadline</p>
+</div>
-Finally let's give initial values for all the remaining variables:
+The variables use the following equations:
<pre>
-WorkingSpeed
-= if ProjectIsReady < 1 then WorkAllocation else 0
-
-WorkToDo
-Initial value: ProjectWorkAmount
+ProjectIsCompleted
+= if time == 0 then 0 else if WorkToDo > 0 and ProjectIsCompleted == 0 then 0 else 1
-WorkDone
-Initial value: 0
+ProjectCompletitionTime
+= if ProjectIsCompleted == 0 then time else ProjectCompletitionTime
-Errors
-Initial value: 0
+DaysLateOnDeadline
+= ProjectCompletitionTime-Deadline
</pre>
-## Connecting modules
-<div outputclass="hr"/>
-
-Our modules are complete. Let's get back to the WorkModel Configuration.
+You can think of ProjectIsCompleted as a Boolean variable that goes to 1 and stays there when WorkToDo goes to 0 for the first time. ProjectCompletitionTime keeps track of time until the project is completed.
-<pre>
-Set Work1CompletionTime to 10.
-</pre>
+Now the Project module is complete.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/ModuleConnections1.png">
- <p class="imageText">Module input connections</p>
+ <img src="AdvancedTutorialImages/CompletedProjectModule.png">
+ <p class="imageText">Completed Project module</p>
</div>
-Connections between modules are made in the properties of the module. Select Work1 and open tab Inputs from the properties. The table lists all input variables in the module that are available. Clicking on the Refers to output column will open a drop-down menu that shows all available variables that are connected to the module. By selecting a variable, you connect that variable to the input.
+## Connecting modules
+<div outputclass="hr"/>
+
+Now that our modules are complete, let's get back to the WorkModel Configuration and connect the inputs and outputs of the modules. Select Project1 and then select Outputs tab from the properties view. Select the only available variable as the connection. Do the same in the Inputs tab. And repeat this process for Workforce1 also.
<div class="imageBorder">
- <img src="AdvancedTutorialImages/ModuleConnections2.png">
+ <img src="AdvancedTutorialImages/ModuleConnections1.png">
<p class="imageText">Module input connections</p>
</div>
-Work1 need also information on how much working speed is required by all works. Since Work1 is the only work, create a dependency connection from RequiredWorkingSpeed1 to Work1 and in Work1's properties connect it to RequiredWorkingSpeedTotalInput.
-
-In Outputs tab, make the only possible connection: from RequiredWorkingSpeed to RequiredWorkingSpeed1.
-
-Workforce module has only one input and one output. Create the only possible connections:
-(Inputs) RequiredWorkingSpeedInput -> RequiredWorkingSpeed1
-(Outputs) PossibleWorkingSpeed -> TotalPossibleWorkingSpeed
-
Now your model is ready for simulation!
## Simulating the model
<div outputclass="hr"/>
-To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 24.0
+To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 50.
<div class="imageBorder">
<img src="AdvancedTutorialImages/ActivateExperiment.png">
<p class="imageText">Experiment activation</p>
</div>
-To run simulations, you must activate an experiment. Expand the experiments folder on your model browser. There is one ready-made experiment. Double click on the experiment and the experiment control buttons appear on the toolbar. To simulate the model, press the play button: <div class="image">
+To run simulations, you must activate an experiment. Expand the experiments folder on your model browser. There is one ready-made experiment. Double-click on the experiment and the experiment control buttons appear on the toolbar. To simulate the model, press the play button:
+
+<div class="image">
<img src="AdvancedTutorialImages/ExperimentPlay.png">
</div>
-System shows the simulation progress in the progress bar on the lower right corner of the screen.
+System shows the simulation progress in the progress bar on the lower right corner of the screen.
<div class="image">
<img src="AdvancedTutorialImages/SimulationProgress.png">
If the Console view pops up and shows an error "Error: Too few equations, underdetermined system. The model has X equation(s) and Y variable(s)", the simulation has failed. The reason might be that you forgot to assign an equation to some variable or some connection in modules. See through all the variables, write the missing equation and simulate again.
-After the simulation is succesfully run, you can select a variable and see its simulation results in the trend view. For example WorkDone variable in Work1 module will give the following graph.
+After the simulation has successfully completed, you can select a variable from model browser under Configuration to see its values over time in the trend view. You can also right-click on a module and select Show Module. This brings up a view of the internal structure of the module instance used in the simulation. Selecting a variable from there will show its values in the trend view.
+
+<div class="image">
+ <img src="AdvancedTutorialImages/ShowModule.png">
+</div>
+
+For example, RequiredWorkingHoursPerDay variable in Project1 module should give the following graph. At first assigned workers are working 7 hours per day, but they start working more when the deadline starts closing in. After the project is completed, a few undiscovered errors are found and workers return to correct them.
<div class="image">
<img src="AdvancedTutorialImages/FirstSimulation.png">
## Adding modules
<div outputclass="hr"/>
+Now that we have a model with one Project module we are going to expand the model to support as many Projects as we want. First, we need to make some restructuring on the top level. Delete the dependency arrow that goes from ResponsedWorkingSpeed to Project1 module, also delete RequestedWorkingSpeed symbol entirely. Now create two new auxiliary variables and name them RequestedWorkingSpeed and WorkforceProject1. Connect the new auxiliaries as in the picture, remember make the connection inside the module properties as well.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/AddingModules1.png">
+ <p class="imageText">Updated model structure</p>
+</div>
+
+Write the following equations inside the new variables:
+<pre>
+RequestedWorkingSpeed
+= Project1.RequestedWorkingSpeed
+
+WorkforceProject1
+= ResponsedWorkingSpeed
+</pre>
+
+Notice that we can access variable values without having dependency arrows connected, we are given a warning next to the symbol as this should be done only when you know exactly what you are doing. Also, note that we can access values inside modules by using a dot notation modulename.variablename.
+
+Simulate the model once to make sure nothing broke.
+
+Next create a new Project module and a corresponding auxiliary variable WorkforceProject2, connect the auxiliary variable to the module and make the input connection in the module settings.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/AddingModules2.png">
+ <p class="imageText">Updated model structure</p>
+</div>
+
+Now we need to make the Workforce1 module to work with several projects at the same time, for this we use enumerations. You can think of enumerations as indices of a vector variable. To create an enumeration right-click on Configuration and select New→Enumeration.
+
<div class="imageBorder">
- <img src="AdvancedTutorialImages/ModulesFinal.png">
- <p class="imageText">Final configuration with two modules</p>
+ <img src="AdvancedTutorialImages/NewEnumeration.png">
+ <p class="imageText">Creating a new enumeration</p>
</div>
-We created the WorkModule to be reusable. To use two WorkModules in the model, you must do the following.
+ Select the newly created enumeration under Configuration and rename it to Projects. Then, select the enumeration and from properties view click twice on Add, rename index and index2 to Project1 and Project2 respectively.
-Populate a second WorkModule to WorkModel configuration and name it Work2.
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/AddEnumerations.png">
+ <p class="imageText">Creating new indices for Projects enumeration</p>
+</div>
-Create RequiredWorkingSpeed2 input variable and Work2CompletionTime auxiliary variable.
+Now we have created the needed enumeration for the top level model. We need to create one for the Workforce module as well. Under the Modules folder in the model browser right-click on Workforce, select New→Enumeration, name it Projects and add a single dummy enumeration. Then make sure the checkbox Can be replaced by parent module is checked. Then select Workforce1 module and from Module Properties overwrite enumeration Projects with Projects. This way we only have to update enumerations in one place when adding new projects to the model.
-We need a sum of all working speed requirements to give to the work modules. For this purpose, create an auxiliary variable RequiredWorkingSpeedTotal which sums the requirements.
+Now we need to select which variables use the enumerations, i.e. what scalar variables we need to turn into vector variables. In the top-level model select RequestedWorkingSpeed and ResponsedWorkingSpeed by holding down ctrl while left-clicking on the symbols, this should bring up a view that allows you to add enumerations to the selected symbols. From the left select Projects by left-clicking and click on the arrow, Projects enumeration should appear on the right side.
-You can also have a different size work. To make Work2 smaller, create an auxiliary variable Work2Amount.
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/AddEnumerationToSymbols.png">
+ <p class="imageText">Adding enumerations to symbols</p>
+</div>
-Use the following equations:
+We need to change the equations of RequestedWorkingSpeed, WorkforceProject1 and WorkforceProject2. RequestedWorkingSpeed needs information from both Project modules and WorkforceProject variables should be scalars. Input the following equations:
<pre>
-Work2CompletionTime
-= 13
+RequestedWorkingSpeed
+= {Project1.RequestedWorkingSpeed, Project2.RequestedWorkingSpeed}
-Work2Amount
-= 800
+WorkforceProject1
+= ResponsedWorkingSpeed[Project1]
-RequiredWorkingSpeedTotal
-= RequiredWorkingSpeed1 + RequiredWorkingSpeed2
+WorkforceProject2
+= ResponsedWorkingSpeed[Project2]
</pre>
-Update connections to match connections shown in the picture and connect the inputs and outputs to the modules.
+Next we need to update the structure of Workforce module so that it handles vector variables. Open the module by right-clicking on Workforce1 and selecting Show Module.
+
+Select variables EmployeesAssigned and RequestedNumberOfPeople and add the Projects enumeration to them as before.
+
+Now we are going to create a custom function that allocates people to projects. To create a custom function, in the Model Browser right-click on Functions folder and select new→Function. Now click on the newly created function and rename it to AssignWorkersToProjects.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/NewFunction.png">
+ <p class="imageText">Creating a new function</p>
+</div>
+
+
+Write (or copy-paste) the following Modelica code to the empty text field. When working with custom Modelica functions note that you need to press shift+enter to create new lines.
<pre>
-Workforce
-RequiredWorkingSpeedInput -> RequiredWorkingSpeedTotal
+public input Real requestedhr[:];
+public input Real totalrequestedhr;
+public input Real availablehr;
+public output Real allocatedhr[size(requestedhr, 1)];
+algorithm
+requestaspercentage := zeros(size(requestedhr, 1));
+nofpeople := zeros(size(requestedhr, 1));
+for i in 1:size(requestedhr, 1) loop
+ requestaspercentage[i] := xidz(requestedhr[i], totalrequestedhr, 0);
+ nofpeople[i] := min(availablehr*requestaspercentage[i], requestedhr[i]);
+ allocatedhr[i] := nofpeople[i];
+end for;
+</pre>
+
+To give you a quick rundown of the code logic, we have 3 input variables. First one tells how much workforce each projects wants, the second tells what the total number of requested people is and the third tells how many employees we have. The function outputs a vector that tells how many people it assigned to which project. In case there is more demand than available workforce, we calculate what percentage of the whole demand each project contributes and assign people accordingly.
+
+Now that our custom Modelica function is ready we are going to use it in the EmployeesAssigned variable. Select EmployeesAssigned and on the right of the properties view select Function tab, double-click on the custom function to make it appear in the equation field. Give the function following parameters: RequestedNumberOfPeople, sum(RequestedNumberOfPeople), NumberOfEmployees.
-Work1 Inputs
-RequiredWorkingSpeedTotalInput -> RequiredWorkingSpeedTotal
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/CustomFunctionInPropertiesView.png">
+ <p class="imageText">Our custom function in variable properties view</p>
+</div>
-Work2 Outputs
-RequiredWorkingSpeed -> RequiredWorkingSpeed2
+Finally we need to change the calculation logic of NumberOfFreeEmployees. As EmployeesAssigned is now a vector variable just add sum() function around it in the equation field.
-Work2 Inputs
+<pre>
+NumberOfFreeEmployees
+= NumberOfEmployees-sum(EmployeesAssigned)
</pre>
-<div class="image">
- <img src="AdvancedTutorialImages/Module2Inputs.png">
+Now the Workforce module is completed!
+
+Finally, we are going to give the projects different parameters. Select Project2 and from the properties view select Parameters tab. By slowly double-clicking on a value you can change the starting time, deadline and work amount of a project.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/ProjectParameters.png">
+ <p class="imageText">Parameters of Project2</p>
</div>
-When all the connections are made, you can simulate the model again. Now you have model with two work modules. Select variables from both modules in model browser to display them in trend view.
+Set the following parameters.
-<div class="image">
- <img src="AdvancedTutorialImages/SecondSimulation.png">
+<pre>
+Deadline: 40
+ProjectWorkAmount : 900
+StartTime: 0
+</pre>
+
+Now we have completed a model with two Project modules, simulate to make sure your model is working.
+
+By following the steps below you can add a new project module to the model. Our current implementation supports any number of projects.
+
+<pre>
+1. Add a new Project module to the diagram
+2. Add a new auxiliary variable and name it WorkforceProject3
+3. Connect the new auxiliary variable with the module using a dependency arrow and connect it to the module in the input tab
+4. Update the equation field of RequestedWorkingSpeed to {Project1.RequestedWorkingSpeed, Project2.RequestedWorkingSpeed, Project3.RequestedWorkingSpeed}
+5. Choose Project enumeration under configuration and add click add, name the new index to Project3
+6. Write ResponsedWorkingSpeed[Project3] as the equation for the new auxiliary variable
+7. Finally, customize the parameters of Project3 module in the Parameters tab
+</pre>
+
+Create a third Project module using the instructions above with the following parameters.
+
+<pre>
+Deadline: 20
+ProjectWorkAmount : 300
+StartTime: 10
+</pre>
+
+To make the results of the simulation more readable we can add auxiliary variables that collect information from each of the Project modules. For example, we might be interested the behaviour of WorkQuality, RequiredWorkingHoursPerDay and DaysLateOnDeadline. Create an auxiliary variable for each of these, add Project enumeration to them and input the following equations.
+
+<pre>
+DaysLateOnDeadline
+ = {Project1.DaysLateOnDeadline, Project2.DaysLateOnDeadline, Project3.DaysLateOnDeadline}
+
+ RequiredWorkHoursPerDay
+ = {Project1.RequiredWorkHoursPerDay, Project2.RequiredWorkHoursPerDay, Project3.RequiredWorkHoursPerDay}
+
+ WorkQuality
+ = {Project1.WorkQuality, Project2.WorkQuality, Project3.WorkQuality}
+</pre>
+
+Remember to update these variables also if you intend to use more than 3 projects.
+
+If you now simulate the model the results of RequiredWorkHoursPerDay should look like this.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/RequiredWorkHoursPerDayResults.png">
+ <p class="imageText">RequiredWorkHoursPerDay results</p>
+</div>
+
+And WorkQuality should look like this.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/WorkQualityResults.png">
+ <p class="imageText">WorkQuality results</p>
</div>
+
+Reading results from DaysLateOnDeadline variable is hard as the variable keeps track of time before the deadline. To see the results more clearly we are going to create a custom bar chart. Right-click on Charts folder under the WorkModel and select New→Bar Chart, rename the chart to Project deadlines and rename the Title to Days late on deadline. Then choose the tab Variables, click on Add, select Write variable name and write DaysLateOnDeadline to the field. Bar charts automatically use the last time step of the simulation when retrieving variable values. The chart should like this.
+
+<div class="imageBorder">
+ <img src="AdvancedTutorialImages/DaysLateOnDeadlineResults.png">
+ <p class="imageText">DaysLateOnDeadline results</p>
+</div>
+
+Now you have completed the advanced Simantics System Dynamics tutorial.
+
+There are some features that neither of the tutorials cover that can be found in the [documentation](sysdyn.md).
+
+If you still want to practice using the tool, here are some ideas on how to further develop the model we just made.
+
+<pre>
+1. The number of employees is currently a static variable, think of ways to simulate the hiring procedure of a company using stocks and flows
+2. Add more projects and think of ways to optimize project scheduling
+3. Add wages to employees and an external workforce that is used in case internal workforce isn't enough, minimize total costs
+</pre>
+
+Happy simulating!
# Tutorial: Basic System Dynamics Modelling
<div outputclass="hr"/>
-* [1 Model](#model)
+This tutorial gives an introduction to the Simantics System Dynamic Tool. We will go over how to create, simulate and analyze a simple system dynamic model. After completing this tutorial, if you wish, there is an [advanced tutorial](AdvancedTutorial.md) that goes more in-depth on the advanced features of the tool. It is recommended that you give a quick glance at first few chapters of the [documentation](sysdyn.md) before starting. You should especially familiarize yourself with the [workbench](sysdyn.md#workbench) of the tool to know the terminology used in the tutorials.
+
+We are going to create the classic prey-predator model. In our case the model will describe how the population sizes of mice (prey) and owls (predator) change over time. The basic idea around the model is to capture the dynamics of two different population sizes. Let's assume a starting scenario where there is a large mice population and a small owl population. Owls start eating mice decreasing their population, and in turn, giving the owl population the opportunity to grow due to good food availability. However, as the mice population is decreasing and the owl population increasing, at some point there won't be enough food for the entire owl population, leading to starvation and consequently to a decrease in owl population size. The decreased owl population size then allows the mice population to regrow, as they have a smaller number of natural predators on the hunt.
+
+This tutorial is a walkthrough for creating and analyzing such a model.
+
+* [1 Creating a new model](#model)
* [2 Configuring the model structure](#configuring-the-model-structure)
* [3 Equations](#equations)
* [4 Simulating the model](#simulating-the-model)
+* [5 Result analysis](#result-analysis)
-This tutorial introduces you to the basic components and concepts of the System dynamics modelling tool for Simantics. After completing this tutorial, you know how to configure and simulate a system dynamics model. An [advanced tutorial](AdvancedTutorial.md) is also available. This tutorial is part of the [sysdyn documentation](sysdyn.md).
-
-## Model
+## Creating a new model
<div outputclass="hr"/>
-We are going to create a simple population model. The model consists of the basic components: Auxiliaries, valves, stocks, dependencies and flows.
-
-Start by creating a new model. Right-click on the model browser and select New -> Model.
+Start by creating a new model from File→New→SD Model.
<div class="imageBorder">
<img src="BasicTutorialImages/NewModel.png">
<p class="imageText">Creating a new model</p>
</div>
-Rename the model to Population. Right-click on Model1 and select Rename.
-
-Expand the model tree and double-click on Configuration. The model configuration diagram opens in a new editor.
+Rename the model to Population by slowly clicking twice on the model name in the Model Browser or by clicking the model once and changing the name from the properties view at the bottom of the tool. Then, expand the model tree and open the model diagram by double-clicking the Population model from Model Browser.
## Configuring the model structure
<div outputclass="hr"/>
-Our model is now empty. Let's build a population model for mice.
+Let's start by building a population model for the mice.
-Open Symbols view and expand BasicSymbols. If BasicSymbols are not visible, make sure that you have the diagram open. The contents of the Symbols view depends on the active diagram editor.
+Drag the Symbols view from right of the Model Browser to underneath it and expand BasicSymbols for easier use. If BasicSymbols is not visible, make sure that you have the diagram open as the contents of the Symbols view depends on the active diagram editor.
<div class="imageBorder">
<img src="BasicTutorialImages/SymbolsView.png">
<p class="imageText">Symbols view</p>
</div>
-These are the basic symbols in System dynamics modelling. We will use these to create the model.
+These are the basic symbols in System dynamic modelling that will be used to create the model.
-Drag one stock variable from Symbols view to the diagram. You can zoom and move on the diagram using [shortcut keys](sysdyn.md#shortcut-and-control-keys)
+Drag one stock variable from Symbols view to the diagram. You can zoom and move on the diagram using the middle mouse button.
-Select the variable. Properties view on the bottom of the screen shows the properties of the selected variable. Change the name to Mice and press enter.
+Select the variable to bring up Properties view on the bottom of the tool. Change the name to Mice and press enter. You should have a red exclamation mark next to the symbol telling that the variable needs to have expressions for Integral and Initial Value fields. These are not shown in the pictures of this tutorial for visual clarity. We will write expressions to these fields later. You can find a collection of warnings and errors related to the model from the Issues tab right of the Properties tab.
<div class="imageBorder">
<img src="BasicTutorialImages/Mice.png">
- <p class="imageText">Stock variable Mice</p>
+ <p class="imageText">Stock variable Mice with the Properties view open, issues can be found on the third tab from the left</p>
</div>
-Next we will draw flows in and out of Mice. Drag one cloud variable from Symbols view to the left hand side of Mice. Hold down Alt and right-click on the cloud. Move cursor on top of Mice and left-click. The system creates a flow from the cloud to Mice and a valve in the middle of the flow. The valve controls the speed of the flow. Flow from Mice is created the same way. Drag one cloud variable from Symbols view to the right hand side of Mice. Hold down Alt and right-click on Mice. Move cursor on top of the cloud and left-click. Rename the valves to MouseBirths and MouseDeaths.
+Next we will draw flows in and out of Mice. Drag one cloud variable from Symbols view to the left hand side of Mice. Hold down Alt and right-click on the cloud, then move your cursor on top of Mice and left-click. The system creates a flow from the cloud to Mice and a valve in between. The valve controls the speed of the flow, in this case the birthrate of Mice. We also need a flow going out from Mice to control the death rate. Let's create this using a shortcut. Right-click Mice while holding Alt down, then drag your mouse right of the Mice and press left-click while holding Alt down. Rename the valves to MouseBirths and MouseDeaths.
<div class="imageBorder">
<img src="BasicTutorialImages/MiceFlows.png">
<p class="imageText">Flows in and out of Mice</p>
</div>
-Of course mice are not alone in the world. There are also owls that hunt mice. Create a similar structure below mice for owls.
+Of course mice are not alone in our imaginary world. We also need owls that hunt mice. Create a similar structure for owls by copy-pasting and renaming. You can copy by drag selecting components and using the all familiar Ctrl+C and Ctrl+V.
<div class="imageBorder">
<img src="BasicTutorialImages/MiceAndOwls.png">
<p class="imageText">Owls and mice</p>
</div>
-To control the births and deaths, we need auxiliary variables. Auxiliary variables can be dragged from Symbols view just like Stock variables. We need one variable for each valve to control it. Drag the variables and rename them according to the picture below.
+To control births and deaths we use auxiliary variables. Auxiliary variables can be dragged from Symbols view just like Stock variables. We need one variable for each valve. Drag the variables and rename them according to the picture below.
<div class="imageBorder">
<img src="BasicTutorialImages/Auxiliaries.png">
<p class="imageText">Auxiliaries for valves</p>
</div>
-Arrow connections, dependencies, are created almost like flows. The difference is that the connection is started and ended with a left click and the connection can only be made between two existing variables. Connect the auxiliary variables and valves like in the picture below.
+Next we need to draw dependency arrows to tell which components of the system have an interaction. Dependency arrows are created by Alt+left-clicking on a symbol and then clicking on another symbol. Connect components like in the picture below.
<div class="imageBorder">
<img src="BasicTutorialImages/Dependency_connections.png">
## Equations
<div outputclass="hr"/>
-As you can see from the model, we have made some shortcuts in our model to make it more simple. In reality, there are lots of other factors that affect mouse and owl populations. Let's however use this model as an example.
-
-For the model to be simulated, each variable needs to have an equation. Equations can be configured from the property view, like the names. Input the following equations into the corresponding variables:
+Now we need to give each variable an equation, stock variables also need a value for initial population. Like names, equations can be configured from the property view. Input the following equations into the corresponding variables:
<pre>
MouseBirths
= 0.09
</pre>
-Finally we need initial values for our populations.
+Finally input initial population values for Mice and Owls.
<pre>
Mice
## Simulating the model
<div outputclass="hr"/>
+Now the model is configured and ready for simulation. An experiment needs to be activated before a model can be simulated. Expand the Experiments folder of your model and double-click on Experiment to activate it. This adds experiment control buttons to the toolbar.
+
<div class="imageBorder">
<img src="BasicTutorialImages/ActivatePopulationExperiment.png">
<p class="imageText">Experiment activation</p>
</div>
-Now the model is configured and ready for simulation. Switch Symbols view back to Model Browser. Expand the Experiments folder on your model and double-click on Experiment. This activates the experiment. Experiment needs to be active before the model can be simulated. Experiment activations adds experiment control buttons to the toolbar. To simulate the model, press the play button: <div class="image">
+To simulate the model, press the play button:
+
+<div class="image">
<img src="BasicTutorialImages/ExperimentPlay.png">
</div>
-System shows the simulation progress in the progress bar on the lower right corner of the screen.
+System shows the simulation progress in the progress bar on the lower right corner of the screen. As our model is very simple the progress bar will most likely go by faster that you can see it.
<div class="image">
<img src="BasicTutorialImages/SimulationProgress.png">
When the progress indicator disappears, the simulation is complete.
-After the simulation has run, you can select variables from the diagram or model browser and their values over the simulation time will be shown on Trend View. You can select multiple variables from the diagram by holding down Ctrl key. Select Mice and Owls.
+After the simulation has been completed, you can select variables from the diagram or Model Browser and their values over the simulation time will be shown on Trend view. You can select multiple variables from the diagram by holding down Ctrl key or by drag selecting. Select Mice and Owls.
<div class="imageBorder">
<img src="BasicTutorialImages/MiceAndOwlResults1.png">
<p class="imageText">Results for Mice and Owls</p>
</div>
-As you can see, the simulation is complete, but the results do not reveal any interesting behavior. Let's extend the simulation time.
+As you can see, the simulation is complete, but the results do not reveal anything interesting. We need to extend the simulation time.
-Select Configuration from the model browser. In the properties-view change stop time to 300.0 and simulate again.
+Select Configuration from the Model Browser. In the properties view change stop time to 300.0 and simulate again.
-After the simualtion is complete, Select Mice and Owls again.
+<div class="imageBorder">
+ <img src="BasicTutorialImages/Configuration1.png">
+ <p class="imageText">Model configuration</p>
+</div>
+
+After the simulation is complete, Select Mice and Owls again.
<div class="imageBorder">
<img src="BasicTutorialImages/MiceAndOwlResults2.png">
- <p class="imageText">Results for Mice and Owls, Extended simulation time</p>
+ <p class="imageText">Results for Mice and Owls, extended simulation time</p>
+</div>
+
+Now we can see the wanted behavior. As the mice population reaches a certain point the number of owls start to increase as they have more food. The increase in owl population lowers the mice population, leading to starvation between owls. The lowered owl population in turn allows the mice population grow back, and the cycle continues. In fact this model simulates the behavior of a pair of first-order nonlinear differential equations also known as Lotka-Volterra equations.
+
+However, we can see that there is something wrong with the results; the peaks of the mice population are not on the same level. We are using a step-size that is too long. On default the step size is calculated by dividing the simulation time to 500 equal steps, meaning that the previous results were obtained using a step size of (300-0)/500=0.6. (For a more bizarre behavior try simulating with a stop time of 950 using the default step size.)
+
+To combat this we can set the step size manually from the model configuration, the same place where we changed the simulation stop time. Change the step size to 0.01 and output interval to 1. Output interval allows us to manually configure the step size of the results, meaning that we can make the numerical errors arbitrarily small by lowering the simulation step size, while only having to handle a part of the steps used for the simulation. With these new parameters we now get the correct results.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/MiceAndOwlResults3.png">
+ <p class="imageText">Results for Mice and Owls with a simulation step size of 0.01</p>
+</div>
+
+## Result analysis
+<div outputclass="hr"/>
+
+In this chapter we are going to go over how to analyze the resulting model structure, use comment symbols, create and export graphs in form of charts and export the simulated dataset. Let's start with the model structure analysis.
+
+Often in system dynamics we are interested in how different feedback loops are formed inside of a model. There is a built in tool analyzing these. Open Structure view that is located between Trend and Values views, then select Loops tab. The contents update depending on the active selection, select OwlBirths symbol.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/OwlBirthsLoopStructure.png">
+ <p class="imageText">The loop structure of OwlBirths</p>
+</div>
+
+We can see a feedback loop of 3 variables. You could interpret this loop as follows: owl births increase the number of owls, the more owls there are the more mice are going to get eaten, the more mice that end up as food the more owls can breed.
+
+To make a visual representation of this feedback loop on the diagram we can utilize a comment symbol called Loop. Expand the CommentSymbols from Symbols and drag the symbol between Mice and Owls symbols. Then, from the properties view select Owls→MouseDeaths→OwlBirths from Loop Items and change the Direction of Rotation to counterclockwise. The Comment option is used for telling if the loop is reinforcing (R) or balancing (B). The symbol automatically detects this behavior, but you can also choose this manually or write your own explanation, if you wish. When you make the Loop symbol as your active selection it automatically highlights the symbols that are included in the loop to visualize how it is formed.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/LoopCommentSymbol.png">
+ <p class="imageText">Loop comment symbol</p>
+</div>
+
+The other comment symbol, called Comment, is purely for writing text in the diagram. It is useful, for example, when you want to have memos inside the diagram, or when you want to write an explanation for a design choice.
+
+Let's move on to graphs. There are two ways of creating them, Trend view (that we have used before) and Charts. Trend view allows you to export the graph as .svg and .png file formats from the top-right controls. However, the built in graph tool has much more options for customizing a graph. Let's create a phase-space plot of the model.
+
+Start by creating a new chart by right-clicking on the folder Charts under your model, then select New→Line Chart.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/newChart.png">
+ <p class="imageText">Creating a new chart</p>
+</div>
+
+Double click the newly made chart to open it and keep the chart selected to access its properties. Name the chart Phase-space plot, tick hide title and hide legend options, type Owls as the x-axis variable and change the label name to Alive owls.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/ChartProperties1.png">
+ <p class="imageText">Chart general properties</p>
</div>
-Now the simulation reveals the traditional behavior of predator-prey models. Feel free to adjust the parameters and try the simulations again.
+Then, select the Axis and Variables tab on the bottom, click on y-axis and rename label to Alive mice, then click Add variable. Select the \<Write variable name> and write Mice as the variable name.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/ChartAxisAndVariables.png">
+ <p class="imageText">Chart Axis and Variables properties</p>
+</div>
+
+Now you should have a completed phase-space plot of the prey-predator model. To export a graph right click on it and select either Save as→PNG or Print... and select the pdf printer of your choice. Notice that in order to see results on the graph you need to have an active experiment that has finished a simulation.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/PhaseSpacePlotAndExport.png">
+ <p class="imageText">Completed phase-space plot and export options</p>
+</div>
+
+You might also want to export the simulated data. Currently the easiest way is to copy it to your clipboard. First, select all components by clicking on the diagram and pressing Ctrl+A on the keyboard. Then, select Values view from the bottom left, click on any numerical value to put the field in focus, finally Ctrl+A and Ctrl+C. Now you have all of the numerical data on your clipboard for pasting to the tool of your choosing.
+
+<div class="imageBorder">
+ <img src="BasicTutorialImages/ValuesView.png">
+ <p class="imageText">Values view</p>
+</div>
+
+This concludes the basic tutorial. If you wish to learn more about the advanced features of the tool, please refer to the [wiki](sysdyn.md) or the [advanced tutorial](AdvancedTutorial.md).
+
+Happy simulating!
* [5.4 Shortcut and Control Keys](#shortcut-and-control-keys)
* [5.5 Unit Validation](#unit-validation)
* [5.6 Diagram Profiles](#diagram-profiles)
+ * [5.7 Debugging a model](#debugging-a-model)
* [6 Visual model elements](#visual-model-elements)
* [6.1 Fonts and colors](#fonts-and-colors)
* [6.2 Dependency properties](#dependency-properties)
* [10.2 Expressions](#expressions)
* [10.3 Array Slices](#array-slices)
* [10.4 Arithmetic Operators](#arithmetic-operators)
- * [10.5 Builtin Modelica Functions](#builtin-modelica-functions)
+ * [10.5 Built-in Modelica Functions](#Built-in-modelica-functions)
* [10.6 Simulation Results](#simulation-results)
* [10.7 Array Variables in Modules](#array-variables-in-modules)
* [11 Functions](#functions)
# What is Simantics System Dynamics
<div outputclass="hr"/>
-*Simantics System Dynamics* is currently the only open source modelling and simulating tool for Simantics. Simantics System Dynamics is under development and will go through some changes in the future. New features will be added and old ones improved according to the needs of the modellers.
+*Simantics System Dynamics* is currently the only open source modelling and simulating tool for Simantics. Simantics System Dynamics is under development and will go through changes in the future. New features will be added and old ones improved according to the needs of modellers.
-This documentation introduces you to the current version of Simantics System Dynamics. Documentation includes the basic modelling principles and a guide on how to model system dynamics models with Simantics System Dynamics. If you like to get to know the tool better and try modelling and simulating yourself, [install](#installation-instructions) the software and try our [basic](BasicTutorial.md) and [advanced](AdvancedTutorial.md) tutorials!
+This documentation introduces you to the current version of Simantics System Dynamics. The documentation includes basic modelling principles and a guide on how to model system dynamics models with Simantics System Dynamics. If you like to get to know the tool better and try modelling and simulating yourself, [install](#installation-instructions) the software and try our [basic](BasicTutorial.md) and [advanced](AdvancedTutorial.md) tutorials!
# Introduction to System Dynamics Simulation
<div outputclass="hr"/>
**Shadow**
-A shadow variable is a reference to a variable defined elsewhere on the diagram. The referred variable can be an auxiliary, a valve, a stock, or an input. Dependency and flow arrows can be drawn out of a shadow variable, but no arrows can be drawn into a shadow variable. Shadow variables are used to improve the readability of the model.
+Shadow variable is a reference to a variable defined elsewhere on the diagram. The referred variable can be an auxiliary, a valve, a stock, or an input. Dependency and flow arrows can be drawn out of a shadow variable, but no arrows can be drawn into a shadow variable. Shadow variables are used to improve the readability of the model.
**Loop**
-A loop element is a graphical component for highlighting selected feedback loops in a model.
+Loop element is a graphical component for highlighting selected feedback loops in a model.
**Comment**
-A comment element is a string of text on diagram.
+Comment element is a string of text on diagram.
## Modeling Principles
**Variable names**
-Variables names should be nouns, not verbs. The names should be positive: for example it is easier to understand that satisfaction decreases than dissatisfaction rises. Variable names can and should have multiple words, if they are needed. Note that due to the reserved words in Modelica, variable names such as *Carbon in Atmosphere* cannot be used (*in* is a reserved word). Capitalizing the reserved (*in* --> *In*) word can be used to sidestep the problem.
+Variables names should be nouns, not verbs. The names should be positive: for example it is easier to understand that satisfaction decreases than dissatisfaction rises. Variable names can and should have multiple words, if they are needed. Note that due to the reserved words in Modelica, variable names such as *Carbon in Atmosphere* cannot be used (*in* is a reserved word). Capitalizing the reserved (*in* → *In*) word can be used to sidestep the problem.
**Connections**
**Graphical annotations**
-System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important, for communicating the behavior of the model.
+System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important for communicating the behavior of the model.
# Installation Instructions
<div outputclass="hr"/>
System dynamics tool is provided with the Simantics platform.
1. [Download installer from the tool's download page](http://sysdyn.simantics.org/)
-2. Install the program to a directory without spaces (limitation inherited from OpenModelica).
+2. Install the program to a directory without spaces or special characters (limitation inherited from OpenModelica).
3. Run the application through the launcher generated by the installer
- (default: Simantics\Simantics-1.8.0-Sysdyn-32\Simantics-1.8.0-Sysdyn-32)
+[OpenModelica](http://www.openmodelica.org/) is used to build and simulate the models. Simantics platform has integrated OpenModelica 1.9.0 beta4 for Windows environments. For other versions and other environments you need to install the latest official 64bit release of [OpenModelica](https://www.openmodelica.org/download/download-windows). In addition to OpenModelica, a development version of a [purpose-built Modelica solver](#solvers) is embedded in the tool.
-[OpenModelica](http://www.openmodelica.org/) is used to build and simulate the models. Simantics platform has integrated OpenModelica 1.9.0 beta4 for Windows environments. For other versions and other environments you need to install [OpenModelica](https://www.openmodelica.org/download/download-windows). In addition to OpenModelica, a development version of a [purpose-built Modelica solver](#solvers) is embedded in the tool.
+If you plan on creating large models or using a long simulation time with a small step size, it is advised that you give the tool more memory by increasing the numerical value of property -Xmx in the file Simantics-Sysdyn.ini.
# Workbench
<div outputclass="hr"/>
1 **Diagram**
-Diagram is the area where you will graphically modify your model. Diagrams are built from elements that can be dragged from Symbols view or populated using shortcut keys.
+Diagram is the area where you will graphically modify your model. Diagrams are built from elements that can be dragged from Symbols view or populated using shortcut keys.
2 **Model Browser**
**Symbols**
-Symbols view (stacked with the model browser) is used for dragging elements to diagrams.
+Symbols view (stacked with the model browser) is used for dragging elements to diagrams.
-**Search**
+3 **Properties (MouseBirths in the image above)**
-Search view (stacked with the model browser) is used for searching elements in all models. Search can be launched also from the search field in the bottom right corner or by Ctrl+F.
-
-3 **Properties**
-
-Property view shows the selected variable's properties. Property view has a different layout depending on the type of the selected component. The view can also have different tabs depending on the component type. Basic tabs for variables are Equation, Indexes, and Additional information.
+Property view shows the selected variable's properties. Property view has a different layout depending on the type of the selected component. The view can also have different tabs depending on the component type. Basic tabs for variables are Equation, indices, and Additional information.
**Console**
-Console view (stacked with the property view) shows console messages from the simulator. Console can be used for debugging models simulated using OpenModelica.
+Console view (stacked with the property view) shows console messages from the simulator. Console can be used for debugging models simulated using OpenModelica.
**Issues**
-Issue view (stacked with the property view) shows the errors and warnings in all models.
+Issue view (stacked with the property view) shows the errors and warnings in all models.
**Profiles**
[Profiles](#diagram-profiles) view (stacked with the property view) allows enabling/disabling some visual diagram effects.
-**Trend**
+4 **Trend**
-[Trend](#simulation-result-and-model-structure-analysis) view shows the graphical representation of the values of the selected value over time. For the trend to be shown, a simulation has to be run. The view shows always the results of the latest run, but you can save results of a simulation and show them in the same trend with results from another simulation.
+[Trend](#simulation-result-and-model-structure-analysis) view shows the graphical representation of the values of the selected value over time. For the trend to be shown, a simulation has to be run. The view shows always the results of the latest run, but you can save results of a simulation and show them in the same trend with results from another simulation.
**Structure**
-The [structure](#simulation-result-and-model-structure-analysis) view (stacked with the trend view) can be used for analyzing the varaible dependencies, loops, and the structure of the model.
+The [structure](#simulation-result-and-model-structure-analysis) view (stacked with the trend view) can be used for analyzing the variable dependencies, loops, and the structure of the model.
**Values**
[Chart panel](#chart-panel) is able to house multiple [charts](#custom-charts) at the same time. Charts are added to the panel by dragging from model browser.
-**TIP!** If you accidentally close a view, you can reopen them from Window->Show View->Other...
+**TIP!** If you accidentally close a view, you can reopen them from Window→Show View→Other...
**TIP!** Try dragging the views to different positions (e.g. the property view to the right pane).
## Global Preferences
-Global preferences of Simantics System Dynamics are located under Window -> Preferences. Feel free to browse the contents yourself. A few notable items on the list are described below.
+Global preferences of Simantics System Dynamics are located under Window → Preferences. Feel free to browse the contents yourself. A few notable items on the list are described below.
<div class="image">
- <img src="Images/Preferences.png">
+ <img src="Images/PreferencesNew.png">
</div>
**Category** | **Description**
--- | ---
-**General -> Keys** | All [keyboard shortcuts](#shortcut-and-control-keys) available.
+**General → Keys** | All [keyboard shortcuts](#shortcut-and-control-keys) available.
**Modelica** | The location of OpenModelica solver on file system.
**Solver** | [Solver](#solvers) to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.
**Sysdyn Diagrams** | Sysdyn Diagrams allows customize default colors and fonts of diagram elements.
Basic modelling functions enable you to create and configure models. System dynamics modeling is basically pretty simple, so with these instructions you can build small and also very large models. The tricky part is writing all the expressions and adjusting the model so that it actually tells you something.
<div class="image">
- <img src="Images/Basic_1.png">
+ <img src="Images/NewModel.png">
</div>
**Creating a new model**
-Start a new model by right-clicking the model browser and selecting New -> Model or from the main menu File -> New -> SD Model.
+Start a new model by right-clicking the model browser and selecting New → Model or from the main menu File → New → SD Model.
<div class="image">
- <img src="Images/Basic_2.png">
+ <img src="Images/NewModule.png">
</div>
**Creating a new module type**
-Create a new module type by right-clicking on the Modules-folder and selecting New -> Module type. This creates a new module type that you can populate to your other modules and the model configuration.
+Create a new module type by right-clicking on the Modules-folder and selecting New → Module type. This creates a new module type that you can populate to your other modules and the model configuration.
**Configuring a model**
-Model configuration can be opened by double clicking Configuration in the model browser.
+Model configuration can be opened by double clicking Configuration in the model browser.
**Configuring modules**
**Connections between modules**
-**Outside the module**
+**Outside the module**
-You can connect variables to variables in modules like this:
+You can connect variables to modules like this:
<pre>
MODULE -----> INPUT
or
-ANY VARIABLE -----> MODULE
+ANY VARIABLE -----> MODULE
</pre>
This is just the visual configuration, but you need those connections to really connect variables in the module's properties.
In the *Inputs* tab stacked under *Module Properties* you can select which variables you connect to inputs inside the module. In the *Outputs* tab you can select which variables you lift from the module to inputs outside it.
-**Inside the module**
+**Inside the module**
-Input variables get values from outside the module
+Input variables get values from outside the module.
-Output variables can send their values outside the module. From the variable properties, select Additional Information and press Is Output
+Output variables send their values outside the module. To make a variable output its values, from the properties view make sure the Is Output checkbox is ticked.
**Configure variables**
-Select a single variable from diagram or model browser. The properties of the variables are shown in the equation view and you can modify them.
+Select a single variable from diagram or model browser. The properties of the variables are shown in the properties view where you can also modify them.
**Export model**
-To export your model to a file, select your model from the model browser, right-click and from the context menu choose Export->Model. Select the folder where to export your model, give the file a name and press Save. You do not need to export a model to Save it, the model is automatically saved in your database. Export can be used, for example, to create different versions of a model, create backups or to transport a model to another database.
+To export your model to a file, select your model from the model browser, right-click and from the context menu choose Export→Model. Select the folder where to export your model, give the file a name and press Save. You do not need to export a model to Save it, the model is automatically saved in your database. Export can be used, for example, to create different versions of a model, create backups or to transport a model to another database.
**Import model**
-Right-click on the model browser and select Import->Model. Browse to your .sysdyn file and select open. The model is added to your model browser.
+Select File→Import Model, browse to your .sysdyn file and select open. The model is added to your model browser.
**Export module**
-To export a module to a file, select the module from the model browser, right-click and from the context menu choose Export->Module. Select the folder where to export your model, give the file a name and press Save. Module export can be used, for example, to transport a module to another model or another database.
+To export a module to a file, select the module from the model browser, right-click and from the context menu choose Export→Module. Select the folder where to export your model, give the file a name and press Save. Module export can be used, for example, to transport a module to another model or another database.
**Import module**
-Right-click the Modules folder of a model and select Import->Module. Browse to your .sysdynModule file and select open. The module is added to your model.
+Right-click the Modules folder of a model and select Import→Module. Browse to your .sysdynModule file and select open. The module is added to your model.
## Model Properties
Auxiliary and valve variables have two special types: WithLookup and Delay. These types are selected from Type drop down menu in the variable's properties. The variable types offer more specific functionalities than normal variables, but the same functionality could be achieved using normal variables.
-### WithLookup
+### WithLookup
WithLookup variable has two equation fields, WithLookup and Lookup table. Lookup table has a table from which the value of the variable is interpolated using the value of WithLookup field.
<div class="image">
<img src="Images/WithLookup1.png">
</div>
-You do not need to manually input the Lookup table. WithLookup variable type offers an additional Lookup table tab in the property view. In this view you can add and modify points in the lookup table. Points can be added either by clickin on the chart or by using the input fields and Add button. Points can be modified by dragging them on the chart or modifying values in the table. Points are removed by clicking them with right mouse click.
+You do not need to manually input the Lookup table. WithLookup variable type offers an additional Lookup table tab in the property view. In this view you can add and modify points in the lookup table. Points can be added either by clicking on the chart or by using the input fields and Add button. Points can be modified by dragging them on the chart or modifying values in the table. Points are removed by clicking them with right mouse click.
<div class="image">
<img src="Images/WithLookup2.png">
</div>
### Delay
-Delay variables build equations for Nth order delays. Users can set the equation for the value that is to be delayed, the time and order of the delay and a possible start value. If start value is empty, the start value is set automatically.
+Delay variables build equations for Nth order delays. Users can set the equation for the value that is to be delayed, the time and order of the delay and a possible start value. If start value is empty, the start value is set automatically.
<div class="image">
<img src="Images/Delay1.png">
</div>
-Different order delays have slightly different curves when a step change is triggered. The example picture below shows a step change from 0 to 1 at time 1 with four different delays: 1st, 2nd, 3rd and 10th order delays.
+Different order delays have slightly different curves when a step change is triggered. The example picture below shows a step change from 0 to 1 at time 1 with four different delays: 1st, 2nd, 3rd and 10th order delays.
<div class="image">
<img src="Images/Delay2.png">
</div>
-For further information on how the delays work, you can look at the equations that are created by the delay variable. Below is a third order delay. Delay3 is the actual variable that is seen by users. DelayClass has as many level (LV) variables as the order of the delay is.
+For further information on how the delays work, you can look at the equations that are created by the delay variable. Below is a third order delay. Delay3 is the actual variable that is seen by users. DelayClass has as many level (LV) variables as the order of the delay is.
Definitions:
<pre>
end Delay3_delayClass;
</pre>
-The above definitions can be seen as a line of stocks and valves. The first valve, delay0, is given the value of the delayed expression. Delay3 is given the value of the valve that is coming from the last stock.
+The above definitions can be seen as a line of stocks and valves. The first valve, delay0, is given the value of the delayed expression. Delay3 is given the value of the valve that is coming from the last stock.
Equations:
<pre>
Shortcut keys for configuring a model on diagram.
Key | Action
---- | ---
+--- | ---
Esc | Cancel operations (e.g. connection and rename).
Shift + A | Hover Auxiliary at the cursor position, populate with left mouse button.
Shift + S | Hover Stock at the cursor position, populate with left mouse button.
Ctrl + left mouse button | Select multiple variables
Mouse wheel or + or - | Diagram zoom
drag(mouse3) | Diagram pan
-drag(shift + any mouse button) | Diagram pan
+drag(shift + right mouse button) | Diagram pan
↓, ←, ↑, → (arrow keys) | Diagram pan
Ctrl + C | Copy selected elements
Ctrl + X | Cut selected elements
1 | Fit diagram contents to screen
Ctrl + Space | Content assist in equation editor
-Other shortcut keys can be found selecting Window -> Preferences from the main menu. Keys are located in General -> Keys.
+Other shortcut keys can be found selecting Window → Preferences from the main menu. Keys are located in General → Keys.
## Unit Validation
-Unit validation is useful for finding errors in the model. With unit validation, the consistency of the measurement units of variables is checked. For unit validation, the units of all variables in the model must be defined. If a variable is dimensionless, use 1 as the unit. In certain constructs, a dimensionless variable can be used as "a wild card", e.g., adding a dimensionless variable with a dimensioned one is OK.
+Unit validation is useful for finding errors in the model. Unit validation checks the consistency of units. To use this feature you need to define units for every variable used in the model. If a variable is dimensionless, use 1 as the unit. In certain constructs, a dimensionless variable can be used as "a wild card", e.g., adding a dimensionless variable with a dimensioned one is OK.
-Common error sources of unit validation include the following. The respective issues are shown in the picture below.
+Common error sources of unit validation include the following. The respective issues are shown in the picture below.
<div class="image">
<img src="Images/UnitValidation.png">
<pre>
unitCast(Aux1) + time
</pre>
-, in which case the unit of the expression is that of time, or to
+in which case the unit of the expression is that of time, or to
<pre>
Aux1 + unitCast(time)
</pre>
-, in which case the unit of the expression is that of Aux1.
+in which case the unit of the expression is that of Aux1.
## Diagram Profiles
**Default**
-**Issue warnings**
+**Issue warnings**
When enabled, an error or a warning symbol is attached to diagram elements in which there are errors or warnings (usually in the equations).
-**Shadow variable visualizations**
+**Shadow variable visualizations**
When enabled, the original and all the shadow variables are highlighted when one is selected.
**Simulation Playback**
-**Playback Colors**
+**Playback Colors**
When enabled, colors of the elements on diagram change during a playback experiment.
+## Debugging a model
+If you find yourself with a model that doesn't simulate or has bizarre behavior, there are several places to look for clues for what went wrong. Firstly, if you got an error message and can't infer the problem straight from the message, look at the issues view if it can tell you what is wrong in different words. If you know how to read Modelica code, right click Configuration under the broken model and choose Open With → Modelica Code Viewer. The tool works by generating Modelica code from the graphical model and then solving it. Therefore, if something is broken it means that there is a problem with the generated Modelica code (or, very rarely, a bug in the solver you are using). You can also refer to the list below, if you still find yourself stuck.
+
+Some of the most common errors include:
+* In a model that uses modules, you forget to connect inputs and/or outputs in the module properties
+* You forgot to add an enumeration to a variable, i.e. trying to put a vector to a scalar variable (or vice versa)
+* You increased the enumeration indices you are using, but forget to update a variable that depend on it
+* You wrote a custom Modelica function, but it is broken
+* You are comparing two numbers for equality while using OpenModelica solver (forbidden, allowed by the internal solver)
+* You have a variable that refers to itself in the equation, making the solver unable find an initial value
+
+If you are using OpenModelica solver it can be very useful to google error messages printed in the console of the tool.
+
# Visual model elements
<div outputclass="hr"/>
-The visual appearance of the elements on diagram can be modified in various ways. In addition, the tool offers are comment symbols which do not affect simulation but help the understandability of models.
+The visual appearance of the elements on diagram can be modified in various ways. In addition, the tool has comment symbols which do not affect simulation but help the understandability of models.
## Fonts and colors
-Fonts and colors of diagram elements can be changed by right-clicking the element and selecting Font... The default fonts and colors for each diagram element type can be changed in Window -> Preferences -> Sysdyn Diagrams.
+Fonts and colors of diagram elements can be changed by right-clicking the element and selecting Font... The default fonts and colors for each diagram element type can be changed in Window → Preferences → Sysdyn Diagrams.
## Dependency properties
## Experiments
-There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics.
+There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics. Currently some of the experiment and solver combinations are still in development.
-Experiments are created from the context menu of experiments folder in a model.
+Experiments are created from the context menu of experiments folder in a model.
<div class="image">
<img src="Images/NewExperiment.png">
**Normal simulation**
-Experiment is the basic simulation type. It simulates a model from start time to end time and results can be viewed after the simulation has been run.
+Experiment is the basic simulation type. It simulates a model from start time to end time and results can be viewed after the simulation has been run. Works on both the internal and OpenModelica solvers.
**Game simulation**
-Game simulations allow simulating an arbitrary number of steps, changing parameter values and continuing simulation with the new values from where it previously ended.
+Game simulations allow simulating an arbitrary number of steps, changing parameter values and continuing simulation with the new values from where it previously ended. Works on the internal solver, OpenModelica version still in development.
**Simulation playback**
-Simulation playback works essentially as the basic experiment, but it offers some additional visualization options.
+Simulation playback works essentially as the basic experiment, but it offers some additional visualization options. Works on both solvers.
**Sensitivity analysis simulation**
-Sensitivity analysis allows running [multivariate](http://en.wikipedia.org/wiki/Multivariate_analysis) [Monte Carlo simulations](http://en.wikipedia.org/wiki/Monte_Carlo_method) with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters.
+Sensitivity analysis allows running [multivariate](http://en.wikipedia.org/wiki/Multivariate_analysis) [Monte Carlo simulations](http://en.wikipedia.org/wiki/Monte_Carlo_method) with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters. Works on OpenModelica solver, internal solver implementation still in development.
<div class="image">
<img src="Images/SensitivityExperiment.png">
Alternatively to OpenModelica, an internal custom Modelica solver is included in Simantics System Dynamics. The custom solver is currently at an experimental state, and thus all functionalities of the tool are not yet supported, e.g., only the basic experiment can be run with it. The advantage of the custom solver is, however, that simulation is usually a lot faster than with OpenModelica. Try out yourself which solver suits best for your needs.
-The solver can be changed in Windows -> Preferences -> Solver.
+The solver can be changed in Windows → Preferences → Solver.
# Simulation Result and Model Structure Analysis
<div outputclass="hr"/>
**Trend**
-Shows you the values of the selected variable(s) graphically over the simulation time. You can modify the trend and zoom it using the context menu (right-click) of the trend.
+Shows you the values of the selected variable(s) graphically over the simulation time. You can modify the trend and zoom it using the context menu (right-click) of the trend. You can also export the trend using controls in the upper right corner.
<div class="image">
<img src="Images/Trend.png">
**Compare results**
-You can compare different results of the same model by saving simulation results and displaying the saved results side by side with other results. You can save your results after simulating by clicking the Save Results button:
+You can compare different results of the same model by saving simulation results and displaying the saved results side by side with other results. This functionality currently only works for the OpenModelica solver, internal solver implementation is in development. You can save your results after simulating by clicking the Save Results button:
<div class="image">
<img src="Images/Saveresults.png">
</div>
-on your experiment controls. The saved results appear to model browser under the active experiment. To show the results on trends and tables, right-click on the result and select Show on charts.
+on your experiment controls. The saved results appear to model browser under the active experiment. To show the results on trends and tables, double click on the result to activate it.
<div class="image">
<img src="Images/CompareTrend.png">
# Custom Charts
<div outputclass="hr"/>
-Custom charts are user-defined displays of simulation result data. They can be used and re-used in various places. The four types of custom charts (line, sensitivity, bar, and pie charts) provide model developers means for examining and developing their models and communicating the simulation results to others.
+Custom charts are user-defined displays of simulation result data. They can be used and re-used in various places. The four types of custom charts (line, sensitivity, bar, and pie charts) provide model developers means for examining and developing their models and communicating the simulation results to others.
Custom charts are created to the Charts folder in model browser.
<img src="Images/NewChart.png">
</div>
-Charts are configured the same way as variables: first select the chart from model browser and then configure it in the property view. Charts can be viewed in the same active trend view as any variable by selecting the chart from model browser. In addition to trend view, charts can be populated directly to the model diagram by dragging them from the model browser. Charts can also be added to a separate chart panel which can contain multiple charts.
+Charts are configured the same way as variables: first select the chart from model browser and then configure it in the property view. Charts can be viewed in the same active trend view as any variable by selecting the chart from model browser. In addition to trend view, charts can be populated directly to the model diagram by dragging them from the model browser. Charts can also be added to a separate chart panel which can contain multiple charts.
## Line Chart
Variable | The full path of the variable. This field has content assistant, which shows the possible variables as you type.
Range | If the variable has multiple dimensions, this field allows to select, which dimensions are displayed. It is also possible to sum the variables in the dimensions.
Display median | Display the median value of the variable at each time step.
-Confidence bounds and colors | The confidence bounds in percents and colors for them.
+Confidence bounds and colors | The confidence bounds in percentages and colors for them.
There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.
## Bar Chart
-Bar charts display variables in a certain point in time. The point can be defined for the complete chart in chart's general settings and individually for each variable in variable's settings. If no time is defined, the last simulation step is shown in game or normal simulation mode. Playback mode displays the current playback time.
+Bar charts display variables in a certain point in time. The point can be defined for the complete chart in chart's general settings and individually for each variable in variable's settings. If no time is defined, the last simulation step is shown in game or normal simulation mode. Playback mode displays the current playback time.
<div class="image">
<img src="Images/BarChartGeneral.png">
## Modeling
-Models with multidimensional variables look just like any other models. The structure of the models is replicated givin multiple indexes to variables. For users with programming background, notation Variable[] may be familiar. In system dynamic modeling we need to give names to the indexes. Instead of using numbers to define the indexes, like in normal programming, we use enumerations. The steps to create a model with multidimensional variables are as follows (with examples):
+Models with multidimensional variables look just like any other models. The structure of the models is replicated giving multiple indices to variables. For users with programming background, notation Variable[] may be familiar. In system dynamic modeling we need to give names to the indices. Instead of using numbers to define the indices, like in normal programming, we use enumerations. The steps to create a model with multidimensional variables are as follows (with examples):
1 **Create the model structure**
<img src="Images/ModelWithMultidimensionalVariables.png">
</div>
-2 **Create Enumerations and define the indexes**
+2 **Create Enumerations and define the indices**
-Enumerations are created by right-clicking configuration and selecting New->Enumeration.
+Enumerations are created by right-clicking configuration and selecting New→Enumeration.
<div class="image">
<img src="Images/NewEnumeration.png">
</div>
-Define enumeration indexes by adding as many indexes as you want. Rename the indexes by selecting them and then clicking on them again.
+Define enumeration indices by adding as many indices as you want. Rename the indices by selecting them and then clicking on them again.
<div class="image">
<img src="Images/DefineIndexes.png">
3 **Add Enumerations for variables**
-Select the variable that you want to be multidimensional. From the Indexes -tab in the property view, move the wanted enumerations to the right. The order of the enumerations does matter.
+Select the variable that you want to be multidimensional. From the indices -tab in the property view, move the wanted enumerations to the right. The order of the enumerations **does** matter.
<div class="image">
<img src="Images/SelectEnumerations.png">
</div>
-4 **Define equations for all possible indexes**
+4 **Define equations for all possible indices**
-Multidimensional variable can be thought as a multidimensional table. Each cell of the table needs to have an expression or a value. A cell cannot have multiple definitions. All cells can be defined in one expression like in the following example. E1 and E2 have both three indexes, so the resulting definition can be {{1,2,3},{4,5,6},{7,8,9}}.
+Multidimensional variable can be thought as a multidimensional table. Each cell of the table needs to have an expression or a value. A cell cannot have multiple definitions. All cells can be defined in one expression like in the following example. E1 and E2 have both three indices, so the resulting definition can be {{1,2,3},{4,5,6},{7,8,9}}.
<div class="image">
<img src="Images/DefineEquations.png">
## Expressions
-Values for all cells in the variable matrix can be defined in a single expression.
+Values for all cells in the variable matrix can be defined in a single expression.
<div class="image">
<img src="Images/DefineEquations.png">
<img src="Images/DefineEquations2.png">
</div>
-In many situations, it is however more clear to define separate expressions for each cell or blocks.
+In many situations, it is however more clear to define separate expressions for each cell or blocks.
1 **Define range for the expression**
// Slices
Auxiliary[one, E2] = {1,2,3}
Auxiliary[E1, zwei] = {{2},{5},{8}}
-
+
// In addition to single cells and the whole enumeration range, a subrange of the enumeration can be used
Auxiliary[two : three, E2] = {{4,5,6},{7,8,9}}
Auxiliary[one : two, zwei : drei] = {{2,3},{5,6}}
<pre>
{1,2,3} / {1,2,3} = ERROR! not allowed
-
+
// Elementwise
{1,2,3} ./ {1,2,3} = {1,1,1}
</pre>
<pre>
{{3,4},{5,6}} * {1,2} = {11,17}
{{3,4},{5,6}} * {1,2,3} = ERROR! incompatible array sizes
-
+
//Elementwise
{1,2} .* {1,2} = {1,4}
-
- Real[3,2] c = {{1,2},{3,4},{5,6}};
+
+ Real[3,2] c = {{1,2},{3,4},{5,6}};
Real[2,2] d = {{3,4},{5,6}};
Real[2,2] cd;
cd = c[2:3, :] .* d; // Result: {{9,16},{25,36}}
{1,2} .^ 2 = {1,4}
</pre>
-## Builtin Modelica Functions
+## Built-in Modelica Functions
-Modelica has some builtin functions that help using multidimensional variables. This chapter introduces some of the builtin functions.
+Modelica has some built-in functions that help using multidimensional variables. You can find the functions under any model inside the folder Functions→Built-in Functions. This chapter introduces some of the built-in functions.
**Dimension and size functions**
<pre>
enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
-
+
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
</pre>
**zeros(n1,n2,n3,...)**
-An array full of zeros with dimensions n1 x n2 x n2 x ...
+An array full of zeros with dimensions n1 x n2 x n2 x ...
<pre>
zeros(2, 2) = {{0,0}, {0,0}}
</pre>
**ones(n1,n2,n3,...)**
-An array full of ones with dimensions n1 x n2 x n2 x ...
+An array full of ones with dimensions n1 x n2 x n2 x ...
<pre>
ones(2, 2) = {{1,1}, {1,1}}
</pre>
**linspace(x1,x2,n)**
-Constracts a Real vector from x1 to x2 with n equally spaced elements.
+Constructs a Real vector from x1 to x2 with n equally spaced elements.
<pre>
linspace(2,5,4) = {2,3,4,5}
</pre>
enumeration E1 = one, two, three
enumeration E2 = eins, zwei, drei
Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
-
+
AuxiliarySum[E1] = {sum( Auxiliary[ i , E2 ] ) for i in E1} // Result: {6, 15, 24}
-
+
/* Same as:
{sum(Auxiliary[one, E2]), sum(Auxiliary[two, E2]), sum(Auxiliary[three, E2])}
{sum({1,2,3}), sum({4,5,6}), sum({7,8,9})}
The range doesn't have to be the whole enumeration. Subranges can also be used.
<pre>
{sum( Auxiliary[ i , eins : zwei ] ) for i in E1.one : E1.two} // Result: {3, 9}
-
+
/* Same as
{sum(Auxiliary[one, eins : zwei]), sum(Auxiliary[two, eins : zwei])}
{sum({1,2}), sum({4,5})}
## Simulation Results
-Multidimensional variables provide multiple results for the same variable. One result for each index. The trend view clutters very quickly when you add dimensions to the variables.
+Multidimensional variables provide multiple results for the same variable. One result for each index. The trend view clutters very quickly when you add dimensions to the variables.
<div class="image">
<img src="Images/3x3trend.png">
</div>
-The clutter can be reduced by selecting which enumeration indexes are shown in charts. Select an enumeration and tick the indexes that you want to show. The same settings apply to each variable that uses the enumeration. This way you can follow an interesting index throughout the model.
+The clutter can be reduced by selecting which enumeration indices are shown in charts. Select an enumeration and tick the indices that you want to show. The same settings apply to each variable that uses the enumeration. This way you can follow an interesting index throughout the model.
<div class="image">
<img src="Images/ShowInCharts.png">
<p class="imageText">Replaceable enumeration inside a module</p>
</div>
-You can also use array variables inside modules. Enumeration need to be defined separately for each module type and added to all necessary variables, also inputs and outputs (see [Modeling](#modeling)).
+You can also use array variables inside modules. Enumeration need to be defined separately for each module type and added to all necessary variables, also inputs and outputs (see [Modeling](#modeling)).
When defining a module, modeler may not want to restrict the size of the array variable. In many cases the same module structure could be used for both large and small arrays. For example if the module is a project, a project may have three or even twenty phases. In this case the enumerations inside modules need to be set as replaceable.
-In this example, the original enumeration that the modeler used had two indexes. We are using an instance of this module, but we need to use array variables that have three indexes instead of two. We are using two variables and an instance of the module.
+In this example, the original enumeration that the modeler used had two indices. We are using an instance of this module, but we need to use array variables that have three indices instead of two. We are using two variables and an instance of the module.
<div class="imageBorder">
<img src="Images/ReplacingEnumerationConfiguration.png">
<p class="imageText">Module configuration for replacing enumerations inside the module</p>
</div>
-In the parent configuration, we have used an enumeration with three indexes in the two variables.
+In the parent configuration, we have used an enumeration with three indices in the two variables.
<div class="imageBorder">
<img src="Images/Replacing.png">
<p class="imageText">Enumeration in the parent configuration that will replace the enumeration in the module</p>
</div>
-The replacement can be defined in the properties of the module instance. When the module instance is selected, a table with all the replaceable enumerations is shown. By clickin on the cell next to the enumeration, a drop-down box is shown with all the enumerations in the parent module. If an enumeration is selected, it will replace the enumeration inside the module during simulation. The replacement will not, however, show elsewhere in the model.
+The replacement can be defined in the properties of the module instance. When the module instance is selected, a table with all the replaceable enumerations is shown. By clicking on the cell next to the enumeration, a drop-down box is shown with all the enumerations in the parent module. If an enumeration is selected, it will replace the enumeration inside the module during simulation. The replacement will not, however, show elsewhere in the model.
<div class="imageBorder">
<img src="Images/ReplacingEnumeration.png">
# Functions
<div outputclass="hr"/>
-Modelica provides a convenient way to use functions in your models. You can create your own functions, export and import complete function libraries and share function libraries to be used in all of your models.
+Modelica provides a convenient way to use functions in your models. You can create your own functions, export and import complete function libraries and share function libraries to be used in all of your models.
## Creating Functions
<img src="Images/NewFunction.png">
</div>
-You can create new functions to the Functions -folder in your model or to function library folders. Right-click on the folder and select New->Function.
+You can create new functions to the Functions -folder in your model or to function library folders. Right-click on the folder and select New→Function.
Functions that can be found from Functions -folder can be used in your variable definitions.
-Functions are defined using Modelica language. The variables used in the function are defined in the declaration section. Function needs an output and an arbitrary number of inputs. Modelica specification enables use of multiple outputs, but this feature is not supported. The inputs are given in the same order as they are used in calling the function.
+Functions are defined using Modelica language. The variables used in the function are defined in the declaration section. Function needs an output and an arbitrary number of inputs. Modelica specification enables use of multiple outputs, but this feature is not supported. The inputs are given in the same order as they are used in calling the function.
Algorithm section defines the actual functionality of the function. In algorithm sections you must use assignments ":=" instead of just plain "=". All the assignments are calculated in the order they are written.
+Also, take note that creating new lines in the Modelica code text box is done via shift+enter.
+
Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and [Modelica specifications](https://www.modelica.org/documents/).
<div class="image">
<img src="Images/NewFunctionLibrary.png">
</div>
-There are three types of function libraries: normal function library, built-in function library and shared function library. Normal function libraries can be created to a model and are available only in that model. Built-in libraries are available in all models and calls to built-in functions should not include the library name. Shared functions are available to all models in your workspace, but you need to enable them to each model individually.
+There are three types of function libraries: normal function library, built-in function library and shared function library. Normal function libraries can be created to a model and are available only in that model. Built-in libraries are available in all models and calls to built-in functions should not include the library name. Shared functions are available to all models in your workspace, but you need to enable them to each model individually.
Create a new function library by right-clicking on Functions folder, Shared functions folder or other module library.
-A function library can be exported by right clicking the function library and selecting Export -> Function library. A function library can be imported by right clicking the Functions folder and selecting Import -> Function library. Functions themselves cannot be exported or imported. To export a function, add it into a function library and export that function library.
+A function library can be exported by right clicking the function library and selecting Export → Function library. A function library can be imported by right clicking the Functions folder and selecting Import → Function library. Functions themselves cannot be exported or imported. To export a function, add it into a function library and export that function library.
If you create a shared function library, the library can be added to other models or removed from current model by selecting the Shared Functions -folder and using the properties view.
## External Functions
-Modelica allows you to use external functions that are programmed using C language. To use this feature, you need to have the Sysdyn version with OpenModelica included and OpenModelica set as the solver in the Preferences (Window -> Preferences -> Solver). The installation package with OpenModelica has also MinGW C compiler included that allows to build object files from C source code.
+Modelica allows you to use external functions that are programmed using C language. To use this feature, you need to have the Sysdyn version with OpenModelica included and OpenModelica set as the solver in the Preferences (Window → Preferences → Solver). The installation package with OpenModelica has also MinGW C compiler included that allows to build object files from C source code.
-Below is a simple example of using a function that returns the sum of two arguments.
+Below is a simple example of using a function that returns the sum of two arguments.
<pre>
double exampleCFunction(double x, double y)
## Modelica Functions
-Modelica has built-in functions that can be used anywhere and are not visible in function libraries. This section covers a large number of those functions. For functions related to array variables, see see [builtin functions for arrays](#builtin-modelica-functions).
+Modelica has built-in functions that can be used anywhere and are not visible in function libraries. This section covers a large number of those functions. For functions related to array variables, see see [Built-in functions for arrays](#Built-in-modelica-functions).
**Function** | **Description**
--- | ---
cross(x,y) | Returns the 3-vector cross product of the 3-vectors x and y.
delay(expr, delayTime) | Returns the value of expr at the time time-delayTime. The value of expr is returned when time <= time.start + delayTime.
der(x) | Time derivative of x. X must be have continuous-time variability.
-div(x, y) | Returns the algebraic quotient x/y with any fractional part discarted. E.g. div(10,3) = 3.
-edge(b) | Returns true when the value of the boolean expression b changes. Expanded into (b and not pre(b)).
+div(x, y) | Returns the algebraic quotient x/y with any fractional part discarded. E.g. div(10,3) = 3.
+edge(b) | Returns true when the value of the Boolean expression b changes. Expanded into (b and not pre(b)).
exp(x) | Exponential, base e.
floor(x) | Returns the largest integer not greater than x, the closest integer below x.
-initial() | Returns true at the beginning of the simulation.
+initial() | Returns true at the beginning of the simulation.
integer(x) | Returns the largest integer not greater than x as an integer.
log(x) | Natural logarithm. (base e, x > 0)
log10(x) | Base 10 logarithm. (x > 0)
mod(x, y) | Returns the integer modulus of x/y: mod(x,y) = x - floor(x/y) * y.
noEvent(expr) | noEvent around an expression causes the expression to NOT generate event. **Important:** If you want a condition to be checked only on time steps, use noEvent. (e.g. if noEvent(value >= 1) then ... else ...)
-pre(x) | Returns the preceding value of y from time event that has occured before current time.
+pre(x) | Returns the preceding value of y from time event that has occurred before current time.
rem(x, y) | Returns the integer remainder of x/y: rem(x,y) = x - div(x,y) * y.
sample(start, interval) | Returns true and triggers time events at times start + i * interval (i=0,1,...).
sign(x) | Returns -1 if x is negative, 1 if x is positive. Expanded into "(if x > 0 then 1 else if x < 0 then -1 else 0)".
<img src="Images/AuxiliarySheet.png">
</div>
-You can also refer to sheets with array variables. Reference is simple with one and two dimensional array variables. Below is an example of a sheet with values for two different variables. The names of the indexes are not mandatory, but help reading and maintaining the sheet.
+You can also refer to sheets with array variables. Reference is simple with one and two dimensional array variables. Below is an example of a sheet with values for two different variables. The names of the indices are not mandatory, but help reading and maintaining the sheet.
<div class="image">
<img src="Images/SheetForMultidim.png">
<img src="Images/SheetMultidim1.png">
</div>
-ArrayTest2 has two dimensions. Reference to a larger range creates a two-dimensional variable. By default, the indexes are ordered as in this example. However, if you wish to present the indexes in a different order in the spreadsheet, you can transpose the sheet reference (e.g. transpose(ArrayTestSheet(E2:G3)))
+ArrayTest2 has two dimensions. Reference to a larger range creates a two-dimensional variable. By default, the indices are ordered as in this example. However, if you wish to present the indices in a different order in the spreadsheet, you can transpose the sheet reference (e.g. transpose(ArrayTestSheet(E2:G3)))
<div class="image">
<img src="Images/SheetMultidim2.png">
<img src="Images/Sheet.png">
</div>
-History data is used by creating a History dataset to an experiment. The dataset is activated and deactivated in charts by double-clicking the dataset. History data reference is set in the properties of the history dataset.
+History data is used by creating a History dataset to an experiment. The dataset is activated and deactivated in charts by double-clicking the dataset. History data reference is set in the properties of the history dataset.
<div class="image">
<img src="Images/HistoryDataSettings.png">
# Vensim Model Import
<div outputclass="hr"/>
-The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool [Vensim](http://vensim.com/). This functionality is used similarly to the regular model import, so by right-clicking the browser and selecting "Import" -> "Vensim Model (.mdl)".
+The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool [Vensim](http://vensim.com/). This functionality is used similarly to the regular model import, so by right-clicking the browser and selecting "Import" → "Vensim Model (.mdl)".
The import process has several known limitations:
# Sample Models and Molecules
<div outputclass="hr"/>
-There are some sample models located in the sampleModels folder found in the installation folder. The sample models can be imported by right-clicking on the model browser and select Import->Model.
+There are some sample models located in the sampleModels folder found in the installation folder. The sample models can be imported by right-clicking on the model browser and select Import→Model.
[Simantics](https://www.simantics.org/end_user_wiki/index.php/Introduction_to_Simantics) | *System Dynamics Modelling*
<div outputclass="hr"/>
-
+
[**Tutorial: Basic System Dynamics Modelling**](BasicTutorial.md)
System dynamics modelling in Simantics is a free modelling tool that is included into the basic installation. This tutorial introduces the basic features of the system dynamics modelling tool.