Built-in Functions & Exit Rules
Valispace’s Time Sequences Module has some built-in functions that allow you to control your Sequence’s time and previous variables’ values and use them to model your Nodes, Variables, and Exit Rules.
this ( ) function
Using the function this( ) we can use the previous simulation value for the next calculated value in the simulation. This allows you to have the cumulative value of a given variable over time. When this() function is used in the variable formula, a new additional block is added where the user has to add the initial value. Therefore, the system iterates continuously.
It is also possible to use the current time step value within the time sequence variable formula. For example, we can input sin (time) as the time variable formula, which will yield the following:
timestep stores the value set for the Time Step on Settings and can be used on formulas.
flownodetime stores the time since the node started. The time counter is reset every time a new node's initial condition is met.
Exit Rules are predefined conditions that will stop the execution of your Time Sequence at any time if they are met. These rules can be related to time or not. Every Vali or Variable can also be used to create Exit Rules. Here are some examples of Exit Rules using different properties:
Stop the Time Sequence when the capacity of the vehicle’s battery dips below zero
Stop the Time Sequence once the Fuel Consumption exceeds the Mass Flow maximum threshold
Stop the Time Sequence if Power Consumption exceeds a certain value
To create an Exit Rule,
Click on the icon (1), and then a dialogue box opens up on the right side
Select the “Add Exit Rule” (2)
A new popup opens (3) where the user can input their Exit Rule formula
These Exit Rules can be used simultaneously, which means the Time Sequence will run until one of the Exit Rules’ conditions is met.