Units for constants in simscape custom module

I have a constant that I have declared in the variables section. I'm assuming that everything needs units. Some papers use constants that use equations with units that don't match (on one side of the equation its a constant and on the other side might be V/K)
variables(Access=private)
cm = { 0, '' };
i = { 2, 'A' };
V1= { 0, 'V' };
T1 = { 0, 'K' };
end
in the equations section if I mix up the units will it throw an error?
equations
i == V1*T1;
end
is there some way to have a unitless constant that doesn't have units?
equations
cm == V1*T1;
end

댓글 수: 3

Steven
Steven 2017년 2월 6일
Sure enough, Got an error: Provided units 'Ohm' and 'K' are not commensurate
Found some help : https://www.mathworks.com/help/physmod/simscape/lang/declaring-domains-and-components.html#bruso4j-1
To declare a unitless parameter, you can either use the same syntax:
par1 = { value , '1' };
Steven
Steven 2017년 2월 6일
편집: Steven 2017년 2월 6일
This doesn't solve my problem right now however, because I have Kelvin/Kelvin and its not going to unitless. Example:
nodes %conserving ports
Ta = foundation.thermal.thermal; % H:top
Tb = foundation.thermal.thermal; % C:bottom
end
variables
R = {334, '1'};
end
parameters
cTemp = {3.2342, '1'};
end
equations
R == (Th.T - cTemp)/Th.T;
end
This will not compile. Even changing R and cTemp to units of K will not compile

댓글을 달려면 로그인하십시오.

답변 (1개)

Nirja Mehta
Nirja Mehta 2017년 2월 6일

0 개 추천

Assign '1' as the unit of "cm".

댓글 수: 1

Steven
Steven 2017년 2월 6일
That compiles, but I can't combine a that is set with R = {334, '1'}; value with any other unit in an equation so it doesn't have that much use. I need a true unitless value that will compile

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Foundation and Custom Domains에 대해 자세히 알아보기

제품

태그

질문:

2017년 2월 3일

댓글:

2017년 2월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by