Datasets Functions
Often, parameters of Blocks and parts are not single values but vary over time or voltage, or any other dimension. Requirements Portal handles two-dimensional parameters with Datasets and Functions. Datasets are point-wise specifications of a varying Vali and Functions are defined by a formula and a variable range (which can also be from minus infinity to infinity). Datasets and Functions can be used in calculations and formulas of other Valis as usual, and the results will be new Datasets or Functions. They can also be evaluated at a certain point where the value is well defined, e.g. Mass (5), where Mass is time-dependent (unit=s), results in the value of Mass at time T = 5s.
Datasets
Datasets are point-wise specifications of a varying Vali. Datasets can also be measurements added to a Vali for reference. When creating a Vali, select Dataset in the Create Property window. Once a dataset Vali is created, you can enter the X-axis or Y-axis values on the Vali's Info tab. Add points to the dataset by adding new rows using the add row control below the table. You can also import values from CSV or XLSX
The variable will by default have the name X and no unit. You can change the name by clicking on the current name and typing a new name. You can change the unit using the X unit field in the dataset's Properties region.
Interpolation and Extrapolation
Interpolation and extrapolation decide the values of the Vali between and beyond the specified points. It is used when datasets are used in calculations and evaluated.
Interpolation can be:
-
No interpolation – values are not defined between the points
-
Stepwise interpolation – constant value between points
-
Linear interpolation – linear function between points
Extrapolation can be:
-
Ignore values outside of the range – values are not defined outside of the data points range
-
Assume values outside of the range as 0 – values are all 0 outside of the data points range
-
Same value as last available point – the values are constant outside of the data points range, defined by the first and last specified point
-
Continue the interpolation – same extrapolation as specified interpolation
Calculating with Datasets
When adding a dataset to a Vali, the formula will automatically be changed to average_of_datasets(), which means that the result of the Vali used in calculations is the dataset. The Vali can be used in normal calculations, e.g. Car.mass = sum_of_children() will sum up the masses of the sub Blocks and if one of the sub Blocks' masses is time-dependent Car.mass will also become time-dependent. Mathematical operations on datasets always do the operation point-wise, e.g., sqrt(Car.mass) will take the square root of each data point and the result itself will be a dataset.
Functions
Valis can be a function by defining a formula dependent on a function variable, such as vali = 2*X + 4. X is a function variable with a name and unit. The function variable can be valid in its full (infinite) range or can be limited so that the function is only valid between a minimum and maximum value.
Function Variables
Function variables must start with a capital letter. X, T, and Time are valid function variables while time is not. The name of the function variable is global throughout all Valis, meaning that if X is used in one function, it is the same X used in another function.
Calculating with Functions
Functions can be calculated within the normal calculation. As an example, if Vali1 = X^2 and Vali2 = 2*X, then Vali3 = $Vali1 + $Vali2 will result in the function X^2 + 2*X. If two Valis with different variables are used in a calculation the result will be a multi-dimensional function.
Valis are functions that can be evaluated at any valid point of the function variable. For example, if Vali1 = X^2 you can specify Vali2 = $Vali1(1) which results in Vali2 = 1.
