|
- module CPower
- use SimulationVariables
- use json_module
- implicit none
- public
- contains
-
- subroutine PowerToJson(parent)
-
- type(json_value),pointer :: parent
- type(json_core) :: json
- type(json_value),pointer :: p
-
- ! 1. create new node
- call json%create_object(p,'Power')
-
- ! 2. add member of data type to new node
- ! call StringConfigurationToJson(p)
- ! call FormationToJson(p)
- call json%add(p,"CementPump",data%Configuration%Power%CementPump)
- call json%add(p,"Drawworks",data%Configuration%Power%Drawworks)
- call json%add(p,"GeneratorPowerRating",data%Configuration%Power%GeneratorPowerRating)
- call json%add(p,"MudPump1",data%Configuration%Power%MudPump1)
- call json%add(p,"MudPump2",data%Configuration%Power%MudPump2)
- call json%add(p,"NumberOfgenerators",data%Configuration%Power%NumberOfgenerators)
- call json%add(p,"RotaryTable",data%Configuration%Power%RotaryTable)
- call json%add(p,"TopDrive",data%Configuration%Power%TopDrive)
- ! 3. add new node to parent
- call json%add(parent,p)
- end subroutine
-
- subroutine PowerFromJson(parent)
- use json_module,IK =>json_ik
- type(json_value),pointer :: parent
- type(json_core) :: json
- type(json_value),pointer :: p,pitems,pitem,pval,pbit
-
- call json%get(parent,'Power',p)
-
- call json%get(p,"CementPump",pitem)
- call json%get(pitem,data%Configuration%Power%CementPump)
- call json%get(p,"Drawworks",pitem)
- call json%get(pitem,data%Configuration%Power%Drawworks)
- call json%get(p,"GeneratorPowerRating",pitem)
- call json%get(pitem,data%Configuration%Power%GeneratorPowerRating)
- call json%get(p,"MudPump1",pitem)
- call json%get(pitem,data%Configuration%Power%MudPump1)
- call json%get(p,"MudPump2",pitem)
- call json%get(pitem,data%Configuration%Power%MudPump2)
- call json%get(p,"NumberOfgenerators",pitem)
- call json%get(pitem,data%Configuration%Power%NumberOfgenerators)
- call json%get(p,"RotaryTable",pitem)
- call json%get(pitem,data%Configuration%Power%RotaryTable)
- call json%get(p,"TopDrive",pitem)
- call json%get(pitem,data%Configuration%Power%TopDrive)
-
- end subroutine
-
-
- end module CPower
|