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.
 
 
 
 
 
 

141 lines
6.1 KiB

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