Simulation Core
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

101 righe
5.2 KiB

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