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.

CRotaryProblems.i90 4.0 KiB

1 år sedan
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # 1 "/home/admin/SimulationCore2/CSharp/Problems/CRotaryProblems.f90"
  2. module CRotaryProblems
  3. use SimulationVariables
  4. implicit none
  5. public
  6. contains
  7. subroutine RotaryProblemsFromJson(parent)
  8. type(json_value),pointer :: parent
  9. type(json_core) :: json
  10. type(json_value),pointer :: p
  11. call json%get(parent,'RotaryProblems',p)
  12. call ProblemFromJson(p,"MotorFail",data%problems%RotaryProblems%MotorFail)
  13. call ProblemFromJson(p,"OverideTorqueLimit",data%problems%RotaryProblems%OverideTorqueLimit)
  14. end subroutine
  15. subroutine RotaryProblemsToJson(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,'RotaryProblems')
  21. ! 2. add member of data type to new node
  22. call ProblemToJson(p,"MotorFail",data%problems%RotaryProblems%MotorFail)
  23. call ProblemToJson(p,"OverideTorqueLimit",data%problems%RotaryProblems%OverideTorqueLimit)
  24. ! 3. add new node to parent
  25. call json%add(parent,p)
  26. end subroutine
  27. subroutine ProcessRotaryProblemsDueTime(time)
  28. implicit none
  29. integer :: time
  30. if(data%problems%RotaryProblems%MotorFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, time)
  31. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, time)
  32. end subroutine
  33. subroutine ProcessRotaryProblemsDuePumpStrokes(strokes)
  34. implicit none
  35. integer :: strokes
  36. if(data%problems%RotaryProblems%MotorFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, strokes)
  37. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, strokes)
  38. end subroutine
  39. subroutine ProcessRotaryProblemsDueVolumePumped(volume)
  40. implicit none
  41. real(8) :: volume
  42. if(data%problems%RotaryProblems%MotorFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, volume)
  43. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, volume)
  44. end subroutine
  45. subroutine ProcessRotaryProblemsDueDistanceDrilled(distance)
  46. implicit none
  47. real(8) :: distance
  48. if(data%problems%RotaryProblems%MotorFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%RotaryProblems%MotorFail, ChangeMotorFail, distance)
  49. if(data%problems%RotaryProblems%OverideTorqueLimit%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%RotaryProblems%OverideTorqueLimit, ChangeOverideTorqueLimit, distance)
  50. end subroutine
  51. subroutine ChangeMotorFail(status)
  52. use SimulationVariables !@
  53. implicit none
  54. integer, intent (in) :: status
  55. !if(associated(MotorFailPtr)) call MotorFailPtr(status)
  56. if(status == Clear_StatusType) data%State%RTable%MotorFaileMalf=0
  57. if(status == Executed_StatusType) data%State%RTable%MotorFaileMalf=1
  58. endsubroutine
  59. subroutine ChangeOverideTorqueLimit(status)
  60. use SimulationVariables !@
  61. implicit none
  62. integer, intent (in) :: status
  63. !if(associated(OverideTorqueLimitPtr)) call OverideTorqueLimitPtr(status)
  64. if(status == Clear_StatusType) data%State%RTable%OverideTorqueLimitMalf=0
  65. if(status == Executed_StatusType) data%State%RTable%OverideTorqueLimitMalf=1
  66. endsubroutine
  67. end module CRotaryProblems