From: Miro Richard Eklund Date: Mon, 27 Aug 2018 14:28:46 +0000 (+0300) Subject: Update documentation to include markdown and dita generation support X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F2037%2F7;p=simantics%2Fsysdyn.git Update documentation to include markdown and dita generation support Generated docs includes eclipse help and wiki-site HTML from a source markdown file collection (base, basic tutorial, advanced tutorial) with accompanying .png files. Updated 1.35.0 branch of sysdyn to use platform 1.35.0 gitlab #5 Change-Id: I3bdcb4da7cad61387bedec6c2adcd31ce2fe6f26 --- diff --git a/bundles/org.simantics.sysdyn.help/.project b/bundles/org.simantics.sysdyn.help/.project new file mode 100644 index 00000000..973b6ce7 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/.project @@ -0,0 +1,22 @@ + + + org.simantics.sysdyn.help + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/bundles/org.simantics.sysdyn.help/META-INF/MANIFEST.MF b/bundles/org.simantics.sysdyn.help/META-INF/MANIFEST.MF new file mode 100644 index 00000000..b8b40481 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Bundle-Version: 0.0.0 +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Localization: plugin +Bundle-Name: %name +Bundle-Vendor: %providerName +Eclipse-LazyStart: true +Bundle-SymbolicName: org.simantics.sysdyn.ditamap; singleton:=true diff --git a/bundles/org.simantics.sysdyn.help/SYSDYN.xml b/bundles/org.simantics.sysdyn.help/SYSDYN.xml new file mode 100644 index 00000000..a94da1e5 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/SYSDYN.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorial.html b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorial.html new file mode 100644 index 00000000..80b4307b --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorial.html @@ -0,0 +1,152 @@ + +Tutorial: Advanced System Dynamics Modelling

Tutorial: Advanced System Dynamics Modelling

+

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 is also available. This tutorial is part of the sysdyn documentation.

Creating model and modules

+

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.

+
+

Creating a new model

+
+
+

Creating a new module

+
+
+

Model after renaming

+

Initial configuration

+
+
+

Workforce and Work modules

+

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.

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.

+
+

Workforce and Work modules, first inputs and connections

+

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

Workforce module

+
+
+

Cloud, Valve, Flow and Stock

+

Open Workforce module by selecting it from the diagram, right-clicking it and selecting Show Module.

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.

+
+

Cloud, Valve, Flow and Stock. Flow works both on directions.

+

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.

+
+

Auxiliaries in Workforce module

+

Now you have used all the basic components and connections. From now on the instructions will be a more simplified.

Next we will create four Auxiliary variables: TimeToAllocateResources, WorkforceRequired, Productivity and PossibleWorkingSpeed. Place and connect them according to the picture on the right.

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.

WorkforceStock 
+Initial value: 0
+
+NetResourcing 
+= (WorkforceRequired - WorkforceStock)/TimeToAllocateResources
+
+TimeToAllocateResources 
+= 2
+
+Productivity 
+= 1
+
+PossibleWorkingSpeed 
+= WorkforceStock * Productivity
+Is Output
+

Variables can be set as output by selecting Is Output option from the Equation tab.

+
+

RequiredWorkingSpeedInput

+

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.

WorkForceRequired 
+= RequiredWorkingSpeedInput/Productivity
+

Now this module is ready to be used as a part of the model.

Work module

+
+
+

Basic work with errors

+

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.

Create the basic flow of work with stocks and flows like in the picture on the right.

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.

+
+

Smoothener for work is done

+

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:

ProjectIsReady 
+Initial value: 0
+
+ProjectReadyness 
+= (xidz(WorkDone, ProjectWorkAmount, 0.0) - ProjectIsReady) / 0.08
+

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

+
+

ProjectWorkAmount input variable

+

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.

+
+

Variables needed for error handling

+

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.

ErrorsGenerated
+= (1-WorkQuality) * WorkingSpeed
+
+ErrorsFoundRate
+= Errors/ErrorsFoundTime
+
+WorkQuality
+= 0.9
+
+ErrorsFoundTime
+Type: WithLookup
+With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0) 
+Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
+

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.

+
+

WorkAllocation and RequiredWorkingSpeed

+

To calculate our own need for workforce we need to create and connect WorkCompletionTime input variable and the following auxliary variables:

RequiredWorkingSpeed 
+= if ProjectIsReady < 1 then xidz(WorkToDo, TimeToDeadline, MaximumWorkingSpeed) else 0
+Is Output
+
+MaximumWorkingSpeed 
+= 500
+
+TimeToDeadline 
+= max(0, WorkCompletionTime-time)
+

time is a universal variable that gives the current simulation time.

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.

Create two Inputs, RequiredWorkingSpeedTotalInput and PossibleWorkingSpeedInput, and an auxiliary variable WorkAllocation. Connect the variables like int the picture.

WorkAllocation
+= xidz(RequiredWorkingSpeed, RequiredWorkingSpeedTotalInput, 0.0) * PossibleWorkingSpeedInput
+

Finally let's give initial values for all the remaining variables:

WorkingSpeed 
+= if ProjectIsReady < 1 then WorkAllocation else 0
+
+WorkToDo 
+Initial value: ProjectWorkAmount
+
+WorkDone 
+Initial value: 0
+
+Errors 
+Initial value: 0
+

Connecting modules

+

Our modules are complete. Let's get back to the WorkModel Configuration.

Set Work1CompletionTime to 10.
+
+
+

Module input connections

+

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.

+
+

Module input connections

+

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

+

To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 24.0

+
+

Experiment activation

+
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:
+

System shows the simulation progress in the progress bar on the lower right corner of the screen.

+
+

When the progress indicator disappears, the simulation is complete.

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.

+
+

Adding modules

+
+
+

Final configuration with two modules

+

We created the WorkModule to be reusable. To use two WorkModules in the model, you must do the following.

Populate a second WorkModule to WorkModel configuration and name it Work2.

Create RequiredWorkingSpeed2 input variable and Work2CompletionTime auxiliary variable.

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.

You can also have a different size work. To make Work2 smaller, create an auxiliary variable Work2Amount.

Use the following equations:

Work2CompletionTime
+= 13
+
+Work2Amount
+= 800
+
+RequiredWorkingSpeedTotal
+= RequiredWorkingSpeed1 + RequiredWorkingSpeed2
+

Update connections to match connections shown in the picture and connect the inputs and outputs to the modules.

Workforce
+RequiredWorkingSpeedInput -> RequiredWorkingSpeedTotal
+
+Work1 Inputs
+RequiredWorkingSpeedTotalInput -> RequiredWorkingSpeedTotal
+
+Work2 Outputs
+RequiredWorkingSpeed -> RequiredWorkingSpeed2
+
+Work2 Inputs
+
+
+

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.

+
+
\ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ActivateExperiment.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ActivateExperiment.png new file mode 100644 index 00000000..8843321e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ActivateExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ConfigurationStart.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ConfigurationStart.png new file mode 100644 index 00000000..185d9e27 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ConfigurationStart.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ErrorsVariables.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ErrorsVariables.png new file mode 100644 index 00000000..4b946edb Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ErrorsVariables.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ExperimentPlay.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ExperimentPlay.png new file mode 100644 index 00000000..fc50f88a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ExperimentPlay.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/FirstSimulation.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/FirstSimulation.png new file mode 100644 index 00000000..e1087cb1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/FirstSimulation.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModelStructure2.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModelStructure2.png new file mode 100644 index 00000000..fcb32883 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModelStructure2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/Module2Inputs.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/Module2Inputs.png new file mode 100644 index 00000000..e8997001 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/Module2Inputs.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModuleConnections1.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModuleConnections1.png new file mode 100644 index 00000000..34122819 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModuleConnections1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModuleConnections2.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModuleConnections2.png new file mode 100644 index 00000000..83a9875a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModuleConnections2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModulesFinal.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModulesFinal.png new file mode 100644 index 00000000..8332359d Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ModulesFinal.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NetResourcing1.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NetResourcing1.png new file mode 100644 index 00000000..b47e9474 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NetResourcing1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NetResourcing2.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NetResourcing2.png new file mode 100644 index 00000000..71db6659 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NetResourcing2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NewModel.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NewModel.png new file mode 100644 index 00000000..609a635c Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NewModel.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NewModule.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NewModule.png new file mode 100644 index 00000000..1e28ea43 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/NewModule.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ProjectIsReady.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ProjectIsReady.png new file mode 100644 index 00000000..bcc555ed Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ProjectIsReady.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ProjectWorkAmount.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ProjectWorkAmount.png new file mode 100644 index 00000000..fc64109e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/ProjectWorkAmount.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png new file mode 100644 index 00000000..25a15725 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/SecondSimulation.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/SecondSimulation.png new file mode 100644 index 00000000..dc3bca8c Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/SecondSimulation.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/SimulationProgress.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/SimulationProgress.png new file mode 100644 index 00000000..e145fcc1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/SimulationProgress.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/TwoModules.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/TwoModules.png new file mode 100644 index 00000000..16fdd64b Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/TwoModules.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkAllocation.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkAllocation.png new file mode 100644 index 00000000..40945fdf Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkAllocation.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkStocks.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkStocks.png new file mode 100644 index 00000000..7c787f9a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkStocks.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png new file mode 100644 index 00000000..2044acb1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorial.html b/bundles/org.simantics.sysdyn.help/Site/BasicTutorial.html new file mode 100644 index 00000000..71077962 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/Site/BasicTutorial.html @@ -0,0 +1,69 @@ + +Tutorial: Basic System Dynamics Modelling

Tutorial: Basic System Dynamics Modelling

+

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 is also available. This tutorial is part of the sysdyn documentation.

Model

+

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.

+
+

Creating a new model

+

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.

Configuring the model structure

+

Our model is now empty. Let's build a population model for 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.

+
+

Symbols view

+

These are the basic symbols in System dynamics modelling. We will use these 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

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.

+
+

Stock variable Mice

+

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.

+
+

Flows in and out of Mice

+

Of course mice are not alone in the world. There are also owls that hunt mice. Create a similar structure below mice for owls.

+
+

Owls and mice

+

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.

+
+

Auxiliaries for valves

+

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.

+
+

Dependency connections

+

Equations

+

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:

MouseBirths
+= MouseBirthRate * Mice
+
+MouseDeaths
+= Mice * MouseDeathsDueToOwls * Owls
+
+OwlBirths
+= OwlsFromMice * MouseDeaths
+
+OwlDeaths
+= OwlDeathRate * Owls
+
+MouseBirthRate
+= 0.04
+
+MouseDeathsDueToOwls
+= 0.0005
+
+OwlsFromMice
+= 0.1
+
+OwlDeathRate
+= 0.09
+

Finally we need initial values for our populations.

Mice
+Initial Value: 700
+
+Owls
+Initial Value: 10
+

Simulating the model

+
+
+

Experiment activation

+
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:
+

System shows the simulation progress in the progress bar on the lower right corner of the screen.

+
+

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.

+
+

Results for Mice and Owls

+

As you can see, the simulation is complete, but the results do not reveal any interesting behavior. Let's extend the simulation time.

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.

+
+

Results for Mice and Owls, Extended simulation time

+

Now the simulation reveals the traditional behavior of predator-prey models. Feel free to adjust the parameters and try the simulations again.

\ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/ActivatePopulationExperiment.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/ActivatePopulationExperiment.png new file mode 100644 index 00000000..0eeeb7e6 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/ActivatePopulationExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Auxiliaries.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Auxiliaries.png new file mode 100644 index 00000000..5cec62b8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Auxiliaries.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Dependency_connections.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Dependency_connections.png new file mode 100644 index 00000000..eeb22288 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Dependency_connections.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/ExperimentPlay.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/ExperimentPlay.png new file mode 100644 index 00000000..fc50f88a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/ExperimentPlay.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Mice.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Mice.png new file mode 100644 index 00000000..601f77ee Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/Mice.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwlResults1.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwlResults1.png new file mode 100644 index 00000000..bee8c180 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwlResults1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwlResults2.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwlResults2.png new file mode 100644 index 00000000..cd8426fd Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwlResults2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwls.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwls.png new file mode 100644 index 00000000..83b4b085 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceAndOwls.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceFlows.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceFlows.png new file mode 100644 index 00000000..a910ea82 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/MiceFlows.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/NewModel.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/NewModel.png new file mode 100644 index 00000000..609a635c Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/NewModel.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/SimulationProgress.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/SimulationProgress.png new file mode 100644 index 00000000..e145fcc1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/SimulationProgress.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/SymbolsView.png b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/SymbolsView.png new file mode 100644 index 00000000..74e6e0b5 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/BasicTutorialImages/SymbolsView.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/3x3trend.png b/bundles/org.simantics.sysdyn.help/Site/Images/3x3trend.png new file mode 100644 index 00000000..a97e66b8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/3x3trend.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/AuxiliarySheet.png b/bundles/org.simantics.sysdyn.help/Site/Images/AuxiliarySheet.png new file mode 100644 index 00000000..f1bc334f Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/AuxiliarySheet.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/AuxiliarySheetReference.png b/bundles/org.simantics.sysdyn.help/Site/Images/AuxiliarySheetReference.png new file mode 100644 index 00000000..9d6ea326 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/AuxiliarySheetReference.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/BarChartAxis.png b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartAxis.png new file mode 100644 index 00000000..46eaa4a1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartAxis.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/BarChartGeneral.png b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartGeneral.png new file mode 100644 index 00000000..4fe5618a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartGeneral.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/BarChartInDiagram.png b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartInDiagram.png new file mode 100644 index 00000000..4bd16776 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartInDiagram.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/BarChartVariable.png b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartVariable.png new file mode 100644 index 00000000..6e26fb97 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/BarChartVariable.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/BasicWorkbench.png b/bundles/org.simantics.sysdyn.help/Site/Images/BasicWorkbench.png new file mode 100644 index 00000000..f5a7ebb5 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/BasicWorkbench.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Basic_1.png b/bundles/org.simantics.sysdyn.help/Site/Images/Basic_1.png new file mode 100644 index 00000000..f3dc3b3c Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Basic_1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Basic_2.png b/bundles/org.simantics.sysdyn.help/Site/Images/Basic_2.png new file mode 100644 index 00000000..d52d24b5 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Basic_2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ChartPanel.png b/bundles/org.simantics.sysdyn.help/Site/Images/ChartPanel.png new file mode 100644 index 00000000..c27a3273 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ChartPanel.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ChartPanelOrientation.png b/bundles/org.simantics.sysdyn.help/Site/Images/ChartPanelOrientation.png new file mode 100644 index 00000000..dff15a38 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ChartPanelOrientation.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/CompareTrend.png b/bundles/org.simantics.sysdyn.help/Site/Images/CompareTrend.png new file mode 100644 index 00000000..35e63c2f Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/CompareTrend.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ComponentTypes.png b/bundles/org.simantics.sysdyn.help/Site/Images/ComponentTypes.png new file mode 100644 index 00000000..3b354f83 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ComponentTypes.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/CreateNewExpression.png b/bundles/org.simantics.sysdyn.help/Site/Images/CreateNewExpression.png new file mode 100644 index 00000000..0eebab17 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/CreateNewExpression.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations.png b/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations.png new file mode 100644 index 00000000..1fa4f6a8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations2.png b/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations2.png new file mode 100644 index 00000000..89f61821 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations3.png b/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations3.png new file mode 100644 index 00000000..679cb73b Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/DefineEquations3.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/DefineIndexes.png b/bundles/org.simantics.sysdyn.help/Site/Images/DefineIndexes.png new file mode 100644 index 00000000..d1ed523e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/DefineIndexes.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/DefineRange.png b/bundles/org.simantics.sysdyn.help/Site/Images/DefineRange.png new file mode 100644 index 00000000..b45314d8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/DefineRange.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Delay1.png b/bundles/org.simantics.sysdyn.help/Site/Images/Delay1.png new file mode 100644 index 00000000..6cd77669 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Delay1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Delay2.png b/bundles/org.simantics.sysdyn.help/Site/Images/Delay2.png new file mode 100644 index 00000000..507d3d99 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Delay2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Dependencies.png b/bundles/org.simantics.sysdyn.help/Site/Images/Dependencies.png new file mode 100644 index 00000000..54e766ff Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Dependencies.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ExampleExternalFunction.png b/bundles/org.simantics.sysdyn.help/Site/Images/ExampleExternalFunction.png new file mode 100644 index 00000000..61ef1d13 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ExampleExternalFunction.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ExampleFunction.png b/bundles/org.simantics.sysdyn.help/Site/Images/ExampleFunction.png new file mode 100644 index 00000000..707ab4ed Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ExampleFunction.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ExternalFunctionResult.png b/bundles/org.simantics.sysdyn.help/Site/Images/ExternalFunctionResult.png new file mode 100644 index 00000000..5be7fd83 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ExternalFunctionResult.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/HistoryData.png b/bundles/org.simantics.sysdyn.help/Site/Images/HistoryData.png new file mode 100644 index 00000000..c4ccb920 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/HistoryData.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/HistoryDataSettings.png b/bundles/org.simantics.sysdyn.help/Site/Images/HistoryDataSettings.png new file mode 100644 index 00000000..62545339 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/HistoryDataSettings.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ImportCFunctionLibrary.png b/bundles/org.simantics.sysdyn.help/Site/Images/ImportCFunctionLibrary.png new file mode 100644 index 00000000..3b0e55f4 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ImportCFunctionLibrary.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/LineChart.png b/bundles/org.simantics.sysdyn.help/Site/Images/LineChart.png new file mode 100644 index 00000000..18dcff84 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/LineChart.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/LineChartAxisAndVariables.png b/bundles/org.simantics.sysdyn.help/Site/Images/LineChartAxisAndVariables.png new file mode 100644 index 00000000..34e4e2f7 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/LineChartAxisAndVariables.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/LineChartGeneral.png b/bundles/org.simantics.sysdyn.help/Site/Images/LineChartGeneral.png new file mode 100644 index 00000000..a22b084c Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/LineChartGeneral.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Loops.png b/bundles/org.simantics.sysdyn.help/Site/Images/Loops.png new file mode 100644 index 00000000..0cf2c86e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Loops.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ModelHierarchy.png b/bundles/org.simantics.sysdyn.help/Site/Images/ModelHierarchy.png new file mode 100644 index 00000000..b128f6fb Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ModelHierarchy.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ModelProperties.png b/bundles/org.simantics.sysdyn.help/Site/Images/ModelProperties.png new file mode 100644 index 00000000..0c181522 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ModelProperties.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ModelStructure.png b/bundles/org.simantics.sysdyn.help/Site/Images/ModelStructure.png new file mode 100644 index 00000000..131e9204 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ModelStructure.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ModelWithMultidimensionalVariables.png b/bundles/org.simantics.sysdyn.help/Site/Images/ModelWithMultidimensionalVariables.png new file mode 100644 index 00000000..e17528f3 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ModelWithMultidimensionalVariables.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/NewChart.png b/bundles/org.simantics.sysdyn.help/Site/Images/NewChart.png new file mode 100644 index 00000000..76b84c07 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/NewChart.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/NewEnumeration.png b/bundles/org.simantics.sysdyn.help/Site/Images/NewEnumeration.png new file mode 100644 index 00000000..40ecc979 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/NewEnumeration.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/NewExperiment.png b/bundles/org.simantics.sysdyn.help/Site/Images/NewExperiment.png new file mode 100644 index 00000000..1bd61a9e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/NewExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/NewFunction.png b/bundles/org.simantics.sysdyn.help/Site/Images/NewFunction.png new file mode 100644 index 00000000..84517e28 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/NewFunction.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/NewFunctionLibrary.png b/bundles/org.simantics.sysdyn.help/Site/Images/NewFunctionLibrary.png new file mode 100644 index 00000000..ca099d12 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/NewFunctionLibrary.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/OpenPerspective.png b/bundles/org.simantics.sysdyn.help/Site/Images/OpenPerspective.png new file mode 100644 index 00000000..51f8e6a4 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/OpenPerspective.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/PieChartChartPanel.png b/bundles/org.simantics.sysdyn.help/Site/Images/PieChartChartPanel.png new file mode 100644 index 00000000..c01d0769 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/PieChartChartPanel.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/PieChartGeneral.png b/bundles/org.simantics.sysdyn.help/Site/Images/PieChartGeneral.png new file mode 100644 index 00000000..e2fe067a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/PieChartGeneral.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/PieChartVariable.png b/bundles/org.simantics.sysdyn.help/Site/Images/PieChartVariable.png new file mode 100644 index 00000000..82581fe8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/PieChartVariable.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Preferences.png b/bundles/org.simantics.sysdyn.help/Site/Images/Preferences.png new file mode 100644 index 00000000..9bbb8590 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Preferences.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Replaceable.png b/bundles/org.simantics.sysdyn.help/Site/Images/Replaceable.png new file mode 100644 index 00000000..49200f84 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Replaceable.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Replacing.png b/bundles/org.simantics.sysdyn.help/Site/Images/Replacing.png new file mode 100644 index 00000000..9b44701e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Replacing.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ReplacingEnumeration.png b/bundles/org.simantics.sysdyn.help/Site/Images/ReplacingEnumeration.png new file mode 100644 index 00000000..8989c205 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ReplacingEnumeration.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ReplacingEnumerationConfiguration.png b/bundles/org.simantics.sysdyn.help/Site/Images/ReplacingEnumerationConfiguration.png new file mode 100644 index 00000000..561121b8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ReplacingEnumerationConfiguration.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Saveresults.png b/bundles/org.simantics.sysdyn.help/Site/Images/Saveresults.png new file mode 100644 index 00000000..444ec1ea Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Saveresults.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SelectEnumerations.png b/bundles/org.simantics.sysdyn.help/Site/Images/SelectEnumerations.png new file mode 100644 index 00000000..cfd75752 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SelectEnumerations.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SelectNewExpression.png b/bundles/org.simantics.sysdyn.help/Site/Images/SelectNewExpression.png new file mode 100644 index 00000000..7df0e3f3 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SelectNewExpression.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityChart.png b/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityChart.png new file mode 100644 index 00000000..973044d1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityChart.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityChartAxisAndVariables.png b/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityChartAxisAndVariables.png new file mode 100644 index 00000000..92ef541a Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityChartAxisAndVariables.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityExperiment.png b/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityExperiment.png new file mode 100644 index 00000000..42034585 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SensitivityExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SharedFunctions.png b/bundles/org.simantics.sysdyn.help/Site/Images/SharedFunctions.png new file mode 100644 index 00000000..d705a1a0 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SharedFunctions.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Sheet.png b/bundles/org.simantics.sysdyn.help/Site/Images/Sheet.png new file mode 100644 index 00000000..bb517d7e Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Sheet.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SheetForMultidim.png b/bundles/org.simantics.sysdyn.help/Site/Images/SheetForMultidim.png new file mode 100644 index 00000000..db33f106 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SheetForMultidim.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SheetMultidim1.png b/bundles/org.simantics.sysdyn.help/Site/Images/SheetMultidim1.png new file mode 100644 index 00000000..781e52e2 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SheetMultidim1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/SheetMultidim2.png b/bundles/org.simantics.sysdyn.help/Site/Images/SheetMultidim2.png new file mode 100644 index 00000000..5a6c7ba2 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/SheetMultidim2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/ShowInCharts.png b/bundles/org.simantics.sysdyn.help/Site/Images/ShowInCharts.png new file mode 100644 index 00000000..9fdea85b Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/ShowInCharts.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Trend.png b/bundles/org.simantics.sysdyn.help/Site/Images/Trend.png new file mode 100644 index 00000000..256e66af Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Trend.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/UnitValidation.png b/bundles/org.simantics.sysdyn.help/Site/Images/UnitValidation.png new file mode 100644 index 00000000..1035a99d Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/UnitValidation.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/Values.png b/bundles/org.simantics.sysdyn.help/Site/Images/Values.png new file mode 100644 index 00000000..f55734e3 Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/Values.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/WithLookup1.png b/bundles/org.simantics.sysdyn.help/Site/Images/WithLookup1.png new file mode 100644 index 00000000..08df607b Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/WithLookup1.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/Images/WithLookup2.png b/bundles/org.simantics.sysdyn.help/Site/Images/WithLookup2.png new file mode 100644 index 00000000..3f69912f Binary files /dev/null and b/bundles/org.simantics.sysdyn.help/Site/Images/WithLookup2.png differ diff --git a/bundles/org.simantics.sysdyn.help/Site/sysdyn.html b/bundles/org.simantics.sysdyn.help/Site/sysdyn.html new file mode 100644 index 00000000..0f3f54ac --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/Site/sysdyn.html @@ -0,0 +1,286 @@ + +Simantics System Dynamics

