---
title: "CreateDataSystemModel"
language: "en"
type: "Symbol"
summary: "CreateDataSystemModel[{v1, v2, ...}] creates a SystemModel generating a signal of values vi. CreateDataSystemModel[{{t1, v1}, ...}] creates a model for the time-value pairs {ti, vi}. CreateDataSystemModel[obj] creates a model for the TimeSeries or InterpolatingFunction obj. CreateDataSystemModel[fun, tmin, tmax] creates a model with samples from the function fun between tmin and tmax. CreateDataSystemModel[data, dspec] creates a model with data specification dspec."
keywords: 
- modelica
- SystemModeler
- SystemModeler link
- create model
- create
- block
- component
- component model
- data model
- data
- source
canonical_url: "https://reference.wolfram.com/language/ref/CreateDataSystemModel.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "System Model Creation"
    link: "https://reference.wolfram.com/language/guide/SystemModelCreation.en.md"
  - 
    title: "System Modeling Overview"
    link: "https://reference.wolfram.com/language/guide/SystemModelingOverview.en.md"
related_functions: 
  - 
    title: "CreateSystemModel"
    link: "https://reference.wolfram.com/language/ref/CreateSystemModel.en.md"
  - 
    title: "SystemModelSimulate"
    link: "https://reference.wolfram.com/language/ref/SystemModelSimulate.en.md"
  - 
    title: "ConnectSystemModelComponents"
    link: "https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.en.md"
---
[EXPERIMENTAL]

# CreateDataSystemModel

CreateDataSystemModel[{v1, v2, …}] creates a SystemModel generating a signal of values vi. 

CreateDataSystemModel[{{t1, v1}, …}] creates a model for the time-value pairs {ti, vi}.

CreateDataSystemModel[obj] creates a model for the TimeSeries or InterpolatingFunction obj. 

CreateDataSystemModel[fun, tmin, tmax] creates a model with samples from the function fun between tmin and tmax.

CreateDataSystemModel[data, "dspec"] creates a model with data specification "dspec".

## Details and Options

* ``CreateDataSystemModel`` will create an interpolated curve that is typically used as flexible input to other models.

* ``CreateDataSystemModel`` returns a ``SystemModel[…]`` object that can be connected to other models.

* ``CreateDataSystemModel["NewModel", …]`` gives the created model the name ``"NewModel"``.

* ``CreateDataSystemModel["PackageA.NewModel", …]`` inserts ``"NewModel"`` into ``"PackageA"``.

* The following options can be given:

|                         |           |                       |
| ----------------------- | --------- | --------------------- |
| InterpolationOrder      | Automatic | interpolation order   |
| SamplingPeriod          | Automatic | time between samples  |
| GeneratedAssetLocation  | None      | location of data file |

* Default values of ``InterpolationOrder`` according to input:

|                                   |           |
| --------------------------------- | --------- |
| {v1, v2, …}, {{t1, v1}, …}        | 1         |
| TimeSeries, InterpolatingFunction | preserved |
| fun                               | 3         |

* For a list of values ``vi``, ``SamplingPeriod`` defaults to ``1``.

* Sample points in ``TimeSeries`` and ``InterpolatingFunction`` are preserved.

* Possible ``"dspec"`` values include:

|        |                                           |
| ------ | ----------------------------------------- |
| "Time" | time column and value columns             |
| "1D"   | argument column and value columns         |
| "2D"   | arguments row and column and value matrix |

* The corresponding data arrays have the layouts given here:

[image]

* The default ``"dspec"`` is ``"Time"``.

---

## Examples (32)

### Basic Examples (3)

Create a model from a list of time-value pairs:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= model = CreateDataSystemModel[data]

Out[2]= [image]
```

Simulate and plot the output of the data model:

```wl
In[3]:= sim = SystemModelSimulate[model, 10]

Out[3]=
SystemModelSimulationData["/tmp/WolframSystemModeler-secavarat-14.3/WL/wsml_WYcaYfYYcYYYfYYfcbYbbdY\
YYfbYabYee_lsim_77788_45790_50878645929018726998883569900_1.mat", 
 "UnnamedModels.WL.W6ca5f61c068f47fcb6bbd289fb7ab2ee", 1, {0., 10.}, "/tmp/Wolfr ... -6, "DisplayTimeUnit" -> None, "Epoch" -> None, 
  "DisplayTimeZone" -> Automatic, "InterpolationPoints" -> 2000, "Method" -> Automatic, 
  "StepSize" -> 0, "SynchronizeWithRealTime" -> False, "SimulationRate" -> 1., 
  "CommunicationRate" -> 20]]

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

