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.
 
 
 
 
 
 

94 rader
4.3 KiB

  1. module CBitProblems
  2. use SimulationVariables
  3. use json_module
  4. implicit none
  5. public
  6. contains
  7. subroutine BitProblemsFromJson(parent)
  8. type(json_value),pointer :: parent
  9. type(json_core) :: json
  10. type(json_value),pointer :: p,pval
  11. call json%get(parent,'BitProblems',p)
  12. call ProblemFromJson(p,"JetWashout",data%problems%BitProblems%JetWashout)
  13. call ProblemFromJson(p,"PlugJets",data%problems%BitProblems%PlugJets)
  14. call json%get(p,"JetWashoutCount",pval)
  15. call json%get(pval,data%problems%BitProblems%JetWashoutCount)
  16. call json%get(p,"PlugJetsCount",pval)
  17. call json%get(pval,data%problems%BitProblems%PlugJetsCount)
  18. end subroutine
  19. subroutine BitProblemsToJson(parent)
  20. type(json_value),pointer :: parent
  21. type(json_core) :: json
  22. type(json_value),pointer :: p
  23. ! 1. create new node
  24. call json%create_object(p,'BitProblems')
  25. ! 2. add member of data type to new node
  26. call ProblemToJson(p,"JetWashout",data%problems%BitProblems%JetWashout)
  27. call ProblemToJson(p,"PlugJets",data%problems%BitProblems%PlugJets)
  28. call json%add(p, "JetWashoutCount",data%problems%BitProblems%JetWashoutCount)
  29. call json%add(p, "PlugJetsCount",data%problems%BitProblems%PlugJetsCount)
  30. ! 3. add new node to parent
  31. call json%add(parent,p)
  32. end subroutine
  33. subroutine ProcessBitProblemsDueTime(time)
  34. implicit none
  35. integer :: time
  36. if(data%problems%BitProblems%PlugJets%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%BitProblems%PlugJets, ChangePlugJets, time)
  37. if(data%problems%BitProblems%JetWashout%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%BitProblems%JetWashout, ChangeJetWashout, time)
  38. end subroutine
  39. subroutine ProcessBitProblemsDuePumpStrokes(strokes)
  40. implicit none
  41. integer :: strokes
  42. if(data%problems%BitProblems%PlugJets%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%BitProblems%PlugJets, ChangePlugJets, strokes)
  43. if(data%problems%BitProblems%JetWashout%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%BitProblems%JetWashout, ChangeJetWashout, strokes)
  44. end subroutine
  45. subroutine ProcessBitProblemsDueVolumePumped(volume)
  46. implicit none
  47. real(8) :: volume
  48. if(data%problems%BitProblems%PlugJets%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%BitProblems%PlugJets, ChangePlugJets, volume)
  49. if(data%problems%BitProblems%JetWashout%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%BitProblems%JetWashout, ChangeJetWashout, volume)
  50. end subroutine
  51. subroutine ProcessBitProblemsDueDistanceDrilled(distance)
  52. implicit none
  53. real(8) :: distance
  54. if(data%problems%BitProblems%PlugJets%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%BitProblems%PlugJets, ChangePlugJets, distance)
  55. if(data%problems%BitProblems%JetWashout%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%BitProblems%JetWashout, ChangeJetWashout, distance)
  56. end subroutine
  57. subroutine ChangePlugJets(status)
  58. USE FricPressDropVarsModule
  59. implicit none
  60. integer, intent (in) :: status
  61. ! if(associated(data%problems%BitProblems%PlugJetsPtr)) call data%problems%BitProblems%PlugJetsPtr(status)
  62. if(status == Clear_StatusType) data%State%FricPressDrop%BitJetsPlugged = 0
  63. if(status == Executed_StatusType) data%State%FricPressDrop%BitJetsPlugged = 1
  64. endsubroutine
  65. subroutine ChangeJetWashout(status)
  66. USE FricPressDropVarsModule
  67. implicit none
  68. integer, intent (in) :: status
  69. ! if(associated(data%problems%BitProblems%JetWashoutPtr)) call data%problems%BitProblems%JetWashoutPtr(status)
  70. if(status == Clear_StatusType) data%State%FricPressDrop%BitJetsWashedOut = 0
  71. if(status == Executed_StatusType) data%State%FricPressDrop%BitJetsWashedOut = 1
  72. endsubroutine
  73. end module CBitProblems