A continuous plant model uses signal data that is smooth and uninterrupted in time. There is signal data for each time value. A continuous plant model uses a continuous solver (any solver other than an explicit discrete solver). The solver can be fixed-step or variable. The model includes blocks from the Continuous library in Simulink®, such as an Integrator block.
To load data to represent a continuous plant, consider using either a root-level input port or a From Workspace block. Using a From Workspace block can be useful when loading data to a port buried deep within a model.
For the signal data:
Specify a time vector and signal values extracted from a continuous plant. For example, extract from data that you acquire experimentally or from the results of a previous simulation.
Use any of the data formats listed in Specify Input Data. Here are recommended formats for the following imported data sources:
Another simulation — Dataset
An equation — MATLAB® time expression
Experimental data — MATLAB
timeseries
, structure with time, a structure without time, or a
data array
For structure data, see Specify Time Data.
This example illustrates how to use logged data from the simulation of one model in the simulation of a second model. For more information, see Load Data Logged In Another Simulation.
When using data from a simulation that uses a variable-step solver for simulation in another model, the second simulation must read the data at the same time steps as the first simulation.
Open the ex_data_import_continuous
model.
This model uses the ode15s
solver and produces continuous
signals.
To use the output of this model as input to the simulation of another model, log the signal that you want to use. In the Simulink Editor, select that signal, and click Log Signals.
Note
To enable signal logging, select the Configuration Parameters > Data Import/Export > Signal logging parameter. This model has Signal logging enabled.
Simulate the model.
Simulating the model saves the logged signal to the workspace in the Simulink.SimulationData.Dataset
object, logsout
.
Use the Simulink.SimulationData.Dataset.getElement
method to
access the logged data. The logged data for an individual signal is stored in a
object. The
Simulink.SimulationData.Signal
Dataset
object created by this model contains one logged signal:
StepResponse
.
Open the second model, ex_data_import_continuous_second
.
You can configure this second model to simulate using the logged data from the first model. In this example, the second model uses a root-level Inport block to load the logged data as input for the simulation. The Inport block has the Interpolate data option selected.
In the second model, select the Configuration Parameters > Data Import/Export > Input parameter.
Use the Simulink.SimulationData.Signal.getElement
method to
specify the StepResponse
signal element:
Specify that for the second model, the Simulink solver runs at the time steps specified in the saved data
(u
). In the Data Import/Export pane, set the Output
options parameter to Produce additional output
and the Output times parameter to:
logsout.getElement('StepResponse').Values.Time
Simulate the second model.
Note
Simulink does not feed minor time step data through root input ports. For details about minor time steps, see Types of Sample Time.