Skip to content
InterpolationJuliaHubDatasetTest.md

InterpolationJuliaHubDatasetTest

Test time-dependent interpolation of JuliaHub dataset values.

Creates a time-based interpolation from a JuliaHub dataset, integrating the interpolated values to produce the output variable.

The component loads time-series data from a specified JuliaHub dataset and uses quadratic interpolation to approximate the data at simulation time points. The derivative of the output variable is set equal to the interpolated value, causing the output to be the integral of the dataset values.

Usage

InterpolationJuliaHubDatasetTest()

Parameters:

NameDescriptionUnitsDefault value
datasetReference to a dataset stored on JuliaHub, specifying the collection, dataset name, and which variables to extractDyadDataset("juliasimtutorials", "circuit_data", dependent_vars=["ampermeter.i(t)"], independent_var="timestamp")

Variables

NameDescriptionUnits
yOutput variable that integrates the interpolated dataset values

Behavior

interp.u(t)=tinterp.y(t)=dy(t)dtinterp.y(t)=interp.interpolator(interp.u(t))

Source

dyad
# Test time-dependent interpolation of JuliaHub dataset values.
#
# Creates a time-based interpolation from a JuliaHub dataset, integrating the interpolated values to
# produce the output variable.
#
# The component loads time-series data from a specified JuliaHub dataset and uses quadratic
# interpolation to approximate the data at simulation time points. The derivative of the output variable
# is set equal to the interpolated value, causing the output to be the integral of the dataset values.
test component InterpolationJuliaHubDatasetTest
  # Interpolation block configured to use quadratic interpolation on the specified dataset
  interp = Interpolation(interpolation_type=QuadraticInterpolation, dataset=dataset)
  # Reference to a dataset stored on JuliaHub, specifying the collection, dataset name, and which variables to extract
  structural parameter dataset::DyadDataset = DyadDataset("juliasimtutorials", "circuit_data", dependent_vars=["ampermeter.i(t)"], independent_var="timestamp")
  # Output variable that integrates the interpolated dataset values
  variable y::Real
relations
  interp.u = time
  interp.y = der(y)
  initial y = 0
metadata {
  "Dyad": {
    "tests": {"case1": {"start": 0.001, "stop": 0.1, "expect": {"signals": ["y"]}}}
  }
}
end
Flattened Source
dyad
# Test time-dependent interpolation of JuliaHub dataset values.
#
# Creates a time-based interpolation from a JuliaHub dataset, integrating the interpolated values to
# produce the output variable.
#
# The component loads time-series data from a specified JuliaHub dataset and uses quadratic
# interpolation to approximate the data at simulation time points. The derivative of the output variable
# is set equal to the interpolated value, causing the output to be the integral of the dataset values.
test component InterpolationJuliaHubDatasetTest
  # Interpolation block configured to use quadratic interpolation on the specified dataset
  interp = Interpolation(interpolation_type=QuadraticInterpolation, dataset=dataset)
  # Reference to a dataset stored on JuliaHub, specifying the collection, dataset name, and which variables to extract
  structural parameter dataset::DyadDataset = DyadDataset("juliasimtutorials", "circuit_data", dependent_vars=["ampermeter.i(t)"], independent_var="timestamp")
  # Output variable that integrates the interpolated dataset values
  variable y::Real
relations
  interp.u = time
  interp.y = der(y)
  initial y = 0
metadata {
  "Dyad": {
    "tests": {"case1": {"start": 0.001, "stop": 0.1, "expect": {"signals": ["y"]}}}
  }
}
end


Test Cases

Test Case case1

julia
plt