Fan Tutorial Part IV - Time Sequence
As you have defined the modes of your system, let’s now explore a more advanced feature: the Time Sequence.
In this tutorial, you can simulate your mode-dependent Valis over time. Using time sequences, the user can calculate scenarios such as battery state or propellant’s mass over time, etc. Then, we will create a scenario to calculate the power consumed by our fan for a day (24 hours) where the fan modes are changed linearly.
The initial state of the fan is the OFF mode
After 8 hours, the state of the fan is in MIN mode (till 12 hours)
During lunch, the fan state is back to OFF mode
After one hour of lunch break (from 13 hours), the state of the fan is set to MAX mode
After 17 hours, the fan is reverted to OFF mode
With these conditions, we will now see how to calculate the power consumption over 24 hours.
(1) Creating a Time Sequence
Click on the Time Sequences Module on the left side (1)
Upon entering the time sequence module, click on the
+ Add Time Sequence
(2)A new tab opens, and you can now enter the name of the time sequence (e.g. Office_UseCase)
Creating a Time Sequence
(2) Adding Modes to the Modelists
Once the time sequence is created, the next step is to add the modes related to our time sequence. In this tutorial, we will be using the fan’s modes. To add the modes to the system:
Click on the
+
on the bottom right corner to have the optionAdd Modelist
. Click on it and select theFan.states
mode from the listPlease note that there is an option for an
initial mode
; automatically set toOFF
here. For this scenario, we will keep it as it isThe former steps are demonstrated in the gif below. Upon adding the modes, you can check in the run section if the modes are added
Adding Modes to the Time Sequences
You can also add the modes to the time sequence in the run section. For example, if you want to see how your child’s modes change regarding the Fan.states modes, you can add them and see the modifications.
(3) Defining Nodes
First, we have set our modes. Now, we will define nodes that can either change a mode, change its formula or implement a delay in its activation. In this example, we will study the “change mode”. We will use it to simulate the following scenario:
The initial state of the fan is the OFF mode
After 8 hours, the state of the fan is in MIN mode (till 12 hours)
During lunch, the fan state is back to OFF mode
After one hour of lunch break (from 13 hours), the state of the fan is set to MAX mode
After 17 hours, the fan is reverted to OFF mode
Click on
+
on the setup pageAdding the first node to your time sequence
Note: since we have initially set that our initial mode is Fan.state.OFF
, we don’t need to create a node for the OFF condition as the system is already in the OFF state.
Clicking on
+
on the setup page will open a “New Node” tab. Enter the following details:Node type:
Change Mode
Mode:
Fan.states.Min
Start condition:
time>=8hours
And click on
Create
Defining Node properties
Similarly, create the other three nodes for OFF, MAX, and OFF with the following details:
OFF | MAX | OFF |
---|---|---|
|
|
|
After completing all the previous steps, the final setup of the time sequence should look like the image below:

Final configuration of our time sequences
(4) Defining the Run settings of the Time Sequence
Since we will compute our simulation for 24 hours, we will set up our run settings. Click on the Run
button next to the step and select the setting icon. Enter the following information, shown in the gif:

Defining the run settings
Time sequence display unit =
hours
Max execution time =
24 hours
Time step =
1 hour
Storage time step =
1 hour
Once you have specified the Run settings, click on > Run
(1) to compute the value. After running the time sequence, you will get a timeline similar to the one below (with different colour codes).

(5) Adding Variables to compute the scenario
Our goal for this tutorial is to calculate how much power is consumed by our ValiFan in 24 hours. We added the simulation steps previously. Now, we have to add the Vali we would like to calculate overtime. In our case, it is the Power_consumption
Vali of the fan. So let’s add this Vali to the variable list.
Click on the “+” on the bottom right corner and select the option
Add Variable
On the tab that opened, enter the name “Power Consumption”
In the formula column, you must choose the mode-dependent Vali, the fan.power_consumption. Type “$”, and then you will have a list of options. Select the Fan.PowerConsumption Vali
Select the option
Value over time and Integral
and click onCreate
Once you have added the variable,
Run
the time sequences. It should take a few seconds to complete.
The above steps are shown in the gif below.

Adding Variables to the time sequence and rerunning the simulations
While selecting the Vali, select the mode-dependent Vali. Don’t select a normal Vali; otherwise, it will give errors.
Once the time sequence is computed, two graphs automatically show the power consumption over time and an integral graph.

Results of your time sequence
(6) Inbuilt functions and Exit Rule
Congratulations on creating your first-time sequence! Let’s now add some spice to this calculation. For example, let’s say you want to have a battery attached to your fan and calculate how long your battery lasts. We want to stop the simulation when the battery power goes to zero.
To respect the above condition, we will use this() and an exit rule to do our calculation. Let’s use the “this()” function and see the results.
The first step would be to create a new variable. Like earlier, click on “Add Variable”.
Once the tab is opened, enter the name “Batterystate_over_time”
In the formula, type “this()”. This() is an in-built function in Valispace. Using the function this( ), we can consider the previous simulation value for the next value calculated in the simulation. This() allows you to have the cumulative value of a given variable over time
Note that once you add this() in the formula, a new input, “Initial Value “, is created. You can either input a Vali from the Components Module or a number. For our case, we will add the “initial value” as 20W
In the formula, add the following “this() - PowerConsumption/Fan.PowerConsumption”. Don’t forget to use “$” while selecting the mode-dependent Vali. Here, we are subtracting the value from the initial value
Click “Update “and rerun the time sequences. The result would be similar to the image below:
When you look at the results, you can see that the battery consumption is still running even after zero. Therefore, we will now define the Exit Rule to stop the simulation. To add the Exit Rule, follow these steps:
Click on the icon “X” next to the settings menu
Upon clicking, a sidebar opens. Click on the “+ Add Exit Rule”
Input the following rule $batterystate_over_time <= 0. Note that when you type “$”, Valispace shows the list of Valis in the project. Make sure to select batterystate_over_time within the Time Sequence Module
You can see when the Exit Rule occurs in the variables and the Run settings.

Wohooo!! Congratulations on your first creation of time sequences and the fan tutorials’ completion.
Want to improve your time sequences? Try the following options:
Add the child’s modes to your time sequence, e.g. fan motor speed settings, and speed controller speed modes
Force a change of your child’s modes despite the mode links and see how your system behaves over time