Create a model from a ``TimeSeries`` :

```wl
In[1]:= ts = TimeSeries[{{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}}]

Out[1]=
TemporalData[TimeSeries, {{{6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9}}, {{0, 10, 1}}, 1, {"Continuous", 1}, 
  {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, 
   ValueDimensions -> 1}}, False, 14.3]

In[2]:= model = CreateDataSystemModel[ts];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

Create a data model of a sampled function between ``0`` and ``10`` seconds:

```wl
In[1]:= model = CreateDataSystemModel[Sin, 0, 10];
```

Simulate and plot the output:

```wl
In[2]:= sim = SystemModelSimulate[model, 10];

In[3]:= SystemModelPlot[sim, "y[1]"]

Out[3]= [image]
```

### Scope (18)

#### Value Lists (4)

Create a data model from a list of values:

```wl
In[1]:= data = {6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9};

In[2]:= model = CreateDataSystemModel[data];
```

The sample interval is assumed to be 1 second:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

Specify a custom sampling period:

```wl
In[1]:= data = {6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9};

In[2]:= model = CreateDataSystemModel[data, SamplingPeriod -> 0.1];
```

Simulate for 1 second and plot:

```wl
In[3]:= sim = SystemModelSimulate[model, 1];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

Use a custom ``InterpolationOrder`` :

```wl
In[1]:= data = {6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9};

In[2]:= model = CreateDataSystemModel[data, InterpolationOrder -> 0];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

``SparseArray`` is interpreted as the corresponding ``Normal`` array:

```wl
In[1]:= s = SparseArray[{{1} -> 1, {2} -> 3, {5} -> 2, {7} -> 1}];

In[2]:= model = CreateDataSystemModel[s];
```

The sample interval is assumed to be 1 second:

```wl
In[3]:= sim = SystemModelSimulate[model, 7];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

#### Time-Value Pairs (3)

Create a model from a list of time-value pairs:

```wl
In[1]:= data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= model = CreateDataSystemModel[data];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

Use a custom ``InterpolationOrder`` :

```wl
In[1]:= data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= model = CreateDataSystemModel[data, InterpolationOrder -> 0];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

Create data with multiple values for each time point:

```wl
In[1]:= data = {{0, 8, 4}, {1, 5, 2}, {2, 9, 6}, {3, 10, 2}, {4, 4, 1}, {5, 0, 4}, {6, 6, 8}, {7, 3, 6}, {8, 1, 3}, {9, 0, 1}, {10, 6, 1}};

In[2]:= model = CreateDataSystemModel[data];
```

Simulate and plot the two output curves:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, {"y[1]", "y[2]"}]

Out[4]= [image]
```

#### TimeSeries (3)

Create a data model from a ``TimeSeries`` :

```wl
In[1]:= ts = TimeSeries[{{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}}]

Out[1]=
TemporalData[TimeSeries, {{{6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9}}, {{0, 10, 1}}, 1, {"Continuous", 1}, 
  {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, 
   ValueDimensions -> 1}}, False, 14.3]

In[2]:= model = CreateDataSystemModel[ts];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

The ``InterpolationOrder`` from the ``TimeSeries`` is preserved:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= ts = TimeSeries[data, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]

Out[2]=
TemporalData[TimeSeries, {{{6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9}}, {{0, 10, 1}}, 1, {"Discrete", 1}, 
  {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}, 
   ValueDimensions -> 1}}, False, 14.3]

In[3]:= model = CreateDataSystemModel[ts];
```

Simulate and plot the output:

```wl
In[4]:= sim = SystemModelSimulate[model, 10];

In[5]:= SystemModelPlot[sim, "y[1]"]

Out[5]= [image]
```

---

Override the ``InterpolationOrder`` when creating a data model:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= ts = TimeSeries[data, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]

Out[2]=
TemporalData[TimeSeries, {{{6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9}}, {{0, 10, 1}}, 1, {"Discrete", 1}, 
  {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}, 
   ValueDimensions -> 1}}, False, 14.3]

In[3]:= model = CreateDataSystemModel[ts, InterpolationOrder -> 3];
```

