How to use of physical units within Simulink systems?
4 次查看(过去 30 天)
显示 更早的评论
How to use of physical units within Simulink systems?
Consistent use of physical units with all signals, also within subsystems, would be desirable (not only for didactic reasons). Unfortunately, I have not yet found a satisfactory approach to this. So far, I've considered the following alternatives:
Defined Simulink.Signal objects per signal
For each signal in the model, a Simulink.Signal object is created first, including unit specification.
uResistance = Simulink.Signal; uResistance.Unit='V';
uInductance = Simulink.Signal; uInductance.Unit='V';
tMotor = Simulink.Signal; tMotor.Unit='N*m';
tFriction = Simulink.Signal; tFriction.Unit='N*m';
Each signal is then bound to the corresponding object by property "Signal must resolve to Simulink signal object".
- Advantage: Consistent and visible use of units (per InformationOverlay->Units).
- Disadvantage: Impractical, high effort and inflexible regarding model changes. Double signal definition.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/769616/image.png)
Defined Simulink.Signal object per "physical quantity"
For each physical quantity, e.g. voltage or torque, a Simulink.Signal object is created. Important: This object type can be reused multiple times in a Simulink model (setting-dependent).
% physical quantities ("signal classes")
voltage = Simulink.Signal; voltage.Unit='V';
current = Simulink.Signal; current.Unit='A';
torque = Simulink.Signal; torque.Unit='N*m';
Each individual signal is then bound to a physical quantity (i.e. signal-object).
- Advantage: consistent and visible use of units. Additionally: intuitve plausi-check for consistent physical quantities, e.g. at summation points (by klicking variable voltage in ModelDataEditor). Moderate effort, flexible model adaptation.
- Disadvantage: The individual signal name does no longer appear at the signal line. (although an individual signal name may be assigned, per SignalProperties->CustomLoggingName)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/769621/image.png)
Explicit signal specification block for each signal in the model.
Each signal is defined, incl. unit-propertiy, within the model-layout by application of the SignalSpecification-block.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/769626/image.png)
- Advantage: Continuous and visible units. Individual signal name recognizable.
- Disadvantage: High effort. Confusing model due to loads of "unnecessary" blocks
Conclusion
None of the variants solves the problem satisfactorily. Easy definition of output signal properties / quantities (incl. unit) at each Simulink block would be desirable.
Is there a simple and practicable solution for this?
(if so, of course next steps already foreshadow. Particularly, use of some Simulink.Parameter property to plausi-check physical quantities with Ohm's law at gain transforming current to voltage. And/or proper application of time-unit "A/s -> A" with integrator blocks)
0 个评论
采纳的回答
Pavan Guntha
2021-11-16
Hello Klaus,
You could use Simscape in order to model systems such as electric motors, hydraulic actuators etc., which supports units for each of the quantities like Resistance, Torque etc., By using Simscape you could overcome the issues which have been mentioned. For more information on Simscape, you could look at the documentation page here. You could also leverage Simscape Onramp to learn basics of Simscape.
Hope this helps!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Operators 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!