Excel Add in🔗
This tutorial provides a step-by-step guide for setting up your first example using the Modelon Impact Add-In for Excel. By following this tutorial, you will learn how to:
- Access the Excel template worksheet used to set up experiments with the add-in.
- Work with the template worksheet.
- Execute the experiment and fetch the results.
Before you start🔗
Before you begin, make sure you have the Modelon Impact Add-In for Excel installed. Also please note that the add-in is installed separately for Excel desktop and Excel for the web. If you want to have access to the add-in in both versions you need to install it to both.
Your first experiment🔗
Throughout this tutorial, we will work with a basic example model from the Modelica Standard library, "Modelica.Blocks.Examples.PID_Controller", in order to illustrate the general workflow. Naturally, the same workflow can be applied to any other model as long as the appropriate adaptions are made.
Download the template file🔗
Launch your web browser and log in to your Modelon Impact Cloud Account. Open a new workspace or an existing one containing the model you wish to work with. In our example, we will be using the model "Modelica.Blocks.Examples.PID_Controller" from a workspace named "GetStarted".
From the Apps menu, locate the option to download or open the template.

When using these buttons while having a model open, you will get both workspace id and model name pre-filled out in the downloaded/opened template worksheet. If used from the home screen, these would have to be added to the template manually later.
Now we can open the template file and see that the correct model name and workspace id are filled out in the "ModelonExperiment" worksheet.

The workspace id is in general an all lower case version of the workspace name.
Launch the Modelon Impact Add-in🔗
If installed correctly, the add-in should be accessible from the "Home" tab.

To open it, simply click the Modelon Impact logo. This will open the add-in to the side of the screen.
Authenticate🔗
To use the add-in we need to authenticate in Modelon Impact. Click the "Login" button and provide your Modelon Impact Account credentials in the pop-up window.

After successful authentication the add-in will display the Modelon Impact play button that is used to launch the execution of experiments.

The ModelonExperiment worksheet🔗
In order to execute an experiment we need to provide the following information:
- Workspace ID and Model Name (Model)
- Cases to execute
- Analysis Parameters (Settings)
- Model Parameters (Indata)
- Output Variables (Outdata)
All this information should be present in the "ModelonExperiment" worksheet in order for the add-in to be able to run a simulation.
The template worksheet also contains other information such as version info and run information from executed experiments.
Important
The add-in retrieves the experiment's information by referring to specific markers in the file, such as "Indata" and "Outdata". Hence, it is highly recommended to make modifications to the template worksheet only as outlined in this document.
Workspace ID and Model Name🔗
If you opened/downloaded the template file while having a specific model opened, the worksheet should already have been filled out automatically to use that specific model.

If the template was generated from the landing page, or you want to change the workspace to use, this information can also be filled in manually in the Excel worksheet.
The workspace id can be found in the tooltip of the workspace name in Modelon Impact, or from the URL of the Impact workspace ("../workspaces/) and is in general an all lower case version of the workspace name.

For the model name, you can get the correct model name by right clicking the model in the library browser and choose "Copy path".

For our example the correct Workspace Id is getstarted
and the Model Name is Modelica.Blocks.Examples.PID_Controller
.
Adjusting the number of cases🔗
A case in an experiment is a simulation of the model done with a certain set of parameters that would yield a certain output. Each case is represented by a column. The template worksheet is by default set up to run 5 cases. To adjust the number of cases to run, we can simply add or remove columns to achieve the appropriate amount of cases.
Adding cases:

Removing cases:

In our example we will consider two cases.

Analysis parameters🔗
Under "Settings" in the template worksheet, the analysis parameters for dynamic simulations are listed, namely:
start_time
final_time
These are given in seconds by filling them out for every individual case.

In this case we have defined two cases which will each run from 0 to 5 seconds.
Note
Steady-state or custom function simulation from Excel is currently not supported.
Model parameters (Indata)🔗
To study the effect on the result of changing a specific model parameter, we can vary any model parameter by adding it to the list under "Indata". The names of the parameters follows the Modelica dot-notation. For example, we would want to change the inertia parameter J of the component inertia1 the name of the parameter would be, inertia1.J.

In the default template there are two dummy parameters given, that we can just replace with the ones we want to change, for example inertia1.J and inertia2.J. The parameter values are always given in the SI unit. If we want to add more parameters to the experiment we can just insert new rows in this list.

Output variables (Outdata)🔗
Now we have added all information needed in order to run the experiment. However in order to analyze the result we also need to specify what variables from the simulation results we want to fetch back to the Excel worksheet. This is specified in the Results group under "Outdata". Similarly to the Model Parameters these are just stated with dot-notation in the list under "Outdata". By default, there are two dummy variables here that we can replace and if we want to add further output variables we can just add new rows this list.
In this case we are interested in reading the variables inertia1.phi, inertia1.w, inertia2.phi and inertia2.w from the result.

After the simulation is run, the end value (I.e. the value of the given variable at final_time
) of the variable will be printed to the corresponding cell.
Execute the experiment🔗
When we are logged in, we will see the Modelon Impact play button in the add-in. To execute an experiment we simply click this button.

During execution, the button will give some feedback on the progress. Once the simulation is finished it will write the output values to the worksheet and update the information under "Experiment Info".

As we can see here, our two cases simulated successfully and we have the results printed to the corresponding cell.
This concludes the getting started tutorial!
If a case fails🔗
If one or more cases fails to simulate, you will be notified by the "Status" row under "Experiment Info". In order to get more information about what went wrong in the specific case, you can always find the specific logs and results of the case in the main Modelon Impact UI. Just browse to the right model in the right workspace and you should be able to find the appropriate case in the Results mode.
