How to use of physical units within Simulink systems?

2 ビュー (過去 30 日間)
Klaus Webers
Klaus Webers 2021 年 10 月 17 日
コメント済み: Klaus Webers 2021 年 11 月 19 日
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.
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)
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.
  • 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)

採用された回答

Pavan Guntha
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!
  1 件のコメント
Klaus Webers
Klaus Webers 2021 年 11 月 19 日
Hello Pavan,
The way units are handeled in Simscape is, ideed, exemplary. However, as the question at hand is to improve (pure) Simulink-models, Simscape is not an option, by definition. Perhaps a suitable unit-handling scheme can be taken into account in future releases?
Thank you anyway.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by