Error: Class member redefinition has been found
3 次查看(过去 30 天)
显示 更早的评论
I have been trying to define a resistor which also produces heat in simscape. The code for the .ssc file is depicted below. When I try to insert the component (via library browser: simscape/utilities/simscape component), I get the error: " Error: Class member redefinition has been found." and "Caused by:
Error using MyPackage.heat_producing_resistor> (line 10)
Class member 'h' is defined.
Error using MyPackage.heat_producing_resistor> (line 16)
Class member 'h' is defined"
What is the problem?
Am i not authorised to define an output?
Is the fault in foundation.electrical.electrical(I don`t understad what that means and if it should be defined differently and why)?
Thanks in advance
component heat_producing_resistor
%linear resistor
%Follows the relation U=I*R [V]
%Includes the heat produced in the resistor dQ/dt =u(t)*i(t) [J/s = W]
%R is assumed to be constant
nodes
p = foundation.electrical.electrical; % +:left
n = foundation.electrical.electrical; % -:right
dQ = foundation.electical.electrical; % Q:right
end
variables
i = {0, 'A' }; %Current (through)
u = {0, 'V' }; %Voltage (across)
dQ = {0, 'W' }; %Heatflow (across)
end
parameters
R = {1, 'Ohm' }; %resistance
end
branches
i : p.i -> n.i;
end
equations
assert(R>0)
v == p.v - n.v;
v == i*R;
dQ == i*v;
end
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!