@@ -21,7 +21,7 @@ | |||
{ | |||
"description": "Set Disassembly Flavor to Intel", | |||
"text": "-gdb-set disassembly-flavor intel", | |||
"ignoreFailures": true | |||
"ignoreFailures": true | |||
} | |||
] | |||
}, | |||
@@ -65,8 +65,7 @@ module Simulator | |||
use UnityModule | |||
implicit none | |||
type(json_file) :: jsonfile | |||
type(json_core):: json | |||
type(json_core):: jsoncore | |||
integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep | |||
real :: stepTime !time for each step | |||
character(len=:),allocatable::redisInput,redisOutput | |||
@@ -251,48 +250,44 @@ module Simulator | |||
use json_module | |||
implicit none | |||
type(json_value),pointer :: jsonroot | |||
character(len=20)::fn | |||
! integer::n_children | |||
call json%initialize() | |||
call json%create_object(jsonroot,'') | |||
call jsoncore%initialize() | |||
call jsoncore%create_object(jsonroot,'') | |||
! print *,"status=",simulationStatus | |||
! call json%add(jsonroot,'status',simulationStatus) | |||
! call json%add(jsonroot,'speed',simulationSpeed) | |||
! call json%add(jsonroot,'endstep',simulationEnd) | |||
call json%add(jsonroot,'step',simulationStep) | |||
call jsoncore%add(jsonroot,'step',simulationStep) | |||
! call ConfigurationToJson(jsonroot) | |||
call WarningsToJson(jsonroot) | |||
! call ProblemsToJson(jsonroot) | |||
call EquipmentsToJson(jsonroot) | |||
! print *,"write starts" | |||
write (fn,*) "data",simulationStep | |||
! call json%print(jsonroot,trim(fn)//".json") | |||
call json%serialize(jsonroot,redisInput) | |||
! call compress_string(redisContent) | |||
if(logging>4) print *,"Writing to redis:",len(redisInput) | |||
call jsoncore%print_to_string(jsonroot,redisInput) | |||
if(logging>4) then | |||
print *,"Writing to redis:",len(redisInput) | |||
call jsoncore%print(jsonroot,'data_out.json') | |||
endif | |||
call setData(redisInput) | |||
! nullify(redisContent) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
call json%destroy(jsonroot) | |||
call jsoncore%destroy(jsonroot) | |||
! print *,"write ends" | |||
end subroutine | |||
subroutine read_configuration() | |||
type(json_value),pointer :: jsonroot | |||
type(json_value),pointer :: pval | |||
type(json_value),pointer :: jsonroot,pval | |||
type(json_file) :: jsonfile | |||
type(json_core)::json | |||
call getData(redisOutput) | |||
! print *,len(redisOutput)," bytes read from redis" | |||
open(1,file="redisContent.json",status="REPLACE") | |||
write(1,"(A)") redisOutput | |||
close(1) | |||
! call json%initialize() | |||
call jsonfile%initialize() | |||
call jsonfile%get_core(json) | |||
! call jsonfile%load_file('redisContent.json'); if (jsonfile%failed()) stop | |||
call jsonfile%deserialize(redisOutput) | |||
call jsonfile%json_file_get_root(jsonroot) | |||
@@ -306,47 +301,62 @@ module Simulator | |||
msPerStep = 100/simulationSpeed | |||
call json%get(jsonroot,'endstep',pval) | |||
call json%get(pval,simulationEnd) | |||
call ConfigurationFromJson(jsonroot) | |||
call ConfigurationFromJson(jsonfile) | |||
! nullify(jsonroot) | |||
! print *,"jsonroot freed" | |||
! nullify(pval) | |||
! print *,"pval freed" | |||
! call WarningsFromJson(jsonroot) | |||
! call ProblemsFromJson(jsonvalue) | |||
! call EquipmentsFromJson(jsonroot) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
call jsonfile%destroy() | |||
print *,"jsonfile destroyed" | |||
! call json%destroy(pval) | |||
! call json%destroy(jsonroot) | |||
! nullify(jsonroot) | |||
end subroutine | |||
subroutine read_variables() | |||
type(json_value),pointer :: jsonroot,pval | |||
type(json_file) :: jsonfile | |||
integer::stat | |||
call getData(redisOutput) | |||
! print *,len(redisOutput)," bytes read from redis" | |||
! open(1,file="redisContent.json",status="REPLACE") | |||
! write(1,"(A)") redisContent | |||
! close(1) | |||
call jsonfile%initialize() | |||
call jsoncore%initialize() | |||
call jsonfile%initialize(jsoncore) | |||
call jsonfile%deserialize(redisOutput) | |||
! call jsonfile%initialize() | |||
! call jsonfile%load_file('redisContent.json'); if (jsonfile%failed()) stop | |||
call jsonfile%json_file_get_root(jsonroot) | |||
! call json%info(jsonvalue, n_children=n_children) | |||
! print *,"n_children =",n_children | |||
call json%get(jsonroot,'status',pval) | |||
call json%get(pval,simulationStatus) | |||
call json%get(jsonroot,'speed',pval) | |||
call json%get(pval,simulationSpeed) | |||
call jsoncore%get(jsonroot,'status',pval) | |||
call jsoncore%get(pval,stat) | |||
if (stat==0) then | |||
return | |||
endif | |||
simulationStatus = stat | |||
call jsoncore%get(jsonroot,'speed',pval) | |||
call jsoncore%get(pval,simulationSpeed) | |||
if(simulationSpeed==0) simulationSpeed = 1 | |||
msPerStep = 100/simulationSpeed | |||
call json%get(jsonroot,'endstep',pval) | |||
call json%get(pval,simulationEnd) | |||
call jsoncore%get(jsonroot,'endstep',pval) | |||
call jsoncore%get(pval,simulationEnd) | |||
print *,simulationStep,"/",simulationEnd | |||
! call ConfigurationFromJson(jsonroot) | |||
! call WarningsFromJson(jsonroot) | |||
call ProblemsFromJson(jsonroot) | |||
call EquipmentsFromJson(jsonroot) | |||
call ProblemsFromJson(jsonfile) | |||
call EquipmentsFromJson(jsonfile) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
! call json%destroy(jsonroot) | |||
! call jsoncore%destroy(pval) | |||
! call jsoncore%destroy(jsonroot) | |||
! call jsonfile%destroy() | |||
! nullify(jsonroot) | |||
end subroutine | |||
subroutine init_modules | |||
@@ -389,13 +399,15 @@ module Simulator | |||
! call OperationScenarios_Init() | |||
end subroutine init_modules | |||
subroutine EquipmentsFromJson(parent) | |||
subroutine EquipmentsFromJson(jsonfile) | |||
type(json_value),pointer :: parent | |||
type(json_value),pointer :: p | |||
type(json_file)::jsonfile | |||
! 1. get related root | |||
call json%get(parent,"Equipments",p) | |||
call jsonfile%json_file_get_root(parent) | |||
call jsoncore%get(parent,"Equipments",p) | |||
! 2. add member of data type to new node | |||
call BopControlPanelFromJson(p) | |||
@@ -417,7 +429,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Equipments') | |||
call jsoncore%create_object(p,'Equipments') | |||
! 2. add member of data type to new node | |||
call BopControlPanelToJson(p) | |||
@@ -432,7 +444,7 @@ module Simulator | |||
! call TankToJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine ConfigurationToJson(parent) | |||
@@ -440,7 +452,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Configuration') | |||
call jsoncore%create_object(p,'Configuration') | |||
! 2. add member of data type to new node | |||
call StringConfigurationToJson(p) | |||
@@ -460,7 +472,7 @@ module Simulator | |||
call UnityOutputsToJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine WarningsToJson(parent) | |||
@@ -469,36 +481,36 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Warnings') | |||
call jsoncore%create_object(p,'Warnings') | |||
! 2. add member of data type to new node | |||
call json%add(p,"PumpWithKellyDisconnected",data%Warnings%PumpWithKellyDisconnected) | |||
call json%add(p,"PumpWithTopdriveDisconnected",data%Warnings%PumpWithTopdriveDisconnected) | |||
call json%add(p,"Pump1PopOffValveBlown",data%Warnings%Pump1PopOffValveBlown) | |||
call json%add(p,"Pump1Failure",data%Warnings%Pump1Failure) | |||
call json%add(p,"Pump2PopOffValveBlown",data%Warnings%Pump2PopOffValveBlown) | |||
call json%add(p,"Pump2Failure",data%Warnings%Pump2Failure) | |||
call json%add(p,"Pump3PopOffValveBlown",data%Warnings%Pump3PopOffValveBlown) | |||
call json%add(p,"Pump3Failure",data%Warnings%Pump3Failure) | |||
call json%add(p,"DrawworksGearsAbuse",data%Warnings%DrawworksGearsAbuse) | |||
call json%add(p,"RotaryGearsAbuse",data%Warnings%RotaryGearsAbuse) | |||
call json%add(p,"HoistLineBreak",data%Warnings%HoistLineBreak) | |||
call json%add(p,"PartedDrillString",data%Warnings%PartedDrillString) | |||
call json%add(p,"ActiveTankOverflow",data%Warnings%ActiveTankOverflow) | |||
call json%add(p,"ActiveTankUnderVolume",data%Warnings%ActiveTankUnderVolume) | |||
call json%add(p,"TripTankOverflow",data%Warnings%TripTankOverflow) | |||
call json%add(p,"DrillPipeTwistOff",data%Warnings%DrillPipeTwistOff) | |||
call json%add(p,"DrillPipeParted",data%Warnings%DrillPipeParted) | |||
call json%add(p,"TripWithSlipsSet",data%Warnings%TripWithSlipsSet) | |||
call json%add(p,"Blowout",data%Warnings%Blowout) | |||
call json%add(p,"UndergroundBlowout",data%Warnings%UndergroundBlowout) | |||
call json%add(p,"MaximumWellDepthExceeded",data%Warnings%MaximumWellDepthExceeded) | |||
call json%add(p,"CrownCollision",data%Warnings%CrownCollision) | |||
call json%add(p,"FloorCollision",data%Warnings%FloorCollision) | |||
call json%add(p,"TopdriveRotaryTableConfilict",data%Warnings%TopdriveRotaryTableConfilict) | |||
call jsoncore%add(p,"PumpWithKellyDisconnected",data%Warnings%PumpWithKellyDisconnected) | |||
call jsoncore%add(p,"PumpWithTopdriveDisconnected",data%Warnings%PumpWithTopdriveDisconnected) | |||
call jsoncore%add(p,"Pump1PopOffValveBlown",data%Warnings%Pump1PopOffValveBlown) | |||
call jsoncore%add(p,"Pump1Failure",data%Warnings%Pump1Failure) | |||
call jsoncore%add(p,"Pump2PopOffValveBlown",data%Warnings%Pump2PopOffValveBlown) | |||
call jsoncore%add(p,"Pump2Failure",data%Warnings%Pump2Failure) | |||
call jsoncore%add(p,"Pump3PopOffValveBlown",data%Warnings%Pump3PopOffValveBlown) | |||
call jsoncore%add(p,"Pump3Failure",data%Warnings%Pump3Failure) | |||
call jsoncore%add(p,"DrawworksGearsAbuse",data%Warnings%DrawworksGearsAbuse) | |||
call jsoncore%add(p,"RotaryGearsAbuse",data%Warnings%RotaryGearsAbuse) | |||
call jsoncore%add(p,"HoistLineBreak",data%Warnings%HoistLineBreak) | |||
call jsoncore%add(p,"PartedDrillString",data%Warnings%PartedDrillString) | |||
call jsoncore%add(p,"ActiveTankOverflow",data%Warnings%ActiveTankOverflow) | |||
call jsoncore%add(p,"ActiveTankUnderVolume",data%Warnings%ActiveTankUnderVolume) | |||
call jsoncore%add(p,"TripTankOverflow",data%Warnings%TripTankOverflow) | |||
call jsoncore%add(p,"DrillPipeTwistOff",data%Warnings%DrillPipeTwistOff) | |||
call jsoncore%add(p,"DrillPipeParted",data%Warnings%DrillPipeParted) | |||
call jsoncore%add(p,"TripWithSlipsSet",data%Warnings%TripWithSlipsSet) | |||
call jsoncore%add(p,"Blowout",data%Warnings%Blowout) | |||
call jsoncore%add(p,"UndergroundBlowout",data%Warnings%UndergroundBlowout) | |||
call jsoncore%add(p,"MaximumWellDepthExceeded",data%Warnings%MaximumWellDepthExceeded) | |||
call jsoncore%add(p,"CrownCollision",data%Warnings%CrownCollision) | |||
call jsoncore%add(p,"FloorCollision",data%Warnings%FloorCollision) | |||
call jsoncore%add(p,"TopdriveRotaryTableConfilict",data%Warnings%TopdriveRotaryTableConfilict) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine ProblemsToJson(parent) | |||
@@ -507,7 +519,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Problems') | |||
call jsoncore%create_object(p,'Problems') | |||
! 2. add member of data type to new node | |||
call BitProblemsToJson(p) | |||
@@ -524,7 +536,7 @@ module Simulator | |||
call RotaryProblemsToJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine StateToJson(parent) | |||
@@ -534,7 +546,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'State') | |||
call jsoncore%create_object(p,'State') | |||
! call OperationScenarioToJson(p) | |||
call notificationsToJson(p) | |||
@@ -597,7 +609,7 @@ module Simulator | |||
! 2. add member of data type to new node | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
!use this as a template | |||
@@ -608,21 +620,22 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Notifications') | |||
call jsoncore%create_object(p,'Notifications') | |||
! 2. add member of data type to new node | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine ConfigurationFromJson(parent) | |||
subroutine ConfigurationFromJson(jsonfile) | |||
type(json_file)::jsonfile | |||
type(json_value),pointer :: parent | |||
type(json_value),pointer :: p | |||
! 1. get related root | |||
call json%get(parent,"Configuration",p) | |||
call jsonfile%json_file_get_root(parent) | |||
call jsoncore%get(parent,"Configuration",p) | |||
call StringConfigurationFromJson(p) | |||
call FormationFromJson(p) | |||
@@ -632,14 +645,14 @@ module Simulator | |||
call BopStackFromJson(p) | |||
call HoistingFromJson(p) | |||
call PowerFromJson(p) | |||
call PumpsFromJson(p) | |||
call PumpsFromJson(p) | |||
call RigSizeFromJson(p) | |||
call CasingLinerChokeFromJson(p) | |||
call PathGenerationFromJson(p) | |||
call MudPropertiesFromJson(p) | |||
call UnityInputsFromJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
! nullify(parent) | |||
end subroutine | |||
subroutine WarningsFromJson(parent) | |||
@@ -648,64 +661,66 @@ module Simulator | |||
type(json_value),pointer :: pval | |||
! 1. get node | |||
call json%get(parent,'Warnings',p) | |||
call jsoncore%get(parent,'Warnings',p) | |||
! ! 2. add member of data type to new node | |||
call json%get(p,'PumpWithKellyDisconnected',pval) | |||
call json%get(pval,data%Warnings%PumpWithKellyDisconnected) | |||
call json%get(p,'PumpWithTopdriveDisconnected',pval) | |||
call json%get(pval,data%Warnings%PumpWithTopdriveDisconnected) | |||
call json%get(p,'Pump1PopOffValveBlown',pval) | |||
call json%get(pval,data%Warnings%Pump1PopOffValveBlown) | |||
call json%get(p,'Pump1Failure',pval) | |||
call json%get(pval,data%Warnings%Pump1Failure) | |||
call json%get(p,'Pump2PopOffValveBlown',pval) | |||
call json%get(pval,data%Warnings%Pump2PopOffValveBlown) | |||
call json%get(p,'Pump2Failure',pval) | |||
call json%get(pval,data%Warnings%Pump2Failure) | |||
call json%get(p,'Pump3PopOffValveBlown',pval) | |||
call json%get(pval,data%Warnings%Pump3PopOffValveBlown) | |||
call json%get(p,'Pump3Failure',pval) | |||
call json%get(pval,data%Warnings%Pump3Failure) | |||
call json%get(p,'DrawworksGearsAbuse',pval) | |||
call json%get(pval,data%Warnings%DrawworksGearsAbuse) | |||
call json%get(p,'RotaryGearsAbuse',pval) | |||
call json%get(pval,data%Warnings%RotaryGearsAbuse) | |||
call json%get(p,'HoistLineBreak',pval) | |||
call json%get(pval,data%Warnings%HoistLineBreak) | |||
call json%get(p,'PartedDrillString',pval) | |||
call json%get(pval,data%Warnings%PartedDrillString) | |||
call json%get(p,'ActiveTankOverflow',pval) | |||
call json%get(pval,data%Warnings%ActiveTankOverflow) | |||
call json%get(p,'ActiveTankUnderVolume',pval) | |||
call json%get(pval,data%Warnings%ActiveTankUnderVolume) | |||
call json%get(p,'TripTankOverflow',pval) | |||
call json%get(pval,data%Warnings%TripTankOverflow) | |||
call json%get(p,'DrillPipeTwistOff',pval) | |||
call json%get(pval,data%Warnings%DrillPipeTwistOff) | |||
call json%get(p,'DrillPipeParted',pval) | |||
call json%get(pval,data%Warnings%DrillPipeParted) | |||
call json%get(p,'TripWithSlipsSet',pval) | |||
call json%get(pval,data%Warnings%TripWithSlipsSet) | |||
call json%get(p,'Blowout',pval) | |||
call json%get(pval,data%Warnings%Blowout) | |||
call json%get(p,'UndergroundBlowout',pval) | |||
call json%get(pval,data%Warnings%UndergroundBlowout) | |||
call json%get(p,'MaximumWellDepthExceeded',pval) | |||
call json%get(pval,data%Warnings%MaximumWellDepthExceeded) | |||
call json%get(p,'CrownCollision',pval) | |||
call json%get(pval,data%Warnings%CrownCollision) | |||
call json%get(p,'FloorCollision',pval) | |||
call json%get(pval,data%Warnings%FloorCollision) | |||
call json%get(p,'TopdriveRotaryTableConfilict',pval) | |||
call json%get(pval,data%Warnings%TopdriveRotaryTableConfilict) | |||
call jsoncore%get(p,'PumpWithKellyDisconnected',pval) | |||
call jsoncore%get(pval,data%Warnings%PumpWithKellyDisconnected) | |||
call jsoncore%get(p,'PumpWithTopdriveDisconnected',pval) | |||
call jsoncore%get(pval,data%Warnings%PumpWithTopdriveDisconnected) | |||
call jsoncore%get(p,'Pump1PopOffValveBlown',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump1PopOffValveBlown) | |||
call jsoncore%get(p,'Pump1Failure',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump1Failure) | |||
call jsoncore%get(p,'Pump2PopOffValveBlown',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump2PopOffValveBlown) | |||
call jsoncore%get(p,'Pump2Failure',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump2Failure) | |||
call jsoncore%get(p,'Pump3PopOffValveBlown',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump3PopOffValveBlown) | |||
call jsoncore%get(p,'Pump3Failure',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump3Failure) | |||
call jsoncore%get(p,'DrawworksGearsAbuse',pval) | |||
call jsoncore%get(pval,data%Warnings%DrawworksGearsAbuse) | |||
call jsoncore%get(p,'RotaryGearsAbuse',pval) | |||
call jsoncore%get(pval,data%Warnings%RotaryGearsAbuse) | |||
call jsoncore%get(p,'HoistLineBreak',pval) | |||
call jsoncore%get(pval,data%Warnings%HoistLineBreak) | |||
call jsoncore%get(p,'PartedDrillString',pval) | |||
call jsoncore%get(pval,data%Warnings%PartedDrillString) | |||
call jsoncore%get(p,'ActiveTankOverflow',pval) | |||
call jsoncore%get(pval,data%Warnings%ActiveTankOverflow) | |||
call jsoncore%get(p,'ActiveTankUnderVolume',pval) | |||
call jsoncore%get(pval,data%Warnings%ActiveTankUnderVolume) | |||
call jsoncore%get(p,'TripTankOverflow',pval) | |||
call jsoncore%get(pval,data%Warnings%TripTankOverflow) | |||
call jsoncore%get(p,'DrillPipeTwistOff',pval) | |||
call jsoncore%get(pval,data%Warnings%DrillPipeTwistOff) | |||
call jsoncore%get(p,'DrillPipeParted',pval) | |||
call jsoncore%get(pval,data%Warnings%DrillPipeParted) | |||
call jsoncore%get(p,'TripWithSlipsSet',pval) | |||
call jsoncore%get(pval,data%Warnings%TripWithSlipsSet) | |||
call jsoncore%get(p,'Blowout',pval) | |||
call jsoncore%get(pval,data%Warnings%Blowout) | |||
call jsoncore%get(p,'UndergroundBlowout',pval) | |||
call jsoncore%get(pval,data%Warnings%UndergroundBlowout) | |||
call jsoncore%get(p,'MaximumWellDepthExceeded',pval) | |||
call jsoncore%get(pval,data%Warnings%MaximumWellDepthExceeded) | |||
call jsoncore%get(p,'CrownCollision',pval) | |||
call jsoncore%get(pval,data%Warnings%CrownCollision) | |||
call jsoncore%get(p,'FloorCollision',pval) | |||
call jsoncore%get(pval,data%Warnings%FloorCollision) | |||
call jsoncore%get(p,'TopdriveRotaryTableConfilict',pval) | |||
call jsoncore%get(pval,data%Warnings%TopdriveRotaryTableConfilict) | |||
end subroutine | |||
subroutine ProblemsFromJson(parent) | |||
subroutine ProblemsFromJson(jsonfile) | |||
type(json_value),pointer :: parent | |||
type(json_value),pointer :: p | |||
type(json_file)::jsonfile | |||
call json%get(parent,'Warnings',p) | |||
call jsonfile%json_file_get_root(parent) | |||
call jsoncore%get(parent,'Warnings',p) | |||
call BitProblemsToJson(p) | |||
call BopProblemsFromJson(p) | |||
@@ -789,7 +804,7 @@ module Simulator | |||
! 2. add member of data type to new node | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
! call jsoncore%add(parent,p) | |||
end subroutine | |||
!use this as a template | |||
@@ -66,8 +66,7 @@ module Simulator | |||
use UnityModule | |||
implicit none | |||
type(json_file) :: jsonfile | |||
type(json_core):: json | |||
type(json_core):: jsoncore | |||
integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep | |||
real :: stepTime !time for each step | |||
character(len=:),allocatable::redisInput,redisOutput | |||
@@ -252,48 +251,44 @@ module Simulator | |||
use json_module | |||
implicit none | |||
type(json_value),pointer :: jsonroot | |||
character(len=20)::fn | |||
! integer::n_children | |||
call json%initialize() | |||
call json%create_object(jsonroot,'') | |||
call jsoncore%initialize() | |||
call jsoncore%create_object(jsonroot,'') | |||
! print *,"status=",simulationStatus | |||
! call json%add(jsonroot,'status',simulationStatus) | |||
! call json%add(jsonroot,'speed',simulationSpeed) | |||
! call json%add(jsonroot,'endstep',simulationEnd) | |||
call json%add(jsonroot,'step',simulationStep) | |||
call jsoncore%add(jsonroot,'step',simulationStep) | |||
! call ConfigurationToJson(jsonroot) | |||
call WarningsToJson(jsonroot) | |||
! call ProblemsToJson(jsonroot) | |||
call EquipmentsToJson(jsonroot) | |||
! print *,"write starts" | |||
write (fn,*) "data",simulationStep | |||
! call json%print(jsonroot,trim(fn)//".json") | |||
call json%serialize(jsonroot,redisInput) | |||
! call compress_string(redisContent) | |||
if(logging>4) print *,"Writing to redis:",len(redisInput) | |||
call jsoncore%print_to_string(jsonroot,redisInput) | |||
if(logging>4) then | |||
print *,"Writing to redis:",len(redisInput) | |||
call jsoncore%print(jsonroot,'data_out.json') | |||
endif | |||
call setData(redisInput) | |||
! nullify(redisContent) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
call json%destroy(jsonroot) | |||
call jsoncore%destroy(jsonroot) | |||
! print *,"write ends" | |||
end subroutine | |||
subroutine read_configuration() | |||
type(json_value),pointer :: jsonroot | |||
type(json_value),pointer :: pval | |||
type(json_value),pointer :: jsonroot,pval | |||
type(json_file) :: jsonfile | |||
type(json_core)::json | |||
call getData(redisOutput) | |||
! print *,len(redisOutput)," bytes read from redis" | |||
open(1,file="redisContent.json",status="REPLACE") | |||
write(1,"(A)") redisOutput | |||
close(1) | |||
! call json%initialize() | |||
call jsonfile%initialize() | |||
call jsonfile%get_core(json) | |||
! call jsonfile%load_file('redisContent.json'); if (jsonfile%failed()) stop | |||
call jsonfile%deserialize(redisOutput) | |||
call jsonfile%json_file_get_root(jsonroot) | |||
@@ -307,47 +302,62 @@ module Simulator | |||
msPerStep = 100/simulationSpeed | |||
call json%get(jsonroot,'endstep',pval) | |||
call json%get(pval,simulationEnd) | |||
call ConfigurationFromJson(jsonroot) | |||
call ConfigurationFromJson(jsonfile) | |||
! nullify(jsonroot) | |||
! print *,"jsonroot freed" | |||
! nullify(pval) | |||
! print *,"pval freed" | |||
! call WarningsFromJson(jsonroot) | |||
! call ProblemsFromJson(jsonvalue) | |||
! call EquipmentsFromJson(jsonroot) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
call jsonfile%destroy() | |||
print *,"jsonfile destroyed" | |||
! call json%destroy(pval) | |||
! call json%destroy(jsonroot) | |||
! nullify(jsonroot) | |||
end subroutine | |||
subroutine read_variables() | |||
type(json_value),pointer :: jsonroot,pval | |||
type(json_file) :: jsonfile | |||
integer::stat | |||
call getData(redisOutput) | |||
! print *,len(redisOutput)," bytes read from redis" | |||
! open(1,file="redisContent.json",status="REPLACE") | |||
! write(1,"(A)") redisContent | |||
! close(1) | |||
call jsonfile%initialize() | |||
call jsoncore%initialize() | |||
call jsonfile%initialize(jsoncore) | |||
call jsonfile%deserialize(redisOutput) | |||
! call jsonfile%initialize() | |||
! call jsonfile%load_file('redisContent.json'); if (jsonfile%failed()) stop | |||
call jsonfile%json_file_get_root(jsonroot) | |||
! call json%info(jsonvalue, n_children=n_children) | |||
! print *,"n_children =",n_children | |||
call json%get(jsonroot,'status',pval) | |||
call json%get(pval,simulationStatus) | |||
call json%get(jsonroot,'speed',pval) | |||
call json%get(pval,simulationSpeed) | |||
call jsoncore%get(jsonroot,'status',pval) | |||
call jsoncore%get(pval,stat) | |||
if (stat==0) then | |||
return | |||
endif | |||
simulationStatus = stat | |||
call jsoncore%get(jsonroot,'speed',pval) | |||
call jsoncore%get(pval,simulationSpeed) | |||
if(simulationSpeed==0) simulationSpeed = 1 | |||
msPerStep = 100/simulationSpeed | |||
call json%get(jsonroot,'endstep',pval) | |||
call json%get(pval,simulationEnd) | |||
call jsoncore%get(jsonroot,'endstep',pval) | |||
call jsoncore%get(pval,simulationEnd) | |||
print *,simulationStep,"/",simulationEnd | |||
! call ConfigurationFromJson(jsonroot) | |||
! call WarningsFromJson(jsonroot) | |||
call ProblemsFromJson(jsonroot) | |||
call EquipmentsFromJson(jsonroot) | |||
call ProblemsFromJson(jsonfile) | |||
call EquipmentsFromJson(jsonfile) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
! call json%destroy(jsonroot) | |||
! call jsoncore%destroy(pval) | |||
! call jsoncore%destroy(jsonroot) | |||
! call jsonfile%destroy() | |||
! nullify(jsonroot) | |||
end subroutine | |||
subroutine init_modules | |||
@@ -390,13 +400,15 @@ module Simulator | |||
! call OperationScenarios_Init() | |||
end subroutine init_modules | |||
subroutine EquipmentsFromJson(parent) | |||
subroutine EquipmentsFromJson(jsonfile) | |||
type(json_value),pointer :: parent | |||
type(json_value),pointer :: p | |||
type(json_file)::jsonfile | |||
! 1. get related root | |||
call json%get(parent,"Equipments",p) | |||
call jsonfile%json_file_get_root(parent) | |||
call jsoncore%get(parent,"Equipments",p) | |||
! 2. add member of data type to new node | |||
call BopControlPanelFromJson(p) | |||
@@ -418,7 +430,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Equipments') | |||
call jsoncore%create_object(p,'Equipments') | |||
! 2. add member of data type to new node | |||
call BopControlPanelToJson(p) | |||
@@ -433,7 +445,7 @@ module Simulator | |||
! call TankToJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine ConfigurationToJson(parent) | |||
@@ -441,7 +453,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Configuration') | |||
call jsoncore%create_object(p,'Configuration') | |||
! 2. add member of data type to new node | |||
call StringConfigurationToJson(p) | |||
@@ -461,7 +473,7 @@ module Simulator | |||
call UnityOutputsToJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine WarningsToJson(parent) | |||
@@ -470,36 +482,36 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Warnings') | |||
call jsoncore%create_object(p,'Warnings') | |||
! 2. add member of data type to new node | |||
call json%add(p,"PumpWithKellyDisconnected",data%Warnings%PumpWithKellyDisconnected) | |||
call json%add(p,"PumpWithTopdriveDisconnected",data%Warnings%PumpWithTopdriveDisconnected) | |||
call json%add(p,"Pump1PopOffValveBlown",data%Warnings%Pump1PopOffValveBlown) | |||
call json%add(p,"Pump1Failure",data%Warnings%Pump1Failure) | |||
call json%add(p,"Pump2PopOffValveBlown",data%Warnings%Pump2PopOffValveBlown) | |||
call json%add(p,"Pump2Failure",data%Warnings%Pump2Failure) | |||
call json%add(p,"Pump3PopOffValveBlown",data%Warnings%Pump3PopOffValveBlown) | |||
call json%add(p,"Pump3Failure",data%Warnings%Pump3Failure) | |||
call json%add(p,"DrawworksGearsAbuse",data%Warnings%DrawworksGearsAbuse) | |||
call json%add(p,"RotaryGearsAbuse",data%Warnings%RotaryGearsAbuse) | |||
call json%add(p,"HoistLineBreak",data%Warnings%HoistLineBreak) | |||
call json%add(p,"PartedDrillString",data%Warnings%PartedDrillString) | |||
call json%add(p,"ActiveTankOverflow",data%Warnings%ActiveTankOverflow) | |||
call json%add(p,"ActiveTankUnderVolume",data%Warnings%ActiveTankUnderVolume) | |||
call json%add(p,"TripTankOverflow",data%Warnings%TripTankOverflow) | |||
call json%add(p,"DrillPipeTwistOff",data%Warnings%DrillPipeTwistOff) | |||
call json%add(p,"DrillPipeParted",data%Warnings%DrillPipeParted) | |||
call json%add(p,"TripWithSlipsSet",data%Warnings%TripWithSlipsSet) | |||
call json%add(p,"Blowout",data%Warnings%Blowout) | |||
call json%add(p,"UndergroundBlowout",data%Warnings%UndergroundBlowout) | |||
call json%add(p,"MaximumWellDepthExceeded",data%Warnings%MaximumWellDepthExceeded) | |||
call json%add(p,"CrownCollision",data%Warnings%CrownCollision) | |||
call json%add(p,"FloorCollision",data%Warnings%FloorCollision) | |||
call json%add(p,"TopdriveRotaryTableConfilict",data%Warnings%TopdriveRotaryTableConfilict) | |||
call jsoncore%add(p,"PumpWithKellyDisconnected",data%Warnings%PumpWithKellyDisconnected) | |||
call jsoncore%add(p,"PumpWithTopdriveDisconnected",data%Warnings%PumpWithTopdriveDisconnected) | |||
call jsoncore%add(p,"Pump1PopOffValveBlown",data%Warnings%Pump1PopOffValveBlown) | |||
call jsoncore%add(p,"Pump1Failure",data%Warnings%Pump1Failure) | |||
call jsoncore%add(p,"Pump2PopOffValveBlown",data%Warnings%Pump2PopOffValveBlown) | |||
call jsoncore%add(p,"Pump2Failure",data%Warnings%Pump2Failure) | |||
call jsoncore%add(p,"Pump3PopOffValveBlown",data%Warnings%Pump3PopOffValveBlown) | |||
call jsoncore%add(p,"Pump3Failure",data%Warnings%Pump3Failure) | |||
call jsoncore%add(p,"DrawworksGearsAbuse",data%Warnings%DrawworksGearsAbuse) | |||
call jsoncore%add(p,"RotaryGearsAbuse",data%Warnings%RotaryGearsAbuse) | |||
call jsoncore%add(p,"HoistLineBreak",data%Warnings%HoistLineBreak) | |||
call jsoncore%add(p,"PartedDrillString",data%Warnings%PartedDrillString) | |||
call jsoncore%add(p,"ActiveTankOverflow",data%Warnings%ActiveTankOverflow) | |||
call jsoncore%add(p,"ActiveTankUnderVolume",data%Warnings%ActiveTankUnderVolume) | |||
call jsoncore%add(p,"TripTankOverflow",data%Warnings%TripTankOverflow) | |||
call jsoncore%add(p,"DrillPipeTwistOff",data%Warnings%DrillPipeTwistOff) | |||
call jsoncore%add(p,"DrillPipeParted",data%Warnings%DrillPipeParted) | |||
call jsoncore%add(p,"TripWithSlipsSet",data%Warnings%TripWithSlipsSet) | |||
call jsoncore%add(p,"Blowout",data%Warnings%Blowout) | |||
call jsoncore%add(p,"UndergroundBlowout",data%Warnings%UndergroundBlowout) | |||
call jsoncore%add(p,"MaximumWellDepthExceeded",data%Warnings%MaximumWellDepthExceeded) | |||
call jsoncore%add(p,"CrownCollision",data%Warnings%CrownCollision) | |||
call jsoncore%add(p,"FloorCollision",data%Warnings%FloorCollision) | |||
call jsoncore%add(p,"TopdriveRotaryTableConfilict",data%Warnings%TopdriveRotaryTableConfilict) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine ProblemsToJson(parent) | |||
@@ -508,7 +520,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Problems') | |||
call jsoncore%create_object(p,'Problems') | |||
! 2. add member of data type to new node | |||
call BitProblemsToJson(p) | |||
@@ -525,7 +537,7 @@ module Simulator | |||
call RotaryProblemsToJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine StateToJson(parent) | |||
@@ -535,7 +547,7 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'State') | |||
call jsoncore%create_object(p,'State') | |||
! call OperationScenarioToJson(p) | |||
call notificationsToJson(p) | |||
@@ -598,7 +610,7 @@ module Simulator | |||
! 2. add member of data type to new node | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
!use this as a template | |||
@@ -609,21 +621,22 @@ module Simulator | |||
type(json_value),pointer :: p | |||
! 1. create new node | |||
call json%create_object(p,'Notifications') | |||
call jsoncore%create_object(p,'Notifications') | |||
! 2. add member of data type to new node | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
call jsoncore%add(parent,p) | |||
end subroutine | |||
subroutine ConfigurationFromJson(parent) | |||
subroutine ConfigurationFromJson(jsonfile) | |||
type(json_file)::jsonfile | |||
type(json_value),pointer :: parent | |||
type(json_value),pointer :: p | |||
! 1. get related root | |||
call json%get(parent,"Configuration",p) | |||
call jsonfile%json_file_get_root(parent) | |||
call jsoncore%get(parent,"Configuration",p) | |||
call StringConfigurationFromJson(p) | |||
call FormationFromJson(p) | |||
@@ -633,14 +646,14 @@ module Simulator | |||
call BopStackFromJson(p) | |||
call HoistingFromJson(p) | |||
call PowerFromJson(p) | |||
call PumpsFromJson(p) | |||
call PumpsFromJson(p) | |||
call RigSizeFromJson(p) | |||
call CasingLinerChokeFromJson(p) | |||
call PathGenerationFromJson(p) | |||
call MudPropertiesFromJson(p) | |||
call UnityInputsFromJson(p) | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
! nullify(parent) | |||
end subroutine | |||
subroutine WarningsFromJson(parent) | |||
@@ -649,64 +662,66 @@ module Simulator | |||
type(json_value),pointer :: pval | |||
! 1. get node | |||
call json%get(parent,'Warnings',p) | |||
call jsoncore%get(parent,'Warnings',p) | |||
! ! 2. add member of data type to new node | |||
call json%get(p,'PumpWithKellyDisconnected',pval) | |||
call json%get(pval,data%Warnings%PumpWithKellyDisconnected) | |||
call json%get(p,'PumpWithTopdriveDisconnected',pval) | |||
call json%get(pval,data%Warnings%PumpWithTopdriveDisconnected) | |||
call json%get(p,'Pump1PopOffValveBlown',pval) | |||
call json%get(pval,data%Warnings%Pump1PopOffValveBlown) | |||
call json%get(p,'Pump1Failure',pval) | |||
call json%get(pval,data%Warnings%Pump1Failure) | |||
call json%get(p,'Pump2PopOffValveBlown',pval) | |||
call json%get(pval,data%Warnings%Pump2PopOffValveBlown) | |||
call json%get(p,'Pump2Failure',pval) | |||
call json%get(pval,data%Warnings%Pump2Failure) | |||
call json%get(p,'Pump3PopOffValveBlown',pval) | |||
call json%get(pval,data%Warnings%Pump3PopOffValveBlown) | |||
call json%get(p,'Pump3Failure',pval) | |||
call json%get(pval,data%Warnings%Pump3Failure) | |||
call json%get(p,'DrawworksGearsAbuse',pval) | |||
call json%get(pval,data%Warnings%DrawworksGearsAbuse) | |||
call json%get(p,'RotaryGearsAbuse',pval) | |||
call json%get(pval,data%Warnings%RotaryGearsAbuse) | |||
call json%get(p,'HoistLineBreak',pval) | |||
call json%get(pval,data%Warnings%HoistLineBreak) | |||
call json%get(p,'PartedDrillString',pval) | |||
call json%get(pval,data%Warnings%PartedDrillString) | |||
call json%get(p,'ActiveTankOverflow',pval) | |||
call json%get(pval,data%Warnings%ActiveTankOverflow) | |||
call json%get(p,'ActiveTankUnderVolume',pval) | |||
call json%get(pval,data%Warnings%ActiveTankUnderVolume) | |||
call json%get(p,'TripTankOverflow',pval) | |||
call json%get(pval,data%Warnings%TripTankOverflow) | |||
call json%get(p,'DrillPipeTwistOff',pval) | |||
call json%get(pval,data%Warnings%DrillPipeTwistOff) | |||
call json%get(p,'DrillPipeParted',pval) | |||
call json%get(pval,data%Warnings%DrillPipeParted) | |||
call json%get(p,'TripWithSlipsSet',pval) | |||
call json%get(pval,data%Warnings%TripWithSlipsSet) | |||
call json%get(p,'Blowout',pval) | |||
call json%get(pval,data%Warnings%Blowout) | |||
call json%get(p,'UndergroundBlowout',pval) | |||
call json%get(pval,data%Warnings%UndergroundBlowout) | |||
call json%get(p,'MaximumWellDepthExceeded',pval) | |||
call json%get(pval,data%Warnings%MaximumWellDepthExceeded) | |||
call json%get(p,'CrownCollision',pval) | |||
call json%get(pval,data%Warnings%CrownCollision) | |||
call json%get(p,'FloorCollision',pval) | |||
call json%get(pval,data%Warnings%FloorCollision) | |||
call json%get(p,'TopdriveRotaryTableConfilict',pval) | |||
call json%get(pval,data%Warnings%TopdriveRotaryTableConfilict) | |||
call jsoncore%get(p,'PumpWithKellyDisconnected',pval) | |||
call jsoncore%get(pval,data%Warnings%PumpWithKellyDisconnected) | |||
call jsoncore%get(p,'PumpWithTopdriveDisconnected',pval) | |||
call jsoncore%get(pval,data%Warnings%PumpWithTopdriveDisconnected) | |||
call jsoncore%get(p,'Pump1PopOffValveBlown',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump1PopOffValveBlown) | |||
call jsoncore%get(p,'Pump1Failure',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump1Failure) | |||
call jsoncore%get(p,'Pump2PopOffValveBlown',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump2PopOffValveBlown) | |||
call jsoncore%get(p,'Pump2Failure',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump2Failure) | |||
call jsoncore%get(p,'Pump3PopOffValveBlown',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump3PopOffValveBlown) | |||
call jsoncore%get(p,'Pump3Failure',pval) | |||
call jsoncore%get(pval,data%Warnings%Pump3Failure) | |||
call jsoncore%get(p,'DrawworksGearsAbuse',pval) | |||
call jsoncore%get(pval,data%Warnings%DrawworksGearsAbuse) | |||
call jsoncore%get(p,'RotaryGearsAbuse',pval) | |||
call jsoncore%get(pval,data%Warnings%RotaryGearsAbuse) | |||
call jsoncore%get(p,'HoistLineBreak',pval) | |||
call jsoncore%get(pval,data%Warnings%HoistLineBreak) | |||
call jsoncore%get(p,'PartedDrillString',pval) | |||
call jsoncore%get(pval,data%Warnings%PartedDrillString) | |||
call jsoncore%get(p,'ActiveTankOverflow',pval) | |||
call jsoncore%get(pval,data%Warnings%ActiveTankOverflow) | |||
call jsoncore%get(p,'ActiveTankUnderVolume',pval) | |||
call jsoncore%get(pval,data%Warnings%ActiveTankUnderVolume) | |||
call jsoncore%get(p,'TripTankOverflow',pval) | |||
call jsoncore%get(pval,data%Warnings%TripTankOverflow) | |||
call jsoncore%get(p,'DrillPipeTwistOff',pval) | |||
call jsoncore%get(pval,data%Warnings%DrillPipeTwistOff) | |||
call jsoncore%get(p,'DrillPipeParted',pval) | |||
call jsoncore%get(pval,data%Warnings%DrillPipeParted) | |||
call jsoncore%get(p,'TripWithSlipsSet',pval) | |||
call jsoncore%get(pval,data%Warnings%TripWithSlipsSet) | |||
call jsoncore%get(p,'Blowout',pval) | |||
call jsoncore%get(pval,data%Warnings%Blowout) | |||
call jsoncore%get(p,'UndergroundBlowout',pval) | |||
call jsoncore%get(pval,data%Warnings%UndergroundBlowout) | |||
call jsoncore%get(p,'MaximumWellDepthExceeded',pval) | |||
call jsoncore%get(pval,data%Warnings%MaximumWellDepthExceeded) | |||
call jsoncore%get(p,'CrownCollision',pval) | |||
call jsoncore%get(pval,data%Warnings%CrownCollision) | |||
call jsoncore%get(p,'FloorCollision',pval) | |||
call jsoncore%get(pval,data%Warnings%FloorCollision) | |||
call jsoncore%get(p,'TopdriveRotaryTableConfilict',pval) | |||
call jsoncore%get(pval,data%Warnings%TopdriveRotaryTableConfilict) | |||
end subroutine | |||
subroutine ProblemsFromJson(parent) | |||
subroutine ProblemsFromJson(jsonfile) | |||
type(json_value),pointer :: parent | |||
type(json_value),pointer :: p | |||
type(json_file)::jsonfile | |||
call json%get(parent,'Warnings',p) | |||
call jsonfile%json_file_get_root(parent) | |||
call jsoncore%get(parent,'Warnings',p) | |||
call BitProblemsToJson(p) | |||
call BopProblemsFromJson(p) | |||
@@ -790,7 +805,7 @@ module Simulator | |||
! 2. add member of data type to new node | |||
! 3. add new node to parent | |||
call json%add(parent,p) | |||
! call jsoncore%add(parent,p) | |||
end subroutine | |||
!use this as a template | |||
@@ -37,11 +37,11 @@ module writevarsmodule | |||
! ! allocate(data%Configuration%Path%DataPoints(3)) | |||
! allocate(data) | |||
call json%initialize() | |||
call json%create_object(jsonroot,'') | |||
call json%add(jsonroot,'status',simulationStatus) | |||
call json%add(jsonroot,'speed',simulationSpeed) | |||
call json%add(jsonroot,'endstep',simulationEnd) | |||
call jsoncore%initialize() | |||
call jsoncore%create_object(jsonroot,'') | |||
call jsoncore%add(jsonroot,'status',simulationStatus) | |||
call jsoncore%add(jsonroot,'speed',simulationSpeed) | |||
call jsoncore%add(jsonroot,'endstep',simulationEnd) | |||
call ConfigurationToJson(jsonroot) | |||
! call WarningsToJson(jsonroot) | |||
@@ -49,14 +49,14 @@ module writevarsmodule | |||
call EquipmentsToJson(jsonroot) | |||
! call json%print(jsonroot,trim(fn)//".json") | |||
call json%serialize(jsonroot,redisInput) | |||
call jsoncore%serialize(jsonroot,redisInput) | |||
! print *,"Writing to redis:",len(redisInput) | |||
! nullify(redisContent) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
call setInput(redisInput) | |||
call json%print(jsonroot,'test.json') | |||
call json%destroy(jsonroot) | |||
call jsoncore%print(jsonroot,'test.json') | |||
call jsoncore%destroy(jsonroot) | |||
print *,"write ends" | |||
end subroutine | |||
@@ -38,11 +38,11 @@ module writevarsmodule | |||
! ! allocate(data%Configuration%Path%DataPoints(3)) | |||
! allocate(data) | |||
call json%initialize() | |||
call json%create_object(jsonroot,'') | |||
call json%add(jsonroot,'status',simulationStatus) | |||
call json%add(jsonroot,'speed',simulationSpeed) | |||
call json%add(jsonroot,'endstep',simulationEnd) | |||
call jsoncore%initialize() | |||
call jsoncore%create_object(jsonroot,'') | |||
call jsoncore%add(jsonroot,'status',simulationStatus) | |||
call jsoncore%add(jsonroot,'speed',simulationSpeed) | |||
call jsoncore%add(jsonroot,'endstep',simulationEnd) | |||
call ConfigurationToJson(jsonroot) | |||
! call WarningsToJson(jsonroot) | |||
@@ -50,14 +50,14 @@ module writevarsmodule | |||
call EquipmentsToJson(jsonroot) | |||
! call json%print(jsonroot,trim(fn)//".json") | |||
call json%serialize(jsonroot,redisInput) | |||
call jsoncore%serialize(jsonroot,redisInput) | |||
! print *,"Writing to redis:",len(redisInput) | |||
! nullify(redisContent) | |||
! deallocate(redisContent) | |||
! call json%destroy(pval) | |||
call setInput(redisInput) | |||
call json%print(jsonroot,'test.json') | |||
call json%destroy(jsonroot) | |||
call jsoncore%print(jsonroot,'test.json') | |||
call jsoncore%destroy(jsonroot) | |||
print *,"write ends" | |||
end subroutine | |||
@@ -0,0 +1,173 @@ | |||
{ | |||
"step": 83, | |||
"Warnings": { | |||
"PumpWithKellyDisconnected": false, | |||
"PumpWithTopdriveDisconnected": false, | |||
"Pump1PopOffValveBlown": false, | |||
"Pump1Failure": false, | |||
"Pump2PopOffValveBlown": false, | |||
"Pump2Failure": false, | |||
"Pump3PopOffValveBlown": false, | |||
"Pump3Failure": false, | |||
"DrawworksGearsAbuse": false, | |||
"RotaryGearsAbuse": false, | |||
"HoistLineBreak": false, | |||
"PartedDrillString": false, | |||
"ActiveTankOverflow": true, | |||
"ActiveTankUnderVolume": false, | |||
"TripTankOverflow": false, | |||
"DrillPipeTwistOff": false, | |||
"DrillPipeParted": false, | |||
"TripWithSlipsSet": false, | |||
"Blowout": false, | |||
"UndergroundBlowout": false, | |||
"MaximumWellDepthExceeded": false, | |||
"CrownCollision": false, | |||
"FloorCollision": false, | |||
"TopdriveRotaryTableConfilict": false | |||
}, | |||
"Equipments": { | |||
"BopControl": { | |||
"ManifoldPressureGauge": 0.15E+4, | |||
"AirSupplyPressureGauge": 0.12E+3, | |||
"AccumulatorPressureGauge": 0.3E+4, | |||
"AnnularPressureGauge": 0.0E+0, | |||
"AnnularOpenLED": 1, | |||
"AnnularCloseLED": 0, | |||
"UpperRamsOpenLED": 1, | |||
"UpperRamsCloseLED": 0, | |||
"MiddleRamsOpenLED": 1, | |||
"MiddleRamsCloseLED": 0, | |||
"KillLineOpenLED": 0, | |||
"KillLineCloseLED": 1, | |||
"ChokeLineOpenLED": 0, | |||
"ChokeLineCloseLED": 1, | |||
"LowerRamsOpenLED": 1, | |||
"LowerRamsCloseLED": 0, | |||
"AnnularStatus": 0.13625E+2, | |||
"UpperRamsStatus": 0.13625E+2, | |||
"MiddleRamsStatus": 0.13625E+2, | |||
"LowerRamsStatus": 0.13625E+2 | |||
}, | |||
"ChokeControl": { | |||
"StandPipePressure": 0.0E+0, | |||
"CasingPressure": 0.0E+0, | |||
"ChokePosition": 0.0E+0, | |||
"ChokePanelSPMCounter": 0.0E+0, | |||
"ChokePanelTotalStrokeCounter": 0.0E+0, | |||
"Choke1LED": 0, | |||
"Choke2LED": 1 | |||
}, | |||
"ChokeManifold": { | |||
"HydraulicChock1": 0, | |||
"HydraulicChock2": 0, | |||
"HyChock1OnProblem": false, | |||
"HyChock2OnProblem": false, | |||
"LeftManChokeOnProblem": false, | |||
"RightManChokeOnProblem": false | |||
}, | |||
"DataDisplay": { | |||
"WOBPointer": 0.0E+0, | |||
"HookLoadPointer": 0.0E+0, | |||
"TripTankGauge": 0.0E+0, | |||
"TripTankAlarmLED": 0, | |||
"TripTankPumpLED": 0, | |||
"StandPipePressureGauge": 0.0E+0, | |||
"CasingPressureGauge": 0.0E+0, | |||
"MP1SPMGauge": 0.0E+0, | |||
"MP2SPMGauge": 0.0E+0, | |||
"ReturnLineTempGauge": 0.0E+0, | |||
"RotaryTorqueGauge": 0.0E+0, | |||
"RotaryRPMGauge": 0.0E+0, | |||
"AcidGasDetectionLED": 0, | |||
"TotalStrokeCounter": 0.0E+0, | |||
"PitGainLossGauge": 0.0E+0, | |||
"MudTanksVolumeGauge": 0.0E+0, | |||
"MVTAlarmLED": 0, | |||
"ReturnMudFlowGauge": 0.0E+0, | |||
"FillStrokeCounter": 0.0E+0, | |||
"MFFITotalStrokeCounter": 0.0E+0, | |||
"MFFIAlarmLED": 0, | |||
"MFFIPumpLED": 0, | |||
"TotalWellDepth": "NaN", | |||
"BitDepth": 0.0E+0, | |||
"HookLoad": 0.0E+0, | |||
"StandPipePressure": 0.0E+0, | |||
"CasingPressure": 0.0E+0, | |||
"MP1SPM": 0.0E+0, | |||
"MP2SPM": 0.0E+0, | |||
"RTTorque": 0.0E+0, | |||
"RTRPM": 0.0E+0, | |||
"WOP": 0.0E+0, | |||
"ROP": "NaN", | |||
"MudWeightIn": 0.0E+0, | |||
"MudWeightOut": 0.0E+0, | |||
"Buzzer1": false, | |||
"Buzzer2": false, | |||
"Buzzer3": false, | |||
"Buzzer4": false | |||
}, | |||
"Drilling": { | |||
"ParkingBrakeLed": false, | |||
"GEN1LED": 0, | |||
"GEN2LED": 0, | |||
"GEN3LED": 0, | |||
"GEN4LED": 0, | |||
"SCR1LED": 0, | |||
"SCR2LED": 0, | |||
"SCR3LED": 0, | |||
"SCR4LED": 0, | |||
"MP1BLWR": 0, | |||
"MP2BLWR": 0, | |||
"DWBLWR": 0, | |||
"RTBLWR": 0, | |||
"PWRLIM": 0, | |||
"PWRLIMMTR": 0.0E+0, | |||
"RTTorqueLimitGauge": 0.0E+0, | |||
"AutoDWLED": 0, | |||
"GEN1BTNLED": 0, | |||
"GEN2BTNLED": 0, | |||
"GEN3BTNLED": 0, | |||
"GEN4BTNLED": 0, | |||
"OpenKellyCockLed": 0, | |||
"CloseKellyCockLed": 0, | |||
"OpenSafetyValveLed": 1, | |||
"CloseSafetyValveLed": 0, | |||
"IRSafetyValveLed": 1, | |||
"IRIBopLed": 0, | |||
"LatchPipeLED": 0, | |||
"UnlatchPipeLED": 0, | |||
"SwingLed": 0, | |||
"FillMouseHoleLed": 0 | |||
}, | |||
"Hook": { | |||
"HookHeight_S": 0.0E+0, | |||
"HookHeight": "NaN" | |||
}, | |||
"StandPipeManifold": { | |||
"StandPipeGauge1": 0.0E+0, | |||
"StandPipeGauge2": 0.0E+0 | |||
}, | |||
"DrillingWatch": { | |||
"Depth": "NaN", | |||
"BitPosition": -0.348E+1, | |||
"HookLoad": 0.0E+0, | |||
"WeightOnBit": 0.0E+0, | |||
"RPM": 0.0E+0, | |||
"ROP": "NaN", | |||
"Torque": 0.0E+0, | |||
"PumpPressure": 0.0E+0, | |||
"SPM1": 0.0E+0, | |||
"SPM2": 0.0E+0, | |||
"CasingPressure": 0.0E+0, | |||
"PercentFlow": 0.0E+0, | |||
"PitGainLose": -0.32000000000000001E+0, | |||
"PitVolume": 0.0E+0, | |||
"KillMudVolume": 0.0E+0, | |||
"TripTankVolume": 0.0E+0, | |||
"MudWeightIn": 0.0E+0, | |||
"FillVolume": 0.0E+0, | |||
"MudWeightOut": 0.0E+0 | |||
} | |||
} | |||
} |