ScalarInterpolationFileTest
Tests time-based interpolation using data from a CSV file.
This component reads data from a specified CSV file and performs linear interpolation, using the current simulation time as the input. The interpolated value is made available through the output variable y. The component utilizes a dataset structure that identifies dependent and independent variables from the CSV file, allowing for flexible time-series data interpolation.
Usage
ScalarInterpolationFileTest()
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
filepath | Dataset configuration specifying the CSV file path and variable mappings | – | "data/interp_square_data.csv" |
independent_var | – | "ts" | |
dependent_var | – | "data" |
Variables
| Name | Description | Units |
|---|---|---|
y | Output variable that holds the interpolated value | – |
Behavior
Source
# Tests time-based interpolation using data from a CSV file.
#
# This component reads data from a specified CSV file and performs linear interpolation, using the
# current simulation time as the input. The interpolated value is made available through the output
# variable `y`. The component utilizes a dataset structure that identifies dependent and independent
# variables from the CSV file, allowing for flexible time-series data interpolation.
test component ScalarInterpolationFileTest
# Interpolation object that performs the actual interpolation calculation
interp = ScalarInterpolation(interpolation_type = "LinearInterpolation", filepath = filepath, independent_var = independent_var, dependent_var = dependent_var)
# Dataset configuration specifying the CSV file path and variable mappings
structural filepath::String = "data/interp_square_data.csv"
structural independent_var::String = "ts"
structural dependent_var::String = "data"
# Output variable that holds the interpolated value
variable y::Real
relations
interp.u = time
interp.y = y
metadata {"Dyad": {"tests": {"case1": {"stop": 0.1, "expect": {"signals": ["y"]}}}}}
endFlattened Source
# Tests time-based interpolation using data from a CSV file.
#
# This component reads data from a specified CSV file and performs linear interpolation, using the
# current simulation time as the input. The interpolated value is made available through the output
# variable `y`. The component utilizes a dataset structure that identifies dependent and independent
# variables from the CSV file, allowing for flexible time-series data interpolation.
test component ScalarInterpolationFileTest
# Interpolation object that performs the actual interpolation calculation
interp = ScalarInterpolation(interpolation_type = "LinearInterpolation", filepath = filepath, independent_var = independent_var, dependent_var = dependent_var)
# Dataset configuration specifying the CSV file path and variable mappings
structural filepath::String = "data/interp_square_data.csv"
structural independent_var::String = "ts"
structural dependent_var::String = "data"
# Output variable that holds the interpolated value
variable y::Real
relations
interp.u = time
interp.y = y
metadata {"Dyad": {"tests": {"case1": {"stop": 0.1, "expect": {"signals": ["y"]}}}}}
endTest Cases
Test Case case1
@example
pltRelated
Examples
Experiments
Analyses
Tests