I want to convert the rotational motion of an axle into the translational movement of a chain to simulate the oscillations in the chain due to the polygon effect caused by the chain hub. I implemented the excitation formula of the chain movement and the changing radius of the chain hub. I wrote a little code-example to test the funktionality, but it didn't work like planned. Here the MWE:
model rotational_to_translational
Real psi;
parameter Real t_k(start=0.012, unit = "m");
parameter Real d(start=0.0037, unit = "m");
parameter Integer e(start=5);
parameter Real pi = Modelica.Constants.pi;
Real alpha, beta, gamma;
Real r_2;
Real dummy1, dummy3;
Modelica.Units.SI.Position x_k;
Modelica.Units.SI.Position y_k;
Integer j(start=1);
Real psi_k;
rotational rotational1;
translational translational1;
equation
rotational1.phi = psi;
alpha = 2*pi/e;
beta = atan((sin(alpha/2))/(((t_k - d)/(t_k + d)) + cos(alpha/2)));
gamma = (alpha/2) - beta;
r_2 = (t_k + d)/(2*sin(beta));
j = floor(psi/alpha);
psi_k = psi - j*alpha;
if (0 <= psi_k) and (psi_k < alpha/2) then
dummy1 = ((t_k + d)/2) + (r_2*sin(psi_k - beta)) + 2*j*t_k;
dummy3 = r_2*cos(psi_k - beta);
elseif (alpha/2 <= psi_k) and (psi_k < alpha) then
dummy1 = (((3*t_k) - d)/2) + (r_2*sin(psi_k + beta - alpha)) + 2*j*t_k;
dummy3 = r_2*cos(psi_k + beta - alpha);
else
dummy1 = 0;
dummy3 = 0;
end if;
y_k = dummy1;
x_k = dummy3;
translational1.f*x_k = rotational1.tau;
y_k = translational1.s;
end rotational_to_translational;
The first few parameters
and the folowing variables are needed to describe the dimensions of chain hub, and psi
should be the rotation angle of the input shaft. x_k
and y_k
are the resulting positions of the chain, see the image attached
x_k and y_k
I wrote the two connectors rotational1
and translational1
to separate the two domains and carry a bit mor information, both contain two variables(position/angle and force/moment). The connectors are defined as follows:
connector translational
Modelica.Units.SI.Position s;
flow Modelica.Units.SI.Force f;
end translational;
connector rotational
Modelica.Units.SI.Angle phi;
flow Modelica.Units.SI.MomentOfForce tau;
end rotational;
I would like to model the force in the chain by using the moment in the axle and levering it via the changing radius of the polygon. Vice versa would i like to model the position of the chain by the rotation angle of the shaft. But i encounter problems using the variables x_k
and y_k
. I assume that the if-statemants generate some errors in the calculation. If i try to simulate the model i get the folowing errors:
[4] 15:00:32 Übersetzung Fehler [C:/OM124/OM64bit/OMCompiler/Compiler/BackEnd/ResolveLoops.mo: 293:9-293:86]: Internal error function resolveLoops_cutNodes failed
[5] 15:00:32 Übersetzung Fehler Internal error IndexReduction.pantelidesIndexReduction failed! Found empty set of continuous equations. Use -d=bltdump to get more information.
[6] 15:00:32 Übersetzung Fehler Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!
along with some warnings (which dont bother me right now):
[1] 15:00:32 Übersetzung Warnung [rotational_to_translational: 3:3-3:46]: Parameter t_k has no value, and is fixed during initialization (fixed=true), using available start value (start=0.012) as default value.
[2] 15:00:32 Übersetzung Warnung [rotational_to_translational: 4:3-4:45]: Parameter d has no value, and is fixed during initialization (fixed=true), using available start value (start=0.0037) as default value.
[3] 15:00:32 Übersetzung Warnung [rotational_to_translational: 5:3-5:31]: Parameter e has no value, and is fixed during initialization (fixed=true), using available start value (start=5) as default value.
I tried modeling the physical system by using the existing models from the Modelica.Mechanical library. The best example is the IdealRollingWheel in the Modelica.Mechanical.Rotational.Components path. I tried changing the values of the variables i would like to link, and it seems that Modelica has problems using the variables that are discontinuous. An other Problem i encountered has to do with the amount of equations and variables in the model. During testing and experimenting with different values, the simulation wouldnt start due to insufficient variables or equations. For example:
[4] 15:15:04 Symbolisch Fehler An independent subset of the model has imbalanced number of equations (4) and variables (3). variables: translational1.f rotational1.tau x_k equations: 1 : rotational1.tau = 0.0 2 : translational1.f = 0.0 3 : x_k = 4.0 4 : translational1.f * x_k = rotational1.tau
But when i check the model using the green button i get:
[1] 15:19:11 Skripting Meldung Check of rotational_to_translational completed successfully. Class rotational_to_translational has 15 equation(s) and 15 variable(s). 7 of these are trivial equation(s).
I am fairly new to Modelica, but i need to solve this problem somehow. I am very grateful for any advice or hint i get. Thanks
I want to convert the rotational motion of an axle into the translational movement of a chain to simulate the oscillations in the chain due to the polygon effect caused by the chain hub. I implemented the excitation formula of the chain movement and the changing radius of the chain hub. I wrote a little code-example to test the funktionality, but it didn't work like planned. Here the MWE:
model rotational_to_translational
Real psi;
parameter Real t_k(start=0.012, unit = "m");
parameter Real d(start=0.0037, unit = "m");
parameter Integer e(start=5);
parameter Real pi = Modelica.Constants.pi;
Real alpha, beta, gamma;
Real r_2;
Real dummy1, dummy3;
Modelica.Units.SI.Position x_k;
Modelica.Units.SI.Position y_k;
Integer j(start=1);
Real psi_k;
rotational rotational1;
translational translational1;
equation
rotational1.phi = psi;
alpha = 2*pi/e;
beta = atan((sin(alpha/2))/(((t_k - d)/(t_k + d)) + cos(alpha/2)));
gamma = (alpha/2) - beta;
r_2 = (t_k + d)/(2*sin(beta));
j = floor(psi/alpha);
psi_k = psi - j*alpha;
if (0 <= psi_k) and (psi_k < alpha/2) then
dummy1 = ((t_k + d)/2) + (r_2*sin(psi_k - beta)) + 2*j*t_k;
dummy3 = r_2*cos(psi_k - beta);
elseif (alpha/2 <= psi_k) and (psi_k < alpha) then
dummy1 = (((3*t_k) - d)/2) + (r_2*sin(psi_k + beta - alpha)) + 2*j*t_k;
dummy3 = r_2*cos(psi_k + beta - alpha);
else
dummy1 = 0;
dummy3 = 0;
end if;
y_k = dummy1;
x_k = dummy3;
translational1.f*x_k = rotational1.tau;
y_k = translational1.s;
end rotational_to_translational;
The first few parameters
and the folowing variables are needed to describe the dimensions of chain hub, and psi
should be the rotation angle of the input shaft. x_k
and y_k
are the resulting positions of the chain, see the image attached
x_k and y_k
I wrote the two connectors rotational1
and translational1
to separate the two domains and carry a bit mor information, both contain two variables(position/angle and force/moment). The connectors are defined as follows:
connector translational
Modelica.Units.SI.Position s;
flow Modelica.Units.SI.Force f;
end translational;
connector rotational
Modelica.Units.SI.Angle phi;
flow Modelica.Units.SI.MomentOfForce tau;
end rotational;
I would like to model the force in the chain by using the moment in the axle and levering it via the changing radius of the polygon. Vice versa would i like to model the position of the chain by the rotation angle of the shaft. But i encounter problems using the variables x_k
and y_k
. I assume that the if-statemants generate some errors in the calculation. If i try to simulate the model i get the folowing errors:
[4] 15:00:32 Übersetzung Fehler [C:/OM124/OM64bit/OMCompiler/Compiler/BackEnd/ResolveLoops.mo: 293:9-293:86]: Internal error function resolveLoops_cutNodes failed
[5] 15:00:32 Übersetzung Fehler Internal error IndexReduction.pantelidesIndexReduction failed! Found empty set of continuous equations. Use -d=bltdump to get more information.
[6] 15:00:32 Übersetzung Fehler Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!
along with some warnings (which dont bother me right now):
[1] 15:00:32 Übersetzung Warnung [rotational_to_translational: 3:3-3:46]: Parameter t_k has no value, and is fixed during initialization (fixed=true), using available start value (start=0.012) as default value.
[2] 15:00:32 Übersetzung Warnung [rotational_to_translational: 4:3-4:45]: Parameter d has no value, and is fixed during initialization (fixed=true), using available start value (start=0.0037) as default value.
[3] 15:00:32 Übersetzung Warnung [rotational_to_translational: 5:3-5:31]: Parameter e has no value, and is fixed during initialization (fixed=true), using available start value (start=5) as default value.
I tried modeling the physical system by using the existing models from the Modelica.Mechanical library. The best example is the IdealRollingWheel in the Modelica.Mechanical.Rotational.Components path. I tried changing the values of the variables i would like to link, and it seems that Modelica has problems using the variables that are discontinuous. An other Problem i encountered has to do with the amount of equations and variables in the model. During testing and experimenting with different values, the simulation wouldnt start due to insufficient variables or equations. For example:
[4] 15:15:04 Symbolisch Fehler An independent subset of the model has imbalanced number of equations (4) and variables (3). variables: translational1.f rotational1.tau x_k equations: 1 : rotational1.tau = 0.0 2 : translational1.f = 0.0 3 : x_k = 4.0 4 : translational1.f * x_k = rotational1.tau
But when i check the model using the green button i get:
[1] 15:19:11 Skripting Meldung Check of rotational_to_translational completed successfully. Class rotational_to_translational has 15 equation(s) and 15 variable(s). 7 of these are trivial equation(s).
I am fairly new to Modelica, but i need to solve this problem somehow. I am very grateful for any advice or hint i get. Thanks
Share Improve this question asked Mar 4 at 14:31 WaldoWaldo 11 bronze badge1 Answer
Reset to default 1The floor
function in Modelica returns a Real, not an Integer.
Using j = integer(psi/alpha);
instead of j = floor(psi/alpha);
ensures that you have the same number of Real variables as Real equations.
Checking the original model in Dymola gives something like
... The problem is structurally singular for the element type Real.
The number of scalar Real unknown elements are 14. The number of scalar Real equation elements are 15.
The problem is structurally singular for the element type Integer.
The number of scalar Integer unknown elements are 1. The number of scalar Integer equation elements are 0.
The following variables are considered as unknowns, but are not appearing in the equations. j
BTW instead of your own connectors you can use:
import rotational=Modelica.Mechanics.Rotational.Interfaces.Flange;
import translational=Modelica.Mechanics.Translational.Interfaces.Flange;