Simulation Core
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CHoistingProblems.f90 5.3 KiB

1 år sedan
1 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. module CHoistingProblems
  2. use SimulationVariables
  3. implicit none
  4. public
  5. contains
  6. subroutine HoistingProblemsFromJson(parent)
  7. type(json_value),pointer :: parent
  8. type(json_core) :: json
  9. type(json_value),pointer :: p
  10. call json%get(parent,'HoistingProblems',p)
  11. call ProblemFromJson(p,"MotorFail",data%problems%HoistingProblems%MotorFail)
  12. call ProblemFromJson(p,"ClutchEngage",data%problems%HoistingProblems%ClutchEngage)
  13. call ProblemFromJson(p,"ClutchDisengage",data%problems%HoistingProblems%ClutchDisengage)
  14. end subroutine
  15. subroutine HoistingProblemsToJson(parent)
  16. type(json_value),pointer :: parent
  17. type(json_core) :: json
  18. type(json_value),pointer :: p
  19. ! 1. create new node
  20. call json%create_object(p,'HoistingProblems')
  21. ! 2. add member of data type to new node
  22. call ProblemToJson(p,"MotorFail",data%problems%HoistingProblems%MotorFail)
  23. call ProblemToJson(p,"ClutchEngage",data%problems%HoistingProblems%ClutchEngage)
  24. call ProblemToJson(p,"ClutchDisengage",data%problems%HoistingProblems%ClutchDisengage)
  25. ! 3. add new node to parent
  26. call json%add(parent,p)
  27. end subroutine
  28. subroutine ProcessHoistingProblemsDueTime(time)
  29. implicit none
  30. integer :: time
  31. if(data%problems%HoistingProblems%MotorFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%HoistingProblems%MotorFail, ChangeMotorFail, time)
  32. if(data%problems%HoistingProblems%ClutchEngage%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%HoistingProblems%ClutchEngage, ChangeClutchEngage, time)
  33. if(data%problems%HoistingProblems%ClutchDisengage%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%HoistingProblems%ClutchDisengage, ChangeClutchDisengage, time)
  34. end subroutine
  35. subroutine ProcessHoistingProblemsDuePumpStrokes(strokes)
  36. implicit none
  37. integer :: strokes
  38. if(data%problems%HoistingProblems%MotorFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%HoistingProblems%MotorFail, ChangeMotorFail, strokes)
  39. if(data%problems%HoistingProblems%ClutchEngage%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%HoistingProblems%ClutchEngage, ChangeClutchEngage, strokes)
  40. if(data%problems%HoistingProblems%ClutchDisengage%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%HoistingProblems%ClutchDisengage, ChangeClutchDisengage, strokes)
  41. end subroutine
  42. subroutine ProcessHoistingProblemsDueVolumePumped(volume)
  43. implicit none
  44. real(8) :: volume
  45. if(data%problems%HoistingProblems%MotorFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%HoistingProblems%MotorFail, ChangeMotorFail, volume)
  46. if(data%problems%HoistingProblems%ClutchEngage%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%HoistingProblems%ClutchEngage, ChangeClutchEngage, volume)
  47. if(data%problems%HoistingProblems%ClutchDisengage%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%HoistingProblems%ClutchDisengage, ChangeClutchDisengage, volume)
  48. end subroutine
  49. subroutine ProcessHoistingProblemsDueDistanceDrilled(distance)
  50. implicit none
  51. real(8) :: distance
  52. if(data%problems%HoistingProblems%MotorFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%HoistingProblems%MotorFail, ChangeMotorFail, distance)
  53. if(data%problems%HoistingProblems%ClutchEngage%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%HoistingProblems%ClutchEngage, ChangeClutchEngage, distance)
  54. if(data%problems%HoistingProblems%ClutchDisengage%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%HoistingProblems%ClutchDisengage, ChangeClutchDisengage, distance)
  55. end subroutine
  56. subroutine ChangeMotorFail(status)
  57. use SimulationVariables !@
  58. implicit none
  59. integer, intent (in) :: status
  60. ! if(associated(MotorFailPtr)) call MotorFailPtr(status)
  61. if(status == Clear_StatusType) data%State%Drawworks%MotorFaileMalf=0
  62. if(status == Executed_StatusType) data%State%Drawworks%MotorFaileMalf=1
  63. endsubroutine
  64. subroutine ChangeClutchEngage(status)
  65. use SimulationVariables !@
  66. implicit none
  67. integer, intent (in) :: status
  68. ! if(associated(ClutchEngagePtr)) call ClutchEngagePtr(status)
  69. if(status == Clear_StatusType) data%State%Drawworks%ClutchEngageMalf=0
  70. if(status == Executed_StatusType) data%State%Drawworks%ClutchEngageMalf=1
  71. endsubroutine
  72. subroutine ChangeClutchDisengage(status)
  73. use SimulationVariables !@
  74. implicit none
  75. integer, intent (in) :: status
  76. ! if(associated(ClutchDisengagePtr)) call ClutchDisengagePtr(status)
  77. if(status == Clear_StatusType) data%State%Drawworks%ClutchDisengageMalf=0
  78. if(status == Executed_StatusType) data%State%Drawworks%ClutchDisengageMalf=1
  79. endsubroutine
  80. end module CHoistingProblems