필터 지우기
필터 지우기

Define constant variables in SSC, without specifiying them as parameter.

조회 수: 4 (최근 30일)
Heinz
Heinz 2017년 6월 7일
편집: Heinz 2017년 6월 19일
Hi I came across a problem in defining constants in ssc. This covers on one hand really constant constants as e.g. e. But also some problem specific konstants which I might like to not make available as parameter.
If I'd like to use e in the equations block, I have always to write it as 2.71828182846. The standard way of using it normally (exp(1)) does not work in the equations block as exp is not an accepted function. This Method is OK for real natural constants, but for problem specific constants this would mean, that I have to switch all occurances of this constant manually. (And if the constant is e.g. 2 then there will certainly be some occurences of "2" in the code, which are associated to this constant, and others which are not.) --> Works but might become difficult in maintaining the code.
Another way would be to define e as parameter. But then the enduser might adapt this "constant" to other values, which makes no sense. Something like a hidden parameter would be required.
parameters
R = { 1.05, 'm' }; % Wheel radius
I = { 5.05, 'kg*m^2' }; % Wheel inertia
end
parameters {Hidden} <-- Does something like this work.
Restitution_factor = {0.001, '1'}
end
A last version would be set the constant as variable. And the fix it in the equations block, which makes no sense to me.
variables(Access=private)
Restitution_factor = {0.001, '1'} % restitution factor
end
equation
Restitution_factor == {0.001, '1'}
... other equations using Restitution_factor
end
Any recommendation on how to do this?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by