Error in simscape when computing derivative

I have a Simscape block that takes linPosition (physical signal) as an input and computes rotPosition (another physical signal). If I put it in my model, where linPosition is 0 for 1ms and then starts increasing smoothly, it works (rotPosition and theta are constant for 1ms and then follow the growth of linPosition). The problem arises when I try to add an additional computation: omega == der(theta) (I need it to make more calculation and provide another output). With that additional equation, I get this warning:
Equations (including nonlinear equations) of one or more components may be dependent or inconsistent. This can cause problems in transient initialization.
referred to the first and second equations. Then the simulation stops at 1ms:
An error occurred during simulation and the simulation was stopped
Caused by:
[‘testCircuit/Solver Configuration’]: Transient initialization at time 0.001, solving for consistent states and modes, failed to converge.
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
all components and nodal across variables involved
Cannot solve for one or more variables, including dynamic variable derivatives:
Time derivative of ‘CRIB.CRIB_velocityBased.breaking_part.offsetSliderCrank.theta’ (rot angle with respect to horizontal)
‘CRIB.CRIB_velocityBased.breaking_part.offsetSliderCrank.omega’ (omega)
In my mind, theta and gamma in the equations are computed and then omega follows the value of theta, but I guess that this is not how it works.

component offsetSliderCrank

inputs
linPosition = {0, ‘mm’};
end

outputs
rotPosition = {0, ‘deg’};
end

parameters
lRod = { 45, ‘mm’ }; %
rJunction = { 10, ‘mm’ }; %
xC = { 2, ‘mm’ }; %
yC = { 40, ‘mm’ }; %

end

variables(Access=Protected)
theta = {value={0,’deg’},imin={-90,’deg’},imax={89,’deg’}}; % rot angle with respect to horizontal
gamma = {value={0,’deg’},imin={0,’deg’},imax={180,’deg’}}; % angle between lRod and horizontal
omega = {0,’deg/s’};

end

equations
lRod*cos(gamma)+xC == rJunction*cos(theta);
yC-linPosition – rJunction*sin(theta) == lRod*sin(gamma);
let
theta0 = asin((yC^2+rJunction^2-lRod^2+xC^2)/(2*rJunction*sqrt(xC^2+yC^2))) – atan(xC/yC) ;
in
rotPosition == – (theta- theta0);
end
omega == der(theta);
end

endI have a Simscape block that takes linPosition (physical signal) as an input and computes rotPosition (another physical signal). If I put it in my model, where linPosition is 0 for 1ms and then starts increasing smoothly, it works (rotPosition and theta are constant for 1ms and then follow the growth of linPosition). The problem arises when I try to add an additional computation: omega == der(theta) (I need it to make more calculation and provide another output). With that additional equation, I get this warning:
Equations (including nonlinear equations) of one or more components may be dependent or inconsistent. This can cause problems in transient initialization.
referred to the first and second equations. Then the simulation stops at 1ms:
An error occurred during simulation and the simulation was stopped
Caused by:
[‘testCircuit/Solver Configuration’]: Transient initialization at time 0.001, solving for consistent states and modes, failed to converge.
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
all components and nodal across variables involved
Cannot solve for one or more variables, including dynamic variable derivatives:
Time derivative of ‘CRIB.CRIB_velocityBased.breaking_part.offsetSliderCrank.theta’ (rot angle with respect to horizontal)
‘CRIB.CRIB_velocityBased.breaking_part.offsetSliderCrank.omega’ (omega)
In my mind, theta and gamma in the equations are computed and then omega follows the value of theta, but I guess that this is not how it works.

component offsetSliderCrank

inputs
linPosition = {0, ‘mm’};
end

outputs
rotPosition = {0, ‘deg’};
end

parameters
lRod = { 45, ‘mm’ }; %
rJunction = { 10, ‘mm’ }; %
xC = { 2, ‘mm’ }; %
yC = { 40, ‘mm’ }; %

end

variables(Access=Protected)
theta = {value={0,’deg’},imin={-90,’deg’},imax={89,’deg’}}; % rot angle with respect to horizontal
gamma = {value={0,’deg’},imin={0,’deg’},imax={180,’deg’}}; % angle between lRod and horizontal
omega = {0,’deg/s’};

end

equations
lRod*cos(gamma)+xC == rJunction*cos(theta);
yC-linPosition – rJunction*sin(theta) == lRod*sin(gamma);
let
theta0 = asin((yC^2+rJunction^2-lRod^2+xC^2)/(2*rJunction*sqrt(xC^2+yC^2))) – atan(xC/yC) ;
in
rotPosition == – (theta- theta0);
end
omega == der(theta);
end

end I have a Simscape block that takes linPosition (physical signal) as an input and computes rotPosition (another physical signal). If I put it in my model, where linPosition is 0 for 1ms and then starts increasing smoothly, it works (rotPosition and theta are constant for 1ms and then follow the growth of linPosition). The problem arises when I try to add an additional computation: omega == der(theta) (I need it to make more calculation and provide another output). With that additional equation, I get this warning:
Equations (including nonlinear equations) of one or more components may be dependent or inconsistent. This can cause problems in transient initialization.
referred to the first and second equations. Then the simulation stops at 1ms:
An error occurred during simulation and the simulation was stopped
Caused by:
[‘testCircuit/Solver Configuration’]: Transient initialization at time 0.001, solving for consistent states and modes, failed to converge.
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
all components and nodal across variables involved
Cannot solve for one or more variables, including dynamic variable derivatives:
Time derivative of ‘CRIB.CRIB_velocityBased.breaking_part.offsetSliderCrank.theta’ (rot angle with respect to horizontal)
‘CRIB.CRIB_velocityBased.breaking_part.offsetSliderCrank.omega’ (omega)
In my mind, theta and gamma in the equations are computed and then omega follows the value of theta, but I guess that this is not how it works.

component offsetSliderCrank

inputs
linPosition = {0, ‘mm’};
end

outputs
rotPosition = {0, ‘deg’};
end

parameters
lRod = { 45, ‘mm’ }; %
rJunction = { 10, ‘mm’ }; %
xC = { 2, ‘mm’ }; %
yC = { 40, ‘mm’ }; %

end

variables(Access=Protected)
theta = {value={0,’deg’},imin={-90,’deg’},imax={89,’deg’}}; % rot angle with respect to horizontal
gamma = {value={0,’deg’},imin={0,’deg’},imax={180,’deg’}}; % angle between lRod and horizontal
omega = {0,’deg/s’};

end

equations
lRod*cos(gamma)+xC == rJunction*cos(theta);
yC-linPosition – rJunction*sin(theta) == lRod*sin(gamma);
let
theta0 = asin((yC^2+rJunction^2-lRod^2+xC^2)/(2*rJunction*sqrt(xC^2+yC^2))) – atan(xC/yC) ;
in
rotPosition == – (theta- theta0);
end
omega == der(theta);
end

end simscape, derivative MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *