From Workspace
Loads data from the workspace as a signal.
Description
The From Workspace block reads data into the model from the workspace and represents it as a signal. The From Workspace block can be located at any level of model nesting and can be used to transfer data to any model or subsystem from the workspace.
Features of data loading
The From Workspace block is intended for reading data from variables of WorkspaceArray type (a special type that is obtained either as a result of data unloading using To Workspace block or can be created manually). The name of the variable to be read is specified in the Data field of the block.
Ports
Output
Port_1 - data from the workspace
scalar
| vector
| matrix
Data loaded from the workspace as a signal. Depending on the loaded data, the output signal can be scalar, vector or matrix.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, UInt8
, UInt16
, UInt32
, UInt64
, Bool
.
Support for complex numbers: Yes
Parameters
Main
Data - data to be loaded from the workspace object
workspace_in (by default)
| string
Variable name in workspace of type Working with big data via WorkspaceArray.
Block parameter |
|
Value |
|
By default |
|
Sample time - interval between calculation steps
−1 (by default)
| скаляр
Specify the parameter Sample time as a non-negative number. To inherit the discrete step of the system, set the value of this parameter to −1
.
Block parameter: |
|
Value: |
|
By default: |
|
Time Values - interpretation of time data
on (By default)
| off
Select the check box to enable interpretation of time data.
Interpolate - interpolate data
On (By default)
| Off
.
Interpolation method used to calculate intermediate signal values (not present in the original data). If checked, the From Workspace block uses linear interpolation of intermediate values, if unchecked - constant interpolation.
The value of the Interpolate parameter also affects how the From Workspace block extrapolates the output values for the simulation time to the first data point. When the parameter is on, the block uses the first two points to linearly extrapolate the output values. When the parameter is off, the output is 0
. Turning interpolation on allows the Extrapolate extrapolation method to be used.
Block parameter |
|
Value |
|
* By default* |
|
Output after final value - method of determining the block output after the final data point
| Extrapolation
| Setting to zero
| Holding final value
| Cyclic repetition
The From Workspace block uses the Interpolate and Output after final value parameters to calculate the block output for the simulation time after the last point available in the loaded data.
Value of Output after final value | Value of Interpolate | Value of block output after last data value |
---|---|---|
|
|
Extrapolated based on the last two data points |
|
Error |
|
`Setting to zero |
`on |
Zero |
`off |
||
`Holding final value |
|
Final value |
|
||
|
|
Error |
|
This mode can be used only if the Interpolate and Time Values parameters are switched off and discrete Sample Time is set. In this case the data is cycled from the first value, otherwise an error occurs. |
Block parameter |
|
Value |
|
By default |
|
Algorithms
*Interpolation
Interpolate is the process that the From Workspace block uses to provide output values that are between calculation steps in the loaded data for simulation time. When Interpolate is checked, the From Workspace block linearly interpolates the output value using two neighbouring points in the workspace data.
When the Interpolate checkbox is not selected, the From Workspace block uses the value of the previous data point as the output value.
* Extrapolation
Extrapolation is the process that the From Workspace block uses to calculate the output values for the simulation time before the first and after the last point in the loaded data.
You can control how the From Workspace block extrapolates the output values before the first value by using the Interpolate parameter. Use Interpolate and Output after final value to specify how the block extrapolates output values after the final data point.
Interpolate parameter value | Output before first data point | Output after final value | Output after final data point. |
---|---|---|---|
|
Linearly extrapolated using the first two data points of the workspace. |
|
Linearly extrapolated using the last two workspace data points. |
|
Zero |
||
|
Holding final value |
||
|
Error |
||
|
Zero |
|
Error |
`Setting to zero |
Zero |
||
|
Holding final value |
||
|
When the loaded workspace data uses a structure without a time format, the workspace data is repeated from the first value. Errors for workspace data formats other than a structure with time. |