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.

пре 1 година
пре 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. module CRotaryProblems
  2. use SimulationVariables
  3. implicit none
  4. public
  5. contains
  6. subroutine RotaryProblemsFromJson(parent)
  7. type(json_value),pointer :: parent
  8. type(json_core) :: json
  9. type(json_value),pointer :: p
  10. call json%get(parent,'RotaryProblems',p)
  11. call ProblemFromJson(p,"MotorFail",data%problems%RotaryProblems%MotorFail)
  12. call ProblemFromJson(p,"OverideTorqueLimit",data%problems%RotaryProblems%OverideTorqueLimit)
  13. end subroutine
  14. subroutine RotaryProblemsToJson(parent)
  15. type(json_value),pointer :: parent
  16. type(json_core) :: json
  17. type(json_value),pointer :: p
  18. ! 1. create new node
  19. call json%create_object(p,'RotaryProblems')
  20. ! 2. add member of data type to new node
  21. call ProblemToJson(p,"MotorFail",data%problems%RotaryProblems%MotorFail)
  22. call ProblemToJson(p,"OverideTorqueLimit",data%problems%RotaryProblems%OverideTorqueLimit)
  23. ! 3. add new node to parent
  24. call json%add(parent,p)
  25. end subroutine
  26. subroutine ProcessRotaryProblemsDueTime(time)
  27. implicit none
  28. integer :: time
  29. if(data%problems%RotaryProblems%MotorFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, time)
  30. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, time)
  31. end subroutine
  32. subroutine ProcessRotaryProblemsDuePumpStrokes(strokes)
  33. implicit none
  34. integer :: strokes
  35. if(data%problems%RotaryProblems%MotorFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, strokes)
  36. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, strokes)
  37. end subroutine
  38. subroutine ProcessRotaryProblemsDueVolumePumped(volume)
  39. implicit none
  40. real(8) :: volume
  41. if(data%problems%RotaryProblems%MotorFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, volume)
  42. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, volume)
  43. end subroutine
  44. subroutine ProcessRotaryProblemsDueDistanceDrilled(distance)
  45. implicit none
  46. real(8) :: distance
  47. if(data%problems%RotaryProblems%MotorFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, distance)
  48. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, distance)
  49. end subroutine
  50. subroutine ChangeMotorFail(status)
  51. use SimulationVariables !@
  52. implicit none
  53. integer, intent (in) :: status
  54. !if(associated(MotorFailPtr)) call MotorFailPtr(status)
  55. if(status == Clear_StatusType) data%State%RTable%MotorFaileMalf=0
  56. if(status == Executed_StatusType) data%State%RTable%MotorFaileMalf=1
  57. endsubroutine
  58. subroutine ChangeOverideTorqueLimit(status)
  59. use SimulationVariables !@
  60. implicit none
  61. integer, intent (in) :: status
  62. !if(associated(OverideTorqueLimitPtr)) call OverideTorqueLimitPtr(status)
  63. if(status == Clear_StatusType) data%State%RTable%OverideTorqueLimitMalf=0
  64. if(status == Executed_StatusType) data%State%RTable%OverideTorqueLimitMalf=1
  65. endsubroutine
  66. end module CRotaryProblems