Simscape ignores parameter units

1 次查看(过去 30 天)
Christian
Christian 2019-10-1
评论: J Chen 2019-10-2
Hi!
I have a problem with a custom component. For investigation purposes I created the followinf minimal example of what I try to do. Running a model with this example throws an error showing a unit mismatch in line "Fg = Fn + Fs". Appearently simscape ignores the unit of Fg which I defined in the parameters section. Changing all units to '1'm (which I want to avoid) everthing works well.
component zeroTest
outputs
Fn = {[0, 0, 0], 'N'}; % Force normal direction
Fs = {[0, 0, 0], 'N'}; % Force slope direction
end
parameters
Fg = {[0, 0, 1], 'N'}; % Gravity Force
n = {[0.5, 0, 1], '1'}; % Normal vector
end
variables
a = {1, '1/N'}; % Scaling factor between n and Fg
end
equations
Fg == Fn + Fs; % Fn and Fg shall sum up to Fg
Fn * Fs' == 0; % Fn and Fs shall be orthogonal
a*Fn == n; % Fn point in normal direction
end
end
Error Message:
Error compiling Simscape network for model myTestModel.
Caused by:
Error using Common.zeroTest> (line 18)
['myTestModel/zeroTest']: Type mismatch for equation. The left hand side of the equation is [0 0 1] and the
right hand side of the equation is {[1x3 double], 'N'}.
Fg = [0 0 1]
Fn = {[1x3 double], 'N'}
Fs = {[1x3 double], 'N'}
There seems to be something simple I am missing. Hopefully anyone can point me in the right direction.
  1 个评论
J Chen
J Chen 2019-10-2
The first two lines in the equation section make no sense. A parameter can't equate to two outputs. The two outputs probably should be inputs.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Troubleshooting 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by