Simulate and plot the output:

```wl
In[4]:= sim = SystemModelSimulate[model, 10];

In[5]:= SystemModelPlot[sim, "y[1]"]

Out[5]= [image]
```

#### InterpolatingFunction (2)

Create a model from an ``InterpolatingFunction`` :

```wl
In[1]:= data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= if = Interpolation[data];

In[3]:= model = CreateDataSystemModel[if];
```

Simulate and plot the output:

```wl
In[4]:= sim = SystemModelSimulate[model, 10];

In[5]:= SystemModelPlot[sim, "y[1]"]

Out[5]= [image]
```

---

Resample an ``InterpolatingFunction`` before creating the model:

```wl
In[1]:= data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= if = Interpolation[data];

In[3]:= model = CreateDataSystemModel[if, SamplingPeriod -> 2];
```

Simulate and plot the output:

```wl
In[4]:= sim = SystemModelSimulate[model, 10];

In[5]:= SystemModelPlot[sim, "y[1]"]

Out[5]= [image]
```

#### Functions (3)

Create a data model of a function sampled for 10 seconds:

```wl
In[1]:= model = CreateDataSystemModel[Cos, 0, 10];
```

The sample points are automatically determined:

```wl
In[2]:= sim = SystemModelSimulate[model, 10];

In[3]:= SystemModelPlot[sim, "y[1]"]

Out[3]= [image]
```

---

Choose the ``InterpolationOrder`` :

```wl
In[1]:= model = CreateDataSystemModel[Cos, 0, 10, InterpolationOrder -> 0];
```

Simulate and plot 2 seconds of the data output to show the interpolation order:

```wl
In[2]:= sim = SystemModelSimulate[model, 2];

In[3]:= SystemModelPlot[sim, "y[1]"]

Out[3]= [image]
```

---

Set the sampling period when creating the model:

```wl
In[1]:= model = CreateDataSystemModel[Cos, 0, 10, InterpolationOrder -> 1, SamplingPeriod -> 1];
```

Simulate and plot the output:

```wl
In[2]:= sim = SystemModelSimulate[model, 10];

In[3]:= SystemModelPlot[sim, "y[1]"]

Out[3]= [image]
```

#### Data Specification (3)

Create a data model that takes time and interpolates it over two value columns:

```wl
In[1]:= data = {#, Cos[#], Sin[#]}& /@ Range[0, 2π, 0.1];
```

Show the first rows of the data:

```wl
In[2]:= Take[data, 5]//MatrixForm

Out[2]//MatrixForm=
(⁠|     |          |           |
| --- | -------- | --------- |
| 0.  | 1.       | 0.        |
| 0.1 | 0.995004 | 0.0998334 |
| 0.2 | 0.980067 | 0.198669  |
| 0.3 | 0.955336 | 0.29552   |
| 0.4 | 0.921061 | 0.389418  |⁠)
```

Create a model that uses time to interpolate over the data:

```wl
In[3]:= model = CreateDataSystemModel[data, "Time"];
```

Simulate the model:

```wl
In[4]:= sim = SystemModelSimulate[model, π];
```

Plot the interpolated variables:

```wl
In[5]:= SystemModelPlot[sim, {"y[1]", "y[2]"}]

Out[5]= [image]
```

---

Create a data model that takes an input and interpolates it over two value columns:

```wl
In[1]:= data = {#, Cos[#], Sin[#]}& /@ Range[0, 2π, 0.1];
```

Show the first rows of the data:

```wl
In[2]:= Take[data, 5]//MatrixForm

Out[2]//MatrixForm=
(⁠|     |          |           |
| --- | -------- | --------- |
| 0.  | 1.       | 0.        |
| 0.1 | 0.995004 | 0.0998334 |
| 0.2 | 0.980067 | 0.198669  |
| 0.3 | 0.955336 | 0.29552   |
| 0.4 | 0.921061 | 0.389418  |⁠)
```

Create a model with the data:

```wl
In[3]:= model = CreateDataSystemModel[data, "1D"];
```

Simulate with an input that samples the data at twice the speed of time:

```wl
In[4]:= sim = SystemModelSimulate[model, π, <|"Inputs" -> {"u" -> Function[t, 2t]}|>];
```

Plot the interpolated variables:

```wl
In[5]:= SystemModelPlot[sim, {"y[1]", "y[2]"}]

Out[5]= [image]
```

---

Create a data model that takes two scalar inputs and runs them through a bivariate interpolation:

```wl
In[1]:=
data = (⁠|     |     |     |     |     |
| --- | --- | --- | --- | --- |
| 0.0 | 0.1 | 0.2 | 0.3 | 0.4 |
| 0.1 | 0.3 | 0.5 | 0.7 | 0.9 |
| 0.2 | 0.4 | 0.6 | 0.8 | 1.0 |
| 0.3 | 0.5 | 0.7 | 0.9 | 1.1 |
| 0.4 | 0.6 | 0.8 | 1.0 | 1.2 |⁠);
```

Split coordinates and values to show the data in a 3D plot:

```wl
In[2]:= xcoords = data[[2 ;; , 1]];

In[3]:= ycoords = data[[1, 2 ;; ]];

In[4]:= values = data[[2 ;; , 2 ;; ]];
```

Show the data points:

```wl
In[5]:= points = Join@@Table[{xcoords[[x]], ycoords[[y]], values[[x, y]]}, {x, Length[xcoords]}, {y, Length[ycoords]}];

In[6]:= p1 = ListPointPlot3D[points]

Out[6]= [image]
```

Create a model with the data:

```wl
In[7]:= model = CreateDataSystemModel[data, "2D"];
```

Simulate with inputs:

```wl
In[8]:= inputx = Function[t, 0.2  + 0.4t Cos[50 t]];

In[9]:= inputy = Function[t, 0.2  + 0.4t Sin[50 t]];

In[10]:= sim = SystemModelSimulate[model, 0.3, <|"Inputs" -> {"u1" -> inputx, "u2" -> inputy}|>];
```

Plot the interpolation results together with the original data:

```wl
In[11]:= p2 = ParametricPlot3D[{inputx[t], inputy[t], sim["y", t]}, {t, 0, 0.3}];

In[12]:= Show[p1, p2]

Out[12]= [image]
```

### Options (7)

#### InterpolationOrder (3)

An ``InterpolationOrder`` of ``0`` gives constant segments between samples:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};

In[2]:= model = CreateDataSystemModel[data, InterpolationOrder -> 0];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 5];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

An ``InterpolationOrder`` of ``1`` gives straight lines between samples:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};

In[2]:= model = CreateDataSystemModel[data, InterpolationOrder -> 1];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 5];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

An ``InterpolationOrder`` of ``3`` gives a smooth line with a continuous derivative:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};

In[2]:= model = CreateDataSystemModel[data, InterpolationOrder -> 3];
```

Simulate and plot the output:

```wl
In[3]:= sim = SystemModelSimulate[model, 5];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

#### SamplingPeriod (3)

For a list of data, ``SamplingPeriod`` determines the period between data points:

```wl
In[1]:= data = {6, 9, 1, 9, 7, 6};

In[2]:= model = CreateDataSystemModel[data, SamplingPeriod -> 2];
```

The output has 2-second-long linear sections between samples:

```wl
In[3]:= sim = SystemModelSimulate[model, 10];

In[4]:= SystemModelPlot[sim, "y[1]"]

Out[4]= [image]
```

---

For a function, ``SamplingPeriod`` determines how often a function is sampled:

```wl
In[1]:= model1 = CreateDataSystemModel[Sin, 0, 10, SamplingPeriod -> 0.5, InterpolationOrder -> 0];

In[2]:= model2 = CreateDataSystemModel[Sin, 0, 10, SamplingPeriod -> 2, InterpolationOrder -> 0];
```

Simulate with sampling periods of 0.5 and 2 seconds:

```wl
In[3]:= sim1 = SystemModelSimulate[model1, 10];

In[4]:= sim2 = SystemModelSimulate[model2, 10];
```

Compare the output for each simulation:

```wl
In[5]:= SystemModelPlot[{sim1, sim2}, "y[1]"]

Out[5]= [image]
```

---

For a ``TimeSeries``, ``SamplingPeriod`` resamples uniformly:

```wl
In[1]:= data = {{0, 5}, {1, 4}, {2, 2}, {3, 9}, {4, 1}, {5, 9}, {6, 4}, {7, 3}, {8, 9}, {9, 2}, {10, 0}};

In[2]:= ts = TimeSeries[data]

Out[2]=
TemporalData[TimeSeries, {{{5, 4, 2, 9, 1, 9, 4, 3, 9, 2, 0}}, {{0, 10, 1}}, 1, {"Continuous", 1}, 
  {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, 
   ValueDimensions -> 1}}, False, 14.3]

In[3]:= ListLinePlot[ts]

Out[3]= [image]
```

Downsample the time series when creating the data model:

```wl
In[4]:= model = CreateDataSystemModel[ts, SamplingPeriod -> 3];
```

Simulate and plot the output:

```wl
In[5]:= sim = SystemModelSimulate[model, 10];

In[6]:= SystemModelPlot[sim, "y[1]"]

Out[6]= [image]
```

#### GeneratedAssetLocation (1)

Data is stored in the model by default:

```wl
In[1]:= model = CreateDataSystemModel[Range[3]];

In[2]:= model["ModelicaDisplay"]

|     |
| :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| model Wdfd6115b27624260bcabdd9c67b2244e |
|   extends Modelica.Blocks.Sources.CombiTimeTable(table = {{0., 1}, {1., 2}, {2., 3}}, smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments); |
| end Wdfd6115b27624260bcabdd9c67b2244e; |
```

Use ``GeneratedAssetLocation`` to export a data file to a specified location referenced by the model:

```wl
In[3]:= model = CreateDataSystemModel[Range[3], GeneratedAssetLocation -> FileNameJoin[{$TemporaryDirectory, "data.txt"}]];

In[4]:= model["ModelicaDisplay"]

|     |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| model Wf786cf8f4cf64e47bec255c348310e27 |
|   extends Modelica.Blocks.Sources.CombiTimeTable(tableOnFile = true, fileName = Modelica.Utilities ... bleName = "table1", columns = 2:2, smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments); |
| end Wf786cf8f4cf64e47bec255c348310e27; |
```

### Applications (1)

Create a data model with noisy output for 5 seconds:

```wl
In[1]:= noise = CreateDataSystemModel[RandomFunction[WienerProcess[], {0., 5, 5 / 400}]];
```

Connect it to a lowpass filter:

```wl
In[2]:= filteredModel = ConnectSystemModelComponents[{"noise"∈noise, "filter"∈"Modelica.Blocks.Continuous.LowpassButterworth"}, {"noise.y[1]" -> "filter.u"}]

Out[2]= [image]
```

Simulate the filtering model:

```wl
In[3]:= sim = SystemModelSimulate[filteredModel, 5]

Out[3]=
SystemModelSimulationData["/tmp/WolframSystemModeler-secavarat-14.3/WL/wsml_WYYYYYdceYYcaYcYdYcfYff\
YYYYYYYYYY_lsim_77788_45790_50878645927561203538974263560_1.mat", 
 "UnnamedModels.WL.W50540dce28ca4c7d9cf0ff9553164696", 8, {0., 5.}, "/tmp/Wolfra ... -6, 
  "DisplayTimeUnit" -> None, "Epoch" -> None, "DisplayTimeZone" -> Automatic, 
  "InterpolationPoints" -> 2000, "Method" -> Automatic, "StepSize" -> 0, 
  "SynchronizeWithRealTime" -> False, "SimulationRate" -> 1., "CommunicationRate" -> 20]]
```

Show the signal before and after filtering:

```wl
In[4]:= SystemModelPlot[sim, {"filter.u", "filter.y"}]

Out[4]= [image]
```

### Properties & Relations (2)

Insert created model in a package:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};

In[2]:= CreateDataSystemModel["MyPackage.DataModel", data];

In[3]:= CreateDataSystemModel["MyPackage.TimeSeriesModel", TimeSeries[data]];
```

The package contains both created models:

```wl
In[4]:= SystemModels["MyPackage.*"]

Out[4]= {[image], [image]}
```

---

Export as a file for use in a ``"CombiTimeTable"`` Modelica component:

```wl
In[1]:= data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};

In[2]:= Export[FileNameJoin[{$TemporaryDirectory, "data.txt"}], {"var1", data}, "MCTT"]

Out[2]= "/tmp/data.txt"
```

### Possible Issues (1)

Larger datasets in the model may lead to slower simulations:

```wl
In[1]:= data = Table[{t, RandomReal[10]}, {t, 0, 1000}];

In[2]:= dataModel = CreateDataSystemModel[data];

In[3]:= AbsoluteTiming[SystemModelSimulate[dataModel, 1000]]

Out[3]=
{3.13882, SystemModelSimulationData["/tmp/WolframSystemModeler-secavarat-14.3/WL/wsml_WYYYfYYdYYYYbYYbYbYadeY\
YYYfYYYYbY_lsim_77788_45790_50878645925962124524780899043_1.mat", 
 "UnnamedModels.WL.W437f32d6722b41b9b1ade4678f2067b4", 1, {0., 1000.}, ... 6, "DisplayTimeUnit" -> None, "Epoch" -> None, 
  "DisplayTimeZone" -> Automatic, "InterpolationPoints" -> 2000, "Method" -> Automatic, 
  "StepSize" -> 0, "SynchronizeWithRealTime" -> False, "SimulationRate" -> 1., 
  "CommunicationRate" -> 20]]}
```

Simulating with data exported using [`MCTT`](https://reference.wolfram.com/language/ref/format/MCTT.en.md) ``Export`` is faster:

```wl
In[4]:= fileModel = "DocumentationExamples.Simulation.FileInput";

In[5]:= AbsoluteTiming[SystemModelSimulate[fileModel, 1000]]

Out[5]=
{1.95786, SystemModelSimulationData["/tmp/WolframSystemModeler-secavarat-14.3/WL/wsml_FileInput_lsim_77788_45\
790_50878645917501431476920787831_1.mat", "DocumentationExamples.Simulation.FileInput", 1, 
 {0., 1000.}, 
 "/tmp/WolframSystemModeler-se ... 6, "DisplayTimeUnit" -> None, "Epoch" -> None, 
  "DisplayTimeZone" -> Automatic, "InterpolationPoints" -> 2000, "Method" -> Automatic, 
  "StepSize" -> 0, "SynchronizeWithRealTime" -> False, "SimulationRate" -> 1., 
  "CommunicationRate" -> 20]]}
```

Use ``GeneratedAssetLocation`` to export a data file to a specified location referenced by the model:

```wl
In[6]:= assetModel = CreateDataSystemModel[data, GeneratedAssetLocation -> FileNameJoin[{$TemporaryDirectory, "data.txt"}]];

In[7]:= AbsoluteTiming[SystemModelSimulate[assetModel, 1000]]

Out[7]=
{2.33128, SystemModelSimulationData["/tmp/WolframSystemModeler-secavarat-14.3/WL/wsml_WbYYYaYYaYYcYYYYYYYYYeY\
cYdYYYYYYY_lsim_77788_45790_50878645925346740119928531439_1.mat", 
 "UnnamedModels.WL.Wb522a61a27c849978276e3c0d5570192", 1, {0., 1000.}, ... 6, "DisplayTimeUnit" -> None, "Epoch" -> None, 
  "DisplayTimeZone" -> Automatic, "InterpolationPoints" -> 2000, "Method" -> Automatic, 
  "StepSize" -> 0, "SynchronizeWithRealTime" -> False, "SimulationRate" -> 1., 
  "CommunicationRate" -> 20]]}
```

## See Also

* [`CreateSystemModel`](https://reference.wolfram.com/language/ref/CreateSystemModel.en.md)
* [`SystemModelSimulate`](https://reference.wolfram.com/language/ref/SystemModelSimulate.en.md)
* [`ConnectSystemModelComponents`](https://reference.wolfram.com/language/ref/ConnectSystemModelComponents.en.md)

## Related Guides

* [System Model Creation](https://reference.wolfram.com/language/guide/SystemModelCreation.en.md)
* [System Modeling Overview](https://reference.wolfram.com/language/guide/SystemModelingOverview.en.md)

## Related Links

* [Wolfram System Modeler Documentation](http://reference.wolfram.com/system-modeler/)

## History

* [Introduced in 2018 (11.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn113.en.md) \| [Updated in 2020 (12.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn121.en.md)