Simantics System Dynamics

Contents

What is Simantics System Dynamics

+

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.

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 the software and try our basic and advanced tutorials!

Introduction to System Dynamics Simulation

+

System Dynamics

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 installation instructions.

Model

System dynamics model is generally understood as the model configuration. In this tool, the model contains also other components: Experiments 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. Module types 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 Functions folder contains built-in and user-defined functions.

+
+

Model structure

+

Components

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.

+
+

Component types

+

Auxiliary

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: Auxiliary, Parameter, Constant, Delay and WithLookup. 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.

Dependency

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.

Flow

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.

Valve

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.

Stock

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.

Cloud

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.

Module

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.

Input

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.

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.

Loop

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

Modeling Principles

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.

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.

Connections

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.

Graphical annotations

System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important, for communicating the behavior of the model.

Installation Instructions

+

System dynamics tool is provided with the Simantics platform.

  1. Download installer from the tool's download page

  2. Install the program to a directory without spaces (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 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. In addition to OpenModelica, a development version of a purpose-built Modelica solver is embedded in the tool.

Workbench

+
+
+

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.

2 Model Browser

Model browser shows the structure of your model and all items related to it.

Symbols

Symbols view (stacked with the model browser) is used for dragging elements to diagrams.

Search

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.

Console

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.

Profiles

Profiles view (stacked with the property view) allows enabling/disabling some visual diagram effects.

Trend

Trend 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 view (stacked with the trend view) can be used for analyzing the varaible dependencies, loops, and the structure of the model.

Values

The values 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.

5 Save and save as...

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.

6 Diagram tool mode

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.

7 Experiment controls

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.

8 Perspectives

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:
+

9 Chart Panel

Chart panel is able to house multiple 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! 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.

+
+
CategoryDescription
General -> KeysAll keyboard shortcuts available.
ModelicaThe location of OpenModelica solver on file system.
SolverSolver to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.
Sysdyn DiagramsSysdyn Diagrams allows customize default colors and fonts of diagram elements.

Modelling

+

Basic Modelling

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.

+
+

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.

+
+

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.

Configuring a model

Model configuration can be opened by double clicking Configuration in the model browser.

Configuring modules

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!

Populate variables

You can drag variables to a diagram from symbol view. You can also populate variables using shortcut keys. Variables can be divided into multiple lines by resizing the variable on diagram.

Populate modules

Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram.

Create connections

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.

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.

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.

Connections between modules

Outside the module

You can connect variables to variables in modules like this:

MODULE -----> INPUT
+or
+ANY VARIABLE -----> MODULE 
+

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

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

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.

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.

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.

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.

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.

Model Properties

Model properties can be viewed by selecting either the model or its configuration on the model browser.

+
+
PropertyDescription
NameThe name of the model
Start timeThe start time of the simulation.
Stop timeThe stop time of the simulation.
Step lengthThe length of the simulation step.
Output intervalInterval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented.
MethodThe simulation solver (only OpenModelica).
Validate unitsUnit validation on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu.
Unit equivalentsDefine if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation.
ToleranceIntegrator error tolerance (only OpenModelica)
Variable filterDefine which variables are presented (only OpenModelica)

Special Variables

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

+
+

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.

+
+

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.

+
+

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.

+
+

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:

Real Delay3;
+Delay3_delayClass Delay3_delayClass_instance(initialValue = 0, delayTime = 1);
+class Delay3_delayClass
+  parameter Real DL = delayTime/3;
+  parameter Real delayTime;
+  parameter Real initialValue;
+  Real delay0;
+  Real LV1(fixed=true, start=initialValue * DL);
+  Real delay1;
+  Real LV2(fixed=true, start=initialValue * DL);
+  Real delay2;
+  Real LV3(fixed=true, start=initialValue * DL);
+  Real delay3;
+equation
+  der(LV1) = - delay1 + delay0;
+  delay1 = LV1 /DL;
+  der(LV2) = - delay2 + delay1;
+  delay2 = LV2 /DL;
+  der(LV3) = - delay3 + delay2;
+  delay3 = LV3 /DL;
+end Delay3_delayClass;
+

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:

Delay3_delayClass_instance.delay0 = Step1;
+Delay3 = Delay3_delayClass_instance.delay3;
+

Shortcut and Control Keys

Shortcut keys for configuring a model on diagram.

KeyAction
EscCancel operations (e.g. connection and rename).
Shift + AHover Auxiliary at the cursor position, populate with left mouse button.
Shift + SHover Stock at the cursor position, populate with left mouse button.
Shift + CHover Cloud at the cursor position, populate with left mouse button.
Shift + VHover Valve at the cursor position, populate with left mouse button.
Shift + IHover Input at the cursor position, populate with left mouse button.
Shift + GHover Shadow (Ghost) variable at the cursor position, populate with left mouse button.
Alt + left mouse buttonStart an arrow from a variable. End to another variable by clicking left mouse button.
Alt + right mouse buttonStart 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.
DeleteRemove selected variables
F2Rename selected variable
Ctrl + left mouse buttonSelect multiple variables
Mouse wheel or + or -Diagram zoom
drag(mouse3)Diagram pan
drag(shift + any mouse button)Diagram pan
↓, ←, ↑, → (arrow keys)Diagram pan
Ctrl + CCopy selected elements
Ctrl + XCut selected elements
Ctrl + VPaste copied or cut elements
Ctrl + FFind element in current diagram or all models
GShow / hide grid
RShow / hide ruler
1Fit diagram contents to screen
Ctrl + SpaceContent assist in equation editor

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.

Common error sources of unit validation include the following. The respective issues are shown in the picture below.

+
+
  • The equation of a variable yields a different unit than that defined for the variable.

  • Two variables which have different units are added (+), subtracted (-), or compared (>, <, =, ...).

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

  • A function is called with an argument of a prohibited unit.

  • A variable has an empty unit.

  • A variable has a misspelled unit.

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.

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.

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

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

    Aux1 + time
+

yields a warning, it can be fixed be changing the expression to

    unitCast(Aux1) + time
+

, in which case the unit of the expression is that of time, or to

    Aux1 + unitCast(time)
+

, in which case the unit of the expression is that of Aux1.

Diagram Profiles

Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used:

Default

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

When enabled, the original and all the shadow variables are highlighted when one is selected.

Simulation Playback

Playback Colors

When enabled, colors of the elements on diagram change during a playback experiment.

Visual model elements

+

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.

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.

Dependency properties

Dependency arrow properties can be changed on the property view:

Polarity

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.

Location

Location of the polarity mark

Arrowhead

Toggle for showing arrowhead

Delay mark

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.

Line thickness

Thickness of the arrow

Loops

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.

Loop Items

The loop of variables which the loop symbol refers can be selected for visualization purposes.

Comment

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.

Direction of Rotation

Direction to which the loop rotates on diagram.

Comments

Comments are just strings of text.

Simulation

+

Experiments

There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics.

Experiments are created from the context menu of experiments folder in a model.

+
+

Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar.

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.

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.

Simulation playback

Simulation playback works essentially as the basic experiment, but it offers some additional visualization options.

Sensitivity analysis simulation

Sensitivity analysis allows running multivariate Monte Carlo simulations with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters.

+
+
General-
NameThe name of the sensitivity analysis experiment. Displayed in e.g. model browser.
Number of runsThe total amount of individual simulation runs
MethodThe method of how the parameter values are selected from the distribution(s). Selecting "Random" yields pseudo-random values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a quasi-random Halton sequence of values selected deterministically to represent the distribution(s) better than a pseudo-random series.
SeedThe seed number for pseudo-random generator
Add parameterAdds a new parameter to be varied
RemoveRemoves a parameter
Parameter properties-
VariableThe full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type.
RangeUsed with multidimensional values to select which dimensions are varied.
DistributionProbability distribution for the varied parameter. "Normal" is for truncated normal distribution and "Uniform" for uniform distribution. 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".
Distribution properties-
Min valueMinimum value of the distribution
Max valueMaximum value of the distribution
MeanMean of the normal distribution
Standard deviationStandard deviation of the normal distribution

Solvers

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.

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.

Simulation Result and Model Structure Analysis

+

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 custom charts.

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.

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.

+
+

Values

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.

+
+

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:

+
+

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.

+
+

Dependencies

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.

+
+

Model Hierarchy

Model Hierarchy displays the hierarchical structure of the model. The module type where a selected variable is located is highlighted.

+
+

Loops

Loops display all feedback loops which the selected variable belongs to.

+
+

Custom Charts

+

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.

+
+

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

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.

+
+
+
+
General-
NameThe name of the chart. Displayed in e.g. model browser
TitleThe title of the chart. Displayed in the chart
TypeLine chart (default) or area chart
HideOptions to hide chart grid, title or legend
X-axis-
VariableA variable that is used as the x-axis variable. The default variable is time and it needs not to be typed in the field.
LabelOptional other label for the variable than its name
MinMinimum value of the x-axis
MaxMaximum value of the x-axis
HideOptions to hide x-axis label, line, tick marks and tick labels
+
+
Variable-
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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.
LabelOptional label for the variable. If label is empty, the variable name is displayed.
ColorColor for the lines of this variable
Line widthThe width of the lines drawn for this variable

There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.

Y-axis-
LabelLabel of the axis
MinMinimum value in the axis
MaxMaximum value in the axis
ColorThe color of the axis lines, ticks and labels
HideOptions to hide parts of the axis: label, axis line, tick marks, tick labels

Sensitivity Chart

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.

+
+
+
+
Axis and Variables-
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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 medianDisplay the median value of the variable at each time step.
Confidence bounds and colorsThe confidence bounds in percents 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.

Y-axis-
LabelLabel of the axis
MinMinimum value in the axis
MaxMaximum value in the axis
ColorThe color of the axis lines, ticks and labels
HideOptions to hide parts of the axis: label, axis line, tick marks, tick labels

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.

+
+
General-
NameThe name of the chart. Name is displayed in model browser.
TitleThe title of the chart. Title is displayed in the chart, if not hidden
TypeNormal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks.
TimeA general time setting for the entire chart. The values at this time are displayed in the chart
HideOption for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed.
+
+

Charts can be added to model diagrams simply by dragging the chart from model browser to diagram.

+
+
Variable-
Add / RemoveAdd or remove variables
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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.
LabelOptional label for the variable. If label is empty, the variable name is displayed
TimeThe time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.
+
+
Domain axis-
LabelAn optional label for x axis
Label angleAxis labels can be displayed in an angle. This value determines the angle in degrees.
ColorThe color of the axis line, tick lines and labels
HideOptions for hiding axis label, line, tick marks and tick labels
Range axis-
LabelAn optional label for y axis
MinMinimum value of y axis
MaxMaximum value of y axis
ColorThe color of the axis line, tick lines and labels
HideOptions for hiding axis label, line, tick marks and tick labels

Pie Chart

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.

+
+
General-
NameThe name of the chart. Displayed in e.g. model browser
TitleTitle The title of the chart. Displayed in the chart
TimeA general time setting for the entire chart. The values at this time are displayed in the chart
HideOptions for hiding title, section labels and legend
+
+
Variables-
Add / RemoveAdd or remove variables
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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.
LabelOptional label for the variable. If label is empty, the variable name is displayed
ColorColor for the sector of this variable
TimeThe time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.
ExplodedIf set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart
+
+

Chart Panel

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.

+
+

Chart panel can be either horizontally or vertically oriented. Different orientations help in configuring the workbench perspective.

+
+

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.

By default, chart panel is hidden in the upper-right corner of the system dynamics perspective.

Multidimensional Variables

+

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

1 Create the model structure

Model with multidimensional variables looks just like any other model.

+
+

2 Create Enumerations and define the indexes

Enumerations are created by right-clicking configuration and selecting New->Enumeration.

+
+

Define enumeration indexes by adding as many indexes as you want. Rename the indexes by selecting them and then clicking on them again.

+
+

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.

+
+

4 Define equations for all possible indexes

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

+
+

Expressions

Values for all cells in the variable matrix can be defined in a single expression.

+
+
+
+

In many situations, it is however more clear to define separate expressions for each cell or blocks.

1 Define range for the expression

+
+

2 Define the expression (dimensions of the defined range and the result of the expression must match!)

+
+

3 Create a new expression

+
+

4 Select the new expression

+
+

Repeat until there is value for each cell. There must be exactly one value for each cell.

Array Slices

Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable:

 enumeration E1 = one, two, three
+ enumeration E2 = eins, zwei, drei
+ Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
+

The whole variable can be accessed in three different ways:

  1. Auxiliary

  2. Auxiliary[E1, E2]

  3. Auxiliary[:, :]

The following explains different methods for accessing parts of the variable

 // Single cell
+ Auxiliary[one, eins] = 1
+
 // 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}}
+

The syntax for accessing parts of variables can be used in both expression range definitions and in expressions.

Arithmetic Operators

Arithmetic operations are defined in Modelica. Below are examples of different operations.

Addition and substraction

Addition and substraction are calculated elementwise

 {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
+

Division

Division with a scalar

 {5,10,15} / 5 = {1,2,3}
+ 5 / {5,10,15} = ERROR! not allowed
+

Division with an array

 {1,2,3} / {1,2,3} = ERROR! not allowed
+ 
+ // Elementwise
+ {1,2,3} ./ {1,2,3} = {1,1,1}
+

Multiplication

Multiplication with a scalar

 {1,2,3} * 2 = {2,4,6}
+ 5 * {1,2,3} = {5,10,15}
+

Matrix multiplication with an array

 {{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[2,2] d = {{3,4},{5,6}};
+ Real[2,2] cd;
+ cd = c[2:3, :] .* d; // Result: {{9,16},{25,36}}
+

Power

Elementwise power of array variable

 {1,2} .^ 2 = {1,4}
+

Builtin Modelica Functions

Modelica has some builtin functions that help using multidimensional variables. This chapter introduces some of the builtin functions.

Dimension and size functions

We will use the same example variable as previously.

 enumeration E1 = one, two, three
+ enumeration E2 = eins, zwei, drei
+ 
+ Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
+

ndims(A)

The number of dimensions in array A

 ndims(Auxiliary) = 2
+

size(A, i)

The size of dimension i in array A

 size(Auxiliary, 2) = 3
+

size(A)

A vector of length ndims(A) containing the dimension sizes of A

 size(Auxiliary) = {3,3}
+

Construction functions

In addition to normal array constructing, a special construction functions can be used.

zeros(n1,n2,n3,...)

An array full of zeros with dimensions n1 x n2 x n2 x ...

 zeros(2, 2) = {{0,0}, {0,0}}
+

ones(n1,n2,n3,...)

An array full of ones with dimensions n1 x n2 x n2 x ...

 ones(2, 2) = {{1,1}, {1,1}}
+

fill(s,n1,n2,n3)

Like zeros() and ones(), but with user defined value (s) for array elements.

 fill(3,2,2) = {{3,3}, {3,3}}
+

identity(n)

Creates an n x n integer identity matrix with ones on the diagonal and all other elements zero.

 identity(3) =
+   1 0 0
+   0 1 0
+   0 0 1
+

diagonal(v)

Constructs a square matrix with elements of vector v on the diagonal and all other elements zero.

 diagonal({1,2,3}) =
+   1 0 0
+   0 2 0
+   0 0 3
+

linspace(x1,x2,n)

Constracts a Real vector from x1 to x2 with n equally spaced elements.

 linspace(2,5,4) = {2,3,4,5}
+

Reduction functions

Reduction functions reduce arrays to scalars.

min(A)

Returns the minimum value in array A.

 Real A = {{1,2},{3,4}}
+ min(A) = 1
+

max(A)

Returns the maximum value in array A.

 Real A = {{1,2},{3,4}}
+ max(A) = 4
+

sum(A)

Returns the sum of values in array A.

 Real A = {{1,2},{3,4}}
+ sum(A) = 10    // 1 + 2 + 3 + 4
+

product(A)

Returns the product of values in array A.

 Real A = {{1,2},{3,4}}
+ product(A) = 24   // 1 * 2 * 3 * 4
+

Using functions with iterators

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.

 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})}
+ */
+

One expression can have multiple iterators. The Modelica specification defines the following format, but it is NOT yet supported in OpenModelica:

 {sum(Array[ i, j, E3]) for i in E1, j in E2}  // Dimensions reduced from 3 to 2
+

To use multiple iterators, use the following format (NOTE the reversed order of iterators!):

 {{sum(Array[ i, j, E3]) for j in E2} for i in E1}  // Dimensions reduced from 3 to 2
+

The range doesn't have to be the whole enumeration. Subranges can also be used.

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

+
+

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.

+
+

Array Variables in Modules

+
+

Replaceable enumeration inside a module

+

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

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.

+
+

Module configuration for replacing enumerations inside the module

+

In the parent configuration, we have used an enumeration with three indexes in the two variables.

+
+

Enumeration in the parent configuration that will replace the enumeration in the module

+

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.

+
+

Enumeration in the parent configuration that will replace the enumeration in the module

+

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!

Functions

+

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

+
+

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.

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.

Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and Modelica specifications.

+
+

Function Libraries

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

+
+

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.

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.

Below is a simple example of using a function that returns the sum of two arguments.

 double exampleCFunction(double x, double y)
+ {
+   double res;
+   res = x + y;
+   return res;
+ }
+
+
+

You need to create an Object file (.o) of your code, import it to a function and define the function to use the library and function that you created. If you don’t have a C-compiler, you can use the one provided by the Simantics installation (e.g. simantics_home/plugins/org.simantics.openmodelica.win32_x/MinGW/bin/mingw32_gcc.exe -g -O -c ExampleCFunctionCode.c).

+
+

You can use the external function like any other function in your variables. Using equation ExampleExternalFunction(Stock1, 10) in an auxiliary variable (Auxiliary2) gives the following result.

+
+

In addition to .o -files, you can import .c and .h files. By including these to the function, the source code can be reviewed and later by you or others that use the function.

Small external C function can also be written directly to the function code in Simantics Sysdyn:

 function ExampleExternalFunction
+ input Real x;
+ input Real y;
+ output Real z;
+ external "C" z=exampleCFunction(x,y) annotation(Include="
+ double exampleCFunction(double x, double y)
+ {
+   double res;
+   res = x + y;
+   return res;
+ }");
+ end ExampleExternalFunction;
+

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.

FunctionDescription
abs(x)Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)".
acos(x)Inverse cosine.
asin(x)Inverse sine.
atan(x)Inverse tangent.
atan2(x1,x2)four quadrant inverse tangent.
cat(n,A,B,...)General concatenation function that concatenates arrays A,B,... along the nth dimension.
ceil(x)Returns the smallest integer not less than x, the closest integer above x.
cos(x)Cosine.
cosh(x)Hyperbolic cosine.
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)).
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.
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.
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)".
sin(x)Sine.
sinh(x)Hyperbolic sine.
sqrt(x)Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs.
tan(x)Tangent.
tanh(x)Hyperbolic tangent.
terminal()Returns true at the end of a successful simulation.

Spreadsheets

+

Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality.

Variable Values

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.

+
+
+

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.

+
+

Reference to a sheet range creates an array variable.

+
+

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

+
+

History Data

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.

+
+

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 properties-
NameName of the history dataset
SheetCombo box for selecting a sheet where the history data is located
OrientationColumns or rows. How the data is arranged in the sheet.
Range startThe upper-left corner cell of the history data range
Range endThe lower-right corner cell of the history data range
Time variableThe name of the time variable in the history data, if it is different than "time"
Variables in rangeThis text field displays the found variables in the given sheet and range

If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart.

+
+

Vensim Model Import

+

The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool Vensim. 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:

  • The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported.

  • Only variables and connections are imported.

  • Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported.

  • Variable value range data is not always imported correctly.

  • Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent.

  • Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant).

  • Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine.

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

Sample Models and Molecules

+

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 | System Dynamics Modelling

+

Tutorial: Basic System Dynamics Modelling

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.

Tutorial: Advanced System Dynamics Modelling

This tutorial introduces the more advanced features of the system dynamics modelling tool: Modules and Operating interfaces

\ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.help/build.properties b/bundles/org.simantics.sysdyn.help/build.properties new file mode 100644 index 00000000..aa5a4cf3 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/build.properties @@ -0,0 +1,11 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + index.xml,\ + commonrtl.css,\ + commonltr.css,\ + Site/,\ + SYSDYN.xml diff --git a/bundles/org.simantics.sysdyn.help/commonltr.css b/bundles/org.simantics.sysdyn.help/commonltr.css new file mode 100644 index 00000000..da51ac17 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/commonltr.css @@ -0,0 +1,433 @@ +/* + | This file is part of the DITA Open Toolkit project. + | See the accompanying LICENSE file for applicable license. +*/ +/* + | (c) Copyright 2004, 2005 IBM Corporation + */ +.unresolved { + background-color: skyblue; +} +.noTemplate { + background-color: yellow; +} +.base { + background-color: #ffffff; +} +/* Add space for top level topics */ +.nested0 { + margin-top: 1em; +} +/* div with class=p is used for paragraphs that contain blocks, to keep the XHTML valid */ +.p { + margin-top: 1em; +} +/* Default of italics to set apart figure captions */ +.figcap { + font-style: italic; +} +.figdesc { + font-style: normal; +} +/* Use @frame to create frames on figures */ +.figborder { + border-style: solid; + padding-left: 3px; + border-width: 2px; + padding-right: 3px; + margin-top: 1em; + border-color: Silver; +} +.figsides { + border-left: 2px solid; + padding-left: 3px; + border-right: 2px solid; + padding-right: 3px; + margin-top: 1em; + border-color: Silver; +} +.figtop { + border-top: 2px solid; + margin-top: 1em; + border-color: Silver; +} +.figbottom { + border-bottom: 2px solid; + border-color: Silver; +} +.figtopbot { + border-top: 2px solid; + border-bottom: 2px solid; + margin-top: 1em; + border-color: Silver; +} +/* Most link groups are created with
. Ensure they have space before and after. */ +.ullinks { + list-style-type: none; +} +.ulchildlink { + margin-top: 1em; + margin-bottom: 1em; +} +.olchildlink { + margin-top: 1em; + margin-bottom: 1em; +} +.linklist { + margin-bottom: 1em; +} +ul.linklist { + margin-top: 0; + list-style-type: none; + padding-left: 0; +} +li.linklist { + margin-top: 0; + margin-bottom: 0; +} +.linklistwithchild { + margin-left: 1.5em; + margin-bottom: 1em; +} +.sublinklist { + margin-left: 1.5em; + margin-bottom: 1em; +} +.relconcepts { + margin-top: 1em; + margin-bottom: 1em; +} +.reltasks { + margin-top: 1em; + margin-bottom: 1em; +} +.relref { + margin-top: 1em; + margin-bottom: 1em; +} +.relinfo { + margin-top: 1em; + margin-bottom: 1em; +} +.breadcrumb { + font-size: smaller; + margin-bottom: 1em; +} +dt.prereq { + margin-left: 20px; +} +/* Set heading sizes, getting smaller for deeper nesting */ +.topictitle1 { + margin-top: 0; + margin-bottom: .1em; + font-size: 1.34em; +} +.topictitle2 { + margin-top: 1pc; + margin-bottom: .45em; + font-size: 1.17em; +} +.topictitle3 { + margin-top: 1pc; + margin-bottom: .17em; + font-size: 1.17em; + font-weight: bold; +} +.topictitle4 { + margin-top: .83em; + font-size: 1.17em; + font-weight: bold; +} +.topictitle5 { + font-size: 1.17em; + font-weight: bold; +} +.topictitle6 { + font-size: 1.17em; + font-style: italic; +} +.sectiontitle { + margin-top: 1em; + margin-bottom: 0; + color: black; + font-size: 1.17em; + font-weight: bold; +} +.section { + margin-top: 1em; + margin-bottom: 1em; +} +.example { + margin-top: 1em; + margin-bottom: 1em; +} +div.tasklabel { + margin-top: 1em; + margin-bottom: 1em; +} +h2.tasklabel, +h3.tasklabel, +h4.tasklabel, +h5.tasklabel, +h6.tasklabel { + font-size: 100%; +} +/* All note formats have the same default presentation */ +.note { + margin-top: 1em; + margin-bottom: 1em; +} +.notetitle { + font-weight: bold; +} +.notelisttitle { + font-weight: bold; +} +.tip { + margin-top: 1em; + margin-bottom: 1em; +} +.tiptitle { + font-weight: bold; +} +.fastpath { + margin-top: 1em; + margin-bottom: 1em; +} +.fastpathtitle { + font-weight: bold; +} +.important { + margin-top: 1em; + margin-bottom: 1em; +} +.importanttitle { + font-weight: bold; +} +.remember { + margin-top: 1em; + margin-bottom: 1em; +} +.remembertitle { + font-weight: bold; +} +.restriction { + margin-top: 1em; + margin-bottom: 1em; +} +.restrictiontitle { + font-weight: bold; +} +.attention { + margin-top: 1em; + margin-bottom: 1em; +} +.attentiontitle { + font-weight: bold; +} +.dangertitle { + font-weight: bold; +} +.danger { + margin-top: 1em; + margin-bottom: 1em; +} +.cautiontitle { + font-weight: bold; +} +.caution { + font-weight: bold; + margin-bottom: 1em; +} +.warning { + margin-top: 1em; + margin-bottom: 1em; +} +.warningtitle { + font-weight: bold; +} +/* Simple lists do not get a bullet */ +ul.simple { + list-style-type: none; +} +/* Used on the first column of a table, when rowheader="firstcol" is used */ +.firstcol { + font-weight: bold; +} +/* Various basic phrase styles */ +.bold { + font-weight: bold; +} +.boldItalic { + font-weight: bold; + font-style: italic; +} +.italic { + font-style: italic; +} +.underlined { + text-decoration: underline; +} +.uicontrol { + font-weight: bold; +} +.wintitle { + font-weight: bold; +} +.parmname { + font-weight: bold; +} +.kwd { + font-weight: bold; +} +.defkwd { + font-weight: bold; + text-decoration: underline; +} +.var { + font-style: italic; +} +.shortcut { + text-decoration: underline; +} +.menucascade > abbr { + text-decoration: none; +} +/* Default of bold for definition list terms */ +.dlterm { + font-weight: bold; +} +/* Use CSS to expand lists with @compact="no" */ +.dltermexpand { + font-weight: bold; + margin-top: 1em; +} +*[compact="yes"] > li { + margin-top: 0; +} +*[compact="no"] > li { + margin-top: .53em; +} +.liexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.sliexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.dlexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.ddexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.stepexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.substepexpand { + margin-top: 1em; + margin-bottom: 1em; +} +/* Align images based on @align on topic/image */ +div.imageleft { + text-align: left; +} +div.imagecenter { + text-align: center; +} +div.imageright { + text-align: right; +} +div.imagejustify { + text-align: justify; +} +/* The cell border can be turned on with + {border-right:solid} + This value creates a very thick border in Firefox (does not match other tables) + + Firefox works with + {border-right:solid 1pt} + but this causes a barely visible line in IE */ +.cellrowborder { + border-left: none; + border-top: none; + border-right: solid 1px; + border-bottom: solid 1px; +} +.row-nocellborder { + border-left: none; + border-top: none; + border-right: hidden; + border-bottom: solid 1px; +} +.cell-norowborder { + border-top: none; + border-left: none; + border-bottom: hidden; + border-right: solid 1px; +} +.nocellnorowborder { + border: none; + border-right: hidden; + border-bottom: hidden; +} +pre.screen { + padding: 5px 5px 5px 5px; + border: outset; + background-color: #CCCCCC; + margin-top: 2px; + margin-bottom: 2px; + white-space: pre; +} +span.filepath, +samp.codeph, +pre.codeblock { + font-family: monospace; +} + +/*! + * Custom CSS declarations, to be appended to the end of existing declarations + */ + +.imageText { + padding: 1px; + border: 1px solid; + text-align: center; + border-color: #c8ccd1; +} + +.imageBorder { + padding: 4px; + border: 1px solid; + border-color: #c8ccd1; + display: table; + background-color: #f8f9fa; +} + + .box { + display: flex; + align-items:left; +} + +center { + margin: auto; + width: 50%; +} + +.hr{ + border-top: 1px solid black; +} + + pre { + color: #000000; + display: block; + white-space: pre-wrap; + margin: 1em 0; + background-color: #f8f9fa; + border: 1px solid #eaecf0; + padding: 0; +} diff --git a/bundles/org.simantics.sysdyn.help/commonrtl.css b/bundles/org.simantics.sysdyn.help/commonrtl.css new file mode 100644 index 00000000..de01f230 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/commonrtl.css @@ -0,0 +1,437 @@ +/* + | This file is part of the DITA Open Toolkit project. + | See the accompanying LICENSE file for applicable license. +*/ +/* + | (c) Copyright 2004, 2005 IBM Corporation + */ +.unresolved { + background-color: skyblue; +} +.noTemplate { + background-color: yellow; +} +.base { + background-color: #ffffff; +} +/* Add space for top level topics */ +.nested0 { + margin-top: 1em; +} +/* div with class=p is used for paragraphs that contain blocks, to keep the XHTML valid */ +.p { + margin-top: 1em; +} +/* Default of italics to set apart figure captions */ +.figcap { + font-style: italic; +} +.figdesc { + font-style: normal; +} +/* Use @frame to create frames on figures */ +.figborder { + border-style: solid; + padding-left: 3px; + border-width: 2px; + padding-right: 3px; + margin-top: 1em; + border-color: Silver; +} +.figsides { + border-left: 2px solid; + padding-left: 3px; + border-right: 2px solid; + padding-right: 3px; + margin-top: 1em; + border-color: Silver; +} +.figtop { + border-top: 2px solid; + margin-top: 1em; + border-color: Silver; +} +.figbottom { + border-bottom: 2px solid; + border-color: Silver; +} +.figtopbot { + border-top: 2px solid; + border-bottom: 2px solid; + margin-top: 1em; + border-color: Silver; +} +/* Most link groups are created with
. Ensure they have space before and after. */ +.ullinks { + list-style-type: none; +} +.ulchildlink { + margin-top: 1em; + margin-bottom: 1em; +} +.olchildlink { + margin-top: 1em; + margin-bottom: 1em; +} +.linklist { + margin-top: 1em; + margin-bottom: 1em; +} +ul.linklist { + margin-top: 0; + list-style-type: none; + padding-right: 0; +} + +li.linklist { + margin-top: 0; + margin-bottom: 0; +} +.linklistwithchild { + margin-top: 1em; + margin-right: 1.5em; + margin-bottom: 1em; +} +.sublinklist { + margin-top: 1em; + margin-right: 1.5em; + margin-bottom: 1em; +} +.relconcepts { + margin-top: 1em; + margin-bottom: 1em; +} +.reltasks { + margin-top: 1em; + margin-bottom: 1em; +} +.relref { + margin-top: 1em; + margin-bottom: 1em; +} +.relinfo { + margin-top: 1em; + margin-bottom: 1em; +} +.breadcrumb { + font-size: smaller; + margin-bottom: 1em; +} +dt.prereq { + margin-right: 20px; +} +/* Set heading sizes, getting smaller for deeper nesting */ +.topictitle1 { + margin-top: 0; + margin-bottom: .1em; + font-size: 1.34em; +} +.topictitle2 { + margin-top: 1pc; + margin-bottom: .45em; + font-size: 1.17em; +} +.topictitle3 { + margin-top: 1pc; + margin-bottom: .17em; + font-size: 1.17em; + font-weight: bold; +} +.topictitle4 { + margin-top: .83em; + font-size: 1.17em; + font-weight: bold; +} +.topictitle5 { + font-size: 1.17em; + font-weight: bold; +} +.topictitle6 { + font-size: 1.17em; + font-style: italic; +} +.sectiontitle { + margin-top: 1em; + margin-bottom: 0; + color: black; + font-size: 1.17em; + font-weight: bold; +} +.section { + margin-top: 1em; + margin-bottom: 1em; +} +.example { + margin-top: 1em; + margin-bottom: 1em; +} +div.tasklabel { + margin-top: 1em; + margin-bottom: 1em; +} +h2.tasklabel, +h3.tasklabel, +h4.tasklabel, +h5.tasklabel, +h6.tasklabel { + font-size: 100%; +} +/* All note formats have the same default presentation */ +.note { + margin-top: 1em; + margin-bottom: 1em; +} +.notetitle { + font-weight: bold; +} +.notelisttitle { + font-weight: bold; +} +.tip { + margin-top: 1em; + margin-bottom: 1em; +} +.tiptitle { + font-weight: bold; +} +.fastpath { + margin-top: 1em; + margin-bottom: 1em; +} +.fastpathtitle { + font-weight: bold; +} +.important { + margin-top: 1em; + margin-bottom: 1em; +} +.importanttitle { + font-weight: bold; +} +.remember { + margin-top: 1em; + margin-bottom: 1em; +} +.remembertitle { + font-weight: bold; +} +.restriction { + margin-top: 1em; + margin-bottom: 1em; +} +.restrictiontitle { + font-weight: bold; +} +.attention { + margin-top: 1em; + margin-bottom: 1em; +} +.attentiontitle { + font-weight: bold; +} +.dangertitle { + font-weight: bold; +} +.danger { + margin-top: 1em; + margin-bottom: 1em; +} +.cautiontitle { + font-weight: bold; +} +.caution { + font-weight: bold; + margin-bottom: 1em; +} +.warning { + margin-top: 1em; + margin-bottom: 1em; +} +.warningtitle { + font-weight: bold; +} +/* Simple lists do not get a bullet */ +ul.simple { + list-style-type: none; +} +/* Used on the first column of a table, when rowheader="firstcol" is used */ +.firstcol { + font-weight: bold; +} +/* Various basic phrase styles */ +.bold { + font-weight: bold; +} +.boldItalic { + font-weight: bold; + font-style: italic; +} +.italic { + font-style: italic; +} +.underlined { + text-decoration: underline; +} +.uicontrol { + font-weight: bold; +} +.wintitle { + font-weight: bold; +} +.parmname { + font-weight: bold; +} +.kwd { + font-weight: bold; +} +.defkwd { + font-weight: bold; + text-decoration: underline; +} +.var { + font-style: italic; +} +.shortcut { + text-decoration: underline; +} +.menucascade > abbr { + text-decoration: none; +} +/* Default of bold for definition list terms */ +.dlterm { + font-weight: bold; +} +/* Use CSS to expand lists with @compact="no" */ +.dltermexpand { + font-weight: bold; + margin-top: 1em; +} +*[compact="yes"] > li { + margin-top: 0; +} +*[compact="no"] > li { + margin-top: .53em; +} +.liexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.sliexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.dlexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.ddexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.stepexpand { + margin-top: 1em; + margin-bottom: 1em; +} +.substepexpand { + margin-top: 1em; + margin-bottom: 1em; +} +/* Align images based on @align on topic/image */ +div.imageleft { + text-align: left; +} +div.imagecenter { + text-align: center; +} +div.imageright { + text-align: right; +} +div.imagejustify { + text-align: justify; +} +/* The cell border can be turned on with + {border-right:solid} + This value creates a very thick border in Firefox (does not match other tables) + + Firefox works with + {border-right:solid 1pt} + but this causes a barely visible line in IE */ +.cellrowborder { + border-right: none; + border-top: none; + border-left: solid 1px; + border-bottom: solid 1px; +} +.row-nocellborder { + border-right: none; + border-top: none; + border-left: hidden; + border-bottom: solid 1px; +} +.cell-norowborder { + border-top: none; + border-right: none; + border-bottom: hidden; + border-left: solid 1px; +} +.nocellnorowborder { + border: none; + border-left: hidden; + border-bottom: hidden; +} +pre.screen { + padding: 5px 5px 5px 5px; + border: outset; + background-color: #CCCCCC; + margin-top: 2px; + margin-bottom: 2px; + white-space: pre; +} +span.filepath, +samp.codeph, +pre.codeblock { + font-family: monospace; +} + +/*! + * Custom CSS declarations, to be appended to the end of existing declarations + */ + +.imageText { + padding: 1px; + border: 1px solid; + text-align: center; + border-color: #c8ccd1; +} + +.imageBorder { + padding: 4px; + border: 1px solid; + border-color: #c8ccd1; + display: table; + background-color: #f8f9fa; +} + + .box { + display: flex; + align-items:left; +} + +center { + margin: auto; + width: 50%; +} + +.hr{ + border-top: 1px solid black; +} + + pre { + color: #000000; + display: block; + white-space: pre-wrap; + margin: 1em 0; + background-color: #f8f9fa; + border: 1px solid #eaecf0; + padding: 0; +} diff --git a/bundles/org.simantics.sysdyn.help/index.xml b/bundles/org.simantics.sysdyn.help/index.xml new file mode 100644 index 00000000..0f0a9939 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/index.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.help/plugin.properties b/bundles/org.simantics.sysdyn.help/plugin.properties new file mode 100644 index 00000000..f053ef3c --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/plugin.properties @@ -0,0 +1,4 @@ +# NLS_MESSAGEFORMAT_NONE +# NLS_ENCODING=UTF-8 +name=Simantics System Dynamics +providerName=DITA \ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.help/plugin.xml b/bundles/org.simantics.sysdyn.help/plugin.xml new file mode 100644 index 00000000..3ae13a05 --- /dev/null +++ b/bundles/org.simantics.sysdyn.help/plugin.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/bundles/org.simantics.sysdyn.wiki/.project b/bundles/org.simantics.sysdyn.wiki/.project new file mode 100644 index 00000000..c3cfe73f --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/.project @@ -0,0 +1,11 @@ + + + org.simantics.sysdyn.wiki + + + + + + + + diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorial.html b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorial.html new file mode 100644 index 00000000..80b4307b --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorial.html @@ -0,0 +1,152 @@ + +Tutorial: Advanced System Dynamics Modelling

Tutorial: Advanced System Dynamics Modelling

+

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 is also available. This tutorial is part of the sysdyn documentation.

Creating model and modules

+

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.

+
+

Creating a new model

+
+
+

Creating a new module

+
+
+

Model after renaming

+

Initial configuration

+
+
+

Workforce and Work modules

+

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.

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.

+
+

Workforce and Work modules, first inputs and connections

+

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

Workforce module

+
+
+

Cloud, Valve, Flow and Stock

+

Open Workforce module by selecting it from the diagram, right-clicking it and selecting Show Module.

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.

+
+

Cloud, Valve, Flow and Stock. Flow works both on directions.

+

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.

+
+

Auxiliaries in Workforce module

+

Now you have used all the basic components and connections. From now on the instructions will be a more simplified.

Next we will create four Auxiliary variables: TimeToAllocateResources, WorkforceRequired, Productivity and PossibleWorkingSpeed. Place and connect them according to the picture on the right.

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.

WorkforceStock 
+Initial value: 0
+
+NetResourcing 
+= (WorkforceRequired - WorkforceStock)/TimeToAllocateResources
+
+TimeToAllocateResources 
+= 2
+
+Productivity 
+= 1
+
+PossibleWorkingSpeed 
+= WorkforceStock * Productivity
+Is Output
+

Variables can be set as output by selecting Is Output option from the Equation tab.

+
+

RequiredWorkingSpeedInput

+

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.

WorkForceRequired 
+= RequiredWorkingSpeedInput/Productivity
+

Now this module is ready to be used as a part of the model.

Work module

+
+
+

Basic work with errors

+

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.

Create the basic flow of work with stocks and flows like in the picture on the right.

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.

+
+

Smoothener for work is done

+

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:

ProjectIsReady 
+Initial value: 0
+
+ProjectReadyness 
+= (xidz(WorkDone, ProjectWorkAmount, 0.0) - ProjectIsReady) / 0.08
+

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

+
+

ProjectWorkAmount input variable

+

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.

+
+

Variables needed for error handling

+

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.

ErrorsGenerated
+= (1-WorkQuality) * WorkingSpeed
+
+ErrorsFoundRate
+= Errors/ErrorsFoundTime
+
+WorkQuality
+= 0.9
+
+ErrorsFoundTime
+Type: WithLookup
+With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0) 
+Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
+

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.

+
+

WorkAllocation and RequiredWorkingSpeed

+

To calculate our own need for workforce we need to create and connect WorkCompletionTime input variable and the following auxliary variables:

RequiredWorkingSpeed 
+= if ProjectIsReady < 1 then xidz(WorkToDo, TimeToDeadline, MaximumWorkingSpeed) else 0
+Is Output
+
+MaximumWorkingSpeed 
+= 500
+
+TimeToDeadline 
+= max(0, WorkCompletionTime-time)
+

time is a universal variable that gives the current simulation time.

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.

Create two Inputs, RequiredWorkingSpeedTotalInput and PossibleWorkingSpeedInput, and an auxiliary variable WorkAllocation. Connect the variables like int the picture.

WorkAllocation
+= xidz(RequiredWorkingSpeed, RequiredWorkingSpeedTotalInput, 0.0) * PossibleWorkingSpeedInput
+

Finally let's give initial values for all the remaining variables:

WorkingSpeed 
+= if ProjectIsReady < 1 then WorkAllocation else 0
+
+WorkToDo 
+Initial value: ProjectWorkAmount
+
+WorkDone 
+Initial value: 0
+
+Errors 
+Initial value: 0
+

Connecting modules

+

Our modules are complete. Let's get back to the WorkModel Configuration.

Set Work1CompletionTime to 10.
+
+
+

Module input connections

+

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.

+
+

Module input connections

+

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

+

To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 24.0

+
+

Experiment activation

+
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:
+

System shows the simulation progress in the progress bar on the lower right corner of the screen.

+
+

When the progress indicator disappears, the simulation is complete.

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.

+
+

Adding modules

+
+
+

Final configuration with two modules

+

We created the WorkModule to be reusable. To use two WorkModules in the model, you must do the following.

Populate a second WorkModule to WorkModel configuration and name it Work2.

Create RequiredWorkingSpeed2 input variable and Work2CompletionTime auxiliary variable.

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.

You can also have a different size work. To make Work2 smaller, create an auxiliary variable Work2Amount.

Use the following equations:

Work2CompletionTime
+= 13
+
+Work2Amount
+= 800
+
+RequiredWorkingSpeedTotal
+= RequiredWorkingSpeed1 + RequiredWorkingSpeed2
+

Update connections to match connections shown in the picture and connect the inputs and outputs to the modules.

Workforce
+RequiredWorkingSpeedInput -> RequiredWorkingSpeedTotal
+
+Work1 Inputs
+RequiredWorkingSpeedTotalInput -> RequiredWorkingSpeedTotal
+
+Work2 Outputs
+RequiredWorkingSpeed -> RequiredWorkingSpeed2
+
+Work2 Inputs
+
+
+

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.

+
+
\ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ActivateExperiment.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ActivateExperiment.png new file mode 100644 index 00000000..8843321e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ActivateExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ConfigurationStart.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ConfigurationStart.png new file mode 100644 index 00000000..185d9e27 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ConfigurationStart.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ErrorsVariables.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ErrorsVariables.png new file mode 100644 index 00000000..4b946edb Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ErrorsVariables.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ExperimentPlay.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ExperimentPlay.png new file mode 100644 index 00000000..fc50f88a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ExperimentPlay.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/FirstSimulation.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/FirstSimulation.png new file mode 100644 index 00000000..e1087cb1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/FirstSimulation.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModelStructure2.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModelStructure2.png new file mode 100644 index 00000000..fcb32883 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModelStructure2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/Module2Inputs.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/Module2Inputs.png new file mode 100644 index 00000000..e8997001 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/Module2Inputs.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModuleConnections1.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModuleConnections1.png new file mode 100644 index 00000000..34122819 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModuleConnections1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModuleConnections2.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModuleConnections2.png new file mode 100644 index 00000000..83a9875a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModuleConnections2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModulesFinal.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModulesFinal.png new file mode 100644 index 00000000..8332359d Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ModulesFinal.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NetResourcing1.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NetResourcing1.png new file mode 100644 index 00000000..b47e9474 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NetResourcing1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NetResourcing2.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NetResourcing2.png new file mode 100644 index 00000000..71db6659 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NetResourcing2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NewModel.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NewModel.png new file mode 100644 index 00000000..609a635c Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NewModel.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NewModule.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NewModule.png new file mode 100644 index 00000000..1e28ea43 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/NewModule.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ProjectIsReady.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ProjectIsReady.png new file mode 100644 index 00000000..bcc555ed Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ProjectIsReady.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ProjectWorkAmount.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ProjectWorkAmount.png new file mode 100644 index 00000000..fc64109e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/ProjectWorkAmount.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png new file mode 100644 index 00000000..25a15725 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/SecondSimulation.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/SecondSimulation.png new file mode 100644 index 00000000..dc3bca8c Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/SecondSimulation.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/SimulationProgress.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/SimulationProgress.png new file mode 100644 index 00000000..e145fcc1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/SimulationProgress.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/TwoModules.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/TwoModules.png new file mode 100644 index 00000000..16fdd64b Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/TwoModules.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkAllocation.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkAllocation.png new file mode 100644 index 00000000..40945fdf Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkAllocation.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkStocks.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkStocks.png new file mode 100644 index 00000000..7c787f9a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkStocks.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png new file mode 100644 index 00000000..2044acb1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorial.html b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorial.html new file mode 100644 index 00000000..71077962 --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorial.html @@ -0,0 +1,69 @@ + +Tutorial: Basic System Dynamics Modelling

Tutorial: Basic System Dynamics Modelling

+

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 is also available. This tutorial is part of the sysdyn documentation.

Model

+

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.

+
+

Creating a new model

+

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.

Configuring the model structure

+

Our model is now empty. Let's build a population model for 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.

+
+

Symbols view

+

These are the basic symbols in System dynamics modelling. We will use these 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

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.

+
+

Stock variable Mice

+

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.

+
+

Flows in and out of Mice

+

Of course mice are not alone in the world. There are also owls that hunt mice. Create a similar structure below mice for owls.

+
+

Owls and mice

+

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.

+
+

Auxiliaries for valves

+

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.

+
+

Dependency connections

+

Equations

+

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:

MouseBirths
+= MouseBirthRate * Mice
+
+MouseDeaths
+= Mice * MouseDeathsDueToOwls * Owls
+
+OwlBirths
+= OwlsFromMice * MouseDeaths
+
+OwlDeaths
+= OwlDeathRate * Owls
+
+MouseBirthRate
+= 0.04
+
+MouseDeathsDueToOwls
+= 0.0005
+
+OwlsFromMice
+= 0.1
+
+OwlDeathRate
+= 0.09
+

Finally we need initial values for our populations.

Mice
+Initial Value: 700
+
+Owls
+Initial Value: 10
+

Simulating the model

+
+
+

Experiment activation

+
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:
+

System shows the simulation progress in the progress bar on the lower right corner of the screen.

+
+

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.

+
+

Results for Mice and Owls

+

As you can see, the simulation is complete, but the results do not reveal any interesting behavior. Let's extend the simulation time.

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.

+
+

Results for Mice and Owls, Extended simulation time

+

Now the simulation reveals the traditional behavior of predator-prey models. Feel free to adjust the parameters and try the simulations again.

\ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/ActivatePopulationExperiment.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/ActivatePopulationExperiment.png new file mode 100644 index 00000000..0eeeb7e6 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/ActivatePopulationExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Auxiliaries.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Auxiliaries.png new file mode 100644 index 00000000..5cec62b8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Auxiliaries.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Dependency_connections.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Dependency_connections.png new file mode 100644 index 00000000..eeb22288 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Dependency_connections.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/ExperimentPlay.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/ExperimentPlay.png new file mode 100644 index 00000000..fc50f88a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/ExperimentPlay.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Mice.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Mice.png new file mode 100644 index 00000000..601f77ee Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/Mice.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwlResults1.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwlResults1.png new file mode 100644 index 00000000..bee8c180 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwlResults1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwlResults2.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwlResults2.png new file mode 100644 index 00000000..cd8426fd Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwlResults2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwls.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwls.png new file mode 100644 index 00000000..83b4b085 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceAndOwls.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceFlows.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceFlows.png new file mode 100644 index 00000000..a910ea82 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/MiceFlows.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/NewModel.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/NewModel.png new file mode 100644 index 00000000..609a635c Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/NewModel.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/SimulationProgress.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/SimulationProgress.png new file mode 100644 index 00000000..e145fcc1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/SimulationProgress.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/SymbolsView.png b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/SymbolsView.png new file mode 100644 index 00000000..74e6e0b5 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/BasicTutorialImages/SymbolsView.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/3x3trend.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/3x3trend.png new file mode 100644 index 00000000..a97e66b8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/3x3trend.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/AuxiliarySheet.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/AuxiliarySheet.png new file mode 100644 index 00000000..f1bc334f Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/AuxiliarySheet.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/AuxiliarySheetReference.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/AuxiliarySheetReference.png new file mode 100644 index 00000000..9d6ea326 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/AuxiliarySheetReference.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartAxis.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartAxis.png new file mode 100644 index 00000000..46eaa4a1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartAxis.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartGeneral.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartGeneral.png new file mode 100644 index 00000000..4fe5618a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartGeneral.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartInDiagram.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartInDiagram.png new file mode 100644 index 00000000..4bd16776 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartInDiagram.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartVariable.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartVariable.png new file mode 100644 index 00000000..6e26fb97 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/BarChartVariable.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/BasicWorkbench.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/BasicWorkbench.png new file mode 100644 index 00000000..f5a7ebb5 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/BasicWorkbench.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Basic_1.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Basic_1.png new file mode 100644 index 00000000..f3dc3b3c Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Basic_1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Basic_2.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Basic_2.png new file mode 100644 index 00000000..d52d24b5 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Basic_2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ChartPanel.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ChartPanel.png new file mode 100644 index 00000000..c27a3273 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ChartPanel.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ChartPanelOrientation.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ChartPanelOrientation.png new file mode 100644 index 00000000..dff15a38 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ChartPanelOrientation.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/CompareTrend.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/CompareTrend.png new file mode 100644 index 00000000..35e63c2f Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/CompareTrend.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ComponentTypes.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ComponentTypes.png new file mode 100644 index 00000000..3b354f83 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ComponentTypes.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/CreateNewExpression.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/CreateNewExpression.png new file mode 100644 index 00000000..0eebab17 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/CreateNewExpression.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations.png new file mode 100644 index 00000000..1fa4f6a8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations2.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations2.png new file mode 100644 index 00000000..89f61821 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations3.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations3.png new file mode 100644 index 00000000..679cb73b Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineEquations3.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineIndexes.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineIndexes.png new file mode 100644 index 00000000..d1ed523e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineIndexes.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineRange.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineRange.png new file mode 100644 index 00000000..b45314d8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/DefineRange.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Delay1.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Delay1.png new file mode 100644 index 00000000..6cd77669 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Delay1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Delay2.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Delay2.png new file mode 100644 index 00000000..507d3d99 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Delay2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Dependencies.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Dependencies.png new file mode 100644 index 00000000..54e766ff Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Dependencies.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ExampleExternalFunction.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ExampleExternalFunction.png new file mode 100644 index 00000000..61ef1d13 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ExampleExternalFunction.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ExampleFunction.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ExampleFunction.png new file mode 100644 index 00000000..707ab4ed Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ExampleFunction.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ExternalFunctionResult.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ExternalFunctionResult.png new file mode 100644 index 00000000..5be7fd83 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ExternalFunctionResult.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/HistoryData.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/HistoryData.png new file mode 100644 index 00000000..c4ccb920 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/HistoryData.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/HistoryDataSettings.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/HistoryDataSettings.png new file mode 100644 index 00000000..62545339 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/HistoryDataSettings.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ImportCFunctionLibrary.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ImportCFunctionLibrary.png new file mode 100644 index 00000000..3b0e55f4 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ImportCFunctionLibrary.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChart.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChart.png new file mode 100644 index 00000000..18dcff84 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChart.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChartAxisAndVariables.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChartAxisAndVariables.png new file mode 100644 index 00000000..34e4e2f7 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChartAxisAndVariables.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChartGeneral.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChartGeneral.png new file mode 100644 index 00000000..a22b084c Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/LineChartGeneral.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Loops.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Loops.png new file mode 100644 index 00000000..0cf2c86e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Loops.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelHierarchy.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelHierarchy.png new file mode 100644 index 00000000..b128f6fb Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelHierarchy.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelProperties.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelProperties.png new file mode 100644 index 00000000..0c181522 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelProperties.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelStructure.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelStructure.png new file mode 100644 index 00000000..131e9204 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelStructure.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelWithMultidimensionalVariables.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelWithMultidimensionalVariables.png new file mode 100644 index 00000000..e17528f3 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ModelWithMultidimensionalVariables.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/NewChart.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewChart.png new file mode 100644 index 00000000..76b84c07 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewChart.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/NewEnumeration.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewEnumeration.png new file mode 100644 index 00000000..40ecc979 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewEnumeration.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/NewExperiment.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewExperiment.png new file mode 100644 index 00000000..1bd61a9e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/NewFunction.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewFunction.png new file mode 100644 index 00000000..84517e28 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewFunction.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/NewFunctionLibrary.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewFunctionLibrary.png new file mode 100644 index 00000000..ca099d12 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/NewFunctionLibrary.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/OpenPerspective.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/OpenPerspective.png new file mode 100644 index 00000000..51f8e6a4 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/OpenPerspective.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartChartPanel.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartChartPanel.png new file mode 100644 index 00000000..c01d0769 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartChartPanel.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartGeneral.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartGeneral.png new file mode 100644 index 00000000..e2fe067a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartGeneral.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartVariable.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartVariable.png new file mode 100644 index 00000000..82581fe8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/PieChartVariable.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Preferences.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Preferences.png new file mode 100644 index 00000000..9bbb8590 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Preferences.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Replaceable.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Replaceable.png new file mode 100644 index 00000000..49200f84 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Replaceable.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Replacing.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Replacing.png new file mode 100644 index 00000000..9b44701e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Replacing.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ReplacingEnumeration.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ReplacingEnumeration.png new file mode 100644 index 00000000..8989c205 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ReplacingEnumeration.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ReplacingEnumerationConfiguration.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ReplacingEnumerationConfiguration.png new file mode 100644 index 00000000..561121b8 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ReplacingEnumerationConfiguration.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Saveresults.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Saveresults.png new file mode 100644 index 00000000..444ec1ea Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Saveresults.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SelectEnumerations.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SelectEnumerations.png new file mode 100644 index 00000000..cfd75752 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SelectEnumerations.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SelectNewExpression.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SelectNewExpression.png new file mode 100644 index 00000000..7df0e3f3 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SelectNewExpression.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityChart.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityChart.png new file mode 100644 index 00000000..973044d1 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityChart.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityChartAxisAndVariables.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityChartAxisAndVariables.png new file mode 100644 index 00000000..92ef541a Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityChartAxisAndVariables.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityExperiment.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityExperiment.png new file mode 100644 index 00000000..42034585 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SensitivityExperiment.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SharedFunctions.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SharedFunctions.png new file mode 100644 index 00000000..d705a1a0 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SharedFunctions.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Sheet.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Sheet.png new file mode 100644 index 00000000..bb517d7e Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Sheet.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetForMultidim.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetForMultidim.png new file mode 100644 index 00000000..db33f106 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetForMultidim.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetMultidim1.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetMultidim1.png new file mode 100644 index 00000000..781e52e2 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetMultidim1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetMultidim2.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetMultidim2.png new file mode 100644 index 00000000..5a6c7ba2 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/SheetMultidim2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/ShowInCharts.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/ShowInCharts.png new file mode 100644 index 00000000..9fdea85b Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/ShowInCharts.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Trend.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Trend.png new file mode 100644 index 00000000..256e66af Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Trend.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/UnitValidation.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/UnitValidation.png new file mode 100644 index 00000000..1035a99d Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/UnitValidation.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/Values.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/Values.png new file mode 100644 index 00000000..f55734e3 Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/Values.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/WithLookup1.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/WithLookup1.png new file mode 100644 index 00000000..08df607b Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/WithLookup1.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/Images/WithLookup2.png b/bundles/org.simantics.sysdyn.wiki/Site/Images/WithLookup2.png new file mode 100644 index 00000000..3f69912f Binary files /dev/null and b/bundles/org.simantics.sysdyn.wiki/Site/Images/WithLookup2.png differ diff --git a/bundles/org.simantics.sysdyn.wiki/Site/sysdyn.html b/bundles/org.simantics.sysdyn.wiki/Site/sysdyn.html new file mode 100644 index 00000000..0f3f54ac --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/Site/sysdyn.html @@ -0,0 +1,286 @@ + +Simantics System Dynamics

Simantics System Dynamics

Contents

What is Simantics System Dynamics

+

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.

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 the software and try our basic and advanced tutorials!

Introduction to System Dynamics Simulation

+

System Dynamics

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 installation instructions.

Model

System dynamics model is generally understood as the model configuration. In this tool, the model contains also other components: Experiments 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. Module types 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 Functions folder contains built-in and user-defined functions.

+
+

Model structure

+

Components

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.

+
+

Component types

+

Auxiliary

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: Auxiliary, Parameter, Constant, Delay and WithLookup. 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.

Dependency

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.

Flow

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.

Valve

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.

Stock

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.

Cloud

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.

Module

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.

Input

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.

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.

Loop

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

Modeling Principles

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.

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.

Connections

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.

Graphical annotations

System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important, for communicating the behavior of the model.

Installation Instructions

+

System dynamics tool is provided with the Simantics platform.

  1. Download installer from the tool's download page

  2. Install the program to a directory without spaces (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 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. In addition to OpenModelica, a development version of a purpose-built Modelica solver is embedded in the tool.

Workbench

+
+
+

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.

2 Model Browser

Model browser shows the structure of your model and all items related to it.

Symbols

Symbols view (stacked with the model browser) is used for dragging elements to diagrams.

Search

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.

Console

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.

Profiles

Profiles view (stacked with the property view) allows enabling/disabling some visual diagram effects.

Trend

Trend 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 view (stacked with the trend view) can be used for analyzing the varaible dependencies, loops, and the structure of the model.

Values

The values 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.

5 Save and save as...

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.

6 Diagram tool mode

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.

7 Experiment controls

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.

8 Perspectives

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:
+

9 Chart Panel

Chart panel is able to house multiple 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! 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.

+
+
CategoryDescription
General -> KeysAll keyboard shortcuts available.
ModelicaThe location of OpenModelica solver on file system.
SolverSolver to be used for simulation. OpenModelica or internal custom solver (experimental) can be selected.
Sysdyn DiagramsSysdyn Diagrams allows customize default colors and fonts of diagram elements.

Modelling

+

Basic Modelling

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.

+
+

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.

+
+

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.

Configuring a model

Model configuration can be opened by double clicking Configuration in the model browser.

Configuring modules

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!

Populate variables

You can drag variables to a diagram from symbol view. You can also populate variables using shortcut keys. Variables can be divided into multiple lines by resizing the variable on diagram.

Populate modules

Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram.

Create connections

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.

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.

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.

Connections between modules

Outside the module

You can connect variables to variables in modules like this:

MODULE -----> INPUT
+or
+ANY VARIABLE -----> MODULE 
+

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

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

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.

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.

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.

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.

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.

Model Properties

Model properties can be viewed by selecting either the model or its configuration on the model browser.

+
+
PropertyDescription
NameThe name of the model
Start timeThe start time of the simulation.
Stop timeThe stop time of the simulation.
Step lengthThe length of the simulation step.
Output intervalInterval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented.
MethodThe simulation solver (only OpenModelica).
Validate unitsUnit validation on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu.
Unit equivalentsDefine if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation.
ToleranceIntegrator error tolerance (only OpenModelica)
Variable filterDefine which variables are presented (only OpenModelica)

Special Variables

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

+
+

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.

+
+

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.

+
+

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.

+
+

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:

Real Delay3;
+Delay3_delayClass Delay3_delayClass_instance(initialValue = 0, delayTime = 1);
+class Delay3_delayClass
+  parameter Real DL = delayTime/3;
+  parameter Real delayTime;
+  parameter Real initialValue;
+  Real delay0;
+  Real LV1(fixed=true, start=initialValue * DL);
+  Real delay1;
+  Real LV2(fixed=true, start=initialValue * DL);
+  Real delay2;
+  Real LV3(fixed=true, start=initialValue * DL);
+  Real delay3;
+equation
+  der(LV1) = - delay1 + delay0;
+  delay1 = LV1 /DL;
+  der(LV2) = - delay2 + delay1;
+  delay2 = LV2 /DL;
+  der(LV3) = - delay3 + delay2;
+  delay3 = LV3 /DL;
+end Delay3_delayClass;
+

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:

Delay3_delayClass_instance.delay0 = Step1;
+Delay3 = Delay3_delayClass_instance.delay3;
+

Shortcut and Control Keys

Shortcut keys for configuring a model on diagram.

KeyAction
EscCancel operations (e.g. connection and rename).
Shift + AHover Auxiliary at the cursor position, populate with left mouse button.
Shift + SHover Stock at the cursor position, populate with left mouse button.
Shift + CHover Cloud at the cursor position, populate with left mouse button.
Shift + VHover Valve at the cursor position, populate with left mouse button.
Shift + IHover Input at the cursor position, populate with left mouse button.
Shift + GHover Shadow (Ghost) variable at the cursor position, populate with left mouse button.
Alt + left mouse buttonStart an arrow from a variable. End to another variable by clicking left mouse button.
Alt + right mouse buttonStart 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.
DeleteRemove selected variables
F2Rename selected variable
Ctrl + left mouse buttonSelect multiple variables
Mouse wheel or + or -Diagram zoom
drag(mouse3)Diagram pan
drag(shift + any mouse button)Diagram pan
↓, ←, ↑, → (arrow keys)Diagram pan
Ctrl + CCopy selected elements
Ctrl + XCut selected elements
Ctrl + VPaste copied or cut elements
Ctrl + FFind element in current diagram or all models
GShow / hide grid
RShow / hide ruler
1Fit diagram contents to screen
Ctrl + SpaceContent assist in equation editor

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.

Common error sources of unit validation include the following. The respective issues are shown in the picture below.

+
+
  • The equation of a variable yields a different unit than that defined for the variable.

  • Two variables which have different units are added (+), subtracted (-), or compared (>, <, =, ...).

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

  • A function is called with an argument of a prohibited unit.

  • A variable has an empty unit.

  • A variable has a misspelled unit.

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.

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.

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

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

    Aux1 + time
+

yields a warning, it can be fixed be changing the expression to

    unitCast(Aux1) + time
+

, in which case the unit of the expression is that of time, or to

    Aux1 + unitCast(time)
+

, in which case the unit of the expression is that of Aux1.

Diagram Profiles

Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used:

Default

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

When enabled, the original and all the shadow variables are highlighted when one is selected.

Simulation Playback

Playback Colors

When enabled, colors of the elements on diagram change during a playback experiment.

Visual model elements

+

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.

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.

Dependency properties

Dependency arrow properties can be changed on the property view:

Polarity

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.

Location

Location of the polarity mark

Arrowhead

Toggle for showing arrowhead

Delay mark

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.

Line thickness

Thickness of the arrow

Loops

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.

Loop Items

The loop of variables which the loop symbol refers can be selected for visualization purposes.

Comment

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.

Direction of Rotation

Direction to which the loop rotates on diagram.

Comments

Comments are just strings of text.

Simulation

+

Experiments

There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics.

Experiments are created from the context menu of experiments folder in a model.

+
+

Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar.

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.

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.

Simulation playback

Simulation playback works essentially as the basic experiment, but it offers some additional visualization options.

Sensitivity analysis simulation

Sensitivity analysis allows running multivariate Monte Carlo simulations with different parameter value sets and to visualize how much the simulation result depends on changes in the selected parameters.

+
+
General-
NameThe name of the sensitivity analysis experiment. Displayed in e.g. model browser.
Number of runsThe total amount of individual simulation runs
MethodThe method of how the parameter values are selected from the distribution(s). Selecting "Random" yields pseudo-random values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a quasi-random Halton sequence of values selected deterministically to represent the distribution(s) better than a pseudo-random series.
SeedThe seed number for pseudo-random generator
Add parameterAdds a new parameter to be varied
RemoveRemoves a parameter
Parameter properties-
VariableThe full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type.
RangeUsed with multidimensional values to select which dimensions are varied.
DistributionProbability distribution for the varied parameter. "Normal" is for truncated normal distribution and "Uniform" for uniform distribution. 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".
Distribution properties-
Min valueMinimum value of the distribution
Max valueMaximum value of the distribution
MeanMean of the normal distribution
Standard deviationStandard deviation of the normal distribution

Solvers

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.

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.

Simulation Result and Model Structure Analysis

+

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 custom charts.

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.

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.

+
+

Values

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.

+
+

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:

+
+

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.

+
+

Dependencies

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.

+
+

Model Hierarchy

Model Hierarchy displays the hierarchical structure of the model. The module type where a selected variable is located is highlighted.

+
+

Loops

Loops display all feedback loops which the selected variable belongs to.

+
+

Custom Charts

+

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.

+
+

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

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.

+
+
+
+
General-
NameThe name of the chart. Displayed in e.g. model browser
TitleThe title of the chart. Displayed in the chart
TypeLine chart (default) or area chart
HideOptions to hide chart grid, title or legend
X-axis-
VariableA variable that is used as the x-axis variable. The default variable is time and it needs not to be typed in the field.
LabelOptional other label for the variable than its name
MinMinimum value of the x-axis
MaxMaximum value of the x-axis
HideOptions to hide x-axis label, line, tick marks and tick labels
+
+
Variable-
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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.
LabelOptional label for the variable. If label is empty, the variable name is displayed.
ColorColor for the lines of this variable
Line widthThe width of the lines drawn for this variable

There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab.

Y-axis-
LabelLabel of the axis
MinMinimum value in the axis
MaxMaximum value in the axis
ColorThe color of the axis lines, ticks and labels
HideOptions to hide parts of the axis: label, axis line, tick marks, tick labels

Sensitivity Chart

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.

+
+
+
+
Axis and Variables-
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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 medianDisplay the median value of the variable at each time step.
Confidence bounds and colorsThe confidence bounds in percents 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.

Y-axis-
LabelLabel of the axis
MinMinimum value in the axis
MaxMaximum value in the axis
ColorThe color of the axis lines, ticks and labels
HideOptions to hide parts of the axis: label, axis line, tick marks, tick labels

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.

+
+
General-
NameThe name of the chart. Name is displayed in model browser.
TitleThe title of the chart. Title is displayed in the chart, if not hidden
TypeNormal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks.
TimeA general time setting for the entire chart. The values at this time are displayed in the chart
HideOption for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed.
+
+

Charts can be added to model diagrams simply by dragging the chart from model browser to diagram.

+
+
Variable-
Add / RemoveAdd or remove variables
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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.
LabelOptional label for the variable. If label is empty, the variable name is displayed
TimeThe time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.
+
+
Domain axis-
LabelAn optional label for x axis
Label angleAxis labels can be displayed in an angle. This value determines the angle in degrees.
ColorThe color of the axis line, tick lines and labels
HideOptions for hiding axis label, line, tick marks and tick labels
Range axis-
LabelAn optional label for y axis
MinMinimum value of y axis
MaxMaximum value of y axis
ColorThe color of the axis line, tick lines and labels
HideOptions for hiding axis label, line, tick marks and tick labels

Pie Chart

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.

+
+
General-
NameThe name of the chart. Displayed in e.g. model browser
TitleTitle The title of the chart. Displayed in the chart
TimeA general time setting for the entire chart. The values at this time are displayed in the chart
HideOptions for hiding title, section labels and legend
+
+
Variables-
Add / RemoveAdd or remove variables
VariableThe full path of the variable. This field has content assistant, which shows the possible variables as you type.
RangeIf 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.
LabelOptional label for the variable. If label is empty, the variable name is displayed
ColorColor for the sector of this variable
TimeThe time for which the value of this variable is displayed. If this is empty, a general (or default) value of the time is used.
ExplodedIf set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart
+
+

Chart Panel

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.

+
+

Chart panel can be either horizontally or vertically oriented. Different orientations help in configuring the workbench perspective.

+
+

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.

By default, chart panel is hidden in the upper-right corner of the system dynamics perspective.

Multidimensional Variables

+

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

1 Create the model structure

Model with multidimensional variables looks just like any other model.

+
+

2 Create Enumerations and define the indexes

Enumerations are created by right-clicking configuration and selecting New->Enumeration.

+
+

Define enumeration indexes by adding as many indexes as you want. Rename the indexes by selecting them and then clicking on them again.

+
+

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.

+
+

4 Define equations for all possible indexes

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

+
+

Expressions

Values for all cells in the variable matrix can be defined in a single expression.

+
+
+
+

In many situations, it is however more clear to define separate expressions for each cell or blocks.

1 Define range for the expression

+
+

2 Define the expression (dimensions of the defined range and the result of the expression must match!)

+
+

3 Create a new expression

+
+

4 Select the new expression

+
+

Repeat until there is value for each cell. There must be exactly one value for each cell.

Array Slices

Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable:

 enumeration E1 = one, two, three
+ enumeration E2 = eins, zwei, drei
+ Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
+

The whole variable can be accessed in three different ways:

  1. Auxiliary

  2. Auxiliary[E1, E2]

  3. Auxiliary[:, :]

The following explains different methods for accessing parts of the variable

 // Single cell
+ Auxiliary[one, eins] = 1
+
 // 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}}
+

The syntax for accessing parts of variables can be used in both expression range definitions and in expressions.

Arithmetic Operators

Arithmetic operations are defined in Modelica. Below are examples of different operations.

Addition and substraction

Addition and substraction are calculated elementwise

 {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
+

Division

Division with a scalar

 {5,10,15} / 5 = {1,2,3}
+ 5 / {5,10,15} = ERROR! not allowed
+

Division with an array

 {1,2,3} / {1,2,3} = ERROR! not allowed
+ 
+ // Elementwise
+ {1,2,3} ./ {1,2,3} = {1,1,1}
+

Multiplication

Multiplication with a scalar

 {1,2,3} * 2 = {2,4,6}
+ 5 * {1,2,3} = {5,10,15}
+

Matrix multiplication with an array

 {{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[2,2] d = {{3,4},{5,6}};
+ Real[2,2] cd;
+ cd = c[2:3, :] .* d; // Result: {{9,16},{25,36}}
+

Power

Elementwise power of array variable

 {1,2} .^ 2 = {1,4}
+

Builtin Modelica Functions

Modelica has some builtin functions that help using multidimensional variables. This chapter introduces some of the builtin functions.

Dimension and size functions

We will use the same example variable as previously.

 enumeration E1 = one, two, three
+ enumeration E2 = eins, zwei, drei
+ 
+ Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
+

ndims(A)

The number of dimensions in array A

 ndims(Auxiliary) = 2
+

size(A, i)

The size of dimension i in array A

 size(Auxiliary, 2) = 3
+

size(A)

A vector of length ndims(A) containing the dimension sizes of A

 size(Auxiliary) = {3,3}
+

Construction functions

In addition to normal array constructing, a special construction functions can be used.

zeros(n1,n2,n3,...)

An array full of zeros with dimensions n1 x n2 x n2 x ...

 zeros(2, 2) = {{0,0}, {0,0}}
+

ones(n1,n2,n3,...)

An array full of ones with dimensions n1 x n2 x n2 x ...

 ones(2, 2) = {{1,1}, {1,1}}
+

fill(s,n1,n2,n3)

Like zeros() and ones(), but with user defined value (s) for array elements.

 fill(3,2,2) = {{3,3}, {3,3}}
+

identity(n)

Creates an n x n integer identity matrix with ones on the diagonal and all other elements zero.

 identity(3) =
+   1 0 0
+   0 1 0
+   0 0 1
+

diagonal(v)

Constructs a square matrix with elements of vector v on the diagonal and all other elements zero.

 diagonal({1,2,3}) =
+   1 0 0
+   0 2 0
+   0 0 3
+

linspace(x1,x2,n)

Constracts a Real vector from x1 to x2 with n equally spaced elements.

 linspace(2,5,4) = {2,3,4,5}
+

Reduction functions

Reduction functions reduce arrays to scalars.

min(A)

Returns the minimum value in array A.

 Real A = {{1,2},{3,4}}
+ min(A) = 1
+

max(A)

Returns the maximum value in array A.

 Real A = {{1,2},{3,4}}
+ max(A) = 4
+

sum(A)

Returns the sum of values in array A.

 Real A = {{1,2},{3,4}}
+ sum(A) = 10    // 1 + 2 + 3 + 4
+

product(A)

Returns the product of values in array A.

 Real A = {{1,2},{3,4}}
+ product(A) = 24   // 1 * 2 * 3 * 4
+

Using functions with iterators

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.

 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})}
+ */
+

One expression can have multiple iterators. The Modelica specification defines the following format, but it is NOT yet supported in OpenModelica:

 {sum(Array[ i, j, E3]) for i in E1, j in E2}  // Dimensions reduced from 3 to 2
+

To use multiple iterators, use the following format (NOTE the reversed order of iterators!):

 {{sum(Array[ i, j, E3]) for j in E2} for i in E1}  // Dimensions reduced from 3 to 2
+

The range doesn't have to be the whole enumeration. Subranges can also be used.

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

+
+

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.

+
+

Array Variables in Modules

+
+

Replaceable enumeration inside a module

+

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

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.

+
+

Module configuration for replacing enumerations inside the module

+

In the parent configuration, we have used an enumeration with three indexes in the two variables.

+
+

Enumeration in the parent configuration that will replace the enumeration in the module

+

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.

+
+

Enumeration in the parent configuration that will replace the enumeration in the module

+

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!

Functions

+

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

+
+

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.

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.

Below is an example of a simple function. For more examples, see the built-in functions provided with the tool and Modelica specifications.

+
+

Function Libraries

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

+
+

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.

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.

Below is a simple example of using a function that returns the sum of two arguments.

 double exampleCFunction(double x, double y)
+ {
+   double res;
+   res = x + y;
+   return res;
+ }
+
+
+

You need to create an Object file (.o) of your code, import it to a function and define the function to use the library and function that you created. If you don’t have a C-compiler, you can use the one provided by the Simantics installation (e.g. simantics_home/plugins/org.simantics.openmodelica.win32_x/MinGW/bin/mingw32_gcc.exe -g -O -c ExampleCFunctionCode.c).

+
+

You can use the external function like any other function in your variables. Using equation ExampleExternalFunction(Stock1, 10) in an auxiliary variable (Auxiliary2) gives the following result.

+
+

In addition to .o -files, you can import .c and .h files. By including these to the function, the source code can be reviewed and later by you or others that use the function.

Small external C function can also be written directly to the function code in Simantics Sysdyn:

 function ExampleExternalFunction
+ input Real x;
+ input Real y;
+ output Real z;
+ external "C" z=exampleCFunction(x,y) annotation(Include="
+ double exampleCFunction(double x, double y)
+ {
+   double res;
+   res = x + y;
+   return res;
+ }");
+ end ExampleExternalFunction;
+

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.

FunctionDescription
abs(x)Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)".
acos(x)Inverse cosine.
asin(x)Inverse sine.
atan(x)Inverse tangent.
atan2(x1,x2)four quadrant inverse tangent.
cat(n,A,B,...)General concatenation function that concatenates arrays A,B,... along the nth dimension.
ceil(x)Returns the smallest integer not less than x, the closest integer above x.
cos(x)Cosine.
cosh(x)Hyperbolic cosine.
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)).
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.
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.
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)".
sin(x)Sine.
sinh(x)Hyperbolic sine.
sqrt(x)Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs.
tan(x)Tangent.
tanh(x)Hyperbolic tangent.
terminal()Returns true at the end of a successful simulation.

Spreadsheets

+

Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality.

Variable Values

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.

+
+
+

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.

+
+

Reference to a sheet range creates an array variable.

+
+

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

+
+

History Data

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.

+
+

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 properties-
NameName of the history dataset
SheetCombo box for selecting a sheet where the history data is located
OrientationColumns or rows. How the data is arranged in the sheet.
Range startThe upper-left corner cell of the history data range
Range endThe lower-right corner cell of the history data range
Time variableThe name of the time variable in the history data, if it is different than "time"
Variables in rangeThis text field displays the found variables in the given sheet and range

If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart.

+
+

Vensim Model Import

+

The tool also has a limited support for importing system dynamics models created with the simulation and modelling tool Vensim. 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:

  • The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported.

  • Only variables and connections are imported.

  • Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported.

  • Variable value range data is not always imported correctly.

  • Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent.

  • Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant).

  • Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine.

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

Sample Models and Molecules

+

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 | System Dynamics Modelling

+

Tutorial: Basic System Dynamics Modelling

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.

Tutorial: Advanced System Dynamics Modelling

This tutorial introduces the more advanced features of the system dynamics modelling tool: Modules and Operating interfaces

\ No newline at end of file diff --git a/bundles/org.simantics.sysdyn.wiki/commonltr.css b/bundles/org.simantics.sysdyn.wiki/commonltr.css new file mode 100644 index 00000000..7dbcedbe --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/commonltr.css @@ -0,0 +1,622 @@ +/*! + * This file is part of the DITA Open Toolkit project. + * + * Copyright 2004, 2005 IBM Corporation + * + * See the accompanying LICENSE file for applicable license. + */ +.codeblock { + font-family: monospace; +} + +.codeph { + font-family: monospace; +} + +.kwd { + font-weight: bold; +} + +.parmname { + font-weight: bold; +} + +.var { + font-style: italic; +} + +.filepath { + font-family: monospace; +} + +div.tasklabel { + margin-top: 1em; + margin-bottom: 1em; +} + +h2.tasklabel, +h3.tasklabel, +h4.tasklabel, +h5.tasklabel, +h6.tasklabel { + font-size: 100%; +} + +.screen { + padding: 5px 5px 5px 5px; + border: outset; + background-color: #CCCCCC; + margin-top: 2px; + margin-bottom: 2px; + white-space: pre; +} + +.wintitle { + font-weight: bold; +} + +.numcharref { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.parameterentity { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.textentity { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlatt { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlelement { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlnsname { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlpi { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.frame-top { + border-top: solid 1px; + border-right: 0; + border-bottom: 0; + border-left: 0; +} + +.frame-bottom { + border-top: 0; + border-right: 0; + border-bottom: solid 1px; + border-left: 0; +} + +.frame-topbot { + border-top: solid 1px; + border-right: 0; + border-bottom: solid 1px; + border-left: 0; +} + +.frame-all { + border: solid 1px; +} + +.frame-sides { + border-top: 0; + border-left: solid 1px; + border-right: solid 1px; + border-bottom: 0; +} + +.frame-none { + border: 0; +} + +.scale-50 { + font-size: 50%; +} + +.scale-60 { + font-size: 60%; +} + +.scale-70 { + font-size: 70%; +} + +.scale-80 { + font-size: 80%; +} + +.scale-90 { + font-size: 90%; +} + +.scale-100 { + font-size: 100%; +} + +.scale-110 { + font-size: 110%; +} + +.scale-120 { + font-size: 120%; +} + +.scale-140 { + font-size: 140%; +} + +.scale-160 { + font-size: 160%; +} + +.scale-180 { + font-size: 180%; +} + +.scale-200 { + font-size: 200%; +} + +.expanse-page, .expanse-spread { + width: 100%; +} + +.fig { + /* Default of italics to set apart figure captions */ + /* Use @frame to create frames on figures */ +} + +.figcap { + font-style: italic; +} + +.figdesc { + font-style: normal; +} + +.figborder { + border-color: Silver; + border-style: solid; + border-width: 2px; + margin-top: 1em; + padding-left: 3px; + padding-right: 3px; +} + +.figsides { + border-color: Silver; + border-left: 2px solid; + border-right: 2px solid; + margin-top: 1em; + padding-left: 3px; + padding-right: 3px; +} + +.figtop { + border-color: Silver; + border-top: 2px solid; + margin-top: 1em; +} + +.figbottom { + border-bottom: 2px solid; + border-color: Silver; +} + +.figtopbot { + border-bottom: 2px solid; + border-color: Silver; + border-top: 2px solid; + margin-top: 1em; +} + +/* Align images based on @align on topic/image */ +div.imageleft { + text-align: left; +} + +div.imagecenter { + text-align: center; +} + +div.imageright { + text-align: right; +} + +div.imagejustify { + text-align: justify; +} + +/* Set heading sizes, getting smaller for deeper nesting */ +.topictitle1 { + font-size: 1.34em; + margin-bottom: 0.1em; + margin-top: 0; +} + +.topictitle2 { + font-size: 1.17em; + margin-bottom: 0.45em; + margin-top: 1pc; +} + +.topictitle3 { + font-size: 1.17em; + font-weight: bold; + margin-bottom: 0.17em; + margin-top: 1pc; +} + +.topictitle4 { + font-size: 1.17em; + font-weight: bold; + margin-top: 0.83em; +} + +.topictitle5 { + font-size: 1.17em; + font-weight: bold; +} + +.topictitle6 { + font-size: 1.17em; + font-style: italic; +} + +.sectiontitle { + color: #000; + font-size: 1.17em; + font-weight: bold; + margin-bottom: 0; + margin-top: 1em; +} + +.section { + margin-bottom: 1em; + margin-top: 1em; +} + +.example { + margin-bottom: 1em; + margin-top: 1em; +} + +/* Most link groups are created with
. Ensure they have space before and after. */ +.ullinks { + list-style-type: none; +} + +.ulchildlink { + margin-bottom: 1em; + margin-top: 1em; +} + +.olchildlink { + margin-bottom: 1em; + margin-top: 1em; +} + +.linklist { + margin-bottom: 1em; +} + +ul.linklist { + margin-top: 0; + list-style-type: none; + padding-left: 0; +} + +li.linklist { + margin-top: 0; + margin-bottom: 0; +} + +.linklistwithchild { + margin-bottom: 1em; + margin-left: 1.5em; +} + +.sublinklist { + margin-bottom: 1em; + margin-left: 1.5em; +} + +.relconcepts { + margin-bottom: 1em; + margin-top: 1em; +} + +.reltasks { + margin-bottom: 1em; + margin-top: 1em; +} + +.relref { + margin-bottom: 1em; + margin-top: 1em; +} + +.relinfo { + margin-bottom: 1em; + margin-top: 1em; +} + +.breadcrumb { + font-size: smaller; + margin-bottom: 1em; +} + +/* Simple lists do not get a bullet */ +ul.simple { + list-style-type: none; +} + +/* Default of bold for definition list terms */ +.dlterm { + font-weight: bold; +} + +/* Use CSS to expand lists with @compact="no" */ +.dltermexpand { + font-weight: bold; + margin-top: 1em; +} + +*[compact="yes"] > li { + margin-top: 0; +} + +*[compact="no"] > li { + margin-top: 0.53em; +} + +.liexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.sliexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.dlexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.ddexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.stepexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.substepexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +dt.prereq { + margin-left: 20px; +} + +/* All note formats have the same default presentation */ +.note { + margin-bottom: 1em; + margin-top: 1em; +} + +.note .notetitle, .note .notelisttitle, +.note .note__title { + font-weight: bold; +} + +/* Various basic phrase styles */ +.bold { + font-weight: bold; +} + +.bolditalic { + font-style: italic; + font-weight: bold; +} + +.italic { + font-style: italic; +} + +.underlined { + text-decoration: underline; +} + +.uicontrol { + font-weight: bold; +} + +.defkwd { + font-weight: bold; + text-decoration: underline; +} + +.shortcut { + text-decoration: underline; +} + +.menucascade > abbr { + text-decoration: none; +} + +table { + border-collapse: collapse; +} + +table .desc { + display: block; + font-style: italic; +} + +.cellrowborder { + border-bottom: solid 1px; + border-left: 0; + border-right: solid 1px; + border-top: 0; +} + +.row-nocellborder { + border-bottom: solid 1px; + border-left: 0; + border-top: 0; +} + +.cell-norowborder { + border-left: 0; + border-right: solid 1px; + border-top: 0; +} + +.nocellnorowborder { + border: 0; +} + +.firstcol { + font-weight: bold; +} + +.table--pgwide-1 { + width: 100%; +} + +.align-left { + text-align: left; +} + +.align-right { + text-align: right; +} + +.align-center { + text-align: center; +} + +.align-justify { + text-align: justify; +} + +.align-char { + text-align: char; +} + +.valign-top { + vertical-align: top; +} + +.valign-bottom { + vertical-align: bottom; +} + +.valign-middle { + vertical-align: middle; +} + +.colsep-0 { + border-right: 0; +} + +.colsep-1 { + border-right: 1px solid; +} + +.rowsep-0 { + border-bottom: 0; +} + +.rowsep-1 { + border-bottom: 1px solid; +} + +.stentry { + border-right: 1px solid; + border-bottom: 1px solid; +} + +.stentry:last-child { + border-right: 0; +} + +.strow:last-child .stentry { + border-bottom: 0; +} + +/* Add space for top level topics */ +.nested0 { + margin-top: 1em; +} + +/* div with class=p is used for paragraphs that contain blocks, to keep the XHTML valid */ +.p { + margin-top: 1em; +} + +/*! + * Custom CSS declarations, to be appended to the end of existing declarations + */ + +.imageText { + padding: 1px; + border: 1px solid; + text-align: center; + border-color: #c8ccd1; +} + +.imageBorder { + padding: 4px; + border: 1px solid; + border-color: #c8ccd1; + display: table; + background-color: #f8f9fa; +} + + .box { + display: flex; + align-items:left; +} + +center { + margin: auto; + width: 50%; +} + +.hr{ + border-top: 1px solid black; +} + + pre { + color: #000000; + display: block; + white-space: pre-wrap; + margin: 1em 0; + background-color: #f8f9fa; + border: 1px solid #eaecf0; + padding: 0; +} diff --git a/bundles/org.simantics.sysdyn.wiki/commonrtl.css b/bundles/org.simantics.sysdyn.wiki/commonrtl.css new file mode 100644 index 00000000..e18e2c02 --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/commonrtl.css @@ -0,0 +1,672 @@ +/*! + * This file is part of the DITA Open Toolkit project. + * + * Copyright 2015 Jarno Elovirta + * + * See the accompanying LICENSE file for applicable license. + */ +/*! + * This file is part of the DITA Open Toolkit project. + * + * Copyright 2004, 2005 IBM Corporation + * + * See the accompanying LICENSE file for applicable license. + */ +.codeblock { + font-family: monospace; +} + +.codeph { + font-family: monospace; +} + +.kwd { + font-weight: bold; +} + +.parmname { + font-weight: bold; +} + +.var { + font-style: italic; +} + +.filepath { + font-family: monospace; +} + +div.tasklabel { + margin-top: 1em; + margin-bottom: 1em; +} + +h2.tasklabel, +h3.tasklabel, +h4.tasklabel, +h5.tasklabel, +h6.tasklabel { + font-size: 100%; +} + +.screen { + padding: 5px 5px 5px 5px; + border: outset; + background-color: #CCCCCC; + margin-top: 2px; + margin-bottom: 2px; + white-space: pre; +} + +.wintitle { + font-weight: bold; +} + +.numcharref { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.parameterentity { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.textentity { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlatt { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlelement { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlnsname { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.xmlpi { + color: #663399; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +.frame-top { + border-top: solid 1px; + border-right: 0; + border-bottom: 0; + border-left: 0; +} + +.frame-bottom { + border-top: 0; + border-right: 0; + border-bottom: solid 1px; + border-left: 0; +} + +.frame-topbot { + border-top: solid 1px; + border-right: 0; + border-bottom: solid 1px; + border-left: 0; +} + +.frame-all { + border: solid 1px; +} + +.frame-sides { + border-top: 0; + border-left: solid 1px; + border-right: solid 1px; + border-bottom: 0; +} + +.frame-none { + border: 0; +} + +.scale-50 { + font-size: 50%; +} + +.scale-60 { + font-size: 60%; +} + +.scale-70 { + font-size: 70%; +} + +.scale-80 { + font-size: 80%; +} + +.scale-90 { + font-size: 90%; +} + +.scale-100 { + font-size: 100%; +} + +.scale-110 { + font-size: 110%; +} + +.scale-120 { + font-size: 120%; +} + +.scale-140 { + font-size: 140%; +} + +.scale-160 { + font-size: 160%; +} + +.scale-180 { + font-size: 180%; +} + +.scale-200 { + font-size: 200%; +} + +.expanse-page, .expanse-spread { + width: 100%; +} + +.fig { + /* Default of italics to set apart figure captions */ + /* Use @frame to create frames on figures */ +} + +.figcap { + font-style: italic; +} + +.figdesc { + font-style: normal; +} + +.figborder { + border-color: Silver; + border-style: solid; + border-width: 2px; + margin-top: 1em; + padding-left: 3px; + padding-right: 3px; +} + +.figsides { + border-color: Silver; + border-left: 2px solid; + border-right: 2px solid; + margin-top: 1em; + padding-left: 3px; + padding-right: 3px; +} + +.figtop { + border-color: Silver; + border-top: 2px solid; + margin-top: 1em; +} + +.figbottom { + border-bottom: 2px solid; + border-color: Silver; +} + +.figtopbot { + border-bottom: 2px solid; + border-color: Silver; + border-top: 2px solid; + margin-top: 1em; +} + +/* Align images based on @align on topic/image */ +div.imageleft { + text-align: left; +} + +div.imagecenter { + text-align: center; +} + +div.imageright { + text-align: right; +} + +div.imagejustify { + text-align: justify; +} + +/* Set heading sizes, getting smaller for deeper nesting */ +.topictitle1 { + font-size: 1.34em; + margin-bottom: 0.1em; + margin-top: 0; +} + +.topictitle2 { + font-size: 1.17em; + margin-bottom: 0.45em; + margin-top: 1pc; +} + +.topictitle3 { + font-size: 1.17em; + font-weight: bold; + margin-bottom: 0.17em; + margin-top: 1pc; +} + +.topictitle4 { + font-size: 1.17em; + font-weight: bold; + margin-top: 0.83em; +} + +.topictitle5 { + font-size: 1.17em; + font-weight: bold; +} + +.topictitle6 { + font-size: 1.17em; + font-style: italic; +} + +.sectiontitle { + color: #000; + font-size: 1.17em; + font-weight: bold; + margin-bottom: 0; + margin-top: 1em; +} + +.section { + margin-bottom: 1em; + margin-top: 1em; +} + +.example { + margin-bottom: 1em; + margin-top: 1em; +} + +/* Most link groups are created with
. Ensure they have space before and after. */ +.ullinks { + list-style-type: none; +} + +.ulchildlink { + margin-bottom: 1em; + margin-top: 1em; +} + +.olchildlink { + margin-bottom: 1em; + margin-top: 1em; +} + +.linklist { + margin-bottom: 1em; +} + +ul.linklist { + margin-top: 0; + list-style-type: none; + padding-left: 0; +} + +li.linklist { + margin-top: 0; + margin-bottom: 0; +} + +.linklistwithchild { + margin-bottom: 1em; + margin-left: 1.5em; +} + +.sublinklist { + margin-bottom: 1em; + margin-left: 1.5em; +} + +.relconcepts { + margin-bottom: 1em; + margin-top: 1em; +} + +.reltasks { + margin-bottom: 1em; + margin-top: 1em; +} + +.relref { + margin-bottom: 1em; + margin-top: 1em; +} + +.relinfo { + margin-bottom: 1em; + margin-top: 1em; +} + +.breadcrumb { + font-size: smaller; + margin-bottom: 1em; +} + +/* Simple lists do not get a bullet */ +ul.simple { + list-style-type: none; +} + +/* Default of bold for definition list terms */ +.dlterm { + font-weight: bold; +} + +/* Use CSS to expand lists with @compact="no" */ +.dltermexpand { + font-weight: bold; + margin-top: 1em; +} + +*[compact="yes"] > li { + margin-top: 0; +} + +*[compact="no"] > li { + margin-top: 0.53em; +} + +.liexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.sliexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.dlexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.ddexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.stepexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +.substepexpand { + margin-bottom: 1em; + margin-top: 1em; +} + +dt.prereq { + margin-left: 20px; +} + +/* All note formats have the same default presentation */ +.note { + margin-bottom: 1em; + margin-top: 1em; +} + +.note .notetitle, .note .notelisttitle, +.note .note__title { + font-weight: bold; +} + +/* Various basic phrase styles */ +.bold { + font-weight: bold; +} + +.bolditalic { + font-style: italic; + font-weight: bold; +} + +.italic { + font-style: italic; +} + +.underlined { + text-decoration: underline; +} + +.uicontrol { + font-weight: bold; +} + +.defkwd { + font-weight: bold; + text-decoration: underline; +} + +.shortcut { + text-decoration: underline; +} + +.menucascade > abbr { + text-decoration: none; +} + +table { + border-collapse: collapse; +} + +table .desc { + display: block; + font-style: italic; +} + +.cellrowborder { + border-bottom: solid 1px; + border-left: 0; + border-right: solid 1px; + border-top: 0; +} + +.row-nocellborder { + border-bottom: solid 1px; + border-left: 0; + border-top: 0; +} + +.cell-norowborder { + border-left: 0; + border-right: solid 1px; + border-top: 0; +} + +.nocellnorowborder { + border: 0; +} + +.firstcol { + font-weight: bold; +} + +.table--pgwide-1 { + width: 100%; +} + +.align-left { + text-align: left; +} + +.align-right { + text-align: right; +} + +.align-center { + text-align: center; +} + +.align-justify { + text-align: justify; +} + +.align-char { + text-align: char; +} + +.valign-top { + vertical-align: top; +} + +.valign-bottom { + vertical-align: bottom; +} + +.valign-middle { + vertical-align: middle; +} + +.colsep-0 { + border-right: 0; +} + +.colsep-1 { + border-right: 1px solid; +} + +.rowsep-0 { + border-bottom: 0; +} + +.rowsep-1 { + border-bottom: 1px solid; +} + +.stentry { + border-right: 1px solid; + border-bottom: 1px solid; +} + +.stentry:last-child { + border-right: 0; +} + +.strow:last-child .stentry { + border-bottom: 0; +} + +/* Add space for top level topics */ +.nested0 { + margin-top: 1em; +} + +/* div with class=p is used for paragraphs that contain blocks, to keep the XHTML valid */ +.p { + margin-top: 1em; +} + +.linklist { + margin-bottom: 1em; +} + +ul.linklist { + margin-top: 0; + list-style-type: none; + padding-right: 0; +} + +.linklistwithchild { + margin-right: 1.5em; + margin-top: 1em; +} + +.sublinklist { + margin-right: 1.5em; + margin-top: 1em; +} + +dt.prereq { + margin-right: 20px; +} + +.cellrowborder { + border-left: solid 1px; + border-right: none; +} + +.row-nocellborder { + border-left: hidden; + border-right: none; +} + +.cell-norowborder { + border-left: solid 1px; + border-right: none; +} + +.nocellnorowborder { + border-left: hidden; +} + +/*! + * Custom CSS declarations, to be appended to the end of existing declarations + */ + +.imageText { + padding: 1px; + border: 1px solid; + text-align: center; + border-color: #c8ccd1; +} + +.imageBorder { + padding: 4px; + border: 1px solid; + border-color: #c8ccd1; + display: table; + background-color: #f8f9fa; +} + + .box { + display: flex; + align-items:left; +} + +center { + margin: auto; + width: 50%; +} + +.hr{ + border-top: 1px solid black; +} + + pre { + color: #000000; + display: block; + white-space: pre-wrap; + margin: 1em 0; + background-color: #f8f9fa; + border: 1px solid #eaecf0; + padding: 0; +} diff --git a/bundles/org.simantics.sysdyn.wiki/index.html b/bundles/org.simantics.sysdyn.wiki/index.html new file mode 100644 index 00000000..f091448b --- /dev/null +++ b/bundles/org.simantics.sysdyn.wiki/index.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + Simantics System Dynamics + + +

Simantics System Dynamics

+ + + \ No newline at end of file diff --git a/bundles/pom.xml b/bundles/pom.xml index 9f7e7bb2..bac09847 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -54,5 +54,6 @@ org.simantics.sysdyn.product org.simantics.sysdyn.ui org.simantics.sysdyn.xmile + org.simantics.sysdyn.help diff --git a/dita-docs/README.md b/dita-docs/README.md new file mode 100644 index 00000000..35f6f9f1 --- /dev/null +++ b/dita-docs/README.md @@ -0,0 +1,11 @@ +# Building dita docs from source markdown + +1. Download and install dita-ot: https://www.dita-ot.org/3.1/topics/installing-client.html +2. Add dita to your PATH +3. Edit the custom.css file +4. Run the .bat file or .sh file +5. To run with debug mode enabled, pass a single arg to the .bat or .sh: "-d" (without quotation marks) + +Note: + +When building, make sure to update build.properties if required. \ No newline at end of file diff --git a/dita-docs/SYSDYN.ditamap b/dita-docs/SYSDYN.ditamap new file mode 100644 index 00000000..df2de59c --- /dev/null +++ b/dita-docs/SYSDYN.ditamap @@ -0,0 +1,6 @@ + + + + Simantics System Dynamics + + diff --git a/dita-docs/Site/AdvancedTutorial.md b/dita-docs/Site/AdvancedTutorial.md new file mode 100644 index 00000000..69159f04 --- /dev/null +++ b/dita-docs/Site/AdvancedTutorial.md @@ -0,0 +1,346 @@ +# Tutorial: Advanced System Dynamics Modelling +
+ +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). + +## Creating model and modules +
+ +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. + +
+ +

Creating a new model

+
+
+ +

Creating a new module

+
+
+ +

Model after renaming

+
+ +## Initial configuration +
+ +
+ +

Workforce and Work modules

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

Workforce and Work modules, first inputs and connections

+
+ +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. + + +## Workforce module +
+ +
+ +

Cloud, Valve, Flow and Stock

+
+ +Open Workforce module by selecting it from the diagram, right-clicking it and selecting Show Module. + +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. + +
+ +

Cloud, Valve, Flow and Stock. Flow works both on directions.

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

Auxiliaries in Workforce module

+
+ +Now you have used all the basic components and connections. From now on the instructions will be a more simplified. + +Next we will create four Auxiliary variables: TimeToAllocateResources, WorkforceRequired, Productivity and PossibleWorkingSpeed. Place and connect them according to the picture on the right. + +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. + +
+WorkforceStock 
+Initial value: 0
+
+NetResourcing 
+= (WorkforceRequired - WorkforceStock)/TimeToAllocateResources
+
+TimeToAllocateResources 
+= 2
+
+Productivity 
+= 1
+
+PossibleWorkingSpeed 
+= WorkforceStock * Productivity
+Is Output
+
+ +Variables can be set as output by selecting Is Output option from the Equation tab. + +
+ +

RequiredWorkingSpeedInput

+
+ +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. + +
+WorkForceRequired 
+= RequiredWorkingSpeedInput/Productivity
+
+ +Now this module is ready to be used as a part of the model. + +## Work module +
+ +
+ +

Basic work with errors

+
+ +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. + +Create the basic flow of work with stocks and flows like in the picture on the right. + +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. + +
+ +

Smoothener for work is done

+
+ +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: + +
+ProjectIsReady 
+Initial value: 0
+
+ProjectReadyness 
+= (xidz(WorkDone, ProjectWorkAmount, 0.0) - ProjectIsReady) / 0.08
+
+ +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''. + +
+ +

ProjectWorkAmount input variable

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

Variables needed for error handling

+
+ +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. + +
+ErrorsGenerated
+= (1-WorkQuality) * WorkingSpeed
+
+ErrorsFoundRate
+= Errors/ErrorsFoundTime
+
+WorkQuality
+= 0.9
+
+ErrorsFoundTime
+Type: WithLookup
+With Lookup: xidz(WorkDone, ProjectWorkAmount, 0.0) 
+Lookup table: {{0,5},{0.5,3},{1,0.5},{2,0.5}}
+
+ +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. + +
+ +

WorkAllocation and RequiredWorkingSpeed

+
+ +To calculate our own need for workforce we need to create and connect WorkCompletionTime input variable and the following auxliary variables: + +
+RequiredWorkingSpeed 
+= if ProjectIsReady < 1 then xidz(WorkToDo, TimeToDeadline, MaximumWorkingSpeed) else 0
+Is Output
+
+MaximumWorkingSpeed 
+= 500
+
+TimeToDeadline 
+= max(0, WorkCompletionTime-time)
+
+ +time is a universal variable that gives the current simulation time. + +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. + +Create two Inputs, RequiredWorkingSpeedTotalInput and PossibleWorkingSpeedInput, and an auxiliary variable WorkAllocation. Connect the variables like int the picture. + +
+WorkAllocation
+= xidz(RequiredWorkingSpeed, RequiredWorkingSpeedTotalInput, 0.0) * PossibleWorkingSpeedInput
+
+ +Finally let's give initial values for all the remaining variables: + +
+WorkingSpeed 
+= if ProjectIsReady < 1 then WorkAllocation else 0
+
+WorkToDo 
+Initial value: ProjectWorkAmount
+
+WorkDone 
+Initial value: 0
+
+Errors 
+Initial value: 0
+
+ +## Connecting modules +
+ +Our modules are complete. Let's get back to the WorkModel Configuration. + +
+Set Work1CompletionTime to 10.
+
+ +
+ +

Module input connections

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

Module input connections

+
+ +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 +
+ +To make the simulation time longer, select Configuration on the model browser. Give the model Stop time 24.0 + +
+ +

Experiment activation

+
+ +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:
+ +
+ +System shows the simulation progress in the progress bar on the lower right corner of the screen. + +
+ +
+ +When the progress indicator disappears, the simulation is complete. + +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. + +
+ +
+ +## Adding modules +
+ +
+ +

Final configuration with two modules

+
+ +We created the WorkModule to be reusable. To use two WorkModules in the model, you must do the following. + +Populate a second WorkModule to WorkModel configuration and name it Work2. + +Create RequiredWorkingSpeed2 input variable and Work2CompletionTime auxiliary variable. + +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. + +You can also have a different size work. To make Work2 smaller, create an auxiliary variable Work2Amount. + +Use the following equations: + +
+Work2CompletionTime
+= 13
+
+Work2Amount
+= 800
+
+RequiredWorkingSpeedTotal
+= RequiredWorkingSpeed1 + RequiredWorkingSpeed2
+
+ +Update connections to match connections shown in the picture and connect the inputs and outputs to the modules. + +
+Workforce
+RequiredWorkingSpeedInput -> RequiredWorkingSpeedTotal
+
+Work1 Inputs
+RequiredWorkingSpeedTotalInput -> RequiredWorkingSpeedTotal
+
+Work2 Outputs
+RequiredWorkingSpeed -> RequiredWorkingSpeed2
+
+Work2 Inputs
+
+ +
+ +
+ +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. + +
+ +
diff --git a/dita-docs/Site/AdvancedTutorialImages/ActivateExperiment.png b/dita-docs/Site/AdvancedTutorialImages/ActivateExperiment.png new file mode 100644 index 00000000..8843321e Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ActivateExperiment.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ConfigurationStart.png b/dita-docs/Site/AdvancedTutorialImages/ConfigurationStart.png new file mode 100644 index 00000000..185d9e27 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ConfigurationStart.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ErrorsVariables.png b/dita-docs/Site/AdvancedTutorialImages/ErrorsVariables.png new file mode 100644 index 00000000..4b946edb Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ErrorsVariables.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ExperimentPlay.png b/dita-docs/Site/AdvancedTutorialImages/ExperimentPlay.png new file mode 100644 index 00000000..fc50f88a Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ExperimentPlay.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/FirstSimulation.png b/dita-docs/Site/AdvancedTutorialImages/FirstSimulation.png new file mode 100644 index 00000000..e1087cb1 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/FirstSimulation.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ModelStructure2.png b/dita-docs/Site/AdvancedTutorialImages/ModelStructure2.png new file mode 100644 index 00000000..fcb32883 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ModelStructure2.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/Module2Inputs.png b/dita-docs/Site/AdvancedTutorialImages/Module2Inputs.png new file mode 100644 index 00000000..e8997001 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/Module2Inputs.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ModuleConnections1.png b/dita-docs/Site/AdvancedTutorialImages/ModuleConnections1.png new file mode 100644 index 00000000..34122819 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ModuleConnections1.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ModuleConnections2.png b/dita-docs/Site/AdvancedTutorialImages/ModuleConnections2.png new file mode 100644 index 00000000..83a9875a Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ModuleConnections2.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ModulesFinal.png b/dita-docs/Site/AdvancedTutorialImages/ModulesFinal.png new file mode 100644 index 00000000..8332359d Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ModulesFinal.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/NetResourcing1.png b/dita-docs/Site/AdvancedTutorialImages/NetResourcing1.png new file mode 100644 index 00000000..b47e9474 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/NetResourcing1.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/NetResourcing2.png b/dita-docs/Site/AdvancedTutorialImages/NetResourcing2.png new file mode 100644 index 00000000..71db6659 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/NetResourcing2.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/NewModel.png b/dita-docs/Site/AdvancedTutorialImages/NewModel.png new file mode 100644 index 00000000..609a635c Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/NewModel.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/NewModule.png b/dita-docs/Site/AdvancedTutorialImages/NewModule.png new file mode 100644 index 00000000..1e28ea43 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/NewModule.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ProjectIsReady.png b/dita-docs/Site/AdvancedTutorialImages/ProjectIsReady.png new file mode 100644 index 00000000..bcc555ed Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ProjectIsReady.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/ProjectWorkAmount.png b/dita-docs/Site/AdvancedTutorialImages/ProjectWorkAmount.png new file mode 100644 index 00000000..fc64109e Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/ProjectWorkAmount.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png b/dita-docs/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png new file mode 100644 index 00000000..25a15725 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/RequiredWorkingSpeedInput.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/SecondSimulation.png b/dita-docs/Site/AdvancedTutorialImages/SecondSimulation.png new file mode 100644 index 00000000..dc3bca8c Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/SecondSimulation.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/SimulationProgress.png b/dita-docs/Site/AdvancedTutorialImages/SimulationProgress.png new file mode 100644 index 00000000..e145fcc1 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/SimulationProgress.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/TwoModules.png b/dita-docs/Site/AdvancedTutorialImages/TwoModules.png new file mode 100644 index 00000000..16fdd64b Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/TwoModules.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/WorkAllocation.png b/dita-docs/Site/AdvancedTutorialImages/WorkAllocation.png new file mode 100644 index 00000000..40945fdf Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/WorkAllocation.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/WorkStocks.png b/dita-docs/Site/AdvancedTutorialImages/WorkStocks.png new file mode 100644 index 00000000..7c787f9a Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/WorkStocks.png differ diff --git a/dita-docs/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png b/dita-docs/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png new file mode 100644 index 00000000..2044acb1 Binary files /dev/null and b/dita-docs/Site/AdvancedTutorialImages/WorkforceAuxiliaries.png differ diff --git a/dita-docs/Site/BasicTutorial.md b/dita-docs/Site/BasicTutorial.md new file mode 100644 index 00000000..279e4430 --- /dev/null +++ b/dita-docs/Site/BasicTutorial.md @@ -0,0 +1,159 @@ +# Tutorial: Basic System Dynamics Modelling +
+ +* [1 Model](#model) +* [2 Configuring the model structure](#configuring-the-model-structure) +* [3 Equations](#equations) +* [4 Simulating the model](#simulating-the-model) + +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 +
+ +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. + +
+ +

Creating a new model

+
+ +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. + +## Configuring the model structure +
+ +Our model is now empty. Let's build a population model for 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. + +
+ +

Symbols view

+
+ +These are the basic symbols in System dynamics modelling. We will use these 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) + +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. + +
+ +

Stock variable Mice

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

Flows in and out of Mice

+
+ +Of course mice are not alone in the world. There are also owls that hunt mice. Create a similar structure below mice for owls. + +
+ +

Owls and mice

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

Auxiliaries for valves

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

Dependency connections

+
+ +## Equations +
+ +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: + +
+MouseBirths
+= MouseBirthRate * Mice
+
+MouseDeaths
+= Mice * MouseDeathsDueToOwls * Owls
+
+OwlBirths
+= OwlsFromMice * MouseDeaths
+
+OwlDeaths
+= OwlDeathRate * Owls
+
+MouseBirthRate
+= 0.04
+
+MouseDeathsDueToOwls
+= 0.0005
+
+OwlsFromMice
+= 0.1
+
+OwlDeathRate
+= 0.09
+
+ +Finally we need initial values for our populations. + +
+Mice
+Initial Value: 700
+
+Owls
+Initial Value: 10
+
+ +## Simulating the model +
+ +
+ +

Experiment activation

+
+ +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:
+ +
+ +System shows the simulation progress in the progress bar on the lower right corner of the screen. + +
+ +
+ +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. + +
+ +

Results for Mice and Owls

+
+ +As you can see, the simulation is complete, but the results do not reveal any interesting behavior. Let's extend the simulation time. + +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. + +
+ +

Results for Mice and Owls, Extended simulation time

+
+ +Now the simulation reveals the traditional behavior of predator-prey models. Feel free to adjust the parameters and try the simulations again. diff --git a/dita-docs/Site/BasicTutorialImages/ActivatePopulationExperiment.png b/dita-docs/Site/BasicTutorialImages/ActivatePopulationExperiment.png new file mode 100644 index 00000000..0eeeb7e6 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/ActivatePopulationExperiment.png differ diff --git a/dita-docs/Site/BasicTutorialImages/Auxiliaries.png b/dita-docs/Site/BasicTutorialImages/Auxiliaries.png new file mode 100644 index 00000000..5cec62b8 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/Auxiliaries.png differ diff --git a/dita-docs/Site/BasicTutorialImages/Dependency_connections.png b/dita-docs/Site/BasicTutorialImages/Dependency_connections.png new file mode 100644 index 00000000..eeb22288 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/Dependency_connections.png differ diff --git a/dita-docs/Site/BasicTutorialImages/ExperimentPlay.png b/dita-docs/Site/BasicTutorialImages/ExperimentPlay.png new file mode 100644 index 00000000..fc50f88a Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/ExperimentPlay.png differ diff --git a/dita-docs/Site/BasicTutorialImages/Mice.png b/dita-docs/Site/BasicTutorialImages/Mice.png new file mode 100644 index 00000000..601f77ee Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/Mice.png differ diff --git a/dita-docs/Site/BasicTutorialImages/MiceAndOwlResults1.png b/dita-docs/Site/BasicTutorialImages/MiceAndOwlResults1.png new file mode 100644 index 00000000..bee8c180 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/MiceAndOwlResults1.png differ diff --git a/dita-docs/Site/BasicTutorialImages/MiceAndOwlResults2.png b/dita-docs/Site/BasicTutorialImages/MiceAndOwlResults2.png new file mode 100644 index 00000000..cd8426fd Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/MiceAndOwlResults2.png differ diff --git a/dita-docs/Site/BasicTutorialImages/MiceAndOwls.png b/dita-docs/Site/BasicTutorialImages/MiceAndOwls.png new file mode 100644 index 00000000..83b4b085 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/MiceAndOwls.png differ diff --git a/dita-docs/Site/BasicTutorialImages/MiceFlows.png b/dita-docs/Site/BasicTutorialImages/MiceFlows.png new file mode 100644 index 00000000..a910ea82 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/MiceFlows.png differ diff --git a/dita-docs/Site/BasicTutorialImages/NewModel.png b/dita-docs/Site/BasicTutorialImages/NewModel.png new file mode 100644 index 00000000..609a635c Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/NewModel.png differ diff --git a/dita-docs/Site/BasicTutorialImages/SimulationProgress.png b/dita-docs/Site/BasicTutorialImages/SimulationProgress.png new file mode 100644 index 00000000..e145fcc1 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/SimulationProgress.png differ diff --git a/dita-docs/Site/BasicTutorialImages/SymbolsView.png b/dita-docs/Site/BasicTutorialImages/SymbolsView.png new file mode 100644 index 00000000..74e6e0b5 Binary files /dev/null and b/dita-docs/Site/BasicTutorialImages/SymbolsView.png differ diff --git a/dita-docs/Site/Images/3x3trend.png b/dita-docs/Site/Images/3x3trend.png new file mode 100644 index 00000000..a97e66b8 Binary files /dev/null and b/dita-docs/Site/Images/3x3trend.png differ diff --git a/dita-docs/Site/Images/AuxiliarySheet.png b/dita-docs/Site/Images/AuxiliarySheet.png new file mode 100644 index 00000000..f1bc334f Binary files /dev/null and b/dita-docs/Site/Images/AuxiliarySheet.png differ diff --git a/dita-docs/Site/Images/AuxiliarySheetReference.png b/dita-docs/Site/Images/AuxiliarySheetReference.png new file mode 100644 index 00000000..9d6ea326 Binary files /dev/null and b/dita-docs/Site/Images/AuxiliarySheetReference.png differ diff --git a/dita-docs/Site/Images/BarChartAxis.png b/dita-docs/Site/Images/BarChartAxis.png new file mode 100644 index 00000000..46eaa4a1 Binary files /dev/null and b/dita-docs/Site/Images/BarChartAxis.png differ diff --git a/dita-docs/Site/Images/BarChartGeneral.png b/dita-docs/Site/Images/BarChartGeneral.png new file mode 100644 index 00000000..4fe5618a Binary files /dev/null and b/dita-docs/Site/Images/BarChartGeneral.png differ diff --git a/dita-docs/Site/Images/BarChartInDiagram.png b/dita-docs/Site/Images/BarChartInDiagram.png new file mode 100644 index 00000000..4bd16776 Binary files /dev/null and b/dita-docs/Site/Images/BarChartInDiagram.png differ diff --git a/dita-docs/Site/Images/BarChartVariable.png b/dita-docs/Site/Images/BarChartVariable.png new file mode 100644 index 00000000..6e26fb97 Binary files /dev/null and b/dita-docs/Site/Images/BarChartVariable.png differ diff --git a/dita-docs/Site/Images/BasicWorkbench.png b/dita-docs/Site/Images/BasicWorkbench.png new file mode 100644 index 00000000..f5a7ebb5 Binary files /dev/null and b/dita-docs/Site/Images/BasicWorkbench.png differ diff --git a/dita-docs/Site/Images/Basic_1.png b/dita-docs/Site/Images/Basic_1.png new file mode 100644 index 00000000..f3dc3b3c Binary files /dev/null and b/dita-docs/Site/Images/Basic_1.png differ diff --git a/dita-docs/Site/Images/Basic_2.png b/dita-docs/Site/Images/Basic_2.png new file mode 100644 index 00000000..d52d24b5 Binary files /dev/null and b/dita-docs/Site/Images/Basic_2.png differ diff --git a/dita-docs/Site/Images/ChartPanel.png b/dita-docs/Site/Images/ChartPanel.png new file mode 100644 index 00000000..c27a3273 Binary files /dev/null and b/dita-docs/Site/Images/ChartPanel.png differ diff --git a/dita-docs/Site/Images/ChartPanelOrientation.png b/dita-docs/Site/Images/ChartPanelOrientation.png new file mode 100644 index 00000000..dff15a38 Binary files /dev/null and b/dita-docs/Site/Images/ChartPanelOrientation.png differ diff --git a/dita-docs/Site/Images/CompareTrend.png b/dita-docs/Site/Images/CompareTrend.png new file mode 100644 index 00000000..35e63c2f Binary files /dev/null and b/dita-docs/Site/Images/CompareTrend.png differ diff --git a/dita-docs/Site/Images/ComponentTypes.png b/dita-docs/Site/Images/ComponentTypes.png new file mode 100644 index 00000000..3b354f83 Binary files /dev/null and b/dita-docs/Site/Images/ComponentTypes.png differ diff --git a/dita-docs/Site/Images/CreateNewExpression.png b/dita-docs/Site/Images/CreateNewExpression.png new file mode 100644 index 00000000..0eebab17 Binary files /dev/null and b/dita-docs/Site/Images/CreateNewExpression.png differ diff --git a/dita-docs/Site/Images/DefineEquations.png b/dita-docs/Site/Images/DefineEquations.png new file mode 100644 index 00000000..1fa4f6a8 Binary files /dev/null and b/dita-docs/Site/Images/DefineEquations.png differ diff --git a/dita-docs/Site/Images/DefineEquations2.png b/dita-docs/Site/Images/DefineEquations2.png new file mode 100644 index 00000000..89f61821 Binary files /dev/null and b/dita-docs/Site/Images/DefineEquations2.png differ diff --git a/dita-docs/Site/Images/DefineEquations3.png b/dita-docs/Site/Images/DefineEquations3.png new file mode 100644 index 00000000..679cb73b Binary files /dev/null and b/dita-docs/Site/Images/DefineEquations3.png differ diff --git a/dita-docs/Site/Images/DefineIndexes.png b/dita-docs/Site/Images/DefineIndexes.png new file mode 100644 index 00000000..d1ed523e Binary files /dev/null and b/dita-docs/Site/Images/DefineIndexes.png differ diff --git a/dita-docs/Site/Images/DefineRange.png b/dita-docs/Site/Images/DefineRange.png new file mode 100644 index 00000000..b45314d8 Binary files /dev/null and b/dita-docs/Site/Images/DefineRange.png differ diff --git a/dita-docs/Site/Images/Delay1.png b/dita-docs/Site/Images/Delay1.png new file mode 100644 index 00000000..6cd77669 Binary files /dev/null and b/dita-docs/Site/Images/Delay1.png differ diff --git a/dita-docs/Site/Images/Delay2.png b/dita-docs/Site/Images/Delay2.png new file mode 100644 index 00000000..507d3d99 Binary files /dev/null and b/dita-docs/Site/Images/Delay2.png differ diff --git a/dita-docs/Site/Images/Dependencies.png b/dita-docs/Site/Images/Dependencies.png new file mode 100644 index 00000000..54e766ff Binary files /dev/null and b/dita-docs/Site/Images/Dependencies.png differ diff --git a/dita-docs/Site/Images/ExampleExternalFunction.png b/dita-docs/Site/Images/ExampleExternalFunction.png new file mode 100644 index 00000000..61ef1d13 Binary files /dev/null and b/dita-docs/Site/Images/ExampleExternalFunction.png differ diff --git a/dita-docs/Site/Images/ExampleFunction.png b/dita-docs/Site/Images/ExampleFunction.png new file mode 100644 index 00000000..707ab4ed Binary files /dev/null and b/dita-docs/Site/Images/ExampleFunction.png differ diff --git a/dita-docs/Site/Images/ExternalFunctionResult.png b/dita-docs/Site/Images/ExternalFunctionResult.png new file mode 100644 index 00000000..5be7fd83 Binary files /dev/null and b/dita-docs/Site/Images/ExternalFunctionResult.png differ diff --git a/dita-docs/Site/Images/HistoryData.png b/dita-docs/Site/Images/HistoryData.png new file mode 100644 index 00000000..c4ccb920 Binary files /dev/null and b/dita-docs/Site/Images/HistoryData.png differ diff --git a/dita-docs/Site/Images/HistoryDataSettings.png b/dita-docs/Site/Images/HistoryDataSettings.png new file mode 100644 index 00000000..62545339 Binary files /dev/null and b/dita-docs/Site/Images/HistoryDataSettings.png differ diff --git a/dita-docs/Site/Images/ImportCFunctionLibrary.png b/dita-docs/Site/Images/ImportCFunctionLibrary.png new file mode 100644 index 00000000..3b0e55f4 Binary files /dev/null and b/dita-docs/Site/Images/ImportCFunctionLibrary.png differ diff --git a/dita-docs/Site/Images/LineChart.png b/dita-docs/Site/Images/LineChart.png new file mode 100644 index 00000000..18dcff84 Binary files /dev/null and b/dita-docs/Site/Images/LineChart.png differ diff --git a/dita-docs/Site/Images/LineChartAxisAndVariables.png b/dita-docs/Site/Images/LineChartAxisAndVariables.png new file mode 100644 index 00000000..34e4e2f7 Binary files /dev/null and b/dita-docs/Site/Images/LineChartAxisAndVariables.png differ diff --git a/dita-docs/Site/Images/LineChartGeneral.png b/dita-docs/Site/Images/LineChartGeneral.png new file mode 100644 index 00000000..a22b084c Binary files /dev/null and b/dita-docs/Site/Images/LineChartGeneral.png differ diff --git a/dita-docs/Site/Images/Loops.png b/dita-docs/Site/Images/Loops.png new file mode 100644 index 00000000..0cf2c86e Binary files /dev/null and b/dita-docs/Site/Images/Loops.png differ diff --git a/dita-docs/Site/Images/ModelHierarchy.png b/dita-docs/Site/Images/ModelHierarchy.png new file mode 100644 index 00000000..b128f6fb Binary files /dev/null and b/dita-docs/Site/Images/ModelHierarchy.png differ diff --git a/dita-docs/Site/Images/ModelProperties.png b/dita-docs/Site/Images/ModelProperties.png new file mode 100644 index 00000000..0c181522 Binary files /dev/null and b/dita-docs/Site/Images/ModelProperties.png differ diff --git a/dita-docs/Site/Images/ModelStructure.png b/dita-docs/Site/Images/ModelStructure.png new file mode 100644 index 00000000..131e9204 Binary files /dev/null and b/dita-docs/Site/Images/ModelStructure.png differ diff --git a/dita-docs/Site/Images/ModelWithMultidimensionalVariables.png b/dita-docs/Site/Images/ModelWithMultidimensionalVariables.png new file mode 100644 index 00000000..e17528f3 Binary files /dev/null and b/dita-docs/Site/Images/ModelWithMultidimensionalVariables.png differ diff --git a/dita-docs/Site/Images/NewChart.png b/dita-docs/Site/Images/NewChart.png new file mode 100644 index 00000000..76b84c07 Binary files /dev/null and b/dita-docs/Site/Images/NewChart.png differ diff --git a/dita-docs/Site/Images/NewEnumeration.png b/dita-docs/Site/Images/NewEnumeration.png new file mode 100644 index 00000000..40ecc979 Binary files /dev/null and b/dita-docs/Site/Images/NewEnumeration.png differ diff --git a/dita-docs/Site/Images/NewExperiment.png b/dita-docs/Site/Images/NewExperiment.png new file mode 100644 index 00000000..1bd61a9e Binary files /dev/null and b/dita-docs/Site/Images/NewExperiment.png differ diff --git a/dita-docs/Site/Images/NewFunction.png b/dita-docs/Site/Images/NewFunction.png new file mode 100644 index 00000000..84517e28 Binary files /dev/null and b/dita-docs/Site/Images/NewFunction.png differ diff --git a/dita-docs/Site/Images/NewFunctionLibrary.png b/dita-docs/Site/Images/NewFunctionLibrary.png new file mode 100644 index 00000000..ca099d12 Binary files /dev/null and b/dita-docs/Site/Images/NewFunctionLibrary.png differ diff --git a/dita-docs/Site/Images/OpenPerspective.png b/dita-docs/Site/Images/OpenPerspective.png new file mode 100644 index 00000000..51f8e6a4 Binary files /dev/null and b/dita-docs/Site/Images/OpenPerspective.png differ diff --git a/dita-docs/Site/Images/PieChartChartPanel.png b/dita-docs/Site/Images/PieChartChartPanel.png new file mode 100644 index 00000000..c01d0769 Binary files /dev/null and b/dita-docs/Site/Images/PieChartChartPanel.png differ diff --git a/dita-docs/Site/Images/PieChartGeneral.png b/dita-docs/Site/Images/PieChartGeneral.png new file mode 100644 index 00000000..e2fe067a Binary files /dev/null and b/dita-docs/Site/Images/PieChartGeneral.png differ diff --git a/dita-docs/Site/Images/PieChartVariable.png b/dita-docs/Site/Images/PieChartVariable.png new file mode 100644 index 00000000..82581fe8 Binary files /dev/null and b/dita-docs/Site/Images/PieChartVariable.png differ diff --git a/dita-docs/Site/Images/Preferences-system.png b/dita-docs/Site/Images/Preferences-system.png new file mode 100644 index 00000000..d3c6ce82 Binary files /dev/null and b/dita-docs/Site/Images/Preferences-system.png differ diff --git a/dita-docs/Site/Images/Preferences.png b/dita-docs/Site/Images/Preferences.png new file mode 100644 index 00000000..9bbb8590 Binary files /dev/null and b/dita-docs/Site/Images/Preferences.png differ diff --git a/dita-docs/Site/Images/Replaceable.png b/dita-docs/Site/Images/Replaceable.png new file mode 100644 index 00000000..49200f84 Binary files /dev/null and b/dita-docs/Site/Images/Replaceable.png differ diff --git a/dita-docs/Site/Images/Replacing.png b/dita-docs/Site/Images/Replacing.png new file mode 100644 index 00000000..9b44701e Binary files /dev/null and b/dita-docs/Site/Images/Replacing.png differ diff --git a/dita-docs/Site/Images/ReplacingEnumeration.png b/dita-docs/Site/Images/ReplacingEnumeration.png new file mode 100644 index 00000000..8989c205 Binary files /dev/null and b/dita-docs/Site/Images/ReplacingEnumeration.png differ diff --git a/dita-docs/Site/Images/ReplacingEnumerationConfiguration.png b/dita-docs/Site/Images/ReplacingEnumerationConfiguration.png new file mode 100644 index 00000000..561121b8 Binary files /dev/null and b/dita-docs/Site/Images/ReplacingEnumerationConfiguration.png differ diff --git a/dita-docs/Site/Images/Saveresults.png b/dita-docs/Site/Images/Saveresults.png new file mode 100644 index 00000000..444ec1ea Binary files /dev/null and b/dita-docs/Site/Images/Saveresults.png differ diff --git a/dita-docs/Site/Images/SelectEnumerations.png b/dita-docs/Site/Images/SelectEnumerations.png new file mode 100644 index 00000000..cfd75752 Binary files /dev/null and b/dita-docs/Site/Images/SelectEnumerations.png differ diff --git a/dita-docs/Site/Images/SelectNewExpression.png b/dita-docs/Site/Images/SelectNewExpression.png new file mode 100644 index 00000000..7df0e3f3 Binary files /dev/null and b/dita-docs/Site/Images/SelectNewExpression.png differ diff --git a/dita-docs/Site/Images/SensitivityChart.png b/dita-docs/Site/Images/SensitivityChart.png new file mode 100644 index 00000000..973044d1 Binary files /dev/null and b/dita-docs/Site/Images/SensitivityChart.png differ diff --git a/dita-docs/Site/Images/SensitivityChartAxisAndVariables.png b/dita-docs/Site/Images/SensitivityChartAxisAndVariables.png new file mode 100644 index 00000000..92ef541a Binary files /dev/null and b/dita-docs/Site/Images/SensitivityChartAxisAndVariables.png differ diff --git a/dita-docs/Site/Images/SensitivityExperiment.png b/dita-docs/Site/Images/SensitivityExperiment.png new file mode 100644 index 00000000..42034585 Binary files /dev/null and b/dita-docs/Site/Images/SensitivityExperiment.png differ diff --git a/dita-docs/Site/Images/SharedFunctions.png b/dita-docs/Site/Images/SharedFunctions.png new file mode 100644 index 00000000..d705a1a0 Binary files /dev/null and b/dita-docs/Site/Images/SharedFunctions.png differ diff --git a/dita-docs/Site/Images/Sheet.png b/dita-docs/Site/Images/Sheet.png new file mode 100644 index 00000000..bb517d7e Binary files /dev/null and b/dita-docs/Site/Images/Sheet.png differ diff --git a/dita-docs/Site/Images/SheetForMultidim.png b/dita-docs/Site/Images/SheetForMultidim.png new file mode 100644 index 00000000..db33f106 Binary files /dev/null and b/dita-docs/Site/Images/SheetForMultidim.png differ diff --git a/dita-docs/Site/Images/SheetMultidim1.png b/dita-docs/Site/Images/SheetMultidim1.png new file mode 100644 index 00000000..781e52e2 Binary files /dev/null and b/dita-docs/Site/Images/SheetMultidim1.png differ diff --git a/dita-docs/Site/Images/SheetMultidim2.png b/dita-docs/Site/Images/SheetMultidim2.png new file mode 100644 index 00000000..5a6c7ba2 Binary files /dev/null and b/dita-docs/Site/Images/SheetMultidim2.png differ diff --git a/dita-docs/Site/Images/ShowInCharts.png b/dita-docs/Site/Images/ShowInCharts.png new file mode 100644 index 00000000..9fdea85b Binary files /dev/null and b/dita-docs/Site/Images/ShowInCharts.png differ diff --git a/dita-docs/Site/Images/Trend.png b/dita-docs/Site/Images/Trend.png new file mode 100644 index 00000000..256e66af Binary files /dev/null and b/dita-docs/Site/Images/Trend.png differ diff --git a/dita-docs/Site/Images/UnitValidation.png b/dita-docs/Site/Images/UnitValidation.png new file mode 100644 index 00000000..1035a99d Binary files /dev/null and b/dita-docs/Site/Images/UnitValidation.png differ diff --git a/dita-docs/Site/Images/Values.png b/dita-docs/Site/Images/Values.png new file mode 100644 index 00000000..f55734e3 Binary files /dev/null and b/dita-docs/Site/Images/Values.png differ diff --git a/dita-docs/Site/Images/WithLookup1.png b/dita-docs/Site/Images/WithLookup1.png new file mode 100644 index 00000000..08df607b Binary files /dev/null and b/dita-docs/Site/Images/WithLookup1.png differ diff --git a/dita-docs/Site/Images/WithLookup2.png b/dita-docs/Site/Images/WithLookup2.png new file mode 100644 index 00000000..3f69912f Binary files /dev/null and b/dita-docs/Site/Images/WithLookup2.png differ diff --git a/dita-docs/Site/sysdyn.md b/dita-docs/Site/sysdyn.md new file mode 100644 index 00000000..7e028b34 --- /dev/null +++ b/dita-docs/Site/sysdyn.md @@ -0,0 +1,1502 @@ +# Simantics System Dynamics + +## Contents + +* [1 What is Simantics System Dynamics](#what-is-simantics-system-dynamics) +* [2 Introduction to System Dynamics Simulation](#introduction-to-system-dynamics-simulation) + * [2.1 System Dynamics](#system-dynamics) + * [2.2 Model](#model) + * [2.3 Components](#components) + * [2.4 Modeling Principles](#modeling-principles) +* [3 Installation Instructions](#installation-instructions) +* [4 Workbench](#workbench) + * [4.1 Global Preferences](#global-preferences) +* [5 Modelling](#modelling) + * [5.1 Basic Modelling](#basic-modelling) + * [5.2 Model Properties](#model-properties) + * [5.3 Special Variables](#special-variables) + * [5.3.1 WithLookup](#withlookup) + * [5.3.2 Delay](#delay) + * [5.4 Shortcut and Control Keys](#shortcut-and-control-keys) + * [5.5 Unit Validation](#unit-validation) + * [5.6 Diagram Profiles](#diagram-profiles) +* [6 Visual model elements](#visual-model-elements) + * [6.1 Fonts and colors](#fonts-and-colors) + * [6.2 Dependency properties](#dependency-properties) + * [6.3 Loops](#loops) + * [6.4 Comments](#comments) +* [7 Simulation](#simulation) + * [7.1 Experiments](#experiments) + * [7.2 Solvers](#solvers) +* [8 Simulation Result and Model Structure Analysis](#simulation-result-and-model-structure-analysis) +* [9 Custom Charts](#custom-charts) + * [9.1 Line Chart](#line-chart) + * [9.2 Sensitivity Chart](#sensitivity-chart) + * [9.3 Bar Chart](#bar-chart) + * [9.4 Pie Chart](#pie-chart) + * [9.5 Chart Panel](#chart-panel) +* [10 Multidimensional Variables](#multidimensional-variables) + * [10.1 Modeling](#modeling) + * [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.6 Simulation Results](#simulation-results) + * [10.7 Array Variables in Modules](#array-variables-in-modules) +* [11 Functions](#functions) + * [11.1 Creating Functions](#creating-functions) + * [11.2 Function Libraries](#function-libraries) + * [11.3 External Functions](#external-functions) + * [11.4 Modelica Functions](#modelica-functions) +* [12 Spreadsheets](#spreadsheets) + * [12.1 Variable Values](#variable-values) + * [12.2 History Data](#history-data) +* [13 Vensim Model Import](#vensim-model-import) +* [14 Sample Models and Molecules](#sample-models-and-molecules) + +# What is Simantics System Dynamics +
+ +*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. + +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! + +# Introduction to System Dynamics Simulation +
+ +## System Dynamics + +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 [installation instructions](#installation-instructions). + +## Model + +System dynamics model is generally understood as the model configuration. In this tool, the model contains also other components: [Experiments](#experiments) 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. [Module types](#basic-modelling) 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 [Functions](#functions) folder contains built-in and user-defined functions. + +
+ +

Model structure

+
+ +## Components + +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. + +
+ +

Component types

+
+ +**Auxiliary** + +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: *Auxiliary*, *Parameter*, *Constant*, [*Delay*](#delay) and [*WithLookup*](#withlookup). 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. + +**Dependency** + +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. + +**Flow** + +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. + +**Valve** + +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. + +**Stock** + +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. + +**Cloud** + +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. + +**Module** + +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. + +**Input** + +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. + +**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. + +**Loop** + +A 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. + +## Modeling Principles + +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. + +**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. + +**Connections** + +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. + +**Graphical annotations** + +System dynamics contains usually annotations for loops, polarities, delays and so on. Annotations are important, for communicating the behavior of the model. + +# Installation Instructions +
+ +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). +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 [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. + +# Workbench +
+ +
+ +
+ +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. + +2 **Model Browser** + +Model browser shows the structure of your model and all items related to it. + +**Symbols** + +Symbols view (stacked with the model browser) is used for dragging elements to diagrams. + +**Search** + +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. + +**Console** + +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. + +**Profiles** + +[Profiles](#diagram-profiles) view (stacked with the property view) allows enabling/disabling some visual diagram effects. + +**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. + +**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. + +**Values** + +The [values](#simulation-result-and-model-structure-analysis) 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. + +5 **Save and save as...** + +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. + +6 **Diagram tool mode** + +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. + +7 **Experiment controls** + +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. + +8 **Perspectives** + +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:
+ +
+ +9 **Chart Panel** + +[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!** 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. + +
+ +
+ +**Category** | **Description** +--- | --- +**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. + +# Modelling +
+ +## Basic Modelling + +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. + +
+ +
+ +**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. + +
+ +
+ +**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. + +**Configuring a model** + +Model configuration can be opened by double clicking Configuration in the model browser. + +**Configuring modules** + +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! + +**Populate variables** + +You can drag variables to a diagram from symbol view. You can also populate variables using [shortcut keys](#shortcut-and-control-keys). Variables can be divided into multiple lines by resizing the variable on diagram. + +**Populate modules** + +Modules are populated from the model browser. Just drag the module you want to populate from the Modules folder to a diagram. + +**Create connections** + +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. + +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. + +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. + +**Connections between modules** + +**Outside the module** + +You can connect variables to variables in modules like this: +
+MODULE -----> INPUT
+or
+ANY VARIABLE -----> MODULE 
+
+ +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** + +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 + +**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. + +**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. + +**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. + +**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. + +**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. + +## Model Properties + +Model properties can be viewed by selecting either the model or its configuration on the model browser. + +
+ +
+ +**Property** | **Description** +--- | --- +**Name** | The name of the model +**Start time** | The start time of the simulation. +**Stop time** | The stop time of the simulation. +**Step length** | The length of the simulation step. +**Output interval** | Interval of witch the simulation result is presented. If the field is left empty, all steps of the output are presented. +**Method** | The simulation solver (only OpenModelica). +**Validate units** | [Unit validation](#unit-validation) on/off. If unit validation is enabled, the unit of the simulation time is selected from the pull-down menu. +**Unit equivalents** | Define if different forms of predefined units are considered equal (e.g. dollars = dollar = $) in unit validation. +**Tolerance** | Integrator error tolerance (only OpenModelica) +**Variable filter** | Define which variables are presented (only OpenModelica) + +## Special Variables + +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 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. + +
+ +
+ +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. + +
+ +
+ +### 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. + +
+ +
+ +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. + +
+ +
+ +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: +
+Real Delay3;
+Delay3_delayClass Delay3_delayClass_instance(initialValue = 0, delayTime = 1);
+class Delay3_delayClass
+  parameter Real DL = delayTime/3;
+  parameter Real delayTime;
+  parameter Real initialValue;
+  Real delay0;
+  Real LV1(fixed=true, start=initialValue * DL);
+  Real delay1;
+  Real LV2(fixed=true, start=initialValue * DL);
+  Real delay2;
+  Real LV3(fixed=true, start=initialValue * DL);
+  Real delay3;
+equation
+  der(LV1) = - delay1 + delay0;
+  delay1 = LV1 /DL;
+  der(LV2) = - delay2 + delay1;
+  delay2 = LV2 /DL;
+  der(LV3) = - delay3 + delay2;
+  delay3 = LV3 /DL;
+end Delay3_delayClass;
+
+ +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: +
+Delay3_delayClass_instance.delay0 = Step1;
+Delay3 = Delay3_delayClass_instance.delay3;
+
+ +## Shortcut and Control Keys + +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. +Shift + C | Hover Cloud at the cursor position, populate with left mouse button. +Shift + V | Hover Valve at the cursor position, populate with left mouse button. +Shift + I | Hover Input at the cursor position, populate with left mouse button. +Shift + G | Hover Shadow (Ghost) variable at the cursor position, populate with left mouse button. +Alt + left mouse button | Start an arrow from a variable. End to another variable by clicking left mouse button. +Alt + right mouse button | 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. +Delete | Remove selected variables +F2 | Rename selected variable +Ctrl + left mouse button | Select multiple variables +Mouse wheel or + or - | Diagram zoom +drag(mouse3) | Diagram pan +drag(shift + any mouse button) | Diagram pan +↓, ←, ↑, → (arrow keys) | Diagram pan +Ctrl + C | Copy selected elements +Ctrl + X | Cut selected elements +Ctrl + V | Paste copied or cut elements +Ctrl + F | Find element in current diagram or all models +G | Show / hide grid +R | Show / hide ruler +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. + +## 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. + +Common error sources of unit validation include the following. The respective issues are shown in the picture below. + +
+ +
+ +* The equation of a variable yields a different unit than that defined for the variable. +* Two variables which have different units are added (+), subtracted (-), or compared (>, <, =, ...). +* 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.) +* A function is called with an argument of a prohibited unit. +* A variable has an empty unit. +* A variable has a misspelled unit. + +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. + +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. + +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". + +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 +
+    Aux1 + time
+
+yields a warning, it can be fixed be changing the expression to +
+    unitCast(Aux1) + time
+
+, in which case the unit of the expression is that of time, or to +
+    Aux1 + unitCast(time)
+
+, in which case the unit of the expression is that of Aux1. + +## Diagram Profiles + +Diagram profiles allow selecting which visual effects are enabled. Currently the following profiles can be used: + +**Default** + +**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** + +When enabled, the original and all the shadow variables are highlighted when one is selected. + +**Simulation Playback** + +**Playback Colors** + +When enabled, colors of the elements on diagram change during a playback experiment. + +# Visual model elements +
+ +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. + +## 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. + +## Dependency properties + +Dependency arrow properties can be changed on the property view: + +**Polarity** + +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. + +**Location** + +Location of the polarity mark + +**Arrowhead** + +Toggle for showing arrowhead + +**Delay mark** + +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. + +**Line thickness** + +Thickness of the arrow + +## Loops + +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. + + +**Loop Items** + +The loop of variables which the loop symbol refers can be selected for visualization purposes. + +**Comment** + +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. + +**Direction of Rotation** + +Direction to which the loop rotates on diagram. + +## Comments + +Comments are just strings of text. + +# Simulation +
+ +## Experiments + +There are three different ways for simulating a model. Different simulations are represented as different types of experiments in Simantics System Dynamics. + +Experiments are created from the context menu of experiments folder in a model. + +
+ +
+ +Double-click on an experiment activates it and displays experiment type specific controls in the main tool bar. + +**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. + +**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. + +**Simulation playback** + +Simulation playback works essentially as the basic experiment, but it offers some additional visualization options. + +**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. + +
+ +
+ +**General** | - +--- | --- +Name | The name of the sensitivity analysis experiment. Displayed in e.g. model browser. +Number of runs | The total amount of individual simulation runs +Method | The method of how the parameter values are selected from the distribution(s). Selecting "Random" yields [pseudo-random](http://en.wikipedia.org/wiki/Random_number_generation#.22True.22_random_numbers_vs._pseudo-random_numbers) values, i.e., randomly selected from the distribution(s). Selecting "Halton" yields a [quasi-random](http://en.wikipedia.org/wiki/Quasi-random) [Halton sequence](http://en.wikipedia.org/wiki/Halton_sequence) of values selected deterministically to represent the distribution(s) better than a pseudo-random series. +Seed | The seed number for pseudo-random generator +Add parameter | Adds a new parameter to be varied +Remove | Removes a parameter +**Parameter properties** | - +Variable | The full path of the variable of which value is varied. This field has content assistant, which shows the possible variables as you type. +Range | Used with multidimensional values to select which dimensions are varied. +Distribution | Probability distribution for the varied parameter. "Normal" is for [truncated normal distribution](http://en.wikipedia.org/wiki/Truncated_normal_distribution) and "Uniform" for [uniform distribution](http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)). 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". +**Distribution properties** | - +Min value | Minimum value of the distribution +Max value | Maximum value of the distribution +Mean | Mean of the normal distribution +Standard deviation | Standard deviation of the normal distribution + +## Solvers + +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. + +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. + +# Simulation Result and Model Structure Analysis +
+ +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 [custom charts](#custom-charts). + +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. + +**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. + +
+ +
+ +**Values** + +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. + +
+ +
+ +**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: + +
+ +
+ +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. + +
+ +
+ +**Dependencies** + +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. + +
+ +
+ +**Model Hierarchy** + +Model Hierarchy displays the hierarchical structure of the model. The module type where a selected variable is located is highlighted. + +
+ +
+ +**Loops** + +Loops display all feedback loops which the selected variable belongs to. + +
+ +
+ +# Custom Charts +
+ +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. + +
+ +
+ +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 + +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. + +
+ +
+ +
+ +
+ + +**General** | - +--- | --- +Name | The name of the chart. Displayed in e.g. model browser +Title | The title of the chart. Displayed in the chart +Type | Line chart (default) or area chart +Hide | Options to hide chart grid, title or legend +**X-axis** | - +Variable | 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. +Label | Optional other label for the variable than its name +Min | Minimum value of the x-axis +Max | Maximum value of the x-axis +Hide | Options to hide x-axis label, line, tick marks and tick labels + +
+ +
+ +**Variable** | - +--- | --- +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. +Label | Optional label for the variable. If label is empty, the variable name is displayed. +Color | Color for the lines of this variable +Line width | The width of the lines drawn for this variable + +There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab. + +**Y-axis** | - +--- | --- +Label | Label of the axis +Min | Minimum value in the axis +Max | Maximum value in the axis +Color | The color of the axis lines, ticks and labels +Hide | Options to hide parts of the axis: label, axis line, tick marks, tick labels + +## Sensitivity Chart + +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. + +
+ +
+ +
+ +
+ +**Axis and Variables** | - +--- | --- +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. + +There are also configuration options for y-axis. They are displayed when an axis is selected in the Axis and variables tab. + +**Y-axis** | - +--- | --- +Label | Label of the axis +Min | Minimum value in the axis +Max | Maximum value in the axis +Color | The color of the axis lines, ticks and labels +Hide | Options to hide parts of the axis: label, axis line, tick marks, tick labels + +## 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. + +
+ +
+ +**General** | - +--- | --- +Name | The name of the chart. Name is displayed in model browser. +Title | The title of the chart. Title is displayed in the chart, if not hidden +Type | Normal or stacked. Normal type displays all variables in separate bars. Stacked mode is able to display one-dimensional array variables in stacks. +Time | A general time setting for the entire chart. The values at this time are displayed in the chart +Hide | Option for hiding grid, title and Legend. Legend is hidden by default since it only contains the information that the current simulation is displayed. + +
+ +
+ +Charts can be added to model diagrams simply by dragging the chart from model browser to diagram. + +
+ +
+ +**Variable** | - +--- | --- +Add / Remove | Add or remove variables +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. +Label | Optional label for the variable. If label is empty, the variable name is displayed +Time | 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. + +
+ +
+ +**Domain axis** | - +--- | --- +Label | An optional label for x axis +Label angle | Axis labels can be displayed in an angle. This value determines the angle in degrees. +Color | The color of the axis line, tick lines and labels +Hide | Options for hiding axis label, line, tick marks and tick labels +**Range axis** | - +Label | An optional label for y axis +Min | Minimum value of y axis +Max | Maximum value of y axis +Color | The color of the axis line, tick lines and labels +Hide | Options for hiding axis label, line, tick marks and tick labels + +## Pie Chart + +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. + +
+ +
+ +**General** | - +---- | --- +Name | The name of the chart. Displayed in e.g. model browser +Title | Title The title of the chart. Displayed in the chart +Time | A general time setting for the entire chart. The values at this time are displayed in the chart +Hide | Options for hiding title, section labels and legend + +
+ +
+ +**Variables** | - +--- | --- +Add / Remove | Add or remove variables +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. +Label | Optional label for the variable. If label is empty, the variable name is displayed +Color | Color for the sector of this variable +Time | 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. +Exploded | If set, the sector(s) of the variable(s) are "exploded" away from the center of the pie chart + +
+ +
+ +## Chart Panel + +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. + +
+ +
+ +Chart panel can be either horizontally or vertically oriented. Different orientations help in configuring the workbench perspective. + +
+ +
+ +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. + +By default, chart panel is hidden in the upper-right corner of the system dynamics perspective. + +# Multidimensional Variables +
+ +## 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): + +1 **Create the model structure** + +Model with multidimensional variables looks just like any other model. + +
+ +
+ +2 **Create Enumerations and define the indexes** + +Enumerations are created by right-clicking configuration and selecting New->Enumeration. + +
+ +
+ +Define enumeration indexes by adding as many indexes as you want. Rename the indexes by selecting them and then clicking on them again. + +
+ +
+ +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. + +
+ +
+ +4 **Define equations for all possible indexes** + +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}}. + +
+ +
+ +## Expressions + +Values for all cells in the variable matrix can be defined in a single expression. + +
+ +
+ +
+ +
+ +In many situations, it is however more clear to define separate expressions for each cell or blocks. + +1 **Define range for the expression** + +
+ +
+ +2 **Define the expression** (dimensions of the defined range and the result of the expression must match!) + +
+ +
+ +3 **Create a new expression** + +
+ +
+ +4 **Select the new expression** + +
+ +
+ +Repeat until there is value for each cell. There must be exactly one value for each cell. + +## Array Slices + +Many times it is useful to access a slice of a multidimensional variable. In this chapter, we will use the following example variable: + +
+ enumeration E1 = one, two, three
+ enumeration E2 = eins, zwei, drei
+ Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
+
+ +The whole variable can be accessed in three different ways: +1. `Auxiliary` +2. `Auxiliary[E1, E2]` +3. `Auxiliary[:, :]` + +The following explains different methods for accessing parts of the variable + +
+ // Single cell
+ Auxiliary[one, eins] = 1
+
+
+ // 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}}
+
+ +The syntax for accessing parts of variables can be used in both expression range definitions and in expressions. + +## Arithmetic Operators + +Arithmetic operations are defined in Modelica. Below are examples of different operations. + +**Addition and substraction** + +Addition and substraction are calculated elementwise + +
+ {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
+
+ +**Division** + +Division with a scalar + +
+ {5,10,15} / 5 = {1,2,3}
+ 5 / {5,10,15} = ERROR! not allowed
+
+ +Division with an array + +
+ {1,2,3} / {1,2,3} = ERROR! not allowed
+ 
+ // Elementwise
+ {1,2,3} ./ {1,2,3} = {1,1,1}
+
+ +**Multiplication** + +Multiplication with a scalar + +
+ {1,2,3} * 2 = {2,4,6}
+ 5 * {1,2,3} = {5,10,15}
+
+ +Matrix multiplication with an array + +
+ {{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[2,2] d = {{3,4},{5,6}};
+ Real[2,2] cd;
+ cd = c[2:3, :] .* d; // Result: {{9,16},{25,36}}
+
+ +**Power** + +Elementwise power of array variable +
+ {1,2} .^ 2 = {1,4}
+
+ +## Builtin Modelica Functions + +Modelica has some builtin functions that help using multidimensional variables. This chapter introduces some of the builtin functions. + +**Dimension and size functions** + +We will use the same example variable as previously. +
+ enumeration E1 = one, two, three
+ enumeration E2 = eins, zwei, drei
+ 
+ Auxiliary[E1, E2] = {{1,2,3},{4,5,6},{7,8,9}}
+
+ +**ndims(A)** + +The number of dimensions in array A +
+ ndims(Auxiliary) = 2
+
+ +**size(A, i)** + +The size of dimension i in array A +
+ size(Auxiliary, 2) = 3
+
+ +**size(A)** + +A vector of length ndims(A) containing the dimension sizes of A +
+ size(Auxiliary) = {3,3}
+
+ +**Construction functions** + +In addition to normal array constructing, a special construction functions can be used. + +**zeros(n1,n2,n3,...)** + +An array full of zeros with dimensions n1 x n2 x n2 x ... +
+ zeros(2, 2) = {{0,0}, {0,0}}
+
+ +**ones(n1,n2,n3,...)** + +An array full of ones with dimensions n1 x n2 x n2 x ... +
+ ones(2, 2) = {{1,1}, {1,1}}
+
+ +**fill(s,n1,n2,n3)** + +Like zeros() and ones(), but with user defined value (s) for array elements. +
+ fill(3,2,2) = {{3,3}, {3,3}}
+
+ +**identity(n)** + +Creates an n x n integer identity matrix with ones on the diagonal and all other elements zero. +
+ identity(3) =
+   1 0 0
+   0 1 0
+   0 0 1
+
+ +**diagonal(v)** + +Constructs a square matrix with elements of vector v on the diagonal and all other elements zero. +
+ diagonal({1,2,3}) =
+   1 0 0
+   0 2 0
+   0 0 3
+
+ +**linspace(x1,x2,n)** + +Constracts a Real vector from x1 to x2 with n equally spaced elements. +
+ linspace(2,5,4) = {2,3,4,5}
+
+ +**Reduction functions** + +Reduction functions reduce arrays to scalars. + +**min(A)** + +Returns the minimum value in array A. +
+ Real A = {{1,2},{3,4}}
+ min(A) = 1
+
+ +**max(A)** + +Returns the maximum value in array A. +
+ Real A = {{1,2},{3,4}}
+ max(A) = 4
+
+ +**sum(A)** + +Returns the sum of values in array A. +
+ Real A = {{1,2},{3,4}}
+ sum(A) = 10    // 1 + 2 + 3 + 4
+
+ +**product(A)** + +Returns the product of values in array A. +
+ Real A = {{1,2},{3,4}}
+ product(A) = 24   // 1 * 2 * 3 * 4
+
+ +**Using functions with iterators** + +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. +
+ 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})}
+ */
+
+ +One expression can have multiple iterators. The Modelica specification defines the following format, but it is NOT yet supported in OpenModelica: +
+ {sum(Array[ i, j, E3]) for i in E1, j in E2}  // Dimensions reduced from 3 to 2
+
+ +To use multiple iterators, use the following format (NOTE the reversed order of iterators!): +
+ {{sum(Array[ i, j, E3]) for j in E2} for i in E1}  // Dimensions reduced from 3 to 2
+
+ +The range doesn't have to be the whole enumeration. Subranges can also be used. +
+ {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. + +
+ +
+ +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. + +
+ +
+ +## Array Variables in Modules + +
+ +

Replaceable enumeration inside a module

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

Module configuration for replacing enumerations inside the module

+
+ +In the parent configuration, we have used an enumeration with three indexes in the two variables. + +
+ +

Enumeration in the parent configuration that will replace the enumeration in the module

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

Enumeration in the parent configuration that will replace the enumeration in the module

+
+ +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! + +# Functions +
+ +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 + +
+ +
+ +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. + +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. + +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/). + +
+ +
+ +## Function Libraries + +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)). + +
+ +
+ +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. + +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. + +Below is a simple example of using a function that returns the sum of two arguments. + +
+ double exampleCFunction(double x, double y)
+ {
+   double res;
+   res = x + y;
+   return res;
+ }
+
+ +
+ +
+ +You need to create an Object file (.o) of your code, import it to a function and define the function to use the library and function that you created. If you don’t have a C-compiler, you can use the one provided by the Simantics installation (e.g. simantics_home/plugins/org.simantics.openmodelica.win32_x/MinGW/bin/mingw32_gcc.exe -g -O -c ExampleCFunctionCode.c). + +
+ +
+ +You can use the external function like any other function in your variables. Using equation ExampleExternalFunction(Stock1, 10) in an auxiliary variable (Auxiliary2) gives the following result. + +
+ +
+ +In addition to .o -files, you can import .c and .h files. By including these to the function, the source code can be reviewed and later by you or others that use the function. + +Small external C function can also be written directly to the function code in Simantics Sysdyn: +
+ function ExampleExternalFunction
+ input Real x;
+ input Real y;
+ output Real z;
+ external "C" z=exampleCFunction(x,y) annotation(Include="
+ double exampleCFunction(double x, double y)
+ {
+   double res;
+   res = x + y;
+   return res;
+ }");
+ end ExampleExternalFunction;
+
+ +## 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). + +**Function** | **Description** +--- | --- +abs(x) | Returns the absolute value of x. Expanded into "(if x >= 0 then x else -x)". +acos(x) | Inverse cosine. +asin(x) | Inverse sine. +atan(x) | Inverse tangent. +atan2(x1,x2) | four quadrant inverse tangent. +cat(n,A,B,...) | General concatenation function that concatenates arrays A,B,... along the nth dimension. +ceil(x) | Returns the smallest integer not less than x, the closest integer above x. +cos(x) | Cosine. +cosh(x) | Hyperbolic cosine. +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)). +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. +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. +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)". +sin(x) | Sine. +sinh(x) | Hyperbolic sine. +sqrt(x) | Square root of x. The value of x must be greater or equal to 0 or an assertion error occurs. +tan(x) | Tangent. +tanh(x) | Hyperbolic tangent. +terminal() | Returns true at the end of a successful simulation. + +# Spreadsheets +
+ +Spreadsheets allow storing and maintaining values in a familiar format. The current spreadsheet implementation is experimental and does not provide much functionality. + +## Variable Values + +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. + +
+ + +
+ +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. + +
+ +
+ +Reference to a sheet range creates an array variable. + +
+ +
+ +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))) + +
+ +
+ +## History Data +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. + +
+ +
+ +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 properties** | - +--- | --- +Name | Name of the history dataset +Sheet | Combo box for selecting a sheet where the history data is located +Orientation | Columns or rows. How the data is arranged in the sheet. +Range start | The upper-left corner cell of the history data range +Range end | The lower-right corner cell of the history data range +Time variable | The name of the time variable in the history data, if it is different than "time" +Variables in range | This text field displays the found variables in the given sheet and range + +If the history dataset is activated, history data is displayed whenever it is available for a variable that is displayed in a chart. + +
+ +
+ +# Vensim Model Import +
+ +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: + +* The Vensim model must be in the .mdl file format, the other Vensim file formats are proprietary and thus not supported. +* Only variables and connections are imported. +* Many advanced Vensim features, such as input and output objects (e.g. graphs and parameter value editors) and other diagram customizations, are not supported. +* Variable value range data is not always imported correctly. +* Subscripts are automatically converted to enumerations which may sometimes lead into problems as the constructions are not exactly equivalent. +* Dimensionless units are currently not converted correctly (in Simantics System Dynamics, dimensionless should be indicated with a constant). +* Non-shadow duplicate variables are sometimes very problematic and may be imported incorrectly, shadow variables should work fine. +* 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. + +# Sample Models and Molecules +
+ +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* + +
+ + +[**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. + + +[**Tutorial: Advanced System Dynamics Modelling**](AdvancedTutorial.md) + +This tutorial introduces the more advanced features of the system dynamics modelling tool: Modules and Operating interfaces diff --git a/dita-docs/custom.css b/dita-docs/custom.css new file mode 100644 index 00000000..f2eb6e39 --- /dev/null +++ b/dita-docs/custom.css @@ -0,0 +1,43 @@ + +/*! + * Custom CSS declarations, to be appended to the end of existing declarations + */ + +.imageText { + padding: 1px; + border: 1px solid; + text-align: center; + border-color: #c8ccd1; +} + +.imageBorder { + padding: 4px; + border: 1px solid; + border-color: #c8ccd1; + display: table; + background-color: #f8f9fa; +} + + .box { + display: flex; + align-items:left; +} + +center { + margin: auto; + width: 50%; +} + +.hr{ + border-top: 1px solid black; +} + + pre { + color: #000000; + display: block; + white-space: pre-wrap; + margin: 1em 0; + background-color: #f8f9fa; + border: 1px solid #eaecf0; + padding: 0; +} diff --git a/dita-docs/makedocs.bat b/dita-docs/makedocs.bat new file mode 100644 index 00000000..b68a525c --- /dev/null +++ b/dita-docs/makedocs.bat @@ -0,0 +1,14 @@ +call del "..\bundles\org.simantics.sysdyn.wiki\commonrtl.css" +call del "..\bundles\org.simantics.sysdyn.help\commonrtl.css" +call del "..\bundles\org.simantics.sysdyn.wiki\commonltr.css" +call del "..\bundles\org.simantics.sysdyn.help\commonltr.css" +call cmd /c dita %1 --input=SYSDYN.ditamap --output=../bundles/org.simantics.sysdyn.wiki --format=html5 +call cmd /c dita %1 --input=SYSDYN.ditamap --output=../bundles/org.simantics.sysdyn.help --format=eclipsehelp +call type ".\custom.css" >> "..\bundles\org.simantics.sysdyn.wiki\commonrtl.css" +call type ".\custom.css" >> "..\bundles\org.simantics.sysdyn.help\commonrtl.css" +call type ".\custom.css" >> "..\bundles\org.simantics.sysdyn.wiki\commonltr.css" +call type ".\custom.css" >> "..\bundles\org.simantics.sysdyn.help\commonltr.css" +REM We also need to replace all .html files in the eclipse help with the files generated by the html5 generator +REM This is because there appears to be a bug that creates malformed HTML with incorrect topic/title IDs in the eclipsehelp format: +for /R "..\bundles\org.simantics.sysdyn.wiki\Site" %%f in (*.html) do copy /Y "%%f" "..\bundles\org.simantics.sysdyn.help\Site\" +EXIT /B \ No newline at end of file diff --git a/dita-docs/makedocs.sh b/dita-docs/makedocs.sh new file mode 100644 index 00000000..864f2fba --- /dev/null +++ b/dita-docs/makedocs.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# This has not been tested yet, but should work (concept is the same as with the .bat file) +rm -f "../bundles/org.simantics.sysdyn.wiki/commonrtl.css" +rm -f "../bundles/org.simantics.sysdyn.help/commonrtl.css" +rm -f "../bundles/org.simantics.sysdyn.wiki/commonltr.css" +rm -f "../bundles/org.simantics.sysdyn.help/commonltr.css" +dita $1 --input=SYSDYN.ditamap --output=../bundles/org.simantics.sysdyn.wiki --format=html5 +dita $1 --input=SYSDYN.ditamap --output=../bundles/org.simantics.sysdyn.help --format=eclipsehelp +cat "./custom.css" >> "../bundles/org.simantics.sysdyn.wiki/commonrtl.css" +cat "./custom.css" >> "../bundles/org.simantics.sysdyn.help/commonrtl.css" +cat "./custom.css" >> "../bundles/org.simantics.sysdyn.wiki/commonltr.css" +cat "./custom.css" >> "../bundles/org.simantics.sysdyn.help/commonltr.css" +#TODO: +#Add copy .html files logic here +#For now, do it manually! (all HTML files under \Site from wiki to help) \ No newline at end of file diff --git a/features/org.simantics.sysdyn.internal.feature/feature.xml b/features/org.simantics.sysdyn.internal.feature/feature.xml index 8967dc9a..e51a01ac 100644 --- a/features/org.simantics.sysdyn.internal.feature/feature.xml +++ b/features/org.simantics.sysdyn.internal.feature/feature.xml @@ -1,63 +1,70 @@ - - - - - Simantics System Dynamics product with custom internal solver only. - - - + + + + + Simantics System Dynamics product with custom internal solver only. + + + Copyright (c) 2007, 2016 Association for Decentralized Information Management in Industry THTH ry.<br/> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at -<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - - - - Licensed under Eclipse Public License (EPL) 1.0. - - - - - - - - - - - - - - - - - - - - - +<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> + + + + Licensed under Eclipse Public License (EPL) 1.0. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/releng/org.simantics.sysdyn.tycho.configuration/pom.xml b/releng/org.simantics.sysdyn.tycho.configuration/pom.xml index 4ff269db..c238f119 100644 --- a/releng/org.simantics.sysdyn.tycho.configuration/pom.xml +++ b/releng/org.simantics.sysdyn.tycho.configuration/pom.xml @@ -1,142 +1,142 @@ - - - 4.0.0 - org.simantics - org.simantics.sysdyn.tycho.configuration - 1.0.0-SNAPSHOT - pom - - - 1.0.0 - 1.0.0 - UTF-8 - master - http://www.simantics.org/download - - - - - simantics-sdk - p2 - ${simantics-download-site}/${branch-spec}/sdk - - - - - - graph-builder-snapshot - Graph Builder Repository - https://repo.simupedia.com/repository/graph-builder-release - default - - never - - - always - - - - - - - - org.simantics - graph-builder-maven-plugin - 0.0.9 - - - - compile-graphs - - - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho.version} - true - - - org.eclipse.tycho - tycho-packaging-plugin - ${tycho.version} - - 'v'yyyyMMdd-HHmmss - - - - org.eclipse.tycho - target-platform-configuration - ${tycho.version} - - true - true - p2 - - - - win32 - win32 - x86 - - - win32 - win32 - x86_64 - - - - - - - org.eclipse.tycho.extras - tycho-pack200b-plugin - ${tycho.extras.version} - - - pack200-pack - - pack - - - - - - org.eclipse.tycho - tycho-p2-plugin - ${tycho.version} - - - attach-p2-metadata - package - - p2-metadata - - - - - false - - - - - + + + 4.0.0 + org.simantics + org.simantics.sysdyn.tycho.configuration + 1.0.0-SNAPSHOT + pom + + + 1.0.0 + 1.0.0 + UTF-8 + release/1.35.0 + http://www.simantics.org/download + + + + + simantics-sdk + p2 + ${simantics-download-site}/${branch-spec}/sdk + + + + + + graph-builder-snapshot + Graph Builder Repository + https://repo.simupedia.com/repository/graph-builder-release + default + + never + + + always + + + + + + + + org.simantics + graph-builder-maven-plugin + 0.0.9 + + + + compile-graphs + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho.version} + true + + + org.eclipse.tycho + tycho-packaging-plugin + ${tycho.version} + + 'v'yyyyMMdd-HHmmss + + + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + true + true + p2 + + + + win32 + win32 + x86 + + + win32 + win32 + x86_64 + + + + + + + org.eclipse.tycho.extras + tycho-pack200b-plugin + ${tycho.extras.version} + + + pack200-pack + + pack + + + + + + org.eclipse.tycho + tycho-p2-plugin + ${tycho.version} + + + attach-p2-metadata + package + + p2-metadata + + + + + false + + + + +