Error while debugging the customized simscape component

8 次查看(过去 30 天)
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 about 5 hours 前
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