---
url: /dyad/dev/stdlib/BlockComponents/tests/Tables.Tests.InterpolationFile.md
description: >-
  Dyad Tables.Tests.InterpolationFile docs.  Tests time-based interpolation
  using data from a CSV file.
---

# `Tables.Tests.InterpolationFile` {#Tables.Tests.InterpolationFile}

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 {#Usage}

`BlockComponents.Tables.Tests.InterpolationFile()`

## Parameters: {#Parameters:}

|      Name |                                                              Description | Units |             Default value |
| ---------:| ------------------------------------------------------------------------:| -----:| -------------------------:|
| `dataset` | Dataset configuration specifying the CSV file path and variable mappings |     – | DyadTimeser...t_var="ts") |

## Variables {#Variables}

| Name |                                       Description | Units |
| ----:| -------------------------------------------------:| -----:|
|  `y` | Output variable that holds the interpolated value |     – |

## Behavior {#Behavior}

Behavior of this component cannot be rendered because it includes `path` variables.

## Source {#Source}

```dyad
"""
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 InterpolationFile
  "Interpolation object that performs the actual interpolation calculation"
  interp = BlockComponents.Tables.Interpolation(interpolation_type = InterpolationType.LinearInterpolation(), dataset = dataset) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 130, "y1": 110, "x2": 230, "y2": 210, "rot": 0}
      }
    }
  }
  "Dataset configuration specifying the CSV file path and variable mappings"
  structural parameter dataset::DyadData.DyadTimeseries = DyadTimeseries("dyad://BlockComponents/data/interp_square_data.csv", dependent_vars = ["data"], independent_var = "ts")
  "Output variable that holds the interpolated value"
  variable y::Real
relations
  interp.u = time
  interp.y = y
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {"case1": {"stop": 0.1, "expect": {"signals": ["y"]}}},
    "doc": {"behavior": false}
  }
}
end
```

```dyad
"""
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 InterpolationFile
  "Interpolation object that performs the actual interpolation calculation"
  interp = BlockComponents.Tables.Interpolation(interpolation_type = InterpolationType.LinearInterpolation(), dataset = dataset) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 130, "y1": 110, "x2": 230, "y2": 210, "rot": 0}
      }
    }
  }
  "Dataset configuration specifying the CSV file path and variable mappings"
  structural parameter dataset::DyadData.DyadTimeseries = DyadTimeseries("dyad://BlockComponents/data/interp_square_data.csv", dependent_vars = ["data"], independent_var = "ts")
  "Output variable that holds the interpolated value"
  variable y::Real
relations
  interp.u = time
  interp.y = y
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {"case1": {"stop": 0.1, "expect": {"signals": ["y"]}}},
    "doc": {"behavior": false}
  }
}
end
```

## Test Cases {#Test-Cases}

### Test Case `case1` {#Test-Case-case1}

```julia
plt
```

![](nvnleje.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Interpolation`](Tables.Tests.InterpolationFile.md)
