Error compiling Simscape network for model: Number of variables exceeds number of equations.

75 visualizaciones (últimos 30 días)
I have modified copy of spring.ssc file from Simscape foundation->translational library, and tried to model simple system but I am getting the error."Number of variables exceeds number of equations", How to identify consistency of equations with variables from available model, and used .ssc files? Some insights I want. Even if you share link containing the information, it will be helpful.
Thanks in advance!
component nspring
% Non-linear Spring
% Behavior is force proportional to square of deformation
nodes
r = foundation.mechanical.translational.translational; % r:right
c = foundation.mechanical.translational.translational; % c:left
end
parameters
k = { 1, 'N/(m*m)' }; % Spring constant
end
variables
v = { 0, 'm/s' }; % Velocity
f = { 0, 'N' }; % Force
x = { 0, 'm' }; % Deformation
end
function setup
if k <= 0
error('k cannot be less than zero')
end
end
branches
f : r.f -> c.f;
end
equations
v == r.v-c.v;
f == k*x*x;
end
end
  1 comentario
lilly michel
lilly michel el 19 de Jul. de 2017
When I use simulink to compile the battery model, the following problems always occur: Error compiling Simscape network for model ssc_lithium_cell_2RC_TEST. Caused by: Unable to compile the physical network. Bother me for a long time, hope to get your guidance

Iniciar sesión para comentar.

Respuesta aceptada

Sebastian Castro
Sebastian Castro el 9 de Sept. de 2015
Yep, you have 3 variables (force, deformation, velocity) but only 2 equations.
The missing one I believe is the one relating the deformation and velocity using the "der" keyword.
v == x.der;
- Sebastian
  2 comentarios
Sebastian Castro
Sebastian Castro el 10 de Sept. de 2015
No problem... also, if you want to make a quadratic spring, you may want the equation to handle the sign of the deformation:
f == k*x*abs(x);
- Sebastian

Iniciar sesión para comentar.

Más respuestas (1)

aymen
aymen el 21 de Abr. de 2018

Hy i have the same error in the component of mass.

this is the code: nodes M = foundation.thermal.thermal; % :top end

parameters mass = { 1000, 'kg' };

    sp_heat = { 447, 'J/(kg*K)' };   % Specific heat
end

variables % Differential variables T = {value = {300, 'K'}}; % Temperature

    Q = { 0, 'J/s' }; % Heat flow
end

function setup %#simple % Parameter range checking if mass <= 0 pm_error('simscape:GreaterThanZero','Mass') end if sp_heat <= 0 pm_error('simscape:GreaterThanZero','Specific heat') end end

branches Q : M.Q -> *; end

equations T == M.T; Q == mass * sp_heat * T.der; assert(T>0, 'Temperature must be greater than absolute zero') end

end

and this is the error message

['HEV_SeriesParallel/Electrical/System Level/DC-DC Converter/Thermal Model/Thermal Mass']: Type mismatch for equation. The left hand side of the equation is {[1x1 double], 'C'} and the right hand side of the equation is {[1x1 double], 'K'}. T = {[1x1 double], 'C'} M.T = {[1x1 double], 'K'} In foundation.thermal.elements.mass (line 45)

Categorías

Más información sobre Run-Time Parameters en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by