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.
 
 
 
 
 
 

106 lines
3.4 KiB

  1. module CRotaryProblemsVariables
  2. use CProblemDifinition
  3. implicit none
  4. public
  5. ! Input vars
  6. type(CProblem) :: MotorFail
  7. type(CProblem) :: OverideTorqueLimit
  8. procedure (ActionInteger), pointer :: MotorFailPtr
  9. procedure (ActionInteger), pointer :: OverideTorqueLimitPtr
  10. contains
  11. subroutine ProcessRotaryProblemsDueTime(time)
  12. implicit none
  13. integer :: time
  14. if(MotorFail%ProblemType == Time_ProblemType) call ProcessDueTime(MotorFail, ChangeMotorFail, time)
  15. if(OverideTorqueLimit%ProblemType == Time_ProblemType) call ProcessDueTime(OverideTorqueLimit, ChangeOverideTorqueLimit, time)
  16. end subroutine
  17. subroutine ProcessRotaryProblemsDuePumpStrokes(strokes)
  18. implicit none
  19. integer :: strokes
  20. if(MotorFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(MotorFail, ChangeMotorFail, strokes)
  21. if(OverideTorqueLimit%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(OverideTorqueLimit, ChangeOverideTorqueLimit, strokes)
  22. end subroutine
  23. subroutine ProcessRotaryProblemsDueVolumePumped(volume)
  24. implicit none
  25. real(8) :: volume
  26. if(MotorFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(MotorFail, ChangeMotorFail, volume)
  27. if(OverideTorqueLimit%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(OverideTorqueLimit, ChangeOverideTorqueLimit, volume)
  28. end subroutine
  29. subroutine ProcessRotaryProblemsDueDistanceDrilled(distance)
  30. implicit none
  31. real(8) :: distance
  32. if(MotorFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(MotorFail, ChangeMotorFail, distance)
  33. if(OverideTorqueLimit%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(OverideTorqueLimit, ChangeOverideTorqueLimit, distance)
  34. end subroutine
  35. subroutine ChangeMotorFail(status)
  36. use RTable_VARIABLES
  37. implicit none
  38. integer, intent (in) :: status
  39. if(associated(MotorFailPtr)) call MotorFailPtr(status)
  40. if(status == Clear_StatusType) RTable%MotorFaileMalf=0
  41. if(status == Executed_StatusType) RTable%MotorFaileMalf=1
  42. endsubroutine
  43. subroutine ChangeOverideTorqueLimit(status)
  44. use RTable_VARIABLES
  45. implicit none
  46. integer, intent (in) :: status
  47. if(associated(OverideTorqueLimitPtr)) call OverideTorqueLimitPtr(status)
  48. if(status == Clear_StatusType) RTable%OverideTorqueLimitMalf=0
  49. if(status == Executed_StatusType) RTable%OverideTorqueLimitMalf=1
  50. endsubroutine
  51. subroutine SubscribeMotorFail2(v)
  52. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeMotorFail2
  53. !DEC$ ATTRIBUTES ALIAS: 'SubscribeMotorFail2' :: SubscribeMotorFail2
  54. implicit none
  55. procedure (ActionInteger) :: v
  56. MotorFailPtr => v
  57. end subroutine
  58. subroutine SubscribeOverideTorqueLimit(v)
  59. !DEC$ ATTRIBUTES DLLEXPORT :: SubscribeOverideTorqueLimit
  60. !DEC$ ATTRIBUTES ALIAS: 'SubscribeOverideTorqueLimit' :: SubscribeOverideTorqueLimit
  61. implicit none
  62. procedure (ActionInteger) :: v
  63. OverideTorqueLimitPtr => v
  64. end subroutine
  65. end module CRotaryProblemsVariables