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.
 
 
 
 
 
 

100 line
3.8 KiB

  1. module CTanks
  2. use SimulationVariables
  3. use CManifolds
  4. implicit none
  5. public
  6. contains
  7. subroutine TankFromJson(parent)
  8. type(json_value),pointer :: parent
  9. type(json_core) :: json
  10. type(json_value),pointer :: p,pval
  11. logical::is_found
  12. ! 1. get related root
  13. call json%get(parent,'Tank',p)
  14. ! 2. get member of data type from node
  15. call json%get(p,'WaterRate',pval)
  16. call json%get(pval,data%Equipments%Tank%WaterRate)
  17. call json%get(p,'CementTankVolume',pval)
  18. call json%get(pval,data%Equipments%Tank%CementTankVolume)
  19. call json%get(p,'CementTankDensity',pval)
  20. call json%get(pval,data%Equipments%Tank%CementTankDensity)
  21. call json%get(p,'TripTankVolume',pval)
  22. call json%get(pval,data%Equipments%Tank%TripTankVolume)
  23. call json%get(p,'TripTankDensity',pval)
  24. call json%get(pval,data%Equipments%Tank%TripTankDensity)
  25. call json%get(p,'ManualPumpPower',pval)
  26. call json%get(pval,data%Equipments%Tank%ManualPumpPower)
  27. call json%get(p,'Valve1',pval)
  28. call json%get(pval,data%Equipments%Tank%Valve1)
  29. call json%get(p,'Valve2',pval)
  30. call json%get(pval,data%Equipments%Tank%Valve2)
  31. call json%get(p,'Valve3',pval)
  32. call json%get(pval,data%Equipments%Tank%Valve3)
  33. call json%get(p,'Valve4',pval)
  34. call json%get(pval,data%Equipments%Tank%Valve4)
  35. call json%get(p,'Valve5',pval)
  36. call json%get(pval,data%Equipments%Tank%Valve5)
  37. call json%get(p,'Valve6',pval)
  38. call json%get(pval,data%Equipments%Tank%Valve6)
  39. call json%get(p,'Valve7',pval)
  40. call json%get(pval,data%Equipments%Tank%Valve7)
  41. call json%get(p,'Valve8',pval)
  42. call json%get(pval,data%Equipments%Tank%Valve8)
  43. call json%get(p,'Valve9',pval)
  44. call json%get(pval,data%Equipments%Tank%Valve9)
  45. call json%get(p,'Valve10',pval)
  46. call json%get(pval,data%Equipments%Tank%Valve10)
  47. call json%get(p,'Valve11',pval)
  48. call json%get(pval,data%Equipments%Tank%Valve11)
  49. end subroutine
  50. ! subroutine TankToJson(parent)
  51. ! type(json_value),pointer :: parent
  52. ! type(json_core) :: json
  53. ! type(json_value),pointer :: p,pform
  54. ! integer :: i
  55. ! call json%create_array(p,'Tank')
  56. ! call json%create_object(pform,'')
  57. ! call json%add(pform,"WaterRate",data%Equipments%Tank%WaterRate)
  58. ! call json%add(pform,"CementTankVolume",data%Equipments%Tank%CementTankVolume)
  59. ! call json%add(pform,"CementTankDensity",data%Equipments%Tank%CementTankDensity)
  60. ! call json%add(pform,"TripTankVolume",data%Equipments%Tank%TripTankVolume)
  61. ! call json%add(pform,"TripTankDensity",data%Equipments%Tank%TripTankDensity)
  62. ! call json%add(pform,"ManualPumpPower",data%Equipments%Tank%ManualPumpPower)
  63. ! call json%add(pform,"Valve1",data%Equipments%Tank%Valve1)
  64. ! call json%add(pform,"Valve2",data%Equipments%Tank%Valve2)
  65. ! call json%add(pform,"Valve3",data%Equipments%Tank%Valve3)
  66. ! call json%add(pform,"Valve4",data%Equipments%Tank%Valve4)
  67. ! call json%add(pform,"Valve5",data%Equipments%Tank%Valve5)
  68. ! call json%add(pform,"Valve6",data%Equipments%Tank%Valve6)
  69. ! call json%add(pform,"Valve7",data%Equipments%Tank%Valve7)
  70. ! call json%add(pform,"Valve8",data%Equipments%Tank%Valve8)
  71. ! call json%add(pform,"Valve9",data%Equipments%Tank%Valve9)
  72. ! call json%add(pform,"Valve10",data%Equipments%Tank%Valve10)
  73. ! call json%add(pform,"Valve11",data%Equipments%Tank%Valve11)
  74. ! call json%add(parent,p)
  75. ! end subroutine
  76. subroutine Set_ManualPumpPower(v)
  77. use CManifolds, only:ChangeValve
  78. implicit none
  79. logical, intent(in) :: v
  80. data%Equipments%Tank%ManualPumpPower = v
  81. call ChangeValve(43, v)
  82. #ifdef deb
  83. print*, 'ManualPumpPower=', data%Equipments%Tank%ManualPumpPower
  84. #endif
  85. end subroutine
  86. end module CTanks