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.

RTable_OffModeSolver.i90 3.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/RTable_OffModeSolver.f90"
  2. subroutine RTable_OffMode
  3. use SimulationVariables !@
  4. IMPLICIT NONE
  5. REAL :: RT_OldSpeed, RT_OldRpmGauge
  6. RT_OldSpeed = data%State%RTable%Speed
  7. RT_OldRpmGauge = data%State%RTable%RpmGaugeOutput
  8. data%State%RTable%N_new = 0.d0
  9. !======================= Rotary Table Rate_limit =======================
  10. if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then
  11. data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old
  12. else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then
  13. data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old
  14. else
  15. data%State%RTable%N_ref = data%State%RTable%N_new
  16. end if
  17. !=======================================================================
  18. if ( any(data%State%RTable%RotaryMode==(/1,4/)) ) then !if rotary connected to string
  19. !==> RPM
  20. data%State%RTable%Speed = data%State%RTable%N_ref/data%State%RTable%Conv_Ratio
  21. data%State%RTable%Speed = min(data%State%RTable%Speed,data%State%RTable%MaxRPM) !Speed [RPM]
  22. data%State%RTable%RpmGaugeOutput = data%State%RTable%Speed
  23. !==> Sound
  24. data%State%RTable%SoundRPM = INT(data%State%RTable%Speed)
  25. !==> Torque
  26. data%State%RTable%Torque = ( ((data%State%RTable%J_coef+data%State%RTable%String_JCoef)*((((pi*data%State%RTable%Speed)/30.d0)-((pi*RT_OldSpeed)/30.d0))/data%State%RTable%time_step))+(data%State%RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m]
  27. data%State%RTable%Torque = min(data%State%RTable%Torque,data%State%RTable%MaxTorque)
  28. data%State%RTable%TorqueGaugeOutput = data%State%RTable%Torque
  29. else if ( any(data%State%RTable%RotaryMode==(/2,5/)) ) then
  30. !==> RPM
  31. data%State%RTable%Speed = 0.d0
  32. data%State%RTable%RpmGaugeOutput = data%State%RTable%N_ref/data%State%RTable%Conv_Ratio
  33. data%State%RTable%RpmGaugeOutput = min(data%State%RTable%RpmGaugeOutput,data%State%RTable%MaxRPM)
  34. !==> Sound
  35. data%State%RTable%SoundRPM = INT(data%State%RTable%RpmGaugeOutput)
  36. !==> Torque
  37. data%State%RTable%Torque = 0.d0
  38. data%State%RTable%TorqueGaugeOutput = ( ((data%State%RTable%J_coef+data%State%RTable%String_JCoef)*((((pi*data%State%RTable%RpmGaugeOutput)/30.d0)-((pi*RT_OldRpmGauge)/30.d0))/data%State%RTable%time_step))+(data%State%RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m]
  39. data%State%RTable%TorqueGaugeOutput = min(data%State%RTable%TorqueGaugeOutput,data%State%RTable%MaxTorque)
  40. else if ( data%State%RTable%RotaryMode==3 ) then
  41. !==> RPM
  42. data%State%RTable%Speed = 0.d0
  43. data%State%RTable%RpmGaugeOutput = 0.d0
  44. !==> Sound
  45. data%State%RTable%SoundRPM = INT(data%State%RTable%RpmGaugeOutput)
  46. !==> Torque
  47. data%State%RTable%Torque = 0.d0
  48. data%State%RTable%TorqueGaugeOutput = 0.d0
  49. end if
  50. end subroutine RTable_OffMode