InterpolationTableTest
Tests interpolation by applying linear interpolation to a dataset of squares.
This component creates an interpolation object configured with linear interpolation and a dataset containing time values from 0 to 1 and their corresponding squared values. The current simulation time is used as the input to the interpolation, and the interpolated output is assigned to the variable y. The metadata includes a test case that runs until time=1 and verifies the y signal.
Usage
InterpolationTableTest()
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
dataset | Dataset containing time values from 0 to 1 and their squares, with 'ts' as independent variable and 'data' as dependent variable | – | DyadDataset(hcat(0:0.1:1, square(0:0.1:1)), dependent_vars=["data"], independent_var="ts") |
Variables
| Name | Description | Units |
|---|---|---|
y | Output variable that receives the interpolated value | – |
Behavior
Source
# Tests interpolation by applying linear interpolation to a dataset of squares.
#
# This component creates an interpolation object configured with linear interpolation and a dataset
# containing time values from 0 to 1 and their corresponding squared values. The current simulation
# time is used as the input to the interpolation, and the interpolated output is assigned to the
# variable `y`. The metadata includes a test case that runs until time=1 and verifies the `y` signal.
test component InterpolationTableTest
# Interpolation object that performs linear interpolation on the dataset
interp = Interpolation(interpolation_type = LinearInterpolation, dataset = dataset)
# Dataset containing time values from 0 to 1 and their squares, with 'ts' as independent variable and 'data' as dependent variable
structural dataset::DyadDataset = DyadDataset(hcat(0:0.1:1, square(0:0.1:1)), dependent_vars = ["data"], independent_var = "ts")
# Output variable that receives the interpolated value
variable y::Real
relations
interp.u = time
interp.y = y
metadata {"Dyad": {"tests": {"case1": {"stop": 1, "expect": {"signals": ["y"]}}}}}
endFlattened Source
# Tests interpolation by applying linear interpolation to a dataset of squares.
#
# This component creates an interpolation object configured with linear interpolation and a dataset
# containing time values from 0 to 1 and their corresponding squared values. The current simulation
# time is used as the input to the interpolation, and the interpolated output is assigned to the
# variable `y`. The metadata includes a test case that runs until time=1 and verifies the `y` signal.
test component InterpolationTableTest
# Interpolation object that performs linear interpolation on the dataset
interp = Interpolation(interpolation_type = LinearInterpolation, dataset = dataset)
# Dataset containing time values from 0 to 1 and their squares, with 'ts' as independent variable and 'data' as dependent variable
structural dataset::DyadDataset = DyadDataset(hcat(0:0.1:1, square(0:0.1:1)), dependent_vars = ["data"], independent_var = "ts")
# Output variable that receives the interpolated value
variable y::Real
relations
interp.u = time
interp.y = y
metadata {"Dyad": {"tests": {"case1": {"stop": 1, "expect": {"signals": ["y"]}}}}}
endTest Cases
Test Case case1
@example
pltRelated
Examples
Experiments
Analyses
Tests