WSMCreateDataModel
WSMCreateDataModel["newmodel",{v1,v2,…}]
creates the Modelica model "newmodel" of the values vi.
WSMCreateDataModel["newmodel",{{t1,v1},…}]
creates a model for the time-value pairs {ti,vi}.
WSMCreateDataModel["newmodel",ts]
creates a model for the TimeSeries ts.
WSMCreateDataModel["newmodel",fun,tmin,tmax]
creates a model with samples from the function fun between tmin and tmax.
Details and Options
- WSMCreateDataModel returns WSMModelData["newmodel"].
- WSMCreateDataModel["PackageA.NewModel"] inserts "NewModel" into "PackageA".
- The following options can be given:
-
InterpolationOrder Automatic interpolation order SamplingPeriod Automatic time between samples - 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.
Examples
open allclose allBasic Examples (4)
Load Wolfram System Modeler Link:
Create a model from a list of time-value pairs:
Simulate and plot the output of the data model:
Create a model from a TimeSeries:
Create a data model of a sampled function between 0 and 10 seconds:
Scope (13)
Value Lists (4)
Create a data model from a list of values:
The sample interval is assumed to be 1 second:
Specify a custom sampling period:
Simulate for 1 second and plot:
Use a custom InterpolationOrder:
SparseArray is interpreted as the corresponding Normal array:
Time-Value Pairs (3)
Create a model from a list of time-value pairs:
Use a custom InterpolationOrder:
TimeSeries (3)
Create a data model from a TimeSeries:
The InterpolationOrder from the TimeSeries is preserved:
Override the InterpolationOrder when creating a data model:
Functions (3)
Create a data model of a function sampled for 10 seconds:
The sample points are automatically determined:
Choose the InterpolationOrder:
Simulate and plot 2 seconds of the data output to show the interpolation order:
Options (6)
InterpolationOrder (3)
An InterpolationOrder of 0 gives constant segments between samples:
An InterpolationOrder of 1 gives straight lines between samples:
An InterpolationOrder of 3 gives a smooth line with a continuous derivative:
SamplingPeriod (3)
For a list of data, SamplingPeriod determines the period between data points:
The output has 2-second-long linear sections between samples:
For a function, SamplingPeriod determines how often a function is sampled:
Simulate with sampling periods of 0.5 and 2 seconds:
Compare the output for each simulation:
For a TimeSeries, SamplingPeriod resamples uniformly:
Applications (2)
Create a data model with noisy output for 5 seconds:
Connect it to a lowpass filter:
Show the signal before and after filtering:
Use real-world data as input to a model:
Shift the data to start at time 0 and filter out units:
Connect with model of a room with heating: