(Ideal Rotational Motion Sensor) Number of variables exceeds the number of equations

5 views (last 30 days)
I have a problem with the ideal rotational motion sensor, the code is raising an error as the following
Error compiling Simscape network for model Hw7.
Caused by:
Number of variables exceeds number of equations. Click on any Simscape blocks identified below for more detailed diagnostics.
  • Hw7/Subsystem/Ideal Rotational Motion Sensor
  • Hw7/Subsystem1/Ideal Rotational Motion Sensor
  • Hw7/Subsystem2/Ideal Rotational Motion Sensor
component angular_velocity
% Ideal Rotational Motion Sensor
nodes
R = foundation.mechanical.rotational.rotational; % R:left
C = foundation.mechanical.rotational.rotational; % C:right
end
outputs
W = { 0, 'rad/s' }; % W:right
A = { 0, 'rad' }; % A:right
end
parameters
wrap_angle = simscape.enum.onoff.off; % Wrap angle to [0, 2*pi]
% 0 - Off
% 1 - On
offset = { 0, 'rad' }; % Initial angle
end
variables(Access = private)
phi = {value = offset, priority = priority.high}; % Angle
end
if wrap_angle == simscape.enum.onoff.on
equations
A == mod(phi, {2*pi, 'rad'});
end
else % wrap_angle == simscape.enum.onoff.off
equations
A == phi;
end
end
equations
phi.der == W;
W == R.w - C.w;
end
end

Answers (0)

Categories

Find more on Discrete Events and Mode Charts in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!