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}.
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".
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}.
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:
- The default "dspec" is "Time".
Examples
open all close allBasic Examples (3)
Create a model from a list of time-value pairs:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};model = CreateDataSystemModel[data]Simulate and plot the output of the data model:
sim = SystemModelSimulate[model, 10]SystemModelPlot[sim, "y[1]"]Create a model from a TimeSeries:
ts = TimeSeries[{{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}}]model = CreateDataSystemModel[ts];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Create a data model of a sampled function between 0 and 10 seconds:
model = CreateDataSystemModel[Sin, 0, 10];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Scope (18)
Value Lists (4)
Create a data model from a list of values:
data = {6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9};model = CreateDataSystemModel[data];The sample interval is assumed to be 1 second:
sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Specify a custom sampling period:
data = {6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9};model = CreateDataSystemModel[data, SamplingPeriod -> 0.1];Simulate for 1 second and plot:
sim = SystemModelSimulate[model, 1];SystemModelPlot[sim, "y[1]"]Use a custom InterpolationOrder:
data = {6, 9, 1, 9, 7, 6, 1, 8, 0, 2, 9};model = CreateDataSystemModel[data, InterpolationOrder -> 0];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]SparseArray is interpreted as the corresponding Normal array:
s = SparseArray[{{1} -> 1, {2} -> 3, {5} -> 2, {7} -> 1}];model = CreateDataSystemModel[s];The sample interval is assumed to be 1 second:
sim = SystemModelSimulate[model, 7];SystemModelPlot[sim, "y[1]"]Time-Value Pairs (3)
Create a model from a list of time-value pairs:
data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};model = CreateDataSystemModel[data];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Use a custom InterpolationOrder:
data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};model = CreateDataSystemModel[data, InterpolationOrder -> 0];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Create data with multiple values for each time point:
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}};model = CreateDataSystemModel[data];Simulate and plot the two output curves:
sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, {"y[1]", "y[2]"}]TimeSeries (3)
Create a data model from a TimeSeries:
ts = TimeSeries[{{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}}]model = CreateDataSystemModel[ts];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]The InterpolationOrder from the TimeSeries is preserved:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};ts = TimeSeries[data, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]model = CreateDataSystemModel[ts];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Override the InterpolationOrder when creating a data model:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};ts = TimeSeries[data, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]model = CreateDataSystemModel[ts, InterpolationOrder -> 3];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]InterpolatingFunction (2)
Create a model from an InterpolatingFunction:
data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};if = Interpolation[data];model = CreateDataSystemModel[if];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Resample an InterpolatingFunction before creating the model:
data = {{0, 6}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};if = Interpolation[data];model = CreateDataSystemModel[if, SamplingPeriod -> 2];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Functions (3)
Create a data model of a function sampled for 10 seconds:
model = CreateDataSystemModel[Cos, 0, 10];The sample points are automatically determined:
sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Choose the InterpolationOrder:
model = CreateDataSystemModel[Cos, 0, 10, InterpolationOrder -> 0];Simulate and plot 2 seconds of the data output to show the interpolation order:
sim = SystemModelSimulate[model, 2];SystemModelPlot[sim, "y[1]"]Set the sampling period when creating the model:
model = CreateDataSystemModel[Cos, 0, 10, InterpolationOrder -> 1, SamplingPeriod -> 1];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]Data Specification (3)
Create a data model that takes time and interpolates it over two value columns:
data = {#, Cos[#], Sin[#]}& /@ Range[0, 2π, 0.1];Show the first rows of the data:
Take[data, 5]//MatrixFormCreate a model that uses time to interpolate over the data:
model = CreateDataSystemModel[data, "Time"];sim = SystemModelSimulate[model, π];Plot the interpolated variables:
SystemModelPlot[sim, {"y[1]", "y[2]"}]Create a data model that takes an input and interpolates it over two value columns:
data = {#, Cos[#], Sin[#]}& /@ Range[0, 2π, 0.1];Show the first rows of the data:
Take[data, 5]//MatrixFormmodel = CreateDataSystemModel[data, "1D"];Simulate with an input that samples the data at twice the speed of time:
sim = SystemModelSimulate[model, π, <|"Inputs" -> {"u" -> Function[t, 2t]}|>];Plot the interpolated variables:
SystemModelPlot[sim, {"y[1]", "y[2]"}]Create a data model that takes two scalar inputs and runs them through a bivariate interpolation:
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:
xcoords = data[[2 ;; , 1]];ycoords = data[[1, 2 ;; ]];values = data[[2 ;; , 2 ;; ]];points = Join@@Table[{xcoords[[x]], ycoords[[y]], values[[x, y]]}, {x, Length[xcoords]}, {y, Length[ycoords]}];p1 = ListPointPlot3D[points]model = CreateDataSystemModel[data, "2D"];inputx = Function[t, 0.2 + 0.4t Cos[50 t]];inputy = Function[t, 0.2 + 0.4t Sin[50 t]];sim = SystemModelSimulate[model, 0.3, <|"Inputs" -> {"u1" -> inputx, "u2" -> inputy}|>];Plot the interpolation results together with the original data:
p2 = ParametricPlot3D[{inputx[t], inputy[t], sim["y", t]}, {t, 0, 0.3}];Show[p1, p2]Options (7)
InterpolationOrder (3)
An InterpolationOrder of 0 gives constant segments between samples:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};model = CreateDataSystemModel[data, InterpolationOrder -> 0];sim = SystemModelSimulate[model, 5];SystemModelPlot[sim, "y[1]"]An InterpolationOrder of 1 gives straight lines between samples:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};model = CreateDataSystemModel[data, InterpolationOrder -> 1];sim = SystemModelSimulate[model, 5];SystemModelPlot[sim, "y[1]"]An InterpolationOrder of 3 gives a smooth line with a continuous derivative:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};model = CreateDataSystemModel[data, InterpolationOrder -> 3];sim = SystemModelSimulate[model, 5];SystemModelPlot[sim, "y[1]"]SamplingPeriod (3)
For a list of data, SamplingPeriod determines the period between data points:
data = {6, 9, 1, 9, 7, 6};model = CreateDataSystemModel[data, SamplingPeriod -> 2];The output has 2-second-long linear sections between samples:
sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]For a function, SamplingPeriod determines how often a function is sampled:
model1 = CreateDataSystemModel[Sin, 0, 10, SamplingPeriod -> 0.5, InterpolationOrder -> 0];model2 = CreateDataSystemModel[Sin, 0, 10, SamplingPeriod -> 2, InterpolationOrder -> 0];Simulate with sampling periods of 0.5 and 2 seconds:
sim1 = SystemModelSimulate[model1, 10];sim2 = SystemModelSimulate[model2, 10];Compare the output for each simulation:
SystemModelPlot[{sim1, sim2}, "y[1]"]For a TimeSeries, SamplingPeriod resamples uniformly:
data = {{0, 5}, {1, 4}, {2, 2}, {3, 9}, {4, 1}, {5, 9}, {6, 4}, {7, 3}, {8, 9}, {9, 2}, {10, 0}};ts = TimeSeries[data]ListLinePlot[ts]Downsample the time series when creating the data model:
model = CreateDataSystemModel[ts, SamplingPeriod -> 3];sim = SystemModelSimulate[model, 10];SystemModelPlot[sim, "y[1]"]GeneratedAssetLocation (1)
Data is stored in the model by default:
model = CreateDataSystemModel[Range[3]];model["ModelicaDisplay"]Use GeneratedAssetLocation to export a data file to a specified location referenced by the model:
model = CreateDataSystemModel[Range[3], GeneratedAssetLocation -> FileNameJoin[{$TemporaryDirectory, "data.txt"}]];model["ModelicaDisplay"]Applications (1)
Create a data model with noisy output for 5 seconds:
noise = CreateDataSystemModel[RandomFunction[WienerProcess[], {0., 5, 5 / 400}]];Connect it to a lowpass filter:
filteredModel = ConnectSystemModelComponents[{"noise"∈noise, "filter"∈"Modelica.Blocks.Continuous.LowpassButterworth"}, {"noise.y[1]" -> "filter.u"}]sim = SystemModelSimulate[filteredModel, 5]Show the signal before and after filtering:
SystemModelPlot[sim, {"filter.u", "filter.y"}]Properties & Relations (2)
Insert created model in a package:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}};CreateDataSystemModel["MyPackage.DataModel", data];CreateDataSystemModel["MyPackage.TimeSeriesModel", TimeSeries[data]];The package contains both created models:
SystemModels["MyPackage.*"]Export as a file for use in a "CombiTimeTable" Modelica component:
data = {{0, 6}, {1, 9}, {2, 1}, {3, 9}, {4, 7}, {5, 6}, {6, 1}, {7, 8}, {8, 0}, {9, 2}, {10, 9}};Export[FileNameJoin[{$TemporaryDirectory, "data.txt"}], {"var1", data}, "MCTT"]Possible Issues (1)
Larger datasets in the model may lead to slower simulations:
data = Table[{t, RandomReal[10]}, {t, 0, 1000}];dataModel = CreateDataSystemModel[data];AbsoluteTiming[SystemModelSimulate[dataModel, 1000]]Simulating with data exported using MCTT Export is faster:
fileModel = "DocumentationExamples.Simulation.FileInput";AbsoluteTiming[SystemModelSimulate[fileModel, 1000]]Use GeneratedAssetLocation to export a data file to a specified location referenced by the model:
assetModel = CreateDataSystemModel[data, GeneratedAssetLocation -> FileNameJoin[{$TemporaryDirectory, "data.txt"}]];AbsoluteTiming[SystemModelSimulate[assetModel, 1000]]Related Guides
Related Links
Text
Wolfram Research (2018), CreateDataSystemModel, Wolfram Language function, https://reference.wolfram.com/language/ref/CreateDataSystemModel.html (updated 2020).
CMS
Wolfram Language. 2018. "CreateDataSystemModel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/CreateDataSystemModel.html.
APA
Wolfram Language. (2018). CreateDataSystemModel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CreateDataSystemModel.html
BibTeX
@misc{reference.wolfram_2026_createdatasystemmodel, author="Wolfram Research", title="{CreateDataSystemModel}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/CreateDataSystemModel.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_createdatasystemmodel, organization={Wolfram Research}, title={CreateDataSystemModel}, year={2020}, url={https://reference.wolfram.com/language/ref/CreateDataSystemModel.html}, note=[Accessed: 13-June-2026]}