subroutine RTable_OffMode use RTable_VARIABLES IMPLICIT NONE REAL :: RT_OldSpeed, RT_OldRpmGauge RT_OldSpeed = RTable%Speed RT_OldRpmGauge = RTable%RpmGaugeOutput RTable%N_new = 0.d0 !======================= Rotary Table Rate_limit ======================= if (((RTable%N_new-RTable%N_old)/RTable%time_step)>RTable%RateChange) then RTable%N_ref = (RTable%RateChange*RTable%time_step)+RTable%N_old else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>RTable%RateChange) then RTable%N_ref = (-RTable%RateChange*RTable%time_step)+RTable%N_old else RTable%N_ref = RTable%N_new end if !======================================================================= if ( any(RTable%RotaryMode==(/1,4/)) ) then !if rotary connected to string !==> RPM RTable%Speed = RTable%N_ref/RTable%Conv_Ratio RTable%Speed = min(RTable%Speed,RTable%MaxRPM) !Speed [RPM] RTable%RpmGaugeOutput = RTable%Speed !==> Sound RTable%SoundRPM = INT(RTable%Speed) !==> Torque RTable%Torque = ( ((RTable%J_coef+RTable%String_JCoef)*((((pi*RTable%Speed)/30.d0)-((pi*RT_OldSpeed)/30.d0))/RTable%time_step))+(RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] RTable%Torque = min(RTable%Torque,RTable%MaxTorque) RTable%TorqueGaugeOutput = RTable%Torque else if ( any(RTable%RotaryMode==(/2,5/)) ) then !==> RPM RTable%Speed = 0.d0 RTable%RpmGaugeOutput = RTable%N_ref/RTable%Conv_Ratio RTable%RpmGaugeOutput = min(RTable%RpmGaugeOutput,RTable%MaxRPM) !==> Sound RTable%SoundRPM = INT(RTable%RpmGaugeOutput) !==> Torque RTable%Torque = 0.d0 RTable%TorqueGaugeOutput = ( ((RTable%J_coef+RTable%String_JCoef)*((((pi*RTable%RpmGaugeOutput)/30.d0)-((pi*RT_OldRpmGauge)/30.d0))/RTable%time_step))+(RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] RTable%TorqueGaugeOutput = min(RTable%TorqueGaugeOutput,RTable%MaxTorque) else if ( RTable%RotaryMode==3 ) then !==> RPM RTable%Speed = 0.d0 RTable%RpmGaugeOutput = 0.d0 !==> Sound RTable%SoundRPM = INT(RTable%RpmGaugeOutput) !==> Torque RTable%Torque = 0.d0 RTable%TorqueGaugeOutput = 0.d0 end if end subroutine RTable_OffMode