Simulink-PS Converter

Convert Simulink input signal into physical signal

Library

Utilities

Description

The Simulink-PS Converter block converts the input Simulink® signal into a physical signal. Use this block to connect Simulink sources or other Simulink blocks to the inputs of a Physical Network diagram.

You specify the desired units as the Input signal unit parameter. If you leave the block unitless, with the Input signal unit parameter set to 1, then the physical signal units are inferred from the destination block. The default destination block units are meter-kilogram-second or MKS (SI). If you specify different units, commensurate with the expected default units of the destination block input, then the unit manager attaches these units to the input Simulink signal value and performs the necessary unit conversion when providing the signal to the destination block.

In the diagram below, the Ideal Torque Source block expects a torque signal, in N*m, on its S port. The Constant source block provides the value for this input signal. If you left the Simulink-PS Converter block unitless, the Ideal Torque Source block would generate torque of 1000 N*m. The parameters of other blocks in this example are chosen so that the output value of the Ideal Torque Sensor block is equal to the torque generated by the Ideal Torque Source block, and therefore the Display block would show the value of 1000. If you change the Input signal unit parameter value in the Simulink-PS Converter block to N*cm, the unit manager performs the conversion and the Ideal Torque Source block generates torque of 10 N*m; the torque value in the Display block changes to 10, as shown in the diagram.

    Note   Currently, physical units are not propagated through the blocks in the Physical Signals library, such as PS Add, PS Gain, and so on. If your diagram contains a Physical Signals block after a Simulink-PS Converter block, the unit specification in the Simulink-PS Converter block does not propagate to the rest of the network.

In the following example, the PS Gain block is installed after the Simulink-PS Converter block. It stops the unit propagation to the rest of the physical network, and the Ideal Torque Source block will generate torque of 1000 N*m regardless of the Input signal unit parameter setting in the Simulink-PS Converter block.

When the input signal is related to thermodynamic variables and contains units of temperature, you must decide whether affine conversion needs to be applied. For more information, see When to Apply Affine Conversion. Usually, if the input signal represents a relative temperature, that is, a change in temperature, you need to apply linear conversion, ΔTnew = L * ΔTold (the default method). However, if the input signal represents an absolute temperature, you need to apply affine conversion, Tnew = L * Told + O.

For example, in the Simulink-PS Converter block shown in the following diagram, if you type C in the Input signal unit field and select the Apply affine conversion check box, the temperature generated by the Ideal Temperature Source block is equal to 293.15 K. However, if you leave the Apply affine conversion check box clear, the output of the Ideal Temperature Source block is 20 K.

Dialog Box and Parameters

The block dialog box has two tabs:

Units

Input signal unit

Units to be assigned to the physical signal. These units must be commensurate with the expected default units of the destination block input. You can select a unit from the drop-down list, or type the desired unit name, such as rpm, or a valid expression, such as rad/s. For more information and a list of unit abbreviations, see How to Specify Units in Block Dialogsand Unit Definitions. The default value is 1, which means that the units of the physical signal at the block output match the expected default units of the destination block input.

Apply affine conversion

This check box is applicable only for units that can be converted either with or without an affine offset, such as thermal units. For more information, see Thermal Unit Conversions.

Input Handling

Filtering and derivatives

This parameter lets you filter input and thus provide time derivatives of the input signal, or provide the time derivatives through additional input ports on the Simulink-PS Converter block:

  • Use input as is — Do not perform input filtering or otherwise provide time derivatives of the input signal. This is the default method. If you use an explicit solver, MathWorks recommends that you provide input derivatives by selecting one of the other options for this parameter. For more information, see Harmonizing Simulink and Simscape Solvers.

  • Filter input — Provide input derivatives by Filter the input through a low-pass filter, which also provides input derivatives. In this case, the input signal is modified (through filtering) before being converted to a physical signal. The first-order filter provides one derivative, while the second-order filter provides the first and second derivatives. If you use this option, set the appropriate Input filtering time constant parameter value, as described below.

  • Provide input derivative(s) — Provide time derivatives of the input signal as additional input signals to the Simulink-PS Converter block. If you select this option, the input signal is not modified. You can provide just the first derivative, or both the first and second derivatives, by using the Input derivatives parameter, as described below.

Input filtering order

This parameter is applicable only if the Filtering and derivatives parameter is set to Filter input. It lets you specify the number of time derivatives computed for the input signal by selecting the filter order:

  • First-order filtering — Provides only the first derivative.

  • Second-order filtering — Provides the first and second derivatives.

Input filtering time constant (in seconds)

This parameter is applicable only if the Filtering and derivatives parameter is set to Filter input. It specifies the filter time constant, which controls the filtering of the input signal. The filtered input follows the true input but is smoothed, with a lag on the order of the time constant chosen. You should set the time constant to a value no larger than the smallest time interval of interest in the system. The trade-off in choosing a very small time constant is that the filtered input signal will be closer to the true input signal, at the cost of increasing the stiffness of the system and slowing down the simulation. The default value is .001 s.

Input derivatives

This parameter is applicable only if the Filtering and derivatives parameter is set to Provide input derivative(s). It lets you provide time derivatives of the input signal as additional input signals:

  • Provide first derivative — If you select this option, an additional Simulink input port appears on the Simulink-PS Converter block, to let you connect the signal providing input derivatives.

  • Provide first and second derivatives — If you select this option, two additional Simulink input ports appear on the Simulink-PS Converter block, to let you connect the signals providing input derivatives.

 Restricted Parameters

Ports

The block has one or two Simulink input ports, depending on the Input derivatives parameter value, located on its left side, and a physical signal output port, located on its right side (in the block default orientation).

Was this topic helpful?