Vm To Physical Converter

1 view
Skip to first unread message

Donahue Granados

unread,
Aug 3, 2024, 5:14:57 PM8/3/24
to teltkalmaco

The physical signal at the output port of the Simulink-PS Converter block serves as an input signal for the Simscape physical network that the block is connected to. The physical signal unit must be commensurate with the unit expected by the input port of the destination block, that is, the input port connected to the output port of the Simulink-PS Converter block.

Simulink signal units do not propagate into physical networks. The Input signal unit parameter lets you specify a physical unit for the input signal value, so that the Simscape unit manager can perform the necessary unit conversions and scale the output physical signal accordingly.

If you also specify a physical unit as an attribute of the Simulink signal connected to the input port of the block, the software checks that the two units match. For more information, see Working with Simulink Units.

In other words, the Input signal unit parameter does not determine the units of the output physical signal, it only provides a scaling value. The output physical signal unit is inferred from the destination block. The default destination block units are meter-kilogram-second or MKS (SI). If you leave the Simulink-PS Converter block unitless, with the Input signal unit parameter set to 1, then the block does not apply scaling to the input signal. 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.

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 degC 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.

Untyped inputs do not support affine units. If you specify affine units in a Simulink-PS Converter block and then connect it directly to an untyped input port, the signal value is converted to the corresponding fundamental unit and further mathematical operations are performed with that value.

When simulating a model, you may need to provide time derivatives of some of the input signals, especially if you use an explicit solver. One way of providing the necessary input derivatives is by filtering the input through a low-pass filter. Input filtering makes the input signal smoother and generally improves model performance. The additional benefit is that the Simscape engine computes the time derivatives of the filtered input. The first-order filter provides one derivative, while the second-order filter provides the first and second derivatives. If you use input filtering, it is very important to select the appropriate value for the filter time constant.

The filter time constant 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 that you choose. Set the time constant to a value no larger than the smallest time interval in the system that interests you. If you choose a very small time constant, the filtered input signal is closer to the true input signal. However, this filtered input signal increases the stiffness of the system and slows the simulation.

Instead of using input filtering, you can provide time derivatives for the input signal directly, as additional Simulink signals. If the provided derivatives are inconsistent with the input signal, then some of the quantities may be incorrect during simulation.

For piecewise-constant signals, you can also explicitly set the input derivatives to zero. Use this option for signals that are truly piecewise-constant, such as step. If you have a continuous input signal sampled with a discrete sample time, setting input derivatives to zero can produce incorrect simulation results. Use one of the other two options: either filter the input or provide time derivatives as separate signals.

Output physical signal. The signal size matches the size of the input signal at Port_1. The signal unit is determined by the destination block. The Input signal unit parameter and Apply affine conversion check box let you apply scaling and linear offset to the input signal value to calculate the correct value of the output signal.

Units to be assigned to the input Simulink signal, to let the unit manager perform the necessary unit conversion and scale the signal value accordingly. 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 mm/s. For more information and a list of unit abbreviations, see How to Specify Units in Block Dialogs and Unit Definitions. The default value is 1, which means that no scaling is applied. The physical signal at the block output matches the value of the input Simulink signal at Port_1, in the units expected by the destination block inside the physical network.

This check box is applicable only for units that can be converted either with or without an affine offset, such as degC or degF. Select this check box if the input signal represents absolute temperature in degrees Celsius or degrees Fahrenheit. For more information, see Thermal Unit Conversions.

Specify the filter time constant, in seconds, 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. When you select a value for this parameter, consider the system dynamics and set the time constant to a value no larger than the smallest time interval of interest during simulation. 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 Output signal unit parameter lets you specify the desired units for the output signal. These units must be commensurate with the units of the input physical signal coming into the block. If you specify a desired output unit, the block applies a gain equal to the conversion factor before outputting the Simulink signal. For example, if the input physical signal coming into the block is displacement, in meters, and you set Output signal unit to mm, the block multiplies the value of the input signal by 1e3 before outputting it. If the output signal unit is the same as the input signal unit, no gain is applied.

The default value of the Output signal unit parameter, inherit, automatically sets the unit at the block output port to match the unit of the input physical signal coming into the block, based on unit propagation rules. This way, you can easily connect a PS-Simulink Converter block to any signal, without worrying about setting the commensurate output unit.

In the diagram below, the input signal for the PS-Simulink Converter block is torque in N*m, and if you do not specify the output signal unit, the Display block shows the value of 10. If you change the Output signal unit parameter value in the PS-Simulink Converter block to N*cm, the torque value in the Display block changes to 1000, as shown in the diagram.

When the output 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 output 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 output signal represents an absolute temperature, you need to apply affine conversion, Tnew = L * Told + O.

In the following diagram, the Display block shows the room temperature. If you want to display it in degrees Celsius, open the PS-Simulink Converter block, type degC in the Output signal unit field, and select the Apply affine conversion check box. The display reading is 24.35. However, if you leave the Apply affine conversion check box clear, the Display block would show 297.5.

Unit specified for the output signal by using the Output signal unit parameter does not propagate outside of the physical network. However, if you also specify a physical unit as an attribute of the Simulink signal connected to the output port of the block, the software checks that the two units match. For more information, see Working with Simulink Units.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages