Skip to main content
Skip table of contents

Octave Engine


The octave engine (open-source MatLab compatible/tool) within the Scripting Module allows users to perform complex calculations within Valispace that are not very easy to perform/calculate in the Components Module. You can reference the Valis needed for the calculations as input Valis and the result as output Valis. Some common examples of such calculation involve solving non-linear equations, matrix multiplication or conditional cases.

Scripting flow for Octave engine scripts

The typical workflow of using a Scripting Module within Valispace is shown below. Each step is explained in each sub-sections.


1. Creating a New Simulation

To create a new simulation in your project (1), hover over to the simulations module and select “+ Simulation” (2). Upon clicking, a popup window opens; enter the name and select “Octave engine (Matlab compatibilite) (3) click on “Create”.

2. Inputs and Outputs

The user can add the input and output Valis. For example, when the user references the Vali within the inputs or outputs, the user can provide a short name to the Vali, which will be used in your octave calculation code.


If you are using a Vali ‘ElectronicPressureRegulatorXenonType.Internal_pressure’ from your component module, you can simply assign an abbreviation of the variable such as P_in (1). Once the Vali is referenced in the inputs, Valispace automatically adds the values along with the units (2).

The user can also change the simulation unit. e.g. the defined inlet pressure of the electronic pressure regulator in the components module is in MPa and if the user wants to run the simulation with a different unit such as bar(3), the user can add it in the “simulation unit” column. Valispace uses the bar for the calculations.


You can use any Vali from the Components Module either as an input or output, but not simultaneously as both. The visual representation of the inputs and outputs makes your code easily readable and understandable by anyone on your team.

3. Calculation/Octave code

As mentioned earlier, Valispace’s simulation module uses an octave engine that allows you to use Octave syntax. It is highly similar and has excellent compatibility with Matlab, so you won’t have to familiarize yourself with a new framework to create practical simulations inside Valispace. You can read the GNU Octave Documentation Page if you need further information.

The users have to write the octave code in the “Main.m” file(1). The instructions are written in the coding area on how the user can define the inputs and outputs (2).

Once the code is added to the main.m file, the user can save the script by clicking on “Save”(3).

4. Run Simulations/Results

Once you are completed with your script, you can click on “Run” which can be found in the top left corner as shown in the gif below.

Once the simulation is completed, Valispace automatically updates the output values. As a result, the output Valis in the component modules gets automatically updated by Valispace. If the output Valis are being used as constants in the formulas for computing other Valis, Valispace automatically recalculates every Valis associated with the output Valis.

The Valis referenced in the Simulation Module has a small tag “SIM_OUT” attached next to the name in the Components Module, as shown in the image below.

5. Scripting + Automation Use case

If any input values are being changed in the Components Module, the user has to rerun the simulation to calculate the output values.

To avoid running simulations after every change in the input values, a link can be created between the Automations and the Scripting Module. Indeed, new automation with a constant trigger can be set to automatically rerun every simulation affected by a Vali’s change, as shown in the gif below.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.