Error: Class member redefinition has been found

11 views (last 30 days)
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

Answers (0)

Categories

Find more on Equations in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!