Error while debugging the customized simscape component

16 vues (au cours des 30 derniers jours)
azizi
azizi le 16 Jan 2012
Réponse apportée : Sabin le 23 Déc 2025 à 19:08
Hello, I'm using Simscape language to make a customized component. Here is the code:
%----------------------------------------------------
component Plant
%%Physical model
nodes
T = foundation.mechanical.translational.translational; %T:right
R = foundation.mechanical.rotational.rotational; % R:right
end
parameters
m = { 2.0, 'kg' }; % Mass of the robot
J = {0.15625, 'kg*m^2' }; %Moment of inertia
rw = {0.1, 'm'}; % Wheel radius
Wd = {0.4, 'm'}; % Chassis width between wheels
init_s = {0, 'm'}; % Intial distance,s
init_theta = {0, 'rad'}; % Initial orientation,theta
end
variables
v = { 0, 'm/s' }; %%translational velocity
w = { 0, 'rad/s' }; %rotational velocity
fl = {0,'kg*m/s^2'}; % force left
fr = {0,'kg*m/s^2'}; % force right or kg*m/s^2
theta = {0,'rad'}; % orientation
s = {0, 'm'}; % distance of the path between 2 points
end
function setup
across( v, T.v, []);
across( w, R.w, [] );
through(fr, T.f, [] );
through(fl, T.f, [] );
theta = init_theta;
s = init_s;
end
equations
v == s.der;
w == theta.der;
v.der == (fr + fl)/m;
w.der == (fr - fl)*rw/J;
end
end
%---------------------------------------------------
It seems OK when I build the component without any error but when I compose the component in Simulink environment, the error appears to be like:
-------------------------------------------------------------
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
Initial conditions solve failed to converge.
Dependency found among topology equations. Check for missing reference node.
-------------------------------------------------------------
Any advice?
Regards,
Azizi

Réponses (1)

Sabin
Sabin le 23 Déc 2025 à 19:08
This error points to a missing reference node. Each topologically distinct circuit within a domain must contain at least one reference block.

Catégories

En savoir plus sur Foundation and Custom Domains dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by