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.
 
 
 
 
 
 

62 rivejä
2.3 KiB

  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/BasicInputs/RigSpecifications/CPower.f90"
  2. module CPower
  3. use SimulationVariables
  4. use json_module
  5. implicit none
  6. public
  7. contains
  8. subroutine PowerToJson(parent)
  9. type(json_value),pointer :: parent
  10. type(json_core) :: json
  11. type(json_value),pointer :: p
  12. ! 1. create new node
  13. call json%create_object(p,'Power')
  14. ! 2. add member of data type to new node
  15. ! call StringConfigurationToJson(p)
  16. ! call FormationToJson(p)
  17. call json%add(p,"CementPump",data%Configuration%Power%CementPump)
  18. call json%add(p,"Drawworks",data%Configuration%Power%Drawworks)
  19. call json%add(p,"GeneratorPowerRating",data%Configuration%Power%GeneratorPowerRating)
  20. call json%add(p,"MudPump1",data%Configuration%Power%MudPump1)
  21. call json%add(p,"MudPump2",data%Configuration%Power%MudPump2)
  22. call json%add(p,"NumberOfgenerators",data%Configuration%Power%NumberOfgenerators)
  23. call json%add(p,"RotaryTable",data%Configuration%Power%RotaryTable)
  24. call json%add(p,"TopDrive",data%Configuration%Power%TopDrive)
  25. ! 3. add new node to parent
  26. call json%add(parent,p)
  27. end subroutine
  28. subroutine PowerFromJson(parent)
  29. use json_module,IK =>json_ik
  30. type(json_value),pointer :: parent
  31. type(json_core) :: json
  32. type(json_value),pointer :: p,pitems,pitem,pval,pbit
  33. call json%get(parent,'Power',p)
  34. call json%get(p,"CementPump",pitem)
  35. call json%get(pitem,data%Configuration%Power%CementPump)
  36. call json%get(p,"Drawworks",pitem)
  37. call json%get(pitem,data%Configuration%Power%Drawworks)
  38. call json%get(p,"GeneratorPowerRating",pitem)
  39. call json%get(pitem,data%Configuration%Power%GeneratorPowerRating)
  40. call json%get(p,"MudPump1",pitem)
  41. call json%get(pitem,data%Configuration%Power%MudPump1)
  42. call json%get(p,"MudPump2",pitem)
  43. call json%get(pitem,data%Configuration%Power%MudPump2)
  44. call json%get(p,"NumberOfgenerators",pitem)
  45. call json%get(pitem,data%Configuration%Power%NumberOfgenerators)
  46. call json%get(p,"RotaryTable",pitem)
  47. call json%get(pitem,data%Configuration%Power%RotaryTable)
  48. call json%get(p,"TopDrive",pitem)
  49. call json%get(pitem,data%Configuration%Power%TopDrive)
  50. end subroutine
  51. end module CPower