Computing rotor speed and position
Hello guys! I've been work on a magnetic gear project (https://github.com/CassioKruger/PDD-pure) and I'm having trouble to compute the velocity of the moving bands. I took the "machine_magstadyn_a.pro" file to base my project and added some modifications to use it with 2 rotors instead of 1.
There is a gear ratio between both rotors, so I made this in my .pro file:
// pdd gear ratio:
// pH*wH + pL*wL = nP*wP
// wH is the speed of the inner rotor
// wL is the speed of the outer rotor
// wP is the speed of the modulators
// When one of the three parts of the gear is stationary, there will be a constant relation or gear ratio
// between the speeds of other two parts.
// considering that the outer rotor is stationary, the gear ratio becomes:
// -> pH*wH = nP*wP
// -> Gr = pH/nP = wP/wH
// -> gear ratio = nbr of poles at rotor 1 / nbr of modulators
// in this case, the nbr of modulators is equal to the nbr of poles at the outer rotor, so:
gear_ratio = NbrPolesInModel/NbrSectStatorMag;
delta_theta[] = delta_theta_deg * deg2rad ; //rotor 1 step
delta_theta2[] = delta_theta[] * gear_ratio ; //rotor 2 step
those "delta_theta[]" should be the step of each rotor to use with "ChangeOfCoordinates" inside the timeloop of the "machine_magstadyn_a_2rotors.pro" file, like this:
ChangeOfCoordinates[ NodesOf[Rotor_Moving], RotatePZ[delta_theta[]]];
ChangeOfCoordinates[ NodesOf[Rotor2_Moving], RotatePZ[delta_theta2[]]];
and that's working nice, the gear ration is clearly seen at the simulation. But the thing that I'm couldn't figure out is how to compute the correct speed and position of each rotor, so I can show it with graphs and prove that my model is working. I've made this: -First, I've declared a "DomainKin2", because now there is 2 parts moving -Then, inside the "Constraint{}" I made this:
Constraint{
...
...
...
//Kinetics
{ Name CurrentPosition ; // [m]
Case {
{ Region DomainKin ; Type Init ; Value ($PreviousPosition = 0) ; }
}
}
{ Name CurrentVelocity ; // [rad/s]
Case {
{ Region DomainKin ; Type Init ; Value ($PreviousVelocity = 0) ; }
}
}
//Kinetics - MOVING BAND 2
{ Name CurrentPosition2 ; // [m]
Case {
{ Region DomainKin2 ; Type Init ; Value ($PreviousPosition2 = 0) ; }
}
}
{ Name CurrentVelocity2 ; // [rad/s]
Case {
{ Region DomainKin2 ; Type Init ; Value ($PreviousVelocity2 = 0) ; }
}
}
}
-After that, I did the same to "FunctionSpace{}":
FunctionSpace{
...
...
...
// For mechanical equation
{ Name Position ; Type Scalar ;
BasisFunction {
{ Name sr ; NameOfCoef pr ; Function BF_Region ;
Support DomainKin ; Entity DomainKin ; }
}
GlobalQuantity {
{ Name P ; Type AliasOf ; NameOfCoef pr ; }
}
Constraint {
{ NameOfCoef P ; EntityType Region ; NameOfConstraint CurrentPosition ; }
}
}
{ Name Velocity ; Type Scalar ;
BasisFunction {
{ Name sr ; NameOfCoef vr ; Function BF_Region ;
Support DomainKin ; Entity DomainKin ; } }
GlobalQuantity {
{ Name V ; Type AliasOf ; NameOfCoef vr ; }
}
Constraint {
{ NameOfCoef V ; EntityType Region ; NameOfConstraint CurrentVelocity ; }
}
}
// For mechanical equation - MOVING BAND 2
{ Name Position2 ; Type Scalar ;
BasisFunction {
{ Name sr ; NameOfCoef pr2 ; Function BF_Region ;
Support DomainKin2 ; Entity DomainKin2 ; }
}
GlobalQuantity {
{ Name P2 ; Type AliasOf ; NameOfCoef pr2 ; }
}
Constraint {
{ NameOfCoef P2 ; EntityType Region ; NameOfConstraint CurrentPosition2 ; }
}
}
{ Name Velocity2 ; Type Scalar ;
BasisFunction {
{ Name sr ; NameOfCoef vr2 ; Function BF_Region ;
Support DomainKin2 ; Entity DomainKin2 ; } }
GlobalQuantity {
{ Name V2 ; Type AliasOf ; NameOfCoef vr2 ; }
}
Constraint {
{ NameOfCoef V2 ; EntityType Region ; NameOfConstraint CurrentVelocity2 ; }
}
}
}
-In the "Formulation{}", I did this:
Formulation{
...
...
...
// Mechanics
{ Name Mechanical ; Type FemEquation ;
Quantity {
{ Name V ; Type Global ; NameOfSpace Velocity [V] ; } // velocity
{ Name P ; Type Global ; NameOfSpace Position [P] ; } // position
{ Name V2 ; Type Global ; NameOfSpace Velocity2 [V2] ; } // velocity MB2
{ Name P2 ; Type Global ; NameOfSpace Position2 [P2] ; } // position MB2
}
Equation {
GlobalTerm { DtDof [ /*Inertia **/ Dof{V} , {V} ] ; In DomainKin ; }
//GlobalTerm { [ Friction[] * Dof{V} , {V} ] ; In DomainKin ; }
GlobalTerm { [ Torque_mec[], {V} ] ; In DomainKin ; }
GlobalTerm { [ Torque_mag[] , {V} ] ; In DomainKin ; }
GlobalTerm { DtDof [ Dof{P} , {P} ] ; In DomainKin ; }
GlobalTerm { [-Dof{V} , {P} ] ; In DomainKin ; }
//---------------------------------------------------------------//
GlobalTerm { DtDof [ /*Inertia*0.7 **/ Dof{V2} , {V2} ] ; In DomainKin2 ; }
//GlobalTerm { [ Friction[] * Dof{V2} , {V2} ] ; In DomainKin2 ; }
GlobalTerm { [ Torque_mec[] , {V2} ] ; In DomainKin2 ; }
GlobalTerm { [ Torque_mag[] , {V2} ] ; In DomainKin2 ; }
GlobalTerm { DtDof [ Dof{P2} , {P2} ] ; In DomainKin2 ; }
GlobalTerm { [-Dof{V2} , {P2} ] ; In DomainKin2 ; }
}
}
}
-And, finally, in the "PostProcessing{}" I did this:
PostProcessing{
...
...
...
{ Name Mechanical ; NameOfFormulation Mechanical ;
PostQuantity {
{ Name P ; Value { Term { [ {P} ] ; In DomainKin ; } } } // Position [rad]
{ Name Pdeg ; Value { Term { [ {P}*180/Pi ] ; In DomainKin ; } } } // Position [deg]
{ Name V ; Value { Term { [ {V} ] ; In DomainKin ; } } } // Velocity [rad/s]
{ Name Vrpm ; Value { Term { [ {V}*30/Pi ] ; In DomainKin ; } } } // Velocity [rpm]
//------------------------------------------------------------------------------------//
//MB2
{ Name P2 ; Value { Term { [ {P2} ] ; In DomainKin2 ; } } } // Position [rad]
{ Name Pdeg2 ; Value { Term { [ {P2}*180/Pi ] ; In DomainKin2 ; } } } // Position [deg]
{ Name V2 ; Value { Term { [ {V2} ] ; In DomainKin2 ; } } } // Velocity [rad/s]
{ Name Vrpm2 ; Value { Term { [ {V2}*30/Pi ] ; In DomainKin2 ; } } } // Velocity [rpm]
}
}
}
After that, is just the PostOperation stuff to creat .dat files to plot the results...
I'm sorry for the long issue, but I REALLY can't figure out how to compute those. Thanks in advance!!!