Error while debugging the customized simscape component

조회 수: 8 (최근 30일)
azizi
azizi 2012년 1월 16일
답변: Sabin 2025년 12월 23일 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

답변 (1개)

Sabin
Sabin 2025년 12월 23일 19:08
This error points to a missing reference node. Each topologically distinct circuit within a domain must contain at least one reference block.

카테고리

Help CenterFile Exchange에서 Foundation and Custom Domains에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by