subroutine TopDrive_MainSolver Use TopDrive_VARIABLES IMPLICIT NONE CALL TopDrive_Inputs if ( (TDS%PowerState==-1) ) then !FWD TDS%SoundBlower = .true. TDS%PowerLed = 1 TDS%N_new = (TDS%RpmKnob/250.d0)*965.d0 ! 0 Top Drive Malfunction ----> Drive Motor Failure if ( TDS%MotorFaileMalf==1 ) then TDS%N_new = 0.d0 end if !========================== Top Drive Rate limit ========================== if (((TDS%N_new-TDS%N_old)/TDS%time_step)>TDS%RateChange) then TDS%N_ref = (TDS%RateChange*TDS%time_step)+TDS%N_old else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>TDS%RateChange) then TDS%N_ref = (-TDS%RateChange*TDS%time_step)+TDS%N_old else TDS%N_ref = TDS%N_new end if !========================================================================== CALL TopDrive_Solver else if ( (TDS%PowerState==1) ) then !REV TDS%SoundBlower = .true. TDS%PowerLed = 1 TDS%N_new = (TDS%RpmKnob/250.d0)*965.d0 !===> Top Drive Malfunction ----> Drive Motor Failure if ( TDS%MotorFaileMalf==1 ) then TDS%N_new = 0.d0 end if !========================== Top Drive Rate limit ========================== if (((TDS%N_new-TDS%N_old)/TDS%time_step)>TDS%RateChange) then TDS%N_ref =(TDS%RateChange*TDS%time_step)+TDS%N_old else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>TDS%RateChange) then TDS%N_ref = (-TDS%RateChange*TDS%time_step)+TDS%N_old else TDS%N_ref = TDS%N_new end if !========================================================================== CALL TopDrive_Solver else if( (TDS%PowerState /= 0) ) then TDS%SoundBlower = .true. TDS%PowerLed = 1 else TDS%SoundBlower = .false. TDS%PowerLed = 0 end if Call TopDrive_OffMode end if Call TopDrive_Outputs TDS%N_old = TDS%N_ref end subroutine TopDrive_MainSolver