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.
 
 
 
 
 
 

102 lines
3.8 KiB

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