Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

83 lines
3.1 KiB

  1. subroutine TopDrive_MainSolver
  2. use SimulationVariables
  3. IMPLICIT NONE
  4. CALL TopDrive_Inputs
  5. if ( (data%State%TDS%PowerState==-1) ) then !FWD
  6. data%State%TDS%SoundBlower = .true.
  7. data%State%TDS%PowerLed = 1
  8. data%State%TDS%N_new = (data%State%TDS%RpmKnob/250.d0)*965.d0 ! 0<data%State%TDS%RpmKnob<250 , 0<data%State%TDS%N_ref(truction motor)<965
  9. !===> Top Drive Malfunction ----> Drive Motor Failure
  10. if ( data%State%TDS%MotorFaileMalf==1 ) then
  11. data%State%TDS%N_new = 0.d0
  12. end if
  13. !========================== Top Drive Rate limit ==========================
  14. if (((data%State%TDS%N_new-data%State%TDS%N_old)/data%State%TDS%time_step)>data%State%TDS%RateChange) then
  15. data%State%TDS%N_ref = (data%State%TDS%RateChange*data%State%TDS%time_step)+data%State%TDS%N_old
  16. else if (((data%State%TDS%N_old-data%State%TDS%N_new)/data%State%TDS%time_step)>data%State%TDS%RateChange) then
  17. data%State%TDS%N_ref = (-data%State%TDS%RateChange*data%State%TDS%time_step)+data%State%TDS%N_old
  18. else
  19. data%State%TDS%N_ref = data%State%TDS%N_new
  20. end if
  21. !==========================================================================
  22. CALL TopDrive_Solver
  23. else if ( (data%State%TDS%PowerState==1) ) then !REV
  24. data%State%TDS%SoundBlower = .true.
  25. data%State%TDS%PowerLed = 1
  26. data%State%TDS%N_new = (data%State%TDS%RpmKnob/250.d0)*965.d0
  27. !===> Top Drive Malfunction ----> Drive Motor Failure
  28. if ( data%State%TDS%MotorFaileMalf==1 ) then
  29. data%State%TDS%N_new = 0.d0
  30. end if
  31. !========================== Top Drive Rate limit ==========================
  32. if (((data%State%TDS%N_new-data%State%TDS%N_old)/data%State%TDS%time_step)>data%State%TDS%RateChange) then
  33. data%State%TDS%N_ref =(data%State%TDS%RateChange*data%State%TDS%time_step)+data%State%TDS%N_old
  34. else if (((data%State%TDS%N_old-data%State%TDS%N_new)/data%State%TDS%time_step)>data%State%TDS%RateChange) then
  35. data%State%TDS%N_ref = (-data%State%TDS%RateChange*data%State%TDS%time_step)+data%State%TDS%N_old
  36. else
  37. data%State%TDS%N_ref = data%State%TDS%N_new
  38. end if
  39. !==========================================================================
  40. CALL TopDrive_Solver
  41. else
  42. if( (data%State%TDS%PowerState /= 0) ) then
  43. data%State%TDS%SoundBlower = .true.
  44. data%State%TDS%PowerLed = 1
  45. else
  46. data%State%TDS%SoundBlower = .false.
  47. data%State%TDS%PowerLed = 0
  48. end if
  49. Call TopDrive_OffMode
  50. end if
  51. Call TopDrive_Outputs
  52. data%State%TDS%N_old = data%State%TDS%N_ref
  53. end subroutine TopDrive_MainSolver