WSMLink`
WSMLink`

WSMCreateDataModel

WSMCreateDataModelString is being phased out in favor of CreateDataSystemModel, which was introduced experimentally in Version 11.3.

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

Examples

open allclose all

Basic 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:

Simulate and plot the output:

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

Simulate and plot the output:

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:

Simulate and plot the output:

SparseArray is interpreted as the corresponding Normal array:

The sample interval is assumed to be 1 second:

Time-Value Pairs  (3)

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

Simulate and plot the output:

Use a custom InterpolationOrder:

Simulate and plot the output:

Create data with multiple values for each time point:

Simulate and plot the two output curves:

TimeSeries  (3)

Create a data model from a TimeSeries:

Simulate and plot the output:

The InterpolationOrder from the TimeSeries is preserved:

Simulate and plot the output:

Override the InterpolationOrder when creating a data model:

Simulate and plot the output:

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:

Set the sampling period when creating the model:

Simulate and plot the output:

Options  (6)

InterpolationOrder  (3)

An InterpolationOrder of 0 gives constant segments between samples:

Simulate and plot the output:

An InterpolationOrder of 1 gives straight lines between samples:

Simulate and plot the output:

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

Simulate and plot the output:

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:

Downsample the time series when creating the data model:

Simulate and plot the output:

Applications  (2)

Create a data model with noisy output for 5 seconds:

Connect it to a lowpass filter:

Simulate the filtering model:

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:

Create model with data:

Connect with model of a room with heating:

Simulate for as long as there is data:

Plot outside and inside temperature:

Properties & Relations  (2)

Insert created model in a package:

The package contains both created models:

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

Possible Issues  (1)

Larger datasets in the model may lead to slower simulations:

Simulating with data exported using MCTT Export is faster: