Error while debugging the customized simscape component
8 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Sabin
2 minutes ago
This error points to a missing reference node. Each topologically distinct circuit within a domain must contain at least one reference block.
0 Comments
See Also
Categories
Find more on Foundation and Custom Domains in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!