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.
 
 
 
 
 
 

80 lines
2.8 KiB

  1. subroutine ON_mode_simulation(Pump_No)
  2. use Pump_VARIABLES
  3. use CPumpsVariables
  4. use CDrillingConsoleVariables
  5. use CDataDisplayConsoleVariables
  6. use CSimulationVariables
  7. use CDrillWatchVariables
  8. use equipments_PowerLimit
  9. IMPLICIT NONE
  10. INTEGER :: Pump_No
  11. Call Pump_INPUTS
  12. ! Torque unit = (in.lbf)
  13. PUMP(Pump_No)%Torque = (63025./132000.)*(1./PUMP(Pump_No)%Trans_Ratio)*(PUMP(Pump_No)%Piston_Area*PUMP(Pump_No)%Stroke_Length*PUMP(Pump_No)%StandPipe_Pressure/PUMP(Pump_No)%Mech_Efficiency/PUMP(Pump_No)%Vol_Efficiency)
  14. !call PowerLimits
  15. Call Pump_Traction_Motor(Pump_No)
  16. if (PUMP(Pump_No)%N_ref<=0.) then
  17. PUMP(Pump_No)%w_ref = 0.
  18. PUMP(Pump_No)%w_old = 0.
  19. PUMP(Pump_No)%w = 0.
  20. PUMP(Pump_No)%w_new = 0.
  21. PUMP(Pump_No)%ia_old = 0.
  22. PUMP(Pump_No)%ia = 0.
  23. PUMP(Pump_No)%ia_new = 0.
  24. PUMP(Pump_No)%x_old = 0.
  25. PUMP(Pump_No)%x = 0.
  26. PUMP(Pump_No)%x_new = 0.
  27. end if
  28. if (Power_sigma>max_Power_sigma) then
  29. PUMP(Pump_No)%Vt_old = PUMP(Pump_No)%Vt_old
  30. else
  31. PUMP(Pump_No)%Vt_old = PUMP(Pump_No)%x_new+Kpi*(Kpn*((30.*PUMP(Pump_No)%w_ref/pi)-(30.*PUMP(Pump_No)%w_new/pi))-PUMP(Pump_No)%ia_new)
  32. IF (PUMP(Pump_No)%Vt_old>810.) THEN
  33. PUMP(Pump_No)%Vt_old = 810.
  34. ELSE IF (PUMP(Pump_No)%Vt_old<0.) THEN
  35. PUMP(Pump_No)%Vt_old = 0.
  36. END IF
  37. end if
  38. !PUMP(Pump_No)%Vt=PUMP(Pump_No)%x_new+Kpi*(Kpn*((30.*PUMP(Pump_No)%w_ref/pi)-(30.*PUMP(Pump_No)%w_new/pi))-PUMP(Pump_No)%ia_new)
  39. !IF (PUMP(Pump_No)%Vt>810.) THEN
  40. ! PUMP(Pump_No)%Vt=810.
  41. !ELSE IF (PUMP(Pump_No)%Vt<0.) THEN
  42. ! PUMP(Pump_No)%Vt=0.
  43. !END IF
  44. PUMP(Pump_No)%Speed = 30.*PUMP(Pump_No)%w_new/pi !Speed [RPM]
  45. Call Set_MP1SPMGauge( sngl(1-PUMP(1)%SPMGaugeMalf)*real((PUMP(1)%Speed/PUMP(1)%Trans_Ratio),8) )
  46. SPM1 = MP1SPMGauge
  47. Call Set_MP2SPMGauge( sngl(1-PUMP(2)%SPMGaugeMalf)*real((PUMP(2)%Speed/PUMP(2)%Trans_Ratio),8) )
  48. SPM2 = MP2SPMGauge
  49. Call Pump_Solver(Pump_No)
  50. Call Pump_Total_Counts
  51. !print*, 'PUMP(1)%Flow_Rate=' , PUMP(1)%Flow_Rate
  52. IF (PUMP(1)%Flow_Rate>0.) Then
  53. Call OpenPump1()
  54. !print*, 'open pump 1'
  55. Else
  56. Call ClosePump1()
  57. !print*, 'close pump 1'
  58. End if
  59. IF (PUMP(2)%Flow_Rate>0.) Then
  60. Call OpenPump2()
  61. Else
  62. Call ClosePump2()
  63. End if
  64. end subroutine ON_mode_simulation