module CTanks use SimulationVariables use CManifolds implicit none public contains subroutine TankFromJson(parent) type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p,pval logical::is_found ! 1. get related root call json%get(parent,'Tank',p) ! 2. get member of data type from node call json%get(p,'WaterRate',pval) call json%get(pval,data%Equipments%Tank%WaterRate) call json%get(p,'CementTankVolume',pval) call json%get(pval,data%Equipments%Tank%CementTankVolume) call json%get(p,'CementTankDensity',pval) call json%get(pval,data%Equipments%Tank%CementTankDensity) call json%get(p,'TripTankVolume',pval) call json%get(pval,data%Equipments%Tank%TripTankVolume) call json%get(p,'TripTankDensity',pval) call json%get(pval,data%Equipments%Tank%TripTankDensity) call json%get(p,'ManualPumpPower',pval) call json%get(pval,data%Equipments%Tank%ManualPumpPower) call json%get(p,'Valve1',pval) call json%get(pval,data%Equipments%Tank%Valve1) call json%get(p,'Valve2',pval) call json%get(pval,data%Equipments%Tank%Valve2) call json%get(p,'Valve3',pval) call json%get(pval,data%Equipments%Tank%Valve3) call json%get(p,'Valve4',pval) call json%get(pval,data%Equipments%Tank%Valve4) call json%get(p,'Valve5',pval) call json%get(pval,data%Equipments%Tank%Valve5) call json%get(p,'Valve6',pval) call json%get(pval,data%Equipments%Tank%Valve6) call json%get(p,'Valve7',pval) call json%get(pval,data%Equipments%Tank%Valve7) call json%get(p,'Valve8',pval) call json%get(pval,data%Equipments%Tank%Valve8) call json%get(p,'Valve9',pval) call json%get(pval,data%Equipments%Tank%Valve9) call json%get(p,'Valve10',pval) call json%get(pval,data%Equipments%Tank%Valve10) call json%get(p,'Valve11',pval) call json%get(pval,data%Equipments%Tank%Valve11) end subroutine ! subroutine TankToJson(parent) ! type(json_value),pointer :: parent ! type(json_core) :: json ! type(json_value),pointer :: p,pform ! integer :: i ! call json%create_array(p,'Tank') ! call json%create_object(pform,'') ! call json%add(pform,"WaterRate",data%Equipments%Tank%WaterRate) ! call json%add(pform,"CementTankVolume",data%Equipments%Tank%CementTankVolume) ! call json%add(pform,"CementTankDensity",data%Equipments%Tank%CementTankDensity) ! call json%add(pform,"TripTankVolume",data%Equipments%Tank%TripTankVolume) ! call json%add(pform,"TripTankDensity",data%Equipments%Tank%TripTankDensity) ! call json%add(pform,"ManualPumpPower",data%Equipments%Tank%ManualPumpPower) ! call json%add(pform,"Valve1",data%Equipments%Tank%Valve1) ! call json%add(pform,"Valve2",data%Equipments%Tank%Valve2) ! call json%add(pform,"Valve3",data%Equipments%Tank%Valve3) ! call json%add(pform,"Valve4",data%Equipments%Tank%Valve4) ! call json%add(pform,"Valve5",data%Equipments%Tank%Valve5) ! call json%add(pform,"Valve6",data%Equipments%Tank%Valve6) ! call json%add(pform,"Valve7",data%Equipments%Tank%Valve7) ! call json%add(pform,"Valve8",data%Equipments%Tank%Valve8) ! call json%add(pform,"Valve9",data%Equipments%Tank%Valve9) ! call json%add(pform,"Valve10",data%Equipments%Tank%Valve10) ! call json%add(pform,"Valve11",data%Equipments%Tank%Valve11) ! call json%add(parent,p) ! end subroutine subroutine Set_ManualPumpPower(v) use CManifolds, only:ChangeValve implicit none logical, intent(in) :: v data%Equipments%Tank%ManualPumpPower = v call ChangeValve(43, v) #ifdef deb print*, 'ManualPumpPower=', data%Equipments%Tank%ManualPumpPower #endif end subroutine end module CTanks