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.

TopDrive_Traction_Motor.f90 4.8 KiB

1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. subroutine TopDrive_Traction_Motor
  2. use CDrillingConsoleVariables
  3. use CDataDisplayConsoleVariables
  4. ! use CSimulationVariables
  5. use CTopDrivePanelVariables
  6. use TopDrive_VARIABLES
  7. use equipments_PowerLimit
  8. IMPLICIT NONE
  9. !integer :: jnomb
  10. !jnomb = 0
  11. !>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<<
  12. TDS%TL = (TDS%String_Torque+TDS%ConstLoad)/(TDS%Mech_Efficiency*TDS%Conv_Ratio)
  13. La = 1700.*1d-6
  14. Lf = 260.*1d-6
  15. Ra = 9.5*1d-3
  16. !Rf = 5.4*1d-3
  17. Rf = 0.
  18. !******** controller *******
  19. Kpn = 50.d0
  20. Kin = 3.d0
  21. Kpi = 100.d0
  22. Kii = 900.d0
  23. TDS%time = TDS%time_step
  24. TDS%dt = 1.d-5
  25. TDS%error = .001
  26. !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  27. TDS%n = TDS%time/TDS%dt
  28. TDS%w_ref = (pi*(TDS%N_ref)/30.)
  29. TDS%ia_ref_limit = TopDrivePanel%TopDriveTorqueLimitKnob/60.d0
  30. TDS%ia_er = 1.
  31. TDS%w_er = 1.
  32. TDS%x_er = 1.
  33. TDS%y_er = 1.
  34. TDS%i = 1
  35. !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  36. DO WHILE (TDS%i<=TDS%n)
  37. !>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<<
  38. call TDS_dx((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%x,TDS%y)
  39. call TDS_dy((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%x,TDS%y)
  40. call TDS_dia((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%fii,TDS%x,TDS%y)
  41. call TDS_dw((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%fii,TDS%TL)
  42. TDS%K1x = TDS%dt*TDS%dx
  43. TDS%K1y = TDS%dt*TDS%dy
  44. TDS%K1ia = TDS%dt*TDS%dia
  45. TDS%K1w = TDS%dt*TDS%dw
  46. call TDS_dx((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%x+(TDS%K1x/2.),TDS%y+(TDS%K1y/2.))
  47. call TDS_dy((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%x+(TDS%K1x/2.),TDS%y+(TDS%K1y/2.))
  48. call TDS_dia((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%fii,TDS%x+(TDS%K1x/2.),TDS%y+(TDS%K1y/2.))
  49. call TDS_dw((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%fii,TDS%TL)
  50. TDS%K2x = TDS%dt*TDS%dx
  51. TDS%K2y = TDS%dt*TDS%dy
  52. TDS%K2ia = TDS%dt*TDS%dia
  53. TDS%K2w = TDS%dt*TDS%dw
  54. call TDS_dx((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%x+(TDS%K2x/2.),TDS%y+(TDS%K2y/2.))
  55. call TDS_dy((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%x+(TDS%K2x/2.),TDS%y+(TDS%K2y/2.))
  56. call TDS_dia((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%fii,TDS%x+(TDS%K2x/2.),TDS%y+(TDS%K2y/2.))
  57. call TDS_dw((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%fii,TDS%TL)
  58. TDS%K3x = TDS%dt*TDS%dx
  59. TDS%K3y = TDS%dt*TDS%dy
  60. TDS%K3ia = TDS%dt*TDS%dia
  61. TDS%K3w = TDS%dt*TDS%dw
  62. call TDS_dx((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%x+TDS%K3x,TDS%y+TDS%K3y)
  63. call TDS_dy((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%x+TDS%K3x,TDS%y+TDS%K3y)
  64. call TDS_dia((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%fii,TDS%x+TDS%K3x,TDS%y+TDS%K3y)
  65. call TDS_dw((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%fii,TDS%TL)
  66. TDS%K4x = TDS%dt*TDS%dx
  67. TDS%K4y = TDS%dt*TDS%dy
  68. TDS%K4ia = TDS%dt*TDS%dia
  69. TDS%K4w = TDS%dt*TDS%dw
  70. TDS%x_new = TDS%x_old+((TDS%K1x+(2.*TDS%K2x)+(2.*TDS%K3x)+TDS%K4x)/6.)
  71. TDS%y_new = TDS%y_old+((TDS%K1y+(2.*TDS%K2y)+(2.*TDS%K3y)+TDS%K4y)/6.)
  72. TDS%ia_new = TDS%ia_old+((TDS%K1ia+(2.*TDS%K2ia)+(2.*TDS%K3ia)+TDS%K4ia)/6.)
  73. TDS%w_new = TDS%w_old+((TDS%K1w+(2.*TDS%K2w)+(2.*TDS%K3w)+TDS%K4w)/6.)
  74. !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  75. TDS%x_old = TDS%x_new
  76. TDS%y_old = TDS%y_new
  77. TDS%ia_old = TDS%ia_new
  78. TDS%w_old = TDS%w_new
  79. TDS%x = TDS%x_new
  80. TDS%y = TDS%y_new
  81. TDS%ia = TDS%ia_new
  82. TDS%w = TDS%w_new
  83. TDS%Te = TDS%fii*TDS%ia_new
  84. !if (jnomb==0) then
  85. ! print*, 'TDS%Vt0=', TDS%Vt
  86. ! jnomb=1
  87. !end if
  88. TDS%ia_ref = TDS%y_new+Kpn*((30.0*TDS%w_ref/pi)-(30.0*TDS%w_new/pi))
  89. call RTTorqueLimit
  90. TDS%Vt = TDS%x_new+(Kpi*(TDS%ia_ref-TDS%ia_new))
  91. !call PowerLimits
  92. !if (Power_sigma>max_Power_sigma) then
  93. ! TDS%Vt = TDS%Vt
  94. !else
  95. ! TDS%Vt = TDS%x_new+(Kpi*(TDS%ia_ref-TDS%ia_new))
  96. !end if
  97. IF (TDS%Vt>810.) THEN
  98. TDS%Vt = 810.0
  99. ELSE IF (TDS%Vt<0.) THEN
  100. TDS%Vt = 0.0
  101. END IF
  102. TDS%i = TDS%i+1
  103. END DO
  104. !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  105. END subroutine