diff --git a/.vscode/launch.json b/.vscode/launch.json index 63c3ff0..536a5ce 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -41,40 +41,16 @@ "preLaunchTask": "build" }, { - "name": "Debug (Liara)", + "name": "Debug Test", "type": "cppdbg", "request": "launch", - "program": "${workspaceRoot}/SimulationCore2", - "args": ["aberama.iran.liara.ir", "32815", "4YKFnubfFFjfh4yTK7b0Rg9X", "de972886-410b-440e-f8cc-08dba274a00f", "4", "1000","10"], - "stopAtEntry": false, - "cwd": "${workspaceRoot}", - "externalConsole": false, - "MIMode": "gdb", - "preLaunchTask": "make", - }, - { - "name": "Debug (Asiatech)", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceRoot}/SimulationCore2", - "args": ["85.198.9.229", "6379", "'1qazxsw2$$'", "b6996849-fb69-4076-ca17-08dbea60e4cb", "4", "100","10"], - "stopAtEntry": false, - "cwd": "${workspaceRoot}", - "externalConsole": false, - "MIMode": "gdb", - "preLaunchTask": "make", - }, - { - "name": "Debug write_vars", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceRoot}/write_vars", - "args": ["Config-debug.json"], + "program": "${workspaceRoot}/Test_Redis", + "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "externalConsole": false, "MIMode": "gdb", - // "preLaunchTask": "make debug", + "preLaunchTask": "make testredis", } ] diff --git a/.vscode/tasks.json b/.vscode/tasks.json index f54adc7..ebbbec5 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,6 +1,14 @@ { "version": "2.0.0", "tasks": [ + { + "label": "make testredis", + "type": "shell", + "command": "make testredis", + "options": { + "cwd": "${workspaceRoot}" + } + }, { "label": "make", "type": "shell", diff --git a/CSharp/BasicInputs/Geology/CFormation.i90 b/CSharp/BasicInputs/Geology/CFormation.i90 index 6f43b0e..0ae23c9 100644 --- a/CSharp/BasicInputs/Geology/CFormation.i90 +++ b/CSharp/BasicInputs/Geology/CFormation.i90 @@ -21,6 +21,7 @@ module CFormation call json%info(p, n_children=n_children) data%Configuration%Formation%Count = n_children + if (.not. allocated(data%Configuration%Formation%Formations) .or. size(data%Configuration%Formation%Formations)/=n_children) then ALLOCATE(data%Configuration%Formation%Formations(n_children)) endif diff --git a/CSharp/BasicInputs/MudProperties.i90 b/CSharp/BasicInputs/MudProperties.i90 index fc4103b..edbdabe 100644 --- a/CSharp/BasicInputs/MudProperties.i90 +++ b/CSharp/BasicInputs/MudProperties.i90 @@ -116,9 +116,8 @@ module MudPropertiesModule subroutine Set_ActiveMudVolume_StudentStation(v) implicit none real*8, intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%Configuration%Mud%ActiveMudVolume == v) return - #endif +# 120 + data%Configuration%Mud%ActiveMudVolume = v ! if(associated(ActiveMudVolumePtr)) call ActiveMudVolumePtr(data%Configuration%Mud%ActiveMudVolume) end subroutine @@ -126,9 +125,8 @@ module MudPropertiesModule subroutine Set_ActiveDensity_StudentStation(v) implicit none real*8, intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%Configuration%Mud%ActiveDensity == v) return - #endif +# 130 + data%Configuration%Mud%ActiveDensity = v ! if(associated(ActiveDensityPtr)) call ActiveDensityPtr(data%Configuration%Mud%ActiveDensity) end subroutine @@ -136,9 +134,8 @@ module MudPropertiesModule subroutine Set_ReserveMudVolume_StudentStation(v) implicit none real*8, intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%Configuration%Mud%ReserveMudVolume == v) return - #endif +# 140 + data%Configuration%Mud%ReserveMudVolume = v ! if(associated(ReserveMudVolumePtr)) call ReserveMudVolumePtr(data%Configuration%Mud%ReserveMudVolume) end subroutine @@ -146,9 +143,8 @@ module MudPropertiesModule subroutine Set_ReserveDensity_StudentStation(v) implicit none real*8, intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%Configuration%Mud%ReserveDensity == v) return - #endif +# 150 + data%Configuration%Mud%ReserveDensity = v ! if(associated(ReserveDensityPtr)) call ReserveDensityPtr(data%Configuration%Mud%ReserveDensity) end subroutine diff --git a/CSharp/DownHole/CDownHoleActions.i90 b/CSharp/DownHole/CDownHoleActions.i90 new file mode 100644 index 0000000..cc9031e --- /dev/null +++ b/CSharp/DownHole/CDownHoleActions.i90 @@ -0,0 +1,106 @@ +# 1 "/home/admin/SimulationCore2/CSharp/DownHole/CDownHoleActions.f90" +module CDownHoleActions + use CIActionReference + implicit none + public + + abstract interface + subroutine ActionFluid(array) + use CDownHoleTypes + type(CFluid), allocatable, intent(in), target :: array(:) + end subroutine + + subroutine ActionComponent(array) + use CDownHoleTypes + type(CStringComponent), allocatable, intent(in), target :: array(:) + end subroutine + + subroutine ActionBopElement(array) + use CDownHoleTypes + type(CBopElement), allocatable, intent(in), target :: array(:) + end subroutine + end interface + + procedure (ActionInteger), pointer :: AnnalusMudCountPtr + procedure (ActionFluid), pointer :: AnnalusMudArrayPtr + + procedure (ActionInteger), pointer :: StringMudCountPtr + procedure (ActionFluid), pointer :: StringMudArrayPtr + + procedure (ActionInteger), pointer :: StringComponentCountPtr + procedure (ActionComponent), pointer :: StringComponentArrayPtr + + procedure (ActionBopElement), pointer :: BopElementsPtr + + contains + + subroutine SubscribeAnnalusMudCount(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeAnnalusMudCount +!DEC$ ATTRIBUTES ALIAS: 'SubscribeAnnalusMudCount' :: SubscribeAnnalusMudCount + implicit none + procedure (ActionInteger) :: a + AnnalusMudCountPtr => a + end subroutine + + subroutine SubscribeAnnalusMudArray(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeAnnalusMudArray +!DEC$ ATTRIBUTES ALIAS: 'SubscribeAnnalusMudArray' :: SubscribeAnnalusMudArray + implicit none + procedure (ActionFluid) :: a + AnnalusMudArrayPtr => a + end subroutine + + + + + + + + + subroutine SubscribeStringMudCount(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeStringMudCount +!DEC$ ATTRIBUTES ALIAS: 'SubscribeStringMudCount' :: SubscribeStringMudCount + implicit none + procedure (ActionInteger) :: a + StringMudCountPtr => a + end subroutine + + subroutine SubscribeStringMudArray(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeStringMudArray +!DEC$ ATTRIBUTES ALIAS: 'SubscribeStringMudArray' :: SubscribeStringMudArray + implicit none + procedure (ActionFluid) :: a + StringMudArrayPtr => a + end subroutine + + + + + + + subroutine SubscribeStringComponentCount(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeStringComponentCount +!DEC$ ATTRIBUTES ALIAS: 'SubscribeStringComponentCount' :: SubscribeStringComponentCount + implicit none + procedure (ActionInteger) :: a + StringComponentCountPtr => a + end subroutine + + subroutine SubscribeStringComponentArray(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeStringComponentArray +!DEC$ ATTRIBUTES ALIAS: 'SubscribeStringComponentArray' :: SubscribeStringComponentArray + implicit none + procedure (ActionComponent) :: a + StringComponentArrayPtr => a + end subroutine + + + subroutine SubscribeBopElements(a) +!DEC$ ATTRIBUTES DLLEXPORT :: SubscribeBopElements +!DEC$ ATTRIBUTES ALIAS: 'SubscribeBopElements' :: SubscribeBopElements + implicit none + procedure (ActionBopElement) :: a + BopElementsPtr => a + end subroutine + +end module CDownHoleActions diff --git a/CSharp/DownHole/CDownHoleTypes.i90 b/CSharp/DownHole/CDownHoleTypes.i90 index 5103c89..6022f2a 100644 --- a/CSharp/DownHole/CDownHoleTypes.i90 +++ b/CSharp/DownHole/CDownHoleTypes.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/DownHole/CDownHoleTypes.f90" +# 1 "/home/admin/SimulationCore2/CSharp/DownHole/CDownHoleTypes.f90" module CDownHoleTypes implicit none public diff --git a/CSharp/DownHole/CDownHoleVariables.f90 b/CSharp/DownHole/CDownHoleVariables.f90 index 6598c50..9898d8f 100644 --- a/CSharp/DownHole/CDownHoleVariables.f90 +++ b/CSharp/DownHole/CDownHoleVariables.f90 @@ -3,7 +3,7 @@ module CDownHoleVariables ! use CStringConfigurationVariables ! use CDownHoleActions use CLog4 - implicit none + implicit none public !!!!!!!!!!!!!!!!!!!!! ! Outputs to user interface diff --git a/CSharp/DownHole/CDownHoleVariables.i90 b/CSharp/DownHole/CDownHoleVariables.i90 index eebb229..b4a5929 100644 --- a/CSharp/DownHole/CDownHoleVariables.i90 +++ b/CSharp/DownHole/CDownHoleVariables.i90 @@ -1,10 +1,10 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/DownHole/CDownHoleVariables.f90" +# 1 "/home/admin/SimulationCore2/CSharp/DownHole/CDownHoleVariables.f90" module CDownHoleVariables use CDownHoleTypes ! use CStringConfigurationVariables ! use CDownHoleActions use CLog4 - implicit none + implicit none public !!!!!!!!!!!!!!!!!!!!! ! Outputs to user interface diff --git a/CSharp/DownHole/DownHole.f90 b/CSharp/DownHole/DownHole.f90 index d17f593..25a186f 100644 --- a/CSharp/DownHole/DownHole.f90 +++ b/CSharp/DownHole/DownHole.f90 @@ -2,23 +2,16 @@ module DownHoleModule use SimulationVariables contains - subroutine MudPropertiesToJson(parent) + subroutine DownHoleToJson(parent) type(json_value),pointer :: parent type(json_core) :: json - type(json_value),pointer :: p - + type(json_value),pointer :: p,jsonarray,pitem + integer::i ! 1. create new node call json%create_object(p,'DownHole') ! 2. add member of data type to new node - ! call json%add(p,"AnnalusFluidsCount",data%Equipments%DownHole%AnnalusFluidsCount) - ! call json%add(p,"StringFluidsCount",data%Equipments%DownHole%StringFluidsCount) - ! call json%add(p,"AnnalusFluids(:)",data%Equipments%DownHole%AnnalusFluids(:)) - ! call json%add(p,"StringFluids(:)",data%Equipments%DownHole%StringFluids(:)) - ! call json%add(p,"StringCount",data%Equipments%DownHole%StringCount) - ! call json%add(p,"String(:)",data%Equipments%DownHole%String(:)) - ! call json%add(p,"BopElements(:)",data%Equipments%DownHole%BopElements(:)) call json%add(p,"DrillPipePressure",data%Equipments%DownHole%DrillPipePressure) call json%add(p,"CasingPressure",data%Equipments%DownHole%CasingPressure) call json%add(p,"ShoePressure",data%Equipments%DownHole%ShoePressure) @@ -28,21 +21,58 @@ module DownHoleModule call json%add(p,"KickVolume",data%Equipments%DownHole%KickVolume) call json%add(p,"SecondKickVolume",data%Equipments%DownHole%SecondKickVolume) call json%add(p,"PermeabilityExposedHeight",data%Equipments%DownHole%PermeabilityExposedHeight) - ! 3. add new node to parent - call json%add(parent,p) - end subroutine + + call json%create_array(jsonarray, 'String') + do i = 1, data%Equipments%DownHole%StringCount + call json%create_object(pitem,'') + call json%add(pitem,'StartMd', data%Equipments%DownHole%String(i)%StartMd) + call json%add(pitem,'EndMd', data%Equipments%DownHole%String(i)%EndMd) + call json%add(pitem,'ComponentType', data%Equipments%DownHole%String(i)%ComponentType) + call json%add(jsonarray,pitem) + nullify(pitem) + enddo + call json%add(p,jsonarray) + nullify(jsonarray) - subroutine DownHoleFromJson(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%create_array(jsonarray, 'StringFluids') + do i = 1, data%Equipments%DownHole%StringCount + call json%create_object(pitem,'') + call json%add(pitem,'StartMd', data%Equipments%DownHole%StringFluids(i)%StartMd) + call json%add(pitem,'EndMd', data%Equipments%DownHole%StringFluids(i)%EndMd) + call json%add(pitem,'Density', data%Equipments%DownHole%StringFluids(i)%Density) + call json%add(pitem,'MudType', data%Equipments%DownHole%StringFluids(i)%MudType) + call json%add(jsonarray,pitem) + nullify(pitem) + enddo + call json%add(p,jsonarray) + nullify(jsonarray) + + ! call json%create_array(jsonarray, 'AnnalusFluids') + ! do i = 1, data%Equipments%DownHole%AnnalusFluidsCount + ! call json%create_object(pitem,'') + ! call json%add(pitem,'StartMd', data%Equipments%DownHole%AnnalusFluids(i)%StartMd) + ! call json%add(pitem,'EndMd', data%Equipments%DownHole%AnnalusFluids(i)%EndMd) + ! call json%add(pitem,'Density', data%Equipments%DownHole%AnnalusFluids(i)%Density) + ! call json%add(pitem,'MudType', data%Equipments%DownHole%AnnalusFluids(i)%MudType) + ! call json%add(jsonarray,pitem) + ! nullify(pitem) + ! enddo + ! call json%add(p,jsonarray) + nullify(jsonarray) - call json%get(parent,'DownHole',p) - call json%get(p,'AnnDrillMud',pval) - call json%get(pval,data%Equipments%DownHole%AnnDrillMud) - call json%get(p,'AnnCirculateMud',pval) - call json%get(pval,data%Equipments%DownHole%AnnCirculateMud) + call json%create_array(jsonarray, 'BOPElements') + do i = 1, 4 + call json%create_object(pitem,'') + call json%add(pitem,'ElementType', data%Equipments%DownHole%BOPElements(i)%ElementType) + call json%add(pitem,'ElementStart', data%Equipments%DownHole%BOPElements(i)%ElementStart) + call json%add(pitem,'ElementEnd', data%Equipments%DownHole%BOPElements(i)%ElementEnd) + call json%add(jsonarray,pitem) + nullify(pitem) + enddo + call json%add(p,jsonarray) + nullify(jsonarray) + ! 3. add new node to parent + call json%add(parent,p) end subroutine subroutine SetAnnalusFluids(count, array) diff --git a/CSharp/DownHole/DownHole.i90 b/CSharp/DownHole/DownHole.i90 index c552e6d..7bebbc8 100644 --- a/CSharp/DownHole/DownHole.i90 +++ b/CSharp/DownHole/DownHole.i90 @@ -1,25 +1,18 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/DownHole/DownHole.f90" +# 1 "/home/admin/SimulationCore2/CSharp/DownHole/DownHole.f90" module DownHoleModule use SimulationVariables contains - subroutine MudPropertiesToJson(parent) + subroutine DownHoleToJson(parent) type(json_value),pointer :: parent type(json_core) :: json - type(json_value),pointer :: p - + type(json_value),pointer :: p,jsonarray,pitem + integer::i ! 1. create new node call json%create_object(p,'DownHole') ! 2. add member of data type to new node -! call json%add(p,"AnnalusFluidsCount",data%Equipments%DownHole%AnnalusFluidsCount) -! call json%add(p,"StringFluidsCount",data%Equipments%DownHole%StringFluidsCount) -! call json%add(p,"AnnalusFluids(:)",data%Equipments%DownHole%AnnalusFluids(:)) -! call json%add(p,"StringFluids(:)",data%Equipments%DownHole%StringFluids(:)) -! call json%add(p,"StringCount",data%Equipments%DownHole%StringCount) -! call json%add(p,"String(:)",data%Equipments%DownHole%String(:)) -! call json%add(p,"BopElements(:)",data%Equipments%DownHole%BopElements(:)) call json%add(p,"DrillPipePressure",data%Equipments%DownHole%DrillPipePressure) call json%add(p,"CasingPressure",data%Equipments%DownHole%CasingPressure) call json%add(p,"ShoePressure",data%Equipments%DownHole%ShoePressure) @@ -29,21 +22,58 @@ module DownHoleModule call json%add(p,"KickVolume",data%Equipments%DownHole%KickVolume) call json%add(p,"SecondKickVolume",data%Equipments%DownHole%SecondKickVolume) call json%add(p,"PermeabilityExposedHeight",data%Equipments%DownHole%PermeabilityExposedHeight) -! 3. add new node to parent - call json%add(parent,p) - end subroutine + + call json%create_array(jsonarray, 'String') + do i = 1, data%Equipments%DownHole%StringCount + call json%create_object(pitem,'') + call json%add(pitem,'StartMd', data%Equipments%DownHole%String(i)%StartMd) + call json%add(pitem,'EndMd', data%Equipments%DownHole%String(i)%EndMd) + call json%add(pitem,'ComponentType', data%Equipments%DownHole%String(i)%ComponentType) + call json%add(jsonarray,pitem) + nullify(pitem) + enddo + call json%add(p,jsonarray) + nullify(jsonarray) - subroutine DownHoleFromJson(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%create_array(jsonarray, 'StringFluids') + do i = 1, data%Equipments%DownHole%StringCount + call json%create_object(pitem,'') + call json%add(pitem,'StartMd', data%Equipments%DownHole%StringFluids(i)%StartMd) + call json%add(pitem,'EndMd', data%Equipments%DownHole%StringFluids(i)%EndMd) + call json%add(pitem,'Density', data%Equipments%DownHole%StringFluids(i)%Density) + call json%add(pitem,'MudType', data%Equipments%DownHole%StringFluids(i)%MudType) + call json%add(jsonarray,pitem) + nullify(pitem) + enddo + call json%add(p,jsonarray) + nullify(jsonarray) + +! call json%create_array(jsonarray, 'AnnalusFluids') +! do i = 1, data%Equipments%DownHole%AnnalusFluidsCount +! call json%create_object(pitem,'') +! call json%add(pitem,'StartMd', data%Equipments%DownHole%AnnalusFluids(i)%StartMd) +! call json%add(pitem,'EndMd', data%Equipments%DownHole%AnnalusFluids(i)%EndMd) +! call json%add(pitem,'Density', data%Equipments%DownHole%AnnalusFluids(i)%Density) +! call json%add(pitem,'MudType', data%Equipments%DownHole%AnnalusFluids(i)%MudType) +! call json%add(jsonarray,pitem) +! nullify(pitem) +! enddo +! call json%add(p,jsonarray) + nullify(jsonarray) - call json%get(parent,'DownHole',p) - call json%get(p,'AnnDrillMud',pval) - call json%get(pval,data%Equipments%DownHole%AnnDrillMud) - call json%get(p,'AnnCirculateMud',pval) - call json%get(pval,data%Equipments%DownHole%AnnCirculateMud) + call json%create_array(jsonarray, 'BOPElements') + do i = 1, 4 + call json%create_object(pitem,'') + call json%add(pitem,'ElementType', data%Equipments%DownHole%BOPElements(i)%ElementType) + call json%add(pitem,'ElementStart', data%Equipments%DownHole%BOPElements(i)%ElementStart) + call json%add(pitem,'ElementEnd', data%Equipments%DownHole%BOPElements(i)%ElementEnd) + call json%add(jsonarray,pitem) + nullify(pitem) + enddo + call json%add(p,jsonarray) + nullify(jsonarray) +! 3. add new node to parent + call json%add(parent,p) end subroutine subroutine SetAnnalusFluids(count, array) @@ -52,8 +82,8 @@ module DownHoleModule integer :: i, offset type(CFluid), intent(inout), target :: array(count) type(CFluid), pointer :: item - data%Equipments%DownHole%AnnalusFluidsCount = count - if(print_log) print*, 'AnnalusFluidsCount = ', count +! data%Equipments%DownHole%AnnalusFluidsCount = count +! if(print_log) print*, 'AnnalusFluidsCount = ', count if(size(data%Equipments%DownHole%AnnalusFluids) > 0) then deallocate(data%Equipments%DownHole%AnnalusFluids) end if @@ -104,7 +134,7 @@ module DownHoleModule type(CFluid), intent(inout), target :: array(count) type(CFluid), pointer :: item data%Equipments%DownHole%StringFluidsCount = count - if(print_log) print*, 'StringFluidsCount = ', count +! if(print_log) print*, 'StringFluidsCount = ', count if(size(data%Equipments%DownHole%StringFluids) > 0) then deallocate(data%Equipments%DownHole%StringFluids) end if diff --git a/CSharp/DownHole/cdownholetypes.mod b/CSharp/DownHole/cdownholetypes.mod deleted file mode 100644 index 5f5f501..0000000 Binary files a/CSharp/DownHole/cdownholetypes.mod and /dev/null differ diff --git a/CSharp/Equipments/ControlPanels/CBopControlPanel.i90 b/CSharp/Equipments/ControlPanels/CBopControlPanel.i90 index 2950c76..e94ce44 100644 --- a/CSharp/Equipments/ControlPanels/CBopControlPanel.i90 +++ b/CSharp/Equipments/ControlPanels/CBopControlPanel.i90 @@ -69,7 +69,6 @@ module CBopControlPanel ! call json%get(pval,data%Equipments%BopControlPanel%MiddleRamsStatus) ! call json%get(p,'LowerRamsStatus',pval) ! call json%get(pval,data%Equipments%BopControlPanel%LowerRamsStatus) - call json%get(p,'AnnularRegulatorSetControl',pval) call json%get(pval,data%Equipments%BopControlPanel%AnnularRegulatorSetControl) ! 2. get member of data type from node diff --git a/CSharp/Equipments/ControlPanels/CChokeControlPanel.i90 b/CSharp/Equipments/ControlPanels/CChokeControlPanel.i90 index 902d25e..cead332 100644 --- a/CSharp/Equipments/ControlPanels/CChokeControlPanel.i90 +++ b/CSharp/Equipments/ControlPanels/CChokeControlPanel.i90 @@ -6,47 +6,24 @@ module CChokeControlPanel public contains - subroutine ChokeControlPanelFromJson(parent) - type(json_value),pointer :: parent - type(json_core) :: json - type(json_value),pointer :: p,pval -! 1. get related root - call json%get(parent,'ChokeControl',p) - -! 2. get member of data type from node - call json%get(p,'ChokeControlLever',pval) - call json%get(pval,data%Equipments%ChokeControlPanel%ChokeControlLever) - - call json%get(p,'ChokePanelRigAirSwitch',pval) - call json%get(pval,data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch) - - - call json%get(p,'ChokePanelPumpSelectorSwitch',pval) - call json%get(pval,data%Equipments%ChokeControlPanel%ChokePanelPumpSelectorSwitch) - call json%get(p,'ChokePanelStrokeResetSwitch',pval) - call json%get(pval,data%Equipments%ChokeControlPanel%ChokePanelStrokeResetSwitch) - call json%get(p,'ChokeSelectorSwitch',pval) - call json%get(pval,data%Equipments%ChokeControlPanel%ChokeSelectorSwitch) - call json%get(p,'ChokeRateControlKnob',pval) - call json%get(pval,data%Equipments%ChokeControlPanel%ChokeRateControlKnob) - -! call json%get(p,'EnableAutoChoke',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%EnableAutoChoke) -! call json%get(p,'StandPipePressure',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%StandPipePressure) -! call json%get(p,'CasingPressure',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%CasingPressure) -! call json%get(p,'ChokePosition',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%ChokePosition) -! call json%get(p,'ChokePanelSPMCounter',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%ChokePanelSPMCounter) -! call json%get(p,'ChokePanelTotalStrokeCounter',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%ChokePanelTotalStrokeCounter) -! call json%get(p,'Choke1LED',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%Choke1LED) -! call json%get(p,'Choke2LED',pval) -! call json%get(pval,data%Equipments%ChokeControlPanel%Choke2LED) - end subroutine + subroutine ChokeControlPanelFromJson(jsonfile) + type(json_file)::jsonfile + logical::found + + call jsonfile%get('Equipments.ChokeControl.ChokePanelPumpSelectorSwitch',data%Equipments%ChokeControlPanel%ChokePanelPumpSelectorSwitch,found) + if ( .not. found ) call logg(4,"Not found: ChokeControlPanel%ChokePanelPumpSelectorSwitch") + call jsonfile%get('Equipments.ChokeControl.ChokePanelStrokeResetSwitch',data%Equipments%ChokeControlPanel%ChokePanelStrokeResetSwitch,found) + if ( .not. found ) call logg(4,"Not found: ChokeControlPanel%ChokePanelStrokeResetSwitch") + call jsonfile%get('Equipments.ChokeControl.ChokeSelectorSwitch',data%Equipments%ChokeControlPanel%ChokeSelectorSwitch,found) + if ( .not. found ) call logg(4,"Not found: ChokeControlPanel%ChokeSelectorSwitch") + call jsonfile%get('Equipments.ChokeControl.ChokeRateControlKnob',data%Equipments%ChokeControlPanel%ChokeRateControlKnob,found) + if ( .not. found ) call logg(4,"Not found: ChokeControlPanel%ChokeRateControlKnob") + call jsonfile%get('Equipments.ChokeControl.ChokeControlLever',data%Equipments%ChokeControlPanel%ChokeControlLever,found) + if ( .not. found ) call logg(4,"Not found: ChokeControlPanel%ChokeControlLever") + call jsonfile%get('Equipments.ChokeControl.ChokePanelRigAirSwitch',data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch,found) + if ( .not. found ) call logg(4,"Not found: ChokeControlPanel%ChokePanelRigAirSwitch") +! print *,data%Equipments%ChokeControlPanel%ChokeSelectorSwitch + end subroutine subroutine ChokeControlPanelToJson(parent) @@ -57,9 +34,9 @@ module CChokeControlPanel ! 1. create new node call json%create_object(p,'ChokeControl') call json%add(p,"ChokePanelPumpSelectorSwitch",data%Equipments%ChokeControlPanel%ChokePanelPumpSelectorSwitch) -! call json%add(p,"ChokePanelStrokeResetSwitch",data%Equipments%ChokeControlPanel%ChokePanelStrokeResetSwitch) + call json%add(p,"ChokePanelStrokeResetSwitch",data%Equipments%ChokeControlPanel%ChokePanelStrokeResetSwitch) call json%add(p,"ChokeSelectorSwitch",data%Equipments%ChokeControlPanel%ChokeSelectorSwitch) -! call json%add(p,"ChokeRateControlKnob",data%Equipments%ChokeControlPanel%ChokeRateControlKnob) + call json%add(p,"ChokeRateControlKnob",data%Equipments%ChokeControlPanel%ChokeRateControlKnob) call json%add(p,"ChokeControlLever",data%Equipments%ChokeControlPanel%ChokeControlLever) call json%add(p,"ChokePanelRigAirSwitch",data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch) ! call json%add(p,"EnableAutoChoke",data%Equipments%ChokeControlPanel%EnableAutoChoke) diff --git a/CSharp/Equipments/ControlPanels/CChokeManifold.i90 b/CSharp/Equipments/ControlPanels/CChokeManifold.i90 index 1d0e9d2..a2233a3 100644 --- a/CSharp/Equipments/ControlPanels/CChokeManifold.i90 +++ b/CSharp/Equipments/ControlPanels/CChokeManifold.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeManifold.f90" +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeManifold.f90" module CChokeManifold ! use CChokeManifoldVariables use SimulationVariables @@ -97,9 +97,9 @@ module CChokeManifold call ChangeValve(33, .true.) else if(v == 100) then - if(Manifold%Valve(33)%Status) call ChangeValve(33, .false.) + if(data%state%manifold%Valve(33)%Status) call ChangeValve(33, .false.) else - if(.not.Manifold%Valve(33)%Status) call ChangeValve(33, .true.) + if(.not.data%state%manifold%Valve(33)%Status) call ChangeValve(33, .true.) endif endif !WRITE (*,*) ' valve 33 ', Valve(33)%Status, ' arg ', v @@ -113,9 +113,9 @@ subroutine SetHydraulicChock2(v) call ChangeValve(34, .true.) else if(v==100) then - if(Manifold%Valve(34)%Status) call ChangeValve(34, .false.) + if(data%state%manifold%Valve(34)%Status) call ChangeValve(34, .false.) else - if(.not.Manifold%Valve(34)%Status) call ChangeValve(34, .true.) + if(.not.data%state%manifold%Valve(34)%Status) call ChangeValve(34, .true.) endif endif !WRITE (*,*) ' valve 34 ', Valve(34)%Status, ' arg ', v diff --git a/CSharp/Equipments/ControlPanels/CChokeManifoldVariables.i90 b/CSharp/Equipments/ControlPanels/CChokeManifoldVariables.i90 index 9dfe622..7966300 100644 --- a/CSharp/Equipments/ControlPanels/CChokeManifoldVariables.i90 +++ b/CSharp/Equipments/ControlPanels/CChokeManifoldVariables.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeManifoldVariables.f90" +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeManifoldVariables.f90" module CChokeManifoldVariables implicit none public diff --git a/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 b/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 index 9704a17..bd515ca 100644 --- a/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 +++ b/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 @@ -140,6 +140,8 @@ module CDataDisplayConsole call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) + !!! + call json%add(p,"StaticHookLoad",data%State%TD_String%StaticHookLoad) call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) call json%add(p,"CasingPressure",data%Equipments%DataDisplayConsole%CasingPressure) call json%add(p,"MP1SPM",data%Equipments%DataDisplayConsole%MP1SPM) diff --git a/CSharp/Equipments/ControlPanels/CDataDisplayConsole.i90 b/CSharp/Equipments/ControlPanels/CDataDisplayConsole.i90 index d4ea065..27653b2 100644 --- a/CSharp/Equipments/ControlPanels/CDataDisplayConsole.i90 +++ b/CSharp/Equipments/ControlPanels/CDataDisplayConsole.i90 @@ -17,7 +17,6 @@ module CDataDisplayConsole call json%get(p,'ResetWob',pval) call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob) - call json%get(p,'TotalStrokeCounterResetSwitch',pval) call json%get(pval,data%Equipments%DataDisplayConsole%TotalStrokeCounterResetSwitch) @@ -110,7 +109,6 @@ module CDataDisplayConsole end subroutine subroutine DataDisplayConsoleToJson(parent) - type(json_value),pointer :: parent type(json_core) :: json type(json_value),pointer :: p @@ -143,6 +141,8 @@ module CDataDisplayConsole call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) +!!! + call json%add(p,"StaticHookLoad",data%State%TD_String%StaticHookLoad) call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) call json%add(p,"CasingPressure",data%Equipments%DataDisplayConsole%CasingPressure) call json%add(p,"MP1SPM",data%Equipments%DataDisplayConsole%MP1SPM) @@ -291,9 +291,8 @@ module CDataDisplayConsole data%Equipments%DataDisplayConsole%MP1SPMGauge = v data%Equipments%DataDisplayConsole%MP1SPM = v !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) - #ifdef deb - if(print_log) print*, 'MP1SPMGauge=', data%Equipments%DataDisplayConsole%MP1SPMGauge - #endif +# 295 + end subroutine subroutine Set_MP2SPMGauge(v) @@ -302,8 +301,7 @@ module CDataDisplayConsole data%Equipments%DataDisplayConsole%MP2SPMGauge = v data%Equipments%DataDisplayConsole%MP2SPM = v !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) - #ifdef deb - if(print_log) print*, 'MP2SPMGauge=', data%Equipments%DataDisplayConsole%MP2SPMGauge - #endif +# 306 + end subroutine end module CDataDisplayConsole diff --git a/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 b/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 index 453fb0d..a88f63d 100644 --- a/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 +++ b/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 @@ -17,110 +17,104 @@ module CDrillingConsole logical::found integer :: i - call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) - if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") - call jsonfile%get('Equipments.Drilling.EmergencySwitch',data%Equipments%DrillingConsole%EmergencySwitch,found) - if ( .not. found ) call logg(4,"Not found: EmergencySwitch") - call jsonfile%get('Equipments.Drilling.RTTorqueLimitKnob',data%Equipments%DrillingConsole%RTTorqueLimitKnob,found) - if ( .not. found ) call logg(4,"Not found: RTTorqueLimitKnob") + ! call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) + ! if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") + ! call jsonfile%get('Equipments.Drilling.EmergencySwitch',data%Equipments%DrillingConsole%EmergencySwitch,found) + ! if ( .not. found ) call logg(4,"Not found: EmergencySwitch") + ! call jsonfile%get('Equipments.Drilling.RTTorqueLimitKnob',data%Equipments%DrillingConsole%RTTorqueLimitKnob,found) + ! if ( .not. found ) call logg(4,"Not found: RTTorqueLimitKnob") call jsonfile%get('Equipments.Drilling.MP1CPSwitch',data%Equipments%DrillingConsole%MP1CPSwitch,found) if ( .not. found ) call logg(4,"Not found: MP1CPSwitch") - call jsonfile%get('Equipments.Drilling.MP1ThrottleUpdate',data%Equipments%DrillingConsole%MP1ThrottleUpdate,found) - if ( .not. found ) call logg(4,"Not found: MP1ThrottleUpdate") + ! call jsonfile%get('Equipments.Drilling.MP1ThrottleUpdate',data%Equipments%DrillingConsole%MP1ThrottleUpdate,found) + ! if ( .not. found ) call logg(4,"Not found: MP1ThrottleUpdate") call jsonfile%get('Equipments.Drilling.MP1Throttle',data%Equipments%DrillingConsole%MP1Throttle,found) - if ( .not. found ) then - call logg(4,"Not found: MP1Throttle") - endif + if ( .not. found ) call logg(4,"Not found: MP1Throttle") call jsonfile%get('Equipments.Drilling.MP2Switch',data%Equipments%DrillingConsole%MP2Switch,found) if ( .not. found ) call logg(4,"Not found: MP2Switch") - call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) - if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") + ! call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) + ! if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") call jsonfile%get('Equipments.Drilling.MP2Throttle',data%Equipments%DrillingConsole%MP2Throttle,found) - if ( .not. found ) then - call logg(4,"Not found: MP2Throttle") - endif + if ( .not. found ) call logg(4,"Not found: MP2Throttle") call jsonfile%get('Equipments.Drilling.DWSwitch',data%Equipments%DrillingConsole%DWSwitch,found) if ( .not. found ) call logg(4,"Not found: DWSwitch") call jsonfile%get('Equipments.Drilling.DWThrottle',data%Equipments%DrillingConsole%DWThrottle,found) if ( .not. found ) call logg(4,"Not found: DWThrottle") - if (print_log .and. abs(data%Equipments%DrillingConsole%DWThrottle)>0) print *,"data%Equipments%DrillingConsole%DWThrottle = ",data%Equipments%DrillingConsole%DWThrottle + ! if (print_log .and. abs(data%Equipments%DrillingConsole%DWThrottle)>0) print *,"data%Equipments%DrillingConsole%DWThrottle = ",data%Equipments%DrillingConsole%DWThrottle call jsonfile%get('Equipments.Drilling.RTSwitch',data%Equipments%DrillingConsole%RTSwitch,found) if ( .not. found ) call logg(4,"Not found: RTSwitch") call jsonfile%get('Equipments.Drilling.RTThrottle',i,found) data%Equipments%DrillingConsole%RTThrottle = real(i) - if ( .not. found ) then - call logg(4,"Not found: RTThrottle") - endif - call jsonfile%get('Equipments.Drilling.DWBreak',data%Equipments%DrillingConsole%DWBreak,found) - if ( .not. found ) call logg(4,"Not found: DWBreak") - call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) - if ( .not. found ) call logg(4,"Not found: PreviousDWBreak") - call jsonfile%get('Equipments.Drilling.ForceBreak',data%Equipments%DrillingConsole%ForceBreak,found) - if ( .not. found ) call logg(4,"Not found: ForceBreak") - call jsonfile%get('Equipments.Drilling.DWAcceleretor',data%Equipments%DrillingConsole%DWAcceleretor,found) - if ( .not. found ) call logg(4,"Not found: DWAcceleretor") - call jsonfile%get('Equipments.Drilling.DWTransmisionLever',data%Equipments%DrillingConsole%DWTransmisionLever,found) - if ( .not. found ) call logg(4,"Not found: DWTransmisionLever") - call jsonfile%get('Equipments.Drilling.DWPowerLever',data%Equipments%DrillingConsole%DWPowerLever,found) - if ( .not. found ) call logg(4,"Not found: DWPowerLever") + if ( .not. found ) call logg(4,"Not found: RTThrottle") + ! call jsonfile%get('Equipments.Drilling.DWBreak',data%Equipments%DrillingConsole%DWBreak,found) + ! if ( .not. found ) call logg(4,"Not found: DWBreak") + ! call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) + ! if ( .not. found ) call logg(4,"Not found: PreviousDWBreak") + ! call jsonfile%get('Equipments.Drilling.ForceBreak',data%Equipments%DrillingConsole%ForceBreak,found) + ! if ( .not. found ) call logg(4,"Not found: ForceBreak") + ! call jsonfile%get('Equipments.Drilling.DWAcceleretor',data%Equipments%DrillingConsole%DWAcceleretor,found) + ! if ( .not. found ) call logg(4,"Not found: DWAcceleretor") + ! call jsonfile%get('Equipments.Drilling.DWTransmisionLever',data%Equipments%DrillingConsole%DWTransmisionLever,found) + ! if ( .not. found ) call logg(4,"Not found: DWTransmisionLever") + ! call jsonfile%get('Equipments.Drilling.DWPowerLever',data%Equipments%DrillingConsole%DWPowerLever,found) + ! if ( .not. found ) call logg(4,"Not found: DWPowerLever") ! call jsonfile%get('Equipments.Drilling.TongLever',data%Equipments%DrillingConsole%TongLever,found) ! if ( .not. found ) call logg(4,"Not found: TongLever") - call jsonfile%get('Equipments.Drilling.RTTransmissionLever',data%Equipments%DrillingConsole%RTTransmissionLever,found) - if ( .not. found ) call logg(4,"Not found: RTTransmissionLever") - call jsonfile%get('Equipments.Drilling.DWClutchLever',data%Equipments%DrillingConsole%DWClutchLever,found) - if ( .not. found ) call logg(4,"Not found: DWClutchLever") - call jsonfile%get('Equipments.Drilling.EddyBreakLever',data%Equipments%DrillingConsole%EddyBreakLever,found) - if ( .not. found ) call logg(4,"Not found: EddyBreakLever") - call jsonfile%get('Equipments.Drilling.AutoDW',data%Equipments%DrillingConsole%AutoDW,found) - if ( .not. found ) call logg(4,"Not found: AutoDW") - call jsonfile%get('Equipments.Drilling.GEN1',data%Equipments%DrillingConsole%GEN1,found) - if ( .not. found ) call logg(4,"Not found: GEN1") - call jsonfile%get('Equipments.Drilling.GEN2',data%Equipments%DrillingConsole%GEN2,found) - if ( .not. found ) call logg(4,"Not found: GEN2") - call jsonfile%get('Equipments.Drilling.GEN3',data%Equipments%DrillingConsole%GEN3,found) - if ( .not. found ) call logg(4,"Not found: GEN3") - call jsonfile%get('Equipments.Drilling.GEN4',data%Equipments%DrillingConsole%GEN4,found) - if ( .not. found ) call logg(4,"Not found: GEN4") - call jsonfile%get('Equipments.Drilling.Permission_OpenKellyCock',data%Equipments%DrillingConsole%Permission_OpenKellyCock,found) - if ( .not. found ) call logg(4,"Not found: Permission_OpenKellyCock") - call jsonfile%get('Equipments.Drilling.OpenKellyCock',data%Equipments%DrillingConsole%OpenKellyCock,found) - if ( .not. found ) call logg(4,"Not found: OpenKellyCock") - call jsonfile%get('Equipments.Drilling.Permission_CloseKellyCock',data%Equipments%DrillingConsole%Permission_CloseKellyCock,found) - if ( .not. found ) call logg(4,"Not found: Permission_CloseKellyCock") - call jsonfile%get('Equipments.Drilling.CloseKellyCock',data%Equipments%DrillingConsole%CloseKellyCock,found) - if ( .not. found ) call logg(4,"Not found: CloseKellyCock") - call jsonfile%get('Equipments.Drilling.Permission_OpenSafetyValve',data%Equipments%DrillingConsole%Permission_OpenSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: Permission_OpenSafetyValve") - call jsonfile%get('Equipments.Drilling.OpenSafetyValve',data%Equipments%DrillingConsole%OpenSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: OpenSafetyValve") - call jsonfile%get('Equipments.Drilling.Permission_CloseSafetyValve',data%Equipments%DrillingConsole%Permission_CloseSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: Permission_CloseSafetyValve") - call jsonfile%get('Equipments.Drilling.CloseSafetyValve',data%Equipments%DrillingConsole%CloseSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: CloseSafetyValve") - call jsonfile%get('Equipments.Drilling.Permission_IRSafetyValve',data%Equipments%DrillingConsole%Permission_IRSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: Permission_IRSafetyValve") - call jsonfile%get('Equipments.Drilling.IRSafetyValve',data%Equipments%DrillingConsole%IRSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: IRSafetyValve") - call jsonfile%get('Equipments.Drilling.Permission_IRIBop',data%Equipments%DrillingConsole%Permission_IRIBop,found) - if ( .not. found ) call logg(4,"Not found: Permission_IRIBop") - call jsonfile%get('Equipments.Drilling.IRIBop',data%Equipments%DrillingConsole%IRIBop,found) - if ( .not. found ) call logg(4,"Not found: IRIBop") - call jsonfile%get('Equipments.Drilling.LatchPipe',data%Equipments%DrillingConsole%LatchPipe,found) - if ( .not. found ) call logg(4,"Not found: LatchPipe") - call jsonfile%get('Equipments.Drilling.UnlatchPipe',data%Equipments%DrillingConsole%UnlatchPipe,found) - if ( .not. found ) call logg(4,"Not found: UnlatchPipe") - call jsonfile%get('Equipments.Drilling.Swing',data%Equipments%DrillingConsole%Swing,found) - if ( .not. found ) call logg(4,"Not found: Swing") - call jsonfile%get('Equipments.Drilling.FillMouseHole',data%Equipments%DrillingConsole%FillMouseHole,found) - if ( .not. found ) call logg(4,"Not found: FillMouseHole") - call jsonfile%get('Equipments.Drilling.Slips',data%Equipments%DrillingConsole%Slips,found) - if ( .not. found ) call logg(4,"Not found: Slips") - call jsonfile%get('Equipments.Drilling.BrakeLeverCoefficient',data%Equipments%DrillingConsole%BrakeLeverCoefficient,found) - if ( .not. found ) call logg(4,"Not found: BrakeLeverCoefficient") - call jsonfile%get('Equipments.Drilling.HideDrillingBrake',data%Equipments%DrillingConsole%HideDrillingBrake,found) - if ( .not. found ) call logg(4,"Not found: HideDrillingBrake") - call jsonfile%get('Equipments.Drilling.ParkingBrakeBtn',data%Equipments%DrillingConsole%ParkingBrakeBtn,found) - if ( .not. found ) call logg(4,"Not found: ParkingBrakeBtn") + ! call jsonfile%get('Equipments.Drilling.RTTransmissionLever',data%Equipments%DrillingConsole%RTTransmissionLever,found) + ! if ( .not. found ) call logg(4,"Not found: RTTransmissionLever") + ! call jsonfile%get('Equipments.Drilling.DWClutchLever',data%Equipments%DrillingConsole%DWClutchLever,found) + ! if ( .not. found ) call logg(4,"Not found: DWClutchLever") + ! call jsonfile%get('Equipments.Drilling.EddyBreakLever',data%Equipments%DrillingConsole%EddyBreakLever,found) + ! if ( .not. found ) call logg(4,"Not found: EddyBreakLever") + ! call jsonfile%get('Equipments.Drilling.AutoDW',data%Equipments%DrillingConsole%AutoDW,found) + ! if ( .not. found ) call logg(4,"Not found: AutoDW") + ! call jsonfile%get('Equipments.Drilling.GEN1',data%Equipments%DrillingConsole%GEN1,found) + ! if ( .not. found ) call logg(4,"Not found: GEN1") + ! call jsonfile%get('Equipments.Drilling.GEN2',data%Equipments%DrillingConsole%GEN2,found) + ! if ( .not. found ) call logg(4,"Not found: GEN2") + ! call jsonfile%get('Equipments.Drilling.GEN3',data%Equipments%DrillingConsole%GEN3,found) + ! if ( .not. found ) call logg(4,"Not found: GEN3") + ! call jsonfile%get('Equipments.Drilling.GEN4',data%Equipments%DrillingConsole%GEN4,found) + ! if ( .not. found ) call logg(4,"Not found: GEN4") + ! call jsonfile%get('Equipments.Drilling.Permission_OpenKellyCock',data%Equipments%DrillingConsole%Permission_OpenKellyCock,found) + ! if ( .not. found ) call logg(4,"Not found: Permission_OpenKellyCock") + ! call jsonfile%get('Equipments.Drilling.OpenKellyCock',data%Equipments%DrillingConsole%OpenKellyCock,found) + ! if ( .not. found ) call logg(4,"Not found: OpenKellyCock") + ! call jsonfile%get('Equipments.Drilling.Permission_CloseKellyCock',data%Equipments%DrillingConsole%Permission_CloseKellyCock,found) + ! if ( .not. found ) call logg(4,"Not found: Permission_CloseKellyCock") + ! call jsonfile%get('Equipments.Drilling.CloseKellyCock',data%Equipments%DrillingConsole%CloseKellyCock,found) + ! if ( .not. found ) call logg(4,"Not found: CloseKellyCock") + ! call jsonfile%get('Equipments.Drilling.Permission_OpenSafetyValve',data%Equipments%DrillingConsole%Permission_OpenSafetyValve,found) + ! if ( .not. found ) call logg(4,"Not found: Permission_OpenSafetyValve") + ! call jsonfile%get('Equipments.Drilling.OpenSafetyValve',data%Equipments%DrillingConsole%OpenSafetyValve,found) + ! if ( .not. found ) call logg(4,"Not found: OpenSafetyValve") + ! call jsonfile%get('Equipments.Drilling.Permission_CloseSafetyValve',data%Equipments%DrillingConsole%Permission_CloseSafetyValve,found) + ! if ( .not. found ) call logg(4,"Not found: Permission_CloseSafetyValve") + ! call jsonfile%get('Equipments.Drilling.CloseSafetyValve',data%Equipments%DrillingConsole%CloseSafetyValve,found) + ! if ( .not. found ) call logg(4,"Not found: CloseSafetyValve") + ! call jsonfile%get('Equipments.Drilling.Permission_IRSafetyValve',data%Equipments%DrillingConsole%Permission_IRSafetyValve,found) + ! if ( .not. found ) call logg(4,"Not found: Permission_IRSafetyValve") + ! call jsonfile%get('Equipments.Drilling.IRSafetyValve',data%Equipments%DrillingConsole%IRSafetyValve,found) + ! if ( .not. found ) call logg(4,"Not found: IRSafetyValve") + ! call jsonfile%get('Equipments.Drilling.Permission_IRIBop',data%Equipments%DrillingConsole%Permission_IRIBop,found) + ! if ( .not. found ) call logg(4,"Not found: Permission_IRIBop") + ! call jsonfile%get('Equipments.Drilling.IRIBop',data%Equipments%DrillingConsole%IRIBop,found) + ! if ( .not. found ) call logg(4,"Not found: IRIBop") + ! call jsonfile%get('Equipments.Drilling.LatchPipe',data%Equipments%DrillingConsole%LatchPipe,found) + ! if ( .not. found ) call logg(4,"Not found: LatchPipe") + ! call jsonfile%get('Equipments.Drilling.UnlatchPipe',data%Equipments%DrillingConsole%UnlatchPipe,found) + ! if ( .not. found ) call logg(4,"Not found: UnlatchPipe") + ! call jsonfile%get('Equipments.Drilling.Swing',data%Equipments%DrillingConsole%Swing,found) + ! if ( .not. found ) call logg(4,"Not found: Swing") + ! call jsonfile%get('Equipments.Drilling.FillMouseHole',data%Equipments%DrillingConsole%FillMouseHole,found) + ! if ( .not. found ) call logg(4,"Not found: FillMouseHole") + ! call jsonfile%get('Equipments.Drilling.Slips',data%Equipments%DrillingConsole%Slips,found) + ! if ( .not. found ) call logg(4,"Not found: Slips") + ! call jsonfile%get('Equipments.Drilling.BrakeLeverCoefficient',data%Equipments%DrillingConsole%BrakeLeverCoefficient,found) + ! if ( .not. found ) call logg(4,"Not found: BrakeLeverCoefficient") + ! call jsonfile%get('Equipments.Drilling.HideDrillingBrake',data%Equipments%DrillingConsole%HideDrillingBrake,found) + ! if ( .not. found ) call logg(4,"Not found: HideDrillingBrake") + ! call jsonfile%get('Equipments.Drilling.ParkingBrakeBtn',data%Equipments%DrillingConsole%ParkingBrakeBtn,found) + ! if ( .not. found ) call logg(4,"Not found: ParkingBrakeBtn") ! call jsonfile%destroy() diff --git a/CSharp/Equipments/ControlPanels/CDrillingConsole.i90 b/CSharp/Equipments/ControlPanels/CDrillingConsole.i90 index a433070..a424f80 100644 --- a/CSharp/Equipments/ControlPanels/CDrillingConsole.i90 +++ b/CSharp/Equipments/ControlPanels/CDrillingConsole.i90 @@ -2,7 +2,6 @@ module CDrillingConsole use CDrillingConsoleVariables use SimulationVariables - use SimulationVariables ! use CSimulationVariables use CLog4 use CLog3 @@ -19,109 +18,104 @@ module CDrillingConsole logical::found integer :: i - call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) - if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") - call jsonfile%get('Equipments.Drilling.EmergencySwitch',data%Equipments%DrillingConsole%EmergencySwitch,found) - if ( .not. found ) call logg(4,"Not found: EmergencySwitch") - call jsonfile%get('Equipments.Drilling.RTTorqueLimitKnob',data%Equipments%DrillingConsole%RTTorqueLimitKnob,found) - if ( .not. found ) call logg(4,"Not found: RTTorqueLimitKnob") +! call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) +! if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") +! call jsonfile%get('Equipments.Drilling.EmergencySwitch',data%Equipments%DrillingConsole%EmergencySwitch,found) +! if ( .not. found ) call logg(4,"Not found: EmergencySwitch") +! call jsonfile%get('Equipments.Drilling.RTTorqueLimitKnob',data%Equipments%DrillingConsole%RTTorqueLimitKnob,found) +! if ( .not. found ) call logg(4,"Not found: RTTorqueLimitKnob") call jsonfile%get('Equipments.Drilling.MP1CPSwitch',data%Equipments%DrillingConsole%MP1CPSwitch,found) if ( .not. found ) call logg(4,"Not found: MP1CPSwitch") - call jsonfile%get('Equipments.Drilling.MP1ThrottleUpdate',data%Equipments%DrillingConsole%MP1ThrottleUpdate,found) - if ( .not. found ) call logg(4,"Not found: MP1ThrottleUpdate") +! call jsonfile%get('Equipments.Drilling.MP1ThrottleUpdate',data%Equipments%DrillingConsole%MP1ThrottleUpdate,found) +! if ( .not. found ) call logg(4,"Not found: MP1ThrottleUpdate") call jsonfile%get('Equipments.Drilling.MP1Throttle',data%Equipments%DrillingConsole%MP1Throttle,found) - if ( .not. found ) then - call logg(4,"Not found: MP1Throttle") - endif + if ( .not. found ) call logg(4,"Not found: MP1Throttle") call jsonfile%get('Equipments.Drilling.MP2Switch',data%Equipments%DrillingConsole%MP2Switch,found) if ( .not. found ) call logg(4,"Not found: MP2Switch") - call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) - if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") +! call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) +! if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") call jsonfile%get('Equipments.Drilling.MP2Throttle',data%Equipments%DrillingConsole%MP2Throttle,found) - if ( .not. found ) then - call logg(4,"Not found: MP2Throttle") - endif + if ( .not. found ) call logg(4,"Not found: MP2Throttle") call jsonfile%get('Equipments.Drilling.DWSwitch',data%Equipments%DrillingConsole%DWSwitch,found) if ( .not. found ) call logg(4,"Not found: DWSwitch") call jsonfile%get('Equipments.Drilling.DWThrottle',data%Equipments%DrillingConsole%DWThrottle,found) if ( .not. found ) call logg(4,"Not found: DWThrottle") +! if (print_log .and. abs(data%Equipments%DrillingConsole%DWThrottle)>0) print *,"data%Equipments%DrillingConsole%DWThrottle = ",data%Equipments%DrillingConsole%DWThrottle call jsonfile%get('Equipments.Drilling.RTSwitch',data%Equipments%DrillingConsole%RTSwitch,found) if ( .not. found ) call logg(4,"Not found: RTSwitch") call jsonfile%get('Equipments.Drilling.RTThrottle',i,found) data%Equipments%DrillingConsole%RTThrottle = real(i) - if ( .not. found ) then - call logg(4,"Not found: RTThrottle") - endif - call jsonfile%get('Equipments.Drilling.DWBreak',data%Equipments%DrillingConsole%DWBreak,found) - if ( .not. found ) call logg(4,"Not found: DWBreak") - call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) - if ( .not. found ) call logg(4,"Not found: PreviousDWBreak") - call jsonfile%get('Equipments.Drilling.ForceBreak',data%Equipments%DrillingConsole%ForceBreak,found) - if ( .not. found ) call logg(4,"Not found: ForceBreak") - call jsonfile%get('Equipments.Drilling.DWAcceleretor',data%Equipments%DrillingConsole%DWAcceleretor,found) - if ( .not. found ) call logg(4,"Not found: DWAcceleretor") - call jsonfile%get('Equipments.Drilling.DWTransmisionLever',data%Equipments%DrillingConsole%DWTransmisionLever,found) - if ( .not. found ) call logg(4,"Not found: DWTransmisionLever") - call jsonfile%get('Equipments.Drilling.DWPowerLever',data%Equipments%DrillingConsole%DWPowerLever,found) - if ( .not. found ) call logg(4,"Not found: DWPowerLever") - call jsonfile%get('Equipments.Drilling.TongLever',data%Equipments%DrillingConsole%TongLever,found) - if ( .not. found ) call logg(4,"Not found: TongLever") - call jsonfile%get('Equipments.Drilling.RTTransmissionLever',data%Equipments%DrillingConsole%RTTransmissionLever,found) - if ( .not. found ) call logg(4,"Not found: RTTransmissionLever") - call jsonfile%get('Equipments.Drilling.DWClutchLever',data%Equipments%DrillingConsole%DWClutchLever,found) - if ( .not. found ) call logg(4,"Not found: DWClutchLever") - call jsonfile%get('Equipments.Drilling.EddyBreakLever',data%Equipments%DrillingConsole%EddyBreakLever,found) - if ( .not. found ) call logg(4,"Not found: EddyBreakLever") - call jsonfile%get('Equipments.Drilling.AutoDW',data%Equipments%DrillingConsole%AutoDW,found) - if ( .not. found ) call logg(4,"Not found: AutoDW") - call jsonfile%get('Equipments.Drilling.GEN1',data%Equipments%DrillingConsole%GEN1,found) - if ( .not. found ) call logg(4,"Not found: GEN1") - call jsonfile%get('Equipments.Drilling.GEN2',data%Equipments%DrillingConsole%GEN2,found) - if ( .not. found ) call logg(4,"Not found: GEN2") - call jsonfile%get('Equipments.Drilling.GEN3',data%Equipments%DrillingConsole%GEN3,found) - if ( .not. found ) call logg(4,"Not found: GEN3") - call jsonfile%get('Equipments.Drilling.GEN4',data%Equipments%DrillingConsole%GEN4,found) - if ( .not. found ) call logg(4,"Not found: GEN4") - call jsonfile%get('Equipments.Drilling.Permission_OpenKellyCock',data%Equipments%DrillingConsole%Permission_OpenKellyCock,found) - if ( .not. found ) call logg(4,"Not found: Permission_OpenKellyCock") - call jsonfile%get('Equipments.Drilling.OpenKellyCock',data%Equipments%DrillingConsole%OpenKellyCock,found) - if ( .not. found ) call logg(4,"Not found: OpenKellyCock") - call jsonfile%get('Equipments.Drilling.Permission_CloseKellyCock',data%Equipments%DrillingConsole%Permission_CloseKellyCock,found) - if ( .not. found ) call logg(4,"Not found: Permission_CloseKellyCock") - call jsonfile%get('Equipments.Drilling.CloseKellyCock',data%Equipments%DrillingConsole%CloseKellyCock,found) - if ( .not. found ) call logg(4,"Not found: CloseKellyCock") - call jsonfile%get('Equipments.Drilling.Permission_OpenSafetyValve',data%Equipments%DrillingConsole%Permission_OpenSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: Permission_OpenSafetyValve") - call jsonfile%get('Equipments.Drilling.OpenSafetyValve',data%Equipments%DrillingConsole%OpenSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: OpenSafetyValve") - call jsonfile%get('Equipments.Drilling.Permission_CloseSafetyValve',data%Equipments%DrillingConsole%Permission_CloseSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: Permission_CloseSafetyValve") - call jsonfile%get('Equipments.Drilling.CloseSafetyValve',data%Equipments%DrillingConsole%CloseSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: CloseSafetyValve") - call jsonfile%get('Equipments.Drilling.Permission_IRSafetyValve',data%Equipments%DrillingConsole%Permission_IRSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: Permission_IRSafetyValve") - call jsonfile%get('Equipments.Drilling.IRSafetyValve',data%Equipments%DrillingConsole%IRSafetyValve,found) - if ( .not. found ) call logg(4,"Not found: IRSafetyValve") - call jsonfile%get('Equipments.Drilling.Permission_IRIBop',data%Equipments%DrillingConsole%Permission_IRIBop,found) - if ( .not. found ) call logg(4,"Not found: Permission_IRIBop") - call jsonfile%get('Equipments.Drilling.IRIBop',data%Equipments%DrillingConsole%IRIBop,found) - if ( .not. found ) call logg(4,"Not found: IRIBop") - call jsonfile%get('Equipments.Drilling.LatchPipe',data%Equipments%DrillingConsole%LatchPipe,found) - if ( .not. found ) call logg(4,"Not found: LatchPipe") - call jsonfile%get('Equipments.Drilling.UnlatchPipe',data%Equipments%DrillingConsole%UnlatchPipe,found) - if ( .not. found ) call logg(4,"Not found: UnlatchPipe") - call jsonfile%get('Equipments.Drilling.Swing',data%Equipments%DrillingConsole%Swing,found) - if ( .not. found ) call logg(4,"Not found: Swing") - call jsonfile%get('Equipments.Drilling.FillMouseHole',data%Equipments%DrillingConsole%FillMouseHole,found) - if ( .not. found ) call logg(4,"Not found: FillMouseHole") - call jsonfile%get('Equipments.Drilling.Slips',data%Equipments%DrillingConsole%Slips,found) - if ( .not. found ) call logg(4,"Not found: Slips") - call jsonfile%get('Equipments.Drilling.BrakeLeverCoefficient',data%Equipments%DrillingConsole%BrakeLeverCoefficient,found) - if ( .not. found ) call logg(4,"Not found: BrakeLeverCoefficient") - call jsonfile%get('Equipments.Drilling.HideDrillingBrake',data%Equipments%DrillingConsole%HideDrillingBrake,found) - if ( .not. found ) call logg(4,"Not found: HideDrillingBrake") - call jsonfile%get('Equipments.Drilling.ParkingBrakeBtn',data%Equipments%DrillingConsole%ParkingBrakeBtn,found) - if ( .not. found ) call logg(4,"Not found: ParkingBrakeBtn") + if ( .not. found ) call logg(4,"Not found: RTThrottle") +! call jsonfile%get('Equipments.Drilling.DWBreak',data%Equipments%DrillingConsole%DWBreak,found) +! if ( .not. found ) call logg(4,"Not found: DWBreak") +! call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) +! if ( .not. found ) call logg(4,"Not found: PreviousDWBreak") +! call jsonfile%get('Equipments.Drilling.ForceBreak',data%Equipments%DrillingConsole%ForceBreak,found) +! if ( .not. found ) call logg(4,"Not found: ForceBreak") +! call jsonfile%get('Equipments.Drilling.DWAcceleretor',data%Equipments%DrillingConsole%DWAcceleretor,found) +! if ( .not. found ) call logg(4,"Not found: DWAcceleretor") +! call jsonfile%get('Equipments.Drilling.DWTransmisionLever',data%Equipments%DrillingConsole%DWTransmisionLever,found) +! if ( .not. found ) call logg(4,"Not found: DWTransmisionLever") +! call jsonfile%get('Equipments.Drilling.DWPowerLever',data%Equipments%DrillingConsole%DWPowerLever,found) +! if ( .not. found ) call logg(4,"Not found: DWPowerLever") +! call jsonfile%get('Equipments.Drilling.TongLever',data%Equipments%DrillingConsole%TongLever,found) +! if ( .not. found ) call logg(4,"Not found: TongLever") +! call jsonfile%get('Equipments.Drilling.RTTransmissionLever',data%Equipments%DrillingConsole%RTTransmissionLever,found) +! if ( .not. found ) call logg(4,"Not found: RTTransmissionLever") +! call jsonfile%get('Equipments.Drilling.DWClutchLever',data%Equipments%DrillingConsole%DWClutchLever,found) +! if ( .not. found ) call logg(4,"Not found: DWClutchLever") +! call jsonfile%get('Equipments.Drilling.EddyBreakLever',data%Equipments%DrillingConsole%EddyBreakLever,found) +! if ( .not. found ) call logg(4,"Not found: EddyBreakLever") +! call jsonfile%get('Equipments.Drilling.AutoDW',data%Equipments%DrillingConsole%AutoDW,found) +! if ( .not. found ) call logg(4,"Not found: AutoDW") +! call jsonfile%get('Equipments.Drilling.GEN1',data%Equipments%DrillingConsole%GEN1,found) +! if ( .not. found ) call logg(4,"Not found: GEN1") +! call jsonfile%get('Equipments.Drilling.GEN2',data%Equipments%DrillingConsole%GEN2,found) +! if ( .not. found ) call logg(4,"Not found: GEN2") +! call jsonfile%get('Equipments.Drilling.GEN3',data%Equipments%DrillingConsole%GEN3,found) +! if ( .not. found ) call logg(4,"Not found: GEN3") +! call jsonfile%get('Equipments.Drilling.GEN4',data%Equipments%DrillingConsole%GEN4,found) +! if ( .not. found ) call logg(4,"Not found: GEN4") +! call jsonfile%get('Equipments.Drilling.Permission_OpenKellyCock',data%Equipments%DrillingConsole%Permission_OpenKellyCock,found) +! if ( .not. found ) call logg(4,"Not found: Permission_OpenKellyCock") +! call jsonfile%get('Equipments.Drilling.OpenKellyCock',data%Equipments%DrillingConsole%OpenKellyCock,found) +! if ( .not. found ) call logg(4,"Not found: OpenKellyCock") +! call jsonfile%get('Equipments.Drilling.Permission_CloseKellyCock',data%Equipments%DrillingConsole%Permission_CloseKellyCock,found) +! if ( .not. found ) call logg(4,"Not found: Permission_CloseKellyCock") +! call jsonfile%get('Equipments.Drilling.CloseKellyCock',data%Equipments%DrillingConsole%CloseKellyCock,found) +! if ( .not. found ) call logg(4,"Not found: CloseKellyCock") +! call jsonfile%get('Equipments.Drilling.Permission_OpenSafetyValve',data%Equipments%DrillingConsole%Permission_OpenSafetyValve,found) +! if ( .not. found ) call logg(4,"Not found: Permission_OpenSafetyValve") +! call jsonfile%get('Equipments.Drilling.OpenSafetyValve',data%Equipments%DrillingConsole%OpenSafetyValve,found) +! if ( .not. found ) call logg(4,"Not found: OpenSafetyValve") +! call jsonfile%get('Equipments.Drilling.Permission_CloseSafetyValve',data%Equipments%DrillingConsole%Permission_CloseSafetyValve,found) +! if ( .not. found ) call logg(4,"Not found: Permission_CloseSafetyValve") +! call jsonfile%get('Equipments.Drilling.CloseSafetyValve',data%Equipments%DrillingConsole%CloseSafetyValve,found) +! if ( .not. found ) call logg(4,"Not found: CloseSafetyValve") +! call jsonfile%get('Equipments.Drilling.Permission_IRSafetyValve',data%Equipments%DrillingConsole%Permission_IRSafetyValve,found) +! if ( .not. found ) call logg(4,"Not found: Permission_IRSafetyValve") +! call jsonfile%get('Equipments.Drilling.IRSafetyValve',data%Equipments%DrillingConsole%IRSafetyValve,found) +! if ( .not. found ) call logg(4,"Not found: IRSafetyValve") +! call jsonfile%get('Equipments.Drilling.Permission_IRIBop',data%Equipments%DrillingConsole%Permission_IRIBop,found) +! if ( .not. found ) call logg(4,"Not found: Permission_IRIBop") +! call jsonfile%get('Equipments.Drilling.IRIBop',data%Equipments%DrillingConsole%IRIBop,found) +! if ( .not. found ) call logg(4,"Not found: IRIBop") +! call jsonfile%get('Equipments.Drilling.LatchPipe',data%Equipments%DrillingConsole%LatchPipe,found) +! if ( .not. found ) call logg(4,"Not found: LatchPipe") +! call jsonfile%get('Equipments.Drilling.UnlatchPipe',data%Equipments%DrillingConsole%UnlatchPipe,found) +! if ( .not. found ) call logg(4,"Not found: UnlatchPipe") +! call jsonfile%get('Equipments.Drilling.Swing',data%Equipments%DrillingConsole%Swing,found) +! if ( .not. found ) call logg(4,"Not found: Swing") +! call jsonfile%get('Equipments.Drilling.FillMouseHole',data%Equipments%DrillingConsole%FillMouseHole,found) +! if ( .not. found ) call logg(4,"Not found: FillMouseHole") +! call jsonfile%get('Equipments.Drilling.Slips',data%Equipments%DrillingConsole%Slips,found) +! if ( .not. found ) call logg(4,"Not found: Slips") +! call jsonfile%get('Equipments.Drilling.BrakeLeverCoefficient',data%Equipments%DrillingConsole%BrakeLeverCoefficient,found) +! if ( .not. found ) call logg(4,"Not found: BrakeLeverCoefficient") +! call jsonfile%get('Equipments.Drilling.HideDrillingBrake',data%Equipments%DrillingConsole%HideDrillingBrake,found) +! if ( .not. found ) call logg(4,"Not found: HideDrillingBrake") +! call jsonfile%get('Equipments.Drilling.ParkingBrakeBtn',data%Equipments%DrillingConsole%ParkingBrakeBtn,found) +! if ( .not. found ) call logg(4,"Not found: ParkingBrakeBtn") ! call jsonfile%destroy() @@ -184,8 +178,21 @@ module CDrillingConsole call json%add(p,"MP2Throttle",data%Equipments%DrillingConsole%MP2Throttle) call json%add(p,"RTThrottle",data%Equipments%DrillingConsole%RTThrottle) call json%add(p,"DWThrottle",data%Equipments%DrillingConsole%DWThrottle) - call json%add(parent,p) end subroutine - + + subroutine SetTongLever(v) bind(C,name="setTongLever") + use CTongEnum + use ISO_C_BINDING, only:c_int + integer(c_int), intent(in) :: v + if(v == 1) then + call ButtonPress_Breakout_TongNotification() + if(print_log) print*, 'BreakoutLeverPress' + endif + if(v == -1) then + call ButtonPress_Makeup_TongNotification() + if(print_log) print*, 'MakeupLeverPress' + endif + if(print_log) print*, 'TongLever=', v + end subroutine end module CDrillingConsole diff --git a/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.f90 b/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.f90 index aee4f96..5702061 100644 --- a/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.f90 +++ b/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.f90 @@ -6,7 +6,7 @@ module CDrillingConsoleVariables TYPE, PUBLIC :: DrillingConsoleType ! Input vars - integer :: AssignmentSwitch + integer :: AssignmentSwitch = 1 logical :: EmergencySwitch real(8) :: RTTorqueLimitKnob ! integer :: MP1CPSwitchI = 0 !for not turning on pump1 on simulation start diff --git a/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.i90 b/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.i90 index a732f40..8fc1ad2 100644 --- a/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.i90 +++ b/CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.i90 @@ -7,7 +7,7 @@ module CDrillingConsoleVariables TYPE, PUBLIC :: DrillingConsoleType ! Input vars - integer :: AssignmentSwitch + integer :: AssignmentSwitch = 1 logical :: EmergencySwitch real(8) :: RTTorqueLimitKnob ! integer :: MP1CPSwitchI = 0 !for not turning on pump1 on simulation start @@ -30,7 +30,7 @@ module CDrillingConsoleVariables real(8) :: DWAcceleretor real(8) :: DWTransmisionLever real(8) :: DWPowerLever - real(8) :: TongLever +! real(8) :: TongLever real(8) :: RTTransmissionLever real(8) :: DWClutchLever real(8) :: EddyBreakLever diff --git a/CSharp/Equipments/ControlPanels/CHook.i90 b/CSharp/Equipments/ControlPanels/CHook.i90 index ef8dc0c..4ae2e6a 100644 --- a/CSharp/Equipments/ControlPanels/CHook.i90 +++ b/CSharp/Equipments/ControlPanels/CHook.i90 @@ -6,34 +6,24 @@ module CHook public contains - subroutine HookFromJson(parent) - type(json_value),pointer :: parent - type(json_core) :: json - type(json_value),pointer :: p,pval +! subroutine HookFromJson(jsonfile) +! type(json_file)::jsonfile +! logical::found -! 1. get related root -! call json%get(parent,'Hook',p) - -! ! 2. get member of data type from node -! call json%get(p,'HookHeight_S',pval) -! call json%get(pval,data%Equipments%Hook%HookHeight_S) -! call json%get(p,'HookHeight',pval) -! call json%get(pval,data%Equipments%Hook%HookHeight) - end subroutine - - subroutine HookToJson(parent) +! call jsonfile%get('Equipments.HookHeight',data%State%Drawworks%Hook_Height_final,found) +! if ( .not. found ) call logg(4,"Not found: Equipments.Hook.HookHeight") +! end subroutine - type(json_value),pointer :: parent - type(json_core) :: json - type(json_value),pointer :: p +! subroutine HookToJson(parent) +! type(json_value),pointer :: parent +! type(json_core) :: json +! type(json_value),pointer :: p -! 1. create new node - call json%create_object(p,'Hook') - call json%add(p,"HookHeight_S",data%Equipments%Hook%HookHeight_S) - call json%add(p,"HookHeight",data%Equipments%Hook%HookHeight) - - call json%add(parent,p) - end subroutine +! ! 1. create new node +! call json%create_object(p,'Hook') +! call json%add(p,"Velocity",data%State%Drawworks%HookLinearVelocity_final) +! call json%add(parent,p) +! end subroutine subroutine Set_HookHeight(v) use CDrillingConsoleVariables diff --git a/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.i90 b/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.i90 index 796fe1c..5bc237a 100644 --- a/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.i90 +++ b/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.f90" +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.f90" module CTopDrivePanelVariables implicit none public diff --git a/CSharp/Equipments/DrillWatch/DrillWatch.f90 b/CSharp/Equipments/DrillWatch/DrillWatch.f90 index d60b7c7..c0a3d12 100644 --- a/CSharp/Equipments/DrillWatch/DrillWatch.f90 +++ b/CSharp/Equipments/DrillWatch/DrillWatch.f90 @@ -2,56 +2,6 @@ module DrillingWatchModule use SimulationVariables contains - ! subroutine DrillingWatchFromJson(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,'DrillingWatch',p) - - ! ! 2. get member of data type from node - ! call json%get(p,'Depth',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%Depth) - ! call json%get(p,'BitPosition',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%BitPosition) - ! call json%get(p,'HookLoad',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%HookLoad) - ! call json%get(p,'WeightOnBit',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%WeightOnBit) - ! call json%get(p,'RPM',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%RPM) - ! call json%get(p,'ROP',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%ROP) - ! call json%get(p,'Torque',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%Torque) - ! call json%get(p,'PumpPressure',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%PumpPressure) - ! call json%get(p,'SPM1',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%SPM1) - ! call json%get(p,'SPM2',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%SPM2) - ! call json%get(p,'CasingPressure',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%CasingPressure) - ! call json%get(p,'PercentFlow',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%PercentFlow) - ! call json%get(p,'PitGainLose',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%PitGainLose) - ! call json%get(p,'PitVolume',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%PitVolume) - ! call json%get(p,'KillMudVolume',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%KillMudVolume) - ! call json%get(p,'TripTankVolume',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%TripTankVolume) - ! call json%get(p,'MudWeightIn',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%MudWeightIn) - ! call json%get(p,'FillVolume',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%FillVolume) - ! call json%get(p,'MudWeightOut',pval) - ! call json%get(pval,data%Equipments%DrillingWatch%MudWeightOut) - ! end subroutine - subroutine DrillingWatchToJson(parent) type(json_value),pointer :: parent type(json_core) :: json diff --git a/CSharp/Equipments/DrillWatch/DrillWatch.i90 b/CSharp/Equipments/DrillWatch/DrillWatch.i90 index 2d2947e..3aa088b 100644 --- a/CSharp/Equipments/DrillWatch/DrillWatch.i90 +++ b/CSharp/Equipments/DrillWatch/DrillWatch.i90 @@ -3,56 +3,6 @@ module DrillingWatchModule use SimulationVariables contains -! subroutine DrillingWatchFromJson(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,'DrillingWatch',p) - -! ! 2. get member of data type from node -! call json%get(p,'Depth',pval) -! call json%get(pval,data%Equipments%DrillingWatch%Depth) -! call json%get(p,'BitPosition',pval) -! call json%get(pval,data%Equipments%DrillingWatch%BitPosition) -! call json%get(p,'HookLoad',pval) -! call json%get(pval,data%Equipments%DrillingWatch%HookLoad) -! call json%get(p,'WeightOnBit',pval) -! call json%get(pval,data%Equipments%DrillingWatch%WeightOnBit) -! call json%get(p,'RPM',pval) -! call json%get(pval,data%Equipments%DrillingWatch%RPM) -! call json%get(p,'ROP',pval) -! call json%get(pval,data%Equipments%DrillingWatch%ROP) -! call json%get(p,'Torque',pval) -! call json%get(pval,data%Equipments%DrillingWatch%Torque) -! call json%get(p,'PumpPressure',pval) -! call json%get(pval,data%Equipments%DrillingWatch%PumpPressure) -! call json%get(p,'SPM1',pval) -! call json%get(pval,data%Equipments%DrillingWatch%SPM1) -! call json%get(p,'SPM2',pval) -! call json%get(pval,data%Equipments%DrillingWatch%SPM2) -! call json%get(p,'CasingPressure',pval) -! call json%get(pval,data%Equipments%DrillingWatch%CasingPressure) -! call json%get(p,'PercentFlow',pval) -! call json%get(pval,data%Equipments%DrillingWatch%PercentFlow) -! call json%get(p,'PitGainLose',pval) -! call json%get(pval,data%Equipments%DrillingWatch%PitGainLose) -! call json%get(p,'PitVolume',pval) -! call json%get(pval,data%Equipments%DrillingWatch%PitVolume) -! call json%get(p,'KillMudVolume',pval) -! call json%get(pval,data%Equipments%DrillingWatch%KillMudVolume) -! call json%get(p,'TripTankVolume',pval) -! call json%get(pval,data%Equipments%DrillingWatch%TripTankVolume) -! call json%get(p,'MudWeightIn',pval) -! call json%get(pval,data%Equipments%DrillingWatch%MudWeightIn) -! call json%get(p,'FillVolume',pval) -! call json%get(pval,data%Equipments%DrillingWatch%FillVolume) -! call json%get(p,'MudWeightOut',pval) -! call json%get(pval,data%Equipments%DrillingWatch%MudWeightOut) -! end subroutine - subroutine DrillingWatchToJson(parent) type(json_value),pointer :: parent type(json_core) :: json diff --git a/CSharp/Equipments/MudPathFinding/CArrangement.i90 b/CSharp/Equipments/MudPathFinding/CArrangement.i90 new file mode 100644 index 0000000..add728b --- /dev/null +++ b/CSharp/Equipments/MudPathFinding/CArrangement.i90 @@ -0,0 +1,138 @@ +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/MudPathFinding/CArrangement.f90" +module CArrangement + implicit none + public + + integer, parameter :: Normal = 0 + integer, parameter :: Relation = 1 + integer, parameter :: Input = 2 + integer, parameter :: Output = 3 + integer, parameter :: InputOutput = 4 + + + type, public :: Arrangement + integer, allocatable :: Adjacent(:) !adjacent valves that is connected to this valve + logical :: Status !valve status ... open/close ... true/false + integer :: ValveType ! Normal/Input/Output/InputOutput + integer :: Number + logical :: IsTraversed + contains + procedure :: Init => Init + procedure :: IsConnectedTo => IsConnectedTo + procedure :: IsSource => IsSource + procedure :: Length => Length + procedure :: AdjacentTo => AdjacentTo + procedure :: RemoveAdjacent => RemoveAdjacent + end type Arrangement + contains + + subroutine Init(this, value) + implicit none + class(Arrangement), intent(inout) :: this + integer, intent(in) :: value + if(allocated(this%Adjacent)) deallocate(this%Adjacent) + this%Status = .false. + this%IsTraversed = .false. + this%ValveType = Normal + this%Number = value + end subroutine + + integer function Length(this) + implicit none + class(Arrangement), intent(in) :: this + if(allocated(this%Adjacent)) then + Length = size(this%Adjacent) + return + end if + Length = 0 + end function + + subroutine AdjacentTo(this, value) + implicit none + class(Arrangement), intent(inout) :: this + integer, intent(in) :: value + integer, allocatable :: tempArr(:) + integer :: i, isize + + if(allocated(this%Adjacent)) then + isize = size(this%Adjacent) + +! check to see if already AdjacentTo that valve# + do i=1,isize + if(this%Adjacent(i)==value) return + end do + +! if value is a new entry then add it to the collection + allocate(tempArr(isize+1)) + do i=1,isize + tempArr(i) = this%Adjacent(i) + end do + tempArr(isize+1) = value + deallocate(this%Adjacent) + call move_alloc(tempArr, this%Adjacent) + else + allocate(this%Adjacent(1)) + this%Adjacent(1) = value + end if + end subroutine + + logical function IsConnectedTo(this, value) + implicit none + class(Arrangement), intent(in) :: this + integer, intent(in) :: value + if(.not.allocated(this%Adjacent)) then + IsConnectedTo = .false. + return + endif + IsConnectedTo = any(this%Adjacent == value) + return + end function + + logical function IsSource(this) + implicit none + class(Arrangement), intent(in) :: this + IsSource = this%ValveType > Relation + end function + + + + subroutine RemoveAdjacent(this, value) + implicit none + class(Arrangement), intent(inout) :: this + integer, intent(in) :: value + integer, allocatable :: tempArr(:) + integer :: i, index, isize + logical :: found + + if(.not.allocated(this%Adjacent))return + index = -1 + do i=1, size(this%Adjacent) + if(this%Adjacent(i)==value) then + index = i + exit + end if + end do + + if(index <= 0 .or. index > size(this%Adjacent)) return + + allocate(tempArr(size(this%Adjacent)-1)) + found = .false. + do i=1, size(this%Adjacent) + if(i==index) then + found = .true. + cycle + end if + if(found) then + tempArr(i-1) = this%Adjacent(i) + else + tempArr(i) = this%Adjacent(i) + endif + end do + deallocate(this%Adjacent) + call move_alloc(tempArr, this%Adjacent) + + + end subroutine + + +end module CArrangement diff --git a/CSharp/Equipments/MudPathFinding/CManifolds.f90 b/CSharp/Equipments/MudPathFinding/CManifolds.f90 index 4929dfb..96f986c 100644 --- a/CSharp/Equipments/MudPathFinding/CManifolds.f90 +++ b/CSharp/Equipments/MudPathFinding/CManifolds.f90 @@ -26,7 +26,6 @@ module CManifolds end subroutine subroutine PathFinding_Setup() - ! use CSimulationVariables implicit none data%state%manifold%IsTraverse = .false. call Setup() @@ -48,7 +47,7 @@ module CManifolds data%state%manifold%IsPathsDirty = .false. call Traverse() endif -end subroutine PathFinding_Step + end subroutine PathFinding_Step ! subroutine PathFinding_Output ! implicit none @@ -70,37 +69,21 @@ end subroutine PathFinding_Step subroutine Traverse() bind(C,name="Traverse") use CLog5 implicit none - integer :: i, Duration - integer, dimension(8) :: StartTime,EndTime !TODO: clean up - call DATE_AND_TIME(values=StartTime) !TODO: clean up - + integer :: i !**call BeforeTraverse%RunAll() - if(allocated(data%state%manifold%OpenPaths)) deallocate(data%state%manifold%OpenPaths) - do i=MinSource, MaxSource + do i=MinSource, MaxSource if(IsValveOpen(i)) then - call AddRootNode(i) + call data%state%manifold%Fringe%Push(i) call AddChildren(data%state%manifold%Valve(i)) endif enddo call PostProcess(data%state%manifold%OpenPaths) - - !**call AfterTraverse%RunAll() - + !**call AfterTraverse%RunAll() data%state%manifold%IsTraverse = .true. - - !TODO: clean up - #ifdef Log5 - CALL DATE_AND_TIME(values=EndTime) - Duration= EndTime(8) - StartTime(8) - !if(print_log) print*, 'Duration= ', Duration, 'ms' - call Log_5('Duration= ', Duration) - call DisplayOpenPaths() - - call Log_5('==========================================') - #endif + call DisplayOpenPaths() end subroutine subroutine PostProcess(pathArr) @@ -109,27 +92,19 @@ end subroutine PathFinding_Step integer :: i if(.not.allocated(pathArr)) return - i = 1 do call pathArr(i)%Purge(MinRelation, MaxRelation) - if(pathArr(i)%Length() <= 2) then call RemovePath(pathArr, i) else i = i + 1 endif - if(i > size(pathArr)) exit enddo end subroutine - subroutine AddRootNode(valve) - implicit none - integer, intent(in) :: valve - call data%state%manifold%Fringe%Push(valve) - end subroutine recursive subroutine AddChildren(node) implicit none @@ -140,7 +115,7 @@ end subroutine PathFinding_Step t = data%state%manifold%Valve(node%Number)%Adjacent(i) if(IsValveOpen(t)) then - + if(data%state%manifold%Fringe%DoesHave(t)) cycle call data%state%manifold%Fringe%Push(t) @@ -247,7 +222,6 @@ end subroutine PathFinding_Step end do deallocate(pathArr) call move_alloc(tempArr, pathArr) - endsubroutine subroutine Setup() @@ -270,11 +244,9 @@ end subroutine PathFinding_Step data%state%manifold%Valve(i)%ValveType = Relation end do - - ! make adjustments call data%state%manifold%Valve(1)%AdjacentTo(91) - + call data%state%manifold%Valve(2)%AdjacentTo(92) call data%state%manifold%Valve(2)%AdjacentTo(117) diff --git a/CSharp/Equipments/MudPathFinding/CManifolds.i90 b/CSharp/Equipments/MudPathFinding/CManifolds.i90 index 5803e2d..64fed2a 100644 --- a/CSharp/Equipments/MudPathFinding/CManifolds.i90 +++ b/CSharp/Equipments/MudPathFinding/CManifolds.i90 @@ -1,47 +1,34 @@ # 1 "/home/admin/SimulationCore2/CSharp/Equipments/MudPathFinding/CManifolds.f90" module CManifolds - use CStack - use CArrangement +! use CStack +! use CArrangement use SimulationVariables - + use ManifoldVariables implicit none - public - integer, parameter :: ValveCount = 128 - integer, parameter :: MinSource = 71 - integer, parameter :: MaxSource = 90 - integer, parameter :: MinRelation = 91 - integer, parameter :: MaxRelation = 128 + contains + + subroutine ManifoldToJson(parent) + type(json_value),pointer :: parent + type(json_value),pointer :: p + type(json_core) :: json + logical :: valve_states(ValveCount) + integer :: i +! 1. create new node + call json%create_object(p,'Manifold') +! 2. add member of data type to new node + DO I=1,ValveCount + valve_states(i) = data%state%Manifold%Valve(i)%Status + ENDDO + + call json%add(p, "valves", valve_states) +! 3. add new node to parent + call json%add(parent,p) + end subroutine - Type::ManifoldType - type(Arrangement) :: Valve(ValveCount) - type(Path), allocatable :: OpenPaths(:) - type(Stack) :: Fringe - logical :: IsRepititveOutput - - logical :: IsSafetyValveInstalled - logical :: IsSafetyValveInstalled_KellyMode - logical :: IsSafetyValveInstalled_TripMode - logical :: IsSafetyValveInstalled_TopDrive - logical :: SafetyValve - logical :: IsIBopInstalled - logical :: IBop - logical :: IsKellyCockInstalled - logical :: KellyCock - logical :: IsTopDriveIBopInstalled - logical :: TopDriveIBop - logical :: IsFloatValveInstalled - logical :: FloatValve - logical :: IsPathsDirty = .false. - logical :: IsTraverse = .false. - End type ManifoldType - type(ManifoldType)::Manifold - contains - subroutine PathFinding_Setup() -! use CSimulationVariables implicit none - Manifold%IsTraverse = .false. + data%state%manifold%IsTraverse = .false. call Setup() !call OnSimulationInitialization%Add(PathFinding_Init) !call OnSimulationStop%Add(PathFinding_Init) @@ -52,16 +39,16 @@ module CManifolds subroutine PathFinding_Init implicit none - Manifold%IsTraverse = .false. + data%state%manifold%IsTraverse = .false. call Setup() end subroutine PathFinding_Init subroutine PathFinding_Step - if (Manifold%IsPathsDirty) then - Manifold%IsPathsDirty = .false. + if (data%state%manifold%IsPathsDirty) then + data%state%manifold%IsPathsDirty = .false. call Traverse() endif -end subroutine PathFinding_Step + end subroutine PathFinding_Step ! subroutine PathFinding_Output ! implicit none @@ -80,35 +67,25 @@ end subroutine PathFinding_Step ! end do loop ! end subroutine PathFindingMainBody - subroutine Traverse() + subroutine Traverse() bind(C,name="Traverse") use CLog5 implicit none - integer :: i, Duration - integer, dimension(8) :: StartTime,EndTime !TODO: clean up - call DATE_AND_TIME(values=StartTime) !TODO: clean up - + integer :: i !**call BeforeTraverse%RunAll() - - if(allocated(Manifold%OpenPaths)) deallocate(Manifold%OpenPaths) - do i=MinSource, MaxSource + if(allocated(data%state%manifold%OpenPaths)) deallocate(data%state%manifold%OpenPaths) + do i=MinSource, MaxSource if(IsValveOpen(i)) then - call AddRootNode(i) - call AddChildren(Manifold%Valve(i)) + call data%state%manifold%Fringe%Push(i) + call AddChildren(data%state%manifold%Valve(i)) endif enddo - call PostProcess(Manifold%OpenPaths) - + call PostProcess(data%state%manifold%OpenPaths) !**call AfterTraverse%RunAll() - - Manifold%IsTraverse = .true. - -!TODO: clean up -# 115 - - - endsubroutine + data%state%manifold%IsTraverse = .true. + call DisplayOpenPaths() + end subroutine subroutine PostProcess(pathArr) implicit none @@ -116,60 +93,52 @@ end subroutine PathFinding_Step integer :: i if(.not.allocated(pathArr)) return - i = 1 do call pathArr(i)%Purge(MinRelation, MaxRelation) - if(pathArr(i)%Length() <= 2) then call RemovePath(pathArr, i) else i = i + 1 endif - if(i > size(pathArr)) exit enddo end subroutine - subroutine AddRootNode(valve) - implicit none - integer, intent(in) :: valve - call Manifold%Fringe%Push(valve) - end subroutine recursive subroutine AddChildren(node) implicit none type(Arrangement), intent(inout) :: node integer :: i,t - do i=1, Manifold%Valve(node%Number)%Length() - t = Manifold%Valve(node%Number)%Adjacent(i) + do i=1, data%state%manifold%Valve(node%Number)%Length() + t = data%state%manifold%Valve(node%Number)%Adjacent(i) if(IsValveOpen(t)) then + + if(data%state%manifold%Fringe%DoesHave(t)) cycle - if(Manifold%Fringe%DoesHave(t)) cycle - - call Manifold%Fringe%Push(t) + call data%state%manifold%Fringe%Push(t) - if(Manifold%Valve(t)%IsSource()) then - call AddPath(Manifold%OpenPaths, Manifold%Fringe%List) - call Manifold%Fringe%Pop() + if(data%state%manifold%Valve(t)%IsSource()) then + call AddPath(data%state%manifold%OpenPaths, data%state%manifold%Fringe%List) + call data%state%manifold%Fringe%Pop() cycle endif - call AddChildren(Manifold%Valve(node%Adjacent(i))) + call AddChildren(data%state%manifold%Valve(node%Adjacent(i))) end if enddo - call Manifold%Fringe%Pop() + call data%state%manifold%Fringe%Pop() end subroutine logical function IsValveOpen(no) implicit none integer, intent(in) :: no - IsValveOpen = Manifold%Valve(no)%Status + IsValveOpen = data%state%manifold%Valve(no)%Status end function @@ -254,7 +223,6 @@ end subroutine PathFinding_Step end do deallocate(pathArr) call move_alloc(tempArr, pathArr) - endsubroutine subroutine Setup() @@ -263,168 +231,166 @@ end subroutine PathFinding_Step ! initialize all valves do i = 1, ValveCount - call Manifold%Valve(i)%init(i) + call data%state%manifold%Valve(i)%init(i) end do ! open source valves do i = MinSource , MaxSource - Manifold%Valve(i)%Status = .true. - Manifold%Valve(i)%ValveType = InputOutput + data%state%manifold%Valve(i)%Status = .true. + data%state%manifold%Valve(i)%ValveType = InputOutput end do do i = MinRelation , MaxRelation - Manifold%Valve(i)%Status = .true. - Manifold%Valve(i)%ValveType = Relation + data%state%manifold%Valve(i)%Status = .true. + data%state%manifold%Valve(i)%ValveType = Relation end do - - ! make adjustments - call Manifold%Valve(1)%AdjacentTo(91) - - call Manifold%Valve(2)%AdjacentTo(92) - call Manifold%Valve(2)%AdjacentTo(117) + call data%state%manifold%Valve(1)%AdjacentTo(91) + + call data%state%manifold%Valve(2)%AdjacentTo(92) + call data%state%manifold%Valve(2)%AdjacentTo(117) - call Manifold%Valve(3)%AdjacentTo(93) - call Manifold%Valve(3)%AdjacentTo(118) + call data%state%manifold%Valve(3)%AdjacentTo(93) + call data%state%manifold%Valve(3)%AdjacentTo(118) - call Manifold%Valve(4)%AdjacentTo(94) + call data%state%manifold%Valve(4)%AdjacentTo(94) - call Manifold%Valve(5)%AdjacentTo(95) + call data%state%manifold%Valve(5)%AdjacentTo(95) - call Manifold%Valve(6)%AdjacentTo(91) - call Manifold%Valve(6)%AdjacentTo(92) + call data%state%manifold%Valve(6)%AdjacentTo(91) + call data%state%manifold%Valve(6)%AdjacentTo(92) - call Manifold%Valve(7)%AdjacentTo(92) - call Manifold%Valve(7)%AdjacentTo(93) + call data%state%manifold%Valve(7)%AdjacentTo(92) + call data%state%manifold%Valve(7)%AdjacentTo(93) - call Manifold%Valve(8)%AdjacentTo(93) - call Manifold%Valve(8)%AdjacentTo(94) + call data%state%manifold%Valve(8)%AdjacentTo(93) + call data%state%manifold%Valve(8)%AdjacentTo(94) - call Manifold%Valve(9)%AdjacentTo(91) - call Manifold%Valve(9)%AdjacentTo(96) + call data%state%manifold%Valve(9)%AdjacentTo(91) + call data%state%manifold%Valve(9)%AdjacentTo(96) - call Manifold%Valve(10)%AdjacentTo(94) - call Manifold%Valve(10)%AdjacentTo(98) + call data%state%manifold%Valve(10)%AdjacentTo(94) + call data%state%manifold%Valve(10)%AdjacentTo(98) - call Manifold%Valve(11)%AdjacentTo(96) - call Manifold%Valve(11)%AdjacentTo(97) + call data%state%manifold%Valve(11)%AdjacentTo(96) + call data%state%manifold%Valve(11)%AdjacentTo(97) - call Manifold%Valve(12)%AdjacentTo(97) - call Manifold%Valve(12)%AdjacentTo(98) + call data%state%manifold%Valve(12)%AdjacentTo(97) + call data%state%manifold%Valve(12)%AdjacentTo(98) - call Manifold%Valve(13)%AdjacentTo(96) - call Manifold%Valve(13)%AdjacentTo(99) + call data%state%manifold%Valve(13)%AdjacentTo(96) + call data%state%manifold%Valve(13)%AdjacentTo(99) - call Manifold%Valve(14)%AdjacentTo(78) - call Manifold%Valve(14)%AdjacentTo(97) + call data%state%manifold%Valve(14)%AdjacentTo(78) + call data%state%manifold%Valve(14)%AdjacentTo(97) !call Valve(14)%AdjacentTo(126) - call Manifold%Valve(15)%AdjacentTo(98) - call Manifold%Valve(15)%AdjacentTo(99) + call data%state%manifold%Valve(15)%AdjacentTo(98) + call data%state%manifold%Valve(15)%AdjacentTo(99) - call Manifold%Valve(16)%AdjacentTo(121) + call data%state%manifold%Valve(16)%AdjacentTo(121) !call Valve(16)%AdjacentTo() - call Manifold%Valve(17)%AdjacentTo(122) + call data%state%manifold%Valve(17)%AdjacentTo(122) !call Valve(17)%AdjacentTo() - call Manifold%Valve(18)%AdjacentTo(123) + call data%state%manifold%Valve(18)%AdjacentTo(123) !call Valve(18)%AdjacentTo() - call Manifold%Valve(19)%AdjacentTo(101) - call Manifold%Valve(19)%AdjacentTo(102) + call data%state%manifold%Valve(19)%AdjacentTo(101) + call data%state%manifold%Valve(19)%AdjacentTo(102) - call Manifold%Valve(20)%AdjacentTo(100) + call data%state%manifold%Valve(20)%AdjacentTo(100) - call Manifold%Valve(21)%AdjacentTo(101) + call data%state%manifold%Valve(21)%AdjacentTo(101) - call Manifold%Valve(22)%AdjacentTo(102) + call data%state%manifold%Valve(22)%AdjacentTo(102) - call Manifold%Valve(23)%AdjacentTo(71) + call data%state%manifold%Valve(23)%AdjacentTo(71) - call Manifold%Valve(24)%AdjacentTo(71) + call data%state%manifold%Valve(24)%AdjacentTo(71) - call Manifold%Valve(25)%AdjacentTo(108) - call Manifold%Valve(25)%AdjacentTo(118) + call data%state%manifold%Valve(25)%AdjacentTo(108) + call data%state%manifold%Valve(25)%AdjacentTo(118) - call Manifold%Valve(26)%AdjacentTo(109) - call Manifold%Valve(26)%AdjacentTo(117) + call data%state%manifold%Valve(26)%AdjacentTo(109) + call data%state%manifold%Valve(26)%AdjacentTo(117) - call Manifold%Valve(27)%AdjacentTo(32) - call Manifold%Valve(27)%AdjacentTo(108) + call data%state%manifold%Valve(27)%AdjacentTo(32) + call data%state%manifold%Valve(27)%AdjacentTo(108) - call Manifold%Valve(28)%AdjacentTo(33) - call Manifold%Valve(28)%AdjacentTo(108) + call data%state%manifold%Valve(28)%AdjacentTo(33) + call data%state%manifold%Valve(28)%AdjacentTo(108) - call Manifold%Valve(29)%AdjacentTo(110) - call Manifold%Valve(29)%AdjacentTo(113) + call data%state%manifold%Valve(29)%AdjacentTo(110) + call data%state%manifold%Valve(29)%AdjacentTo(113) - call Manifold%Valve(30)%AdjacentTo(34) - call Manifold%Valve(30)%AdjacentTo(109) + call data%state%manifold%Valve(30)%AdjacentTo(34) + call data%state%manifold%Valve(30)%AdjacentTo(109) - call Manifold%Valve(31)%AdjacentTo(35) - call Manifold%Valve(31)%AdjacentTo(109) + call data%state%manifold%Valve(31)%AdjacentTo(35) + call data%state%manifold%Valve(31)%AdjacentTo(109) - call Manifold%Valve(32)%AdjacentTo(27) - call Manifold%Valve(32)%AdjacentTo(61) + call data%state%manifold%Valve(32)%AdjacentTo(27) + call data%state%manifold%Valve(32)%AdjacentTo(61) - call Manifold%Valve(33)%AdjacentTo(28) - call Manifold%Valve(33)%AdjacentTo(62) + call data%state%manifold%Valve(33)%AdjacentTo(28) + call data%state%manifold%Valve(33)%AdjacentTo(62) - call Manifold%Valve(34)%AdjacentTo(30) - call Manifold%Valve(34)%AdjacentTo(63) + call data%state%manifold%Valve(34)%AdjacentTo(30) + call data%state%manifold%Valve(34)%AdjacentTo(63) - call Manifold%Valve(35)%AdjacentTo(31) - call Manifold%Valve(35)%AdjacentTo(64) + call data%state%manifold%Valve(35)%AdjacentTo(31) + call data%state%manifold%Valve(35)%AdjacentTo(64) - call Manifold%Valve(36)%AdjacentTo(116) + call data%state%manifold%Valve(36)%AdjacentTo(116) - call Manifold%Valve(37)%AdjacentTo(78) + call data%state%manifold%Valve(37)%AdjacentTo(78) - call Manifold%Valve(38)%AdjacentTo(71) + call data%state%manifold%Valve(38)%AdjacentTo(71) - call Manifold%Valve(39)%AdjacentTo(77) + call data%state%manifold%Valve(39)%AdjacentTo(77) !call Valve(40)%AdjacentTo(105) - call Manifold%Valve(40)%AdjacentTo(80) + call data%state%manifold%Valve(40)%AdjacentTo(80) - call Manifold%Valve(41)%AdjacentTo(77) + call data%state%manifold%Valve(41)%AdjacentTo(77) - call Manifold%Valve(42)%AdjacentTo(71) + call data%state%manifold%Valve(42)%AdjacentTo(71) - call Manifold%Valve(43)%AdjacentTo(106) + call data%state%manifold%Valve(43)%AdjacentTo(106) - call Manifold%Valve(44)%AdjacentTo(77) + call data%state%manifold%Valve(44)%AdjacentTo(77) - call Manifold%Valve(45)%AdjacentTo(71) + call data%state%manifold%Valve(45)%AdjacentTo(71) - call Manifold%Valve(46)%AdjacentTo(104) + call data%state%manifold%Valve(46)%AdjacentTo(104) - call Manifold%Valve(47)%AdjacentTo(104) - call Manifold%Valve(47)%AdjacentTo(117) + call data%state%manifold%Valve(47)%AdjacentTo(104) + call data%state%manifold%Valve(47)%AdjacentTo(117) - call Manifold%Valve(48)%AdjacentTo(69) - call Manifold%Valve(48)%AdjacentTo(79) + call data%state%manifold%Valve(48)%AdjacentTo(69) + call data%state%manifold%Valve(48)%AdjacentTo(79) - call Manifold%Valve(49)%AdjacentTo(104) - call Manifold%Valve(49)%AdjacentTo(79) + call data%state%manifold%Valve(49)%AdjacentTo(104) + call data%state%manifold%Valve(49)%AdjacentTo(79) !call Valve(50)%AdjacentTo(48) - call Manifold%Valve(50)%AdjacentTo(51) + call data%state%manifold%Valve(50)%AdjacentTo(51) !call Valve(50)%AdjacentTo(54) - call Manifold%Valve(50)%AdjacentTo(104) + call data%state%manifold%Valve(50)%AdjacentTo(104) - call Manifold%Valve(51)%AdjacentTo(50) - call Manifold%Valve(51)%AdjacentTo(52) + call data%state%manifold%Valve(51)%AdjacentTo(50) + call data%state%manifold%Valve(51)%AdjacentTo(52) - call Manifold%Valve(52)%AdjacentTo(51) + call data%state%manifold%Valve(52)%AdjacentTo(51) !call Valve(52)%AdjacentTo(127) - call Manifold%Valve(52)%AdjacentTo(80) + call data%state%manifold%Valve(52)%AdjacentTo(80) !call Valve(53)%AdjacentTo(103) !call Valve(53)%AdjacentTo(105) - call Manifold%Valve(53)%AdjacentTo(80) + call data%state%manifold%Valve(53)%AdjacentTo(80) !call Valve(54)%AdjacentTo(69) !call Valve(54)%AdjacentTo(124) @@ -432,79 +398,79 @@ end subroutine PathFinding_Step !call Valve(55)%AdjacentTo(103) !call Valve(55)%AdjacentTo(124) - call Manifold%Valve(56)%AdjacentTo(128) - call Manifold%Valve(56)%AdjacentTo(127) + call data%state%manifold%Valve(56)%AdjacentTo(128) + call data%state%manifold%Valve(56)%AdjacentTo(127) !call Valve(57)%AdjacentTo(14) !call Valve(57)%AdjacentTo(103) !call Valve(57)%AdjacentTo(126) - call Manifold%Valve(58)%AdjacentTo(78) + call data%state%manifold%Valve(58)%AdjacentTo(78) - call Manifold%Valve(59)%AdjacentTo(78) + call data%state%manifold%Valve(59)%AdjacentTo(78) - call Manifold%Valve(60)%AdjacentTo(78) + call data%state%manifold%Valve(60)%AdjacentTo(78) - call Manifold%Valve(61)%AdjacentTo(32) - call Manifold%Valve(61)%AdjacentTo(115) + call data%state%manifold%Valve(61)%AdjacentTo(32) + call data%state%manifold%Valve(61)%AdjacentTo(115) - call Manifold%Valve(62)%AdjacentTo(33) - call Manifold%Valve(62)%AdjacentTo(114) + call data%state%manifold%Valve(62)%AdjacentTo(33) + call data%state%manifold%Valve(62)%AdjacentTo(114) - call Manifold%Valve(63)%AdjacentTo(112) - call Manifold%Valve(63)%AdjacentTo(34) + call data%state%manifold%Valve(63)%AdjacentTo(112) + call data%state%manifold%Valve(63)%AdjacentTo(34) - call Manifold%Valve(64)%AdjacentTo(35) - call Manifold%Valve(64)%AdjacentTo(111) + call data%state%manifold%Valve(64)%AdjacentTo(35) + call data%state%manifold%Valve(64)%AdjacentTo(111) - call Manifold%Valve(65)%AdjacentTo(120) + call data%state%manifold%Valve(65)%AdjacentTo(120) - call Manifold%Valve(66)%AdjacentTo(120) + call data%state%manifold%Valve(66)%AdjacentTo(120) - call Manifold%Valve(67)%AdjacentTo(73) + call data%state%manifold%Valve(67)%AdjacentTo(73) - call Manifold%Valve(68)%AdjacentTo(125) - call Manifold%Valve(68)%AdjacentTo(126) + call data%state%manifold%Valve(68)%AdjacentTo(125) + call data%state%manifold%Valve(68)%AdjacentTo(126) - call Manifold%Valve(69)%AdjacentTo(48) - call Manifold%Valve(69)%AdjacentTo(124) + call data%state%manifold%Valve(69)%AdjacentTo(48) + call data%state%manifold%Valve(69)%AdjacentTo(124) !call Valve(70)%AdjacentTo() !call Valve(70)%AdjacentTo() - call Manifold%Valve(71)%AdjacentTo(20) - call Manifold%Valve(71)%AdjacentTo(44) - call Manifold%Valve(71)%AdjacentTo(59) + call data%state%manifold%Valve(71)%AdjacentTo(20) + call data%state%manifold%Valve(71)%AdjacentTo(44) + call data%state%manifold%Valve(71)%AdjacentTo(59) - call Manifold%Valve(72)%AdjacentTo(21) - call Manifold%Valve(72)%AdjacentTo(23) + call data%state%manifold%Valve(72)%AdjacentTo(21) + call data%state%manifold%Valve(72)%AdjacentTo(23) - call Manifold%Valve(73)%AdjacentTo(22) + call data%state%manifold%Valve(73)%AdjacentTo(22) - call Manifold%Valve(74)%AdjacentTo(24) + call data%state%manifold%Valve(74)%AdjacentTo(24) !call Valve(75)%AdjacentTo() !call Valve(76)%AdjacentTo() - call Manifold%Valve(77)%AdjacentTo(43) - call Manifold%Valve(77)%AdjacentTo(58) + call data%state%manifold%Valve(77)%AdjacentTo(43) + call data%state%manifold%Valve(77)%AdjacentTo(58) !call Valve(78)%AdjacentTo() - call Manifold%Valve(79)%AdjacentTo(48) - call Manifold%Valve(79)%AdjacentTo(49) + call data%state%manifold%Valve(79)%AdjacentTo(48) + call data%state%manifold%Valve(79)%AdjacentTo(49) - call Manifold%Valve(80)%AdjacentTo(52) - call Manifold%Valve(80)%AdjacentTo(107) + call data%state%manifold%Valve(80)%AdjacentTo(52) + call data%state%manifold%Valve(80)%AdjacentTo(107) - call Manifold%Valve(81)%AdjacentTo(53) + call data%state%manifold%Valve(81)%AdjacentTo(53) - call Manifold%Valve(82)%AdjacentTo(16) + call data%state%manifold%Valve(82)%AdjacentTo(16) - call Manifold%Valve(83)%AdjacentTo(17) + call data%state%manifold%Valve(83)%AdjacentTo(17) - call Manifold%Valve(84)%AdjacentTo(18) + call data%state%manifold%Valve(84)%AdjacentTo(18) !call Valve(85)%AdjacentTo() @@ -518,161 +484,161 @@ end subroutine PathFinding_Step !call Valve(90)%AdjacentTo() - call Manifold%Valve(91)%AdjacentTo(6) - call Manifold%Valve(91)%AdjacentTo(9) - call Manifold%Valve(91)%AdjacentTo(75) + call data%state%manifold%Valve(91)%AdjacentTo(6) + call data%state%manifold%Valve(91)%AdjacentTo(9) + call data%state%manifold%Valve(91)%AdjacentTo(75) - call Manifold%Valve(92)%AdjacentTo(6) - call Manifold%Valve(92)%AdjacentTo(7) - call Manifold%Valve(92)%AdjacentTo(2) + call data%state%manifold%Valve(92)%AdjacentTo(6) + call data%state%manifold%Valve(92)%AdjacentTo(7) + call data%state%manifold%Valve(92)%AdjacentTo(2) - call Manifold%Valve(93)%AdjacentTo(3) - call Manifold%Valve(93)%AdjacentTo(7) - call Manifold%Valve(93)%AdjacentTo(8) + call data%state%manifold%Valve(93)%AdjacentTo(3) + call data%state%manifold%Valve(93)%AdjacentTo(7) + call data%state%manifold%Valve(93)%AdjacentTo(8) - call Manifold%Valve(94)%AdjacentTo(8) - call Manifold%Valve(94)%AdjacentTo(10) - call Manifold%Valve(94)%AdjacentTo(95) + call data%state%manifold%Valve(94)%AdjacentTo(8) + call data%state%manifold%Valve(94)%AdjacentTo(10) + call data%state%manifold%Valve(94)%AdjacentTo(95) - call Manifold%Valve(95)%AdjacentTo(76) - call Manifold%Valve(95)%AdjacentTo(94) + call data%state%manifold%Valve(95)%AdjacentTo(76) + call data%state%manifold%Valve(95)%AdjacentTo(94) - call Manifold%Valve(96)%AdjacentTo(9) - call Manifold%Valve(96)%AdjacentTo(11) - call Manifold%Valve(96)%AdjacentTo(13) + call data%state%manifold%Valve(96)%AdjacentTo(9) + call data%state%manifold%Valve(96)%AdjacentTo(11) + call data%state%manifold%Valve(96)%AdjacentTo(13) - call Manifold%Valve(97)%AdjacentTo(11) - call Manifold%Valve(97)%AdjacentTo(12) - call Manifold%Valve(97)%AdjacentTo(14) + call data%state%manifold%Valve(97)%AdjacentTo(11) + call data%state%manifold%Valve(97)%AdjacentTo(12) + call data%state%manifold%Valve(97)%AdjacentTo(14) - call Manifold%Valve(98)%AdjacentTo(10) - call Manifold%Valve(98)%AdjacentTo(12) - call Manifold%Valve(98)%AdjacentTo(15) + call data%state%manifold%Valve(98)%AdjacentTo(10) + call data%state%manifold%Valve(98)%AdjacentTo(12) + call data%state%manifold%Valve(98)%AdjacentTo(15) - call Manifold%Valve(99)%AdjacentTo(13) - call Manifold%Valve(99)%AdjacentTo(15) - call Manifold%Valve(99)%AdjacentTo(125) + call data%state%manifold%Valve(99)%AdjacentTo(13) + call data%state%manifold%Valve(99)%AdjacentTo(15) + call data%state%manifold%Valve(99)%AdjacentTo(125) !call Valve(100)%AdjacentTo(16) - call Manifold%Valve(100)%AdjacentTo(82) - call Manifold%Valve(100)%AdjacentTo(101) + call data%state%manifold%Valve(100)%AdjacentTo(82) + call data%state%manifold%Valve(100)%AdjacentTo(101) !call Valve(101)%AdjacentTo(17) - call Manifold%Valve(101)%AdjacentTo(19) - call Manifold%Valve(101)%AdjacentTo(83) - call Manifold%Valve(101)%AdjacentTo(100) + call data%state%manifold%Valve(101)%AdjacentTo(19) + call data%state%manifold%Valve(101)%AdjacentTo(83) + call data%state%manifold%Valve(101)%AdjacentTo(100) !call Valve(102)%AdjacentTo(18) - call Manifold%Valve(102)%AdjacentTo(19) - call Manifold%Valve(102)%AdjacentTo(84) + call data%state%manifold%Valve(102)%AdjacentTo(19) + call data%state%manifold%Valve(102)%AdjacentTo(84) !call Valve(103)%AdjacentTo(53) !call Valve(103)%AdjacentTo(56) - call Manifold%Valve(103)%AdjacentTo(124) + call data%state%manifold%Valve(103)%AdjacentTo(124) !call Valve(103)%AdjacentTo(56) !call Valve(103)%AdjacentTo(78) - call Manifold%Valve(104)%AdjacentTo(46) - call Manifold%Valve(104)%AdjacentTo(47) - call Manifold%Valve(104)%AdjacentTo(49) - call Manifold%Valve(104)%AdjacentTo(50) + call data%state%manifold%Valve(104)%AdjacentTo(46) + call data%state%manifold%Valve(104)%AdjacentTo(47) + call data%state%manifold%Valve(104)%AdjacentTo(49) + call data%state%manifold%Valve(104)%AdjacentTo(50) !call Valve(105)%AdjacentTo(53) !call Valve(105)%AdjacentTo(107) !call Valve(105)%AdjacentTo(127) - call Manifold%Valve(106)%AdjacentTo(40) - call Manifold%Valve(106)%AdjacentTo(45) + call data%state%manifold%Valve(106)%AdjacentTo(40) + call data%state%manifold%Valve(106)%AdjacentTo(45) - call Manifold%Valve(107)%AdjacentTo(41) + call data%state%manifold%Valve(107)%AdjacentTo(41) !call Valve(107)%AdjacentTo(105) - call Manifold%Valve(107)%AdjacentTo(119) + call data%state%manifold%Valve(107)%AdjacentTo(119) !call Valve(107)%AdjacentTo(42) - call Manifold%Valve(108)%AdjacentTo(25) - call Manifold%Valve(108)%AdjacentTo(27) - call Manifold%Valve(108)%AdjacentTo(28) - call Manifold%Valve(108)%AdjacentTo(110) + call data%state%manifold%Valve(108)%AdjacentTo(25) + call data%state%manifold%Valve(108)%AdjacentTo(27) + call data%state%manifold%Valve(108)%AdjacentTo(28) + call data%state%manifold%Valve(108)%AdjacentTo(110) - call Manifold%Valve(109)%AdjacentTo(26) - call Manifold%Valve(109)%AdjacentTo(30) - call Manifold%Valve(109)%AdjacentTo(31) - call Manifold%Valve(109)%AdjacentTo(110) + call data%state%manifold%Valve(109)%AdjacentTo(26) + call data%state%manifold%Valve(109)%AdjacentTo(30) + call data%state%manifold%Valve(109)%AdjacentTo(31) + call data%state%manifold%Valve(109)%AdjacentTo(110) - call Manifold%Valve(110)%AdjacentTo(29) - call Manifold%Valve(110)%AdjacentTo(85) - call Manifold%Valve(110)%AdjacentTo(108) - call Manifold%Valve(110)%AdjacentTo(109) + call data%state%manifold%Valve(110)%AdjacentTo(29) + call data%state%manifold%Valve(110)%AdjacentTo(85) + call data%state%manifold%Valve(110)%AdjacentTo(108) + call data%state%manifold%Valve(110)%AdjacentTo(109) - call Manifold%Valve(111)%AdjacentTo(37) - call Manifold%Valve(111)%AdjacentTo(64) - call Manifold%Valve(111)%AdjacentTo(112) + call data%state%manifold%Valve(111)%AdjacentTo(37) + call data%state%manifold%Valve(111)%AdjacentTo(64) + call data%state%manifold%Valve(111)%AdjacentTo(112) - call Manifold%Valve(112)%AdjacentTo(63) - call Manifold%Valve(112)%AdjacentTo(111) - call Manifold%Valve(112)%AdjacentTo(113) + call data%state%manifold%Valve(112)%AdjacentTo(63) + call data%state%manifold%Valve(112)%AdjacentTo(111) + call data%state%manifold%Valve(112)%AdjacentTo(113) - call Manifold%Valve(113)%AdjacentTo(29) - call Manifold%Valve(113)%AdjacentTo(112) - call Manifold%Valve(113)%AdjacentTo(114) + call data%state%manifold%Valve(113)%AdjacentTo(29) + call data%state%manifold%Valve(113)%AdjacentTo(112) + call data%state%manifold%Valve(113)%AdjacentTo(114) - call Manifold%Valve(114)%AdjacentTo(62) - call Manifold%Valve(114)%AdjacentTo(113) - call Manifold%Valve(114)%AdjacentTo(115) + call data%state%manifold%Valve(114)%AdjacentTo(62) + call data%state%manifold%Valve(114)%AdjacentTo(113) + call data%state%manifold%Valve(114)%AdjacentTo(115) - call Manifold%Valve(115)%AdjacentTo(36) - call Manifold%Valve(115)%AdjacentTo(61) - call Manifold%Valve(115)%AdjacentTo(114) + call data%state%manifold%Valve(115)%AdjacentTo(36) + call data%state%manifold%Valve(115)%AdjacentTo(61) + call data%state%manifold%Valve(115)%AdjacentTo(114) - call Manifold%Valve(116)%AdjacentTo(38) - call Manifold%Valve(116)%AdjacentTo(39) + call data%state%manifold%Valve(116)%AdjacentTo(38) + call data%state%manifold%Valve(116)%AdjacentTo(39) - call Manifold%Valve(117)%AdjacentTo(2) - call Manifold%Valve(117)%AdjacentTo(26) - call Manifold%Valve(117)%AdjacentTo(47) + call data%state%manifold%Valve(117)%AdjacentTo(2) + call data%state%manifold%Valve(117)%AdjacentTo(26) + call data%state%manifold%Valve(117)%AdjacentTo(47) - call Manifold%Valve(118)%AdjacentTo(3) - call Manifold%Valve(118)%AdjacentTo(25) - call Manifold%Valve(118)%AdjacentTo(46) + call data%state%manifold%Valve(118)%AdjacentTo(3) + call data%state%manifold%Valve(118)%AdjacentTo(25) + call data%state%manifold%Valve(118)%AdjacentTo(46) - call Manifold%Valve(119)%AdjacentTo(42) - call Manifold%Valve(119)%AdjacentTo(60) - call Manifold%Valve(119)%AdjacentTo(107) + call data%state%manifold%Valve(119)%AdjacentTo(42) + call data%state%manifold%Valve(119)%AdjacentTo(60) + call data%state%manifold%Valve(119)%AdjacentTo(107) - call Manifold%Valve(120)%AdjacentTo(71) + call data%state%manifold%Valve(120)%AdjacentTo(71) !call Valve(121)%AdjacentTo(16) - call Manifold%Valve(121)%AdjacentTo(1) - call Manifold%Valve(121)%AdjacentTo(65) + call data%state%manifold%Valve(121)%AdjacentTo(1) + call data%state%manifold%Valve(121)%AdjacentTo(65) !call Valve(122)%AdjacentTo(17) - call Manifold%Valve(122)%AdjacentTo(4) - call Manifold%Valve(122)%AdjacentTo(66) + call data%state%manifold%Valve(122)%AdjacentTo(4) + call data%state%manifold%Valve(122)%AdjacentTo(66) !call Valve(123)%AdjacentTo(18) - call Manifold%Valve(123)%AdjacentTo(5) - call Manifold%Valve(123)%AdjacentTo(67) + call data%state%manifold%Valve(123)%AdjacentTo(5) + call data%state%manifold%Valve(123)%AdjacentTo(67) !call Valve(124)%AdjacentTo(54) !call Valve(124)%AdjacentTo(55) - call Manifold%Valve(124)%AdjacentTo(69) - call Manifold%Valve(124)%AdjacentTo(103) + call data%state%manifold%Valve(124)%AdjacentTo(69) + call data%state%manifold%Valve(124)%AdjacentTo(103) - call Manifold%Valve(125)%AdjacentTo(68) - call Manifold%Valve(125)%AdjacentTo(99) + call data%state%manifold%Valve(125)%AdjacentTo(68) + call data%state%manifold%Valve(125)%AdjacentTo(99) ! call Valve(125)%AdjacentTo(126) - call Manifold%Valve(126)%AdjacentTo(128) - call Manifold%Valve(126)%AdjacentTo(68) + call data%state%manifold%Valve(126)%AdjacentTo(128) + call data%state%manifold%Valve(126)%AdjacentTo(68) !call Valve(126)%AdjacentTo(125) - call Manifold%Valve(127)%AdjacentTo(56) - call Manifold%Valve(127)%AdjacentTo(78) + call data%state%manifold%Valve(127)%AdjacentTo(56) + call data%state%manifold%Valve(127)%AdjacentTo(78) !call Valve(127)%AdjacentTo(105) - call Manifold%Valve(128)%AdjacentTo(56) - call Manifold%Valve(128)%AdjacentTo(126) + call data%state%manifold%Valve(128)%AdjacentTo(56) + call data%state%manifold%Valve(128)%AdjacentTo(126) ! initialization @@ -687,34 +653,24 @@ end subroutine PathFinding_Step - subroutine KellyConnected() -!use CLog3 + subroutine KellyConnected() !Bind(C,name='KellyConnected') implicit none + call data%state%manifold%Valve(127)%RemoveAdjacent(78) - call Manifold%Valve(127)%RemoveAdjacent(78) + call data%state%manifold%Valve(127)%AdjacentTo(103) + call data%state%manifold%Valve(103)%AdjacentTo(127) - call Manifold%Valve(127)%AdjacentTo(103) - call Manifold%Valve(103)%AdjacentTo(127) - -# 708 - - Manifold%IsPathsDirty = .true. + if(print_log) print*, 'KellyConnected()' + data%state%manifold%IsPathsDirty = .true. end subroutine - subroutine KellyDisconnected() -!use CLog3 - implicit none - - call Manifold%Valve(127)%RemoveAdjacent(103) - call Manifold%Valve(103)%RemoveAdjacent(127) - - call Manifold%Valve(127)%AdjacentTo(78) - -# 724 - - - Manifold%IsPathsDirty = .true. - + subroutine KellyDisconnected() !Bind(C,name='KellyDisconnected') + implicit none + call data%state%manifold%Valve(127)%RemoveAdjacent(103) + call data%state%manifold%Valve(103)%RemoveAdjacent(127) + call data%state%manifold%Valve(127)%AdjacentTo(78) + if(print_log) print*, 'KellyDisconnected()' + data%state%manifold%IsPathsDirty = .true. end subroutine @@ -727,33 +683,33 @@ end subroutine PathFinding_Step subroutine InstallSafetyValve_KellyMode() implicit none - Manifold%IsSafetyValveInstalled_KellyMode = .true. + data%state%manifold%IsSafetyValveInstalled_KellyMode = .true. call RemoveTopDriveIBop() ! Remove Safey Valve (54) - call Manifold%Valve(124)%RemoveAdjacent(54) - call Manifold%Valve(54)%RemoveAdjacent(124) + call data%state%manifold%Valve(124)%RemoveAdjacent(54) + call data%state%manifold%Valve(54)%RemoveAdjacent(124) - call Manifold%Valve(69)%RemoveAdjacent(54) - call Manifold%Valve(54)%RemoveAdjacent(69) + call data%state%manifold%Valve(69)%RemoveAdjacent(54) + call data%state%manifold%Valve(54)%RemoveAdjacent(69) ! Remove 126-103 cnn - call Manifold%Valve(128)%RemoveAdjacent(127) - call Manifold%Valve(127)%RemoveAdjacent(128) + call data%state%manifold%Valve(128)%RemoveAdjacent(127) + call data%state%manifold%Valve(127)%RemoveAdjacent(128) ! now make cnn - call Manifold%Valve(124)%AdjacentTo(69) - call Manifold%Valve(69)%AdjacentTo(124) + call data%state%manifold%Valve(124)%AdjacentTo(69) + call data%state%manifold%Valve(69)%AdjacentTo(124) - call Manifold%Valve(128)%AdjacentTo(56) + call data%state%manifold%Valve(128)%AdjacentTo(56) - call Manifold%Valve(56)%AdjacentTo(128) - call Manifold%Valve(56)%AdjacentTo(127) + call data%state%manifold%Valve(56)%AdjacentTo(128) + call data%state%manifold%Valve(56)%AdjacentTo(127) - call Manifold%Valve(127)%AdjacentTo(56) + call data%state%manifold%Valve(127)%AdjacentTo(56) -# 768 +# 713 data%Equipments%DrillingConsole%IRSafetyValveLed = 1 @@ -762,49 +718,49 @@ end subroutine PathFinding_Step subroutine RemoveSafetyValve_KellyMode() implicit none - Manifold%IsSafetyValveInstalled_KellyMode = .false. + data%state%manifold%IsSafetyValveInstalled_KellyMode = .false. - call Manifold%Valve(128)%RemoveAdjacent(56) - call Manifold%Valve(56)%RemoveAdjacent(128) + call data%state%manifold%Valve(128)%RemoveAdjacent(56) + call data%state%manifold%Valve(56)%RemoveAdjacent(128) - call Manifold%Valve(127)%RemoveAdjacent(56) - call Manifold%Valve(56)%RemoveAdjacent(127) + call data%state%manifold%Valve(127)%RemoveAdjacent(56) + call data%state%manifold%Valve(56)%RemoveAdjacent(127) - call Manifold%Valve(127)%AdjacentTo(128) - call Manifold%Valve(128)%AdjacentTo(127) + call data%state%manifold%Valve(127)%AdjacentTo(128) + call data%state%manifold%Valve(128)%AdjacentTo(127) data%Equipments%DrillingConsole%IRSafetyValveLed = 0 call CloseSafetyValve_KellyMode() data%Equipments%DrillingConsole%OpenSafetyValveLed = 0 data%Equipments%DrillingConsole%CloseSafetyValveLed = 0 -# 794 +# 739 end subroutine subroutine OpenSafetyValve_KellyMode() implicit none - if(.not.Manifold%IsSafetyValveInstalled_KellyMode) return + if(.not.data%state%manifold%IsSafetyValveInstalled_KellyMode) return data%Equipments%DrillingConsole%OpenSafetyValveLed = 1 data%Equipments%DrillingConsole%CloseSafetyValveLed = 0 - Manifold%SafetyValve = .true. - call ChangeValve(56, Manifold%SafetyValve) + data%state%manifold%SafetyValve = .true. + call ChangeValve(56, data%state%manifold%SafetyValve) -# 808 +# 753 end subroutine subroutine CloseSafetyValve_KellyMode() implicit none - if(.not.Manifold%IsSafetyValveInstalled_KellyMode) return + if(.not.data%state%manifold%IsSafetyValveInstalled_KellyMode) return data%Equipments%DrillingConsole%CloseSafetyValveLed = 1 data%Equipments%DrillingConsole%OpenSafetyValveLed = 0 - Manifold%SafetyValve = .false. - call ChangeValve(56, Manifold%SafetyValve) + data%state%manifold%SafetyValve = .false. + call ChangeValve(56, data%state%manifold%SafetyValve) -# 822 +# 767 end subroutine @@ -820,80 +776,77 @@ end subroutine PathFinding_Step subroutine InstallSafetyValve_TripMode() implicit none - Manifold%IsSafetyValveInstalled_TripMode = .true. + data%state%manifold%IsSafetyValveInstalled_TripMode = .true. - call Manifold%Valve(128)%RemoveAdjacent(56) - call Manifold%Valve(56)%RemoveAdjacent(128) + call data%state%manifold%Valve(128)%RemoveAdjacent(56) + call data%state%manifold%Valve(56)%RemoveAdjacent(128) - call Manifold%Valve(127)%RemoveAdjacent(56) - call Manifold%Valve(56)%RemoveAdjacent(127) + call data%state%manifold%Valve(127)%RemoveAdjacent(56) + call data%state%manifold%Valve(56)%RemoveAdjacent(127) - call Manifold%Valve(69)%RemoveAdjacent(124) - call Manifold%Valve(124)%RemoveAdjacent(69) + call data%state%manifold%Valve(69)%RemoveAdjacent(124) + call data%state%manifold%Valve(124)%RemoveAdjacent(69) - call Manifold%Valve(127)%AdjacentTo(128) - call Manifold%Valve(128)%AdjacentTo(127) + call data%state%manifold%Valve(127)%AdjacentTo(128) + call data%state%manifold%Valve(128)%AdjacentTo(127) - call Manifold%Valve(124)%AdjacentTo(54) - call Manifold%Valve(54)%AdjacentTo(124) + call data%state%manifold%Valve(124)%AdjacentTo(54) + call data%state%manifold%Valve(54)%AdjacentTo(124) - call Manifold%Valve(54)%AdjacentTo(69) - call Manifold%Valve(69)%AdjacentTo(54) + call data%state%manifold%Valve(54)%AdjacentTo(69) + call data%state%manifold%Valve(69)%AdjacentTo(54) data%Equipments%DrillingConsole%IRSafetyValveLed = 1 call OpenSafetyValve_TripMode() -# 863 +# 808 end subroutine subroutine RemoveSafetyValve_TripMode() implicit none - Manifold%IsSafetyValveInstalled_TripMode = .false. + data%state%manifold%IsSafetyValveInstalled_TripMode = .false. - call Manifold%Valve(124)%RemoveAdjacent(54) - call Manifold%Valve(54)%RemoveAdjacent(124) + call data%state%manifold%Valve(124)%RemoveAdjacent(54) + call data%state%manifold%Valve(54)%RemoveAdjacent(124) - call Manifold%Valve(54)%RemoveAdjacent(69) - call Manifold%Valve(69)%RemoveAdjacent(54) + call data%state%manifold%Valve(54)%RemoveAdjacent(69) + call data%state%manifold%Valve(69)%RemoveAdjacent(54) - call Manifold%Valve(124)%AdjacentTo(69) - call Manifold%Valve(69)%AdjacentTo(124) + call data%state%manifold%Valve(124)%AdjacentTo(69) + call data%state%manifold%Valve(69)%AdjacentTo(124) data%Equipments%DrillingConsole%IRSafetyValveLed = 0 call CloseSafetyValve_TripMode() data%Equipments%DrillingConsole%OpenSafetyValveLed = 0 data%Equipments%DrillingConsole%CloseSafetyValveLed = 0 - -# 887 - - + if(print_log) print*, 'RemoveSafetyValve_TripMode()' end subroutine subroutine OpenSafetyValve_TripMode() implicit none - if(.not.Manifold%IsSafetyValveInstalled_TripMode) return + if(.not.data%state%manifold%IsSafetyValveInstalled_TripMode) return data%Equipments%DrillingConsole%OpenSafetyValveLed = 1 data%Equipments%DrillingConsole%CloseSafetyValveLed = 0 - Manifold%SafetyValve = .true. - call ChangeValve(54, Manifold%SafetyValve) + data%state%manifold%SafetyValve = .true. + call ChangeValve(54, data%state%manifold%SafetyValve) -# 901 +# 842 end subroutine subroutine CloseSafetyValve_TripMode() implicit none - if(.not.Manifold%IsSafetyValveInstalled_TripMode) return + if(.not.data%state%manifold%IsSafetyValveInstalled_TripMode) return data%Equipments%DrillingConsole%CloseSafetyValveLed = 1 data%Equipments%DrillingConsole%OpenSafetyValveLed = 0 - Manifold%SafetyValve = .false. - call ChangeValve(54, Manifold%SafetyValve) + data%state%manifold%SafetyValve = .false. + call ChangeValve(54, data%state%manifold%SafetyValve) -# 915 +# 856 end subroutine @@ -907,78 +860,78 @@ end subroutine PathFinding_Step subroutine InstallSafetyValve_TopDrive() implicit none - Manifold%IsSafetyValveInstalled_TopDrive = .true. + data%state%manifold%IsSafetyValveInstalled_TopDrive = .true. - call Manifold%Valve(128)%RemoveAdjacent(56) - call Manifold%Valve(56)%RemoveAdjacent(128) + call data%state%manifold%Valve(128)%RemoveAdjacent(56) + call data%state%manifold%Valve(56)%RemoveAdjacent(128) - call Manifold%Valve(127)%RemoveAdjacent(56) - call Manifold%Valve(56)%RemoveAdjacent(127) + call data%state%manifold%Valve(127)%RemoveAdjacent(56) + call data%state%manifold%Valve(56)%RemoveAdjacent(127) - call Manifold%Valve(69)%RemoveAdjacent(124) - call Manifold%Valve(124)%RemoveAdjacent(69) + call data%state%manifold%Valve(69)%RemoveAdjacent(124) + call data%state%manifold%Valve(124)%RemoveAdjacent(69) - call Manifold%Valve(124)%AdjacentTo(54) - call Manifold%Valve(54)%AdjacentTo(124) + call data%state%manifold%Valve(124)%AdjacentTo(54) + call data%state%manifold%Valve(54)%AdjacentTo(124) - call Manifold%Valve(54)%AdjacentTo(69) - call Manifold%Valve(69)%AdjacentTo(54) + call data%state%manifold%Valve(54)%AdjacentTo(69) + call data%state%manifold%Valve(69)%AdjacentTo(54) data%Equipments%DrillingConsole%IRSafetyValveLed = 1 call OpenSafetyValve_TopDrive() -# 950 +# 891 end subroutine subroutine RemoveSafetyValve_TopDrive() implicit none - Manifold%IsSafetyValveInstalled_TopDrive = .false. + data%state%manifold%IsSafetyValveInstalled_TopDrive = .false. - call Manifold%Valve(124)%RemoveAdjacent(54) - call Manifold%Valve(54)%RemoveAdjacent(124) + call data%state%manifold%Valve(124)%RemoveAdjacent(54) + call data%state%manifold%Valve(54)%RemoveAdjacent(124) - call Manifold%Valve(54)%RemoveAdjacent(69) - call Manifold%Valve(69)%RemoveAdjacent(54) + call data%state%manifold%Valve(54)%RemoveAdjacent(69) + call data%state%manifold%Valve(69)%RemoveAdjacent(54) - call Manifold%Valve(124)%AdjacentTo(69) - call Manifold%Valve(69)%AdjacentTo(124) + call data%state%manifold%Valve(124)%AdjacentTo(69) + call data%state%manifold%Valve(69)%AdjacentTo(124) data%Equipments%DrillingConsole%IRSafetyValveLed = 0 call CloseSafetyValve_TopDrive() data%Equipments%DrillingConsole%OpenSafetyValveLed = 0 data%Equipments%DrillingConsole%CloseSafetyValveLed = 0 -# 974 +# 915 end subroutine subroutine OpenSafetyValve_TopDrive() implicit none - if(.not.Manifold%IsSafetyValveInstalled_TopDrive) return + if(.not.data%state%manifold%IsSafetyValveInstalled_TopDrive) return data%Equipments%DrillingConsole%OpenSafetyValveLed = 1 data%Equipments%DrillingConsole%CloseSafetyValveLed = 0 - Manifold%SafetyValve = .true. + data%state%manifold%SafetyValve = .true. -# 987 +# 928 - call ChangeValve(54, Manifold%SafetyValve) + call ChangeValve(54, data%state%manifold%SafetyValve) end subroutine subroutine CloseSafetyValve_TopDrive() implicit none - if(.not.Manifold%IsSafetyValveInstalled_TopDrive) return + if(.not.data%state%manifold%IsSafetyValveInstalled_TopDrive) return data%Equipments%DrillingConsole%CloseSafetyValveLed = 1 data%Equipments%DrillingConsole%OpenSafetyValveLed = 0 - Manifold%SafetyValve = .false. + data%state%manifold%SafetyValve = .false. -# 1001 +# 942 - call ChangeValve(54, Manifold%SafetyValve) + call ChangeValve(54, data%state%manifold%SafetyValve) end subroutine @@ -991,18 +944,18 @@ end subroutine PathFinding_Step subroutine InstallIBop() implicit none - Manifold%IsIBopInstalled = .true. + data%state%manifold%IsIBopInstalled = .true. - call Manifold%Valve(103)%RemoveAdjacent(124) - call Manifold%Valve(124)%RemoveAdjacent(103) + call data%state%manifold%Valve(103)%RemoveAdjacent(124) + call data%state%manifold%Valve(124)%RemoveAdjacent(103) - call Manifold%Valve(55)%AdjacentTo(103) - call Manifold%Valve(55)%AdjacentTo(124) + call data%state%manifold%Valve(55)%AdjacentTo(103) + call data%state%manifold%Valve(55)%AdjacentTo(124) - call Manifold%Valve(103)%AdjacentTo(55) - call Manifold%Valve(124)%AdjacentTo(55) + call data%state%manifold%Valve(103)%AdjacentTo(55) + call data%state%manifold%Valve(124)%AdjacentTo(55) -# 1029 +# 970 data%Equipments%DrillingConsole%IRIBopLed = 1 @@ -1011,45 +964,45 @@ end subroutine PathFinding_Step subroutine RemoveIBop() implicit none - Manifold%IsIBopInstalled = .false. + data%state%manifold%IsIBopInstalled = .false. - call Manifold%Valve(55)%RemoveAdjacent(103) - call Manifold%Valve(55)%RemoveAdjacent(124) + call data%state%manifold%Valve(55)%RemoveAdjacent(103) + call data%state%manifold%Valve(55)%RemoveAdjacent(124) - call Manifold%Valve(103)%RemoveAdjacent(55) - call Manifold%Valve(124)%RemoveAdjacent(55) + call data%state%manifold%Valve(103)%RemoveAdjacent(55) + call data%state%manifold%Valve(124)%RemoveAdjacent(55) - call Manifold%Valve(103)%AdjacentTo(124) - call Manifold%Valve(124)%AdjacentTo(103) + call data%state%manifold%Valve(103)%AdjacentTo(124) + call data%state%manifold%Valve(124)%AdjacentTo(103) -# 1050 +# 991 data%Equipments%DrillingConsole%IRIBopLed = 0 - Manifold%IBop = .false. - call ChangeValve(55, Manifold%IBop) + data%state%manifold%IBop = .false. + call ChangeValve(55, data%state%manifold%IBop) end subroutine subroutine OpenIBop() implicit none - if(.not.Manifold%IsIBopInstalled) return - Manifold%IBop = .true. + if(.not.data%state%manifold%IsIBopInstalled) return + data%state%manifold%IBop = .true. -# 1064 +# 1005 - call ChangeValve(55, Manifold%IBop) + call ChangeValve(55, data%state%manifold%IBop) end subroutine subroutine CloseIBop() implicit none - if(.not.Manifold%IsIBopInstalled) return - Manifold%IBop = .false. + if(.not.data%state%manifold%IsIBopInstalled) return + data%state%manifold%IBop = .false. -# 1076 +# 1017 - call ChangeValve(55, Manifold%IBop) + call ChangeValve(55, data%state%manifold%IBop) end subroutine @@ -1059,19 +1012,19 @@ end subroutine PathFinding_Step subroutine InstallKellyCock() implicit none - Manifold%IsKellyCockInstalled = .true. + data%state%manifold%IsKellyCockInstalled = .true. - call Manifold%Valve(125)%RemoveAdjacent(126) - call Manifold%Valve(126)%RemoveAdjacent(125) + call data%state%manifold%Valve(125)%RemoveAdjacent(126) + call data%state%manifold%Valve(126)%RemoveAdjacent(125) - call Manifold%Valve(125)%AdjacentTo(68) + call data%state%manifold%Valve(125)%AdjacentTo(68) - call Manifold%Valve(68)%AdjacentTo(125) - call Manifold%Valve(68)%AdjacentTo(126) + call data%state%manifold%Valve(68)%AdjacentTo(125) + call data%state%manifold%Valve(68)%AdjacentTo(126) - call Manifold%Valve(126)%AdjacentTo(68) + call data%state%manifold%Valve(126)%AdjacentTo(68) -# 1102 +# 1043 call OpenKellyCock() @@ -1079,51 +1032,51 @@ end subroutine PathFinding_Step subroutine RemoveKellyCock() implicit none - Manifold%IsKellyCockInstalled = .false. + data%state%manifold%IsKellyCockInstalled = .false. - call Manifold%Valve(125)%RemoveAdjacent(68) - call Manifold%Valve(126)%RemoveAdjacent(68) + call data%state%manifold%Valve(125)%RemoveAdjacent(68) + call data%state%manifold%Valve(126)%RemoveAdjacent(68) - call Manifold%Valve(68)%RemoveAdjacent(125) - call Manifold%Valve(68)%RemoveAdjacent(126) + call data%state%manifold%Valve(68)%RemoveAdjacent(125) + call data%state%manifold%Valve(68)%RemoveAdjacent(126) - call Manifold%Valve(125)%AdjacentTo(126) - call Manifold%Valve(126)%AdjacentTo(125) + call data%state%manifold%Valve(125)%AdjacentTo(126) + call data%state%manifold%Valve(126)%AdjacentTo(125) - Manifold%KellyCock = .false. - call ChangeValve(68, Manifold%KellyCock) + data%state%manifold%KellyCock = .false. + call ChangeValve(68, data%state%manifold%KellyCock) data%Equipments%DrillingConsole%CloseKellyCockLed = 0 data%Equipments%DrillingConsole%OpenKellyCockLed = 0 -# 1127 +# 1068 end subroutine subroutine OpenKellyCock() implicit none - if(.not.Manifold%IsKellyCockInstalled) return + if(.not.data%state%manifold%IsKellyCockInstalled) return data%Equipments%DrillingConsole%OpenKellyCockLed = 1 data%Equipments%DrillingConsole%CloseKellyCockLed = 0 - Manifold%KellyCock = .true. + data%state%manifold%KellyCock = .true. -# 1140 +# 1081 - call ChangeValve(68, Manifold%KellyCock) + call ChangeValve(68, data%state%manifold%KellyCock) end subroutine subroutine CloseKellyCock() implicit none - if(.not.Manifold%IsKellyCockInstalled) return + if(.not.data%state%manifold%IsKellyCockInstalled) return data%Equipments%DrillingConsole%CloseKellyCockLed = 1 data%Equipments%DrillingConsole%OpenKellyCockLed = 0 - Manifold%KellyCock = .false. + data%state%manifold%KellyCock = .false. -# 1154 +# 1095 - call ChangeValve(68, Manifold%KellyCock) + call ChangeValve(68, data%state%manifold%KellyCock) end subroutine @@ -1135,57 +1088,57 @@ end subroutine PathFinding_Step subroutine InstallTopDriveIBop() implicit none - Manifold%IsTopDriveIBopInstalled = .true. + data%state%manifold%IsTopDriveIBopInstalled = .true. - call Manifold%Valve(126)%RemoveAdjacent(128) - call Manifold%Valve(128)%RemoveAdjacent(126) + call data%state%manifold%Valve(126)%RemoveAdjacent(128) + call data%state%manifold%Valve(128)%RemoveAdjacent(126) - call Manifold%Valve(126)%AdjacentTo(70) - call Manifold%Valve(70)%AdjacentTo(126) + call data%state%manifold%Valve(126)%AdjacentTo(70) + call data%state%manifold%Valve(70)%AdjacentTo(126) - call Manifold%Valve(128)%AdjacentTo(70) - call Manifold%Valve(70)%AdjacentTo(128) + call data%state%manifold%Valve(128)%AdjacentTo(70) + call data%state%manifold%Valve(70)%AdjacentTo(128) -# 1182 +# 1123 call OpenTopDriveIBop() end subroutine subroutine RemoveTopDriveIBop() implicit none - Manifold%IsTopDriveIBopInstalled = .false. + data%state%manifold%IsTopDriveIBopInstalled = .false. - call Manifold%Valve(126)%RemoveAdjacent(70) - call Manifold%Valve(70)%RemoveAdjacent(126) + call data%state%manifold%Valve(126)%RemoveAdjacent(70) + call data%state%manifold%Valve(70)%RemoveAdjacent(126) - call Manifold%Valve(128)%RemoveAdjacent(70) - call Manifold%Valve(70)%RemoveAdjacent(128) + call data%state%manifold%Valve(128)%RemoveAdjacent(70) + call data%state%manifold%Valve(70)%RemoveAdjacent(128) - call Manifold%Valve(126)%AdjacentTo(128) - call Manifold%Valve(128)%AdjacentTo(126) + call data%state%manifold%Valve(126)%AdjacentTo(128) + call data%state%manifold%Valve(128)%AdjacentTo(126) -# 1201 +# 1142 - Manifold%TopDriveIBop = .false. - call ChangeValve(70, Manifold%TopDriveIBop) + data%state%manifold%TopDriveIBop = .false. + call ChangeValve(70, data%state%manifold%TopDriveIBop) end subroutine subroutine OpenTopDriveIBop() implicit none - if(.not.Manifold%IsTopDriveIBopInstalled) return - Manifold%TopDriveIBop = .true. - call ChangeValve(70, Manifold%TopDriveIBop) -# 1213 + if(.not.data%state%manifold%IsTopDriveIBopInstalled) return + data%state%manifold%TopDriveIBop = .true. + call ChangeValve(70, data%state%manifold%TopDriveIBop) +# 1154 end subroutine subroutine CloseTopDriveIBop() implicit none - if(.not.Manifold%IsTopDriveIBopInstalled) return - Manifold%TopDriveIBop = .false. - call ChangeValve(70, Manifold%TopDriveIBop) -# 1223 + if(.not.data%state%manifold%IsTopDriveIBopInstalled) return + data%state%manifold%TopDriveIBop = .false. + call ChangeValve(70, data%state%manifold%TopDriveIBop) +# 1164 end subroutine @@ -1199,55 +1152,55 @@ end subroutine PathFinding_Step subroutine InstallFloatValve() implicit none - Manifold%IsFloatValveInstalled = .true. + data%state%manifold%IsFloatValveInstalled = .true. - call Manifold%Valve(69)%RemoveAdjacent(79) - call Manifold%Valve(79)%RemoveAdjacent(69) + call data%state%manifold%Valve(69)%RemoveAdjacent(79) + call data%state%manifold%Valve(79)%RemoveAdjacent(69) - call Manifold%Valve(48)%AdjacentTo(69) - call Manifold%Valve(48)%AdjacentTo(79) + call data%state%manifold%Valve(48)%AdjacentTo(69) + call data%state%manifold%Valve(48)%AdjacentTo(79) - call Manifold%Valve(69)%AdjacentTo(48) - call Manifold%Valve(79)%AdjacentTo(48) -# 1248 + call data%state%manifold%Valve(69)%AdjacentTo(48) + call data%state%manifold%Valve(79)%AdjacentTo(48) +# 1189 call OpenFloatValve() end subroutine subroutine RemoveFloatValve() implicit none - Manifold%IsFloatValveInstalled = .false. + data%state%manifold%IsFloatValveInstalled = .false. - call Manifold%Valve(48)%RemoveAdjacent(69) - call Manifold%Valve(48)%RemoveAdjacent(79) + call data%state%manifold%Valve(48)%RemoveAdjacent(69) + call data%state%manifold%Valve(48)%RemoveAdjacent(79) - call Manifold%Valve(69)%RemoveAdjacent(48) - call Manifold%Valve(79)%RemoveAdjacent(48) + call data%state%manifold%Valve(69)%RemoveAdjacent(48) + call data%state%manifold%Valve(79)%RemoveAdjacent(48) - call Manifold%Valve(69)%AdjacentTo(79) - call Manifold%Valve(79)%AdjacentTo(69) -# 1266 + call data%state%manifold%Valve(69)%AdjacentTo(79) + call data%state%manifold%Valve(79)%AdjacentTo(69) +# 1207 - Manifold%FloatValve = .false. - call ChangeValve(48, Manifold%FloatValve) + data%state%manifold%FloatValve = .false. + call ChangeValve(48, data%state%manifold%FloatValve) end subroutine subroutine OpenFloatValve() implicit none - if(.not.Manifold%IsFloatValveInstalled) return - Manifold%FloatValve = .true. -# 1277 + if(.not.data%state%manifold%IsFloatValveInstalled) return + data%state%manifold%FloatValve = .true. +# 1218 - call ChangeValve(48, Manifold%FloatValve) + call ChangeValve(48, data%state%manifold%FloatValve) end subroutine subroutine CloseFloatValve() implicit none - if(.not.Manifold%IsFloatValveInstalled) return - Manifold%FloatValve = .false. -# 1287 + if(.not.data%state%manifold%IsFloatValveInstalled) return + data%state%manifold%FloatValve = .false. +# 1228 - call ChangeValve(48, Manifold%FloatValve) + call ChangeValve(48, data%state%manifold%FloatValve) end subroutine @@ -1260,22 +1213,22 @@ end subroutine PathFinding_Step implicit none logical, intent(in) :: v if(v) then - call Manifold%Valve(14)%RemoveAdjacent(78) + call data%state%manifold%Valve(14)%RemoveAdjacent(78) - call Manifold%Valve(14)%AdjacentTo(57) - call Manifold%Valve(57)%AdjacentTo(14) - call Manifold%Valve(57)%AdjacentTo(103) - call Manifold%Valve(103)%AdjacentTo(57) + call data%state%manifold%Valve(14)%AdjacentTo(57) + call data%state%manifold%Valve(57)%AdjacentTo(14) + call data%state%manifold%Valve(57)%AdjacentTo(103) + call data%state%manifold%Valve(103)%AdjacentTo(57) else - call Manifold%Valve(14)%RemoveAdjacent(57) - call Manifold%Valve(57)%RemoveAdjacent(14) - call Manifold%Valve(57)%RemoveAdjacent(103) - call Manifold%Valve(103)%RemoveAdjacent(57) + call data%state%manifold%Valve(14)%RemoveAdjacent(57) + call data%state%manifold%Valve(57)%RemoveAdjacent(14) + call data%state%manifold%Valve(57)%RemoveAdjacent(103) + call data%state%manifold%Valve(103)%RemoveAdjacent(57) - call Manifold%Valve(14)%AdjacentTo(78) + call data%state%manifold%Valve(14)%AdjacentTo(78) endif - Manifold%IsPathsDirty = .true. + data%state%manifold%IsPathsDirty = .true. call ChangeValve(57, .true.) end subroutine @@ -1285,46 +1238,38 @@ end subroutine PathFinding_Step call ChangeValve(53, v) end subroutine - - - - - - - - subroutine ToggleMiddleRams(v) implicit none logical, intent(in) :: v - Manifold%Valve(50)%Status = v + data%state%manifold%Valve(50)%Status = v call ChangeValve(69, v) end subroutine - - - - - - - + subroutine ToggleValve(i) bind(C,name="ToggleValve") + integer :: i + logical :: currentStatus + currentStatus = data%State%Manifold%Valve(i)%Status + call ChangeValve(i,.not. currentStatus) + end subroutine + subroutine ChangeValve(i, state) implicit none integer, intent(in) :: i logical, intent(in) :: state - if(Manifold%Valve(i)%Status==state) return - Manifold%Valve(i)%Status = state + if(data%state%manifold%Valve(i)%Status==state) return + data%state%manifold%Valve(i)%Status = state if(i == 41 .or. i == 42) then - if(Manifold%Valve(41)%Status == .false. .and. Manifold%Valve(42)%Status == .false.) then - Manifold%Valve(60)%Status = .true. + if(data%state%manifold%Valve(41)%Status == .false. .and. data%state%manifold%Valve(42)%Status == .false.) then + data%state%manifold%Valve(60)%Status = .true. else - Manifold%Valve(60)%Status = .false. + data%state%manifold%Valve(60)%Status = .false. endif endif -# 1364 +# 1297 !call Traverse() - Manifold%IsPathsDirty = .true. + data%state%manifold%IsPathsDirty = .true. end subroutine @@ -1334,9 +1279,9 @@ end subroutine PathFinding_Step subroutine DisplayOpenPaths() implicit none integer :: i - if(allocated(Manifold%OpenPaths)) then - do i = 1, size(Manifold%OpenPaths) - call Manifold%OpenPaths(i)%Display() + if(allocated(data%state%manifold%OpenPaths)) then + do i = 1, size(data%state%manifold%OpenPaths) + call data%state%manifold%OpenPaths(i)%Display() end do end if end subroutine @@ -1344,9 +1289,9 @@ end subroutine PathFinding_Step subroutine DisplayOpenPathsWrite() implicit none integer :: i - if(allocated(Manifold%OpenPaths)) then - do i = 1, size(Manifold%OpenPaths) - call Manifold%OpenPaths(i)%DisplayWrite() + if(allocated(data%state%manifold%OpenPaths)) then + do i = 1, size(data%state%manifold%OpenPaths) + call data%state%manifold%OpenPaths(i)%DisplayWrite() end do end if end subroutine diff --git a/CSharp/Equipments/MudPathFinding/CPath.i90 b/CSharp/Equipments/MudPathFinding/CPath.i90 new file mode 100644 index 0000000..431536a --- /dev/null +++ b/CSharp/Equipments/MudPathFinding/CPath.i90 @@ -0,0 +1,232 @@ +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/MudPathFinding/CPath.f90" +module CPath + use CLog5 + implicit none + public + + type, public :: Path + integer, allocatable :: Valves(:) + logical :: IsClosed + contains + procedure :: Display => Display + procedure :: DisplayWrite => DisplayWrite + procedure :: First => First + procedure :: Last => Last + procedure :: Length => Length + procedure :: Get => Get + procedure :: Add => Add + procedure :: Remove => Remove + procedure :: Purge => Purge + procedure :: Copy => Copy + procedure :: MakeNull => MakeNull + procedure :: IsNull => IsNull + procedure :: Equal => Equal + procedure :: Find => Find + end type Path + + contains + + + subroutine DisplayWrite(this) + implicit none + class(Path), intent(in) :: this + character(len=512) :: temp + integer :: i + if(allocated(this%valves)) then + write(temp, '(a1,i0,a3,i0,a4,9999(g0))') '(', this%First(), '<=>', this%Last(), ') : ', (this%Valves(i), ", ",i=1,size(this%Valves)) + write(*,*) temp + end if + end subroutine + + subroutine Display(this) + implicit none + class(Path), intent(in) :: this + character(len=512) :: temp + integer :: i + if(allocated(this%valves)) then + write(temp, '(a1,i0,a3,i0,a4,9999(g0))') '(', this%First(), '<=>', this%Last(), ') : ', (this%Valves(i), ", ",i=1,size(this%Valves)) + call Log_5(temp) + end if + end subroutine + + integer function First(this) + implicit none + class(Path), intent(in) :: this + if(allocated(this%Valves) .and. size(this%Valves) > 0) then + First = this%Valves(1) + return + end if + First = 0 + end function + + integer function Last(this) + implicit none + class(Path), intent(in) :: this + if(allocated(this%Valves) .and. size(this%Valves) > 0) then + Last = this%Valves(size(this%Valves)) + return + end if + Last = 0 + end function + + integer function Length(this) + implicit none + class(Path), intent(in) :: this + if(allocated(this%Valves)) then + Length = size(this%Valves) + return + end if + Length = 0 + end function + + integer function Get(this, index) + implicit none + class(Path), intent(in) :: this + integer, intent(in) :: index + if(allocated(this%Valves)) then + + if(index < 1 .or. index > size(this%Valves)) then + Get = -1 + return + endif + + Get = this%Valves(index) + return + end if + get = -1 + end function + + subroutine Add(this, value) + implicit none + class(Path), intent(inout) :: this + integer, allocatable :: tempArr(:) + integer, intent(in) :: value + integer :: i, isize + + if(allocated(this%Valves)) then + isize = size(this%Valves) + allocate(tempArr(isize+1)) + do i=1,isize + tempArr(i) = this%Valves(i) + end do + tempArr(isize+1) = value + deallocate(this%Valves) + call move_alloc(tempArr, this%Valves) + else + allocate(this%Valves(1)) + this%Valves(1) = value + end if + + end subroutine + + subroutine Remove(this, index) + implicit none + class(Path), intent(inout) :: this + integer, intent(in) :: index + integer, allocatable :: tempArr(:) + integer :: i + logical :: found + + if(index <= 0 .or. index > size(this%Valves)) return + if(.not.allocated(this%Valves))return + allocate(tempArr(size(this%Valves)-1)) + found = .false. + do i=1, size(this%Valves) + if(i==index) then + found = .true. + cycle + end if + if(found) then + tempArr(i-1) = this%Valves(i) + else + tempArr(i) = this%Valves(i) + endif + end do + deallocate(this%valves) + call move_alloc(tempArr, this%valves) + end subroutine + + + subroutine Purge(this, min, max) + implicit none + class(Path), intent(inout) :: this + integer, intent(in) :: min + integer, intent(in) :: max + integer :: i + + i = 1 + do +! + if(this%Valves(i) >= min .and. this%Valves(i) <= max) then + call this%Remove(i) + else + i = i + 1 + endif + + if(i > this%Length()) exit + enddo + + end subroutine + + + subroutine Copy(this, from) + implicit none + class(Path), intent(inout) :: this + class(Path), intent(in) :: from + if(allocated(from%Valves)) then + if(allocated(this%Valves)) deallocate(this%Valves) + allocate(this%Valves(size(from%Valves))) + this%Valves(:) = from%Valves(:) + end if + end subroutine + + subroutine MakeNull(this) + implicit none + class(Path), intent(inout) :: this + if(allocated(this%Valves)) deallocate(this%Valves) + end subroutine + + logical function IsNull(this) + implicit none + class(Path), intent(in) :: this + IsNull = .not.allocated(this%Valves) + return + end function + + logical function Equal(this, otherPath) + implicit none + class(Path), intent(inout) :: this + class(Path), intent(in) :: otherPath + integer :: i, sizeThis, sizeOtherPath + + sizeThis = size(this%Valves) + sizeOtherPath = size(otherPath%Valves) + + if(sizeThis /= sizeOtherPath) then + Equal = .false. + return + end if + + do i = 1, sizeThis + if(this%Valves(i) /= otherPath%Valves(i)) then + Equal = .false. + return + end if + end do + + Equal = .true. + return + end function + + logical function Find(this, value) + implicit none + class(Path), intent(in) :: this + integer, intent(in) :: value + if(allocated(this%Valves)) then + Find = any(this%Valves == value) + return + end if + Find = .false. + end function + +end module CPath diff --git a/CSharp/Equipments/MudPathFinding/CStack.i90 b/CSharp/Equipments/MudPathFinding/CStack.i90 new file mode 100644 index 0000000..3c3e14a --- /dev/null +++ b/CSharp/Equipments/MudPathFinding/CStack.i90 @@ -0,0 +1,43 @@ +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/MudPathFinding/CStack.f90" +module CStack + use CPath,Only:Path + implicit none + public + + type, public :: Stack + type(Path) :: List + contains + procedure :: Clear => Clear + procedure :: Push => Push + procedure :: Pop => Pop + procedure :: DoesHave => DoesHave + end type Stack + contains + + subroutine Clear(this) + implicit none + class(Stack), intent(inout) :: this + call this%List%MakeNull() + end subroutine + + subroutine Push(this, value) + implicit none + class(Stack), intent(inout) :: this + integer, intent(in) :: value + call this%List%Add(value) + end subroutine + + subroutine Pop(this) + implicit none + class(Stack), intent(inout) :: this + call this%List%Remove(this%List%Length()) + end subroutine + + logical function DoesHave(this, value) + implicit none + class(Stack), intent(in) :: this + integer, intent(in) :: value + DoesHave = this%List%Find(value) + end function + +end module CStack diff --git a/CSharp/Equipments/MudPathFinding/ManifoldVariables.i90 b/CSharp/Equipments/MudPathFinding/ManifoldVariables.i90 new file mode 100644 index 0000000..e72a3e0 --- /dev/null +++ b/CSharp/Equipments/MudPathFinding/ManifoldVariables.i90 @@ -0,0 +1,38 @@ +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/MudPathFinding/ManifoldVariables.f90" +module ManifoldVariables + use CStack + use CArrangement +! use SimulationVariables +! use CStandPipeManifoldVariables + implicit none + + public + integer, parameter :: ValveCount = 128 + integer, parameter :: MinSource = 71 + integer, parameter :: MaxSource = 90 + integer, parameter :: MinRelation = 91 + integer, parameter :: MaxRelation = 128 + + Type::ManifoldType + type(Arrangement) :: Valve(ValveCount) + type(Path), allocatable :: OpenPaths(:) + type(Stack) :: Fringe + logical :: IsRepititveOutput + + logical :: IsSafetyValveInstalled + logical :: IsSafetyValveInstalled_KellyMode + logical :: IsSafetyValveInstalled_TripMode + logical :: IsSafetyValveInstalled_TopDrive + logical :: SafetyValve + logical :: IsIBopInstalled + logical :: IBop + logical :: IsKellyCockInstalled + logical :: KellyCock + logical :: IsTopDriveIBopInstalled + logical :: TopDriveIBop + logical :: IsFloatValveInstalled + logical :: FloatValve + logical :: IsPathsDirty = .false. + logical :: IsTraverse = .false. + End type ManifoldType +End module ManifoldVariables diff --git a/CSharp/Equipments/Tanks/CTanks.i90 b/CSharp/Equipments/Tanks/CTanks.i90 index 72291f5..d208654 100644 --- a/CSharp/Equipments/Tanks/CTanks.i90 +++ b/CSharp/Equipments/Tanks/CTanks.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/Tanks/CTanks.f90" +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/Tanks/CTanks.f90" module CTanks use SimulationVariables @@ -92,9 +92,8 @@ logical, intent(in) :: v data%Equipments%Tank%ManualPumpPower = v call ChangeValve(43, v) - #ifdef deb - if(print_log) print*, 'ManualPumpPower=', data%Equipments%Tank%ManualPumpPower - #endif +# 96 + end subroutine diff --git a/CSharp/Equipments/Tanks/CTanksVariables.i90 b/CSharp/Equipments/Tanks/CTanksVariables.i90 index 267ec9f..118a574 100644 --- a/CSharp/Equipments/Tanks/CTanksVariables.i90 +++ b/CSharp/Equipments/Tanks/CTanksVariables.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/Tanks/CTanksVariables.f90" +# 1 "/home/admin/SimulationCore2/CSharp/Equipments/Tanks/CTanksVariables.f90" module CTanksVariables implicit none public diff --git a/CSharp/OperationScenarios/Common/COperationScenariosMain.f90 b/CSharp/OperationScenarios/Common/COperationScenariosMain.f90 index 6393498..46d1ac2 100644 --- a/CSharp/OperationScenarios/Common/COperationScenariosMain.f90 +++ b/CSharp/OperationScenarios/Common/COperationScenariosMain.f90 @@ -29,16 +29,8 @@ module COperationScenariosMain use SoftwareInputsVariables use UnityModule - ! use CElevatorEnum - ! use CIbopEnum - ! use CKellyEnum - ! use CMouseHoleEnum use UnitySignalsModule - ! use CSafetyValveEnum - ! use CSlipsEnum - ! use CSwingEnum use CTongEnum - ! use CFlowPipeDisconnectEnum use CFlowKellyDisconnectEnum use CFillupHeadPermission use CSwingDrillPermission @@ -116,16 +108,16 @@ module COperationScenariosMain !topdrive - call Evaluate_TdsElevatorModes() - call Evaluate_TdsConnectionModes() - call Evaluate_SwingTiltPermission() - call Evaluate_SwingOffPermission() - call Evaluate_SwingDrillPermission() - call Evaluate_FillupHeadPermission() - call Evaluate_TdsTong() - call Evaluate_TdsBackupClamp() - call Evaluate_TdsSwing() - call Evaluate_TdsSpine() + ! call Evaluate_TdsElevatorModes() + ! call Evaluate_TdsConnectionModes() + ! call Evaluate_SwingTiltPermission() + ! call Evaluate_SwingOffPermission() + ! call Evaluate_SwingDrillPermission() + ! call Evaluate_FillupHeadPermission() + ! call Evaluate_TdsTong() + ! call Evaluate_TdsBackupClamp() + ! call Evaluate_TdsSwing() + ! call Evaluate_TdsSpine() call Evaluate_PowerLed() call Evaluate_IbopLed() diff --git a/CSharp/OperationScenarios/Common/COperationScenariosMain.i90 b/CSharp/OperationScenarios/Common/COperationScenariosMain.i90 index afd07c2..406be38 100644 --- a/CSharp/OperationScenarios/Common/COperationScenariosMain.i90 +++ b/CSharp/OperationScenarios/Common/COperationScenariosMain.i90 @@ -1,13 +1,12 @@ # 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Common/COperationScenariosMain.f90" module COperationScenariosMain use CIActionReference + use UnitySignalsModule implicit none public -! procedure (ActionVoid), pointer :: UpdateUnityPtr contains subroutine OperationScenarios_Step -! use CSimulationVariables use OperationScenariosModule use CElevatorConnectionEnum use CCloseKellyCockLedNotification @@ -29,42 +28,23 @@ module COperationScenariosMain use CRemoveFillupHeadPermission use CRemoveMudBucketPermission use SoftwareInputsVariables -! use CHookHeight -! use CIbopHeight -! use CNearFloorConnection -! use CSafetyValveHeight -! use CSlackOff -! use CStandRack -! use CStringPressure -! use CZeroStringSpeed -! use CUnityInputs, only: & -! Get_ElevatorConnectionPossible, & -! Get_JointConnectionPossible, & -! Get_ElevatorPickup, & -! Get_NearFloorPosition, & -! Get_SingleSetInMouseHole -! use CBucketEnum -! use UnitySignalsModule + use UnityModule - use CElevatorEnum -! use CHeadEnum - use CIbopEnum - use CKellyEnum - use CMouseHoleEnum +! use CElevatorEnum +! use CIbopEnum +! use CKellyEnum +! use CMouseHoleEnum use UnitySignalsModule - use CSafetyValveEnum - use CSlipsEnum - use CSwingEnum +! use CSafetyValveEnum +! use CSlipsEnum +! use CSwingEnum use CTongEnum -! use CStringUpdate - use CFlowPipeDisconnectEnum +! use CFlowPipeDisconnectEnum use CFlowKellyDisconnectEnum use CFillupHeadPermission use CSwingDrillPermission use CSwingOffPermission use CSwingTiltPermission -! use CTdsStemJointHeight -! use UnitySignalsModule !for CTdsConnectionModesEnum use CTdsElevatorModesEnum use CTdsSpineEnum use CTdsSwingEnum @@ -73,7 +53,8 @@ module COperationScenariosMain use CTdsIbopLedNotification use CTdsPowerLedNotification use CTdsTorqueWrenchLedNotification - + use CElevatorConnectionEnum + implicit none call Evaluate_KellyConnection() @@ -100,22 +81,21 @@ module COperationScenariosMain call Evaluate_RemoveMudBucketPermission() call Evaluate_MudBucket() - call Evaluate_Elevator() +! call Evaluate_Elevator() call Evaluate_FillupHead() - call Evaluate_Ibop() - call Evaluate_Kelly() - call Evaluate_MouseHole() - call Evaluate_MouseHole() - call Evaluate_OperationCondition() - call Evaluate_SafetyValve() - call Evaluate_Slips() - call Evaluate_Swing() - call Evaluate_Tong() +! call Evaluate_Ibop() is empty, so i commented (mahmood) +! call Evaluate_Kelly() is empty, so i commented (mahmood) +! call Evaluate_MouseHole() +! call Evaluate_OperationCondition() +! call Evaluate_SafetyValve() +! call Evaluate_Slips() +! call Evaluate_Swing() +! call Evaluate_Tong() ! call Evaluate_StringUpdate() - call Evaluate_FlowKellyDisconnect() - call Evaluate_FlowPipeDisconnect() +! call Evaluate_FlowKellyDisconnect() is empty, so i commented (mahmood) +! call Evaluate_FlowPipeDisconnect() is empty, so i commented (mahmood) !if(Get_FillMouseHoleLed()) then ! call Set_MouseHole(MOUSE_HOLE_FILL) @@ -137,16 +117,16 @@ module COperationScenariosMain !topdrive - call Evaluate_TdsElevatorModes() - call Evaluate_TdsConnectionModes() - call Evaluate_SwingTiltPermission() - call Evaluate_SwingOffPermission() - call Evaluate_SwingDrillPermission() - call Evaluate_FillupHeadPermission() - call Evaluate_TdsTong() - call Evaluate_TdsBackupClamp() - call Evaluate_TdsSwing() - call Evaluate_TdsSpine() +! call Evaluate_TdsElevatorModes() +! call Evaluate_TdsConnectionModes() +! call Evaluate_SwingTiltPermission() +! call Evaluate_SwingOffPermission() +! call Evaluate_SwingDrillPermission() +! call Evaluate_FillupHeadPermission() +! call Evaluate_TdsTong() +! call Evaluate_TdsBackupClamp() +! call Evaluate_TdsSwing() +! call Evaluate_TdsSpine() call Evaluate_PowerLed() call Evaluate_IbopLed() @@ -160,13 +140,13 @@ module COperationScenariosMain ! if(associated(UpdateUnityPtr)) call UpdateUnityPtr() ! end subroutine - subroutine Kelly_ConnectionNothing + subroutine Kelly_ConnectionNothing() bind (C,name="Kelly_ConnectionNothine") use UnitySignalVariables - use UnitySignalsModule use CHook use SimulationVariables implicit none - +! call logg(4,"Kelly_ConnectionNothing started") + print *,"Kelly_ConnectionNothing started" call Set_HookHeight(75.0) call sleep(1) @@ -207,12 +187,13 @@ module COperationScenariosMain ! move to final hook height call Update_HookHeight_From_Snapshot() call sleep(3) - +! call logg(4,"Kelly_ConnectionNothing end") + print *,"Kelly_ConnectionNothing end" + end subroutine Kelly_ConnectionNothing - subroutine Kelly_ConnectionString + subroutine Kelly_ConnectionString() BIND(C,name='Kelly_ConnectionString') use UnitySignalVariables - use UnitySignalsModule use CHook use SimulationVariables implicit none @@ -269,12 +250,8 @@ module COperationScenariosMain end subroutine Kelly_ConnectionString - subroutine Kelly_ConnectionSingle -! use CSwingEnumVariables -! use CSlipsEnumVariables -! use CTongEnumVariables + subroutine Kelly_ConnectionSingle() BIND(C,name='Kelly_ConnectionSingle') use UnitySignalVariables - use UnitySignalsModule use CHook use SimulationVariables implicit none @@ -344,9 +321,8 @@ module COperationScenariosMain end subroutine Kelly_ConnectionSingle - subroutine Elevator_ConnectionNothing + subroutine Elevator_ConnectionNothing() BIND(C,name='Elevator_ConnectionNothing') use UnitySignalVariables - use UnitySignalsModule use CHook use SimulationVariables implicit none diff --git a/CSharp/OperationScenarios/Common/COperationScenariosSettings.f90 b/CSharp/OperationScenarios/Common/COperationScenariosSettings.f90 index 17ae952..fd7a8d4 100644 --- a/CSharp/OperationScenarios/Common/COperationScenariosSettings.f90 +++ b/CSharp/OperationScenarios/Common/COperationScenariosSettings.f90 @@ -152,7 +152,8 @@ module COperationScenariosSettings ! !end subroutine - subroutine SetDefaultValues() + ! subroutine SetDefaultValues() + subroutine OperationScenarios_Init() use OperationScenariosModule use CHoistingVariables use SimulationVariables @@ -305,13 +306,8 @@ module COperationScenariosSettings !SAFETY_VALVE_REMOVE if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call Set_SafetyValve(SAFETY_VALVE_REMOVE) - call Set_Slips(SLIPS_SET_BEGIN) + call Set_Slips(SLIPS_SET_END) !Get_Slips() - !SLIPS_NEUTRAL - !SLIPS_SET_BEGIN - !SLIPS_SET_END - !SLIPS_UNSET_BEGIN - !SLIPS_UNSET_END call Set_Swing(SWING_WELL_BEGIN) !Get_Swing() @@ -467,23 +463,13 @@ module COperationScenariosSettings !TDS_SPINE_DISCONNECT_BEGIN !TDS_SPINE_DISCONNECT_END - - - - - - - - - - end subroutine - subroutine SetDefaults_WN() - !DEC$ ATTRIBUTES DLLEXPORT :: SetDefaults_WN - !DEC$ ATTRIBUTES ALIAS: 'SetDefaults_WN' :: SetDefaults_WN - implicit none - call SetDefaultValues() - end subroutine + ! subroutine SetDefaults_WN() + ! !DEC$ ATTRIBUTES DLLEXPORT :: SetDefaults_WN + ! !DEC$ ATTRIBUTES ALIAS: 'SetDefaults_WN' :: SetDefaults_WN + ! implicit none + ! call SetDefaultValues() + ! end subroutine end module COperationScenariosSettings \ No newline at end of file diff --git a/CSharp/OperationScenarios/Common/COperationScenariosSettings.i90 b/CSharp/OperationScenarios/Common/COperationScenariosSettings.i90 new file mode 100644 index 0000000..717e3a8 --- /dev/null +++ b/CSharp/OperationScenarios/Common/COperationScenariosSettings.i90 @@ -0,0 +1,476 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Common/COperationScenariosSettings.f90" +module COperationScenariosSettings + implicit none + public + contains + +!subroutine Initialization() +! ! use CSimulationVariables +! use CUnityOutputs, only: SetupUnityOutputs => Setup +! +! use CBucketEnum +! use CTongEnum +! use CSwingEnum +! use CSlipsEnum +! use CSafetyValveEnum +! use UnitySignalsModule +! use CMouseHoleEnum +! use CKellyEnum +! use OperationScenariosModule +! use CIbopEnum +! use CHeadEnum +! use CElevatorEnum +! use CElevatorConnectionEnum +! +! use CInstallFillupHeadPermission +! use CInstallMudBucketPermission +! use CIrIbopPermission +! use CIrSafetyValvePermission +! use CRemoveFillupHeadPermission +! use CRemoveMudBucketPermission +! +! use CCloseKellyCockLedNotification +! use CCloseSafetyValveLedNotification +! use CFillMouseHoleLedNotification +! use CIrIBopLedNotification +! use CIrSafetyValveLedNotification +! use CLatchLedNotification +! use COpenKellyCockLedNotification +! use COpenSafetyValveLedNotification +! use CSlipsNotification +! use CSwingLedNotification +! use CTongNotification +! use CUnlatchLedNotification +! +! use CHookHeight +! use CIbopHeight +! use CNearFloorConnection +! use CSafetyValveHeight +! use CSlackOff +! use CStandRack +! use CStringPressure +! use CZeroStringSpeed +! +! use CStringUpdate +! +! use CFlowPipeDisconnectEnum +! use CFlowKellyDisconnectEnum +! +! use CFillupHeadPermission +! use CSwingDrillPermission +! use CSwingOffPermission +! use CSwingTiltPermission +! use CTdsStemJointHeight +! use UnitySignalsModule !for CTdsConnectionModesEnum +! use CTdsElevatorModesEnum +! use CTdsSpineEnum +! use CTdsSwingEnum +! use CTdsTongEnum +! use CTdsBackupClamp +! +! use CTdsIbopLedNotification +! use CTdsPowerLedNotification +! +! use CTdsTorqueWrenchLedNotification +! +! implicit none +! +! call SetupUnityOutputs() +! +! call Subscribe_Tong() +! call Subscribe_MudBucket() +! call Subscribe_ElevatorConnection() +! call Subscribe_Elevator() +! call Subscribe_FillupHead() +! call Subscribe_Ibop() +! call Subscribe_KellyConnection() +! call Subscribe_Kelly() +! call Subscribe_MouseHole() +! call Subscribe_OperationCondition() +! call Subscribe_SafetyValve() +! call Subscribe_Slips() +! call Subscribe_Swing() +! +! +! call Subscribe_InstallFillupHeadPermission() +! call Subscribe_InstallMudBucketPermission() +! call Subscribe_IrIbopPermission() +! call Subscribe_IrSafetyValvePermission() +! call Subscribe_RemoveFillupHeadPermission() +! call Subscribe_RemoveMudBucketPermission() +! +! call Subscribe_CloseKellyCockLed() +! call Subscribe_CloseSafetyValveLed() +! call Subscribe_FillMouseHoleLed() +! call Subscribe_IrIBopLed() +! call Subscribe_IrSafetyValveLed() +! call Subscribe_LatchLed() +! call Subscribe_OpenKellyCockLed() +! call Subscribe_OpenSafetyValveLed() +! call Subscribe_SlipsNotification() +! call Subscribe_SwingLed() +! call Subscribe_UnlatchLed() +! +! call Subscribe_HookHeight() +! call Subscribe_IbopHeight() +! call Subscribe_NearFloorConnection() +! call Subscribe_SafetyValveHeight() +! call Subscribe_SlackOff() +! call Subscribe_StringPressure() +! call Subscribe_ZeroStringSpeed() +! call Subscribe_StandRack() +! +! call Subscribe_StringUpdate() +! +! call Subscribe_TongNotification() +! +! call Subscribe_FlowKellyDisconnect() +! call Subscribe_FlowPipeDisconnect() +! +! +! +! +! +! !top drive +! call Subscribe_TdsConnectionModes() +! call Subscribe_TdsElevatorModes() +! call Subscribe_FillupHeadPermission() +! call Subscribe_SwingDrillPermission() +! call Subscribe_SwingOffPermission() +! call Subscribe_SwingTiltPermission() +! call Subscribe_TdsStemJointHeight() +! call Subscribe_TdsTong() +! call Subscribe_TdsBackupClamp() +! call Subscribe_TdsSwing() +! call Subscribe_TdsSpine() +! call Subscribe_PowerLed() +! call Subscribe_IbopLed() +! +! call Subscribe_TorqueWrenchLed() +! +! +! call OnSimulationStart%Add(SetDefaultValues) +! +!end subroutine + +! subroutine SetDefaultValues() + subroutine OperationScenarios_Init() + use OperationScenariosModule + use CHoistingVariables + use SimulationVariables + use CManifolds, only: RemoveSafetyValve_TripMode, RemoveSafetyValve_KellyMode + implicit none + + call Set_KellyConnection(KELLY_CONNECTION_NOTHING) +!Get_KellyConnection() +!KELLY_CONNECTION_NOTHING +!KELLY_CONNECTION_STRING +!KELLY_CONNECTION_SINGLE + call Set_ElevatorConnection(ELEVATOR_CONNECTION_NOTHING) +!Get_ElevatorConnection() +!ELEVATOR_CONNECTION_NOTHING +!ELEVATOR_CONNECTION_STRING +!ELEVATOR_CONNECTION_STAND +!ELEVATOR_CONNECTION_SINGLE +!ELEVATOR_LATCH_STRING +!ELEVATOR_LATCH_SINGLE +!ELEVATOR_LATCH_STAND + + + + + + + + + call Set_CloseKellyCockLed(.false.) !Get_CloseKellyCockLed() + call Set_CloseSafetyValveLed(.false.) !Get_CloseSafetyValveLed() + call Set_FillMouseHoleLed(.true.) !Get_FillMouseHoleLed() + call Set_IrIBopLed(.false.) !Get_IrIBopLed() +!call Set_IrSafetyValveLed(.true.) !Get_IrSafetyValveLed() + if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then + call RemoveSafetyValve_TripMode() + call RemoveSafetyValve_KellyMode() + call Set_IrSafetyValveLed(.false.) + else + call Set_IrSafetyValveLed(.true.) + endif + call Set_LatchLed(.false.) !Get_LatchLed() + call Set_OpenKellyCockLed(.true.) !Get_OpenKellyCockLed() + call Set_OpenSafetyValveLed(.true.) !Get_OpenSafetyValveLed() + call Set_SlipsNotification(.false.) !Get_SlipsNotification() + call Set_SwingLed(.false.) !Get_SwingLed() + call Set_TongNotification(.false.) !Get_TongNotification() + call Set_UnlatchLed(.false.) !Get_UnlatchLed() + + + + + + + + call Set_InstallFillupHeadPermission(.false.) !Get_InstallFillupHeadPermission() + call Set_InstallMudBucketPermission(.false.) !Get_InstallMudBucketPermission() + call Set_IrIbopPermission(.false.) !Get_IrIbopPermission() + call Set_IrSafetyValvePermission(.false.) !Get_IrSafetyValvePermission() + call Set_RemoveFillupHeadPermission(.false.) !Get_RemoveFillupHeadPermission() + call Set_RemoveMudBucketPermission(.false.) !Get_RemoveMudBucketPermission() + + + + + + + + + +!call Set_HookHeight(REAL(70.0, 8)) !Get_HookHeight() + call Set_IbopHeight(3.0) !Get_IbopHeight() +!call Set_NearFloorConnection(3.0) !Get_NearFloorConnection() + call Set_SafetyValveHeight(3.0) !Get_SafetyValveHeight() + call Set_SlackOff(.true.) !Get_SlackOff() +!call Set_StandRack(0.0) !Get_StandRack() +!call Set_StringPressure(0.0) !Get_StringPressure() +!call Set_ZeroStringSpeed(.true.) !Get_ZeroStringSpeed() + + + + + + + + +!Get_ElevatorConnected() +!Get_JointConnection() +!Get_NearMonkeyBoardPosition() +!Get_NearFloorPosition() +!Get_SingleSetInMouseHole() +!Get_SwingCenter() + + + + + + + call Set_MudBucket(MUD_BUCKET_REMOVE) +!Get_MudBucket() +!MUD_BUCKET_INSTALL +!MUD_BUCKET_REMOVE + + call Set_Elevator(ELEVATOR_NEUTRAL) +! Get_Elevator() +!ELEVATOR_NEUTRAL +!ELEVATOR_LATCH_STRING_BEGIN +!ELEVATOR_LATCH_STRING_END +!ELEVATOR_UNLATCH_STRING_BEGIN +!ELEVATOR_UNLATCH_STRING_END +!ELEVATOR_LATCH_STAND_BEGIN +!ELEVATOR_LATCH_STAND_END +!ELEVATOR_UNLATCH_STAND_BEGIN +!ELEVATOR_UNLATCH_STAND_END +!ELEVATOR_LATCH_SINGLE_BEGIN +!ELEVATOR_LATCH_SINGLE_END +!ELEVATOR_UNLATCH_SINGLE_BEGIN +!ELEVATOR_UNLATCH_SINGLE_END + + call Set_FillupHead(FILLUP_HEAD_REMOVE) +!Get_FillupHead() +!FILLUP_HEAD_INSTALL +!FILLUP_HEAD_REMOVE + + call Set_Ibop(IBOP_REMOVE) +!Get_Ibop() +!IBOP_INSTALL +!IBOP_REMOVE + + call Set_Kelly(KELLY_INSTALL) +!Get_Kelly() +!KELLY_NEUTRAL +!KELLY_INSTALL +!KELLY_REMOVE + + call Set_MouseHole(MOUSE_HOLE_FILL) +!Get_MouseHole() +!MOUSE_HOLE_NEUTRAL +!MOUSE_HOLE_FILL +!MOUSE_HOLE_EMPTY + + call Set_OperationCondition(OPERATION_DRILL) +!Get_OperationCondition() +!OPERATION_DRILL +!OPERATION_TRIP + + + call Set_SafetyValve(SAFETY_VALVE_INSTALL) +!Get_SafetyValve() +!SAFETY_VALVE_INSTALL +!SAFETY_VALVE_REMOVE + if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call Set_SafetyValve(SAFETY_VALVE_REMOVE) + + call Set_Slips(SLIPS_SET_END) +!Get_Slips() + + call Set_Swing(SWING_WELL_BEGIN) +!Get_Swing() +!SWING_NEUTRAL +!SWING_MOUSE_HOLE_BEGIN +!SWING_MOUSE_HOLE_END +!SWING_RAT_HOLE_BEGIN +!SWING_RAT_HOLE_END +!SWING_WELL_BEGIN +!SWING_WELL_END + + call Set_Tong(TONG_NEUTRAL) +!Get_Tong() +!TONG_NEUTRAL +!TONG_BREAKOUT_BEGIN +!TONG_BREAKOUT_END +!TONG_MAKEUP_BEGIN +!TONG_MAKEUP_END + + + call Set_StringUpdate(STRING_UPDATE_NEUTRAL) +!Get_StringUpdate() +!STRING_UPDATE_NEUTRAL +!STRING_UPDATE_ADD_SINGLE +!STRING_UPDATE_ADD_STAND +!STRING_UPDATE_REMOVE_SINGLE +!STRING_UPDATE_REMOVE_STAND + + + + + + + + + + + + + + + + + + + + + + + + + + + call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_NOTHING) +!Get_TdsElevatorModes() +!TDS_ELEVATOR_CONNECTION_NOTHING +!TDS_ELEVATOR_CONNECTION_STRING +!TDS_ELEVATOR_CONNECTION_SINGLE +!TDS_ELEVATOR_CONNECTION_STAND +!TDS_ELEVATOR_LATCH_STRING +!TDS_ELEVATOR_LATCH_SINGLE +!TDS_ELEVATOR_LATCH_STAND + + + + + + call Set_TdsConnectionModes(TDS_CONNECTION_NOTHING) +!Get_TdsConnectionModes() +!TDS_CONNECTION_NOTHING +!TDS_CONNECTION_STRING +!TDS_CONNECTION_SPINE + + + + + call Set_SwingTiltPermission(.false.) !Get_SwingTiltPermission() + call Set_SwingOffPermission(.false.) !Get_SwingOffPermission() + call Set_SwingDrillPermission(.false.) !Get_SwingDrillPermission() + call Set_FillupHeadPermission(.false.) !Get_FillupHeadPermission() + + call Set_PowerLed(.false.) + call Set_IbopLed(.false.) + + call Set_TorqueWrenchLed(0) !Get_TorqueWrenchLed() + + +!TdsPower_REV = 1 +!TdsPower_OFF = 0 +!TdsPower_FWD = -1 +! +!TdsMu_TORQ = 1 +!TdsMu_SPINE = 0 +!TdsMu_DRILL = -1 +! +!TdsLinkTilt_TILT = 1 +!TdsLinkTilt_OFF = 0 +!TdsLinkTilt_DRILL = -1 + +!TDS IBOP TopDriveIbop +!TDS LinkTilt TopDriveLinkTiltState +!TDS MU TopDriveDrillTorqueState +!TDS Power TopDriveTdsPowerState + +!TopDriveTorqueWrench PRESSED=True or UNPRESSED=Falses + +!Get_TdsConnectionPossible() +!Get_TdsStemIn() + +!call Set_TdsStemJointHeight(v) !Get_TdsStemJointHeight() + + +!Get_SwingDrillPermission() +!Get_SwingOffPermission() +!Get_SwingTiltPermission() +!Get_FillupHeadPermission() + + call Set_TdsTong(TDS_TONG_BREAKOUT_END) +!Get_TdsTong() +!TDS_TONG_BREAKOUT_BEGIN +!TDS_TONG_BREAKOUT_END +!TDS_TONG_MAKEUP_BEGIN +!TDS_TONG_MAKEUP_END + + + call Set_TdsBackupClamp(BACKUP_CLAMP_OFF_END) +!Get_TdsBackupClamp() +!BACKUP_CLAMP_OFF_END +!BACKUP_CLAMP_OFF_BEGIN +!BACKUP_CLAMP_FW_BEGIN +!BACKUP_CLAMP_FW_END + + + call Set_TdsSwing(TDS_SWING_OFF_END) +!Get_TdsSwing() +!TDS_SWING_NEUTRAL +!TDS_SWING_OFF_BEGIN +!TDS_SWING_OFF_END +!TDS_SWING_DRILL_BEGIN +!TDS_SWING_DRILL_END +!TDS_SWING_TILT_BEGIN +!TDS_SWING_TILT_END + + + + + + call Set_TdsSpine(TDS_SPINE_NEUTRAL) !TDS_SPINE_DISCONNECT_END +!Get_TdsSpine() +!TDS_SPINE_NEUTRAL +!TDS_SPINE_CONNECT_BEGIN +!TDS_SPINE_CONNECT_END +!TDS_SPINE_DISCONNECT_BEGIN +!TDS_SPINE_DISCONNECT_END + + end subroutine + +! subroutine SetDefaults_WN() +! !DEC$ ATTRIBUTES DLLEXPORT :: SetDefaults_WN +! !DEC$ ATTRIBUTES ALIAS: 'SetDefaults_WN' :: SetDefaults_WN +! implicit none +! call SetDefaultValues() +! end subroutine + +end module COperationScenariosSettings diff --git a/CSharp/OperationScenarios/Common/COperationScenariosVariables.i90 b/CSharp/OperationScenarios/Common/COperationScenariosVariables.i90 new file mode 100644 index 0000000..9885f1d --- /dev/null +++ b/CSharp/OperationScenarios/Common/COperationScenariosVariables.i90 @@ -0,0 +1,46 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Common/COperationScenariosVariables.f90" +module COperationScenariosVariables + implicit none + public + type::OperationScenarioType +! Apparently Constants + real :: HKL = 63.76 ! Hook And Kelly Length + real :: HL = 17.81 ! Hook Length + real :: PL = 30.0 ! Pipe Length + real :: SL = 90.0 ! Stand Length + real :: LG = 8.0 ! Limit Gap + real :: SG = 3.0 ! Slips Gap + real :: TG = 4.0 ! Tong Gap + real :: RE = 3.0 ! Release + real :: ECG = 2.3 ! Elevator Connection Gap + +!Apparently Variables + integer :: ElevatorConnection = 0 + integer :: StringUpdate = 0 + integer :: KellyConnection = 0 + + end type OperationScenarioType + + enum, bind(c) + enumerator STRING_UPDATE_NEUTRAL + enumerator STRING_UPDATE_ADD_SINGLE + enumerator STRING_UPDATE_ADD_STAND + enumerator STRING_UPDATE_REMOVE_SINGLE + enumerator STRING_UPDATE_REMOVE_STAND + end enum + enum, bind(c) + enumerator KELLY_CONNECTION_NOTHING + enumerator KELLY_CONNECTION_STRING + enumerator KELLY_CONNECTION_SINGLE + end enum + enum, bind(c) + enumerator ELEVATOR_CONNECTION_NOTHING + enumerator ELEVATOR_CONNECTION_STRING + enumerator ELEVATOR_CONNECTION_STAND + enumerator ELEVATOR_CONNECTION_SINGLE + enumerator ELEVATOR_LATCH_STRING + enumerator ELEVATOR_LATCH_SINGLE + enumerator ELEVATOR_LATCH_STAND + end enum + contains +end module COperationScenariosVariables diff --git a/CSharp/OperationScenarios/Common/OperationScenarios.i90 b/CSharp/OperationScenarios/Common/OperationScenarios.i90 index 390d0a7..ed96ddc 100644 --- a/CSharp/OperationScenarios/Common/OperationScenarios.i90 +++ b/CSharp/OperationScenarios/Common/OperationScenarios.i90 @@ -3,18 +3,12 @@ module OperationScenariosModule !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Paseted From ....Variables.f90 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! use OperationScenariosModule ! -! use OperationScenariosModule !!CElevator... -! use COperationScenariosVariables use SimulationVariables use PermissionsModule -! use SoftwareInputsVariables -! use CUnityInputs use UnityModule use UnitySignalVariables use UnitySignalsModule use PermissionsModule -! use CTdsElevatorModesEnumVariables ! use CHoistingVariables use CTopDrivePanelVariables use NotificationModule @@ -45,9 +39,8 @@ module OperationScenariosModule use CManifolds, Only: KellyConnected, KellyDisconnected implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%OperationScenario%KellyConnection == v) return - #endif +# 43 + data%State%OperationScenario%KellyConnection = v @@ -57,9 +50,8 @@ module OperationScenariosModule call KellyConnected() endif - #ifdef deb - if(print_log) print*, 'data%State%OperationScenario%KellyConnection=', data%State%OperationScenario%KellyConnection - #endif +# 55 + !**call data%State%OperationScenario%OnKellyConnectionChange%RunAll() end subroutine @@ -71,14 +63,12 @@ module OperationScenariosModule subroutine Evaluate_KellyConnection() implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then - #ifdef OST - if(print_log) print*, 'Evaluate_KellyConnection=TopDrive' - #endif +# 69 + endif if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then - #ifdef OST - if(print_log) print*, 'Evaluate_KellyConnection=Kelly' - #endif +# 74 + !OPERATION-CODE=1 if (Get_OperationCondition() == OPERATION_DRILL .and.& @@ -183,13 +173,13 @@ module OperationScenariosModule subroutine ButtonPress_Breakout() implicit none -# 187 +# 181 end subroutine subroutine ButtonPress_Makeup() implicit none -# 194 +# 188 end subroutine @@ -197,9 +187,8 @@ module OperationScenariosModule subroutine Set_StringUpdate(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%OperationScenario%StringUpdate == v) return - #endif +# 197 + data%State%OperationScenario%StringUpdate = v !**call data%State%OperationScenario%OnStringUpdateChange%RunAll(v) end subroutine @@ -229,14 +218,12 @@ module OperationScenariosModule subroutine Set_ElevatorConnection(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%OperationScenario%ElevatorConnection == v) return - #endif +# 229 + data%State%OperationScenario%ElevatorConnection = v - #ifdef deb - if(print_log) print*, 'data%State%OperationScenario%ElevatorConnection=', data%State%OperationScenario%ElevatorConnection - #endif +# 234 + !**call data%State%OperationScenario%OnElevatorConnectionChange%RunAll() end subroutine @@ -245,4 +232,73 @@ module OperationScenariosModule Get_ElevatorConnection = data%State%OperationScenario%ElevatorConnection end function +!//SLIPS: everythings start here + subroutine ButtonPress_Slips() bind(C,name="ButtonPress_Slips") +! use NotificationModule + use CUnityOutputs +! use UnitySignalsModule + implicit none + if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then + if(print_log) print*, 'ButtonPress_Slips=TopDrive' + +!TOPDRIVE-CODE=30 + if (Get_Slips() == SLIPS_UNSET_END .and.& + Get_SlipsNotification()) then + + call Set_Slips(SLIPS_SET_BEGIN) + return + end if + +!TOPDRIVE-CODE=31 + if (Get_TdsConnectionModes() == TDS_CONNECTION_STRING .and.& + Get_Slips() == SLIPS_SET_END .and.& + Get_SlipsNotification()) then + + call Set_Slips(SLIPS_UNSET_BEGIN) + return + end if + +!TOPDRIVE-CODE=32 + if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING .and.& + Get_Slips() == SLIPS_SET_END .and.& + Get_SlipsNotification()) then + + call Set_Slips(SLIPS_UNSET_BEGIN) + return + end if + endif + + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + if(print_log) print*, 'ButtonPress_Slips=Kelly' +!OPERATION-CODE=19 + if (Get_Slips() == SLIPS_UNSET_END .and.& + Get_SlipsNotification()) then + + call Set_Slips(SLIPS_SET_BEGIN) + return + end if + +!OPERATION-CODE=20 + if (Get_OperationCondition() == OPERATION_DRILL .and.& + Get_KellyConnection() == KELLY_CONNECTION_STRING .and.& + GetRotaryRpm() == 0.0d0 .and.& + Get_SlipsNotification() .and.& + Get_Slips() == SLIPS_SET_END) then + + call Set_Slips(SLIPS_UNSET_BEGIN) + return + end if +!OPERATION-CODE=21 + if (Get_OperationCondition() == OPERATION_TRIP .and.& + Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.& + GetRotaryRpm() == 0.0d0 .and.& + Get_SlipsNotification() .and.& + Get_Slips() == SLIPS_SET_END) then + call Set_Slips(SLIPS_UNSET_BEGIN) + return + end if + endif + end subroutine + + end module OperationScenariosModule diff --git a/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90 b/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90 index e7662d0..066cf7b 100644 --- a/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90 +++ b/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90 @@ -9,10 +9,7 @@ module CTdsElevatorModesEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST if(print_log) print*, 'Evaluate_TdsElevatorModes=TopDrive' -#endif - !TOPDRIVE-CODE=7 if (Get_Elevator() == ELEVATOR_LATCH_STRING_END .and.& @@ -24,8 +21,6 @@ module CTdsElevatorModesEnum return end if - - !TOPDRIVE-CODE=8 if (Get_HookHeight() <= (TL() + TJH() - data%State%OperationScenario%ECG) .and.& Get_ElevatorPickup() == .false. .and.& @@ -304,19 +299,9 @@ module CTdsElevatorModesEnum endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_TdsElevatorModes=Kelly' -#endif - endif + ! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + ! if(print_log) print*, 'Evaluate_TdsElevatorModes=Kelly' + ! endif @@ -325,8 +310,8 @@ module CTdsElevatorModesEnum subroutine Subscribe_TdsElevatorModes() use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables + use SimulationVariables + use SimulationVariables implicit none end subroutine diff --git a/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.i90 b/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.i90 index e54c931..8c9ac55 100644 --- a/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.i90 +++ b/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90" module CTdsElevatorModesEnum use OperationScenariosModule use UnityModule @@ -10,9 +10,7 @@ module CTdsElevatorModesEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 14 - - + if(print_log) print*, 'Evaluate_TdsElevatorModes=TopDrive' !TOPDRIVE-CODE=7 if (Get_Elevator() == ELEVATOR_LATCH_STRING_END .and.& @@ -24,8 +22,6 @@ module CTdsElevatorModesEnum return end if - - !TOPDRIVE-CODE=8 if (Get_HookHeight() <= (TL() + TJH() - data%State%OperationScenario%ECG) .and.& Get_ElevatorPickup() == .false. .and.& @@ -304,18 +300,9 @@ module CTdsElevatorModesEnum endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 318 - - endif +! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_TdsElevatorModes=Kelly' +! endif @@ -324,8 +311,8 @@ module CTdsElevatorModesEnum subroutine Subscribe_TdsElevatorModes() use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables + use SimulationVariables + use SimulationVariables implicit none end subroutine diff --git a/CSharp/OperationScenarios/Notifications/COpenSafetyValveLedNotification.i90 b/CSharp/OperationScenarios/Notifications/COpenSafetyValveLedNotification.i90 new file mode 100644 index 0000000..f5f1585 --- /dev/null +++ b/CSharp/OperationScenarios/Notifications/COpenSafetyValveLedNotification.i90 @@ -0,0 +1,105 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/COpenSafetyValveLedNotification.f90" +module COpenSafetyValveLedNotification + use OperationScenariosModule + implicit none + contains + + subroutine Evaluate_OpenSafetyValveLed() + implicit none + + + +! if (DriveType == TopDrive_DriveType) then +!#ifdef OST +! if(print_log) print*, 'Evaluate_OpenSafetyValveLed=TopDrive' +!#endif +! endif +! +! +! +! +! +! +! +! +! if (DriveType == Kelly_DriveType) then +!#ifdef OST +! if(print_log) print*, 'Evaluate_OpenSafetyValveLed=Kelly' +!#endif +! endif + + + + end subroutine + +! subroutine Subscribe_OpenSafetyValveLed() +! use CDrillingConsoleVariables +! use ConfigurationVariables +! use ConfigurationVariables +! implicit none +! call OnOpenSafetyValvePress%Add(ButtonPress_OpenSafetyValve) +! call OnOperationConditionChangeInt%Add(Set_Operation_OpenSafetyValveLed) +! end subroutine + + + subroutine Set_Operation_OpenSafetyValveLed(v) + implicit none + integer , intent(in) :: v +# 49 + + data%State%notifications%operation_OpenSafetyValveLed = v +# 53 + + end subroutine + + + subroutine ButtonPress_OpenSafetyValve() + implicit none + + + if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then +# 64 + + +!TOPDRIVE-CODE=56 + if (Get_SafetyValveHeight() >= 3.0 .and. Get_SafetyValveHeight() <= 12.0 .and.& + Get_OpenSafetyValveLed() == .false. .and.& + Get_CloseSafetyValveLed()) then + + call Set_CloseSafetyValveLed(.false.) + call Set_OpenSafetyValveLed(.true.) + return + end if + + endif + + + + + + + + + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +# 88 + + + +!OPERATION-CODE=58 + if (Get_SafetyValveHeight() >= 3.0 .and. Get_SafetyValveHeight() <= 12.0 .and.& + Get_OpenSafetyValveLed() == .false. .and.& + Get_CloseSafetyValveLed()) then + call Set_OpenSafetyValveLed(.true.) + call Set_CloseSafetyValveLed(.false.) + return + end if + + + endif + + + + + end subroutine + +end module COpenSafetyValveLedNotification diff --git a/CSharp/OperationScenarios/Notifications/CSlipsNotification.f90 b/CSharp/OperationScenarios/Notifications/CSlipsNotification.f90 index 8c0a337..e10665e 100644 --- a/CSharp/OperationScenarios/Notifications/CSlipsNotification.f90 +++ b/CSharp/OperationScenarios/Notifications/CSlipsNotification.f90 @@ -3,17 +3,12 @@ module CSlipsNotification implicit none contains + !//TODO: must change code such that get new states of tong and slips from uie subroutine Evaluate_SlipsNotification() implicit none - - - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_SlipsNotification=TopDrive' -#endif - + ! if(print_log) print*, 'Evaluate_SlipsNotification=TopDrive' !TOPDRIVE-CODE=28 if (Get_ZeroStringSpeed() .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -22,10 +17,8 @@ module CSlipsNotification call Set_SlipsNotification(.true.) return - end if - - - + end if + !TOPDRIVE-CODE=29 if (Get_ZeroStringSpeed() .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -37,25 +30,16 @@ module CSlipsNotification call Set_SlipsNotification(.true.) return end if - - - endif - - - - - - - - - - + ! enumerator SLIPS_NEUTRAL + ! enumerator SLIPS_SET_BEGIN + ! enumerator SLIPS_SET_END + ! enumerator SLIPS_UNSET_BEGIN + ! enumerator SLIPS_UNSET_END + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_SlipsNotification=Kelly' -#endif + ! if(print_log) print*, 'Evaluate_SlipsNotification=Kelly' !OPERATION-CODE=53 if (Get_ZeroStringSpeed() .and.& @@ -67,10 +51,6 @@ module CSlipsNotification return end if - - - - !OPERATION-CODE=77 if (Get_ZeroStringSpeed() .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -79,43 +59,13 @@ module CSlipsNotification Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.& (Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .or. Get_KellyConnection() == KELLY_CONNECTION_STRING)) then call Set_SlipsNotification(.true.) - return end if - - - - - - !if (Get_OperationCondition() == OPERATION_DRILL .and.& - ! Get_ZeroStringSpeed() .and.& - ! Get_SlackOff() .and.& - ! Get_KellyConnection() == KELLY_CONNECTION_STRING) then - ! call Set_SlipsNotification(.true.) - ! return - !end if - ! - ! - !if (Get_OperationCondition() == OPERATION_TRIP .and.& - ! Get_ZeroStringSpeed() .and.& - ! Get_NearFloorConnection() >= 21 .and. Get_NearFloorConnection() <= 25 .and.& - ! Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then - ! call Set_SlipsNotification(.true.) - ! return - !end if - - - - + call Set_SlipsNotification(.false.) endif - - - - - end subroutine ! subroutine Subscribe_SlipsNotification() diff --git a/CSharp/OperationScenarios/Notifications/CSlipsNotification.i90 b/CSharp/OperationScenarios/Notifications/CSlipsNotification.i90 index 75ad059..6f38bdb 100644 --- a/CSharp/OperationScenarios/Notifications/CSlipsNotification.i90 +++ b/CSharp/OperationScenarios/Notifications/CSlipsNotification.i90 @@ -1,19 +1,15 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Notifications/CSlipsNotification.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/CSlipsNotification.f90" module CSlipsNotification use OperationScenariosModule implicit none contains +!//TODO: must change code such that get new states of tong and slips from uie subroutine Evaluate_SlipsNotification() implicit none - - - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 15 - - +! if(print_log) print*, 'Evaluate_SlipsNotification=TopDrive' !TOPDRIVE-CODE=28 if (Get_ZeroStringSpeed() .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -22,10 +18,8 @@ module CSlipsNotification call Set_SlipsNotification(.true.) return - end if - - - + end if + !TOPDRIVE-CODE=29 if (Get_ZeroStringSpeed() .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -37,24 +31,16 @@ module CSlipsNotification call Set_SlipsNotification(.true.) return end if - - - endif - - - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 58 +! enumerator SLIPS_NEUTRAL +! enumerator SLIPS_SET_BEGIN +! enumerator SLIPS_SET_END +! enumerator SLIPS_UNSET_BEGIN +! enumerator SLIPS_UNSET_END + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_SlipsNotification=Kelly' !OPERATION-CODE=53 if (Get_ZeroStringSpeed() .and.& @@ -66,10 +52,6 @@ module CSlipsNotification return end if - - - - !OPERATION-CODE=77 if (Get_ZeroStringSpeed() .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -78,43 +60,13 @@ module CSlipsNotification Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.& (Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .or. Get_KellyConnection() == KELLY_CONNECTION_STRING)) then call Set_SlipsNotification(.true.) - return end if - - - - - -!if (Get_OperationCondition() == OPERATION_DRILL .and.& -! Get_ZeroStringSpeed() .and.& -! Get_SlackOff() .and.& -! Get_KellyConnection() == KELLY_CONNECTION_STRING) then -! call Set_SlipsNotification(.true.) -! return -!end if -! -! -!if (Get_OperationCondition() == OPERATION_TRIP .and.& -! Get_ZeroStringSpeed() .and.& -! Get_NearFloorConnection() >= 21 .and. Get_NearFloorConnection() <= 25 .and.& -! Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then -! call Set_SlipsNotification(.true.) -! return -!end if - - - - + call Set_SlipsNotification(.false.) endif - - - - - end subroutine ! subroutine Subscribe_SlipsNotification() diff --git a/CSharp/OperationScenarios/Notifications/CSwingLedNotification.i90 b/CSharp/OperationScenarios/Notifications/CSwingLedNotification.i90 index 331bcb4..c5af064 100644 --- a/CSharp/OperationScenarios/Notifications/CSwingLedNotification.i90 +++ b/CSharp/OperationScenarios/Notifications/CSwingLedNotification.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Notifications/CSwingLedNotification.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/CSwingLedNotification.f90" module CSwingLedNotification use OperationScenariosModule use UnityModule diff --git a/CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.i90 b/CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.i90 index 0be2146..af94a6e 100644 --- a/CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.i90 +++ b/CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.f90" module CTdsPowerLedNotification use OperationScenariosModule use SimulationVariables diff --git a/CSharp/OperationScenarios/Notifications/CTongNotification.i90 b/CSharp/OperationScenarios/Notifications/CTongNotification.i90 index 27d2ee5..bb593c5 100644 --- a/CSharp/OperationScenarios/Notifications/CTongNotification.i90 +++ b/CSharp/OperationScenarios/Notifications/CTongNotification.i90 @@ -7,17 +7,9 @@ module CTongNotification subroutine Evaluate_TongNotification() implicit none - - - - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 16 - - +! if(print_log) print*, 'Evaluate_TongNotification=TopDrive' - - !TOPDRIVE-CODE=50 if (((Get_HookHeight() >= (TL() + data%State%OperationScenario%PL - data%State%OperationScenario%ECG + NFC() - data%State%OperationScenario%RE) .and. Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%PL - data%State%OperationScenario%ECG + data%State%OperationScenario%TG)) .or.& (Get_HookHeight() >= (TL() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + NFC() - data%State%OperationScenario%RE) .and. Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + data%State%OperationScenario%TG))).and.& @@ -34,62 +26,34 @@ module CTongNotification return end if - - - - !TOPDRIVE-CODE=51 if (GetRotaryRpm() == 0.0d0 .and.& - Get_JointConnectionPossible() .and.& - (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& - Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& - (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - Get_Slips() == SLIPS_SET_END) then - + Get_JointConnectionPossible() .and.& + (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& + Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& + (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) .and.& + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if - - - - - - - !TOPDRIVE-CODE=52 if (GetRotaryRpm() == 0.0d0 .and.& - Get_JointConnectionPossible() .and.& - (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& - Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& - (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - Get_Slips() == SLIPS_SET_END) then - + Get_JointConnectionPossible() .and.& + (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.& + Get_Tong() /= TONG_MAKEUP_BEGIN) .and.& + (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) .and.& + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + Get_Slips() == SLIPS_SET_END) then call Set_TongNotification(.true.) return end if - - - - - endif - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 92 - - +! if(print_log) print*, 'Evaluate_TongNotification=Kelly' !OPERATION-CODE=44 if (Get_OperationCondition() == OPERATION_DRILL .and.& !((Get_HookHeight() >= 65.0 .and. Get_HookHeight() <= 70.0) .or.& @@ -108,9 +72,6 @@ module CTongNotification return end if - - - !OPERATION-CODE=45 if (Get_OperationCondition() == OPERATION_DRILL .and.& Get_HookHeight() >= 66 .and. Get_HookHeight() <= 69 .and.& @@ -123,8 +84,6 @@ module CTongNotification return end if - - !OPERATION-CODE=46 if (Get_OperationCondition() == OPERATION_DRILL .and.& Get_JointConnectionPossible() .and.& @@ -137,9 +96,6 @@ module CTongNotification return end if - - - !OPERATION-CODE=47 if (Get_OperationCondition() == OPERATION_DRILL .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -152,11 +108,7 @@ module CTongNotification call Set_TongNotification(.true.) return - end if - - - - + end if !OPERATION-CODE=48 if (Get_OperationCondition() == OPERATION_DRILL .and.& @@ -171,21 +123,7 @@ module CTongNotification call Set_TongNotification(.true.) return end if - - - - - - - - - - - - - - - + !OPERATION-CODE=50 if (Get_OperationCondition() == OPERATION_TRIP .and.& ((Get_HookHeight() >= (data%State%OperationScenario%HL + data%State%OperationScenario%PL - data%State%OperationScenario%ECG + Get_NearFloorConnection() - data%State%OperationScenario%RE) .and. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%PL - data%State%OperationScenario%ECG + data%State%OperationScenario%TG)) .or.& @@ -219,11 +157,7 @@ module CTongNotification call Set_TongNotification(.true.) return end if - - - - - + !OPERATION-CODE=52 if (Get_OperationCondition() == OPERATION_TRIP .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -237,9 +171,6 @@ module CTongNotification call Set_TongNotification(.true.) return end if - - - !if (Get_OperationCondition() == OPERATION_DRILL .and.& ! Get_KellyConnection() == KELLY_CONNECTION_STRING .and.& @@ -250,21 +181,11 @@ module CTongNotification ! return !end if ! - - call Set_TongNotification(.false.) - endif + call Set_TongNotification(.true.) - - - - - - - - end subroutine ! subroutine Subscribe_TongNotification() diff --git a/CSharp/OperationScenarios/Notifications/Notifications.i90 b/CSharp/OperationScenarios/Notifications/Notifications.i90 index 7c77707..52b30a0 100644 --- a/CSharp/OperationScenarios/Notifications/Notifications.i90 +++ b/CSharp/OperationScenarios/Notifications/Notifications.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Notifications/Notifications.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/Notifications.f90" module NotificationModule use SimulationVariables implicit none @@ -9,9 +9,8 @@ contains !use CLatchLedNotification implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%UnlatchLed == v) return - #endif +# 13 + data%State%notifications%UnlatchLed = v if(data%State%notifications%UnlatchLed) then @@ -32,14 +31,12 @@ contains subroutine Set_TongNotification(v) implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%TongNotification == v) return - #endif +# 36 + data%State%notifications%TongNotification = v ! if(associated(data%State%notifications%TongNotificationPtr)) !**call data%State%notifications%TongNotificationPtr(data%State%notifications%TongNotification) - #ifdef deb - if(print_log) print*, 'data%State%notifications%TongNotification=', data%State%notifications%TongNotification - #endif +# 41 + !**call data%State%notifications%OnTongNotificationChange%RunAll() end subroutine @@ -54,9 +51,8 @@ contains implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%TorqueWrenchLed == v) return - #endif +# 58 + data%State%notifications%TorqueWrenchLed = v data%Equipments%TopDrivePanel%TopDriveTorqueWrenchLed = v !**call data%State%notifications%OnTorqueWrenchLedChange%RunAll() @@ -73,9 +69,8 @@ contains !use CLatchLedNotification implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%PowerLed == v) return - #endif +# 77 + data%State%notifications%PowerLed = v if(data%State%notifications%PowerLed) then @@ -100,9 +95,8 @@ contains !use CLatchLedNotification implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%IbopLed == v) return - #endif +# 104 + data%State%notifications%IbopLed = v if(data%State%notifications%IbopLed) then @@ -128,9 +122,8 @@ contains implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%SwingLed == v) return - #endif +# 132 + data%State%notifications%SwingLed = v if(data%State%notifications%SwingLed) then data%Equipments%DrillingConsole%SwingLed = 1 @@ -148,14 +141,12 @@ contains subroutine Set_SlipsNotification(v) implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%SlipsNotification == v) return - #endif +# 152 + data%State%notifications%SlipsNotification = v ! if(associated(data%State%notifications%SlipsNotificationPtr)) !**call data%State%notifications%SlipsNotificationPtr(data%State%notifications%SlipsNotification) - #ifdef deb - if(print_log) print*, 'data%State%notifications%SlipsNotification=', data%State%notifications%SlipsNotification - #endif +# 157 + !**call data%State%notifications%OnSlipsNotificationChange%RunAll() end subroutine @@ -173,9 +164,8 @@ contains use SimulationVariables!, only: data%Configuration%Hoisting%DriveType, TopDrive_DriveType, Kelly_DriveType implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%OpenSafetyValveLed == v) return - #endif +# 177 + data%State%notifications%OpenSafetyValveLed = v if(data%State%notifications%OpenSafetyValveLed) then @@ -200,9 +190,8 @@ contains use CManifolds, only: OpenKellyCock implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%OpenKellyCockLed == v) return - #endif +# 204 + data%State%notifications%OpenKellyCockLed = v if(data%State%notifications%OpenKellyCockLed) then @@ -232,9 +221,8 @@ contains !use CUnlatchLedNotification implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%LatchLed == v) return - #endif +# 236 + data%State%notifications%LatchLed = v if(data%State%notifications%LatchLed) then data%Equipments%DrillingConsole%LatchPipeLED = 1 @@ -252,8 +240,8 @@ contains subroutine Set_IrSafetyValveLed(v) use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables!, only: data%Equipments%DrillingConsole%CloseKellyCockLed => IRSafetyValveLed + use SimulationVariables + use UnitySignalsModule use CManifolds, only: & InstallSafetyValve_TopDrive, & InstallSafetyValve_KellyMode, & @@ -262,31 +250,23 @@ contains RemoveSafetyValve_KellyMode, & RemoveSafetyValve_TripMode use UnitySignalVariables - use UnitySignalsModule, only: Set_SafetyValve_Install, Set_SafetyValve_Remove use CHoistingVariables - use SimulationVariables!, only: data%Configuration%Hoisting%DriveType, TopDrive_DriveType, Kelly_DriveType implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%IrSafetyValveLed == v) return - #endif +# 269 + data%State%notifications%IrSafetyValveLed = v - if(data%State%notifications%IrSafetyValveLed) then data%Equipments%DrillingConsole%IRSafetyValveLed = 1 - if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call InstallSafetyValve_TopDrive() if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 0) call InstallSafetyValve_KellyMode() if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 1) call InstallSafetyValve_TripMode() - call Set_SafetyValve_Install() else data%Equipments%DrillingConsole%IRSafetyValveLed = 0 - if(data%Configuration%Hoisting%DriveType == TopDrive_DriveType) call RemoveSafetyValve_TopDrive() if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 0) call RemoveSafetyValve_KellyMode() if(data%Configuration%Hoisting%DriveType == Kelly_DriveType .and. data%State%notifications%operation_IrSafetyValveLed == 1) call RemoveSafetyValve_TripMode() - call Set_SafetyValve_Remove() endif @@ -300,16 +280,15 @@ contains subroutine Set_IrIBopLed(v) use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables!, only: IRIBopLedHw => IRIBopLed + use SimulationVariables + use SimulationVariables!, only: IRIBopLedHw => IRIBopLed use CManifolds, only: InstallIBop, RemoveIBop use UnitySignalVariables - use UnitySignalsModule, only: Set_Ibop_Install, Set_Ibop_Remove + use UnitySignalsModule, only: Set_Ibop_Install, Set_Ibop_Remove implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%IrIBopLed == v) return - #endif +# 304 + data%State%notifications%IrIBopLed = v if(data%State%notifications%IrIBopLed) then data%Equipments%DrillingConsole%IRIBopLed = 1 @@ -330,16 +309,14 @@ contains subroutine Set_FillMouseHoleLed(v) use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables!, only: FillMouseHoleLedHw => FillMouseHoleLed + use SimulationVariables ! use CMouseHoleEnumVariables use UnitySignalVariables - use UnitySignalsModule + use UnitySignalsModule implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%FillMouseHoleLed == v) return - #endif +# 333 + data%State%notifications%FillMouseHoleLed = v if(data%State%notifications%FillMouseHoleLed) then data%Equipments%DrillingConsole%FillMouseHoleLed = 1 @@ -363,9 +340,8 @@ contains use CManifolds, only: CloseKellyCock implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%CloseKellyCockLed == v) return - #endif +# 359 + data%State%notifications%CloseKellyCockLed = v if(data%State%notifications%CloseKellyCockLed) then call CloseKellyCock() @@ -387,9 +363,8 @@ contains use SimulationVariables!, only: data%Configuration%Hoisting%DriveType, TopDrive_DriveType, Kelly_DriveType implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%notifications%CloseSafetyValveLed == v) return - #endif +# 383 + data%State%notifications%CloseSafetyValveLed = v if(data%State%notifications%CloseSafetyValveLed) then !!call CloseSafetyValve() diff --git a/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90 b/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90 index c10ffaa..93a774c 100644 --- a/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90 +++ b/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90 @@ -9,10 +9,6 @@ module CFillupHeadPermission implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_FillupHeadPermission=TopDrive' -#endif - !TOPDRIVE-CODE=66 if (Get_NearFloorConnection() >= 3 .and. Get_NearFloorConnection() <= 10 .and.& @@ -28,15 +24,7 @@ module CFillupHeadPermission endif - - - - - - - - - + ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_FillupHeadPermission=Kelly' diff --git a/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.i90 b/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.i90 new file mode 100644 index 0000000..0bf508a --- /dev/null +++ b/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.i90 @@ -0,0 +1,43 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90" +module CFillupHeadPermission + use OperationScenariosModule + implicit none + + contains + + subroutine Evaluate_FillupHeadPermission() +! use UnitySignalsModule !for CTdsConnectionModesEnum + implicit none + + if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then + +!TOPDRIVE-CODE=66 + if (Get_NearFloorConnection() >= 3 .and. Get_NearFloorConnection() <= 10 .and.& + Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then + + call Set_FillupHeadPermission(.true.) + return + end if + + + call Set_FillupHeadPermission(.false.) + + + endif + +! if (DriveType == Kelly_DriveType) then +!#ifdef OST +! if(print_log) print*, 'Evaluate_FillupHeadPermission=Kelly' +!#endif +! endif + + + + end subroutine + + subroutine Subscribe_FillupHeadPermission() + implicit none + end subroutine + +end module CFillupHeadPermission diff --git a/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90 b/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90 index 413c2ef..863bd5b 100644 --- a/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90 +++ b/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90 @@ -12,12 +12,6 @@ module CIrSafetyValvePermission if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_IrSafetyValvePermission=TopDrive' -#endif - - - !TOPDRIVE-CODE=55 if (GetRotaryRpm() == 0.0d0 .and.& (Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 10.0) .and.& @@ -28,21 +22,9 @@ module CIrSafetyValvePermission call Set_IrSafetyValvePermission(.true.) return end if - - - endif - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then - if(print_log) print*, 'Evaluate_IrSafetyValvePermission=Kelly' - !OPERATION-CODE=57 if (Get_OperationCondition() == OPERATION_TRIP .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -57,10 +39,6 @@ module CIrSafetyValvePermission return end if - - - - call Set_IrSafetyValvePermission(.false.) endif diff --git a/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.i90 b/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.i90 index d7eca13..3fd23fd 100644 --- a/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.i90 +++ b/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90" module CIrSafetyValvePermission use OperationScenariosModule implicit none @@ -13,11 +13,6 @@ module CIrSafetyValvePermission if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 17 - - - - !TOPDRIVE-CODE=55 if (GetRotaryRpm() == 0.0d0 .and.& (Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 10.0) .and.& @@ -28,23 +23,9 @@ module CIrSafetyValvePermission call Set_IrSafetyValvePermission(.true.) return end if - - - endif - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 46 - - - !OPERATION-CODE=57 if (Get_OperationCondition() == OPERATION_TRIP .and.& GetRotaryRpm() == 0.0d0 .and.& @@ -59,10 +40,6 @@ module CIrSafetyValvePermission return end if - - - - call Set_IrSafetyValvePermission(.false.) endif diff --git a/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90 b/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90 index 030f9ef..ca547bb 100644 --- a/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90 +++ b/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90 @@ -9,42 +9,19 @@ module CSwingDrillPermission subroutine Evaluate_SwingDrillPermission() implicit none - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST if(print_log) print*, 'Evaluate_SwingDrillPermission=TopDrive' -#endif - !TOPDRIVE-CODE=33 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingDrillPermission(.true.) return end if - - - - - call Set_SwingDrillPermission(.false.) - - - - - endif - - - - - - - - ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_SwingDrillPermission=Kelly' diff --git a/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.i90 b/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.i90 index d623540..5de6ff2 100644 --- a/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.i90 +++ b/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90" module CSwingDrillPermission use OperationScenariosModule use CTopDrivePanelVariables @@ -10,41 +10,19 @@ module CSwingDrillPermission subroutine Evaluate_SwingDrillPermission() implicit none - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 16 - - + if(print_log) print*, 'Evaluate_SwingDrillPermission=TopDrive' !TOPDRIVE-CODE=33 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingDrillPermission(.true.) return end if - - - - - call Set_SwingDrillPermission(.false.) - - - - - endif - - - - - - - - ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_SwingDrillPermission=Kelly' diff --git a/CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90 b/CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90 index 29ff630..13ec2e1 100644 --- a/CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90 +++ b/CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90 @@ -7,55 +7,34 @@ module CSwingOffPermission subroutine Evaluate_SwingOffPermission() implicit none - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST if(print_log) print*, 'Evaluate_SwingOffPermission=TopDrive' -#endif - - !TOPDRIVE-CODE=35 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_TILT_END .and.& - Get_Slips() == SLIPS_SET_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& + Get_TdsSwing() == TDS_SWING_TILT_END .and.& + Get_Slips() == SLIPS_SET_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingOffPermission(.true.) return end if - - - !TOPDRIVE-CODE=36 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_DRILL_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& + Get_TdsSwing() == TDS_SWING_DRILL_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingOffPermission(.true.) return end if - - call Set_SwingOffPermission(.false.) endif - - - - - - - ! if (DriveType == Kelly_DriveType) then -!#ifdef OST ! if(print_log) print*, 'Evaluate_SwingOffPermission=Kelly' -!#endif ! endif end subroutine diff --git a/CSharp/OperationScenarios/Permissions/CSwingOffPermission.i90 b/CSharp/OperationScenarios/Permissions/CSwingOffPermission.i90 index 076ce13..0e6a0b8 100644 --- a/CSharp/OperationScenarios/Permissions/CSwingOffPermission.i90 +++ b/CSharp/OperationScenarios/Permissions/CSwingOffPermission.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90" module CSwingOffPermission use OperationScenariosModule implicit none @@ -8,54 +8,34 @@ module CSwingOffPermission subroutine Evaluate_SwingOffPermission() implicit none - if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 14 - - - + if(print_log) print*, 'Evaluate_SwingOffPermission=TopDrive' !TOPDRIVE-CODE=35 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_TILT_END .and.& - Get_Slips() == SLIPS_SET_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& + Get_TdsSwing() == TDS_SWING_TILT_END .and.& + Get_Slips() == SLIPS_SET_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingOffPermission(.true.) return end if - - - !TOPDRIVE-CODE=36 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_DRILL_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& + Get_TdsSwing() == TDS_SWING_DRILL_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingOffPermission(.true.) return end if - - call Set_SwingOffPermission(.false.) endif - - - - - - - ! if (DriveType == Kelly_DriveType) then -!#ifdef OST ! if(print_log) print*, 'Evaluate_SwingOffPermission=Kelly' -!#endif ! endif end subroutine diff --git a/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90 b/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90 index 52db734..003dcf5 100644 --- a/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90 +++ b/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90 @@ -10,35 +10,21 @@ module CSwingTiltPermission implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST if(print_log) print*, 'Evaluate_SwingTiltPermission=TopDrive' -#endif - !TOPDRIVE-CODE=34 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - Get_Slips() == SLIPS_SET_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + Get_Slips() == SLIPS_SET_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingTiltPermission(.true.) return end if - call Set_SwingTiltPermission(.false.) - endif - - - - - - - - ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_SwingTiltPermission=Kelly' diff --git a/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.i90 b/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.i90 index e89c949..88ae9f4 100644 --- a/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.i90 +++ b/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90" module CSwingTiltPermission use UnitySignalsModule use OperationScenariosModule @@ -11,34 +11,21 @@ module CSwingTiltPermission implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 15 - - + if(print_log) print*, 'Evaluate_SwingTiltPermission=TopDrive' !TOPDRIVE-CODE=34 if (Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.& - Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - Get_Slips() == SLIPS_SET_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then - + Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + Get_Slips() == SLIPS_SET_END .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF) then call Set_SwingTiltPermission(.true.) return end if - call Set_SwingTiltPermission(.false.) - endif - - - - - - - - ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_SwingTiltPermission=Kelly' diff --git a/CSharp/OperationScenarios/Permissions/Permissions.i90 b/CSharp/OperationScenarios/Permissions/Permissions.i90 new file mode 100644 index 0000000..aa870be --- /dev/null +++ b/CSharp/OperationScenarios/Permissions/Permissions.i90 @@ -0,0 +1,169 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/Permissions.f90" +module PermissionsModule + use SimulationVariables + implicit none + +contains + subroutine Set_SwingTiltPermission(v) + implicit none + logical , intent(in) :: v +# 11 + + data%State%permissions%SwingTiltPermission = v +# 15 + +!**call data%State%permissions%OnSwingTiltPermissionChange%RunAll() + end subroutine + + logical function Get_SwingTiltPermission() + implicit none + Get_SwingTiltPermission = data%State%permissions%SwingTiltPermission + end function + + subroutine Set_SwingOffPermission(v) + implicit none + logical , intent(in) :: v +# 29 + + data%State%permissions%SwingOffPermission = v +# 33 + +!**call data%State%permissions%OnSwingOffPermissionChange%RunAll() + end subroutine + + logical function Get_SwingOffPermission() + implicit none + Get_SwingOffPermission = data%State%permissions%SwingOffPermission + end function + + subroutine Set_SwingDrillPermission(v) + implicit none + logical , intent(in) :: v +# 47 + + data%State%permissions%SwingDrillPermission = v +# 51 + +!**call data%State%permissions%OnSwingDrillPermissionChange%RunAll() + end subroutine + + logical function Get_SwingDrillPermission() + implicit none + Get_SwingDrillPermission = data%State%permissions%SwingDrillPermission + end function + + subroutine Set_RemoveMudBucketPermission(v) + implicit none + logical , intent(in) :: v +# 65 + + data%State%permissions%RemoveMudBucketPermission = v +# 69 + +!**call data%State%permissions%OnRemoveMudBucketPermissionChange%RunAll() + end subroutine + + logical function Get_RemoveMudBucketPermission() + implicit none + Get_RemoveMudBucketPermission = data%State%permissions%RemoveMudBucketPermission + end function + + + subroutine Set_RemoveFillupHeadPermission(v) + implicit none + logical , intent(in) :: v +# 84 + + data%State%permissions%RemoveFillupHeadPermission = v +# 88 + +!**call data%State%permissions%OnRemoveFillupHeadPermissionChange%RunAll() + end subroutine + + logical function Get_RemoveFillupHeadPermission() + implicit none + Get_RemoveFillupHeadPermission = data%State%permissions%RemoveFillupHeadPermission + end function + + subroutine Set_IrSafetyValvePermission(v) + implicit none + logical , intent(in) :: v +# 102 + + data%State%permissions%IrSafetyValvePermission = v +# 106 + +!**call data%State%permissions%OnIrSafetyValvePermissionChange%RunAll() + end subroutine + + logical function Get_IrSafetyValvePermission() + implicit none + Get_IrSafetyValvePermission = data%State%permissions%IrSafetyValvePermission + end function + + subroutine Set_IrIbopPermission(v) + implicit none + logical , intent(in) :: v +# 120 + + data%State%permissions%IrIbopPermission = v +# 124 + +!**call data%State%permissions%OnIrIbopPermissionChange%RunAll() + end subroutine + + logical function Get_IrIbopPermission() + implicit none + Get_IrIbopPermission = data%State%permissions%IrIbopPermission + end function + + + subroutine Set_InstallMudBucketPermission(v) + implicit none + logical , intent(in) :: v +# 139 + + data%State%permissions%InstallMudBucketPermission = v +# 143 + +!**call data%State%permissions%OnInstallMudBucketPermissionChange%RunAll() + end subroutine + + logical function Get_InstallMudBucketPermission() + implicit none + Get_InstallMudBucketPermission = data%State%permissions%InstallMudBucketPermission + end function + + subroutine Set_InstallFillupHeadPermission(v) + implicit none + logical , intent(in) :: v +# 157 + + data%State%permissions%InstallFillupHeadPermission = v +# 161 + +!**call data%State%permissions%OnInstallFillupHeadPermissionChange%RunAll() + end subroutine + + logical function Get_InstallFillupHeadPermission() + implicit none + Get_InstallFillupHeadPermission = data%State%permissions%InstallFillupHeadPermission + end function + + subroutine Set_FillupHeadPermission(v) + implicit none + logical , intent(in) :: v +# 175 + + data%State%permissions%FillupHeadPermission = v +# 179 + +!**call data%State%permissions%OnFillupHeadPermissionChange%RunAll() + end subroutine + + logical function Get_FillupHeadPermission() + implicit none + Get_FillupHeadPermission = data%State%permissions%FillupHeadPermission + end function + +end module PermissionsModule diff --git a/CSharp/OperationScenarios/Permissions/PermissionsVariables.i90 b/CSharp/OperationScenarios/Permissions/PermissionsVariables.i90 new file mode 100644 index 0000000..85c6659 --- /dev/null +++ b/CSharp/OperationScenarios/Permissions/PermissionsVariables.i90 @@ -0,0 +1,17 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/PermissionsVariables.f90" +module PermissionsVariables +! use CVoidEventHandlerCollection + type::PermissionsType + logical :: FillupHeadPermission = .false. + logical :: InstallFillupHeadPermission = .false. + logical :: InstallMudBucketPermission = .false. + logical :: IrIbopPermission = .false. + logical :: IrSafetyValvePermission = .false. + logical :: RemoveFillupHeadPermission = .false. + logical :: RemoveMudBucketPermission = .false. + logical :: SwingDrillPermission = .false. + logical :: SwingOffPermission = .false. + logical :: SwingTiltPermission = .false. + end type PermissionsType + contains +end module diff --git a/CSharp/OperationScenarios/SoftwareInputs.f90 b/CSharp/OperationScenarios/SoftwareInputs.f90 index 7252467..cd04a10 100644 --- a/CSharp/OperationScenarios/SoftwareInputs.f90 +++ b/CSharp/OperationScenarios/SoftwareInputs.f90 @@ -18,7 +18,12 @@ module SoftwareInputsModule logical function Get_ZeroStringSpeed() implicit none - Get_ZeroStringSpeed = data%State%softwareInputs%ZeroStringSpeed + if(abs(data%State%Drawworks%HookLinearVelocity_final)<0.2) then + Get_ZeroStringSpeed = .TRUE. + else + Get_ZeroStringSpeed = .FALSE. + endif + !data%State%softwareInputs%ZeroStringSpeed !Get_ZeroStringSpeed = .true. end function @@ -153,6 +158,7 @@ module SoftwareInputsModule !Get_IbopHeight = 23.0 end function + !//TODO: Investigate this hookheight! why two hook height?! subroutine Set_HookHeight(v) implicit none real , intent(in) :: v @@ -168,6 +174,7 @@ module SoftwareInputsModule real function Get_HookHeight() implicit none - Get_HookHeight = data%State%softwareInputs%HookHeight + ! Get_HookHeight = data%State%softwareInputs%HookHeight + Get_HookHeight = data%State%Drawworks%Hook_Height_final end function end module SoftwareInputsModule \ No newline at end of file diff --git a/CSharp/OperationScenarios/SoftwareInputs.i90 b/CSharp/OperationScenarios/SoftwareInputs.i90 index 40fdad6..54532b5 100644 --- a/CSharp/OperationScenarios/SoftwareInputs.i90 +++ b/CSharp/OperationScenarios/SoftwareInputs.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/SoftwareInputs.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/SoftwareInputs.f90" module SoftwareInputsModule use SimulationVariables @@ -7,32 +7,33 @@ module SoftwareInputsModule subroutine Set_ZeroStringSpeed(v) implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%ZeroStringSpeed == v) return - #endif +# 11 + data%State%softwareInputs%ZeroStringSpeed = v - #ifdef deb - if(print_log) print*, 'ZeroStringSpeed=', data%State%softwareInputs%ZeroStringSpeed - #endif +# 15 + ! call data%State%softwareInputs%OnZeroStringSpeedChange%RunAll() end subroutine logical function Get_ZeroStringSpeed() implicit none - Get_ZeroStringSpeed = data%State%softwareInputs%ZeroStringSpeed + if(abs(data%State%Drawworks%HookLinearVelocity_final)<0.2) then + Get_ZeroStringSpeed = .TRUE. + else + Get_ZeroStringSpeed = .FALSE. + endif +!data%State%softwareInputs%ZeroStringSpeed !Get_ZeroStringSpeed = .true. end function subroutine Set_TdsStemJointHeight(v) implicit none real , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%TdsStemJointHeight == v) return - #endif +# 35 + data%State%softwareInputs%TdsStemJointHeight = v - #ifdef deb - if(print_log) print*, 'TdsStemJointHeight=', data%State%softwareInputs%TdsStemJointHeight - #endif +# 39 + ! call data%State%softwareInputs%OnTdsStemJointHeightChange%RunAll() end subroutine @@ -45,13 +46,11 @@ module SoftwareInputsModule subroutine Set_StringPressure(v) implicit none real , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%StringPressure == v) return - #endif +# 54 + data%State%softwareInputs%StringPressure = v - #ifdef deb - if(print_log) print*, 'StringPressure=', data%State%softwareInputs%StringPressure - #endif +# 58 + ! call data%State%softwareInputs%OnStringPressureChange%RunAll() end subroutine @@ -63,13 +62,11 @@ module SoftwareInputsModule subroutine Set_StandRack(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%StandRack == v) return - #endif +# 72 + data%State%softwareInputs%StandRack = v - #ifdef deb - if(print_log) print*, 'StandRack=', data%State%softwareInputs%StandRack - #endif +# 76 + ! call data%State%softwareInputs%OnStandRackChanged%RunAll() end subroutine @@ -81,13 +78,11 @@ module SoftwareInputsModule subroutine Set_SlackOff(v) implicit none logical , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%SlackOff == v) return - #endif +# 90 + data%State%softwareInputs%SlackOff = v - #ifdef deb - if(print_log) print*, 'SlackOff=', data%State%softwareInputs%SlackOff - #endif +# 94 + ! call data%State%softwareInputs%OnSlackOffChange%RunAll() end subroutine @@ -99,13 +94,11 @@ module SoftwareInputsModule subroutine Set_SafetyValveHeight(v) implicit none real , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%SafetyValveHeight == v) return - #endif +# 108 + data%State%softwareInputs%SafetyValveHeight = v - #ifdef deb - if(print_log) print*, 'SafetyValveHeight=', data%State%softwareInputs%SafetyValveHeight - #endif +# 112 + ! call data%State%softwareInputs%OnSafetyValveHeightChange%RunAll() end subroutine @@ -119,13 +112,11 @@ module SoftwareInputsModule subroutine Set_NearFloorConnection(v) implicit none real , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%NearFloorConnection == v) return - #endif +# 128 + data%State%softwareInputs%NearFloorConnection = v - #ifdef deb - if(print_log) print*, 'NearFloorConnection=', data%State%softwareInputs%NearFloorConnection - #endif +# 132 + ! call data%State%softwareInputs%OnNearFloorConnectionChange%RunAll() end subroutine @@ -138,13 +129,11 @@ module SoftwareInputsModule subroutine Set_IbopHeight(v) implicit none real , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%IbopHeight == v) return - #endif +# 147 + data%State%softwareInputs%IbopHeight = v - #ifdef deb - if(print_log) print*, 'IbopHeight=', data%State%softwareInputs%IbopHeight - #endif +# 151 + ! call data%State%softwareInputs%OnIbopHeightChange%RunAll() end subroutine @@ -154,21 +143,21 @@ module SoftwareInputsModule !Get_IbopHeight = 23.0 end function +!//TODO: Investigate this hookheight! why two hook height?! subroutine Set_HookHeight(v) implicit none real , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%softwareInputs%HookHeight == v) return - #endif +# 167 + data%State%softwareInputs%HookHeight = v - #ifdef deb - if(print_log) print*, 'HookHeight=', data%State%softwareInputs%HookHeight - #endif +# 171 + ! call data%State%softwareInputs%OnHookHeightChange%RunAll() end subroutine real function Get_HookHeight() implicit none - Get_HookHeight = data%State%softwareInputs%HookHeight +! Get_HookHeight = data%State%softwareInputs%HookHeight + Get_HookHeight = data%State%Drawworks%Hook_Height_final end function end module SoftwareInputsModule diff --git a/CSharp/OperationScenarios/SoftwareInputsVariables.i90 b/CSharp/OperationScenarios/SoftwareInputsVariables.i90 index 2bd8411..48bf9bb 100644 --- a/CSharp/OperationScenarios/SoftwareInputsVariables.i90 +++ b/CSharp/OperationScenarios/SoftwareInputsVariables.i90 @@ -12,7 +12,6 @@ module SoftwareInputsVariables real :: TdsStemJointHeight = 0 logical :: ZeroStringSpeed = .false. end type SoftwareInputsType -! type(SoftwareInputsType):: softwareInputs contains diff --git a/CSharp/OperationScenarios/Unity/CUnityInputs.i90 b/CSharp/OperationScenarios/Unity/CUnityInputs.i90 index 49f9e8d..08fcf9a 100644 --- a/CSharp/OperationScenarios/Unity/CUnityInputs.i90 +++ b/CSharp/OperationScenarios/Unity/CUnityInputs.i90 @@ -1,12 +1,14 @@ # 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Unity/CUnityInputs.f90" module CUnityInputs ! use CVoidEventHandlerCollection - implicit none + implicit none type :: UnityInputsType +!Input from unity to fortran logical :: ElevatorConnectionPossible logical :: JointConnectionPossible logical :: IsKellyBushingSetInTable - logical :: ElevatorPickup + logical :: ElevatorPickup +!only used in set and get logical :: NearFloorPosition logical :: SingleSetInMouseHole logical :: TdsConnectionPossible diff --git a/CSharp/OperationScenarios/Unity/UnityModule.i90 b/CSharp/OperationScenarios/Unity/UnityModule.i90 index bfde8cf..8d65fff 100644 --- a/CSharp/OperationScenarios/Unity/UnityModule.i90 +++ b/CSharp/OperationScenarios/Unity/UnityModule.i90 @@ -3,31 +3,27 @@ module UnityModule use SimulationVariables implicit none contains - subroutine UnityInputsFromJson(parent) - use json_module,IK =>json_ik - type(json_value),pointer :: parent - type(json_core) :: json - type(json_value),pointer :: p,pval - - call json%get(parent,'Unity',p) - - call json%get(p,'ElevatorConnectionPossible',pval) - call json%get(pval,data%Equipments%UnityInputs%ElevatorConnectionPossible) - call json%get(p,'JointConnectionPossible',pval) - call json%get(pval,data%Equipments%UnityInputs%JointConnectionPossible) - call json%get(p,'IsKellyBushingSetInTable',pval) - call json%get(pval,data%Equipments%UnityInputs%IsKellyBushingSetInTable) - call json%get(p,'ElevatorPickup',pval) - call json%get(pval,data%Equipments%UnityInputs%ElevatorPickup) - call json%get(p,'NearFloorPosition',pval) - call json%get(pval,data%Equipments%UnityInputs%NearFloorPosition) - call json%get(p,'SingleSetInMouseHole',pval) - call json%get(pval,data%Equipments%UnityInputs%SingleSetInMouseHole) - call json%get(p,'TdsConnectionPossible',pval) - call json%get(pval,data%Equipments%UnityInputs%TdsConnectionPossible) - call json%get(p,'TdsStemIn',pval) - call json%get(pval,data%Equipments%UnityInputs%TdsStemIn) - end subroutine + subroutine UnityInputsFromJson(jsonfile) + type(json_file)::jsonfile + logical::found + + call jsonfile%get('UnityInputs.ElevatorConnectionPossible',data%Equipments%UnityInputs%ElevatorConnectionPossible,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%ElevatorConnectionPossible") + call jsonfile%get('UnityInputs.JointConnectionPossible',data%Equipments%UnityInputs%JointConnectionPossible,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%JointConnectionPossible") + call jsonfile%get('UnityInputs.IsKellyBushingSetInTable',data%Equipments%UnityInputs%IsKellyBushingSetInTable,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%IsKellyBushingSetInTable") + call jsonfile%get('UnityInputs.ElevatorPickup',data%Equipments%UnityInputs%ElevatorPickup,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%ElevatorPickup") + call jsonfile%get('UnityInputs.NearFloorPosition',data%Equipments%UnityInputs%NearFloorPosition,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%NearFloorPosition") + call jsonfile%get('UnityInputs.SingleSetInMouseHole',data%Equipments%UnityInputs%SingleSetInMouseHole,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%SingleSetInMouseHole") + call jsonfile%get('UnityInputs.TdsConnectionPossible',data%Equipments%UnityInputs%TdsConnectionPossible,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%TdsConnectionPossible") + call jsonfile%get('UnityInputs.TdsStemIn',data%Equipments%UnityInputs%TdsStemIn,found) + if ( .not. found ) call logg(4,"Not found: UnityInputs%TdsStemIn") + end subroutine subroutine UnityOutputsToJson(parent) type(json_value),pointer :: parent @@ -101,7 +97,7 @@ subroutine Set_BlowoutFromString(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%BlowoutFromString = v -# 105 +# 101 end subroutine @@ -114,7 +110,7 @@ subroutine Set_BlowoutFromAnnular(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%BlowoutFromAnnular = v -# 119 +# 115 end subroutine @@ -131,7 +127,7 @@ subroutine Set_FlowFromReturnLine(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%FlowFromReturnLine = v -# 137 +# 133 end subroutine @@ -146,7 +142,7 @@ subroutine Set_FlowFromKelly(v) implicit none real, intent (in) :: v data%Equipments%UnityOutputs%FlowFromKelly = v -# 153 +# 149 end subroutine @@ -163,7 +159,7 @@ subroutine Set_FlowFromFillupHead(v) implicit none real, intent (in) :: v data%Equipments%UnityOutputs%FlowFromFillupHead = v -# 171 +# 167 end subroutine @@ -181,7 +177,7 @@ subroutine Set_FlowKellyDisconnect(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%FlowKellyDisconnect = v -# 190 +# 186 end subroutine @@ -197,7 +193,7 @@ subroutine Set_FlowPipeDisconnect(v) implicit none logical, intent (in) :: v data%Equipments%UnityOutputs%FlowPipeDisconnect = v -# 207 +# 203 end subroutine @@ -210,7 +206,7 @@ subroutine Set_BlowoutFromStringPercent(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%BlowoutFromStringPercent = v -# 221 +# 217 end subroutine @@ -226,7 +222,7 @@ subroutine Calc_KellyHoseVibrationRate(spm1, spm2) real :: total total = (spm1 + spm2)/2 data%Equipments%UnityOutputs%KellyHoseVibrationRate = ScaleRange(total, 0.0, 10.0, 0.0, 120.0) -# 238 +# 234 end subroutine @@ -239,7 +235,7 @@ subroutine Set_Pedal(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%Pedal = v -# 252 +# 248 end subroutine @@ -252,7 +248,7 @@ subroutine Set_FlowRate(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%FlowRate = v -# 266 +# 262 end subroutine @@ -265,7 +261,7 @@ subroutine Set_RotaryRpm(v) implicit none real(8), intent (in) :: v data%Equipments%UnityOutputs%RotaryRpm = v -# 280 +# 276 end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90 b/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90 index 8321b92..8ad4ddf 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90 @@ -7,45 +7,26 @@ module CTdsBackupClamp implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_TdsBackupClamp=TopDrive' -#endif !TOPDRIVE-CODE=79 if(Get_TdsBackupClamp() == BACKUP_CLAMP_OFF_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& - data%Equipments%TopDrivePanel%TopDriveTorqueWrench) then - + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& + data%Equipments%TopDrivePanel%TopDriveTorqueWrench) then call Set_TdsBackupClamp(BACKUP_CLAMP_FW_BEGIN) - endif !TOPDRIVE-CODE=80 if(Get_TdsBackupClamp() /= BACKUP_CLAMP_OFF_END .and.& - Get_TdsBackupClamp() /= BACKUP_CLAMP_OFF_BEGIN .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& - data%Equipments%TopDrivePanel%TopDriveTorqueWrench == .false.) then - + Get_TdsBackupClamp() /= BACKUP_CLAMP_OFF_BEGIN .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& + data%Equipments%TopDrivePanel%TopDriveTorqueWrench == .false.) then call Set_TdsBackupClamp(BACKUP_CLAMP_OFF_BEGIN) - endif - - endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_TdsBackupClamp=Kelly' -#endif - endif + ! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + ! if(print_log) print*, 'Evaluate_TdsBackupClamp=Kelly' + ! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.i90 b/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.i90 index 8d9b84c..03f4e77 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.i90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90" module CTdsBackupClamp use OperationScenariosModule implicit none @@ -8,43 +8,26 @@ module CTdsBackupClamp implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 12 - !TOPDRIVE-CODE=79 if(Get_TdsBackupClamp() == BACKUP_CLAMP_OFF_END .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& - data%Equipments%TopDrivePanel%TopDriveTorqueWrench) then - + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& + data%Equipments%TopDrivePanel%TopDriveTorqueWrench) then call Set_TdsBackupClamp(BACKUP_CLAMP_FW_BEGIN) - endif !TOPDRIVE-CODE=80 if(Get_TdsBackupClamp() /= BACKUP_CLAMP_OFF_END .and.& - Get_TdsBackupClamp() /= BACKUP_CLAMP_OFF_BEGIN .and.& - data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& - data%Equipments%TopDrivePanel%TopDriveTorqueWrench == .false.) then - + Get_TdsBackupClamp() /= BACKUP_CLAMP_OFF_BEGIN .and.& + data%Equipments%TopDrivePanel%TopDriveTdsPowerState /= TdsPower_OFF .and.& + data%Equipments%TopDrivePanel%TopDriveTorqueWrench == .false.) then call Set_TdsBackupClamp(BACKUP_CLAMP_OFF_BEGIN) - endif - - endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 47 - - endif +! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_TdsBackupClamp=Kelly' +! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90 b/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90 index 5844d3f..b2e00a4 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90 @@ -9,9 +9,7 @@ module CTdsSpineEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST if(print_log) print*, 'Evaluate_TdsSpine=TopDrive' -#endif !TOPDRIVE-CODE=83 if (Get_TdsStemIn() .and.& @@ -35,23 +33,11 @@ module CTdsSpineEnum return end if - - endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_TdsSpine=Kelly' -#endif - endif + ! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + ! if(print_log) print*, 'Evaluate_TdsSpine=Kelly' + ! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.i90 b/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.i90 index 275235f..357f16e 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.i90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90" module CTdsSpineEnum use OperationScenariosModule use UnityModule @@ -10,8 +10,7 @@ module CTdsSpineEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 14 - + if(print_log) print*, 'Evaluate_TdsSpine=TopDrive' !TOPDRIVE-CODE=83 if (Get_TdsStemIn() .and.& @@ -35,22 +34,11 @@ module CTdsSpineEnum return end if - - endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 53 - - endif +! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_TdsSpine=Kelly' +! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90 b/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90 index d0bbb9b..6bc0e4c 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90 @@ -9,17 +9,12 @@ module CTdsSwingEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST if(print_log) print*, 'Evaluate_TdsSwing=TopDrive' -#endif - - !TOPDRIVE-CODE=37 if (Get_SwingDrillPermission() .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - Get_FillMouseHoleLed() == .false. .and.& - data%Equipments%TopDrivePanel%TopDriveLinkTiltState == TdsLinkTilt_DRILL) then - + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + Get_FillMouseHoleLed() == .false. .and.& + data%Equipments%TopDrivePanel%TopDriveLinkTiltState == TdsLinkTilt_DRILL) then call Set_TdsSwing(TDS_SWING_DRILL_BEGIN) data%Equipments%TopDrivePanel%TopDriveLinkTiltLed = LED_ON return @@ -115,17 +110,6 @@ module CTdsSwingEnum endif - - - - - - - - - - - ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_TdsSwing=Kelly' diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.i90 b/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.i90 index b3cf15e..44bb06c 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.i90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90" module CTdsSwingEnum use OperationScenariosModule use SimulationVariables @@ -10,16 +10,12 @@ module CTdsSwingEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 14 - - - + if(print_log) print*, 'Evaluate_TdsSwing=TopDrive' !TOPDRIVE-CODE=37 if (Get_SwingDrillPermission() .and.& - Get_TdsSwing() == TDS_SWING_OFF_END .and.& - Get_FillMouseHoleLed() == .false. .and.& - data%Equipments%TopDrivePanel%TopDriveLinkTiltState == TdsLinkTilt_DRILL) then - + Get_TdsSwing() == TDS_SWING_OFF_END .and.& + Get_FillMouseHoleLed() == .false. .and.& + data%Equipments%TopDrivePanel%TopDriveLinkTiltState == TdsLinkTilt_DRILL) then call Set_TdsSwing(TDS_SWING_DRILL_BEGIN) data%Equipments%TopDrivePanel%TopDriveLinkTiltLed = LED_ON return @@ -115,17 +111,6 @@ module CTdsSwingEnum endif - - - - - - - - - - - ! if (DriveType == Kelly_DriveType) then !#ifdef OST ! if(print_log) print*, 'Evaluate_TdsSwing=Kelly' diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90 b/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90 index b0146ef..0baf188 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90 @@ -7,21 +7,15 @@ module CTdsTongEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_TdsTong=TopDrive' -#endif - - !TOPDRIVE-CODE=1 if (Get_TdsConnectionModes() == TDS_CONNECTION_SPINE .and.& Get_TdsBackupClamp() == BACKUP_CLAMP_FW_END .and.& data%Equipments%TopDrivePanel%TopDriveTdsPowerState == TdsPower_FWD .and.& data%Equipments%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_TORQ) then - - call Set_TdsTong(TDS_TONG_MAKEUP_BEGIN) - !TopDriveTorqueWrenchLed = LED_ON - return + call Set_TdsTong(TDS_TONG_MAKEUP_BEGIN) + !TopDriveTorqueWrenchLed = LED_ON + return end if @@ -30,29 +24,17 @@ module CTdsTongEnum if (Get_TdsConnectionModes() == TDS_CONNECTION_STRING .and.& Get_TdsBackupClamp() == BACKUP_CLAMP_FW_END .and.& data%Equipments%TopDrivePanel%TopDriveTdsPowerState == TdsPower_REV .and.& - data%Equipments%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_TORQ) then - - call Set_TdsTong(TDS_TONG_BREAKOUT_BEGIN) - !TopDriveTorqueWrenchLed = LED_ON - return + data%Equipments%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_TORQ) then + call Set_TdsTong(TDS_TONG_BREAKOUT_BEGIN) + !TopDriveTorqueWrenchLed = LED_ON + return end if - endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -#ifdef OST - if(print_log) print*, 'Evaluate_TdsTong=Kelly' -#endif - endif + ! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + ! if(print_log) print*, 'Evaluate_TdsTong=Kelly' + ! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.i90 b/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.i90 index cf1a10a..7c7dfb4 100644 --- a/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.i90 +++ b/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90" +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90" module CTdsTongEnum use OperationScenariosModule implicit none @@ -8,20 +8,15 @@ module CTdsTongEnum implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 12 - - - !TOPDRIVE-CODE=1 if (Get_TdsConnectionModes() == TDS_CONNECTION_SPINE .and.& Get_TdsBackupClamp() == BACKUP_CLAMP_FW_END .and.& data%Equipments%TopDrivePanel%TopDriveTdsPowerState == TdsPower_FWD .and.& data%Equipments%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_TORQ) then - - call Set_TdsTong(TDS_TONG_MAKEUP_BEGIN) + call Set_TdsTong(TDS_TONG_MAKEUP_BEGIN) !TopDriveTorqueWrenchLed = LED_ON - return + return end if @@ -30,28 +25,17 @@ module CTdsTongEnum if (Get_TdsConnectionModes() == TDS_CONNECTION_STRING .and.& Get_TdsBackupClamp() == BACKUP_CLAMP_FW_END .and.& data%Equipments%TopDrivePanel%TopDriveTdsPowerState == TdsPower_REV .and.& - data%Equipments%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_TORQ) then - - call Set_TdsTong(TDS_TONG_BREAKOUT_BEGIN) + data%Equipments%TopDrivePanel%TopDriveDrillTorqueState == TdsMu_TORQ) then + call Set_TdsTong(TDS_TONG_BREAKOUT_BEGIN) !TopDriveTorqueWrenchLed = LED_ON - return + return end if - endif - - - - - - - - - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 54 - - endif +! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_TdsTong=Kelly' +! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/CTongEnum.i90 b/CSharp/OperationScenarios/UnitySignals/CTongEnum.i90 new file mode 100644 index 0000000..88b5254 --- /dev/null +++ b/CSharp/OperationScenarios/UnitySignals/CTongEnum.i90 @@ -0,0 +1,92 @@ +# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/CTongEnum.f90" +module CTongEnum + use OperationScenariosModule + implicit none + contains + + subroutine Evaluate_Tong() + implicit none + +! if (DriveType == TopDrive_DriveType) then +! if(print_log) print*, 'Evaluate_Tong=TopDrive' +! endif +! if (DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_Tong=Kelly' +! endif + + end subroutine + +! subroutine Subscribe_Tong() +! use CDrillingConsoleVariables +!@ use ConfigurationVariables +! implicit none + +! call OnBreakoutLeverPress%Add(ButtonPress_Breakout_TongNotification) +! call OnMakeupLeverPress%Add(ButtonPress_Makeup_TongNotification) +! call OnTongNeutralPress%Add(ButtonPress_Neutral_TongNotification) + +! end subroutine + + + + subroutine ButtonPress_Breakout_TongNotification() + implicit none + if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then + if(print_log) print*, 'ButtonPress_Breakout_TongNotification=TopDrive' +!TOPDRIVE-CODE=70 + if (Get_TongNotification()) then + call Set_Tong(TONG_BREAKOUT_BEGIN) + return + end if + endif + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + if(print_log) print*, 'ButtonPress_Breakout_TongNotification=Kelly' +!OPERATION-CODE=74 + if (Get_TongNotification()) then + call Set_Tong(TONG_BREAKOUT_BEGIN) + endif + endif + end subroutine + + + + + + + + subroutine ButtonPress_Makeup_TongNotification() + use NotificationModule + implicit none + + if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then + if(print_log) print*, 'ButtonPress_Makeup_TongNotification=TopDrive' +!TOPDRIVE-CODE=69 + if (Get_TongNotification()) then + call Set_Tong(TONG_MAKEUP_BEGIN) + return + end if + endif + + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + if(print_log) print*, 'ButtonPress_Makeup_TongNotification=Kelly' +!OPERATION-CODE=73 + if (Get_TongNotification()) then + call Set_Tong(TONG_MAKEUP_BEGIN) + endif + endif + + end subroutine + + subroutine ButtonPress_Neutral_TongNotification() + implicit none + if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then + if(print_log) print*, 'ButtonPress_Neutral_TongNotification=TopDrive' + endif + + if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + if(print_log) print*, 'ButtonPress_Neutral_TongNotification=Kelly' + call Set_Tong(TONG_NEUTRAL) + endif + end subroutine + +end module CTongEnum diff --git a/CSharp/OperationScenarios/UnitySignals/UnitySignals.f90 b/CSharp/OperationScenarios/UnitySignals/UnitySignals.f90 index 05c2fd6..86998a5 100644 --- a/CSharp/OperationScenarios/UnitySignals/UnitySignals.f90 +++ b/CSharp/OperationScenarios/UnitySignals/UnitySignals.f90 @@ -4,13 +4,41 @@ module UnitySignalsModule use RedisInterface contains -subroutine UnitySignalsFromJson(jsonfile) +subroutine UnitySignalsToJson(parent) type(json_value),pointer :: parent - type(json_core) :: json - type(json_value),pointer :: p,pval + type(json_value),pointer :: p + type(json_core) :: jsoncore + + call jsoncore%create_object(p,'UnitySignals') + + call jsoncore%add(p,"MudBucket",data%State%unitySignals%MudBucket) + call jsoncore%add(p,"Elevator",data%State%unitySignals%Elevator) + call jsoncore%add(p,"FillupHead",data%State%unitySignals%FillupHead) + call jsoncore%add(p,"Ibop",data%State%unitySignals%Ibop) + call jsoncore%add(p,"Kelly",data%State%unitySignals%Kelly) + call jsoncore%add(p,"MouseHole",data%State%unitySignals%MouseHole) + call jsoncore%add(p,"OperationCondition",data%State%unitySignals%OperationCondition) + call jsoncore%add(p,"SafetyValve",data%State%unitySignals%SafetyValve) + call jsoncore%add(p,"operation",data%State%unitySignals%operation) + call jsoncore%add(p,"Slips",data%State%unitySignals%Slips) + call jsoncore%add(p,"Slips_S",data%State%unitySignals%Slips_S) + call jsoncore%add(p,"Swing",data%State%unitySignals%Swing) + call jsoncore%add(p,"Swing_S",data%State%unitySignals%Swing_S) + call jsoncore%add(p,"TdsBackupClamp",data%State%unitySignals%TdsBackupClamp) + call jsoncore%add(p,"TdsSpine",data%State%unitySignals%TdsSpine) + call jsoncore%add(p,"TdsSwing",data%State%unitySignals%TdsSwing) + call jsoncore%add(p,"TdsTong",data%State%unitySignals%TdsTong) + call jsoncore%add(p,"Tong",data%State%unitySignals%Tong) + call jsoncore%add(p,"Tong_S",data%State%unitySignals%Tong_S) + call jsoncore%add(p,"TdsConnectionModes",data%State%unitySignals%TdsConnectionModes) + call jsoncore%add(p,"TdsElevatorModes",data%State%unitySignals%TdsElevatorModes) + + call jsoncore%add(parent,p) +end subroutine + +subroutine UnitySignalsFromJson(jsonfile) type(json_file)::jsonfile logical::found - integer :: i call jsonfile%get('UnitySignals.MudBucket',data%State%unitySignals%MudBucket,found) if ( .not. found ) call logg(4,"Not found: unitySignals%MudBucket") @@ -487,15 +515,12 @@ subroutine Evaluate_TdsConnectionModes() implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then - #ifdef OST - if(print_log) print*, 'Evaluate_TdsConnectionModes=TopDrive' - #endif + !TOPDRIVE-CODE=3 if (Get_TdsStemIn() .and.& Get_TdsSpine() == TDS_SPINE_CONNECT_END .and.& !TopDriveDrillTorqueState == TdsMu_SPINE Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then - call Set_TdsConnectionModes(TDS_CONNECTION_SPINE) return end if @@ -529,11 +554,9 @@ subroutine Evaluate_TdsConnectionModes() endif - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then - #ifdef OST - if(print_log) print*, 'Evaluate_TdsConnectionModes=Kelly' - #endif - endif + ! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then + ! if(print_log) print*, 'Evaluate_TdsConnectionModes=Kelly' + ! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/UnitySignals.i90 b/CSharp/OperationScenarios/UnitySignals/UnitySignals.i90 index 15e916a..a143d42 100644 --- a/CSharp/OperationScenarios/UnitySignals/UnitySignals.i90 +++ b/CSharp/OperationScenarios/UnitySignals/UnitySignals.i90 @@ -2,14 +2,95 @@ module UnitySignalsModule use UnitySignalVariables use SimulationVariables + use RedisInterface contains +subroutine UnitySignalsToJson(parent) + type(json_value),pointer :: parent + type(json_value),pointer :: p + type(json_core) :: jsoncore + + call jsoncore%create_object(p,'UnitySignals') + + call jsoncore%add(p,"MudBucket",data%State%unitySignals%MudBucket) + call jsoncore%add(p,"Elevator",data%State%unitySignals%Elevator) + call jsoncore%add(p,"FillupHead",data%State%unitySignals%FillupHead) + call jsoncore%add(p,"Ibop",data%State%unitySignals%Ibop) + call jsoncore%add(p,"Kelly",data%State%unitySignals%Kelly) + call jsoncore%add(p,"MouseHole",data%State%unitySignals%MouseHole) + call jsoncore%add(p,"OperationCondition",data%State%unitySignals%OperationCondition) + call jsoncore%add(p,"SafetyValve",data%State%unitySignals%SafetyValve) + call jsoncore%add(p,"operation",data%State%unitySignals%operation) + call jsoncore%add(p,"Slips",data%State%unitySignals%Slips) + call jsoncore%add(p,"Slips_S",data%State%unitySignals%Slips_S) + call jsoncore%add(p,"Swing",data%State%unitySignals%Swing) + call jsoncore%add(p,"Swing_S",data%State%unitySignals%Swing_S) + call jsoncore%add(p,"TdsBackupClamp",data%State%unitySignals%TdsBackupClamp) + call jsoncore%add(p,"TdsSpine",data%State%unitySignals%TdsSpine) + call jsoncore%add(p,"TdsSwing",data%State%unitySignals%TdsSwing) + call jsoncore%add(p,"TdsTong",data%State%unitySignals%TdsTong) + call jsoncore%add(p,"Tong",data%State%unitySignals%Tong) + call jsoncore%add(p,"Tong_S",data%State%unitySignals%Tong_S) + call jsoncore%add(p,"TdsConnectionModes",data%State%unitySignals%TdsConnectionModes) + call jsoncore%add(p,"TdsElevatorModes",data%State%unitySignals%TdsElevatorModes) + + call jsoncore%add(parent,p) +end subroutine + +subroutine UnitySignalsFromJson(jsonfile) + type(json_file)::jsonfile + logical::found + + call jsonfile%get('UnitySignals.MudBucket',data%State%unitySignals%MudBucket,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%MudBucket") + call jsonfile%get('UnitySignals.Elevator',data%State%unitySignals%Elevator,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Elevator") + call jsonfile%get('UnitySignals.FillupHead',data%State%unitySignals%FillupHead,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%FillupHead") + call jsonfile%get('UnitySignals.Ibop',data%State%unitySignals%Ibop,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Ibop") + call jsonfile%get('UnitySignals.Kelly',data%State%unitySignals%Kelly,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Kelly") + call jsonfile%get('UnitySignals.MouseHole',data%State%unitySignals%MouseHole,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%MouseHole") + call jsonfile%get('UnitySignals.OperationCondition',data%State%unitySignals%OperationCondition,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%OperationCondition") + call jsonfile%get('UnitySignals.SafetyValve',data%State%unitySignals%SafetyValve,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%SafetyValve") + call jsonfile%get('UnitySignals.operation',data%State%unitySignals%operation,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%operation") + call jsonfile%get('UnitySignals.Slips',data%State%unitySignals%Slips,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Slips") + call jsonfile%get('UnitySignals.Slips_S',data%State%unitySignals%Slips_S,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Slips_S") + call jsonfile%get('UnitySignals.Swing',data%State%unitySignals%Swing,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Swing") + call jsonfile%get('UnitySignals.Swing_S',data%State%unitySignals%Swing_S,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Swing_S") + call jsonfile%get('UnitySignals.TdsBackupClamp',data%State%unitySignals%TdsBackupClamp,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%TdsBackupClamp") + call jsonfile%get('UnitySignals.TdsSpine',data%State%unitySignals%TdsSpine,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%TdsSpine") + call jsonfile%get('UnitySignals.TdsSwing',data%State%unitySignals%TdsSwing,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%TdsSwing") + call jsonfile%get('UnitySignals.TdsTong',data%State%unitySignals%TdsTong,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%TdsTong") + call jsonfile%get('UnitySignals.Tong',data%State%unitySignals%Tong,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Tong") + call jsonfile%get('UnitySignals.Tong_S',data%State%unitySignals%Tong_S,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%Tong_S") + call jsonfile%get('UnitySignals.TdsConnectionModes',data%State%unitySignals%TdsConnectionModes,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%TdsConnectionModes") + call jsonfile%get('UnitySignals.TdsElevatorModes',data%State%unitySignals%TdsElevatorModes,found) + if ( .not. found ) call logg(4,"Not found: unitySignals%TdsElevatorModes") + +end subroutine + subroutine Set_TdsElevatorModes(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%TdsElevatorModes == v) return - #endif +# 93 + data%State%unitySignals%TdsElevatorModes = v !**call TdsElevatorModesEnum%OnTdsElevatorModesChange%RunAll() end subroutine @@ -32,13 +113,11 @@ end subroutine subroutine Set_Tong(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%Tong == v) return - #endif + if(data%State%unitySignals%Tong == v) return data%State%unitySignals%Tong = v - #ifdef deb - if(print_log) print*, 'Tong=', data%State%unitySignals%Tong - #endif + if(print_log) print*, 'Tong=', data%State%unitySignals%Tong + if(data%State%unitySignals%Tong==TONG_MAKEUP_BEGIN) call publishMessageToChannel("TONG_MAKEUP_BEGIN") + if(data%State%unitySignals%Tong==TONG_BREAKOUT_BEGIN) call publishMessageToChannel("TONG_BREAKOUT_BEGIN") !**call data%State%unitySignals%OnTongChange%RunAll() end subroutine @@ -51,13 +130,11 @@ end function subroutine Set_TdsTong(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%TdsTong == v) return - #endif +# 135 + data%State%unitySignals%TdsTong = v - #ifdef deb - if(print_log) print*, 'TdsTong=', data%State%unitySignals%TdsTong - #endif +# 139 + !**call data%State%unitySignals%OnTdsTongChange%RunAll() end subroutine @@ -70,13 +147,11 @@ end function subroutine Set_TdsSwing(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%TdsSwing == v) return - #endif +# 154 + data%State%unitySignals%TdsSwing = v - #ifdef deb - if(print_log) print*, 'TdsSwing=', data%State%unitySignals%TdsSwing - #endif +# 158 + !**call data%State%unitySignals%OnTdsSwingChange%RunAll() end subroutine @@ -89,13 +164,11 @@ end function subroutine Set_TdsSpine(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%TdsSpine == v) return - #endif +# 173 + data%State%unitySignals%TdsSpine = v - #ifdef deb - if(print_log) print*, 'TdsSpine=', data%State%unitySignals%TdsSpine - #endif +# 177 + !**call data%State%unitySignals%OnTdsSpineChange%RunAll() end subroutine @@ -108,13 +181,11 @@ end function subroutine Set_TdsBackupClamp(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%TdsBackupClamp == v) return - #endif +# 192 + data%State%unitySignals%TdsBackupClamp = v - #ifdef deb - if(print_log) print*, 'TdsBackupClamp=', data%State%unitySignals%TdsBackupClamp - #endif +# 196 + !**call data%State%unitySignals%OnTdsBackupClampChange%RunAll() end subroutine @@ -127,13 +198,11 @@ end function subroutine Set_Swing(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%Swing == v) return - #endif +# 211 + data%State%unitySignals%Swing = v - #ifdef deb - if(print_log) print*, 'Swing=', data%State%unitySignals%Swing - #endif +# 215 + !**call data%State%unitySignals%OnSwingChange%RunAll() end subroutine @@ -142,17 +211,15 @@ integer function Get_Swing() Get_Swing = data%State%unitySignals%Swing end function - +!//TODO: apparently every thing is started here for slips subroutine Set_Slips(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%Slips == v) return - #endif + if(data%State%unitySignals%Slips == v) return data%State%unitySignals%Slips = v - #ifdef deb - if(print_log) print*, 'Slips=', data%State%unitySignals%Slips - #endif + if(print_log) print*, 'Slips=', data%State%unitySignals%Slips + if(v==SLIPS_SET_BEGIN) call publishMessageToChannel("SLIPS_SET_BEGIN") + if(v==SLIPS_UNSET_BEGIN) call publishMessageToChannel("SLIPS_UNSET_BEGIN") !**call data%State%unitySignals%OnSlipsChange%RunAll() end subroutine @@ -170,10 +237,10 @@ end subroutine subroutine Set_SafetyValve(v) implicit none integer , intent(in) :: v -# 174 +# 252 data%State%unitySignals%SafetyValve = v -# 184 +# 262 !**call data%State%unitySignals%OnSafetyValveChange%RunAll() end subroutine @@ -198,13 +265,11 @@ subroutine Set_OperationCondition(v) ! use CKellyEnumVariables implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%OperationCondition == v) return - #endif +# 288 + data%State%unitySignals%OperationCondition = v - #ifdef deb - if(print_log) print*, 'OperationCondition=', data%State%unitySignals%OperationCondition - #endif +# 292 + !**call data%State%unitySignals%OnOperationConditionChange%RunAll() !**call data%State%unitySignals%OnOperationConditionChangeInt%RunAll(data%State%unitySignals%OperationCondition) end subroutine @@ -222,14 +287,12 @@ end subroutine subroutine Set_MouseHole(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%MouseHole == v) return - #endif +# 312 + !call sleep(2) data%State%unitySignals%MouseHole = v - #ifdef deb - if(print_log) print*, 'MouseHole=', data%State%unitySignals%MouseHole - #endif +# 317 + !**call data%State%unitySignals%OnMouseHoleChange%RunAll() end subroutine @@ -243,13 +306,11 @@ end function subroutine Set_Kelly(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%Kelly == v) return - #endif +# 333 + data%State%unitySignals%Kelly = v - #ifdef deb - if(print_log) print*, 'Kelly=', data%State%unitySignals%Kelly - #endif +# 337 + !**call data%State%unitySignals%OnKellyChange%RunAll() end subroutine @@ -262,13 +323,11 @@ end function subroutine Set_Ibop(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%Ibop == v) return - #endif +# 352 + data%State%unitySignals%Ibop = v - #ifdef deb - if(print_log) print*, 'Ibop=', data%State%unitySignals%Ibop - #endif +# 356 + !**call data%State%unitySignals%OnIbopChange%RunAll() end subroutine @@ -282,9 +341,8 @@ subroutine Set_FillupHead(v) use CManifolds, only: ToggleFillupHead implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%FillupHead == v) return - #endif +# 372 + data%State%unitySignals%FillupHead = v if (data%State%unitySignals%FillupHead == FILLUP_HEAD_INSTALL) then @@ -293,9 +351,8 @@ subroutine Set_FillupHead(v) call ToggleFillupHead(.false.) endif - #ifdef deb - if(print_log) print*, 'FillupHead=', data%State%unitySignals%FillupHead - #endif +# 383 + !**call data%State%unitySignals%OnFillupHeadChange%RunAll() end subroutine @@ -311,7 +368,7 @@ subroutine Evaluate_FillupHead() implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then -# 323 +# 401 endif @@ -321,7 +378,7 @@ subroutine Evaluate_FillupHead() if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then -# 334 +# 412 endif @@ -338,13 +395,11 @@ end subroutine subroutine Set_Elevator(v) implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%Elevator == v) return - #endif +# 430 + data%State%unitySignals%Elevator = v - #ifdef deb - if(print_log) print*, 'Elevator=', data%State%unitySignals%Elevator - #endif +# 434 + !**call data%State%unitySignals%OnElevatorChange%RunAll() end subroutine @@ -359,18 +414,16 @@ subroutine Set_MudBucket(v) use CManifolds, only: ToggleMudBox implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%MudBucket == v) return - #endif +# 451 + data%State%unitySignals%MudBucket = v if (data%State%unitySignals%MudBucket == MUD_BUCKET_INSTALL) then call ToggleMudBox(.true.) else if (data%State%unitySignals%MudBucket == MUD_BUCKET_REMOVE) then call ToggleMudBox(.false.) endif - #ifdef deb - if(print_log) print*, 'MudBucket=', data%State%unitySignals%MudBucket - #endif +# 460 + !**call data%State%unitySignals%OnMudBucketChange%RunAll() end subroutine @@ -398,9 +451,8 @@ subroutine Set_TdsConnectionModes(v) use CManifolds, Only: KellyConnected, KellyDisconnected implicit none integer , intent(in) :: v - #ifdef ExcludeExtraChanges - if(data%State%unitySignals%TdsConnectionModes == v) return - #endif +# 490 + data%State%unitySignals%TdsConnectionModes = v if(data%State%unitySignals%TdsConnectionModes == TDS_CONNECTION_NOTHING) then @@ -409,9 +461,8 @@ subroutine Set_TdsConnectionModes(v) call KellyConnected() endif - #ifdef deb - if(print_log) print*, 'data%State%unitySignals%TdsConnectionModes=', data%State%unitySignals%TdsConnectionModes - #endif +# 501 + !**call data%State%unitySignals%OnTdsConnectionModesChange%RunAll() end subroutine @@ -428,15 +479,12 @@ subroutine Evaluate_TdsConnectionModes() implicit none if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then - #ifdef OST - if(print_log) print*, 'Evaluate_TdsConnectionModes=TopDrive' - #endif + !TOPDRIVE-CODE=3 if (Get_TdsStemIn() .and.& Get_TdsSpine() == TDS_SPINE_CONNECT_END .and.& !TopDriveDrillTorqueState == TdsMu_SPINE Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then - call Set_TdsConnectionModes(TDS_CONNECTION_SPINE) return end if @@ -470,11 +518,9 @@ subroutine Evaluate_TdsConnectionModes() endif - if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then - #ifdef OST - if(print_log) print*, 'Evaluate_TdsConnectionModes=Kelly' - #endif - endif +! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then +! if(print_log) print*, 'Evaluate_TdsConnectionModes=Kelly' +! endif end subroutine diff --git a/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90 b/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90 index cbab97c..3d34b33 100644 --- a/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90 +++ b/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90 @@ -23,7 +23,7 @@ module UnitySignalVariables integer :: OperationCondition = 0 integer :: SafetyValve = 0 integer :: operation = 0 - !previous value is 0 (neutral),set to unset_end by mahmood + !previous value is 0 (neutral),set to set_end by mahmood integer :: Slips = SLIPS_SET_END integer :: Slips_S = 0 integer :: Swing = 0 @@ -95,17 +95,19 @@ module UnitySignalVariables enumerator MOUSE_HOLE_NEUTRAL enumerator MOUSE_HOLE_FILL enumerator MOUSE_HOLE_EMPTY - + end enum + enum, bind(c) enumerator KELLY_NEUTRAL enumerator KELLY_INSTALL enumerator KELLY_REMOVE - + end enum + enum, bind(c) !enumerator FILLUP_HEAD_NEUTRAL enumerator FILLUP_HEAD_REMOVE enumerator FILLUP_HEAD_INSTALL - + end enum + enum, bind(c) enumerator ELEVATOR_NEUTRAL - enumerator ELEVATOR_LATCH_STRING_BEGIN enumerator ELEVATOR_LATCH_STRING_END @@ -123,19 +125,23 @@ module UnitySignalVariables enumerator ELEVATOR_UNLATCH_SINGLE_BEGIN enumerator ELEVATOR_UNLATCH_SINGLE_END - + end enum + enum, bind(c) !enumerator MUD_BUCKET_NEUTRAL enumerator MUD_BUCKET_REMOVE enumerator MUD_BUCKET_INSTALL - + end enum + enum, bind(c) !enumerator IBOP_NEUTRAL enumerator IBOP_REMOVE enumerator IBOP_INSTALL - + end enum + enum, bind(c) enumerator TDS_CONNECTION_NOTHING enumerator TDS_CONNECTION_STRING enumerator TDS_CONNECTION_SPINE - + end enum + enum, bind(c) enumerator TDS_ELEVATOR_CONNECTION_NOTHING enumerator TDS_ELEVATOR_CONNECTION_STRING enumerator TDS_ELEVATOR_CONNECTION_SINGLE @@ -146,6 +152,5 @@ module UnitySignalVariables end enum contains - end module UnitySignalVariables \ No newline at end of file diff --git a/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.i90 b/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.i90 index ebe41cd..7c98688 100644 --- a/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.i90 +++ b/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.i90 @@ -3,9 +3,20 @@ module UnitySignalVariables ! use CVoidEventHandlerCollection ! use CIntegerEventHandlerCollection + enum, bind(c) + enumerator SLIPS_NEUTRAL + enumerator SLIPS_SET_BEGIN + enumerator SLIPS_SET_END + enumerator SLIPS_UNSET_BEGIN + enumerator SLIPS_UNSET_END + end enum + type:: UnitySignalsType +! used only in set and get (unitysignals.f90) integer :: MudBucket = 0 +! used only in set and get (unitysignals.f90) and indirectly in Evaluate... integer :: Elevator = 0 +! used only in set and get (unitysignals.f90) and indirectly in Evaluate... integer :: FillupHead = 0 integer :: Ibop = 0 integer :: Kelly = 0 @@ -13,7 +24,8 @@ module UnitySignalVariables integer :: OperationCondition = 0 integer :: SafetyValve = 0 integer :: operation = 0 - integer :: Slips = 0 +!previous value is 0 (neutral),set to set_end by mahmood + integer :: Slips = SLIPS_SET_END integer :: Slips_S = 0 integer :: Swing = 0 integer :: Swing_S = 0 @@ -25,7 +37,6 @@ module UnitySignalVariables integer :: Tong_S = 0 integer :: TdsConnectionModes = 0 integer :: TdsElevatorModes = 0 - end type UnitySignalsType enum, bind(c) @@ -81,27 +92,23 @@ module UnitySignalVariables enumerator OPERATION_DRILL enumerator OPERATION_TRIP end enum - enum, bind(c) - enumerator SLIPS_NEUTRAL - enumerator SLIPS_SET_BEGIN - enumerator SLIPS_SET_END - enumerator SLIPS_UNSET_BEGIN - enumerator SLIPS_UNSET_END - + enum, bind(c) enumerator MOUSE_HOLE_NEUTRAL enumerator MOUSE_HOLE_FILL enumerator MOUSE_HOLE_EMPTY - + end enum + enum, bind(c) enumerator KELLY_NEUTRAL enumerator KELLY_INSTALL enumerator KELLY_REMOVE - + end enum + enum, bind(c) !enumerator FILLUP_HEAD_NEUTRAL enumerator FILLUP_HEAD_REMOVE enumerator FILLUP_HEAD_INSTALL - + end enum + enum, bind(c) enumerator ELEVATOR_NEUTRAL - enumerator ELEVATOR_LATCH_STRING_BEGIN enumerator ELEVATOR_LATCH_STRING_END @@ -119,19 +126,23 @@ module UnitySignalVariables enumerator ELEVATOR_UNLATCH_SINGLE_BEGIN enumerator ELEVATOR_UNLATCH_SINGLE_END - + end enum + enum, bind(c) !enumerator MUD_BUCKET_NEUTRAL enumerator MUD_BUCKET_REMOVE enumerator MUD_BUCKET_INSTALL - + end enum + enum, bind(c) !enumerator IBOP_NEUTRAL enumerator IBOP_REMOVE enumerator IBOP_INSTALL - + end enum + enum, bind(c) enumerator TDS_CONNECTION_NOTHING enumerator TDS_CONNECTION_STRING enumerator TDS_CONNECTION_SPINE - + end enum + enum, bind(c) enumerator TDS_ELEVATOR_CONNECTION_NOTHING enumerator TDS_ELEVATOR_CONNECTION_STRING enumerator TDS_ELEVATOR_CONNECTION_SINGLE @@ -142,6 +153,5 @@ module UnitySignalVariables end enum contains - end module UnitySignalVariables diff --git a/CSharp/Problems/CRotaryProblems.i90 b/CSharp/Problems/CRotaryProblems.i90 index 0fb4931..0ae2bbc 100644 --- a/CSharp/Problems/CRotaryProblems.i90 +++ b/CSharp/Problems/CRotaryProblems.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Problems/CRotaryProblems.f90" +# 1 "/home/admin/SimulationCore2/CSharp/Problems/CRotaryProblems.f90" module CRotaryProblems use SimulationVariables implicit none diff --git a/Equipments/BopStack/ANNULAR.f90 b/Equipments/BopStack/ANNULAR.f90 index faef276..07e73b6 100644 --- a/Equipments/BopStack/ANNULAR.f90 +++ b/Equipments/BopStack/ANNULAR.f90 @@ -14,173 +14,173 @@ SUBROUTINE ANNULAR_SUB1 ! START CONDITIONS FOR ANNULAR PREVENTER !===================================================================== - data%State%RAM(1)%SuccessionCounter = data%State%RAM(1)%SuccessionCounter + 1 + data%State%RAM(1)%SuccessionCounter = data%State%RAM(1)%SuccessionCounter + 1 - if (data%Equipments%BopControlPanel%AnnularValve == 1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then - - if (data%State%BopStackInput%AnnularCloseLedMine == LedOn) then - RETURN - end if - - - if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then - data%State%RAM(1)%SuccessionCounter = 0 ! also in starup - data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup - !return - else - data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter - endif + if (data%Equipments%BopControlPanel%AnnularValve == 1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then + + if (data%State%BopStackInput%AnnularCloseLedMine == LedOn) then + RETURN + end if + + + if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then + data%State%RAM(1)%SuccessionCounter = 0 ! also in starup + data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup + !return + else + data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter + endif - if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then - !return - - data%State%RAM(1)%First_CloseTimecheck= 1 - - data%Equipments%BopControlPanel%AnnularOpenLED = LedOff - data%State%BopStackInput%AnnularOpenLedMine = LedOff - data%Equipments%BopControlPanel%AnnularCloseLED = LedOn !LedBlinking - - data%State%RAM(1)%FourwayValve = 1 - - endif + if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then + !return + + data%State%RAM(1)%First_CloseTimecheck= 1 + + data%Equipments%BopControlPanel%AnnularOpenLED = LedOff + data%State%BopStackInput%AnnularOpenLedMine = LedOff + data%Equipments%BopControlPanel%AnnularCloseLED = LedOn !LedBlinking + + data%State%RAM(1)%FourwayValve = 1 endif + + endif - if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure) then ! 1: Open , 0: Close + if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure) then ! 1: Open , 0: Close + - - data%State%RAM(1)%FourwayValve = 0 - - - - data%State%Annular%Annular_closed=0 - !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) - data%State%RAM(1)%vdis_tot=0 - data%State%RAM(1)%vdis_bottles=0. - data%State%RAM(1)%fvr_air=0. - data%State%RAM(1)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(1)%Qzero=70 - data%State%RAM(1)%Q=data%State%RAM(1)%Qzero - data%State%RAM(1)%flow=70 - data%State%Annular%tolAnnular=0.0018 - if (data%State%Annular%finished_Annular==1) then - data%State%Annular%AnnularLeverOld=-1.0 - else - data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve - endif - data%State%Annular%finished_Annular=0 - data%State%Annular%AnnularIsClosing = .true. - data%State%Annular%AnnularIsOpening = .false. + data%State%RAM(1)%FourwayValve = 0 + + + + data%State%Annular%Annular_closed=0 + !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) + data%State%RAM(1)%vdis_tot=0 + data%State%RAM(1)%vdis_bottles=0. + data%State%RAM(1)%fvr_air=0. + data%State%RAM(1)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(1)%Qzero=70 + data%State%RAM(1)%Q=data%State%RAM(1)%Qzero + data%State%RAM(1)%flow=70 + data%State%Annular%tolAnnular=0.0018 + if (data%State%Annular%finished_Annular==1) then + data%State%Annular%AnnularLeverOld=-1.0 + else + data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve + endif + data%State%Annular%finished_Annular=0 + data%State%Annular%AnnularIsClosing = .true. + data%State%Annular%AnnularIsOpening = .false. - data%State%RAM(2)%bop_type = 3 - !AbopAnnular=963.1 !(in^2) - data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerClose*231.)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal - data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5 - !WRITE(*,*) 'a)NeededVolumeAnnular=' , NeededVolumeAnnular - !write(*,*) 'close 1' - endif + data%State%RAM(2)%bop_type = 3 + !AbopAnnular=963.1 !(in^2) + data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerClose*231.)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal + data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5 + !WRITE(*,*) 'a)NeededVolumeAnnular=' , NeededVolumeAnnular + !write(*,*) 'close 1' + endif - if (data%Equipments%BopControlPanel%AnnularValve == -1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 ) then + if (data%Equipments%BopControlPanel%AnnularValve == -1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 ) then + + if (data%State%BopStackInput%AnnularOpenLedMine == LedOn) then + RETURN + end if + + !CasingPressure : PressureGauges(2) *****temp conditionssssss + + !note: (AnnularSealingPressure) is only for opening while well is pressurised + + + if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then + data%State%RAM(1)%SuccessionCounter = 0 ! also in starup + data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup + !return + else + data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter + endif + + + + if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then + !return - if (data%State%BopStackInput%AnnularOpenLedMine == LedOn) then - RETURN - end if + data%State%RAM(1)%First_OpenTimecheck= 1 - !CasingPressure : PressureGauges(2) *****temp conditionssssss + data%Equipments%BopControlPanel%AnnularCloseLED = LedOff !new + data%State%BopStackInput%AnnularCloseLedMine = LedOff !new + data%Equipments%BopControlPanel%AnnularOpenLED = LedOn !LedBlinking - !note: (AnnularSealingPressure) is only for opening while well is pressurised - - - if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then - data%State%RAM(1)%SuccessionCounter = 0 ! also in starup - data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup - !return - else - data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter - endif - - - - if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then - !return - - data%State%RAM(1)%First_OpenTimecheck= 1 - - data%Equipments%BopControlPanel%AnnularCloseLED = LedOff !new - data%State%BopStackInput%AnnularCloseLedMine = LedOff !new - data%Equipments%BopControlPanel%AnnularOpenLED = LedOn !LedBlinking - - data%State%RAM(1)%FourwayValve = 1 - - endif + data%State%RAM(1)%FourwayValve = 1 endif + endif + - if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure & + if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure & .and. (data%State%Annular%Annular_closed==0 .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2) <=100.0) .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2)>100.0 .and. data%State%Annular%Pannular_reg>=data%State%AnnularComputational%AnnularSealingPressure))) then ! 1: Open , 0: Close - !write(*,*) 'open 2' + !write(*,*) 'open 2' - data%State%RAM(1)%FourwayValve = 0 + data%State%RAM(1)%FourwayValve = 0 - data%State%Annular%Annular_closed=0 - !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) - data%State%RAM(1)%vdis_tot=0 - data%State%RAM(1)%vdis_bottles=0. - data%State%RAM(1)%fvr_air=0. - data%State%RAM(1)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(1)%Qzero=70 - data%State%RAM(1)%Q=data%State%RAM(1)%Qzero - data%State%RAM(1)%flow=70 - data%State%Annular%tolAnnular=0.0018 + data%State%Annular%Annular_closed=0 + !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) + data%State%RAM(1)%vdis_tot=0 + data%State%RAM(1)%vdis_bottles=0. + data%State%RAM(1)%fvr_air=0. + data%State%RAM(1)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(1)%Qzero=70 + data%State%RAM(1)%Q=data%State%RAM(1)%Qzero + data%State%RAM(1)%flow=70 + data%State%Annular%tolAnnular=0.0018 - if (data%State%Annular%finished_Annular==1) then - data%State%Annular%AnnularLeverOld=1.0 - else - data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve - endif - data%State%Annular%finished_Annular=0 - data%State%Annular%AnnularIsOpening = .true. - data%State%Annular%AnnularIsClosing = .false. + if (data%State%Annular%finished_Annular==1) then + data%State%Annular%AnnularLeverOld=1.0 + else + data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve + endif + data%State%Annular%finished_Annular=0 + data%State%Annular%AnnularIsOpening = .true. + data%State%Annular%AnnularIsClosing = .false. - !if (AnnularOpenLed == LedOn) then - ! RETURN - !end if + !if (AnnularOpenLed == LedOn) then + ! RETURN + !end if - data%State%RAM(1)%bop_type = 3 - !AbopAnnular=758.48 !(in^2) - data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerOpen*231)/((data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/2.) - data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5 - !write(*,*) 'open 1' + data%State%RAM(1)%bop_type = 3 + !AbopAnnular=758.48 !(in^2) + data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerOpen*231)/((data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/2.) + data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5 + !write(*,*) 'open 1' - endif + endif !===================================================================== -if (data%State%Annular%AnnularIsOpening .or. data%State%Annular%AnnularIsClosing .or. data%State%RAM(1)%Bottles_Charged_MalfActive) then - CALL ANNULAR_SUB2 -end if + if (data%State%Annular%AnnularIsOpening .or. data%State%Annular%AnnularIsClosing .or. data%State%RAM(1)%Bottles_Charged_MalfActive) then + CALL ANNULAR_SUB2 + end if - END SUBROUTINE ANNULAR_SUB1 +END SUBROUTINE ANNULAR_SUB1 diff --git a/Equipments/BopStack/ANNULAR.i90 b/Equipments/BopStack/ANNULAR.i90 index 1f493c7..ec14e4d 100644 --- a/Equipments/BopStack/ANNULAR.i90 +++ b/Equipments/BopStack/ANNULAR.i90 @@ -15,147 +15,147 @@ SUBROUTINE ANNULAR_SUB1 ! START CONDITIONS FOR ANNULAR PREVENTER !===================================================================== - data%State%RAM(1)%SuccessionCounter = data%State%RAM(1)%SuccessionCounter + 1 + data%State%RAM(1)%SuccessionCounter = data%State%RAM(1)%SuccessionCounter + 1 - if (data%Equipments%BopControlPanel%AnnularValve == 1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then - - if (data%State%BopStackInput%AnnularCloseLedMine == LedOn) then - RETURN - end if - - - if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then - data%State%RAM(1)%SuccessionCounter = 0 ! also in starup - data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup + if (data%Equipments%BopControlPanel%AnnularValve == 1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then + + if (data%State%BopStackInput%AnnularCloseLedMine == LedOn) then + RETURN + end if + + + if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then + data%State%RAM(1)%SuccessionCounter = 0 ! also in starup + data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup !return - else - data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter - endif + else + data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter + endif - if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then + if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then !return - - data%State%RAM(1)%First_CloseTimecheck= 1 - - data%Equipments%BopControlPanel%AnnularOpenLED = LedOff - data%State%BopStackInput%AnnularOpenLedMine = LedOff - data%Equipments%BopControlPanel%AnnularCloseLED = LedOn !LedBlinking - - data%State%RAM(1)%FourwayValve = 1 - - endif + + data%State%RAM(1)%First_CloseTimecheck= 1 + + data%Equipments%BopControlPanel%AnnularOpenLED = LedOff + data%State%BopStackInput%AnnularOpenLedMine = LedOff + data%Equipments%BopControlPanel%AnnularCloseLED = LedOn !LedBlinking + + data%State%RAM(1)%FourwayValve = 1 endif + + endif - if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure) then ! 1: Open , 0: Close + if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure) then ! 1: Open , 0: Close + - - data%State%RAM(1)%FourwayValve = 0 - - - - data%State%Annular%Annular_closed=0 + data%State%RAM(1)%FourwayValve = 0 + + + + data%State%Annular%Annular_closed=0 !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) - data%State%RAM(1)%vdis_tot=0 - data%State%RAM(1)%vdis_bottles=0. - data%State%RAM(1)%fvr_air=0. - data%State%RAM(1)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(1)%Qzero=70 - data%State%RAM(1)%Q=data%State%RAM(1)%Qzero - data%State%RAM(1)%flow=70 - data%State%Annular%tolAnnular=0.0018 - if (data%State%Annular%finished_Annular==1) then - data%State%Annular%AnnularLeverOld=-1.0 - else - data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve - endif - data%State%Annular%finished_Annular=0 - data%State%Annular%AnnularIsClosing = .true. - data%State%Annular%AnnularIsOpening = .false. + data%State%RAM(1)%vdis_tot=0 + data%State%RAM(1)%vdis_bottles=0. + data%State%RAM(1)%fvr_air=0. + data%State%RAM(1)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(1)%Qzero=70 + data%State%RAM(1)%Q=data%State%RAM(1)%Qzero + data%State%RAM(1)%flow=70 + data%State%Annular%tolAnnular=0.0018 + if (data%State%Annular%finished_Annular==1) then + data%State%Annular%AnnularLeverOld=-1.0 + else + data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve + endif + data%State%Annular%finished_Annular=0 + data%State%Annular%AnnularIsClosing = .true. + data%State%Annular%AnnularIsOpening = .false. - data%State%RAM(2)%bop_type = 3 + data%State%RAM(2)%bop_type = 3 !AbopAnnular=963.1 !(in^2) - data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerClose*231.)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal - data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5 + data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerClose*231.)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal + data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5 !WRITE(*,*) 'a)NeededVolumeAnnular=' , NeededVolumeAnnular !write(*,*) 'close 1' - endif + endif - if (data%Equipments%BopControlPanel%AnnularValve == -1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 ) then - - if (data%State%BopStackInput%AnnularOpenLedMine == LedOn) then - RETURN - end if - + if (data%Equipments%BopControlPanel%AnnularValve == -1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 ) then + + if (data%State%BopStackInput%AnnularOpenLedMine == LedOn) then + RETURN + end if + !CasingPressure : PressureGauges(2) *****temp conditionssssss - + !note: (AnnularSealingPressure) is only for opening while well is pressurised - + - if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then - data%State%RAM(1)%SuccessionCounter = 0 ! also in starup - data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup + if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then + data%State%RAM(1)%SuccessionCounter = 0 ! also in starup + data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup !return - else - data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter - endif - + else + data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter + endif + - - if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then + + if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then !return - - data%State%RAM(1)%First_OpenTimecheck= 1 - - data%Equipments%BopControlPanel%AnnularCloseLED = LedOff !new - data%State%BopStackInput%AnnularCloseLedMine = LedOff !new - data%Equipments%BopControlPanel%AnnularOpenLED = LedOn !LedBlinking - - data%State%RAM(1)%FourwayValve = 1 - - endif + + data%State%RAM(1)%First_OpenTimecheck= 1 + + data%Equipments%BopControlPanel%AnnularCloseLED = LedOff !new + data%State%BopStackInput%AnnularCloseLedMine = LedOff !new + data%Equipments%BopControlPanel%AnnularOpenLED = LedOn !LedBlinking + + data%State%RAM(1)%FourwayValve = 1 endif + endif + - if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure & + if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure & .and. (data%State%Annular%Annular_closed==0 .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2) <=100.0) .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2)>100.0 .and. data%State%Annular%Pannular_reg>=data%State%AnnularComputational%AnnularSealingPressure))) then ! 1: Open , 0: Close !write(*,*) 'open 2' - data%State%RAM(1)%FourwayValve = 0 + data%State%RAM(1)%FourwayValve = 0 - data%State%Annular%Annular_closed=0 + data%State%Annular%Annular_closed=0 !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) - data%State%RAM(1)%vdis_tot=0 - data%State%RAM(1)%vdis_bottles=0. - data%State%RAM(1)%fvr_air=0. - data%State%RAM(1)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(1)%Qzero=70 - data%State%RAM(1)%Q=data%State%RAM(1)%Qzero - data%State%RAM(1)%flow=70 - data%State%Annular%tolAnnular=0.0018 + data%State%RAM(1)%vdis_tot=0 + data%State%RAM(1)%vdis_bottles=0. + data%State%RAM(1)%fvr_air=0. + data%State%RAM(1)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(1)%Qzero=70 + data%State%RAM(1)%Q=data%State%RAM(1)%Qzero + data%State%RAM(1)%flow=70 + data%State%Annular%tolAnnular=0.0018 - if (data%State%Annular%finished_Annular==1) then - data%State%Annular%AnnularLeverOld=1.0 - else - data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve - endif - data%State%Annular%finished_Annular=0 - data%State%Annular%AnnularIsOpening = .true. - data%State%Annular%AnnularIsClosing = .false. + if (data%State%Annular%finished_Annular==1) then + data%State%Annular%AnnularLeverOld=1.0 + else + data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve + endif + data%State%Annular%finished_Annular=0 + data%State%Annular%AnnularIsOpening = .true. + data%State%Annular%AnnularIsClosing = .false. !if (AnnularOpenLed == LedOn) then @@ -164,24 +164,24 @@ SUBROUTINE ANNULAR_SUB1 - data%State%RAM(1)%bop_type = 3 + data%State%RAM(1)%bop_type = 3 !AbopAnnular=758.48 !(in^2) - data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerOpen*231)/((data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/2.) - data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5 + data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerOpen*231)/((data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/2.) + data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5 !write(*,*) 'open 1' - endif + endif !===================================================================== -if (data%State%Annular%AnnularIsOpening .or. data%State%Annular%AnnularIsClosing .or. data%State%RAM(1)%Bottles_Charged_MalfActive) then - CALL ANNULAR_SUB2 -end if + if (data%State%Annular%AnnularIsOpening .or. data%State%Annular%AnnularIsClosing .or. data%State%RAM(1)%Bottles_Charged_MalfActive) then + CALL ANNULAR_SUB2 + end if - END SUBROUTINE ANNULAR_SUB1 +END SUBROUTINE ANNULAR_SUB1 diff --git a/Equipments/BopStack/BOP.f90 b/Equipments/BopStack/BOP.f90 index 5f52944..42579a4 100644 --- a/Equipments/BopStack/BOP.f90 +++ b/Equipments/BopStack/BOP.f90 @@ -289,7 +289,8 @@ module BOP data%Equipments%BopControlPanel%LowerRamsStatus = data%State%PipeRam2%ID data%Equipments%BopControlPanel%AnnularStatus = data%State%Annular%IDAnnular data%Equipments%BopControlPanel%AccumulatorPressureGauge = (1 - data%State%BopStackAcc%AccumulatorPressureGaugeMalf) * data%State%RamLine%P_ACC - data%Equipments%BopControlPanel%ManifoldPressureGauge= (1 - data%State%BopStackAcc%ManifoldPressureGaugeMalf) * data%State%BopStackAcc%pram_reg + data%Equipments%BopControlPanel%ManifoldPressureGauge = (1 - data%State%BopStackAcc%ManifoldPressureGaugeMalf) * data%State%BopStackAcc%pram_reg + ! if(print_log) print *, "ManifoldPressureGauge = ", data%Equipments%BopControlPanel%ManifoldPressureGauge !AnnularPressureGauge=Pannular_reg ! ! WRITE(60,60) data%State%RAM(2)%time,data%State%RAM(2)%Q,data%State%RAM(2)%vdis_tot,p_acc, & diff --git a/Equipments/BopStack/BOP.i90 b/Equipments/BopStack/BOP.i90 index 53c9ad7..64e902e 100644 --- a/Equipments/BopStack/BOP.i90 +++ b/Equipments/BopStack/BOP.i90 @@ -18,7 +18,7 @@ module BOP data%State%BopStackInput%BOP_timeCounter= data%State%BopStackInput%BOP_timeCounter + 1 - write(*,*) 'BOP_timeCounter=' , data%State%BopStackInput%BOP_timeCounter +! write(*,*) 'BOP_timeCounter=' , data%State%BopStackInput%BOP_timeCounter data%Equipments%BopControlPanel%AirSupplyPressureGauge= (1 - data%State%BopStackAcc%AirSupplyPressureGaugeMalf)* (1 - data%State%BopStackAcc%RigAirMalf) *120. !psi @@ -290,7 +290,8 @@ module BOP data%Equipments%BopControlPanel%LowerRamsStatus = data%State%PipeRam2%ID data%Equipments%BopControlPanel%AnnularStatus = data%State%Annular%IDAnnular data%Equipments%BopControlPanel%AccumulatorPressureGauge = (1 - data%State%BopStackAcc%AccumulatorPressureGaugeMalf) * data%State%RamLine%P_ACC - data%Equipments%BopControlPanel%ManifoldPressureGauge= (1 - data%State%BopStackAcc%ManifoldPressureGaugeMalf) * data%State%BopStackAcc%pram_reg + data%Equipments%BopControlPanel%ManifoldPressureGauge = (1 - data%State%BopStackAcc%ManifoldPressureGaugeMalf) * data%State%BopStackAcc%pram_reg +! if(print_log) print *, "ManifoldPressureGauge = ", data%Equipments%BopControlPanel%ManifoldPressureGauge !AnnularPressureGauge=Pannular_reg ! ! WRITE(60,60) data%State%RAM(2)%time,data%State%RAM(2)%Q,data%State%RAM(2)%vdis_tot,p_acc, & diff --git a/Equipments/BopStack/KILL_LINE.f90 b/Equipments/BopStack/KILL_LINE.f90 index dba38e8..37c25de 100644 --- a/Equipments/BopStack/KILL_LINE.f90 +++ b/Equipments/BopStack/KILL_LINE.f90 @@ -17,11 +17,11 @@ SUBROUTINE KILL_LINE ! START CONDITIONS FOR KILL LINE 1 !===================================================================== - data%State%RAM(6)%SuccessionCounter = data%State%RAM(6)%SuccessionCounter + 1 + data%State%RAM(6)%SuccessionCounter = data%State%RAM(6)%SuccessionCounter + 1 - if (data%Equipments%BopControlPanel%KillLineValve == -1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then - + if (data%Equipments%BopControlPanel%KillLineValve == -1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then + if ( data%State%RAM(6)%SuccessionCounter /= data%State%RAM(6)%SuccessionCounterOld+1 ) then data%State%RAM(6)%SuccessionCounter = 0 ! also in starup data%State%RAM(6)%SuccessionCounterOld = 0 ! also in starup @@ -35,97 +35,97 @@ SUBROUTINE KILL_LINE return endif - data%State%RAM(6)%First_CloseTimecheck= 1 + data%State%RAM(6)%First_CloseTimecheck= 1 - if (data%State%BopStackInput%KillLineOpenLedMine == LedOn) then - RETURN - end if - data%State%KillLine%closed=0 - data%State%RAM(6)%vdis_tot=0 - data%State%RAM(6)%vdis_bottles=0. - data%State%RAM(6)%fvr_air=0. - data%State%RAM(6)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(6)%Qzero=70 - data%State%RAM(6)%Q=data%State%RAM(6)%Qzero - data%State%RAM(6)%flow=70 - data%State%RAM(6)%tol=0.0037 - if (data%State%KillLine%finished==1) then - data%State%KillLine%LeverOld= 1.0 - else - data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve - endif - data%State%KillLine%finished=0 - data%State%KillLine%IsOpening = .true. - data%Equipments%BopControlPanel%KillLineCloseLED = LedOff - data%State%BopStackInput%KillLineCloseLedMine = LedOff - data%Equipments%BopControlPanel%KillLineOpenLED = LedOn !LedBlinking - data%State%RAM(6)%bop_type = 3 - !AbopKillLine=196.67 - data%State%KillLine%Abop=(data%Configuration%BopStack%KillClose*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) - data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP + if (data%State%BopStackInput%KillLineOpenLedMine == LedOn) then + RETURN + end if + data%State%KillLine%closed=0 + data%State%RAM(6)%vdis_tot=0 + data%State%RAM(6)%vdis_bottles=0. + data%State%RAM(6)%fvr_air=0. + data%State%RAM(6)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(6)%Qzero=70 + data%State%RAM(6)%Q=data%State%RAM(6)%Qzero + data%State%RAM(6)%flow=70 + data%State%RAM(6)%tol=0.0037 + if (data%State%KillLine%finished==1) then + data%State%KillLine%LeverOld= 1.0 + else + data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve endif + data%State%KillLine%finished=0 + data%State%KillLine%IsOpening = .true. + data%Equipments%BopControlPanel%KillLineCloseLED = LedOff + data%State%BopStackInput%KillLineCloseLedMine = LedOff + data%Equipments%BopControlPanel%KillLineOpenLED = LedOn !LedBlinking + data%State%RAM(6)%bop_type = 3 + !AbopKillLine=196.67 + data%State%KillLine%Abop=(data%Configuration%BopStack%KillClose*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) + data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP + endif - if (data%Equipments%BopControlPanel%KillLineValve == 1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then - - - if ( data%State%RAM(6)%SuccessionCounter /= data%State%RAM(6)%SuccessionCounterOld+1 ) then - data%State%RAM(6)%SuccessionCounter = 0 ! also in starup - data%State%RAM(6)%SuccessionCounterOld = 0 ! also in starup - return - else - data%State%RAM(6)%SuccessionCounterOld= data%State%RAM(6)%SuccessionCounter - endif + if (data%Equipments%BopControlPanel%KillLineValve == 1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then - if ( data%State%RAM(6)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then - return - endif - - data%State%RAM(6)%First_OpenTimecheck= 1 - - - - if (data%State%BopStackInput%KillLineCloseLedMine == LedOn) then - RETURN - end if - data%State%KillLine%closed=0 - data%State%RAM(6)%vdis_tot=0 - data%State%RAM(6)%vdis_bottles=0. - data%State%RAM(6)%fvr_air=0. - data%State%RAM(6)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(6)%Qzero=70 - data%State%RAM(6)%Q=data%State%RAM(6)%Qzero - data%State%RAM(6)%flow=70 - data%State%RAM(6)%tol=0.0037 - + if ( data%State%RAM(6)%SuccessionCounter /= data%State%RAM(6)%SuccessionCounterOld+1 ) then + data%State%RAM(6)%SuccessionCounter = 0 ! also in starup + data%State%RAM(6)%SuccessionCounterOld = 0 ! also in starup + return + else + data%State%RAM(6)%SuccessionCounterOld= data%State%RAM(6)%SuccessionCounter + endif + + + if ( data%State%RAM(6)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then + return + endif + data%State%RAM(6)%First_OpenTimecheck= 1 + + + + if (data%State%BopStackInput%KillLineCloseLedMine == LedOn) then + RETURN + end if + data%State%KillLine%closed=0 + data%State%RAM(6)%vdis_tot=0 + data%State%RAM(6)%vdis_bottles=0. + data%State%RAM(6)%fvr_air=0. + data%State%RAM(6)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(6)%Qzero=70 + data%State%RAM(6)%Q=data%State%RAM(6)%Qzero + data%State%RAM(6)%flow=70 + data%State%RAM(6)%tol=0.0037 + + - if (data%State%KillLine%finished==1) then - data%State%KillLine%LeverOld= -1.0 - else - data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve - endif - data%State%KillLine%finished=0 - data%State%KillLine%IsClosing = .true. + if (data%State%KillLine%finished==1) then + data%State%KillLine%LeverOld= -1.0 + else + data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve + endif + data%State%KillLine%finished=0 + data%State%KillLine%IsClosing = .true. + + !if (KillLineCloseLed == LedOn) then + ! RETURN + !end if - !if (KillLineCloseLed == LedOn) then - ! RETURN - !end if - - data%Equipments%BopControlPanel%KillLineCloseLED = LedOff !new - data%State%BopStackInput%KillLineCloseLedMine = LedOff !new - - data%Equipments%BopControlPanel%KillLineCloseLED = LedOn !LedBlinking - data%State%RAM(6)%bop_type = 3 - !AbopKillLine=196.67 - data%State%KillLine%Abop=(data%Configuration%BopStack%KillOpen*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) - data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP - endif + data%Equipments%BopControlPanel%KillLineCloseLED = LedOff !new + data%State%BopStackInput%KillLineCloseLedMine = LedOff !new + + data%Equipments%BopControlPanel%KillLineCloseLED = LedOn !LedBlinking + data%State%RAM(6)%bop_type = 3 + !AbopKillLine=196.67 + data%State%KillLine%Abop=(data%Configuration%BopStack%KillOpen*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) + data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP + endif !========================================================================== diff --git a/Equipments/BopStack/KILL_LINE.i90 b/Equipments/BopStack/KILL_LINE.i90 index 96e5c0c..70dd9d6 100644 --- a/Equipments/BopStack/KILL_LINE.i90 +++ b/Equipments/BopStack/KILL_LINE.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/BopStack/KILL_LINE.f90" +# 1 "/home/admin/SimulationCore2/Equipments/BopStack/KILL_LINE.f90" SUBROUTINE KILL_LINE @@ -18,11 +18,11 @@ SUBROUTINE KILL_LINE ! START CONDITIONS FOR KILL LINE 1 !===================================================================== - data%State%RAM(6)%SuccessionCounter = data%State%RAM(6)%SuccessionCounter + 1 + data%State%RAM(6)%SuccessionCounter = data%State%RAM(6)%SuccessionCounter + 1 - if (data%Equipments%BopControlPanel%KillLineValve == -1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then - + if (data%Equipments%BopControlPanel%KillLineValve == -1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then + if ( data%State%RAM(6)%SuccessionCounter /= data%State%RAM(6)%SuccessionCounterOld+1 ) then data%State%RAM(6)%SuccessionCounter = 0 ! also in starup data%State%RAM(6)%SuccessionCounterOld = 0 ! also in starup @@ -36,97 +36,97 @@ SUBROUTINE KILL_LINE return endif - data%State%RAM(6)%First_CloseTimecheck= 1 + data%State%RAM(6)%First_CloseTimecheck= 1 - if (data%State%BopStackInput%KillLineOpenLedMine == LedOn) then - RETURN - end if - data%State%KillLine%closed=0 - data%State%RAM(6)%vdis_tot=0 - data%State%RAM(6)%vdis_bottles=0. - data%State%RAM(6)%fvr_air=0. - data%State%RAM(6)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(6)%Qzero=70 - data%State%RAM(6)%Q=data%State%RAM(6)%Qzero - data%State%RAM(6)%flow=70 - data%State%RAM(6)%tol=0.0037 - if (data%State%KillLine%finished==1) then - data%State%KillLine%LeverOld= 1.0 - else - data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve - endif - data%State%KillLine%finished=0 - data%State%KillLine%IsOpening = .true. - data%Equipments%BopControlPanel%KillLineCloseLED = LedOff - data%State%BopStackInput%KillLineCloseLedMine = LedOff - data%Equipments%BopControlPanel%KillLineOpenLED = LedOn !LedBlinking - data%State%RAM(6)%bop_type = 3 -!AbopKillLine=196.67 - data%State%KillLine%Abop=(data%Configuration%BopStack%KillClose*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) - data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP + if (data%State%BopStackInput%KillLineOpenLedMine == LedOn) then + RETURN + end if + data%State%KillLine%closed=0 + data%State%RAM(6)%vdis_tot=0 + data%State%RAM(6)%vdis_bottles=0. + data%State%RAM(6)%fvr_air=0. + data%State%RAM(6)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(6)%Qzero=70 + data%State%RAM(6)%Q=data%State%RAM(6)%Qzero + data%State%RAM(6)%flow=70 + data%State%RAM(6)%tol=0.0037 + if (data%State%KillLine%finished==1) then + data%State%KillLine%LeverOld= 1.0 + else + data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve endif + data%State%KillLine%finished=0 + data%State%KillLine%IsOpening = .true. + data%Equipments%BopControlPanel%KillLineCloseLED = LedOff + data%State%BopStackInput%KillLineCloseLedMine = LedOff + data%Equipments%BopControlPanel%KillLineOpenLED = LedOn !LedBlinking + data%State%RAM(6)%bop_type = 3 +!AbopKillLine=196.67 + data%State%KillLine%Abop=(data%Configuration%BopStack%KillClose*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) + data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP + endif - if (data%Equipments%BopControlPanel%KillLineValve == 1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then - - - if ( data%State%RAM(6)%SuccessionCounter /= data%State%RAM(6)%SuccessionCounterOld+1 ) then - data%State%RAM(6)%SuccessionCounter = 0 ! also in starup - data%State%RAM(6)%SuccessionCounterOld = 0 ! also in starup - return - else - data%State%RAM(6)%SuccessionCounterOld= data%State%RAM(6)%SuccessionCounter - endif + if (data%Equipments%BopControlPanel%KillLineValve == 1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then - if ( data%State%RAM(6)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then - return - endif - - data%State%RAM(6)%First_OpenTimecheck= 1 - - - - if (data%State%BopStackInput%KillLineCloseLedMine == LedOn) then - RETURN - end if - data%State%KillLine%closed=0 - data%State%RAM(6)%vdis_tot=0 - data%State%RAM(6)%vdis_bottles=0. - data%State%RAM(6)%fvr_air=0. - data%State%RAM(6)%vdis_elecp=0. - data%State%Pumps%Qiter=7 - data%State%RAM(6)%Qzero=70 - data%State%RAM(6)%Q=data%State%RAM(6)%Qzero - data%State%RAM(6)%flow=70 - data%State%RAM(6)%tol=0.0037 - + if ( data%State%RAM(6)%SuccessionCounter /= data%State%RAM(6)%SuccessionCounterOld+1 ) then + data%State%RAM(6)%SuccessionCounter = 0 ! also in starup + data%State%RAM(6)%SuccessionCounterOld = 0 ! also in starup + return + else + data%State%RAM(6)%SuccessionCounterOld= data%State%RAM(6)%SuccessionCounter + endif + + + if ( data%State%RAM(6)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then + return + endif + data%State%RAM(6)%First_OpenTimecheck= 1 + + + + if (data%State%BopStackInput%KillLineCloseLedMine == LedOn) then + RETURN + end if + data%State%KillLine%closed=0 + data%State%RAM(6)%vdis_tot=0 + data%State%RAM(6)%vdis_bottles=0. + data%State%RAM(6)%fvr_air=0. + data%State%RAM(6)%vdis_elecp=0. + data%State%Pumps%Qiter=7 + data%State%RAM(6)%Qzero=70 + data%State%RAM(6)%Q=data%State%RAM(6)%Qzero + data%State%RAM(6)%flow=70 + data%State%RAM(6)%tol=0.0037 + + - if (data%State%KillLine%finished==1) then - data%State%KillLine%LeverOld= -1.0 - else - data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve - endif - data%State%KillLine%finished=0 - data%State%KillLine%IsClosing = .true. + if (data%State%KillLine%finished==1) then + data%State%KillLine%LeverOld= -1.0 + else + data%State%KillLine%LeverOld=data%Equipments%BopControlPanel%KillLineValve + endif + data%State%KillLine%finished=0 + data%State%KillLine%IsClosing = .true. - + !if (KillLineCloseLed == LedOn) then ! RETURN !end if - - data%Equipments%BopControlPanel%KillLineCloseLED = LedOff !new - data%State%BopStackInput%KillLineCloseLedMine = LedOff !new - - data%Equipments%BopControlPanel%KillLineCloseLED = LedOn !LedBlinking - data%State%RAM(6)%bop_type = 3 + + data%Equipments%BopControlPanel%KillLineCloseLED = LedOff !new + data%State%BopStackInput%KillLineCloseLedMine = LedOff !new + + data%Equipments%BopControlPanel%KillLineCloseLED = LedOn !LedBlinking + data%State%RAM(6)%bop_type = 3 !AbopKillLine=196.67 - data%State%KillLine%Abop=(data%Configuration%BopStack%KillOpen*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) - data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP - endif + data%State%KillLine%Abop=(data%Configuration%BopStack%KillOpen*231)/((data%State%KillLine%IDBase-data%State%KillLine%ODDrillpipe_inBase)/2.) + data%State%KillLine%NeededVolume=data%State%KillLine%Abop*(data%State%KillLine%IDBase-max(data%State%KillLine%ODDrillpipe_in,data%State%KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP + endif !========================================================================== diff --git a/Equipments/BopStack/KillLineMain.i90 b/Equipments/BopStack/KillLineMain.i90 new file mode 100644 index 0000000..60b6a00 --- /dev/null +++ b/Equipments/BopStack/KillLineMain.i90 @@ -0,0 +1,37 @@ +# 1 "/home/admin/SimulationCore2/Equipments/BopStack/KillLineMain.f90" +module KillLineMain + implicit none + public + contains + +! subroutine KillLine_Setup() +! ! use CSimulationVariables +! implicit none +! call OnSimulationInitialization%Add(KillLine_Init) +! call OnSimulationStop%Add(KillLine_Init) +! call OnKillLineStep%Add(KillLine_Step) +! call OnKillLineOutput%Add(KillLine_Output) +! call OnKillLineMain%Add(KillLineMainBody) +! end subroutine + +! subroutine KillLine_Init +! implicit none +! end subroutine KillLine_Init + + subroutine KillLine_Step + use SimulationVariables + implicit none + if (data%State%KillLine%finished/=0) then + call KILL_LINE + if (data%State%KillLine%IsOpening .or. data%State%KillLine%IsClosing) then + if(data%State%KillLine%finished==0) then + call KILL_LINE_SUB !only body of loop2 + endif + endif + else + call KILL_LINE_SUB + endif + end subroutine KillLine_Step + + +end module KillLineMain diff --git a/Equipments/BopStack/LOSS_INPUTS.i90 b/Equipments/BopStack/LOSS_INPUTS.i90 index 1e8db28..0cf1ced 100644 --- a/Equipments/BopStack/LOSS_INPUTS.i90 +++ b/Equipments/BopStack/LOSS_INPUTS.i90 @@ -64,7 +64,6 @@ INTEGER I ! RAMLINE MINOR LOSSES INPUT !=========================================================================== data%State%RamLine%NO_MINORSRAMLINE=34 - ALLOCATE (data%State%BopStackInput%MINORS1(data%State%RamLine%NO_MINORSRAMLINE,4)) ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION diff --git a/Equipments/ChokeControl/AirPump_Choke_Subs.f90 b/Equipments/ChokeControl/AirPump_Choke_Subs.f90 index ea58b95..e69de29 100644 --- a/Equipments/ChokeControl/AirPump_Choke_Subs.f90 +++ b/Equipments/ChokeControl/AirPump_Choke_Subs.f90 @@ -1,337 +0,0 @@ - - SUBROUTINE DEALLOCATE_ARRAYS_CHOKE() - -USE CHOKEVARIABLES -use SimulationVariables !@ - -implicit none -write(*,*) 'deallocateeeeeeeeeeeee' -!=========================================================================== -! AIR PUMP LOSSES INPUT -!=========================================================================== -!if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP) - -DEALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP,data%State%AirPumpLine%DIAM_AIR_INCH, & - data%State%AirPumpLine%Re_air,data%State%AirPumpLine%AREA_AIR,data%State%AirPumpLine%LENGT_AIR,data%State%AirPumpLine%ROUGHNESS_AIRPLINE,data%State%AirPumpLine%REL_ROUGHAIR, & - data%State%AirPumpLine%fric_air,data%State%AirPumpLine%fricloss_air) - !================================================================ -DEALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP,data%State%AirPumpLine%MINORDIAM_AIR_INCH, & - data%State%AirPumpLine%MINORAREA_AIR,data%State%AirPumpLine%LF_AIR,data%State%AirPumpLine%CV_AIR,data%State%AirPumpLine%NOTE_AIR & - ,data%State%AirPumpLine%minlosspa_air,data%State%AirPumpLine%minloss_air) - - END - - - - - - - SUBROUTINE LOSS_INPUTS_CHOKE() -USE CHOKEVARIABLES -use SimulationVariables !@ -implicit none - Integer I - - -!=========================================================================== -! AIR PUMP LOSSES INPUT -!=========================================================================== -data%State%AirPumpLine%NO_PIPINGS_AIRPLINE=1 - -ALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE,3)) - ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION -data%State%AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance - -!60960= 200 ft -ALLOCATE(data%State%AirPumpLine%DIAM_AIR_INCH(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) -ALLOCATE(data%State%AirPumpLine%Re_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) - -ALLOCATE(data%State%AirPumpLine%AREA_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) -ALLOCATE(data%State%AirPumpLine%LENGT_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) -ALLOCATE(data%State%AirPumpLine%ROUGHNESS_AIRPLINE(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) -ALLOCATE(data%State%AirPumpLine%REL_ROUGHAIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) -ALLOCATE(data%State%AirPumpLine%fric_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) -ALLOCATE(data%State%AirPumpLine%fricloss_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) - -DO I=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE - data%State%AirPumpLine%DIAM_AIR_INCH(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,1) - data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,2) - data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,3) - - - data%State%AirPumpLine%AREA_AIR(I)=PI*(data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m) - data%State%AirPumpLine%REL_ROUGHAIR(I)=data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)/(data%State%AirPumpLine%DIAM_AIR_INCH(I)*25.4) - !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m) - data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%LENGT_AIR(I)*.001 ! (m) - ENDDO - - - !================================================================ -data%State%AirPumpLine%NO_MINORS_AIRPLINE=6 - -ALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP(data%State%AirPumpLine%NO_MINORS_AIRPLINE,4)) - - ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION -data%State%AirPumpLine%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee -data%State%AirPumpLine%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow -data%State%AirPumpLine%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter -data%State%AirPumpLine%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve -data%State%AirPumpLine%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve -data%State%AirPumpLine%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA - - -ALLOCATE (data%State%AirPumpLine%MINORDIAM_AIR_INCH(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%MINORAREA_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE), & - data%State%AirPumpLine%LF_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%CV_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%NOTE_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE) & - ,data%State%AirPumpLine%minlosspa_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%minloss_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE)) - - -DO I=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE - data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,1) - data%State%AirPumpLine%LF_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,2) - data%State%AirPumpLine%CV_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,3) - data%State%AirPumpLine%NOTE_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,4) - - - data%State%AirPumpLine%MINORAREA_AIR(I)=PI*(data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m) -ENDDO - - - END - - - - - -! SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER) -! USE CHOKEVARIABLES -! use ConfigurationVariables !@ -! Use CSimulationVariables -! implicit none -! INTEGER CHNUMBER -! Integer I - -! loop3: do while (ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) -! if (data%Equipments%ChokeControlPanel%ChokeControlLever == 1.0) then -! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .true. -! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .false. -! endif -! if (data%Equipments%ChokeControlPanel%ChokeControlLever == -1.0) then -! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .true. -! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .false. -! endif -! data%State%AirPumpLine%TIME=data%State%AirPumpLine%TIME+data%State%AirPumpLine%DeltaT_Choke !overal time (s) -! call airpump_code_CHOKE(CHNUMBER) -! call sleepqq(100) -! if (IsStopped == .true.) return -! end do loop3 !while finished_Choke==0 -! end - - - - - - - SUBROUTINE airpump_code_CHOKE(CHNUMBER) - USE CHOKEVARIABLES -use SimulationVariables !@ - use CChokeManifold - use SimulationVariables - use CSounds - USE CChokeProblemsVariables - implicit none - Integer I - - INTEGER CHNUMBER - - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirPumpLine%QITER+.1 !(gpm) maximum flow for the start - data%State%AirPumpLine%diffp_air=-10 - data%State%AirPumpLine%losses_air=10 - - !=================================================================== - ! AIR OPERATED PUMP - ! MODEL 10-6000W030 RATIO 55:1 - !=================for air consumption at 100 psig=================== - do while (data%State%AirPumpLine%diffp_air<0) - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.1 - ! Qup=data%State%AirDrivenPump%QAIR_PUMP; - !cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM - data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) - ! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) - data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem - end do !returns Qup - - do while (abs((data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air)/data%State%AirPumpLine%diffp_air)>data%State%AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram - if (data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air>0) then - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP+.005 - else - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.005 - endif - !=================================================================== - ! AIR OPERATED PUMP - ! MODEL 10-6000W030 RATIO 55:1 - !=================for air consumption at 100 psig=================== - data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) - !kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) - data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem - !===========================LOSSES==================================== - do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE - data%State%AirPumpLine%Re_air(i)=data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(data%State%AirPumpLine%AREA_AIR(i)*nu) - enddo - do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE - if (data%State%AirPumpLine%Re_air(i) 1.0 ) then - data%State%Choke%SoundChokePump= 60 - data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke - 1.0 - else - data%State%Choke%SoundChokePump= 0.0 - endif - data%State%AirPumpLine%DELTAV_AIR=data%State%AirDrivenPump%QAIR_PUMP*data%State%AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm) - if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse + (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3 - if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse - (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) - !DeltaT_Choke= 1sec or 2sec - !((((((((IN OUTER LOOP)))))) - !===============AIR PUMP OUTPUTS========================= - data%State%AirPumpLine%alpha_timeair=data%State%AirPumpLine%TIME ! overal time (s) - data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem - data%State%AirPumpLine%alpha_pairp=data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%alpha_Qair=data%State%AirDrivenPump%QAIR_PUMP - !write(*,*) 'diffp_air=',diffp_air - !pause - data%State%AirPumpLine%alpha_diffpair=data%State%AirPumpLine%diffp_air - data%State%AirPumpLine%alpha_lossesair=data%State%AirPumpLine%losses_air - !======================================================== - !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') - - if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse>data%State%AirPumpLine%CourseBase) then - data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%AirPumpLine%CourseBase - data%State%Choke%SoundChokePump= 0.0 - endif - if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse<0.) then - data%State%CHOOKE(CHNUMBER)%PassedCourse=0. - data%State%Choke%SoundChokePump= 0.0 - endif - - call SetSoundChokePump(data%State%Choke%SoundChokePump) - data%State%CHOOKE(CHNUMBER)%PercentClose= data%State%CHOOKE(CHNUMBER)%PassedCourse/data%State%AirPumpLine%CourseBase - IF (data%Equipments%ChokeControlPanel%Choke1LED==1) THEN - data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(1)%PercentClose*10 - ELSE ! Choke2LED==1 - data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(2)%PercentClose*10 - ENDIF - !CALL SetHydraulicChock1(nint(MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)*100)) - ! CALL SetHydraulicChock2(nint(MIN(data%State%CHOOKE(2)%PercentClose / 0.91 , 1.0)*100)) - ! .91 >> 9 percent clearance - - ! =================== calculating Area - ! AreaChoke=0.5 - ! .91 >> 9 percent clearance - - data%State%CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2) - data%State%CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2 - data%State%Choke%HydraulicChoke1WashoutCoef= data%State%Choke%HydraulicChoke1WashoutCoef * data%State%CHOOKE(1)%WashoutMalf - data%State%Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke1WashoutCoef+ data%State%CHOOKE(1)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time - data%State%Choke%HydraulicChoke2WashoutCoef= data%State%Choke%HydraulicChoke2WashoutCoef * data%State%CHOOKE(2)%WashoutMalf - data%State%Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke2WashoutCoef+ data%State%CHOOKE(2)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time - !write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef - - IF (data%State%CHOOKE(1)%PlugMalf == 1) THEN - data%State%Choke%Present_HydraulicChoke1Plug= data%State%Choke%Present_HydraulicChoke1Plug * data%State%CHOOKE(1)%PlugMalf - ! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay - ! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent - !write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent - - if ( (data%problems%ChokeProblems%HydraulicChoke1PluggedPercent - data%State%Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then - data%State%Choke%DeltaPlug1Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke1Plug - data%State%Choke%Plug1TimeCounter = 0 - !write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug - endif - data%State%Choke%Plug1TimeCounter= data%State%Choke%Plug1TimeCounter + 1 - data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent - - if (data%State%Choke%Plug1TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 - data%State%Choke%Present_HydraulicChoke1Plug = data%State%Choke%Present_HydraulicChoke1Plug + data%State%CHOOKE(1)%PlugMalf* ((data%State%Choke%DeltaPlug1Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 - endif - !write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug - ENDIF - - IF (data%State%CHOOKE(2)%PlugMalf == 1) THEN - data%State%Choke%Present_HydraulicChoke2Plug= data%State%Choke%Present_HydraulicChoke2Plug * data%State%CHOOKE(2)%PlugMalf - ! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay - ! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent - if ( (data%problems%ChokeProblems%HydraulicChoke2PluggedPercent - data%State%Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then - data%State%Choke%DeltaPlug2Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke2Plug - data%State%Choke%Plug2TimeCounter = 0 - endif - data%State%Choke%Plug2TimeCounter= data%State%Choke%Plug2TimeCounter + 1 - data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent - if (data%State%Choke%Plug2TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 - data%State%Choke%Present_HydraulicChoke2Plug = data%State%Choke%Present_HydraulicChoke2Plug + data%State%CHOOKE(2)%PlugMalf *((data%State%Choke%DeltaPlug2Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 - endif - ENDIF - ! fully open area is 123/64 in^2 = 0.01334635 ft^2 - data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke+(data%State%CHOOKE(1)%WashoutMalf*data%State%Choke%HydraulicChoke1WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup - - !write(*,*) 'data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke=' ,data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke - - data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke-(data%State%CHOOKE(1)%PlugMalf* data%State%Choke%Present_HydraulicChoke1Plug *data%State%CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup - - data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke+(data%State%CHOOKE(2)%WashoutMalf*data%State%Choke%HydraulicChoke2WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup - data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke-(data%State%CHOOKE(2)%PlugMalf* data%State%Choke%Present_HydraulicChoke2Plug *data%State%CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup - !write(*,*) 'data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke=' ,data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke - - - data%State%CHOOKE(1)%AreaChokeFinal= data%State%CHOOKE(1)%AreaChoke - data%State%CHOOKE(2)%AreaChokeFinal= data%State%CHOOKE(2)%AreaChoke - - ! 144: ft^2 to in^2 - CALL SetHydraulicChock1(100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve - CALL SetHydraulicChock2(100 - nint((data%State%CHOOKE(2)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve - - - !write(*,*) 'data%State%CHOOKE(1)%PercentClose=' , data%State%CHOOKE(1)%PercentClose ! close percent 0 to 100 - !write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display - !write(*,*) 'data%State%CHOOKE(1)%AreaChokeFinal=' , data%State%CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance - !write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.) - !write(*,*) 'valve value=' , 100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance - !write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close - ! =================== calculating Area - !write(*,*) 'data%State%CHOOKE(1)%AreaChoke= ' , data%State%CHOOKE(1)%AreaChoke - !WRITE(150,50) alpha_timeair,alpha_Qair,alpha_pairp, & - !alpha_Pdownstrem,alpha_diffpair,alpha_lossesair,data%State%CHOOKE(CHNUMBER)%PassedCourse - !50 FORMAT(7(f15.5)) - !======================================================================================== - !======================================================================================== - ! write(*,*) PassedCourse - end diff --git a/Equipments/ChokeControl/AirPump_Choke_Subs.i90 b/Equipments/ChokeControl/AirPump_Choke_Subs.i90 index cc1e946..29a21a7 100644 --- a/Equipments/ChokeControl/AirPump_Choke_Subs.i90 +++ b/Equipments/ChokeControl/AirPump_Choke_Subs.i90 @@ -1,338 +1 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/ChokeControl/AirPump_Choke_Subs.f90" - - SUBROUTINE DEALLOCATE_ARRAYS_CHOKE() - -USE CHOKEVARIABLES -use SimulationVariables !@ - -implicit none -write(*,*) 'deallocateeeeeeeeeeeee' -!=========================================================================== -! AIR PUMP LOSSES INPUT -!=========================================================================== -!if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP) - -DEALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP,data%State%AirPumpLine%DIAM_AIR_INCH, & - data%State%AirPumpLine%Re_air,data%State%AirPumpLine%AREA_AIR,data%State%AirPumpLine%LENGT_AIR,data%State%AirPumpLine%ROUGHNESS_AIRPLINE,data%State%AirPumpLine%REL_ROUGHAIR, & - data%State%AirPumpLine%fric_air,data%State%AirPumpLine%fricloss_air) -!================================================================ -DEALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP,data%State%AirPumpLine%MINORDIAM_AIR_INCH, & - data%State%AirPumpLine%MINORAREA_AIR,data%State%AirPumpLine%LF_AIR,data%State%AirPumpLine%CV_AIR,data%State%AirPumpLine%NOTE_AIR & - ,data%State%AirPumpLine%minlosspa_air,data%State%AirPumpLine%minloss_air) - - END - - - - - - - SUBROUTINE LOSS_INPUTS_CHOKE() -USE CHOKEVARIABLES -use SimulationVariables !@ -implicit none - Integer I - - -!=========================================================================== -! AIR PUMP LOSSES INPUT -!=========================================================================== -data%State%AirPumpLine%NO_PIPINGS_AIRPLINE=1 - -ALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE,3)) -! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION -data%State%AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance - -!60960= 200 ft - - - ALLOCATE (data%State%AirPumpLine%DIAM_AIR_INCH(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE),data%State%AirPumpLine%Re_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE),data%State%AirPumpLine%AREA_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE), & - data%State%AirPumpLine%LENGT_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE),data%State%AirPumpLine%ROUGHNESS_AIRPLINE(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE),data%State%AirPumpLine%REL_ROUGHAIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE), & - data%State%AirPumpLine%fric_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE),data%State%AirPumpLine%fricloss_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) - - - -DO I=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE - data%State%AirPumpLine%DIAM_AIR_INCH(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,1) - data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,2) - data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,3) - - - data%State%AirPumpLine%AREA_AIR(I)=PI*(data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m) - data%State%AirPumpLine%REL_ROUGHAIR(I)=data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)/(data%State%AirPumpLine%DIAM_AIR_INCH(I)*25.4) -!DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m) - data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%LENGT_AIR(I)*.001 ! (m) - ENDDO - - -!================================================================ -data%State%AirPumpLine%NO_MINORS_AIRPLINE=6 - -ALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP(data%State%AirPumpLine%NO_MINORS_AIRPLINE,4)) - -! ID(INCH) LF CV NOTE(BAR) DESCRIPTION -data%State%AirPumpLine%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee -data%State%AirPumpLine%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow -data%State%AirPumpLine%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter -data%State%AirPumpLine%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve -data%State%AirPumpLine%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve -data%State%AirPumpLine%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA - - - - ALLOCATE (data%State%AirPumpLine%MINORDIAM_AIR_INCH(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%MINORAREA_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE), & - data%State%AirPumpLine%LF_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%CV_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%NOTE_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE) & - ,data%State%AirPumpLine%minlosspa_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%minloss_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE)) - - - -DO I=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE - data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,1) - data%State%AirPumpLine%LF_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,2) - data%State%AirPumpLine%CV_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,3) - data%State%AirPumpLine%NOTE_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,4) - - - data%State%AirPumpLine%MINORAREA_AIR(I)=PI*(data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m) -ENDDO - - - END - - - - - -! SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER) -! USE CHOKEVARIABLES -! use ConfigurationVariables !@ -! Use CSimulationVariables -! implicit none -! INTEGER CHNUMBER -! Integer I - -! loop3: do while (ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) -! if (data%Equipments%ChokeControlPanel%ChokeControlLever == 1.0) then -! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .true. -! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .false. -! endif -! if (data%Equipments%ChokeControlPanel%ChokeControlLever == -1.0) then -! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .true. -! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .false. -! endif -! data%State%AirPumpLine%TIME=data%State%AirPumpLine%TIME+data%State%AirPumpLine%DeltaT_Choke !overal time (s) -! call airpump_code_CHOKE(CHNUMBER) -! call sleepqq(100) -! if (IsStopped == .true.) return -! end do loop3 !while finished_Choke==0 -! end - - - - - - - SUBROUTINE airpump_code_CHOKE(CHNUMBER) - USE CHOKEVARIABLES -use SimulationVariables !@ - use CChokeManifold - use SimulationVariables - use CSounds - USE CChokeProblemsVariables - implicit none - Integer I - - INTEGER CHNUMBER - - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirPumpLine%QITER+.1 !(gpm) maximum flow for the start - data%State%AirPumpLine%diffp_air=-10 - data%State%AirPumpLine%losses_air=10 - -!=================================================================== -! AIR OPERATED PUMP -! MODEL 10-6000W030 RATIO 55:1 -!=================for air consumption at 100 psig=================== - do while (data%State%AirPumpLine%diffp_air<0) - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.1 -! Qup=data%State%AirDrivenPump%QAIR_PUMP; -!cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM - data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) -! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) - data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem - end do !returns Qup - - do while (abs((data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air)/data%State%AirPumpLine%diffp_air)>data%State%AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram - if (data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air>0) then - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP+.005 - else - data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.005 - endif -!=================================================================== -! AIR OPERATED PUMP -! MODEL 10-6000W030 RATIO 55:1 -!=================for air consumption at 100 psig=================== - data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) -!kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) - data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem -!===========================LOSSES==================================== - do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE - data%State%AirPumpLine%Re_air(i)=data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(data%State%AirPumpLine%AREA_AIR(i)*nu) - enddo - do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE - if (data%State%AirPumpLine%Re_air(i) 1.0 ) then - data%State%Choke%SoundChokePump= 60 - data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke - 1.0 - else - data%State%Choke%SoundChokePump= 0.0 - endif - data%State%AirPumpLine%DELTAV_AIR=data%State%AirDrivenPump%QAIR_PUMP*data%State%AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm) - if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse + (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3 - if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse - (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) -!DeltaT_Choke= 1sec or 2sec -!((((((((IN OUTER LOOP)))))) -!===============AIR PUMP OUTPUTS========================= - data%State%AirPumpLine%alpha_timeair=data%State%AirPumpLine%TIME ! overal time (s) - data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem - data%State%AirPumpLine%alpha_pairp=data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%alpha_Qair=data%State%AirDrivenPump%QAIR_PUMP -!write(*,*) 'diffp_air=',diffp_air -!pause - data%State%AirPumpLine%alpha_diffpair=data%State%AirPumpLine%diffp_air - data%State%AirPumpLine%alpha_lossesair=data%State%AirPumpLine%losses_air -!======================================================== -!OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') - - if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse>data%State%AirPumpLine%CourseBase) then - data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%AirPumpLine%CourseBase - data%State%Choke%SoundChokePump= 0.0 - endif - if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse<0.) then - data%State%CHOOKE(CHNUMBER)%PassedCourse=0. - data%State%Choke%SoundChokePump= 0.0 - endif - - call SetSoundChokePump(data%State%Choke%SoundChokePump) - data%State%CHOOKE(CHNUMBER)%PercentClose= data%State%CHOOKE(CHNUMBER)%PassedCourse/data%State%AirPumpLine%CourseBase - IF (data%Equipments%ChokeControlPanel%Choke1LED==1) THEN - data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(1)%PercentClose*10 - ELSE ! Choke2LED==1 - data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(2)%PercentClose*10 - ENDIF -!CALL SetHydraulicChock1(nint(MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)*100)) -! CALL SetHydraulicChock2(nint(MIN(data%State%CHOOKE(2)%PercentClose / 0.91 , 1.0)*100)) -! .91 >> 9 percent clearance - -! =================== calculating Area -! AreaChoke=0.5 -! .91 >> 9 percent clearance - - data%State%CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2) - data%State%CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2 - data%State%Choke%HydraulicChoke1WashoutCoef= data%State%Choke%HydraulicChoke1WashoutCoef * data%State%CHOOKE(1)%WashoutMalf - data%State%Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke1WashoutCoef+ data%State%CHOOKE(1)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time - data%State%Choke%HydraulicChoke2WashoutCoef= data%State%Choke%HydraulicChoke2WashoutCoef * data%State%CHOOKE(2)%WashoutMalf - data%State%Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke2WashoutCoef+ data%State%CHOOKE(2)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time -!write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef - - IF (data%State%CHOOKE(1)%PlugMalf == 1) THEN - data%State%Choke%Present_HydraulicChoke1Plug= data%State%Choke%Present_HydraulicChoke1Plug * data%State%CHOOKE(1)%PlugMalf -! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay -! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent -!write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent - - if ( (data%problems%ChokeProblems%HydraulicChoke1PluggedPercent - data%State%Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then - data%State%Choke%DeltaPlug1Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke1Plug - data%State%Choke%Plug1TimeCounter = 0 -!write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug - endif - data%State%Choke%Plug1TimeCounter= data%State%Choke%Plug1TimeCounter + 1 - data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent - - if (data%State%Choke%Plug1TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 - data%State%Choke%Present_HydraulicChoke1Plug = data%State%Choke%Present_HydraulicChoke1Plug + data%State%CHOOKE(1)%PlugMalf* ((data%State%Choke%DeltaPlug1Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 - endif -!write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug - ENDIF - - IF (data%State%CHOOKE(2)%PlugMalf == 1) THEN - data%State%Choke%Present_HydraulicChoke2Plug= data%State%Choke%Present_HydraulicChoke2Plug * data%State%CHOOKE(2)%PlugMalf -! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay -! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent - if ( (data%problems%ChokeProblems%HydraulicChoke2PluggedPercent - data%State%Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then - data%State%Choke%DeltaPlug2Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke2Plug - data%State%Choke%Plug2TimeCounter = 0 - endif - data%State%Choke%Plug2TimeCounter= data%State%Choke%Plug2TimeCounter + 1 - data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent - if (data%State%Choke%Plug2TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 - data%State%Choke%Present_HydraulicChoke2Plug = data%State%Choke%Present_HydraulicChoke2Plug + data%State%CHOOKE(2)%PlugMalf *((data%State%Choke%DeltaPlug2Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 - endif - ENDIF -! fully open area is 123/64 in^2 = 0.01334635 ft^2 - data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke+(data%State%CHOOKE(1)%WashoutMalf*data%State%Choke%HydraulicChoke1WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup - -!write(*,*) 'data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke=' ,data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke - - data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke-(data%State%CHOOKE(1)%PlugMalf* data%State%Choke%Present_HydraulicChoke1Plug *data%State%CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup - - data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke+(data%State%CHOOKE(2)%WashoutMalf*data%State%Choke%HydraulicChoke2WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup - data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke-(data%State%CHOOKE(2)%PlugMalf* data%State%Choke%Present_HydraulicChoke2Plug *data%State%CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup -!write(*,*) 'data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke=' ,data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke - - - data%State%CHOOKE(1)%AreaChokeFinal= data%State%CHOOKE(1)%AreaChoke - data%State%CHOOKE(2)%AreaChokeFinal= data%State%CHOOKE(2)%AreaChoke - -! 144: ft^2 to in^2 - CALL SetHydraulicChock1(100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve - CALL SetHydraulicChock2(100 - nint((data%State%CHOOKE(2)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve - - -!write(*,*) 'data%State%CHOOKE(1)%PercentClose=' , data%State%CHOOKE(1)%PercentClose ! close percent 0 to 100 -!write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display -!write(*,*) 'data%State%CHOOKE(1)%AreaChokeFinal=' , data%State%CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance -!write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.) -!write(*,*) 'valve value=' , 100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance -!write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close -! =================== calculating Area -!write(*,*) 'data%State%CHOOKE(1)%AreaChoke= ' , data%State%CHOOKE(1)%AreaChoke -!WRITE(150,50) alpha_timeair,alpha_Qair,alpha_pairp, & -!alpha_Pdownstrem,alpha_diffpair,alpha_lossesair,data%State%CHOOKE(CHNUMBER)%PassedCourse -!50 FORMAT(7(f15.5)) -!======================================================================================== -!======================================================================================== -! write(*,*) PassedCourse - end +# 1 "/home/admin/SimulationCore2/Equipments/ChokeControl/AirPump_Choke_Subs.f90" diff --git a/Equipments/ChokeControl/CHOKE.f90 b/Equipments/ChokeControl/CHOKE.f90 index 298e19f..16df22f 100644 --- a/Equipments/ChokeControl/CHOKE.f90 +++ b/Equipments/ChokeControl/CHOKE.f90 @@ -2,17 +2,11 @@ module ChokeModule USE CHOKEVARIABLES -use SimulationVariables !@ - !use CDataDisplayConsole - ! !@use ConfigurationVariables, CasingPressureDataDisplay=>CasingPressure!, StandPipePressureDataDisplay=>StandPipePressure + use SimulationVariables USE CChokeProblemsVariables - !use CChokeControlPanelVariables - ! !@use ConfigurationVariables, StandPipePressureChoke=>StandPipePressure USE MudSystemVARIABLES -use SimulationVariables !@@@ use CChokeManifold - use SimulationVariables - + contains ! function CHOKE_MainBody1 result(CHNUMBER) diff --git a/Equipments/ChokeControl/CHOKE.i90 b/Equipments/ChokeControl/CHOKE.i90 index bb81a63..702b38b 100644 --- a/Equipments/ChokeControl/CHOKE.i90 +++ b/Equipments/ChokeControl/CHOKE.i90 @@ -1,19 +1,13 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/ChokeControl/CHOKE.f90" +# 1 "/home/admin/SimulationCore2/Equipments/ChokeControl/CHOKE.f90" module ChokeModule USE CHOKEVARIABLES -use SimulationVariables !@ -!use CDataDisplayConsole -! !@use ConfigurationVariables, CasingPressureDataDisplay=>CasingPressure!, StandPipePressureDataDisplay=>StandPipePressure + use SimulationVariables USE CChokeProblemsVariables -!use CChokeControlPanelVariables -! !@use ConfigurationVariables, StandPipePressureChoke=>StandPipePressure USE MudSystemVARIABLES -use SimulationVariables !@@@ use CChokeManifold - use SimulationVariables - + contains ! function CHOKE_MainBody1 result(CHNUMBER) diff --git a/Equipments/ChokeControl/CHOKE_VARIABLES.i90 b/Equipments/ChokeControl/CHOKE_VARIABLES.i90 new file mode 100644 index 0000000..af079b2 --- /dev/null +++ b/Equipments/ChokeControl/CHOKE_VARIABLES.i90 @@ -0,0 +1,79 @@ +# 1 "/home/admin/SimulationCore2/Equipments/ChokeControl/CHOKE_VARIABLES.f90" +MODULE CHOKEVARIABLES +!IMPLICIT DOUBLEPRECISION(A-H,O-Z) +! use CBopControlPanel +! use ConfigurationVariables +! use CEquipmentsConstants +! use CSimulationVariables +! use CAccumulatorVariables +! use CBopStackVariables +! use CChokeControlPanelVariables +! use ConfigurationVariables + +IMPLICIT NONE + +!=========================================================================== +! CHOKE VARIABLES +!=========================================================================== +type::ChokeType + REAL Ycritical,Cp,Cv,CL,kRatio,nPolytripic,x1,SGliquid,WaterDensity,LiquidDensity,VL,VG1 + REAL epsilon_step,epsilon_abs,step_size,Ycritical_a,Ycritical_b,Ycritical_c + REAL G2,Cdrag,Pwh,MixDens2,Yratio_a,Yratio_b,Yratio_c,Yratio,Yratio_low,Yratio_high + REAL FlowRate,Patm,MassFlux,LiquidPPG,time2,AreaChoke + REAL eps_step,eps_abs,Yratiomat(100),Yrario_actual,Yrario + REAL :: DegreeOpen,GRAVITY1=9.81!,PercentClose + REAL ChokedMassFlux,ChokedFlowRate,PwhChoked + REAL TotalStrokes1,TotalStrokes2 +!INTEGER WashoutMalf,PlugMalf,failMalf + INTEGER GaugeChokePositionMailf,SoundChokePump + Real Cumulative_AirVolume_Choke + Real HydraulicChoke1WashoutCoef,HydraulicChoke2WashoutCoef + + Real Present_HydraulicChoke1Plug, Present_HydraulicChoke2Plug,DeltaPlug1Percent,DeltaPlug2Percent + Integer HydraulicChoke1PluggedPercent_Old,HydraulicChoke2PluggedPercent_Old,Plug1TimeCounter,Plug2TimeCounter,ChokePlugTimeDelay + Real ChokeAreaFullyOpen +end type ChokeType +!=========================================================================== +! AIR DRIVEN PUMP VARIABLES +!=========================================================================== +type::AirDrivenPumpType + REAL QAIR_PUMP,cc1,cc2,cc3,cc4,cc5 + INTEGER ChokeAirFail +end type AirDrivenPumpType + +! PARAMETER PI=3.141593 +!============================================================================ +! OIL & ENVIRONMENT VARIABLES +!============================================================================ +! REAL:: SG=1.12,WDENS=1000,GRAVITY=9.81,RE_CR=2000 +!specific gravity of liquid +!water density(kg/m^3) + + +!=========================================================================== +! AIR PUMP LINE COMPUTATIONAL VARIABLES +!=========================================================================== +!logical ChokeIsClosing,ChokeIsOpening +type::AirPumpLineType + REAL ChokeControlLeverOld + REAL P_AIRP,QITER,DELTAV_AIR,TIME,DeltaT_Choke,TOL_AIR + REAL diffp_air,losses_air,pipe_loss1air,minor_loss1air,static_loss1air + integer NO_PIPINGS_AIRPLINE,NO_MINORS_AIRPLINE + REAL,ALLOCATABLE:: Re_air(:),DIAM_AIR_MM(:),DIAM_AIR_INCH(:),AREA_AIR(:),REL_ROUGHAIR(:),LENGT_AIR(:),LF_AIR(:),CV_AIR(:),NOTE_AIR(:) + REAL,ALLOCATABLE:: fric_air(:),fricloss_air(:),minlosspa_air(:),minloss_air(:),MINORS_AIRPUMP(:,:) + REAL,ALLOCATABLE:: MINORDIAM_AIR_INCH(:),MINORAREA_AIR(:) + REAL,ALLOCATABLE:: ROUGHNESS_AIRPLINE(:),PIPINGS_AIRPUMP(:,:) + REAL Acylinder,CourseBase!,PassedCourse + REAL alpha_Qair,alpha_timeair,alpha_pairp,alpha_diffpair,alpha_lossesair,alpha_Pdownstrem,Pdownstrem +end type AirPumpLineType + +!================================================================================= + + TYPE, PUBLIC :: CHOKE_TypeVars + INTEGER WashoutMalf,PlugMalf,failMalf + REAL PercentClose,PassedCourse,AreaChoke,AreaChokeFinal + logical ChokeIsClosing,ChokeIsOpening + END TYPE CHOKE_TypeVars + + +END MODULE diff --git a/Equipments/ChokeControl/ChokeControlMain.f90 b/Equipments/ChokeControl/ChokeControlMain.f90 index cf148b2..71ef6a5 100644 --- a/Equipments/ChokeControl/ChokeControlMain.f90 +++ b/Equipments/ChokeControl/ChokeControlMain.f90 @@ -1,6 +1,6 @@ module ChokeControlMain USE CHOKEVARIABLES -use SimulationVariables !@ + use SimulationVariables !@ implicit none public contains @@ -16,7 +16,7 @@ use SimulationVariables !@ ! end subroutine subroutine ChokeControl_Init - call Choke_StartUp + call Choke_StartUp() end subroutine ChokeControl_Init subroutine ChokeControl_Step @@ -33,7 +33,7 @@ use SimulationVariables !@ data%Equipments%ChokeControlPanel%Choke1LED=0 CHNUMBER=2 ENDIF - if(ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) then + if(ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) then if (data%Equipments%ChokeControlPanel%ChokeControlLever == 1.0) then data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .true. data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .false. @@ -85,4 +85,455 @@ use SimulationVariables !@ ! end subroutine ChokeControlMainBody + SUBROUTINE Choke_StartUp() + + USE CHOKEVARIABLES + use SimulationVariables + USE CChokeProblemsVariables + implicit none + + CALL LOSS_INPUTS_CHOKE() + + !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') + + + !data%State%CHOOKE(1)%WashoutMalf=1 + !data%State%CHOOKE(1)%PlugMalf=0 + !data%State%CHOOKE(1)%FailMalf=0 + ! + !data%State%CHOOKE(2)%WashoutMalf=1 + !data%State%CHOOKE(2)%PlugMalf=0 + !data%State%CHOOKE(2)%FailMalf=0 + ! + ! + !ChokeAirFail=0 + ! + !GaugeChokePositionMailf=0 + + + + + + + + data%State%Choke%kRatio=1.4 + data%State%Choke%Cp=0.24 + data%State%Choke%CL=0.8 + + data%State%Choke%x1=0.5 + + data%State%Choke%LiquidPPG=9. + data%State%Choke%LiquidDensity=data%State%Choke%LiquidPPG*7.48 !lbm/ft**3 + + data%State%Choke%VL=1.0/data%State%Choke%LiquidDensity !SpecificVolume of Liquid + + data%State%Choke%Cv=data%State%Choke%Cp/data%State%Choke%kRatio + + data%State%Choke%nPolytripic=1+(data%State%Choke%x1*(data%State%Choke%Cp-data%State%Choke%Cv)/(data%State%Choke%x1*data%State%Choke%Cv+(1-data%State%Choke%x1)*data%State%Choke%CL)) + + data%State%Choke%VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream + + data%State%Choke%Cdrag=0.8 + data%State%Choke%Pwh=1400. !psi + + + data%State%Choke%Patm=14.7 + data%State%Choke%MixDens2=data%State%Choke%x1*data%State%Choke%VG1 !lbm/ft**3 + + + + data%State%Choke%epsilon_abs= 1e-5 + data%State%Choke%epsilon_step= 1e-5 + + + !ChokeDiameter= 32/64. !in + + data%State%CHOOKE%PercentClose= 0.0 + !AreaChoke=0.01334635 + + ! data%State%CHOOKE(1)%AreaChoke=0.01334635 + !ChokeAreaFullyOpen = 123.d0 / 64.d0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2 + + data%State%AirPumpLine%DeltaT_Choke=0.1 + !TotalStrokes1=0. + !TotalStrokes2=0. + + data%State%Choke%HydraulicChoke1WashoutCoef= 0.0 + data%State%Choke%HydraulicChoke2WashoutCoef= 0.0 + + + + data%State%Choke%ChokePlugTimeDelay = int(180./data%State%AirPumpLine%DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay + + data%State%Choke%Present_HydraulicChoke1Plug = REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100. + data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent + data%State%Choke%Plug1TimeCounter= 0 + data%State%Choke%DeltaPlug1Percent = 0.0 + + data%State%Choke%Present_HydraulicChoke2Plug = REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100. + data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent + data%State%Choke%Plug2TimeCounter= 0 + data%State%Choke%DeltaPlug2Percent = 0.0 + + !======================AIRPUMP INPUTS(CONSTANTS)=========================== + data%State%AirPumpLine%CourseBase= 24. !cm + data%State%CHOOKE%PassedCourse= 0. + data%Equipments%ChokeControlPanel%ChokePosition=0. + + data%State%AirPumpLine%Acylinder= PI*(8.**2)/4. ! (CM^2), 8=DIAMETER, 24=course , 3785.412: cm^3 to galon + + + data%State%CHOOKE%ChokeIsOpening = .false. + data%State%CHOOKE%ChokeIsClosing = .false. + + + data%State%AirPumpLine%P_AIRP=0 + + data%State%AirDrivenPump%cc1 = 0.1354; data%State%AirDrivenPump%cc2 = -2.066; data%State%AirDrivenPump%cc3 = -21.09; data%State%AirDrivenPump%cc4 = -51.36; data%State%AirDrivenPump%cc5 = 5935 ! FOR OUTPUT IN GPM + ! cc1 = 4.754e-07; cc2 = -0.0001676; cc3 = -0.03953; cc4 = -2.223; cc5 = 5935 FOR OUTPUT IN IN^3/MIN + + + data%State%AirPumpLine%Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%AirPumpLine%QITER=5. !(gpm) + + ! Q=0.0003585; true + data%State%AirPumpLine%TIME=0 + data%State%AirPumpLine%TOL_AIR=0.05 + + data%State%AirPumpLine%alpha_Qair=0 + data%State%AirPumpLine%alpha_timeair=0 + data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem + data%State%AirPumpLine%alpha_diffpair=0 + data%State%AirPumpLine%alpha_lossesair=0 + + end + + SUBROUTINE DEALLOCATE_ARRAYS_CHOKE() + USE CHOKEVARIABLES + use SimulationVariables !@ + + implicit none + write(*,*) 'deallocateeeeeeeeeeeee' + !=========================================================================== + ! AIR PUMP LOSSES INPUT + !=========================================================================== + !if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP) + + DEALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP,data%State%AirPumpLine%DIAM_AIR_INCH, & + data%State%AirPumpLine%Re_air,data%State%AirPumpLine%AREA_AIR,data%State%AirPumpLine%LENGT_AIR,data%State%AirPumpLine%ROUGHNESS_AIRPLINE,data%State%AirPumpLine%REL_ROUGHAIR, & + data%State%AirPumpLine%fric_air,data%State%AirPumpLine%fricloss_air) + !================================================================ + DEALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP,data%State%AirPumpLine%MINORDIAM_AIR_INCH, & + data%State%AirPumpLine%MINORAREA_AIR,data%State%AirPumpLine%LF_AIR,data%State%AirPumpLine%CV_AIR,data%State%AirPumpLine%NOTE_AIR & + ,data%State%AirPumpLine%minlosspa_air,data%State%AirPumpLine%minloss_air) + END + + + + + + SUBROUTINE LOSS_INPUTS_CHOKE() + USE CHOKEVARIABLES + use SimulationVariables + implicit none + Integer I + + !=========================================================================== + ! AIR PUMP LOSSES INPUT + !=========================================================================== + data%State%AirPumpLine%NO_PIPINGS_AIRPLINE=1 + + ALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE,3)) + ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION + data%State%AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance + + !60960= 200 ft + ALLOCATE(data%State%AirPumpLine%DIAM_AIR_INCH(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%Re_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + + ALLOCATE(data%State%AirPumpLine%AREA_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%LENGT_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%ROUGHNESS_AIRPLINE(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%REL_ROUGHAIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%fric_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%fricloss_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + + DO I=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE + data%State%AirPumpLine%DIAM_AIR_INCH(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,1) + data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,2) + data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,3) + data%State%AirPumpLine%AREA_AIR(I)=PI*(data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m) + data%State%AirPumpLine%REL_ROUGHAIR(I)=data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)/(data%State%AirPumpLine%DIAM_AIR_INCH(I)*25.4) + !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m) + data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%LENGT_AIR(I)*.001 ! (m) + ENDDO + + + !================================================================ + data%State%AirPumpLine%NO_MINORS_AIRPLINE=6 + + ALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP(data%State%AirPumpLine%NO_MINORS_AIRPLINE,4)) + + ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION + data%State%AirPumpLine%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee + data%State%AirPumpLine%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow + data%State%AirPumpLine%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter + data%State%AirPumpLine%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve + data%State%AirPumpLine%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve + data%State%AirPumpLine%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA + + + ALLOCATE (data%State%AirPumpLine%MINORDIAM_AIR_INCH(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%MINORAREA_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE), & + data%State%AirPumpLine%LF_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%CV_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%NOTE_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE) & + ,data%State%AirPumpLine%minlosspa_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%minloss_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE)) + + + DO I=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE + data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,1) + data%State%AirPumpLine%LF_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,2) + data%State%AirPumpLine%CV_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,3) + data%State%AirPumpLine%NOTE_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,4) + data%State%AirPumpLine%MINORAREA_AIR(I)=PI*(data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m) + ENDDO + + END + + + + + + ! SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER) + ! USE CHOKEVARIABLES + ! use ConfigurationVariables !@ + ! Use CSimulationVariables + ! implicit none + ! INTEGER CHNUMBER + ! Integer I + + ! loop3: do while (ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) + ! if (data%Equipments%ChokeControlPanel%ChokeControlLever == 1.0) then + ! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .true. + ! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .false. + ! endif + ! if (data%Equipments%ChokeControlPanel%ChokeControlLever == -1.0) then + ! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .true. + ! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .false. + ! endif + ! data%State%AirPumpLine%TIME=data%State%AirPumpLine%TIME+data%State%AirPumpLine%DeltaT_Choke !overal time (s) + ! call airpump_code_CHOKE(CHNUMBER) + ! call sleepqq(100) + ! if (IsStopped == .true.) return + ! end do loop3 !while finished_Choke==0 + ! end + + + + + + + SUBROUTINE airpump_code_CHOKE(CHNUMBER) + USE CHOKEVARIABLES + use SimulationVariables !@ + use CChokeManifold + use SimulationVariables + use CSounds + USE CChokeProblemsVariables + implicit none + Integer I + + INTEGER CHNUMBER + + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirPumpLine%QITER+.1 !(gpm) maximum flow for the start + data%State%AirPumpLine%diffp_air=-10 + data%State%AirPumpLine%losses_air=10 + + !=================================================================== + ! AIR OPERATED PUMP + ! MODEL 10-6000W030 RATIO 55:1 + !=================for air consumption at 100 psig=================== + do while (data%State%AirPumpLine%diffp_air<0) + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.1 + ! Qup=data%State%AirDrivenPump%QAIR_PUMP; + !cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM + data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) + ! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) + data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem + end do !returns Qup + + do while (abs((data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air)/data%State%AirPumpLine%diffp_air)>data%State%AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram + if (data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air>0) then + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP+.005 + else + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.005 + endif + !=================================================================== + ! AIR OPERATED PUMP + ! MODEL 10-6000W030 RATIO 55:1 + !=================for air consumption at 100 psig=================== + data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) + !kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) + data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem + !===========================LOSSES==================================== + do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE + data%State%AirPumpLine%Re_air(i)=data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(data%State%AirPumpLine%AREA_AIR(i)*nu) + enddo + do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE + if (data%State%AirPumpLine%Re_air(i) 1.0 ) then + data%State%Choke%SoundChokePump= 60 + data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke - 1.0 + else + data%State%Choke%SoundChokePump= 0.0 + endif + data%State%AirPumpLine%DELTAV_AIR=data%State%AirDrivenPump%QAIR_PUMP*data%State%AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm) + if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse + (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3 + if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse - (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) + !DeltaT_Choke= 1sec or 2sec + !((((((((IN OUTER LOOP)))))) + !===============AIR PUMP OUTPUTS========================= + data%State%AirPumpLine%alpha_timeair=data%State%AirPumpLine%TIME ! overal time (s) + data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem + data%State%AirPumpLine%alpha_pairp=data%State%AirPumpLine%P_AIRP + data%State%AirPumpLine%alpha_Qair=data%State%AirDrivenPump%QAIR_PUMP + !write(*,*) 'diffp_air=',diffp_air + !pause + data%State%AirPumpLine%alpha_diffpair=data%State%AirPumpLine%diffp_air + data%State%AirPumpLine%alpha_lossesair=data%State%AirPumpLine%losses_air + !======================================================== + !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') + + if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse>data%State%AirPumpLine%CourseBase) then + data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%AirPumpLine%CourseBase + data%State%Choke%SoundChokePump= 0.0 + endif + if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse<0.) then + data%State%CHOOKE(CHNUMBER)%PassedCourse=0. + data%State%Choke%SoundChokePump= 0.0 + endif + + call SetSoundChokePump(data%State%Choke%SoundChokePump) + data%State%CHOOKE(CHNUMBER)%PercentClose= data%State%CHOOKE(CHNUMBER)%PassedCourse/data%State%AirPumpLine%CourseBase + IF (data%Equipments%ChokeControlPanel%Choke1LED==1) THEN + data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(1)%PercentClose*10 + ELSE ! Choke2LED==1 + data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(2)%PercentClose*10 + ENDIF + !CALL SetHydraulicChock1(nint(MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)*100)) + ! CALL SetHydraulicChock2(nint(MIN(data%State%CHOOKE(2)%PercentClose / 0.91 , 1.0)*100)) + ! .91 >> 9 percent clearance + + ! =================== calculating Area + ! AreaChoke=0.5 + ! .91 >> 9 percent clearance + + data%State%CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2) + data%State%CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2 + data%State%Choke%HydraulicChoke1WashoutCoef= data%State%Choke%HydraulicChoke1WashoutCoef * data%State%CHOOKE(1)%WashoutMalf + data%State%Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke1WashoutCoef+ data%State%CHOOKE(1)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time + data%State%Choke%HydraulicChoke2WashoutCoef= data%State%Choke%HydraulicChoke2WashoutCoef * data%State%CHOOKE(2)%WashoutMalf + data%State%Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke2WashoutCoef+ data%State%CHOOKE(2)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time + !write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef + + IF (data%State%CHOOKE(1)%PlugMalf == 1) THEN + data%State%Choke%Present_HydraulicChoke1Plug= data%State%Choke%Present_HydraulicChoke1Plug * data%State%CHOOKE(1)%PlugMalf + ! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay + ! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent + !write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent + + if ( (data%problems%ChokeProblems%HydraulicChoke1PluggedPercent - data%State%Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then + data%State%Choke%DeltaPlug1Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke1Plug + data%State%Choke%Plug1TimeCounter = 0 + !write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug + endif + data%State%Choke%Plug1TimeCounter= data%State%Choke%Plug1TimeCounter + 1 + data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent + + if (data%State%Choke%Plug1TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 + data%State%Choke%Present_HydraulicChoke1Plug = data%State%Choke%Present_HydraulicChoke1Plug + data%State%CHOOKE(1)%PlugMalf* ((data%State%Choke%DeltaPlug1Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 + endif + !write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug + ENDIF + + IF (data%State%CHOOKE(2)%PlugMalf == 1) THEN + data%State%Choke%Present_HydraulicChoke2Plug= data%State%Choke%Present_HydraulicChoke2Plug * data%State%CHOOKE(2)%PlugMalf + ! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay + ! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent + if ( (data%problems%ChokeProblems%HydraulicChoke2PluggedPercent - data%State%Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then + data%State%Choke%DeltaPlug2Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke2Plug + data%State%Choke%Plug2TimeCounter = 0 + endif + data%State%Choke%Plug2TimeCounter= data%State%Choke%Plug2TimeCounter + 1 + data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent + if (data%State%Choke%Plug2TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 + data%State%Choke%Present_HydraulicChoke2Plug = data%State%Choke%Present_HydraulicChoke2Plug + data%State%CHOOKE(2)%PlugMalf *((data%State%Choke%DeltaPlug2Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 + endif + ENDIF + ! fully open area is 123/64 in^2 = 0.01334635 ft^2 + data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke+(data%State%CHOOKE(1)%WashoutMalf*data%State%Choke%HydraulicChoke1WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup + + !write(*,*) 'data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke=' ,data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke + + data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke-(data%State%CHOOKE(1)%PlugMalf* data%State%Choke%Present_HydraulicChoke1Plug *data%State%CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup + + data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke+(data%State%CHOOKE(2)%WashoutMalf*data%State%Choke%HydraulicChoke2WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup + data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke-(data%State%CHOOKE(2)%PlugMalf* data%State%Choke%Present_HydraulicChoke2Plug *data%State%CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup + !write(*,*) 'data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke=' ,data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke + + + data%State%CHOOKE(1)%AreaChokeFinal= data%State%CHOOKE(1)%AreaChoke + data%State%CHOOKE(2)%AreaChokeFinal= data%State%CHOOKE(2)%AreaChoke + + ! 144: ft^2 to in^2 + CALL SetHydraulicChock1(100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve + CALL SetHydraulicChock2(100 - nint((data%State%CHOOKE(2)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve + + + !write(*,*) 'data%State%CHOOKE(1)%PercentClose=' , data%State%CHOOKE(1)%PercentClose ! close percent 0 to 100 + !write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display + !write(*,*) 'data%State%CHOOKE(1)%AreaChokeFinal=' , data%State%CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance + !write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.) + !write(*,*) 'valve value=' , 100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance + !write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close + ! =================== calculating Area + !write(*,*) 'data%State%CHOOKE(1)%AreaChoke= ' , data%State%CHOOKE(1)%AreaChoke + !WRITE(150,50) alpha_timeair,alpha_Qair,alpha_pairp, & + !alpha_Pdownstrem,alpha_diffpair,alpha_lossesair,data%State%CHOOKE(CHNUMBER)%PassedCourse + !50 FORMAT(7(f15.5)) + !======================================================================================== + !======================================================================================== + ! write(*,*) PassedCourse + end + end module ChokeControlMain \ No newline at end of file diff --git a/Equipments/ChokeControl/ChokeControlMain.i90 b/Equipments/ChokeControl/ChokeControlMain.i90 index d32e938..4379651 100644 --- a/Equipments/ChokeControl/ChokeControlMain.i90 +++ b/Equipments/ChokeControl/ChokeControlMain.i90 @@ -1,7 +1,7 @@ # 1 "/home/admin/SimulationCore2/Equipments/ChokeControl/ChokeControlMain.f90" module ChokeControlMain USE CHOKEVARIABLES -use SimulationVariables !@ + use SimulationVariables !@ implicit none public contains @@ -17,7 +17,7 @@ use SimulationVariables !@ ! end subroutine subroutine ChokeControl_Init - call Choke_StartUp + call Choke_StartUp() end subroutine ChokeControl_Init subroutine ChokeControl_Step @@ -25,7 +25,7 @@ use SimulationVariables !@ implicit none INTEGER CHNUMBER - IF(data%Equipments%ChokeControlPanel%ChokeSelectorSwitch== 1) THEN + IF(data%Equipments%ChokeControlPanel%ChokeSelectorSwitch) THEN data%Equipments%ChokeControlPanel%Choke1LED=1 data%Equipments%ChokeControlPanel%Choke2LED=0 CHNUMBER=1 @@ -34,7 +34,7 @@ use SimulationVariables !@ data%Equipments%ChokeControlPanel%Choke1LED=0 CHNUMBER=2 ENDIF - if(ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) then + if(ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) then if (data%Equipments%ChokeControlPanel%ChokeControlLever == 1.0) then data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .true. data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .false. @@ -86,4 +86,455 @@ use SimulationVariables !@ ! end subroutine ChokeControlMainBody + SUBROUTINE Choke_StartUp() + + USE CHOKEVARIABLES + use SimulationVariables + USE CChokeProblemsVariables + implicit none + + CALL LOSS_INPUTS_CHOKE() + +!OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') + + +!data%State%CHOOKE(1)%WashoutMalf=1 +!data%State%CHOOKE(1)%PlugMalf=0 +!data%State%CHOOKE(1)%FailMalf=0 +! +!data%State%CHOOKE(2)%WashoutMalf=1 +!data%State%CHOOKE(2)%PlugMalf=0 +!data%State%CHOOKE(2)%FailMalf=0 +! +! +!ChokeAirFail=0 +! +!GaugeChokePositionMailf=0 + + + + + + + + data%State%Choke%kRatio=1.4 + data%State%Choke%Cp=0.24 + data%State%Choke%CL=0.8 + + data%State%Choke%x1=0.5 + + data%State%Choke%LiquidPPG=9. + data%State%Choke%LiquidDensity=data%State%Choke%LiquidPPG*7.48 !lbm/ft**3 + + data%State%Choke%VL=1.0/data%State%Choke%LiquidDensity !SpecificVolume of Liquid + + data%State%Choke%Cv=data%State%Choke%Cp/data%State%Choke%kRatio + + data%State%Choke%nPolytripic=1+(data%State%Choke%x1*(data%State%Choke%Cp-data%State%Choke%Cv)/(data%State%Choke%x1*data%State%Choke%Cv+(1-data%State%Choke%x1)*data%State%Choke%CL)) + + data%State%Choke%VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream + + data%State%Choke%Cdrag=0.8 + data%State%Choke%Pwh=1400. !psi + + + data%State%Choke%Patm=14.7 + data%State%Choke%MixDens2=data%State%Choke%x1*data%State%Choke%VG1 !lbm/ft**3 + + + + data%State%Choke%epsilon_abs= 1e-5 + data%State%Choke%epsilon_step= 1e-5 + + +!ChokeDiameter= 32/64. !in + + data%State%CHOOKE%PercentClose= 0.0 +!AreaChoke=0.01334635 + +! data%State%CHOOKE(1)%AreaChoke=0.01334635 +!ChokeAreaFullyOpen = 123.d0 / 64.d0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2 + + data%State%AirPumpLine%DeltaT_Choke=0.1 +!TotalStrokes1=0. +!TotalStrokes2=0. + + data%State%Choke%HydraulicChoke1WashoutCoef= 0.0 + data%State%Choke%HydraulicChoke2WashoutCoef= 0.0 + + + + data%State%Choke%ChokePlugTimeDelay = int(180./data%State%AirPumpLine%DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay + + data%State%Choke%Present_HydraulicChoke1Plug = REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100. + data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent + data%State%Choke%Plug1TimeCounter= 0 + data%State%Choke%DeltaPlug1Percent = 0.0 + + data%State%Choke%Present_HydraulicChoke2Plug = REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100. + data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent + data%State%Choke%Plug2TimeCounter= 0 + data%State%Choke%DeltaPlug2Percent = 0.0 + +!======================AIRPUMP INPUTS(CONSTANTS)=========================== + data%State%AirPumpLine%CourseBase= 24. !cm + data%State%CHOOKE%PassedCourse= 0. + data%Equipments%ChokeControlPanel%ChokePosition=0. + + data%State%AirPumpLine%Acylinder= PI*(8.**2)/4. ! (CM^2), 8=DIAMETER, 24=course , 3785.412: cm^3 to galon + + + data%State%CHOOKE%ChokeIsOpening = .false. + data%State%CHOOKE%ChokeIsClosing = .false. + + + data%State%AirPumpLine%P_AIRP=0 + + data%State%AirDrivenPump%cc1 = 0.1354; data%State%AirDrivenPump%cc2 = -2.066; data%State%AirDrivenPump%cc3 = -21.09; data%State%AirDrivenPump%cc4 = -51.36; data%State%AirDrivenPump%cc5 = 5935 ! FOR OUTPUT IN GPM +! cc1 = 4.754e-07; cc2 = -0.0001676; cc3 = -0.03953; cc4 = -2.223; cc5 = 5935 FOR OUTPUT IN IN^3/MIN + + + data%State%AirPumpLine%Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%AirPumpLine%QITER=5. !(gpm) + +! Q=0.0003585; true + data%State%AirPumpLine%TIME=0 + data%State%AirPumpLine%TOL_AIR=0.05 + + data%State%AirPumpLine%alpha_Qair=0 + data%State%AirPumpLine%alpha_timeair=0 + data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem + data%State%AirPumpLine%alpha_diffpair=0 + data%State%AirPumpLine%alpha_lossesair=0 + + end + + SUBROUTINE DEALLOCATE_ARRAYS_CHOKE() + USE CHOKEVARIABLES + use SimulationVariables !@ + + implicit none + write(*,*) 'deallocateeeeeeeeeeeee' +!=========================================================================== +! AIR PUMP LOSSES INPUT +!=========================================================================== +!if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP) + + DEALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP,data%State%AirPumpLine%DIAM_AIR_INCH, & + data%State%AirPumpLine%Re_air,data%State%AirPumpLine%AREA_AIR,data%State%AirPumpLine%LENGT_AIR,data%State%AirPumpLine%ROUGHNESS_AIRPLINE,data%State%AirPumpLine%REL_ROUGHAIR, & + data%State%AirPumpLine%fric_air,data%State%AirPumpLine%fricloss_air) +!================================================================ + DEALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP,data%State%AirPumpLine%MINORDIAM_AIR_INCH, & + data%State%AirPumpLine%MINORAREA_AIR,data%State%AirPumpLine%LF_AIR,data%State%AirPumpLine%CV_AIR,data%State%AirPumpLine%NOTE_AIR & + ,data%State%AirPumpLine%minlosspa_air,data%State%AirPumpLine%minloss_air) + END + + + + + + SUBROUTINE LOSS_INPUTS_CHOKE() + USE CHOKEVARIABLES + use SimulationVariables + implicit none + Integer I + +!=========================================================================== +! AIR PUMP LOSSES INPUT +!=========================================================================== + data%State%AirPumpLine%NO_PIPINGS_AIRPLINE=1 + + ALLOCATE (data%State%AirPumpLine%PIPINGS_AIRPUMP(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE,3)) +! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION + data%State%AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance + +!60960= 200 ft + ALLOCATE(data%State%AirPumpLine%DIAM_AIR_INCH(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%Re_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + + ALLOCATE(data%State%AirPumpLine%AREA_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%LENGT_AIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%ROUGHNESS_AIRPLINE(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%REL_ROUGHAIR(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%fric_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + ALLOCATE(data%State%AirPumpLine%fricloss_air(data%State%AirPumpLine%NO_PIPINGS_AIRPLINE)) + + DO I=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE + data%State%AirPumpLine%DIAM_AIR_INCH(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,1) + data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,2) + data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)=data%State%AirPumpLine%PIPINGS_AIRPUMP(I,3) + data%State%AirPumpLine%AREA_AIR(I)=PI*(data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m) + data%State%AirPumpLine%REL_ROUGHAIR(I)=data%State%AirPumpLine%ROUGHNESS_AIRPLINE(I)/(data%State%AirPumpLine%DIAM_AIR_INCH(I)*25.4) +!DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m) + data%State%AirPumpLine%LENGT_AIR(I)=data%State%AirPumpLine%LENGT_AIR(I)*.001 ! (m) + ENDDO + + +!================================================================ + data%State%AirPumpLine%NO_MINORS_AIRPLINE=6 + + ALLOCATE (data%State%AirPumpLine%MINORS_AIRPUMP(data%State%AirPumpLine%NO_MINORS_AIRPLINE,4)) + +! ID(INCH) LF CV NOTE(BAR) DESCRIPTION + data%State%AirPumpLine%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee + data%State%AirPumpLine%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow + data%State%AirPumpLine%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter + data%State%AirPumpLine%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve + data%State%AirPumpLine%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve + data%State%AirPumpLine%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA + + + ALLOCATE (data%State%AirPumpLine%MINORDIAM_AIR_INCH(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%MINORAREA_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE), & + data%State%AirPumpLine%LF_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%CV_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%NOTE_AIR(data%State%AirPumpLine%NO_MINORS_AIRPLINE) & + ,data%State%AirPumpLine%minlosspa_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE),data%State%AirPumpLine%minloss_air(data%State%AirPumpLine%NO_MINORS_AIRPLINE)) + + + DO I=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE + data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,1) + data%State%AirPumpLine%LF_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,2) + data%State%AirPumpLine%CV_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,3) + data%State%AirPumpLine%NOTE_AIR(I)=data%State%AirPumpLine%MINORS_AIRPUMP(I,4) + data%State%AirPumpLine%MINORAREA_AIR(I)=PI*(data%State%AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m) + ENDDO + + END + + + + + +! SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER) +! USE CHOKEVARIABLES +! use ConfigurationVariables !@ +! Use CSimulationVariables +! implicit none +! INTEGER CHNUMBER +! Integer I + +! loop3: do while (ABS(data%Equipments%ChokeControlPanel%ChokeControlLever)==1.0 .AND. data%Equipments%ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. data%State%CHOOKE(CHNUMBER)%FailMalf==0 .AND. data%State%AirDrivenPump%ChokeAirFail==0) +! if (data%Equipments%ChokeControlPanel%ChokeControlLever == 1.0) then +! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .true. +! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .false. +! endif +! if (data%Equipments%ChokeControlPanel%ChokeControlLever == -1.0) then +! data%State%CHOOKE(CHNUMBER)%ChokeIsOpening = .true. +! data%State%CHOOKE(CHNUMBER)%ChokeIsClosing = .false. +! endif +! data%State%AirPumpLine%TIME=data%State%AirPumpLine%TIME+data%State%AirPumpLine%DeltaT_Choke !overal time (s) +! call airpump_code_CHOKE(CHNUMBER) +! call sleepqq(100) +! if (IsStopped == .true.) return +! end do loop3 !while finished_Choke==0 +! end + + + + + + + SUBROUTINE airpump_code_CHOKE(CHNUMBER) + USE CHOKEVARIABLES + use SimulationVariables !@ + use CChokeManifold + use SimulationVariables + use CSounds + USE CChokeProblemsVariables + implicit none + Integer I + + INTEGER CHNUMBER + + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirPumpLine%QITER+.1 !(gpm) maximum flow for the start + data%State%AirPumpLine%diffp_air=-10 + data%State%AirPumpLine%losses_air=10 + +!=================================================================== +! AIR OPERATED PUMP +! MODEL 10-6000W030 RATIO 55:1 +!=================for air consumption at 100 psig=================== + do while (data%State%AirPumpLine%diffp_air<0) + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.1 +! Qup=data%State%AirDrivenPump%QAIR_PUMP; +!cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM + data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) +! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) + data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem + end do !returns Qup + + do while (abs((data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air)/data%State%AirPumpLine%diffp_air)>data%State%AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram + if (data%State%AirPumpLine%diffp_air-data%State%AirPumpLine%losses_air>0) then + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP+.005 + else + data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP-.005 + endif +!=================================================================== +! AIR OPERATED PUMP +! MODEL 10-6000W030 RATIO 55:1 +!=================for air consumption at 100 psig=================== + data%State%AirPumpLine%P_AIRP=data%State%AirDrivenPump%cc1*(data%State%AirDrivenPump%QAIR_PUMP**4) + data%State%AirDrivenPump%cc2*(data%State%AirDrivenPump%QAIR_PUMP**3) + data%State%AirDrivenPump%cc3*(data%State%AirDrivenPump%QAIR_PUMP**2) + data%State%AirDrivenPump%cc4*data%State%AirDrivenPump%QAIR_PUMP + data%State%AirDrivenPump%cc5 !(psig) +!kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi) + data%State%AirPumpLine%diffp_air= data%State%AirPumpLine%P_AIRP - data%State%AirPumpLine%Pdownstrem +!===========================LOSSES==================================== + do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE + data%State%AirPumpLine%Re_air(i)=data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(data%State%AirPumpLine%AREA_AIR(i)*nu) + enddo + do i=1,data%State%AirPumpLine%NO_PIPINGS_AIRPLINE + if (data%State%AirPumpLine%Re_air(i) 1.0 ) then + data%State%Choke%SoundChokePump= 60 + data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke - 1.0 + else + data%State%Choke%SoundChokePump= 0.0 + endif + data%State%AirPumpLine%DELTAV_AIR=data%State%AirDrivenPump%QAIR_PUMP*data%State%AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm) + if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse + (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3 + if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening) data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%CHOOKE(CHNUMBER)%PassedCourse - (data%State%AirPumpLine%DELTAV_AIR*3785.412/data%State%AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) +!DeltaT_Choke= 1sec or 2sec +!((((((((IN OUTER LOOP)))))) +!===============AIR PUMP OUTPUTS========================= + data%State%AirPumpLine%alpha_timeair=data%State%AirPumpLine%TIME ! overal time (s) + data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem + data%State%AirPumpLine%alpha_pairp=data%State%AirPumpLine%P_AIRP + data%State%AirPumpLine%alpha_Qair=data%State%AirDrivenPump%QAIR_PUMP +!write(*,*) 'diffp_air=',diffp_air +!pause + data%State%AirPumpLine%alpha_diffpair=data%State%AirPumpLine%diffp_air + data%State%AirPumpLine%alpha_lossesair=data%State%AirPumpLine%losses_air +!======================================================== +!OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') + + if (data%State%CHOOKE(CHNUMBER)%ChokeIsClosing .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse>data%State%AirPumpLine%CourseBase) then + data%State%CHOOKE(CHNUMBER)%PassedCourse=data%State%AirPumpLine%CourseBase + data%State%Choke%SoundChokePump= 0.0 + endif + if (data%State%CHOOKE(CHNUMBER)%ChokeIsOpening .AND. data%State%CHOOKE(CHNUMBER)%PassedCourse<0.) then + data%State%CHOOKE(CHNUMBER)%PassedCourse=0. + data%State%Choke%SoundChokePump= 0.0 + endif + + call SetSoundChokePump(data%State%Choke%SoundChokePump) + data%State%CHOOKE(CHNUMBER)%PercentClose= data%State%CHOOKE(CHNUMBER)%PassedCourse/data%State%AirPumpLine%CourseBase + IF (data%Equipments%ChokeControlPanel%Choke1LED==1) THEN + data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(1)%PercentClose*10 + ELSE ! Choke2LED==1 + data%Equipments%ChokeControlPanel%ChokePosition= (1 - data%State%Choke%GaugeChokePositionMailf) * data%State%CHOOKE(2)%PercentClose*10 + ENDIF +!CALL SetHydraulicChock1(nint(MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)*100)) +! CALL SetHydraulicChock2(nint(MIN(data%State%CHOOKE(2)%PercentClose / 0.91 , 1.0)*100)) +! .91 >> 9 percent clearance + +! =================== calculating Area +! AreaChoke=0.5 +! .91 >> 9 percent clearance + + data%State%CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2) + data%State%CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(data%State%CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2 + data%State%Choke%HydraulicChoke1WashoutCoef= data%State%Choke%HydraulicChoke1WashoutCoef * data%State%CHOOKE(1)%WashoutMalf + data%State%Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke1WashoutCoef+ data%State%CHOOKE(1)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time + data%State%Choke%HydraulicChoke2WashoutCoef= data%State%Choke%HydraulicChoke2WashoutCoef * data%State%CHOOKE(2)%WashoutMalf + data%State%Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , data%State%Choke%HydraulicChoke2WashoutCoef+ data%State%CHOOKE(2)%WashoutMalf*(0.5/(60.0/data%State%AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time +!write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef + + IF (data%State%CHOOKE(1)%PlugMalf == 1) THEN + data%State%Choke%Present_HydraulicChoke1Plug= data%State%Choke%Present_HydraulicChoke1Plug * data%State%CHOOKE(1)%PlugMalf +! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay +! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent +!write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent + + if ( (data%problems%ChokeProblems%HydraulicChoke1PluggedPercent - data%State%Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then + data%State%Choke%DeltaPlug1Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke1Plug + data%State%Choke%Plug1TimeCounter = 0 +!write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug + endif + data%State%Choke%Plug1TimeCounter= data%State%Choke%Plug1TimeCounter + 1 + data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent + + if (data%State%Choke%Plug1TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 + data%State%Choke%Present_HydraulicChoke1Plug = data%State%Choke%Present_HydraulicChoke1Plug + data%State%CHOOKE(1)%PlugMalf* ((data%State%Choke%DeltaPlug1Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 + endif +!write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug + ENDIF + + IF (data%State%CHOOKE(2)%PlugMalf == 1) THEN + data%State%Choke%Present_HydraulicChoke2Plug= data%State%Choke%Present_HydraulicChoke2Plug * data%State%CHOOKE(2)%PlugMalf +! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay +! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent + if ( (data%problems%ChokeProblems%HydraulicChoke2PluggedPercent - data%State%Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then + data%State%Choke%DeltaPlug2Percent = (REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - data%State%Choke%Present_HydraulicChoke2Plug + data%State%Choke%Plug2TimeCounter = 0 + endif + data%State%Choke%Plug2TimeCounter= data%State%Choke%Plug2TimeCounter + 1 + data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent + if (data%State%Choke%Plug2TimeCounter <= data%State%Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600 + data%State%Choke%Present_HydraulicChoke2Plug = data%State%Choke%Present_HydraulicChoke2Plug + data%State%CHOOKE(2)%PlugMalf *((data%State%Choke%DeltaPlug2Percent / real(data%State%Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 + endif + ENDIF +! fully open area is 123/64 in^2 = 0.01334635 ft^2 + data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke+(data%State%CHOOKE(1)%WashoutMalf*data%State%Choke%HydraulicChoke1WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup + +!write(*,*) 'data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke=' ,data%State%CHOOKE(1)%WashoutMalf , data%State%CHOOKE(1)%AreaChoke + + data%State%CHOOKE(1)%AreaChoke=data%State%CHOOKE(1)%AreaChoke-(data%State%CHOOKE(1)%PlugMalf* data%State%Choke%Present_HydraulicChoke1Plug *data%State%CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup + + data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke+(data%State%CHOOKE(2)%WashoutMalf*data%State%Choke%HydraulicChoke2WashoutCoef*data%State%Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup + data%State%CHOOKE(2)%AreaChoke=data%State%CHOOKE(2)%AreaChoke-(data%State%CHOOKE(2)%PlugMalf* data%State%Choke%Present_HydraulicChoke2Plug *data%State%CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup +!write(*,*) 'data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke=' ,data%State%CHOOKE(2)%WashoutMalf , data%State%CHOOKE(2)%AreaChoke + + + data%State%CHOOKE(1)%AreaChokeFinal= data%State%CHOOKE(1)%AreaChoke + data%State%CHOOKE(2)%AreaChokeFinal= data%State%CHOOKE(2)%AreaChoke + +! 144: ft^2 to in^2 + CALL SetHydraulicChock1(100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve + CALL SetHydraulicChock2(100 - nint((data%State%CHOOKE(2)%AreaChokeFinal/(data%State%Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve + + +!write(*,*) 'data%State%CHOOKE(1)%PercentClose=' , data%State%CHOOKE(1)%PercentClose ! close percent 0 to 100 +!write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display +!write(*,*) 'data%State%CHOOKE(1)%AreaChokeFinal=' , data%State%CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance +!write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.) +!write(*,*) 'valve value=' , 100 - nint((data%State%CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance +!write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close +! =================== calculating Area +!write(*,*) 'data%State%CHOOKE(1)%AreaChoke= ' , data%State%CHOOKE(1)%AreaChoke +!WRITE(150,50) alpha_timeair,alpha_Qair,alpha_pairp, & +!alpha_Pdownstrem,alpha_diffpair,alpha_lossesair,data%State%CHOOKE(CHNUMBER)%PassedCourse +!50 FORMAT(7(f15.5)) +!======================================================================================== +!======================================================================================== +! write(*,*) PassedCourse + end + end module ChokeControlMain diff --git a/Equipments/ChokeControl/ChokeStartup.f90 b/Equipments/ChokeControl/ChokeStartup.f90 deleted file mode 100644 index 3dc0bdd..0000000 --- a/Equipments/ChokeControl/ChokeStartup.f90 +++ /dev/null @@ -1,127 +0,0 @@ - SUBROUTINE Choke_StartUp() - - USE CHOKEVARIABLES -use SimulationVariables !@ - USE CChokeProblemsVariables - implicit none - - CALL LOSS_INPUTS_CHOKE() - - !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') - - - !data%State%CHOOKE(1)%WashoutMalf=1 - !data%State%CHOOKE(1)%PlugMalf=0 - !data%State%CHOOKE(1)%FailMalf=0 - ! - !data%State%CHOOKE(2)%WashoutMalf=1 - !data%State%CHOOKE(2)%PlugMalf=0 - !data%State%CHOOKE(2)%FailMalf=0 - ! - ! - !ChokeAirFail=0 - ! - !GaugeChokePositionMailf=0 - - - - - - - - data%State%Choke%kRatio=1.4 -data%State%Choke%Cp=0.24 -data%State%Choke%CL=0.8 - -data%State%Choke%x1=0.5 - -data%State%Choke%LiquidPPG=9. -data%State%Choke%LiquidDensity=data%State%Choke%LiquidPPG*7.48 !lbm/ft**3 - -data%State%Choke%VL=1.0/data%State%Choke%LiquidDensity !SpecificVolume of Liquid - -data%State%Choke%Cv=data%State%Choke%Cp/data%State%Choke%kRatio - -data%State%Choke%nPolytripic=1+(data%State%Choke%x1*(data%State%Choke%Cp-data%State%Choke%Cv)/(data%State%Choke%x1*data%State%Choke%Cv+(1-data%State%Choke%x1)*data%State%Choke%CL)) - -data%State%Choke%VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream - -data%State%Choke%Cdrag=0.8 -data%State%Choke%Pwh=1400. !psi - - -data%State%Choke%Patm=14.7 -data%State%Choke%MixDens2=data%State%Choke%x1*data%State%Choke%VG1 !lbm/ft**3 - - - -data%State%Choke%epsilon_abs= 1e-5 -data%State%Choke%epsilon_step= 1e-5 - - -!ChokeDiameter= 32/64. !in - -data%State%CHOOKE%PercentClose= 0.0 - !AreaChoke=0.01334635 - - ! data%State%CHOOKE(1)%AreaChoke=0.01334635 -!ChokeAreaFullyOpen = 123.d0 / 64.d0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2 - -data%State%AirPumpLine%DeltaT_Choke=0.1 -!TotalStrokes1=0. -!TotalStrokes2=0. - -data%State%Choke%HydraulicChoke1WashoutCoef= 0.0 -data%State%Choke%HydraulicChoke2WashoutCoef= 0.0 - - - -data%State%Choke%ChokePlugTimeDelay = int(180./data%State%AirPumpLine%DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay - -data%State%Choke%Present_HydraulicChoke1Plug = REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100. -data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent -data%State%Choke%Plug1TimeCounter= 0 -data%State%Choke%DeltaPlug1Percent = 0.0 - -data%State%Choke%Present_HydraulicChoke2Plug = REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100. -data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent -data%State%Choke%Plug2TimeCounter= 0 -data%State%Choke%DeltaPlug2Percent = 0.0 - - - - - - -!======================AIRPUMP INPUTS(CONSTANTS)=========================== - data%State%AirPumpLine%CourseBase= 24. !cm - data%State%CHOOKE%PassedCourse= 0. - data%Equipments%ChokeControlPanel%ChokePosition=0. - - data%State%AirPumpLine%Acylinder= PI*(8.**2)/4. ! (CM^2), 8=DIAMETER, 24=course , 3785.412: cm^3 to galon - - - data%State%CHOOKE%ChokeIsOpening = .false. - data%State%CHOOKE%ChokeIsClosing = .false. - - - data%State%AirPumpLine%P_AIRP=0 - - data%State%AirDrivenPump%cc1 = 0.1354; data%State%AirDrivenPump%cc2 = -2.066; data%State%AirDrivenPump%cc3 = -21.09; data%State%AirDrivenPump%cc4 = -51.36; data%State%AirDrivenPump%cc5 = 5935 ! FOR OUTPUT IN GPM - ! cc1 = 4.754e-07; cc2 = -0.0001676; cc3 = -0.03953; cc4 = -2.223; cc5 = 5935 FOR OUTPUT IN IN^3/MIN - - -data%State%AirPumpLine%Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -data%State%AirPumpLine%QITER=5. !(gpm) - -! Q=0.0003585; true -data%State%AirPumpLine%TIME=0 -data%State%AirPumpLine%TOL_AIR=0.05 - -data%State%AirPumpLine%alpha_Qair=0 -data%State%AirPumpLine%alpha_timeair=0 -data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem -data%State%AirPumpLine%alpha_diffpair=0 -data%State%AirPumpLine%alpha_lossesair=0 - - end \ No newline at end of file diff --git a/Equipments/ChokeControl/ChokeStartup.i90 b/Equipments/ChokeControl/ChokeStartup.i90 index 76b9ca2..54e797e 100644 --- a/Equipments/ChokeControl/ChokeStartup.i90 +++ b/Equipments/ChokeControl/ChokeStartup.i90 @@ -1,12 +1,12 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/ChokeControl/ChokeStartup.f90" - SUBROUTINE Choke_StartUp() +# 1 "/home/admin/SimulationCore2/Equipments/ChokeControl/ChokeStartup.f90" +SUBROUTINE Choke_StartUp() USE CHOKEVARIABLES -use SimulationVariables !@ + use SimulationVariables USE CChokeProblemsVariables implicit none - CALL LOSS_INPUTS_CHOKE() + CALL LOSS_INPUTS_CHOKE() !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') @@ -31,68 +31,63 @@ use SimulationVariables !@ data%State%Choke%kRatio=1.4 -data%State%Choke%Cp=0.24 -data%State%Choke%CL=0.8 + data%State%Choke%Cp=0.24 + data%State%Choke%CL=0.8 -data%State%Choke%x1=0.5 - -data%State%Choke%LiquidPPG=9. -data%State%Choke%LiquidDensity=data%State%Choke%LiquidPPG*7.48 !lbm/ft**3 + data%State%Choke%x1=0.5 + + data%State%Choke%LiquidPPG=9. + data%State%Choke%LiquidDensity=data%State%Choke%LiquidPPG*7.48 !lbm/ft**3 -data%State%Choke%VL=1.0/data%State%Choke%LiquidDensity !SpecificVolume of Liquid + data%State%Choke%VL=1.0/data%State%Choke%LiquidDensity !SpecificVolume of Liquid -data%State%Choke%Cv=data%State%Choke%Cp/data%State%Choke%kRatio + data%State%Choke%Cv=data%State%Choke%Cp/data%State%Choke%kRatio -data%State%Choke%nPolytripic=1+(data%State%Choke%x1*(data%State%Choke%Cp-data%State%Choke%Cv)/(data%State%Choke%x1*data%State%Choke%Cv+(1-data%State%Choke%x1)*data%State%Choke%CL)) - -data%State%Choke%VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream + data%State%Choke%nPolytripic=1+(data%State%Choke%x1*(data%State%Choke%Cp-data%State%Choke%Cv)/(data%State%Choke%x1*data%State%Choke%Cv+(1-data%State%Choke%x1)*data%State%Choke%CL)) + + data%State%Choke%VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream -data%State%Choke%Cdrag=0.8 -data%State%Choke%Pwh=1400. !psi + data%State%Choke%Cdrag=0.8 + data%State%Choke%Pwh=1400. !psi -data%State%Choke%Patm=14.7 -data%State%Choke%MixDens2=data%State%Choke%x1*data%State%Choke%VG1 !lbm/ft**3 + data%State%Choke%Patm=14.7 + data%State%Choke%MixDens2=data%State%Choke%x1*data%State%Choke%VG1 !lbm/ft**3 -data%State%Choke%epsilon_abs= 1e-5 -data%State%Choke%epsilon_step= 1e-5 + data%State%Choke%epsilon_abs= 1e-5 + data%State%Choke%epsilon_step= 1e-5 !ChokeDiameter= 32/64. !in -data%State%CHOOKE%PercentClose= 0.0 + data%State%CHOOKE%PercentClose= 0.0 !AreaChoke=0.01334635 ! data%State%CHOOKE(1)%AreaChoke=0.01334635 !ChokeAreaFullyOpen = 123.d0 / 64.d0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2 -data%State%AirPumpLine%DeltaT_Choke=0.1 + data%State%AirPumpLine%DeltaT_Choke=0.1 !TotalStrokes1=0. !TotalStrokes2=0. -data%State%Choke%HydraulicChoke1WashoutCoef= 0.0 -data%State%Choke%HydraulicChoke2WashoutCoef= 0.0 - - + data%State%Choke%HydraulicChoke1WashoutCoef= 0.0 + data%State%Choke%HydraulicChoke2WashoutCoef= 0.0 -data%State%Choke%ChokePlugTimeDelay = int(180./data%State%AirPumpLine%DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay -data%State%Choke%Present_HydraulicChoke1Plug = REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100. -data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent -data%State%Choke%Plug1TimeCounter= 0 -data%State%Choke%DeltaPlug1Percent = 0.0 -data%State%Choke%Present_HydraulicChoke2Plug = REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100. -data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent -data%State%Choke%Plug2TimeCounter= 0 -data%State%Choke%DeltaPlug2Percent = 0.0 + data%State%Choke%ChokePlugTimeDelay = int(180./data%State%AirPumpLine%DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay + data%State%Choke%Present_HydraulicChoke1Plug = REAL(data%problems%ChokeProblems%HydraulicChoke1PluggedPercent)/100. + data%State%Choke%HydraulicChoke1PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke1PluggedPercent + data%State%Choke%Plug1TimeCounter= 0 + data%State%Choke%DeltaPlug1Percent = 0.0 - - - + data%State%Choke%Present_HydraulicChoke2Plug = REAL(data%problems%ChokeProblems%HydraulicChoke2PluggedPercent)/100. + data%State%Choke%HydraulicChoke2PluggedPercent_Old= data%problems%ChokeProblems%HydraulicChoke2PluggedPercent + data%State%Choke%Plug2TimeCounter= 0 + data%State%Choke%DeltaPlug2Percent = 0.0 !======================AIRPUMP INPUTS(CONSTANTS)=========================== data%State%AirPumpLine%CourseBase= 24. !cm @@ -112,17 +107,17 @@ data%State%Choke%DeltaPlug2Percent = 0.0 ! cc1 = 4.754e-07; cc2 = -0.0001676; cc3 = -0.03953; cc4 = -2.223; cc5 = 5935 FOR OUTPUT IN IN^3/MIN -data%State%AirPumpLine%Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -data%State%AirPumpLine%QITER=5. !(gpm) + data%State%AirPumpLine%Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%AirPumpLine%QITER=5. !(gpm) ! Q=0.0003585; true -data%State%AirPumpLine%TIME=0 -data%State%AirPumpLine%TOL_AIR=0.05 + data%State%AirPumpLine%TIME=0 + data%State%AirPumpLine%TOL_AIR=0.05 -data%State%AirPumpLine%alpha_Qair=0 -data%State%AirPumpLine%alpha_timeair=0 -data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem -data%State%AirPumpLine%alpha_diffpair=0 -data%State%AirPumpLine%alpha_lossesair=0 + data%State%AirPumpLine%alpha_Qair=0 + data%State%AirPumpLine%alpha_timeair=0 + data%State%AirPumpLine%alpha_Pdownstrem=data%State%AirPumpLine%Pdownstrem + data%State%AirPumpLine%alpha_diffpair=0 + data%State%AirPumpLine%alpha_lossesair=0 - end +end diff --git a/Equipments/Drawworks/Drawworks_Direction.i90 b/Equipments/Drawworks/Drawworks_Direction.i90 index 13e637e..6159b4d 100644 --- a/Equipments/Drawworks/Drawworks_Direction.i90 +++ b/Equipments/Drawworks/Drawworks_Direction.i90 @@ -10,21 +10,44 @@ subroutine Drawworks_Direction IMPLICIT NONE - if (data%State%Drawworks%Switch==1) then !Up +! ! if (data%State%Drawworks%Switch==1) then !Up +! if (data%State%Drawworks%Throttle >= 0.d0) then !Up +! data%State%Drawworks%motion = +1 +! data%State%Drawworks%w_old_drum = data%State%Drawworks%w_drum !(pi*(data%State%Drawworks%N_old/data%State%Drawworks%Conv_Ratio)/30.d0) ? +! data%State%Drawworks%w_drum = (pi*(data%State%Drawworks%Speed/data%State%Drawworks%Conv_Ratio)/30.d0) ![rad/s] +! data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height+(((data%State%Drawworks%Diameter/2.0)*(data%State%Drawworks%time_step*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum)))/data%State%Drawworks%NumberOfLine) ![m] +! ! else if (data%State%Drawworks%Switch==-1) then !Down +! else if (data%State%Drawworks%Throttle < 0.d0) then !Down +! data%State%Drawworks%motion = -1 +! data%State%Drawworks%w_old_drum = data%State%Drawworks%w_drum !(pi*(data%State%Drawworks%N_old/data%State%Drawworks%Conv_Ratio)/30.d0) ? +! data%State%Drawworks%w_drum = (pi*(data%State%Drawworks%Speed/data%State%Drawworks%Conv_Ratio)/30.d0) ![rad/s] +! data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height-(((data%State%Drawworks%Diameter/2.0)*(data%State%Drawworks%time_step*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum)))/data%State%Drawworks%NumberOfLine) ![m] +! !else if (data%State%Drawworks%Switch==0) then !Off +! ! data%State%Drawworks%motion = 0 +! ! data%State%Drawworks%w_old_drum = 0.d0 +! ! data%State%Drawworks%w_drum = 0.d0 +! ! data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height +! end if + + + if ((data%State%Drawworks%Throttle>0.d0) .or. (data%State%Drawworks%Throttle==0.d0 .and. data%State%Drawworks%Speed/=0.d0 .and. data%State%Drawworks%motion==+1)) then !Up data%State%Drawworks%motion = +1 data%State%Drawworks%w_old_drum = data%State%Drawworks%w_drum !(pi*(data%State%Drawworks%N_old/data%State%Drawworks%Conv_Ratio)/30.d0) ? data%State%Drawworks%w_drum = (pi*(data%State%Drawworks%Speed/data%State%Drawworks%Conv_Ratio)/30.d0) ![rad/s] - data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height+(((data%State%Drawworks%Diameter/2.0)*(data%State%Drawworks%time_step*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum)))/data%State%Drawworks%NumberOfLine) ![m] - else if (data%State%Drawworks%Switch==-1) then !Down +!data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height+(((data%State%Drawworks%Diameter/2.0)*(data%State%Drawworks%time_step*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum)))/data%State%Drawworks%NumberOfLine) ![m] + data%State%Drawworks%HookLinearVelocity = (((data%State%Drawworks%Diameter/2.0)*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum))/data%State%Drawworks%NumberOfLine) ![m/s] + else if ((data%State%Drawworks%Throttle<0.d0) .or. (data%State%Drawworks%Throttle==0.d0 .and. data%State%Drawworks%Speed/=0.d0 .and. data%State%Drawworks%motion==-1)) then !Down data%State%Drawworks%motion = -1 data%State%Drawworks%w_old_drum = data%State%Drawworks%w_drum !(pi*(data%State%Drawworks%N_old/data%State%Drawworks%Conv_Ratio)/30.d0) ? data%State%Drawworks%w_drum = (pi*(data%State%Drawworks%Speed/data%State%Drawworks%Conv_Ratio)/30.d0) ![rad/s] - data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height-(((data%State%Drawworks%Diameter/2.0)*(data%State%Drawworks%time_step*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum)))/data%State%Drawworks%NumberOfLine) ![m] -!else if (data%State%Drawworks%Switch==0) then !Off -! data%State%Drawworks%motion = 0 -! data%State%Drawworks%w_old_drum = 0.d0 -! data%State%Drawworks%w_drum = 0.d0 -! data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height +!data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height-(((data%State%Drawworks%Diameter/2.0)*(data%State%Drawworks%time_step*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum)))/data%State%Drawworks%NumberOfLine) ![m] + data%State%Drawworks%HookLinearVelocity = -(((data%State%Drawworks%Diameter/2.0)*0.5d0*(data%State%Drawworks%w_drum+data%State%Drawworks%w_old_drum))/data%State%Drawworks%NumberOfLine) ![m/s] + else !fixed + data%State%Drawworks%motion = 0 + data%State%Drawworks%w_old_drum = 0.d0 + data%State%Drawworks%w_drum = 0.d0 + data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height +!data%State%Drawworks%HookLinearVelocity = 0.d0 ![m/s] end if @@ -40,8 +63,6 @@ subroutine Drawworks_Direction - - !if (data%State%Drawworks%Conv_Ratio==1.d0) then ! ! diff --git a/Equipments/Drawworks/Drawworks_Outputs.f90 b/Equipments/Drawworks/Drawworks_Outputs.f90 index 895a3c1..60f306c 100644 --- a/Equipments/Drawworks/Drawworks_Outputs.f90 +++ b/Equipments/Drawworks/Drawworks_Outputs.f90 @@ -34,8 +34,4 @@ subroutine Drawworks_Outputs !!data%State%Drawworks%HookHeight_graph_output !data%Equipments%DrillingConsole%ParkingBrakeLed = 0 ! in Drawworks_Inputs - - - - end subroutine Drawworks_Outputs \ No newline at end of file diff --git a/Equipments/Drawworks/Drawworks_Outputs.i90 b/Equipments/Drawworks/Drawworks_Outputs.i90 index 586d559..9cfa2bb 100644 --- a/Equipments/Drawworks/Drawworks_Outputs.i90 +++ b/Equipments/Drawworks/Drawworks_Outputs.i90 @@ -29,13 +29,10 @@ subroutine Drawworks_Outputs Call Activate_FloorCollision() end if - Call Set_HookHeight( real(data%State%Drawworks%Hook_Height_final) ) ![ft] +!Call Set_HookHeight( real(data%State%Drawworks%Hook_Height_final) ) ![ft] data%State%Drawworks%TDHookHeight = data%State%Drawworks%Hook_Height_final ![ft] +! = data%State%Drawworks%HookLinearVelocity_final ![ft/s] !!data%State%Drawworks%HookHeight_graph_output !data%Equipments%DrillingConsole%ParkingBrakeLed = 0 ! in Drawworks_Inputs - - - - end subroutine Drawworks_Outputs diff --git a/Equipments/Drawworks/Drawworks_Solver.i90 b/Equipments/Drawworks/Drawworks_Solver.i90 index 3b08a7c..5d09928 100644 --- a/Equipments/Drawworks/Drawworks_Solver.i90 +++ b/Equipments/Drawworks/Drawworks_Solver.i90 @@ -23,7 +23,7 @@ subroutine Drawworks_Solver !>>>>>>>>>>>>>>>>>>>> Speed <<<<<<<<<<<<<<<<<<<<<<<< - data%State%Drawworks%N_Throtle = data%State%Drawworks%Throttle ![rpm] + data%State%Drawworks%N_Throtle = abs(data%State%Drawworks%Throttle) ![rpm] !data%State%Drawworks%N_Accelarator = (data%State%Drawworks%Acceleretor/100.d0)*965.d0 ![rpm] !IF (data%State%Drawworks%N_Throtle>data%State%Drawworks%N_Accelarator) THEN @@ -78,24 +78,25 @@ subroutine Drawworks_Solver -!==================================================== -! Crown Collision (Max_Hook_Height) -!==================================================== - if ( ((3.280839895d0*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then - if ( CrownCollision_Status==0 .and. data%State%Drawworks%motion==1 ) then - CrownCollision_Status = 1 - data%State%Drawworks%CrownCollision = .true. - data%State%Drawworks%SoundCrownCollision = .true. - else - data%State%Drawworks%SoundCrownCollision = .false. - end if - if ( data%State%Drawworks%motion==-1 .and. data%State%Drawworks%CrownCollision==.false. ) then - data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] - else - Call DWFixModeMotion - end if - return - end if +! !==================================================== +! ! Crown Collision (Max_Hook_Height) +! !==================================================== +! ?if ( ((3.280839895d0*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then +! if ( CrownCollision_Status==0 .and. data%State%Drawworks%motion==1 ) then +! CrownCollision_Status = 1 +! data%State%Drawworks%CrownCollision = .true. +! data%State%Drawworks%SoundCrownCollision = .true. +! else +! data%State%Drawworks%SoundCrownCollision = .false. +! end if +! if ( data%State%Drawworks%motion==-1 .and. data%State%Drawworks%CrownCollision==.false. ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if @@ -103,24 +104,25 @@ subroutine Drawworks_Solver -!==================================================== -! Floor Collision (Min_Hook_Height) -!==================================================== - if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then - if ( FloorCollision_Status==0 .and. data%State%Drawworks%motion==-1 ) then - FloorCollision_Status = 1 - data%State%Drawworks%FloorCollision = .true. - data%State%Drawworks%SoundFloorCollision = .true. - else - data%State%Drawworks%SoundFloorCollision = .false. - end if - if ( data%State%Drawworks%motion==1 .and. data%State%Drawworks%FloorCollision==.false. ) then - data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] - else - Call DWFixModeMotion - end if - return - end if +! !==================================================== +! ! Floor Collision (Min_Hook_Height) +! !==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then +! if ( FloorCollision_Status==0 .and. data%State%Drawworks%motion==-1 ) then +! FloorCollision_Status = 1 +! data%State%Drawworks%FloorCollision = .true. +! data%State%Drawworks%SoundFloorCollision = .true. +! else +! data%State%Drawworks%SoundFloorCollision = .false. +! end if +! if ( data%State%Drawworks%motion==1 .and. data%State%Drawworks%FloorCollision==.false. ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if @@ -129,17 +131,18 @@ subroutine Drawworks_Solver -!==================================================== -! Crown Warning -!==================================================== - if ( ((3.280839895*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then - if ( data%State%Drawworks%motion==-1 ) then - data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] - else - Call DWFixModeMotion - end if - return - end if +! !==================================================== +! ! Crown Warning +! !==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then +! if ( data%State%Drawworks%motion==-1 ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if @@ -147,17 +150,18 @@ subroutine Drawworks_Solver -!==================================================== -! Floor Warning -!==================================================== - if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then - if ( data%State%Drawworks%motion==1 ) then - data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] - else - Call DWFixModeMotion - end if - return - end if +! !==================================================== +! ! Floor Warning +! !==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then +! if ( data%State%Drawworks%motion==1 ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if @@ -198,7 +202,8 @@ subroutine Drawworks_Solver if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then if ( ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)<=(data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))+data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)>data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))) .and. (data%State%Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDBOPElementNo(j)))) ) then if ( data%State%Drawworks%motion==1 ) then - data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +!data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] + data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] else Call DWFixModeMotion end if @@ -222,7 +227,8 @@ subroutine Drawworks_Solver if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then if ( ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness)>=(data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDBOPElementNo(j))-data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness) BottomHole ROP Condition if ( (int(data%State%Drawworks%TDDrillStemBottom*10000.d0)>=(int((data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax)*10000.d0))) .and. (data%State%Drawworks%motion==-1 .or. data%State%Drawworks%motion==0) ) then if ( data%State%Drawworks%StringIsBottomOfWell==0 ) then - data%State%Drawworks%Hook_Height_final = data%State%Drawworks%Hook_Height_final+(data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax)) +!?data%State%Drawworks%Hook_Height_final = data%State%Drawworks%Hook_Height_final+(data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax)) + data%State%Drawworks%HookLinearVelocity_final = (data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax))/data%State%Drawworks%time_step ![ft/s] data%State%Drawworks%StringIsBottomOfWell = 1 end if Call DWFixModeMotion @@ -276,7 +276,8 @@ subroutine Drawworks_Solver - data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +!data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] + data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] data%State%Drawworks%HookHeight_graph_output = 0.1189d0*((3.280839895d0*data%State%Drawworks%Hook_Height)-28.d0)-2.6d0 ![ft] diff --git a/Equipments/Drawworks/Drawworks_Solver_OffMode.i90 b/Equipments/Drawworks/Drawworks_Solver_OffMode.i90 new file mode 100644 index 0000000..46e7d5a --- /dev/null +++ b/Equipments/Drawworks/Drawworks_Solver_OffMode.i90 @@ -0,0 +1,259 @@ +# 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_Solver_OffMode.f90" +subroutine Drawworks_Solver_OffMode + + Use CUnityInputs + use UnitySignalVariables + use UnitySignalsModule + use SimulationVariables !@ + use OperationScenariosModule + use OperationScenariosModule !!CElevator... + use UnitySignalsModule +! Use CTdsElevatorModesEnumVariables + use OperationScenariosModule + + + IMPLICIT NONE + + + Integer :: j + Integer :: CrownCollision_Status , FloorCollision_Status , CrownWarning_Status , FloorWarning_Status + + + + + data%State%Drawworks%motion = 0 + data%State%Drawworks%w_old_drum = 0.d0 + data%State%Drawworks%w_drum = 0.d0 +!data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height + data%State%Drawworks%HookLinearVelocity = 0.d0 ![ft/s] + + + + + + +!==================================================== +! Collision & Warning +!==================================================== + if ( data%State%Drawworks%CrownCollision == .false. ) then + CrownCollision_Status = 0 + end if + if ( data%State%Drawworks%FloorCollision == .false. ) then + FloorCollision_Status = 0 + end if + + + + + + + +!!==================================================== +!! Crown Collision (Max_Hook_Height) +!!==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then +! if ( CrownCollision_Status==0 .and. data%State%Drawworks%motion==1 ) then +! CrownCollision_Status = 1 +! data%State%Drawworks%CrownCollision = .true. +! data%State%Drawworks%SoundCrownCollision = .true. +! else +! data%State%Drawworks%SoundCrownCollision = .false. +! end if +! if ( data%State%Drawworks%motion==-1 .and. data%State%Drawworks%CrownCollision==.false. ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if + + + + + + + +! !==================================================== +! ! Floor Collision (Min_Hook_Height) +! !==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then +! if ( FloorCollision_Status==0 .and. data%State%Drawworks%motion==-1 ) then +! FloorCollision_Status = 1 +! data%State%Drawworks%FloorCollision = .true. +! data%State%Drawworks%SoundFloorCollision = .true. +! else +! data%State%Drawworks%SoundFloorCollision = .false. +! end if +! if ( data%State%Drawworks%motion==1 .and. data%State%Drawworks%FloorCollision==.false. ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if + + + + + + + + +! !==================================================== +! ! Warning (Max_Hook_Height) +! !==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then +! if ( data%State%Drawworks%motion==-1 ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if + + + + + + + +! !==================================================== +! ! Warning (Min_Hook_Height) +! !==================================================== +! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then +! if ( data%State%Drawworks%motion==1 ) then +! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] +! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] +! else +! Call DWFixModeMotion +! end if +! return +! end if + + + + + + + + + +!==================================================== +! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion) +!==================================================== + if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. data%State%Drawworks%motion/=-1 ) then + Call DWFixModeMotion + return + end if + + if ( data%State%Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. data%State%Drawworks%motion/=-1 ) then + Call DWFixModeMotion + return + end if + + + + + + + + + +!==================================================== +! RAM & ToolJoint Collision (Top of RAM) +!==================================================== + Do j = 2,4 !startup problem ??????? + if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then + if ( ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)<=(data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))+data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)>data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))) .and. (data%State%Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDBOPElementNo(j)))) ) then + if ( data%State%Drawworks%motion==1 ) then +!data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] + data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] + else + Call DWFixModeMotion + end if + return + end if + end if + End Do + + + + + + + + + +!==================================================== +! RAM & ToolJoint Collision (Bottom of RAM) +!==================================================== + Do j = 2,4 + if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then + if ( ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness)>=(data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDBOPElementNo(j))-data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness) BottomHole ROP Condition + if ( (int(data%State%Drawworks%TDDrillStemBottom*10000.d0)>=(int((data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax)*10000.d0))) .and. (data%State%Drawworks%motion==-1 .or. data%State%Drawworks%motion==0) ) then + if ( data%State%Drawworks%StringIsBottomOfWell==0 ) then +!?data%State%Drawworks%Hook_Height_final = data%State%Drawworks%Hook_Height_final+(data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax)) + data%State%Drawworks%HookLinearVelocity_final = (data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax))/data%State%Drawworks%time_step ![ft/s] + data%State%Drawworks%StringIsBottomOfWell = 1 + end if + Call DWFixModeMotion + return + else + data%State%Drawworks%StringIsBottomOfWell = 0 + end if + + + + + + +!data%State%Drawworks%Hook_Height_final=3.280839895d0*data%State%Drawworks%Hook_Height ![ft] + data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s] + data%State%Drawworks%HookHeight_graph_output=0.1189d0*((3.280839895d0*data%State%Drawworks%Hook_Height)-28.0d0)-2.6d0 ![ft] + + + + + +end subroutine Drawworks_Solver_OffMode diff --git a/Equipments/Drawworks/Drawworks_StartUp.i90 b/Equipments/Drawworks/Drawworks_StartUp.i90 index 129f19e..7f9a6c2 100644 --- a/Equipments/Drawworks/Drawworks_StartUp.i90 +++ b/Equipments/Drawworks/Drawworks_StartUp.i90 @@ -21,9 +21,11 @@ subroutine Drawworks_StartUp data%State%Drawworks%Hook_Height_ini = 75.0d0 ![ft] data%State%Drawworks%Hook_Height_ini_graph_output = -1.54090d0 ![ft] data%State%Drawworks%Hook_Height_inim = 0.3048d0*data%State%Drawworks%Hook_Height_ini ![m] - data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height_inim ![m] - data%State%Drawworks%Hook_Height_final = 75.d0 ![ft] - data%State%Drawworks%TDHookHeight = 75.d0 ![ft] +!data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height_inim ![m] +!data%State%Drawworks%Hook_Height_final = 75.d0 ![ft] + data%State%Drawworks%TDHookHeight = data%State%Drawworks%Hook_Height_final ![ft] + data%State%Drawworks%HookLinearVelocity_final = 0.d0 ![ft/s] + data%State%Drawworks%HookLinearVelocity = 0.d0 ![m/s] diff --git a/Equipments/Drawworks/Drawworks_VARIABLES.f90 b/Equipments/Drawworks/Drawworks_VARIABLES.f90 index 9908fb7..33b5c85 100644 --- a/Equipments/Drawworks/Drawworks_VARIABLES.f90 +++ b/Equipments/Drawworks/Drawworks_VARIABLES.f90 @@ -49,9 +49,4 @@ MODULE Drawworks_VARIABLES END TYPE Drawworks_Var !*********************************************************************************************** !**************************************************************************************************** - - - - - END MODULE Drawworks_VARIABLES \ No newline at end of file diff --git a/Equipments/Drawworks/Drawworks_VARIABLES.i90 b/Equipments/Drawworks/Drawworks_VARIABLES.i90 index f6f50f3..987fd79 100644 --- a/Equipments/Drawworks/Drawworks_VARIABLES.i90 +++ b/Equipments/Drawworks/Drawworks_VARIABLES.i90 @@ -27,7 +27,8 @@ MODULE Drawworks_VARIABLES REAL :: Hook_Height, Hook_Height_ini, Hook_Height_inim, Hook_Height_ini_graph_output, Hook_Height_final, max_Hook_Height, min_Hook_Height, HookHeight_graph_output REAL :: N_Throtle, Conv_Ratio, NumberOfLine, Speed, N_new, N_old ! N[RPM] REAL :: w_drum, w_old_drum ! w[rad/s] - REAL :: HookLinearVelocity ! [ft/s] + REAL :: HookLinearVelocity ! [m/s] + REAL :: HookLinearVelocity_final ! [ft/s] REAL , Dimension(6) :: TDBOPHeight REAL , Dimension(4) :: TDBOPRamDiam REAL :: TDBOPThickness, TDDrillStemBottom, TDWellTotalLength, TDDlMax @@ -49,9 +50,4 @@ MODULE Drawworks_VARIABLES END TYPE Drawworks_Var !*********************************************************************************************** !**************************************************************************************************** - - - - - END MODULE Drawworks_VARIABLES diff --git a/Equipments/DrillingConsole_ScrLEDs.f90 b/Equipments/DrillingConsole_ScrLEDs.f90 index 83544b8..e69de29 100644 --- a/Equipments/DrillingConsole_ScrLEDs.f90 +++ b/Equipments/DrillingConsole_ScrLEDs.f90 @@ -1,51 +0,0 @@ -subroutine DrillingConsole_ScrLEDs - - use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables - use SimulationVariables !@ - - IMPLICIT NONE - - - - !===> Torque Limit - data%Equipments%DrillingConsole%RTTorqueLimitGauge = sngl(1-data%State%RTable%TorqueLimitGaugeMalf)*(data%Equipments%DrillingConsole%RTTorqueLimitKnob/10.d0)*7000.d0 !tabdile bazeye 0-10 be 0-7000 taghribi anjam shode, baadan eslah shavad ?????? - - - - - - if((any(data%Equipments%DrillingConsole%AssignmentSwitch==(/1,2,3,4,8,9,10,11/)))) then - - data%Equipments%DrillingConsole%SCR1LED=1 - data%Equipments%DrillingConsole%SCR2LED=1 - data%Equipments%DrillingConsole%SCR3LED=1 - data%Equipments%DrillingConsole%SCR4LED=1 - - else if (data%Equipments%DrillingConsole%AssignmentSwitch == 5) then - - data%Equipments%DrillingConsole%SCR1LED=1 - data%Equipments%DrillingConsole%SCR2LED=1 - data%Equipments%DrillingConsole%SCR3LED=0 - data%Equipments%DrillingConsole%SCR4LED=1 - - else if (data%Equipments%DrillingConsole%AssignmentSwitch == 7) then - - data%Equipments%DrillingConsole%SCR1LED=1 - data%Equipments%DrillingConsole%SCR2LED=1 - data%Equipments%DrillingConsole%SCR3LED=1 - data%Equipments%DrillingConsole%SCR4LED=0 - - else - data%Equipments%DrillingConsole%SCR1LED=0 - data%Equipments%DrillingConsole%SCR2LED=0 - data%Equipments%DrillingConsole%SCR3LED=0 - data%Equipments%DrillingConsole%SCR4LED=0 - - end if - - - - -end subroutine DrillingConsole_ScrLEDs \ No newline at end of file diff --git a/Equipments/DrillingConsole_ScrLEDs.i90 b/Equipments/DrillingConsole_ScrLEDs.i90 index d14d779..3523f19 100644 --- a/Equipments/DrillingConsole_ScrLEDs.i90 +++ b/Equipments/DrillingConsole_ScrLEDs.i90 @@ -1,52 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/DrillingConsole_ScrLEDs.f90" -subroutine DrillingConsole_ScrLEDs - - use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables - use SimulationVariables !@ - - IMPLICIT NONE - - - -!===> Torque Limit - data%Equipments%DrillingConsole%RTTorqueLimitGauge = sngl(1-data%State%RTable%TorqueLimitGaugeMalf)*(data%Equipments%DrillingConsole%RTTorqueLimitKnob/10.d0)*7000.d0 !tabdile bazeye 0-10 be 0-7000 taghribi anjam shode, baadan eslah shavad ?????? - - - - - - if((any(data%Equipments%DrillingConsole%AssignmentSwitch==(/1,2,3,4,8,9,10,11/)))) then - - data%Equipments%DrillingConsole%SCR1LED=1 - data%Equipments%DrillingConsole%SCR2LED=1 - data%Equipments%DrillingConsole%SCR3LED=1 - data%Equipments%DrillingConsole%SCR4LED=1 - - else if (data%Equipments%DrillingConsole%AssignmentSwitch == 5) then - - data%Equipments%DrillingConsole%SCR1LED=1 - data%Equipments%DrillingConsole%SCR2LED=1 - data%Equipments%DrillingConsole%SCR3LED=0 - data%Equipments%DrillingConsole%SCR4LED=1 - - else if (data%Equipments%DrillingConsole%AssignmentSwitch == 7) then - - data%Equipments%DrillingConsole%SCR1LED=1 - data%Equipments%DrillingConsole%SCR2LED=1 - data%Equipments%DrillingConsole%SCR3LED=1 - data%Equipments%DrillingConsole%SCR4LED=0 - - else - data%Equipments%DrillingConsole%SCR1LED=0 - data%Equipments%DrillingConsole%SCR2LED=0 - data%Equipments%DrillingConsole%SCR3LED=0 - data%Equipments%DrillingConsole%SCR4LED=0 - - end if - - - - -end subroutine DrillingConsole_ScrLEDs diff --git a/Equipments/MudSystem/Circulation_Code_Select.f90 b/Equipments/MudSystem/Circulation_Code_Select.f90 index d3d3e0c..de537fe 100644 --- a/Equipments/MudSystem/Circulation_Code_Select.f90 +++ b/Equipments/MudSystem/Circulation_Code_Select.f90 @@ -52,7 +52,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver if (data%State%TD_Vol%RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe - IF (KickVARIABLES%KickFlux .AND. NOT(KickVARIABLES%KickOffBottom)) THEN + IF (KickFlux .AND. NOT(KickOffBottom)) THEN call Kick_Influx endif @@ -65,7 +65,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver ! ============================ must be after migration ============================== - DO KickNumber= data%State%MudSystem%NewInfluxNumber-KickVARIABLES%NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber + DO KickNumber= data%State%MudSystem%NewInfluxNumber-NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber ! FINDING NEW KICK LOCATIONS: data%State%MudSystem%Ann_KickLoc= 0 data%State%MudSystem%Op_KickLoc= 0 @@ -94,7 +94,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver ! ============================ must be after migration-end =========================== - IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == data%State%MudSystem%NewInfluxNumber .AND. NOT(KickVARIABLES%KickOffBottom) .AND. data%State%MudSystem%WellHeadIsOpen) THEN + IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == data%State%MudSystem%NewInfluxNumber .AND. NOT(KickOffBottom) .AND. data%State%MudSystem%WellHeadIsOpen) THEN cycle diff --git a/Equipments/MudSystem/Circulation_Code_Select.i90 b/Equipments/MudSystem/Circulation_Code_Select.i90 index 5c94164..c70226e 100644 --- a/Equipments/MudSystem/Circulation_Code_Select.i90 +++ b/Equipments/MudSystem/Circulation_Code_Select.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/MudSystem/Circulation_Code_Select.f90" +# 1 "/home/admin/SimulationCore2/Equipments/MudSystem/Circulation_Code_Select.f90" subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver use KickVARIABLESModule USE MudSystemVARIABLES @@ -53,7 +53,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver if (data%State%TD_Vol%RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe - IF (KickVARIABLES%KickFlux .AND. NOT(KickVARIABLES%KickOffBottom)) THEN + IF (KickFlux .AND. NOT(KickOffBottom)) THEN call Kick_Influx endif @@ -66,7 +66,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver ! ============================ must be after migration ============================== - DO KickNumber= data%State%MudSystem%NewInfluxNumber-KickVARIABLES%NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber + DO KickNumber= data%State%MudSystem%NewInfluxNumber-NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber ! FINDING NEW KICK LOCATIONS: data%State%MudSystem%Ann_KickLoc= 0 data%State%MudSystem%Op_KickLoc= 0 @@ -95,7 +95,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver ! ============================ must be after migration-end =========================== - IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == data%State%MudSystem%NewInfluxNumber .AND. NOT(KickVARIABLES%KickOffBottom) .AND. data%State%MudSystem%WellHeadIsOpen) THEN + IF (ALLOCATED(GasPocketWeight%Array) .and. KickNumber == data%State%MudSystem%NewInfluxNumber .AND. NOT(KickOffBottom) .AND. data%State%MudSystem%WellHeadIsOpen) THEN cycle diff --git a/Equipments/MudSystem/Elements_Creation.f90 b/Equipments/MudSystem/Elements_Creation.f90 index 640d8f7..0146bb3 100644 --- a/Equipments/MudSystem/Elements_Creation.f90 +++ b/Equipments/MudSystem/Elements_Creation.f90 @@ -214,7 +214,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn data%State%MudSystem%DeltaVolumePipe = INT(data%State%MudSystem%DeltaVolumePipe * 100000.d0) / 100000.d0 !DeltaVolumeAnnulusCapacity= ((Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)-OldPosition))*Area_PipeSectionFt(NoPipeSections)* 7.48051948d0! ft^3 to gal - KickVARIABLES%DrillStringSpeed = (data%State%MudSystem%Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)-data%State%MudSystem%OldPosition) / 0.1 + DrillStringSpeed = (data%State%MudSystem%Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)-data%State%MudSystem%OldPosition) / 0.1 data%State%MudSystem%DeltaVolumeAnnulusCapacity= sum(data%State%MudSystem%PipeSection_VolumeCapacity(data%State%F_Counts%StringIntervalCounts+1:data%State%MudSystem%NoPipeSections)) - data%State%MudSystem%OldAnnulusCapacity diff --git a/Equipments/MudSystem/Elements_Creation.i90 b/Equipments/MudSystem/Elements_Creation.i90 index 0ba94de..ac17936 100644 --- a/Equipments/MudSystem/Elements_Creation.i90 +++ b/Equipments/MudSystem/Elements_Creation.i90 @@ -215,7 +215,7 @@ ALLOCATE (data%State%MudSystem%Xstart_OpSection(data%State%F_Counts%BottomHoleIn data%State%MudSystem%DeltaVolumePipe = INT(data%State%MudSystem%DeltaVolumePipe * 100000.d0) / 100000.d0 !DeltaVolumeAnnulusCapacity= ((Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)-OldPosition))*Area_PipeSectionFt(NoPipeSections)* 7.48051948d0! ft^3 to gal - KickVARIABLES%DrillStringSpeed = (data%State%MudSystem%Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)-data%State%MudSystem%OldPosition) / 0.1 + DrillStringSpeed = (data%State%MudSystem%Xend_PipeSection(data%State%F_Counts%StringIntervalCounts)-data%State%MudSystem%OldPosition) / 0.1 data%State%MudSystem%DeltaVolumeAnnulusCapacity= sum(data%State%MudSystem%PipeSection_VolumeCapacity(data%State%F_Counts%StringIntervalCounts+1:data%State%MudSystem%NoPipeSections)) - data%State%MudSystem%OldAnnulusCapacity diff --git a/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 b/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 index 2aa01c7..679cd00 100644 --- a/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 +++ b/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90 @@ -152,7 +152,7 @@ use SimulationVariables !@@@ !********************************************************* !write(*,*) 'Kick Contraction' - !data%State%MUD(2)%Q= data%State%MPumps%Total_Pump_GPM + !data%State%MUD(2)%Q= data%Equipments%MPumps%Total_Pump_GPM data%State%MudSystem%StringFlowRate= data%State%MUD(2)%Q data%State%MudSystem%AnnulusFlowRate= data%State%MUD(2)%Q diff --git a/Equipments/MudSystem/Kick_Expansion_and_Contraction.i90 b/Equipments/MudSystem/Kick_Expansion_and_Contraction.i90 index 9fd18d1..f9e7616 100644 --- a/Equipments/MudSystem/Kick_Expansion_and_Contraction.i90 +++ b/Equipments/MudSystem/Kick_Expansion_and_Contraction.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90" +# 1 "/home/admin/SimulationCore2/Equipments/MudSystem/Kick_Expansion_and_Contraction.f90" subroutine Kick_Expansion ! is called in subroutine CirculationCodeSelect Use GeoElements_FluidModule @@ -153,7 +153,7 @@ use SimulationVariables !@@@ !********************************************************* !write(*,*) 'Kick Contraction' -!data%State%MUD(2)%Q= data%State%MPumps%Total_Pump_GPM +!data%State%MUD(2)%Q= data%Equipments%MPumps%Total_Pump_GPM data%State%MudSystem%StringFlowRate= data%State%MUD(2)%Q data%State%MudSystem%AnnulusFlowRate= data%State%MUD(2)%Q diff --git a/Equipments/MudSystem/Kick_Influx.f90 b/Equipments/MudSystem/Kick_Influx.f90 index cea8854..e09788f 100644 --- a/Equipments/MudSystem/Kick_Influx.f90 +++ b/Equipments/MudSystem/Kick_Influx.f90 @@ -44,7 +44,7 @@ use SimulationVariables !@@@ endif - data%State%MudSystem%Op_MudDischarged_Volume%Array(1)= data%State%MudSystem%Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.0d0)*data%State%MudSystem%DeltaT_Mudline) !(gal) due to KickFlux + data%State%MudSystem%Op_MudDischarged_Volume%Array(1)= data%State%MudSystem%Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.0d0)*data%State%MudSystem%DeltaT_Mudline) !(gal) due to KickFlux !write(*,*) 'kick volume ok=' , Op_MudDischarged_Volume%Array(1) diff --git a/Equipments/MudSystem/Kick_Influx.i90 b/Equipments/MudSystem/Kick_Influx.i90 index a7d24c2..43f96d9 100644 --- a/Equipments/MudSystem/Kick_Influx.i90 +++ b/Equipments/MudSystem/Kick_Influx.i90 @@ -45,7 +45,7 @@ use SimulationVariables !@@@ endif - data%State%MudSystem%Op_MudDischarged_Volume%Array(1)= data%State%MudSystem%Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.0d0)*data%State%MudSystem%DeltaT_Mudline) !(gal) due to KickFlux + data%State%MudSystem%Op_MudDischarged_Volume%Array(1)= data%State%MudSystem%Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.0d0)*data%State%MudSystem%DeltaT_Mudline) !(gal) due to KickFlux !write(*,*) 'kick volume ok=' , Op_MudDischarged_Volume%Array(1) diff --git a/Equipments/MudSystem/Kick_Migration.f90 b/Equipments/MudSystem/Kick_Migration.f90 index 5c6f58d..36732e3 100644 --- a/Equipments/MudSystem/Kick_Migration.f90 +++ b/Equipments/MudSystem/Kick_Migration.f90 @@ -20,7 +20,7 @@ use SimulationVariables !@@@ integer jopelement,jopmud,jopsection,CuttingValue - !data%State%MUD(2)%Q= data%State%MPumps%Total_Pump_GPM + !data%State%MUD(2)%Q= data%Equipments%MPumps%Total_Pump_GPM !data%State%MudSystem%StringFlowRate= data%State%MUD(2)%Q !data%State%MudSystem%AnnulusFlowRate= data%State%MUD(2)%Q ! @@ -41,9 +41,9 @@ use SimulationVariables !@@@ !FirstSetKickMigration !write(*,*) 'NewInfluxNumber=' , NewInfluxNumber -DO KickNumber= data%State%MudSystem%NewInfluxNumber-KickVARIABLES%NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber +DO KickNumber= data%State%MudSystem%NewInfluxNumber-NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber !write(*,*) 'KickNumber=' , KickNumber - if (KickVARIABLES%KickFlux .AND. NOT(KickVARIABLES%KickOffBottom) .and. KickNumber == data%State%MudSystem%NewInfluxNumber) cycle + if (KickFlux .AND. NOT(KickOffBottom) .and. KickNumber == data%State%MudSystem%NewInfluxNumber) cycle if ( KickNumber == data%State%MudSystem%Ann_MudOrKick%Last() ) cycle ! when the last element in Annulus is kick, Migration is not called !write(*,*) 'Migration will be done for,KickNumber=' ,KickNumber diff --git a/Equipments/MudSystem/Kick_Migration.i90 b/Equipments/MudSystem/Kick_Migration.i90 index f443ee0..9aa14fe 100644 --- a/Equipments/MudSystem/Kick_Migration.i90 +++ b/Equipments/MudSystem/Kick_Migration.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/MudSystem/Kick_Migration.f90" +# 1 "/home/admin/SimulationCore2/Equipments/MudSystem/Kick_Migration.f90" subroutine Kick_Migration ! is called in subroutine CirculationCodeSelect Use GeoElements_FluidModule @@ -21,7 +21,7 @@ use SimulationVariables !@@@ integer jopelement,jopmud,jopsection,CuttingValue -!data%State%MUD(2)%Q= data%State%MPumps%Total_Pump_GPM +!data%State%MUD(2)%Q= data%Equipments%MPumps%Total_Pump_GPM !data%State%MudSystem%StringFlowRate= data%State%MUD(2)%Q !data%State%MudSystem%AnnulusFlowRate= data%State%MUD(2)%Q ! @@ -42,9 +42,9 @@ use SimulationVariables !@@@ !FirstSetKickMigration !write(*,*) 'NewInfluxNumber=' , NewInfluxNumber -DO KickNumber= data%State%MudSystem%NewInfluxNumber-KickVARIABLES%NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber +DO KickNumber= data%State%MudSystem%NewInfluxNumber-NoGasPocket+1 , data%State%MudSystem%NewInfluxNumber !write(*,*) 'KickNumber=' , KickNumber - if (KickVARIABLES%KickFlux .AND. NOT(KickVARIABLES%KickOffBottom) .and. KickNumber == data%State%MudSystem%NewInfluxNumber) cycle + if (KickFlux .AND. NOT(KickOffBottom) .and. KickNumber == data%State%MudSystem%NewInfluxNumber) cycle if ( KickNumber == data%State%MudSystem%Ann_MudOrKick%Last() ) cycle ! when the last element in Annulus is kick, Migration is not called !write(*,*) 'Migration will be done for,KickNumber=' ,KickNumber diff --git a/Equipments/MudSystem/MudSystem.f90 b/Equipments/MudSystem/MudSystem.f90 index cc78284..4e998a1 100644 --- a/Equipments/MudSystem/MudSystem.f90 +++ b/Equipments/MudSystem/MudSystem.f90 @@ -2039,9 +2039,9 @@ use SimulationVariables !@ data%State%MudSystem%GraphTotalStrokes=data%State%MudSystem%GraphTotalStrokes+((data%Equipments%DataDisplayConsole%MP1SPMGauge)/60.)*data%State%MudSystem%DeltaT_Mudline+((data%Equipments%DataDisplayConsole%MP2SPMGauge)/60.)*data%State%MudSystem%DeltaT_Mudline - data%State%MPumps%Total_Stroke_Counter_For_Plot = data%State%MPumps%Total_Stroke_Counter_For_Plot + ((data%Equipments%DataDisplayConsole%MP1SPMGauge + data%Equipments%DataDisplayConsole%MP2SPMGauge) / 60.0) * data%State%MudSystem%DeltaT_Mudline + data%Equipments%MPumps%Total_Stroke_Counter_For_Plot = data%Equipments%MPumps%Total_Stroke_Counter_For_Plot + ((data%Equipments%DataDisplayConsole%MP1SPMGauge + data%Equipments%DataDisplayConsole%MP2SPMGauge) / 60.0) * data%State%MudSystem%DeltaT_Mudline - ! CALL SetTotalStrokes(INT(data%State%MPumps%Total_Stroke_Counter_For_Plot)) + ! CALL SetTotalStrokes(INT(data%Equipments%MPumps%Total_Stroke_Counter_For_Plot)) data%Equipments%DataDisplayConsole%TotalStrokeCounter= real(nint(data%State%MudSystem%TotalStrokesPump1+data%State%MudSystem%TotalStrokesPump2)) !for drilling data display diff --git a/Equipments/MudSystem/MudSystem.i90 b/Equipments/MudSystem/MudSystem.i90 index 758a624..367f503 100644 --- a/Equipments/MudSystem/MudSystem.i90 +++ b/Equipments/MudSystem/MudSystem.i90 @@ -802,16 +802,16 @@ use SimulationVariables !@ data%State%FricPressDrop%PumpToManifoldCompressedMudVol = data%State%FricPressDrop%PumpToManifoldCompressedMudVol + MP1_Q / ConvMinToSec * dt PumpPressure1= data%State%FricPressDrop%PumpToManifoldCompressedMudVol / (MudCompressibility * data%State%FricPressDrop%PumpToManifoldMudVol) write(*,*) '21)PumpPressure1=' , PumpPressure1 - WRITE (*,*) ' valve 1 ', Manifold%Valve(1)%Status - WRITE (*,*) ' valve 4 ', Manifold%Valve(4)%Status - WRITE (*,*) ' valve 6 ', Manifold%Valve(6)%Status - WRITE (*,*) ' valve 7 ', Manifold%Valve(7)%Status - WRITE (*,*) ' valve 8 ', Manifold%Valve(8)%Status - WRITE (*,*) ' valve 9 ', Manifold%Valve(9)%Status - WRITE (*,*) ' valve 13 ', Manifold%Valve(13)%Status - WRITE (*,*) ' valve 68 ', Manifold%Valve(68)%Status - WRITE (*,*) ' valve 69 ', Manifold%Valve(69)%Status - WRITE (*,*) ' valve 48 ', Manifold%Valve(48)%Status + WRITE (*,*) ' valve 1 ', data%state%manifold%Valve(1)%Status + WRITE (*,*) ' valve 4 ', data%state%manifold%Valve(4)%Status + WRITE (*,*) ' valve 6 ', data%state%manifold%Valve(6)%Status + WRITE (*,*) ' valve 7 ', data%state%manifold%Valve(7)%Status + WRITE (*,*) ' valve 8 ', data%state%manifold%Valve(8)%Status + WRITE (*,*) ' valve 9 ', data%state%manifold%Valve(9)%Status + WRITE (*,*) ' valve 13 ', data%state%manifold%Valve(13)%Status + WRITE (*,*) ' valve 68 ', data%state%manifold%Valve(68)%Status + WRITE (*,*) ' valve 69 ', data%state%manifold%Valve(69)%Status + WRITE (*,*) ' valve 48 ', data%state%manifold%Valve(48)%Status !call DisplayOpenPathsWrite() ENDIF @@ -819,16 +819,16 @@ use SimulationVariables !@ data%State%FricPressDrop%PumpToManifoldCompressedMudVol = data%State%FricPressDrop%PumpToManifoldCompressedMudVol + MP2_Q / ConvMinToSec * dt PumpPressure2= data%State%FricPressDrop%PumpToManifoldCompressedMudVol / (MudCompressibility * data%State%FricPressDrop%PumpToManifoldMudVol) write(*,*) '22)PumpPressure1=' , PumpPressure2 - WRITE (*,*) ' -valve 1 ', Manifold%Valve(1)%Status - WRITE (*,*) ' -valve 4 ', Manifold%Valve(4)%Status - WRITE (*,*) ' -valve 6 ', Manifold%Valve(6)%Status - WRITE (*,*) ' -valve 7 ', Manifold%Valve(7)%Status - WRITE (*,*) ' -valve 8 ', Manifold%Valve(8)%Status - WRITE (*,*) ' -valve 9 ', Manifold%Valve(9)%Status - WRITE (*,*) ' -valve 13 ', Manifold%Valve(13)%Status - WRITE (*,*) ' -valve 68 ', Manifold%Valve(68)%Status - WRITE (*,*) ' -valve 69 ', Manifold%Valve(69)%Status - WRITE (*,*) ' -valve 48 ', Manifold%Valve(48)%Status + WRITE (*,*) ' -valve 1 ', data%state%manifold%Valve(1)%Status + WRITE (*,*) ' -valve 4 ', data%state%manifold%Valve(4)%Status + WRITE (*,*) ' -valve 6 ', data%state%manifold%Valve(6)%Status + WRITE (*,*) ' -valve 7 ', data%state%manifold%Valve(7)%Status + WRITE (*,*) ' -valve 8 ', data%state%manifold%Valve(8)%Status + WRITE (*,*) ' -valve 9 ', data%state%manifold%Valve(9)%Status + WRITE (*,*) ' -valve 13 ', data%state%manifold%Valve(13)%Status + WRITE (*,*) ' -valve 68 ', data%state%manifold%Valve(68)%Status + WRITE (*,*) ' -valve 69 ', data%state%manifold%Valve(69)%Status + WRITE (*,*) ' -valve 48 ', data%state%manifold%Valve(48)%Status !call DisplayOpenPathsWrites() ENDIF @@ -1997,9 +1997,9 @@ use SimulationVariables !@ !!====================================================================== - IF (Manifold%Valve(65)%Status == .TRUE.) call Activate_Pump1PopOffValveBlown() !Pump1PopOffValveBlown= .TRUE. - IF (Manifold%Valve(66)%Status == .TRUE.) call Activate_Pump2PopOffValveBlown() ! Pump2PopOffValveBlown= .TRUE. - IF (Manifold%Valve(67)%Status == .TRUE.) call Activate_Pump3PopOffValveBlown() !Pump2PopOffValveBlown= .TRUE. + IF (data%state%manifold%Valve(65)%Status == .TRUE.) call Activate_Pump1PopOffValveBlown() !Pump1PopOffValveBlown= .TRUE. + IF (data%state%manifold%Valve(66)%Status == .TRUE.) call Activate_Pump2PopOffValveBlown() ! Pump2PopOffValveBlown= .TRUE. + IF (data%state%manifold%Valve(67)%Status == .TRUE.) call Activate_Pump3PopOffValveBlown() !Pump2PopOffValveBlown= .TRUE. IF (data%State%MudSystem%ActiveTankVolume >= (data%Configuration%Mud%ActiveTotalTankCapacityGal-data%Configuration%Mud%ActiveSettledContentsGal)) THEN @@ -2040,9 +2040,9 @@ use SimulationVariables !@ data%State%MudSystem%GraphTotalStrokes=data%State%MudSystem%GraphTotalStrokes+((data%Equipments%DataDisplayConsole%MP1SPMGauge)/60.)*data%State%MudSystem%DeltaT_Mudline+((data%Equipments%DataDisplayConsole%MP2SPMGauge)/60.)*data%State%MudSystem%DeltaT_Mudline - data%State%MPumps%Total_Stroke_Counter_For_Plot = data%State%MPumps%Total_Stroke_Counter_For_Plot + ((data%Equipments%DataDisplayConsole%MP1SPMGauge + data%Equipments%DataDisplayConsole%MP2SPMGauge) / 60.0) * data%State%MudSystem%DeltaT_Mudline + data%Equipments%MPumps%Total_Stroke_Counter_For_Plot = data%Equipments%MPumps%Total_Stroke_Counter_For_Plot + ((data%Equipments%DataDisplayConsole%MP1SPMGauge + data%Equipments%DataDisplayConsole%MP2SPMGauge) / 60.0) * data%State%MudSystem%DeltaT_Mudline -! CALL SetTotalStrokes(INT(data%State%MPumps%Total_Stroke_Counter_For_Plot)) +! CALL SetTotalStrokes(INT(data%Equipments%MPumps%Total_Stroke_Counter_For_Plot)) data%Equipments%DataDisplayConsole%TotalStrokeCounter= real(nint(data%State%MudSystem%TotalStrokesPump1+data%State%MudSystem%TotalStrokesPump2)) !for drilling data display @@ -2807,7 +2807,7 @@ use SimulationVariables !@ !============BellNippleToPits-FullWell(MLnumber=3)============== - if ( Manifold%Valve(41)%Status == .false. .and. Manifold%Valve(42)%Status == .false. ) then + if ( data%state%manifold%Valve(41)%Status == .false. .and. data%state%manifold%Valve(42)%Status == .false. ) then call ChangeValve(60, .TRUE.) else call ChangeValve(60, .FALSE.) diff --git a/Equipments/MudSystem/MudSystemStartup.f90 b/Equipments/MudSystem/MudSystemStartup.f90 index f67d479..86c46be 100644 --- a/Equipments/MudSystem/MudSystemStartup.f90 +++ b/Equipments/MudSystem/MudSystemStartup.f90 @@ -32,7 +32,7 @@ data%State%MudSystem%AnnCapOld=0. data%State%MudSystem%DeltaAnnCap=0. -data%State%MPumps%Total_Stroke_Counter_For_Plot = 0.0 +data%Equipments%MPumps%Total_Stroke_Counter_For_Plot = 0.0 data%State%MudSystem%DeltaT_Mudline=0.1 !second @@ -83,7 +83,7 @@ data%State%MudSystem%FluidFlowCounter = 0 !KickVolumeinAnnulus= 0.0 data%State%MudSystem%KickDeltaVinAnnulus= 0.0 - KickVARIABLES%GasKickPumpFlowRate= 0.0 + GasKickPumpFlowRate= 0.0 data%State%MudSystem%FirstMudSet= 0 data%State%MudSystem%FirstSetUtube1=0 @@ -137,7 +137,7 @@ use SimulationVariables !@ CALL MUDLINE_LOSS_INPUTS() -!data%State%MPumps%Total_Pump_GPM=10. ! Initial Value +!data%Equipments%MPumps%Total_Pump_GPM=10. ! Initial Value data%State%MUD%Q=0. ! Commented by mahmood @@ -148,7 +148,7 @@ use SimulationVariables !@ data%State%MudSystem%DeltaT_Mudline=0.1 !second - KickVARIABLES%GasKickPumpFlowRate= 0. + GasKickPumpFlowRate= 0. data%State%MudSystem%BellNippleVolume= 0. data%State%MudSystem%BellNippleDensity= 0. data%State%MudSystem%MudBucketVolume= 0. diff --git a/Equipments/MudSystem/MudSystemStartup.i90 b/Equipments/MudSystem/MudSystemStartup.i90 index 173b04e..0b4b34e 100644 --- a/Equipments/MudSystem/MudSystemStartup.i90 +++ b/Equipments/MudSystem/MudSystemStartup.i90 @@ -33,7 +33,7 @@ data%State%MudSystem%AnnCapOld=0. data%State%MudSystem%DeltaAnnCap=0. -data%State%MPumps%Total_Stroke_Counter_For_Plot = 0.0 +data%Equipments%MPumps%Total_Stroke_Counter_For_Plot = 0.0 data%State%MudSystem%DeltaT_Mudline=0.1 !second @@ -84,7 +84,7 @@ data%State%MudSystem%FluidFlowCounter = 0 !KickVolumeinAnnulus= 0.0 data%State%MudSystem%KickDeltaVinAnnulus= 0.0 - KickVARIABLES%GasKickPumpFlowRate= 0.0 + GasKickPumpFlowRate= 0.0 data%State%MudSystem%FirstMudSet= 0 data%State%MudSystem%FirstSetUtube1=0 @@ -138,7 +138,7 @@ use SimulationVariables !@ CALL MUDLINE_LOSS_INPUTS() -!data%State%MPumps%Total_Pump_GPM=10. ! Initial Value +!data%Equipments%MPumps%Total_Pump_GPM=10. ! Initial Value data%State%MUD%Q=0. ! Commented by mahmood @@ -149,7 +149,7 @@ use SimulationVariables !@ data%State%MudSystem%DeltaT_Mudline=0.1 !second - KickVARIABLES%GasKickPumpFlowRate= 0. + GasKickPumpFlowRate= 0. data%State%MudSystem%BellNippleVolume= 0. data%State%MudSystem%BellNippleDensity= 0. data%State%MudSystem%MudBucketVolume= 0. diff --git a/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 b/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 index c61c17d..a3f5d19 100644 --- a/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 +++ b/Equipments/MudSystem/Plot_Final_Mud_Elements.f90 @@ -187,9 +187,9 @@ endif data%State%MudSystem%TDNoCasingMudElements= data%State%MudSystem%NoCasingMudElements - data%State%MudSystem%TDXstart_MudElementArray(:) = data%State%MudSystem%Xstart_MudElement%Array(:) - data%State%MudSystem%TDXend_MudElementArray(:) = data%State%MudSystem%Xend_MudElement%Array(:) - data%State%MudSystem%TDDensity_MudElementArray(:) = data%State%MudSystem%Density_MudElement%Array(:) + data%State%MudSystem%TDXstart_MudElementArray(:) = data%State%MudSystem%Xstart_MudElement%Array(:) + data%State%MudSystem%TDXend_MudElementArray(:) = data%State%MudSystem%Xend_MudElement%Array(:) + data%State%MudSystem%TDDensity_MudElementArray(:) = data%State%MudSystem%Density_MudElement%Array(:) !===================================================================== @@ -265,7 +265,7 @@ endif !============================ UTUBE ============================= !IF (UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadIsOpen) THEN - IF (data%State%MudSystem%UtubePossibility== .true. .and. data%State%TD_StConn%FluidStringConnectionMode==0 .and. data%State%MudSystem%WellHeadIsOpen .AND. KickVARIABLES%NoGasPocket == 0) THEN + IF (data%State%MudSystem%UtubePossibility== .true. .and. data%State%TD_StConn%FluidStringConnectionMode==0 .and. data%State%MudSystem%WellHeadIsOpen .AND. NoGasPocket == 0) THEN CALL WellPressureDataTransfer !WRITE (*,*) ' U-Tube Done 1' CALL Utube diff --git a/Equipments/MudSystem/Plot_Final_Mud_Elements.i90 b/Equipments/MudSystem/Plot_Final_Mud_Elements.i90 index 2f9da21..9a52dd3 100644 --- a/Equipments/MudSystem/Plot_Final_Mud_Elements.i90 +++ b/Equipments/MudSystem/Plot_Final_Mud_Elements.i90 @@ -188,9 +188,9 @@ endif data%State%MudSystem%TDNoCasingMudElements= data%State%MudSystem%NoCasingMudElements - data%State%MudSystem%TDXstart_MudElementArray(:) = data%State%MudSystem%Xstart_MudElement%Array(:) - data%State%MudSystem%TDXend_MudElementArray(:) = data%State%MudSystem%Xend_MudElement%Array(:) - data%State%MudSystem%TDDensity_MudElementArray(:) = data%State%MudSystem%Density_MudElement%Array(:) + data%State%MudSystem%TDXstart_MudElementArray(:) = data%State%MudSystem%Xstart_MudElement%Array(:) + data%State%MudSystem%TDXend_MudElementArray(:) = data%State%MudSystem%Xend_MudElement%Array(:) + data%State%MudSystem%TDDensity_MudElementArray(:) = data%State%MudSystem%Density_MudElement%Array(:) !===================================================================== @@ -266,7 +266,7 @@ endif !============================ UTUBE ============================= !IF (UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadIsOpen) THEN - IF (data%State%MudSystem%UtubePossibility== .true. .and. data%State%TD_StConn%FluidStringConnectionMode==0 .and. data%State%MudSystem%WellHeadIsOpen .AND. KickVARIABLES%NoGasPocket == 0) THEN + IF (data%State%MudSystem%UtubePossibility== .true. .and. data%State%TD_StConn%FluidStringConnectionMode==0 .and. data%State%MudSystem%WellHeadIsOpen .AND. NoGasPocket == 0) THEN CALL WellPressureDataTransfer !WRITE (*,*) ' U-Tube Done 1' CALL Utube diff --git a/Equipments/MudSystem/Pump_and_Trip_In.f90 b/Equipments/MudSystem/Pump_and_Trip_In.f90 index 2da2e89..8e08a35 100644 --- a/Equipments/MudSystem/Pump_and_Trip_In.f90 +++ b/Equipments/MudSystem/Pump_and_Trip_In.f90 @@ -416,7 +416,7 @@ imud=0 if ( data%State%MudSystem%MudVolume_InjectedToBH > 0.0 ) then - if (KickVARIABLES%KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the + if (KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the AddLocation= data%State%MudSystem%Op_Density%Length()-data%State%MudSystem%iLoc+1+1 ! well, thus pumped mud should be placed above the kick else AddLocation= data%State%MudSystem%Op_Density%Length()+1 diff --git a/Equipments/MudSystem/Pump_and_Trip_In.i90 b/Equipments/MudSystem/Pump_and_Trip_In.i90 index f61f03a..b972cc8 100644 --- a/Equipments/MudSystem/Pump_and_Trip_In.i90 +++ b/Equipments/MudSystem/Pump_and_Trip_In.i90 @@ -417,7 +417,7 @@ imud=0 if ( data%State%MudSystem%MudVolume_InjectedToBH > 0.0 ) then - if (KickVARIABLES%KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the + if (KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the AddLocation= data%State%MudSystem%Op_Density%Length()-data%State%MudSystem%iLoc+1+1 ! well, thus pumped mud should be placed above the kick else AddLocation= data%State%MudSystem%Op_Density%Length()+1 diff --git a/Equipments/MudSystem/Trip_Out_andPump.f90 b/Equipments/MudSystem/Trip_Out_andPump.f90 index 55480db..e9adc0f 100644 --- a/Equipments/MudSystem/Trip_Out_andPump.f90 +++ b/Equipments/MudSystem/Trip_Out_andPump.f90 @@ -433,7 +433,7 @@ imud=0 if ( data%State%MudSystem%MudVolume_InjectedToBH > 0.0 ) then - if (KickVARIABLES%KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the + if (KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the AddLocation= data%State%MudSystem%Op_Density%Length()-data%State%MudSystem%iLoc+1+1 ! well, thus pumped mud should be placed above the kick else AddLocation= data%State%MudSystem%Op_Density%Length()+1 diff --git a/Equipments/MudSystem/Trip_Out_andPump.i90 b/Equipments/MudSystem/Trip_Out_andPump.i90 index e13f43c..37bd171 100644 --- a/Equipments/MudSystem/Trip_Out_andPump.i90 +++ b/Equipments/MudSystem/Trip_Out_andPump.i90 @@ -434,7 +434,7 @@ imud=0 if ( data%State%MudSystem%MudVolume_InjectedToBH > 0.0 ) then - if (KickVARIABLES%KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the + if (KickOffBottom) then ! (kickOffBottom = F) means kick is next to the bottom hole and usually kick is entering the AddLocation= data%State%MudSystem%Op_Density%Length()-data%State%MudSystem%iLoc+1+1 ! well, thus pumped mud should be placed above the kick else AddLocation= data%State%MudSystem%Op_Density%Length()+1 diff --git a/Equipments/MudSystem/Utube1_and_Trip_In.f90 b/Equipments/MudSystem/Utube1_and_Trip_In.f90 index 7ef5b64..2ccb28c 100644 --- a/Equipments/MudSystem/Utube1_and_Trip_In.f90 +++ b/Equipments/MudSystem/Utube1_and_Trip_In.f90 @@ -260,7 +260,7 @@ imud=0 !============================= Bottom Hole ============================== - !Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux + !Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux imud=0 do while (imud < data%State%MudSystem%Op_Mud_Forehead_X%Length()) imud = imud + 1 diff --git a/Equipments/MudSystem/Utube1_and_Trip_In.i90 b/Equipments/MudSystem/Utube1_and_Trip_In.i90 index 5a0540e..e9f6b20 100644 --- a/Equipments/MudSystem/Utube1_and_Trip_In.i90 +++ b/Equipments/MudSystem/Utube1_and_Trip_In.i90 @@ -261,7 +261,7 @@ imud=0 !============================= Bottom Hole ============================== -!Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux +!Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux imud=0 do while (imud < data%State%MudSystem%Op_Mud_Forehead_X%Length()) imud = imud + 1 diff --git a/Equipments/MudSystem/Utube2_and_Trip_In.f90 b/Equipments/MudSystem/Utube2_and_Trip_In.f90 index 8bcbc2d..02a2354 100644 --- a/Equipments/MudSystem/Utube2_and_Trip_In.f90 +++ b/Equipments/MudSystem/Utube2_and_Trip_In.f90 @@ -272,7 +272,7 @@ imud= data%State%MudSystem%Ann_Mud_Forehead_X%Length() + 1 !============================= Bottom Hole ============================== - !Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux + !Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux imud=0 do while (imud < data%State%MudSystem%Op_Mud_Forehead_X%Length()) imud = imud + 1 diff --git a/Equipments/MudSystem/Utube2_and_Trip_In.i90 b/Equipments/MudSystem/Utube2_and_Trip_In.i90 index 18a17ad..bacfc4d 100644 --- a/Equipments/MudSystem/Utube2_and_Trip_In.i90 +++ b/Equipments/MudSystem/Utube2_and_Trip_In.i90 @@ -273,7 +273,7 @@ imud= data%State%MudSystem%Ann_Mud_Forehead_X%Length() + 1 !============================= Bottom Hole ============================== -!Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((KickVARIABLES%GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux +!Op_MudDischarged_Volume%Array(1)= Op_MudDischarged_Volume%Array(1)+ ((GasKickPumpFlowRate/60.)*DeltaT_Mudline) !(gal) due to KickFlux imud=0 do while (imud < data%State%MudSystem%Op_Mud_Forehead_X%Length()) imud = imud + 1 diff --git a/Equipments/Pumps/Pump1_MainSolver.f90 b/Equipments/Pumps/Pump1_MainSolver.f90 index 8dd7a83..e69de29 100644 --- a/Equipments/Pumps/Pump1_MainSolver.f90 +++ b/Equipments/Pumps/Pump1_MainSolver.f90 @@ -1,57 +0,0 @@ -subroutine Pump1_MainSolver - - use SimulationVariables - - Implicit none - - - - - if (data%State%Pump(1)%Throttle<=0.d0) then - data%State%Pump(1)%K_throttle = 1 - end if - - - if((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%K_throttle==1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then - - data%State%Pump(1)%SoundBlower = .true. - data%State%Pump(1)%BLWR = 1 - - !========================== Pump 1 Rate limit ========================== - if (((data%State%Pump(1)%N_new-data%State%Pump(1)%N_old)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then - data%State%Pump(1)%Speed =(data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old ![RPM] - else if (((data%State%Pump(1)%N_old-data%State%Pump(1)%N_new)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then - data%State%Pump(1)%Speed = (-data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old - else - data%State%Pump(1)%Speed = data%State%Pump(1)%N_new - end if - !======================================================================= - - Call Pump_OnMode_Solver(1) - - else - - if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1)) then - data%State%Pump(1)%SoundBlower = .true. - else - data%State%Pump(1)%SoundBlower = .false. - end if - - if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then - data%State%Pump(1)%BLWR = 1 - else - data%State%Pump(1)%BLWR = 0 - end if - - - Call Pump_OffMode_Solver(1) - data%State%Pump(1)%K_throttle = 0 - - end if - - - data%State%Pump(1)%N_old = data%State%Pump(1)%Speed - - - -end subroutine Pump1_MainSolver \ No newline at end of file diff --git a/Equipments/Pumps/Pump1_MainSolver.i90 b/Equipments/Pumps/Pump1_MainSolver.i90 index 325fea5..62c5fb9 100644 --- a/Equipments/Pumps/Pump1_MainSolver.i90 +++ b/Equipments/Pumps/Pump1_MainSolver.i90 @@ -1,58 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump1_MainSolver.f90" -subroutine Pump1_MainSolver - - use SimulationVariables - - Implicit none - - - - - if (data%State%Pump(1)%Throttle<=0.d0) then - data%State%Pump(1)%K_throttle = 1 - end if - - - if((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%K_throttle==1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then - - data%State%Pump(1)%SoundBlower = .true. - data%State%Pump(1)%BLWR = 1 - -!========================== Pump 1 Rate limit ========================== - if (((data%State%Pump(1)%N_new-data%State%Pump(1)%N_old)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then - data%State%Pump(1)%Speed =(data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old ![RPM] - else if (((data%State%Pump(1)%N_old-data%State%Pump(1)%N_new)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then - data%State%Pump(1)%Speed = (-data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old - else - data%State%Pump(1)%Speed = data%State%Pump(1)%N_new - end if -!======================================================================= - - Call Pump_OnMode_Solver(1) - - else - - if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1)) then - data%State%Pump(1)%SoundBlower = .true. - else - data%State%Pump(1)%SoundBlower = .false. - end if - - if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then - data%State%Pump(1)%BLWR = 1 - else - data%State%Pump(1)%BLWR = 0 - end if - - - Call Pump_OffMode_Solver(1) - data%State%Pump(1)%K_throttle = 0 - - end if - - - data%State%Pump(1)%N_old = data%State%Pump(1)%Speed - - - -end subroutine Pump1_MainSolver diff --git a/Equipments/Pumps/Pump2_MainSolver.f90 b/Equipments/Pumps/Pump2_MainSolver.f90 index 0a8c3a7..e69de29 100644 --- a/Equipments/Pumps/Pump2_MainSolver.f90 +++ b/Equipments/Pumps/Pump2_MainSolver.f90 @@ -1,57 +0,0 @@ -subroutine Pump2_MainSolver - - use SimulationVariables - - Implicit none - - - - - if (data%State%Pump(2)%Throttle<=0.d0) then - data%State%Pump(2)%K_throttle = 1 - end if - - - if((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%K_throttle==1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then - - data%State%Pump(2)%SoundBlower = .true. - data%State%Pump(2)%BLWR = 1 - - !========================== Pump 2 Rate limit ========================== - if (((data%State%Pump(2)%N_new-data%State%Pump(2)%N_old)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then - data%State%Pump(2)%Speed =(data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old ![RPM] - else if (((data%State%Pump(2)%N_old-data%State%Pump(2)%N_new)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then - data%State%Pump(2)%Speed = (-data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old - else - data%State%Pump(2)%Speed = data%State%Pump(2)%N_new - end if - !======================================================================= - - Call Pump_OnMode_Solver(2) - - else - - if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1)) then - data%State%Pump(2)%SoundBlower = .true. - else - data%State%Pump(2)%SoundBlower = .false. - end if - - if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then - data%State%Pump(2)%BLWR = 1 - else - data%State%Pump(2)%BLWR = 0 - end if - - - Call Pump_OffMode_Solver(2) - data%State%Pump(2)%K_throttle = 0 - - end if - - - data%State%Pump(2)%N_old = data%State%Pump(2)%Speed - - - -end subroutine Pump2_MainSolver \ No newline at end of file diff --git a/Equipments/Pumps/Pump2_MainSolver.i90 b/Equipments/Pumps/Pump2_MainSolver.i90 new file mode 100644 index 0000000..6dd3e86 --- /dev/null +++ b/Equipments/Pumps/Pump2_MainSolver.i90 @@ -0,0 +1 @@ +# 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump2_MainSolver.f90" diff --git a/Equipments/Pumps/Pump3_MainSolver.f90 b/Equipments/Pumps/Pump3_MainSolver.f90 index 31275ca..e69de29 100644 --- a/Equipments/Pumps/Pump3_MainSolver.f90 +++ b/Equipments/Pumps/Pump3_MainSolver.f90 @@ -1,41 +0,0 @@ -subroutine Pump3_MainSolver - - use SimulationVariables - - Implicit none - - - - - if (data%State%Pump(3)%Throttle<=0.d0) then - data%State%Pump(3)%K_throttle = 1 - end if - - - if((data%State%Pump(3)%Switch==1) .and. (data%State%Pump(3)%K_throttle==1) .and. (data%State%Pump(3)%PowerFailMalf==0) .and. (data%State%Pump(3)%Failure==0)) then - - !========================== Pump 3 Rate limit ========================== - if (((data%State%Pump(3)%N_new-data%State%Pump(3)%N_old)/data%State%Pump(3)%time_step)>data%State%Pump(3)%RateChange) then - data%State%Pump(3)%Speed =(data%State%Pump(3)%RateChange*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old ![RPM] - else if (((data%State%Pump(3)%N_old-data%State%Pump(3)%N_new)/data%State%Pump(3)%time_step)>data%State%Pump(3)%RateChange) then - data%State%Pump(3)%Speed = (-data%State%Pump(3)%RateChange*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old - else - data%State%Pump(3)%Speed = data%State%Pump(3)%N_new - end if - !======================================================================= - - Call Pump_OnMode_Solver(3) - - else - - Call Pump_OffMode_Solver(3) - data%State%Pump(3)%K_throttle = 0 - - end if - - - data%State%Pump(3)%N_old = data%State%Pump(3)%Speed - - - -end subroutine Pump3_MainSolver \ No newline at end of file diff --git a/Equipments/Pumps/Pump3_MainSolver.i90 b/Equipments/Pumps/Pump3_MainSolver.i90 new file mode 100644 index 0000000..3baf40c --- /dev/null +++ b/Equipments/Pumps/Pump3_MainSolver.i90 @@ -0,0 +1 @@ +# 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump3_MainSolver.f90" diff --git a/Equipments/Pumps/Pump_OffMode_Solver.f90 b/Equipments/Pumps/Pump_OffMode_Solver.f90 index b48dee1..e69de29 100644 --- a/Equipments/Pumps/Pump_OffMode_Solver.f90 +++ b/Equipments/Pumps/Pump_OffMode_Solver.f90 @@ -1,46 +0,0 @@ -subroutine Pump_OffMode_Solver(Pump_No) - - use SimulationVariables - - IMPLICIT NONE - INTEGER :: Pump_No - - - - data%State%Pump(Pump_No)%N_new = 0.d0 - - !========================== Pump Rate limit ========================== - if (((data%State%Pump(Pump_No)%N_new-data%State%Pump(Pump_No)%N_old)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then - data%State%Pump(Pump_No)%Speed =(data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old - else if (((data%State%Pump(Pump_No)%N_old-data%State%Pump(Pump_No)%N_new)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then - data%State%Pump(Pump_No)%Speed = (-data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old - else - data%State%Pump(Pump_No)%Speed = data%State%Pump(Pump_No)%N_new - end if - !======================================================================= - - - data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] - data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] - !data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] - data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) - if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad - !if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then - data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] - data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] - end if - - data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] - - If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then - data%State%Pump(Pump_No)%Open_Close = 1 - Else - data%State%Pump(Pump_No)%Open_Close = 0 - End if - - - - - - -end subroutine Pump_OffMode_Solver \ No newline at end of file diff --git a/Equipments/Pumps/Pump_OffMode_Solver.i90 b/Equipments/Pumps/Pump_OffMode_Solver.i90 index 70dc923..8326eb0 100644 --- a/Equipments/Pumps/Pump_OffMode_Solver.i90 +++ b/Equipments/Pumps/Pump_OffMode_Solver.i90 @@ -1,47 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump_OffMode_Solver.f90" -subroutine Pump_OffMode_Solver(Pump_No) - - use SimulationVariables - - IMPLICIT NONE - INTEGER :: Pump_No - - - - data%State%Pump(Pump_No)%N_new = 0.d0 - -!========================== Pump Rate limit ========================== - if (((data%State%Pump(Pump_No)%N_new-data%State%Pump(Pump_No)%N_old)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then - data%State%Pump(Pump_No)%Speed =(data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old - else if (((data%State%Pump(Pump_No)%N_old-data%State%Pump(Pump_No)%N_new)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then - data%State%Pump(Pump_No)%Speed = (-data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old - else - data%State%Pump(Pump_No)%Speed = data%State%Pump(Pump_No)%N_new - end if -!======================================================================= - - - data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] - data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] -!data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] - data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) - if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad -!if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then - data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] - data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] - end if - - data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] - - If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then - data%State%Pump(Pump_No)%Open_Close = 1 - Else - data%State%Pump(Pump_No)%Open_Close = 0 - End if - - - - - - -end subroutine Pump_OffMode_Solver diff --git a/Equipments/Pumps/Pump_OnMode_Solver.f90 b/Equipments/Pumps/Pump_OnMode_Solver.f90 index 4a5af95..e69de29 100644 --- a/Equipments/Pumps/Pump_OnMode_Solver.f90 +++ b/Equipments/Pumps/Pump_OnMode_Solver.f90 @@ -1,33 +0,0 @@ -subroutine Pump_OnMode_Solver(Pump_No) - - use SimulationVariables - - IMPLICIT NONE - INTEGER :: Pump_No - - - - data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] - data%State%Pump(Pump_No)%Max_FlowRate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*data%State%Pump(Pump_No)%MaxSPM ![gpm] - data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] - !data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] - data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) - if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad - !if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then - data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] - data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] - end if - - data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] ![spm] - - If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then - data%State%Pump(Pump_No)%Open_Close = 1 - Else - data%State%Pump(Pump_No)%Open_Close = 0 - End if - - - - - -end subroutine Pump_OnMode_Solver \ No newline at end of file diff --git a/Equipments/Pumps/Pump_OnMode_Solver.i90 b/Equipments/Pumps/Pump_OnMode_Solver.i90 index bdde4cf..9af5223 100644 --- a/Equipments/Pumps/Pump_OnMode_Solver.i90 +++ b/Equipments/Pumps/Pump_OnMode_Solver.i90 @@ -1,34 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump_OnMode_Solver.f90" -subroutine Pump_OnMode_Solver(Pump_No) - - use SimulationVariables - - IMPLICIT NONE - INTEGER :: Pump_No - - - - data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] - data%State%Pump(Pump_No)%Max_FlowRate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*data%State%Pump(Pump_No)%MaxSPM ![gpm] - data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] -!data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] - data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) -! if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad -! !if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then -! data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] -! data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] -! end if - - data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] ![spm] - - If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then - data%State%Pump(Pump_No)%Open_Close = 1 - Else - data%State%Pump(Pump_No)%Open_Close = 0 - End if - - - - - -end subroutine Pump_OnMode_Solver diff --git a/Equipments/Pumps/PumpsMain.f90 b/Equipments/Pumps/PumpsMain.f90 index a364c3c..4462d5c 100644 --- a/Equipments/Pumps/PumpsMain.f90 +++ b/Equipments/Pumps/PumpsMain.f90 @@ -24,6 +24,572 @@ module PumpsMain Call Pump1_MainSolver end subroutine Pump1_Step + subroutine Pumps_MainSolver + + use SimulationVariables + + Implicit none + + Call DrillingConsole_ScrLEDs !koja bezaramesh????? + Call Pumps_Inputs + Call Pump1_MainSolver + Call Pump2_MainSolver + Call Pump3_MainSolver + Call Pumps_TotalSolver + Call Pumps_Outputs + + end subroutine Pumps_MainSolver + + subroutine Pumps_Inputs + + use CDrillingConsoleVariables + use SimulationVariables + Use MudSystemModule + + IMPLICIT NONE + + + + !>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + !data%State%Pump(1)%BlowPopOffMalf = 0 !??????? motaghayere voroudi + + if ( data%State%Pump(1)%BlowPopOffMalf==1 ) then ! Pump1 Malfunction ----> Blow Pop-offs (Relief Valves) + data%State%Pump(1)%StandPipe_Pressure = 0.d0 + else + data%State%Pump(1)%StandPipe_Pressure = PumpPressure1 ![psi] + if ( data%State%Pump(1)%StandPipe_Pressure<=14.d0 ) then + data%State%Pump(1)%StandPipe_Pressure = 14.d0 + end if + end if + + data%State%Pump(1)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch + + data%State%Pump(1)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch + + data%State%Pump(1)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad + + data%State%Pump(1)%Failure = data%Warnings%Pump1Failure !(Pump1 Warning ----> Failure) + + data%State%Pump(1)%N_new = data%State%Pump(1)%Throttle + + + + + + + + !>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + !data%State%Pump(2)%BlowPopOffMalf = 0 !??????? motaghayere voroudi + + if ( data%State%Pump(2)%BlowPopOffMalf==1 ) then ! Pump2 Malfunction ----> Blow Pop-offs (Relief Valves) + data%State%Pump(2)%StandPipe_Pressure = 0.d0 + else + data%State%Pump(2)%StandPipe_Pressure = PumpPressure2 ![psi] + if ( data%State%Pump(2)%StandPipe_Pressure<=14.d0 ) then + data%State%Pump(2)%StandPipe_Pressure = 14.d0 + end if + end if + + data%State%Pump(2)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch + + data%State%Pump(2)%Switch = data%Equipments%DrillingConsole%MP2Switch + + data%State%Pump(2)%Throttle = data%Equipments%DrillingConsole%MP2Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad + + data%State%Pump(2)%Failure = data%Warnings%Pump2Failure !(Pump2 Warning ----> Failure) + + data%State%Pump(2)%N_new = data%State%Pump(2)%Throttle + + !!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + !data%State%Pump(3)%BlowPopOffMalf = 0 !??????? motaghayere voroudi + + if ( data%State%Pump(3)%BlowPopOffMalf==1 ) then ! Pump3 Malfunction ----> Blow Pop-offs (Relief Valves) + data%State%Pump(3)%StandPipe_Pressure = 0.d0 + else + data%State%Pump(3)%StandPipe_Pressure = PumpPressure3 ![psi] + if ( data%State%Pump(3)%StandPipe_Pressure<=14.d0 ) then + data%State%Pump(3)%StandPipe_Pressure = 14.d0 + end if + end if + + data%State%Pump(3)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch + + data%State%Pump(3)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad + + data%State%Pump(3)%Failure = data%Warnings%Pump3Failure !(Pump1 Warning ----> Failure) + + data%State%Pump(3)%N_new = data%State%Pump(3)%Throttle + + !>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< + + end subroutine Pumps_Inputs + + subroutine DrillingConsole_ScrLEDs + + use CDrillingConsoleVariables + use SimulationVariables + use SimulationVariables + use SimulationVariables !@ + + IMPLICIT NONE + + + + !===> Torque Limit + data%Equipments%DrillingConsole%RTTorqueLimitGauge = sngl(1-data%State%RTable%TorqueLimitGaugeMalf)*(data%Equipments%DrillingConsole%RTTorqueLimitKnob/10.d0)*7000.d0 !tabdile bazeye 0-10 be 0-7000 taghribi anjam shode, baadan eslah shavad ?????? + + + + + + if((any(data%Equipments%DrillingConsole%AssignmentSwitch==(/1,2,3,4,8,9,10,11/)))) then + + data%Equipments%DrillingConsole%SCR1LED=1 + data%Equipments%DrillingConsole%SCR2LED=1 + data%Equipments%DrillingConsole%SCR3LED=1 + data%Equipments%DrillingConsole%SCR4LED=1 + + else if (data%Equipments%DrillingConsole%AssignmentSwitch == 5) then + + data%Equipments%DrillingConsole%SCR1LED=1 + data%Equipments%DrillingConsole%SCR2LED=1 + data%Equipments%DrillingConsole%SCR3LED=0 + data%Equipments%DrillingConsole%SCR4LED=1 + + else if (data%Equipments%DrillingConsole%AssignmentSwitch == 7) then + + data%Equipments%DrillingConsole%SCR1LED=1 + data%Equipments%DrillingConsole%SCR2LED=1 + data%Equipments%DrillingConsole%SCR3LED=1 + data%Equipments%DrillingConsole%SCR4LED=0 + + else + data%Equipments%DrillingConsole%SCR1LED=0 + data%Equipments%DrillingConsole%SCR2LED=0 + data%Equipments%DrillingConsole%SCR3LED=0 + data%Equipments%DrillingConsole%SCR4LED=0 + + end if + + + + + end subroutine DrillingConsole_ScrLEDs + + subroutine Pump1_MainSolver + + use SimulationVariables + + Implicit none + + + + + if (data%State%Pump(1)%Throttle<=0.d0) then + data%State%Pump(1)%K_throttle = 1 + end if + + + if((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%K_throttle==1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then + + data%State%Pump(1)%SoundBlower = .true. + data%State%Pump(1)%BLWR = 1 + + !========================== Pump 1 Rate limit ========================== + if (((data%State%Pump(1)%N_new-data%State%Pump(1)%N_old)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then + data%State%Pump(1)%Speed =(data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old ![RPM] + else if (((data%State%Pump(1)%N_old-data%State%Pump(1)%N_new)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then + data%State%Pump(1)%Speed = (-data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old + else + data%State%Pump(1)%Speed = data%State%Pump(1)%N_new + end if + !======================================================================= + + Call Pump_OnMode_Solver(1) + + else + + if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1)) then + data%State%Pump(1)%SoundBlower = .true. + else + data%State%Pump(1)%SoundBlower = .false. + end if + + if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then + data%State%Pump(1)%BLWR = 1 + else + data%State%Pump(1)%BLWR = 0 + end if + + + Call Pump_OffMode_Solver(1) + data%State%Pump(1)%K_throttle = 0 + + end if + + + data%State%Pump(1)%N_old = data%State%Pump(1)%Speed + + + + end subroutine Pump1_MainSolver + + subroutine Pump2_MainSolver + + use SimulationVariables + + Implicit none + + + + + if (data%State%Pump(2)%Throttle<=0.d0) then + data%State%Pump(2)%K_throttle = 1 + end if + + + if((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%K_throttle==1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then + + data%State%Pump(2)%SoundBlower = .true. + data%State%Pump(2)%BLWR = 1 + + !========================== Pump 2 Rate limit ========================== + if (((data%State%Pump(2)%N_new-data%State%Pump(2)%N_old)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then + data%State%Pump(2)%Speed =(data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old ![RPM] + else if (((data%State%Pump(2)%N_old-data%State%Pump(2)%N_new)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then + data%State%Pump(2)%Speed = (-data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old + else + data%State%Pump(2)%Speed = data%State%Pump(2)%N_new + end if + !======================================================================= + + Call Pump_OnMode_Solver(2) + + else + + if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1)) then + data%State%Pump(2)%SoundBlower = .true. + else + data%State%Pump(2)%SoundBlower = .false. + end if + + if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then + data%State%Pump(2)%BLWR = 1 + else + data%State%Pump(2)%BLWR = 0 + end if + + + Call Pump_OffMode_Solver(2) + data%State%Pump(2)%K_throttle = 0 + + end if + + + data%State%Pump(2)%N_old = data%State%Pump(2)%Speed + + + + end subroutine Pump2_MainSolver + + subroutine Pump3_MainSolver + + use SimulationVariables + + Implicit none + + + + + if (data%State%Pump(3)%Throttle<=0.d0) then + data%State%Pump(3)%K_throttle = 1 + end if + + + if((data%State%Pump(3)%Switch==1) .and. (data%State%Pump(3)%K_throttle==1) .and. (data%State%Pump(3)%PowerFailMalf==0) .and. (data%State%Pump(3)%Failure==0)) then + + !========================== Pump 3 Rate limit ========================== + if (((data%State%Pump(3)%N_new-data%State%Pump(3)%N_old)/data%State%Pump(3)%time_step)>data%State%Pump(3)%RateChange) then + data%State%Pump(3)%Speed =(data%State%Pump(3)%RateChange*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old ![RPM] + else if (((data%State%Pump(3)%N_old-data%State%Pump(3)%N_new)/data%State%Pump(3)%time_step)>data%State%Pump(3)%RateChange) then + data%State%Pump(3)%Speed = (-data%State%Pump(3)%RateChange*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old + else + data%State%Pump(3)%Speed = data%State%Pump(3)%N_new + end if + !======================================================================= + + Call Pump_OnMode_Solver(3) + + else + + Call Pump_OffMode_Solver(3) + data%State%Pump(3)%K_throttle = 0 + + end if + + + data%State%Pump(3)%N_old = data%State%Pump(3)%Speed + + + + end subroutine Pump3_MainSolver + + subroutine Pumps_TotalSolver + + use SimulationVariables + + Implicit none + + + + data%Equipments%MPumps%Total_Pump_Gpm = data%State%Pump(1)%Flow_Rate+data%State%Pump(2)%Flow_Rate+data%State%Pump(3)%Flow_Rate ![gpm] + data%Equipments%MPumps%Total_Pump_SPM = (data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio)+(data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio)+(data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio) ![stk/min] + + + + end subroutine Pumps_TotalSolver + + subroutine Pumps_Outputs + use CDataDisplayConsole + use SimulationVariables + Use MudSystemModule + Use CSounds + + IMPLICIT NONE + !>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + If (data%State%Pump(1)%Open_Close==1) then + Call OpenPump1() + Else if (data%State%Pump(1)%Open_Close==0) then + Call ClosePump1() + End if + + data%Equipments%DrillingConsole%MP1BLWR = data%State%Pump(1)%BLWR + + Call SetSoundBlowerMP1( data%State%Pump(1)%SoundBlower ) !.true. or .false. + Call SetSoundMP1( data%State%Pump(1)%SoundSPM ) ![SPM] , integer + + if ((data%State%Pump(1)%Switch==-1) .or. (data%State%Pump(1)%Switch==0)) then + Call Set_MP1SPMGauge( sngl(1-data%State%Pump(1)%SPMGaugeMalf)*real((data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio),8) ) ![spm] , real + data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge + end if + + !data%State%Pump(1)%Flow_Rate !to other modules , [gpm] + + + + + + + + !>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + If (data%State%Pump(2)%Open_Close==1) then + Call OpenPump2() + Else if (data%State%Pump(2)%Open_Close==0) then + Call ClosePump2() + End if + + data%Equipments%DrillingConsole%MP2BLWR = data%State%Pump(2)%BLWR + + Call SetSoundBlowerMP2( data%State%Pump(2)%SoundBlower ) + Call SetSoundMP2( data%State%Pump(2)%SoundSPM ) ![SPM] + + Call Set_MP2SPMGauge( sngl(1-data%State%Pump(2)%SPMGaugeMalf)*real((data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio),8) ) ![SPM] + data%Equipments%DrillingWatch%SPM2 = data%Equipments%DataDisplayConsole%MP2SPMGauge + + !data%State%Pump(2)%Flow_Rate !to other modules + + + + + + + !!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + If (data%State%Pump(3)%Open_Close==1) then + Call OpenCementPump() + Else if (data%State%Pump(3)%Open_Close==0) then + Call CloseCementPump() + End if + + Call SetSoundMP3( data%State%Pump(3)%SoundSPM ) + + if (data%State%Pump(3)%Switch==1) then + Call Set_MP1SPMGauge( real((data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio),8) ) ![SPM] SPMGaugeMalf Malf nadarad???? + data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge + end if + + !data%State%Pump(3)%Flow_Rate !to other modules + + + + !>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< + + !data%Equipments%MPumps%Total_Pump_Gpm = 100.d0 !??????????? + !data%Equipments%MPumps%Total_Pump_SPM = 1000.d0 !????????????? + + !SCR1LED=1 + !SCR2LED=1 + !SCR3LED=1 + !SCR4LED=1 + + + + + end subroutine Pumps_Outputs + + subroutine Pumps_StartUp + use CPumpsVariables + use CPumps + use SimulationVariables + IMPLICIT NONE + + + !>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%Pump(1)%FlowRatePerSTK = data%Configuration%Pumps%MudPump1VolumetricOutput !.1d0 ![bbl/stk] + data%State%Pump(1)%RateChange = data%Configuration%Pumps%MudPump1PumpRateChange ![stk/min2 ??] + data%State%Pump(1)%DelayToShutdown = data%Configuration%Pumps%MudPump1DelayToShutdown ![min] + data%State%Pump(1)%Mech_Efficiency = data%Configuration%Pumps%MudPump1MechanicalEfficiency ![dimensionless] + !data%State%Pump(1)%Vol_Efficiency = MudPump1VolumetricEfficiency !bayad hazf beshe ? + data%State%Pump(1)%Max_Pressure = data%Configuration%Pumps%MudPump1MaximumPressure !6000.d0 ![psi] + data%State%Pump(1)%MaxSPM = data%Configuration%Pumps%MudPump1Maximum ![spm] + data%State%Pump(1)%Trans_Ratio = 965.d0/data%State%Pump(1)%MaxSPM + data%State%Pump(1)%time_step = 0.1d0 !?????? niaz hast ya na?? + + data%State%Pump(1)%RateChange = (data%State%Pump(1)%RateChange*data%State%Pump(1)%Trans_Ratio)/60.d0 ![rpm/s ??] 24/60 + data%State%Pump(1)%DelayToShutdown = data%State%Pump(1)%DelayToShutdown/60.d0 ![s] + data%State%Pump(1)%K_throttle = 0 + data%State%Pump(1)%N_old = 0.d0 + Call Pump_OffMode_Solver(1) + + + !>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%Pump(2)%FlowRatePerSTK = data%Configuration%Pumps%MudPump2VolumetricOutput !.1d0 ![bbl/stk] + data%State%Pump(2)%RateChange = data%Configuration%Pumps%MudPump2PumpRateChange ![stk/min2 ??] + data%State%Pump(2)%DelayToShutdown = data%Configuration%Pumps%MudPump2DelayToShutdown ![min] + data%State%Pump(2)%Mech_Efficiency = data%Configuration%Pumps%MudPump2MechanicalEfficiency ![dimensionless] + !data%State%Pump(2)%Vol_Efficiency = MudPump2VolumetricEfficiency !bayad hazf beshe ? + data%State%Pump(2)%Max_Pressure = data%Configuration%Pumps%MudPump2MaximumPressure !6000.d0 ![psi] + data%State%Pump(2)%MaxSPM = data%Configuration%Pumps%MudPump2Maximum ![spm] + data%State%Pump(2)%Trans_Ratio = 965.d0/data%State%Pump(2)%MaxSPM + data%State%Pump(2)%time_step = 0.1d0 !?????? niaz hast ya na?? + + data%State%Pump(2)%RateChange = (data%State%Pump(2)%RateChange*data%State%Pump(2)%Trans_Ratio)/60.d0 ![rpm/s ??] + data%State%Pump(2)%DelayToShutdown = data%State%Pump(2)%DelayToShutdown/60.d0 ![s] + data%State%Pump(2)%K_throttle = 0 + data%State%Pump(2)%N_old = 0.d0 + Call Pump_OffMode_Solver(2) + + + !!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%Pump(3)%FlowRatePerSTK = data%Configuration%Pumps%CementPumpVolumetricOutput !.1d0 ![bbl/stk] + data%State%Pump(3)%RateChange = data%Configuration%Pumps%CementPumpPumpRateChange ![stk/min2 ??] + data%State%Pump(3)%DelayToShutdown = data%Configuration%Pumps%CementPumpDelayToShutdown ![min] + data%State%Pump(3)%Mech_Efficiency = data%Configuration%Pumps%CementPumpMechanicalEfficiency ![dimensionless] + !data%State%Pump(3)%Vol_Efficiency = CementPumpVolumetricEfficiency !bayad hazf beshe ? + data%State%Pump(3)%Max_Pressure = data%Configuration%Pumps%CementPumpMaximumPressure !6000.d0 ![psi] + data%State%Pump(3)%MaxSPM = data%Configuration%Pumps%CementPumpMaximum ![spm] + data%State%Pump(3)%Trans_Ratio = 965.d0/data%State%Pump(3)%MaxSPM + data%State%Pump(3)%time_step = 0.1d0 !?????? niaz hast ya na?? + + data%State%Pump(3)%RateChange = (data%State%Pump(3)%RateChange*data%State%Pump(3)%Trans_Ratio)/60.d0 ![rpm/s ??] + data%State%Pump(3)%DelayToShutdown = data%State%Pump(3)%DelayToShutdown/60.d0 ![s] + data%State%Pump(3)%K_throttle = 0 + data%State%Pump(3)%N_old = 0.d0 + Call Pump_OffMode_Solver(3) + + + end subroutine Pumps_StartUp + + subroutine Pump_OffMode_Solver(Pump_No) + + use SimulationVariables + + IMPLICIT NONE + INTEGER :: Pump_No + + + + data%State%Pump(Pump_No)%N_new = 0.d0 + + !========================== Pump Rate limit ========================== + if (((data%State%Pump(Pump_No)%N_new-data%State%Pump(Pump_No)%N_old)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then + data%State%Pump(Pump_No)%Speed =(data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old + else if (((data%State%Pump(Pump_No)%N_old-data%State%Pump(Pump_No)%N_new)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then + data%State%Pump(Pump_No)%Speed = (-data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old + else + data%State%Pump(Pump_No)%Speed = data%State%Pump(Pump_No)%N_new + end if + !======================================================================= + + + data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] + data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] + !data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] + data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) + if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad + !if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then + data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] + data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] + end if + + data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] + + If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then + data%State%Pump(Pump_No)%Open_Close = 1 + Else + data%State%Pump(Pump_No)%Open_Close = 0 + End if + + + + + + + end subroutine Pump_OffMode_Solver + + subroutine Pump_OnMode_Solver(Pump_No) + + use SimulationVariables + + IMPLICIT NONE + INTEGER :: Pump_No + + + + data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] + data%State%Pump(Pump_No)%Max_FlowRate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*data%State%Pump(Pump_No)%MaxSPM ![gpm] + data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] + !data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] + data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) + if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad + !if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then + data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] + data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] + end if + + data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] ![spm] + + If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then + data%State%Pump(Pump_No)%Open_Close = 1 + Else + data%State%Pump(Pump_No)%Open_Close = 0 + End if + + end subroutine Pump_OnMode_Solver ! subroutine Pump1_Output ! implicit none ! end subroutine Pump1_Output diff --git a/Equipments/Pumps/PumpsMain.i90 b/Equipments/Pumps/PumpsMain.i90 index 0c10ced..5674c11 100644 --- a/Equipments/Pumps/PumpsMain.i90 +++ b/Equipments/Pumps/PumpsMain.i90 @@ -1,223 +1,789 @@ -# 1 "/home/admin/SimulationCore2/Equipments/Pumps/PumpsMain.f90" -module PumpsMain - use SimulationVariables - implicit none - public - contains -! **************************************** -! ***** subroutine Pump1MainBody ***** -! **************************** -! subroutine Pump1_Setup() -! use CSimulationVariables -! implicit none -! call OnSimulationInitialization%Add(Pump1_Init) -! call OnSimulationStop%Add(Pump1_Init) -! call OnPump1Step%Add(Pump1_Step) -! call OnPump1Output%Add(Pump1_Output) -! call OnPump1Main%Add(Pump1MainBody) -! end subroutine - - subroutine Pump1_Init - Call Pumps_StartUp - end subroutine Pump1_Init - - subroutine Pump1_Step - Call Pump1_MainSolver - end subroutine Pump1_Step - -! subroutine Pump1_Output -! implicit none -! end subroutine Pump1_Output - -! subroutine Pump1MainBody -! use ifport -! use ifmt -! implicit none - - -! Call Pumps_StartUp - - -! loop1 : do - -! Call Pumps_MainSolver - -! end do loop1 - - -! end subroutine Pump1MainBody - - - - - -! **************************************** -! ***** subroutine Pump2MainBody ***** -! **************************** -! subroutine Pump2_Setup() -! use CSimulationVariables -! implicit none -! call OnSimulationInitialization%Add(Pump2_Init) -! call OnSimulationStop%Add(Pump2_Init) -! call OnPump2Step%Add(Pump2_Step) -! call OnPump2Output%Add(Pump2_Output) -! call OnPump2Main%Add(Pump2MainBody) -! end subroutine -! -! subroutine Pump2_Init -! implicit none -! end subroutine Pump2_Init -! -! subroutine Pump2_Step -! call Pump2_MainSolver -! end subroutine Pump2_Step -! -! subroutine Pump2_Output -! implicit none -! end subroutine Pump2_Output -! -! subroutine Pump2MainBody -! use ifport -! use ifmt -! use CWarnings -! implicit none -! -! integer,dimension(8) :: MP_START_TIME, MP_END_TIME -! INTEGER :: MP_SolDuration -! -! Call Pump_StartUp -! -! loop1 : do -! -! Call DATE_AND_TIME(values=MP_START_TIME) -! -! Call Pump2_MainSolver -! -! Call DATE_AND_TIME(values=MP_END_TIME) -! MP_SolDuration = 100-(MP_END_TIME(5)*3600000+MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(5)*3600000-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8)) -! if(MP_SolDuration > 0.0) then -! Call sleepqq(MP_SolDuration) -! end if -! -! if (IsStopped == .true.) then -! exit loop1 -! end if -! -! end do loop1 -! -! -! end subroutine Pump2MainBody -! -! -! -! -!! **************************************** -!! ***** subroutine Pump3MainBody ***** -!! **************************** -! subroutine Pump3_Setup() -! use CSimulationVariables -! implicit none -! call OnSimulationInitialization%Add(Pump3_Init) -! call OnSimulationStop%Add(Pump3_Init) -! call OnPump3Step%Add(Pump3_Step) -! call OnPump3Output%Add(Pump3_Output) -! call OnPump3Main%Add(Pump3MainBody) -! end subroutine -! -! subroutine Pump3_Init -! implicit none -! end subroutine Pump3_Init -! -! subroutine Pump3_Step -! implicit none -! end subroutine Pump3_Step -! -! subroutine Pump3_Output -! implicit none -! end subroutine Pump3_Output -! -! subroutine Pump3MainBody -! use ifport -! use ifmt -! implicit none -! -! -! integer,dimension(8) :: MP_START_TIME, MP_END_TIME -! INTEGER :: MP_SolDuration -! -! !Call Pump_StartUp -! !loop1 : do -! ! -! ! Call sleepqq(10) -! ! -! ! !!! Pump3 Malfunction ----> Power Failure -! ! !!if (data%State%Pump(1)%PowerFailMalf==1) then -! ! !! !MP1BLWR=0 -! ! !! Call Pump3_OffMode_Solver -! ! !! Call ClosePump1() -! ! !!end if -! ! -! ! !if( (MP1CPSwitch==1) .and. (MP1Throttle==0.) .and. (data%State%Pump(3)%PowerFailMalf==0) ) then -! !! -! !! loop2: do -! !! -! !! Call DATE_AND_TIME(values=MP_START_TIME) -! !! -! !!!! ! Pump3 Malfunction ----> Power Failure -! !!!! if (data%State%Pump(1)%PowerFailMalf==1) then -! !!!! !MP1BLWR=0 -! !!!! Pump3_OffMode_Solver -! !!!! Call ClosePump1() -! !!!! exit loop2 -! !!!! end if -! !! -! !! data%State%Pump(3)%N_new = MP1Throttle -! !! if (((data%State%Pump(3)%N_new-data%State%Pump(3)%N_old)/data%State%Pump(3)%time_step)>193.) then -! !! data%State%Pump(3)%N_ref =(193.*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old -! !! else if (((data%State%Pump(3)%N_old-data%State%Pump(3)%N_new)/data%State%Pump(3)%time_step)>193.) then -! !! data%State%Pump(3)%N_ref = (-193.*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old -! !! else -! !! data%State%Pump(3)%N_ref = data%State%Pump(3)%N_new -! !! end if -! !! -! !! Call Pump3_OnMode_Solver -! !! -! !! IF (data%State%Pump(3)%Flow_Rate>0.) Then -! !! Call OpenCementPump() -! !! Else -! !! Call CloseCementPump() -! !! End if -! !! -! !! data%State%Pump(3)%N_old = data%State%Pump(3)%N_ref -! !! -! !! Call DATE_AND_TIME(values=MP_END_TIME) -! !! MP_SolDuration = 100-(MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8)) -! !! !if(print_log) print*, 'MPtime=', MP_SolDuration -! !! if(MP_SolDuration > 0.0) then -! !! Call sleepqq(MP_SolDuration) -! !! end if -! !! -! !! if ((MP1CPSwitch==0) .or. (IsStopped == .true.)) then -! !! Call Pump3_OffMode_Solver -! !! Call CloseCementPump() -! !! exit loop2 -! !! end if -! !! end do loop2 -! ! -! ! else -! ! -! ! !Call Pump3_OffMode_Solver -! ! !Call CloseCementPump() -! ! -! ! end if -! ! -! ! if (IsStopped == .true.) then -! ! exit loop1 -! ! end if -! ! -! !end do loop1 -! -! -! end subroutine Pump3MainBody - -end module PumpsMain +# 1 "/home/admin/SimulationCore2/Equipments/Pumps/PumpsMain.f90" +module PumpsMain + use SimulationVariables + implicit none + public + contains +! **************************************** +! ***** subroutine Pump1MainBody ***** +! **************************** +! subroutine Pump1_Setup() +! use CSimulationVariables +! implicit none +! call OnSimulationInitialization%Add(Pump1_Init) +! call OnSimulationStop%Add(Pump1_Init) +! call OnPump1Step%Add(Pump1_Step) +! call OnPump1Output%Add(Pump1_Output) +! call OnPump1Main%Add(Pump1MainBody) +! end subroutine + + subroutine Pump1_Init + Call Pumps_StartUp + end subroutine Pump1_Init + + subroutine Pump1_Step + Call Pump1_MainSolver + end subroutine Pump1_Step + + subroutine Pumps_MainSolver + + use SimulationVariables + + Implicit none + + Call DrillingConsole_ScrLEDs !koja bezaramesh????? + Call Pumps_Inputs + Call Pump1_MainSolver + Call Pump2_MainSolver + Call Pump3_MainSolver + Call Pumps_TotalSolver + Call Pumps_Outputs + + end subroutine Pumps_MainSolver + + subroutine Pumps_Inputs + + use CDrillingConsoleVariables + use SimulationVariables + Use MudSystemModule + + IMPLICIT NONE + + + +!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< + +!data%State%Pump(1)%BlowPopOffMalf = 0 !??????? motaghayere voroudi + + if ( data%State%Pump(1)%BlowPopOffMalf==1 ) then ! Pump1 Malfunction ----> Blow Pop-offs (Relief Valves) + data%State%Pump(1)%StandPipe_Pressure = 0.d0 + else + data%State%Pump(1)%StandPipe_Pressure = PumpPressure1 ![psi] + if ( data%State%Pump(1)%StandPipe_Pressure<=14.d0 ) then + data%State%Pump(1)%StandPipe_Pressure = 14.d0 + end if + end if + + data%State%Pump(1)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch + + data%State%Pump(1)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch + + data%State%Pump(1)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad + + data%State%Pump(1)%Failure = data%Warnings%Pump1Failure !(Pump1 Warning ----> Failure) + + data%State%Pump(1)%N_new = data%State%Pump(1)%Throttle + + + + + + + +!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< + +!data%State%Pump(2)%BlowPopOffMalf = 0 !??????? motaghayere voroudi + + if ( data%State%Pump(2)%BlowPopOffMalf==1 ) then ! Pump2 Malfunction ----> Blow Pop-offs (Relief Valves) + data%State%Pump(2)%StandPipe_Pressure = 0.d0 + else + data%State%Pump(2)%StandPipe_Pressure = PumpPressure2 ![psi] + if ( data%State%Pump(2)%StandPipe_Pressure<=14.d0 ) then + data%State%Pump(2)%StandPipe_Pressure = 14.d0 + end if + end if + + data%State%Pump(2)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch + + data%State%Pump(2)%Switch = data%Equipments%DrillingConsole%MP2Switch + + data%State%Pump(2)%Throttle = data%Equipments%DrillingConsole%MP2Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad + + data%State%Pump(2)%Failure = data%Warnings%Pump2Failure !(Pump2 Warning ----> Failure) + + data%State%Pump(2)%N_new = data%State%Pump(2)%Throttle + +!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< + +!data%State%Pump(3)%BlowPopOffMalf = 0 !??????? motaghayere voroudi + + if ( data%State%Pump(3)%BlowPopOffMalf==1 ) then ! Pump3 Malfunction ----> Blow Pop-offs (Relief Valves) + data%State%Pump(3)%StandPipe_Pressure = 0.d0 + else + data%State%Pump(3)%StandPipe_Pressure = PumpPressure3 ![psi] + if ( data%State%Pump(3)%StandPipe_Pressure<=14.d0 ) then + data%State%Pump(3)%StandPipe_Pressure = 14.d0 + end if + end if + + data%State%Pump(3)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch + + data%State%Pump(3)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad + + data%State%Pump(3)%Failure = data%Warnings%Pump3Failure !(Pump1 Warning ----> Failure) + + data%State%Pump(3)%N_new = data%State%Pump(3)%Throttle + +!>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< + + end subroutine Pumps_Inputs + + subroutine DrillingConsole_ScrLEDs + + use CDrillingConsoleVariables + use SimulationVariables + use SimulationVariables + use SimulationVariables !@ + + IMPLICIT NONE + + + +!===> Torque Limit + data%Equipments%DrillingConsole%RTTorqueLimitGauge = sngl(1-data%State%RTable%TorqueLimitGaugeMalf)*(data%Equipments%DrillingConsole%RTTorqueLimitKnob/10.d0)*7000.d0 !tabdile bazeye 0-10 be 0-7000 taghribi anjam shode, baadan eslah shavad ?????? + + + + + + if((any(data%Equipments%DrillingConsole%AssignmentSwitch==(/1,2,3,4,8,9,10,11/)))) then + + data%Equipments%DrillingConsole%SCR1LED=1 + data%Equipments%DrillingConsole%SCR2LED=1 + data%Equipments%DrillingConsole%SCR3LED=1 + data%Equipments%DrillingConsole%SCR4LED=1 + + else if (data%Equipments%DrillingConsole%AssignmentSwitch == 5) then + + data%Equipments%DrillingConsole%SCR1LED=1 + data%Equipments%DrillingConsole%SCR2LED=1 + data%Equipments%DrillingConsole%SCR3LED=0 + data%Equipments%DrillingConsole%SCR4LED=1 + + else if (data%Equipments%DrillingConsole%AssignmentSwitch == 7) then + + data%Equipments%DrillingConsole%SCR1LED=1 + data%Equipments%DrillingConsole%SCR2LED=1 + data%Equipments%DrillingConsole%SCR3LED=1 + data%Equipments%DrillingConsole%SCR4LED=0 + + else + data%Equipments%DrillingConsole%SCR1LED=0 + data%Equipments%DrillingConsole%SCR2LED=0 + data%Equipments%DrillingConsole%SCR3LED=0 + data%Equipments%DrillingConsole%SCR4LED=0 + + end if + + + + + end subroutine DrillingConsole_ScrLEDs + + subroutine Pump1_MainSolver + + use SimulationVariables + + Implicit none + + + + + if (data%State%Pump(1)%Throttle<=0.d0) then + data%State%Pump(1)%K_throttle = 1 + end if + + + if((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%K_throttle==1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then + + data%State%Pump(1)%SoundBlower = .true. + data%State%Pump(1)%BLWR = 1 + +!========================== Pump 1 Rate limit ========================== + if (((data%State%Pump(1)%N_new-data%State%Pump(1)%N_old)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then + data%State%Pump(1)%Speed =(data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old ![RPM] + else if (((data%State%Pump(1)%N_old-data%State%Pump(1)%N_new)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then + data%State%Pump(1)%Speed = (-data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old + else + data%State%Pump(1)%Speed = data%State%Pump(1)%N_new + end if +!======================================================================= + + Call Pump_OnMode_Solver(1) + + else + + if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1)) then + data%State%Pump(1)%SoundBlower = .true. + else + data%State%Pump(1)%SoundBlower = .false. + end if + + if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then + data%State%Pump(1)%BLWR = 1 + else + data%State%Pump(1)%BLWR = 0 + end if + + + Call Pump_OffMode_Solver(1) + data%State%Pump(1)%K_throttle = 0 + + end if + + + data%State%Pump(1)%N_old = data%State%Pump(1)%Speed + + + + end subroutine Pump1_MainSolver + + subroutine Pump2_MainSolver + + use SimulationVariables + + Implicit none + + + + + if (data%State%Pump(2)%Throttle<=0.d0) then + data%State%Pump(2)%K_throttle = 1 + end if + + + if((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%K_throttle==1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then + + data%State%Pump(2)%SoundBlower = .true. + data%State%Pump(2)%BLWR = 1 + +!========================== Pump 2 Rate limit ========================== + if (((data%State%Pump(2)%N_new-data%State%Pump(2)%N_old)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then + data%State%Pump(2)%Speed =(data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old ![RPM] + else if (((data%State%Pump(2)%N_old-data%State%Pump(2)%N_new)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then + data%State%Pump(2)%Speed = (-data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old + else + data%State%Pump(2)%Speed = data%State%Pump(2)%N_new + end if +!======================================================================= + + Call Pump_OnMode_Solver(2) + + else + + if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1)) then + data%State%Pump(2)%SoundBlower = .true. + else + data%State%Pump(2)%SoundBlower = .false. + end if + + if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then + data%State%Pump(2)%BLWR = 1 + else + data%State%Pump(2)%BLWR = 0 + end if + + + Call Pump_OffMode_Solver(2) + data%State%Pump(2)%K_throttle = 0 + + end if + + + data%State%Pump(2)%N_old = data%State%Pump(2)%Speed + + + + end subroutine Pump2_MainSolver + + subroutine Pump3_MainSolver + + use SimulationVariables + + Implicit none + + + + + if (data%State%Pump(3)%Throttle<=0.d0) then + data%State%Pump(3)%K_throttle = 1 + end if + + + if((data%State%Pump(3)%Switch==1) .and. (data%State%Pump(3)%K_throttle==1) .and. (data%State%Pump(3)%PowerFailMalf==0) .and. (data%State%Pump(3)%Failure==0)) then + +!========================== Pump 3 Rate limit ========================== + if (((data%State%Pump(3)%N_new-data%State%Pump(3)%N_old)/data%State%Pump(3)%time_step)>data%State%Pump(3)%RateChange) then + data%State%Pump(3)%Speed =(data%State%Pump(3)%RateChange*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old ![RPM] + else if (((data%State%Pump(3)%N_old-data%State%Pump(3)%N_new)/data%State%Pump(3)%time_step)>data%State%Pump(3)%RateChange) then + data%State%Pump(3)%Speed = (-data%State%Pump(3)%RateChange*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old + else + data%State%Pump(3)%Speed = data%State%Pump(3)%N_new + end if +!======================================================================= + + Call Pump_OnMode_Solver(3) + + else + + Call Pump_OffMode_Solver(3) + data%State%Pump(3)%K_throttle = 0 + + end if + + + data%State%Pump(3)%N_old = data%State%Pump(3)%Speed + + + + end subroutine Pump3_MainSolver + + subroutine Pumps_TotalSolver + + use SimulationVariables + + Implicit none + + + + data%Equipments%MPumps%Total_Pump_Gpm = data%State%Pump(1)%Flow_Rate+data%State%Pump(2)%Flow_Rate+data%State%Pump(3)%Flow_Rate ![gpm] + data%Equipments%MPumps%Total_Pump_SPM = (data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio)+(data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio)+(data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio) ![stk/min] + + + + end subroutine Pumps_TotalSolver + + subroutine Pumps_Outputs + use CDataDisplayConsole + use SimulationVariables + Use MudSystemModule + Use CSounds + + IMPLICIT NONE +!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + If (data%State%Pump(1)%Open_Close==1) then + Call OpenPump1() + Else if (data%State%Pump(1)%Open_Close==0) then + Call ClosePump1() + End if + + data%Equipments%DrillingConsole%MP1BLWR = data%State%Pump(1)%BLWR + + Call SetSoundBlowerMP1( data%State%Pump(1)%SoundBlower ) !.true. or .false. + Call SetSoundMP1( data%State%Pump(1)%SoundSPM ) ![SPM] , integer + + if ((data%State%Pump(1)%Switch==-1) .or. (data%State%Pump(1)%Switch==0)) then + Call Set_MP1SPMGauge( sngl(1-data%State%Pump(1)%SPMGaugeMalf)*real((data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio),8) ) ![spm] , real + data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge + end if + +!data%State%Pump(1)%Flow_Rate !to other modules , [gpm] + + + + + + + +!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + If (data%State%Pump(2)%Open_Close==1) then + Call OpenPump2() + Else if (data%State%Pump(2)%Open_Close==0) then + Call ClosePump2() + End if + + data%Equipments%DrillingConsole%MP2BLWR = data%State%Pump(2)%BLWR + + Call SetSoundBlowerMP2( data%State%Pump(2)%SoundBlower ) + Call SetSoundMP2( data%State%Pump(2)%SoundSPM ) ![SPM] + + Call Set_MP2SPMGauge( sngl(1-data%State%Pump(2)%SPMGaugeMalf)*real((data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio),8) ) ![SPM] + data%Equipments%DrillingWatch%SPM2 = data%Equipments%DataDisplayConsole%MP2SPMGauge + +!data%State%Pump(2)%Flow_Rate !to other modules + + + + + + +!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< + + If (data%State%Pump(3)%Open_Close==1) then + Call OpenCementPump() + Else if (data%State%Pump(3)%Open_Close==0) then + Call CloseCementPump() + End if + + Call SetSoundMP3( data%State%Pump(3)%SoundSPM ) + + if (data%State%Pump(3)%Switch==1) then + Call Set_MP1SPMGauge( real((data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio),8) ) ![SPM] SPMGaugeMalf Malf nadarad???? + data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge + end if + +!data%State%Pump(3)%Flow_Rate !to other modules + + + +!>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< + +!data%Equipments%MPumps%Total_Pump_Gpm = 100.d0 !??????????? +!data%Equipments%MPumps%Total_Pump_SPM = 1000.d0 !????????????? + +!SCR1LED=1 +!SCR2LED=1 +!SCR3LED=1 +!SCR4LED=1 + + + + + end subroutine Pumps_Outputs + + subroutine Pumps_StartUp + use CPumpsVariables + use CPumps + use SimulationVariables + IMPLICIT NONE + + +!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%Pump(1)%FlowRatePerSTK = data%Configuration%Pumps%MudPump1VolumetricOutput !.1d0 ![bbl/stk] + data%State%Pump(1)%RateChange = data%Configuration%Pumps%MudPump1PumpRateChange ![stk/min2 ??] + data%State%Pump(1)%DelayToShutdown = data%Configuration%Pumps%MudPump1DelayToShutdown ![min] + data%State%Pump(1)%Mech_Efficiency = data%Configuration%Pumps%MudPump1MechanicalEfficiency ![dimensionless] +!data%State%Pump(1)%Vol_Efficiency = MudPump1VolumetricEfficiency !bayad hazf beshe ? + data%State%Pump(1)%Max_Pressure = data%Configuration%Pumps%MudPump1MaximumPressure !6000.d0 ![psi] + data%State%Pump(1)%MaxSPM = data%Configuration%Pumps%MudPump1Maximum ![spm] + data%State%Pump(1)%Trans_Ratio = 965.d0/data%State%Pump(1)%MaxSPM + data%State%Pump(1)%time_step = 0.1d0 !?????? niaz hast ya na?? + + data%State%Pump(1)%RateChange = (data%State%Pump(1)%RateChange*data%State%Pump(1)%Trans_Ratio)/60.d0 ![rpm/s ??] 24/60 + data%State%Pump(1)%DelayToShutdown = data%State%Pump(1)%DelayToShutdown/60.d0 ![s] + data%State%Pump(1)%K_throttle = 0 + data%State%Pump(1)%N_old = 0.d0 + Call Pump_OffMode_Solver(1) + + +!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%Pump(2)%FlowRatePerSTK = data%Configuration%Pumps%MudPump2VolumetricOutput !.1d0 ![bbl/stk] + data%State%Pump(2)%RateChange = data%Configuration%Pumps%MudPump2PumpRateChange ![stk/min2 ??] + data%State%Pump(2)%DelayToShutdown = data%Configuration%Pumps%MudPump2DelayToShutdown ![min] + data%State%Pump(2)%Mech_Efficiency = data%Configuration%Pumps%MudPump2MechanicalEfficiency ![dimensionless] +!data%State%Pump(2)%Vol_Efficiency = MudPump2VolumetricEfficiency !bayad hazf beshe ? + data%State%Pump(2)%Max_Pressure = data%Configuration%Pumps%MudPump2MaximumPressure !6000.d0 ![psi] + data%State%Pump(2)%MaxSPM = data%Configuration%Pumps%MudPump2Maximum ![spm] + data%State%Pump(2)%Trans_Ratio = 965.d0/data%State%Pump(2)%MaxSPM + data%State%Pump(2)%time_step = 0.1d0 !?????? niaz hast ya na?? + + data%State%Pump(2)%RateChange = (data%State%Pump(2)%RateChange*data%State%Pump(2)%Trans_Ratio)/60.d0 ![rpm/s ??] + data%State%Pump(2)%DelayToShutdown = data%State%Pump(2)%DelayToShutdown/60.d0 ![s] + data%State%Pump(2)%K_throttle = 0 + data%State%Pump(2)%N_old = 0.d0 + Call Pump_OffMode_Solver(2) + + +!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< + data%State%Pump(3)%FlowRatePerSTK = data%Configuration%Pumps%CementPumpVolumetricOutput !.1d0 ![bbl/stk] + data%State%Pump(3)%RateChange = data%Configuration%Pumps%CementPumpPumpRateChange ![stk/min2 ??] + data%State%Pump(3)%DelayToShutdown = data%Configuration%Pumps%CementPumpDelayToShutdown ![min] + data%State%Pump(3)%Mech_Efficiency = data%Configuration%Pumps%CementPumpMechanicalEfficiency ![dimensionless] +!data%State%Pump(3)%Vol_Efficiency = CementPumpVolumetricEfficiency !bayad hazf beshe ? + data%State%Pump(3)%Max_Pressure = data%Configuration%Pumps%CementPumpMaximumPressure !6000.d0 ![psi] + data%State%Pump(3)%MaxSPM = data%Configuration%Pumps%CementPumpMaximum ![spm] + data%State%Pump(3)%Trans_Ratio = 965.d0/data%State%Pump(3)%MaxSPM + data%State%Pump(3)%time_step = 0.1d0 !?????? niaz hast ya na?? + + data%State%Pump(3)%RateChange = (data%State%Pump(3)%RateChange*data%State%Pump(3)%Trans_Ratio)/60.d0 ![rpm/s ??] + data%State%Pump(3)%DelayToShutdown = data%State%Pump(3)%DelayToShutdown/60.d0 ![s] + data%State%Pump(3)%K_throttle = 0 + data%State%Pump(3)%N_old = 0.d0 + Call Pump_OffMode_Solver(3) + + + end subroutine Pumps_StartUp + + subroutine Pump_OffMode_Solver(Pump_No) + + use SimulationVariables + + IMPLICIT NONE + INTEGER :: Pump_No + + + + data%State%Pump(Pump_No)%N_new = 0.d0 + +!========================== Pump Rate limit ========================== + if (((data%State%Pump(Pump_No)%N_new-data%State%Pump(Pump_No)%N_old)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then + data%State%Pump(Pump_No)%Speed =(data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old + else if (((data%State%Pump(Pump_No)%N_old-data%State%Pump(Pump_No)%N_new)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then + data%State%Pump(Pump_No)%Speed = (-data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old + else + data%State%Pump(Pump_No)%Speed = data%State%Pump(Pump_No)%N_new + end if +!======================================================================= + + + data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] + data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] +!data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] + data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) + if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad +!if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then + data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] + data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] + end if + + data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] + + If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then + data%State%Pump(Pump_No)%Open_Close = 1 + Else + data%State%Pump(Pump_No)%Open_Close = 0 + End if + + + + + + + end subroutine Pump_OffMode_Solver + + subroutine Pump_OnMode_Solver(Pump_No) + + use SimulationVariables + + IMPLICIT NONE + INTEGER :: Pump_No + + + + data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] + data%State%Pump(Pump_No)%Max_FlowRate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*data%State%Pump(Pump_No)%MaxSPM ![gpm] + data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] +!data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] + data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) + if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad +!if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then + data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] + data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] + end if + + data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![SPM] ![spm] + + If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then + data%State%Pump(Pump_No)%Open_Close = 1 + Else + data%State%Pump(Pump_No)%Open_Close = 0 + End if + + end subroutine Pump_OnMode_Solver +! subroutine Pump1_Output +! implicit none +! end subroutine Pump1_Output + +! subroutine Pump1MainBody +! use ifport +! use ifmt +! implicit none + + +! Call Pumps_StartUp + + +! loop1 : do + +! Call Pumps_MainSolver + +! end do loop1 + + +! end subroutine Pump1MainBody + + + + + +! **************************************** +! ***** subroutine Pump2MainBody ***** +! **************************** +! subroutine Pump2_Setup() +! use CSimulationVariables +! implicit none +! call OnSimulationInitialization%Add(Pump2_Init) +! call OnSimulationStop%Add(Pump2_Init) +! call OnPump2Step%Add(Pump2_Step) +! call OnPump2Output%Add(Pump2_Output) +! call OnPump2Main%Add(Pump2MainBody) +! end subroutine +! +! subroutine Pump2_Init +! implicit none +! end subroutine Pump2_Init +! +! subroutine Pump2_Step +! call Pump2_MainSolver +! end subroutine Pump2_Step +! +! subroutine Pump2_Output +! implicit none +! end subroutine Pump2_Output +! +! subroutine Pump2MainBody +! use ifport +! use ifmt +! use CWarnings +! implicit none +! +! integer,dimension(8) :: MP_START_TIME, MP_END_TIME +! INTEGER :: MP_SolDuration +! +! Call Pump_StartUp +! +! loop1 : do +! +! Call DATE_AND_TIME(values=MP_START_TIME) +! +! Call Pump2_MainSolver +! +! Call DATE_AND_TIME(values=MP_END_TIME) +! MP_SolDuration = 100-(MP_END_TIME(5)*3600000+MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(5)*3600000-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8)) +! if(MP_SolDuration > 0.0) then +! Call sleepqq(MP_SolDuration) +! end if +! +! if (IsStopped == .true.) then +! exit loop1 +! end if +! +! end do loop1 +! +! +! end subroutine Pump2MainBody +! +! +! +! +!! **************************************** +!! ***** subroutine Pump3MainBody ***** +!! **************************** +! subroutine Pump3_Setup() +! use CSimulationVariables +! implicit none +! call OnSimulationInitialization%Add(Pump3_Init) +! call OnSimulationStop%Add(Pump3_Init) +! call OnPump3Step%Add(Pump3_Step) +! call OnPump3Output%Add(Pump3_Output) +! call OnPump3Main%Add(Pump3MainBody) +! end subroutine +! +! subroutine Pump3_Init +! implicit none +! end subroutine Pump3_Init +! +! subroutine Pump3_Step +! implicit none +! end subroutine Pump3_Step +! +! subroutine Pump3_Output +! implicit none +! end subroutine Pump3_Output +! +! subroutine Pump3MainBody +! use ifport +! use ifmt +! implicit none +! +! +! integer,dimension(8) :: MP_START_TIME, MP_END_TIME +! INTEGER :: MP_SolDuration +! +! !Call Pump_StartUp +! !loop1 : do +! ! +! ! Call sleepqq(10) +! ! +! ! !!! Pump3 Malfunction ----> Power Failure +! ! !!if (data%State%Pump(1)%PowerFailMalf==1) then +! ! !! !MP1BLWR=0 +! ! !! Call Pump3_OffMode_Solver +! ! !! Call ClosePump1() +! ! !!end if +! ! +! ! !if( (MP1CPSwitch==1) .and. (MP1Throttle==0.) .and. (data%State%Pump(3)%PowerFailMalf==0) ) then +! !! +! !! loop2: do +! !! +! !! Call DATE_AND_TIME(values=MP_START_TIME) +! !! +! !!!! ! Pump3 Malfunction ----> Power Failure +! !!!! if (data%State%Pump(1)%PowerFailMalf==1) then +! !!!! !MP1BLWR=0 +! !!!! Pump3_OffMode_Solver +! !!!! Call ClosePump1() +! !!!! exit loop2 +! !!!! end if +! !! +! !! data%State%Pump(3)%N_new = MP1Throttle +! !! if (((data%State%Pump(3)%N_new-data%State%Pump(3)%N_old)/data%State%Pump(3)%time_step)>193.) then +! !! data%State%Pump(3)%N_ref =(193.*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old +! !! else if (((data%State%Pump(3)%N_old-data%State%Pump(3)%N_new)/data%State%Pump(3)%time_step)>193.) then +! !! data%State%Pump(3)%N_ref = (-193.*data%State%Pump(3)%time_step)+data%State%Pump(3)%N_old +! !! else +! !! data%State%Pump(3)%N_ref = data%State%Pump(3)%N_new +! !! end if +! !! +! !! Call Pump3_OnMode_Solver +! !! +! !! IF (data%State%Pump(3)%Flow_Rate>0.) Then +! !! Call OpenCementPump() +! !! Else +! !! Call CloseCementPump() +! !! End if +! !! +! !! data%State%Pump(3)%N_old = data%State%Pump(3)%N_ref +! !! +! !! Call DATE_AND_TIME(values=MP_END_TIME) +! !! MP_SolDuration = 100-(MP_END_TIME(6)*60000+MP_END_TIME(7)*1000+MP_END_TIME(8)-MP_START_TIME(6)*60000-MP_START_TIME(7)*1000-MP_START_TIME(8)) +! !! !if(print_log) print*, 'MPtime=', MP_SolDuration +! !! if(MP_SolDuration > 0.0) then +! !! Call sleepqq(MP_SolDuration) +! !! end if +! !! +! !! if ((MP1CPSwitch==0) .or. (IsStopped == .true.)) then +! !! Call Pump3_OffMode_Solver +! !! Call CloseCementPump() +! !! exit loop2 +! !! end if +! !! end do loop2 +! ! +! ! else +! ! +! ! !Call Pump3_OffMode_Solver +! ! !Call CloseCementPump() +! ! +! ! end if +! ! +! ! if (IsStopped == .true.) then +! ! exit loop1 +! ! end if +! ! +! !end do loop1 +! +! +! end subroutine Pump3MainBody + +end module PumpsMain diff --git a/Equipments/Pumps/Pumps_Inputs.f90 b/Equipments/Pumps/Pumps_Inputs.f90 index d851d0e..e69de29 100644 --- a/Equipments/Pumps/Pumps_Inputs.f90 +++ b/Equipments/Pumps/Pumps_Inputs.f90 @@ -1,113 +0,0 @@ -subroutine Pumps_Inputs - - use CDrillingConsoleVariables - use SimulationVariables - Use MudSystemModule - - IMPLICIT NONE - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - !data%State%Pump(1)%BlowPopOffMalf = 0 !??????? motaghayere voroudi - - if ( data%State%Pump(1)%BlowPopOffMalf==1 ) then ! Pump1 Malfunction ----> Blow Pop-offs (Relief Valves) - data%State%Pump(1)%StandPipe_Pressure = 0.d0 - else - data%State%Pump(1)%StandPipe_Pressure = PumpPressure1 ![psi] - if ( data%State%Pump(1)%StandPipe_Pressure<=14.d0 ) then - data%State%Pump(1)%StandPipe_Pressure = 14.d0 - end if - end if - - data%State%Pump(1)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch - - data%State%Pump(1)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch - - data%State%Pump(1)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad - - data%State%Pump(1)%Failure = data%Warnings%Pump1Failure !(Pump1 Warning ----> Failure) - - data%State%Pump(1)%N_new = data%State%Pump(1)%Throttle - - - - - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - !data%State%Pump(2)%BlowPopOffMalf = 0 !??????? motaghayere voroudi - - if ( data%State%Pump(2)%BlowPopOffMalf==1 ) then ! Pump2 Malfunction ----> Blow Pop-offs (Relief Valves) - data%State%Pump(2)%StandPipe_Pressure = 0.d0 - else - data%State%Pump(2)%StandPipe_Pressure = PumpPressure2 ![psi] - if ( data%State%Pump(2)%StandPipe_Pressure<=14.d0 ) then - data%State%Pump(2)%StandPipe_Pressure = 14.d0 - end if - end if - - data%State%Pump(2)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch - - data%State%Pump(2)%Switch = data%Equipments%DrillingConsole%MP2Switch - - data%State%Pump(2)%Throttle = data%Equipments%DrillingConsole%MP2Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad - - data%State%Pump(2)%Failure = data%Warnings%Pump2Failure !(Pump2 Warning ----> Failure) - - data%State%Pump(2)%N_new = data%State%Pump(2)%Throttle - - - - - - - -!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - !data%State%Pump(3)%BlowPopOffMalf = 0 !??????? motaghayere voroudi - - if ( data%State%Pump(3)%BlowPopOffMalf==1 ) then ! Pump3 Malfunction ----> Blow Pop-offs (Relief Valves) - data%State%Pump(3)%StandPipe_Pressure = 0.d0 - else - data%State%Pump(3)%StandPipe_Pressure = PumpPressure3 ![psi] - if ( data%State%Pump(3)%StandPipe_Pressure<=14.d0 ) then - data%State%Pump(3)%StandPipe_Pressure = 14.d0 - end if - end if - - data%State%Pump(3)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch - - data%State%Pump(3)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad - - data%State%Pump(3)%Failure = data%Warnings%Pump3Failure !(Pump1 Warning ----> Failure) - - data%State%Pump(3)%N_new = data%State%Pump(3)%Throttle - - - - - - -!>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< - - - - - - - - -end subroutine Pumps_Inputs \ No newline at end of file diff --git a/Equipments/Pumps/Pumps_Inputs.i90 b/Equipments/Pumps/Pumps_Inputs.i90 index b2aa76b..3ffc4b4 100644 --- a/Equipments/Pumps/Pumps_Inputs.i90 +++ b/Equipments/Pumps/Pumps_Inputs.i90 @@ -1,114 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pumps_Inputs.f90" -subroutine Pumps_Inputs - - use CDrillingConsoleVariables - use SimulationVariables - Use MudSystemModule - - IMPLICIT NONE - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< - -!data%State%Pump(1)%BlowPopOffMalf = 0 !??????? motaghayere voroudi - - if ( data%State%Pump(1)%BlowPopOffMalf==1 ) then ! Pump1 Malfunction ----> Blow Pop-offs (Relief Valves) - data%State%Pump(1)%StandPipe_Pressure = 0.d0 - else - data%State%Pump(1)%StandPipe_Pressure = PumpPressure1 ![psi] - if ( data%State%Pump(1)%StandPipe_Pressure<=14.d0 ) then - data%State%Pump(1)%StandPipe_Pressure = 14.d0 - end if - end if - - data%State%Pump(1)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch - - data%State%Pump(1)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch - - data%State%Pump(1)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad - - data%State%Pump(1)%Failure = data%Warnings%Pump1Failure !(Pump1 Warning ----> Failure) - - data%State%Pump(1)%N_new = data%State%Pump(1)%Throttle - - - - - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< - -!data%State%Pump(2)%BlowPopOffMalf = 0 !??????? motaghayere voroudi - - if ( data%State%Pump(2)%BlowPopOffMalf==1 ) then ! Pump2 Malfunction ----> Blow Pop-offs (Relief Valves) - data%State%Pump(2)%StandPipe_Pressure = 0.d0 - else - data%State%Pump(2)%StandPipe_Pressure = PumpPressure2 ![psi] - if ( data%State%Pump(2)%StandPipe_Pressure<=14.d0 ) then - data%State%Pump(2)%StandPipe_Pressure = 14.d0 - end if - end if - - data%State%Pump(2)%AssignmentSwitchh = data%Equipments%DrillingConsole%AssignmentSwitch - - data%State%Pump(2)%Switch = data%Equipments%DrillingConsole%MP2Switch - - data%State%Pump(2)%Throttle = data%Equipments%DrillingConsole%MP2Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad - - data%State%Pump(2)%Failure = data%Warnings%Pump2Failure !(Pump2 Warning ----> Failure) - - data%State%Pump(2)%N_new = data%State%Pump(2)%Throttle - - - - - - - -!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< - -!data%State%Pump(3)%BlowPopOffMalf = 0 !??????? motaghayere voroudi - - if ( data%State%Pump(3)%BlowPopOffMalf==1 ) then ! Pump3 Malfunction ----> Blow Pop-offs (Relief Valves) - data%State%Pump(3)%StandPipe_Pressure = 0.d0 - else - data%State%Pump(3)%StandPipe_Pressure = PumpPressure3 ![psi] - if ( data%State%Pump(3)%StandPipe_Pressure<=14.d0 ) then - data%State%Pump(3)%StandPipe_Pressure = 14.d0 - end if - end if - - data%State%Pump(3)%Switch = data%Equipments%DrillingConsole%MP1CPSwitch - - data%State%Pump(3)%Throttle = data%Equipments%DrillingConsole%MP1Throttle ![SPM] 0 Power Failure) !dar CPumpProblemsVariables meghdardehi mishavad - - data%State%Pump(3)%Failure = data%Warnings%Pump3Failure !(Pump1 Warning ----> Failure) - - data%State%Pump(3)%N_new = data%State%Pump(3)%Throttle - - - - - - -!>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< - - - - - - - - -end subroutine Pumps_Inputs diff --git a/Equipments/Pumps/Pumps_MainSolver.f90 b/Equipments/Pumps/Pumps_MainSolver.f90 index a4f91e4..e69de29 100644 --- a/Equipments/Pumps/Pumps_MainSolver.f90 +++ b/Equipments/Pumps/Pumps_MainSolver.f90 @@ -1,26 +0,0 @@ -subroutine Pumps_MainSolver - - use SimulationVariables - - Implicit none - - - - Call DrillingConsole_ScrLEDs !koja bezaramesh????? - - Call Pumps_Inputs - - Call Pump1_MainSolver - - Call Pump2_MainSolver - - Call Pump3_MainSolver - - Call Pumps_TotalSolver - - - - Call Pumps_Outputs - - -end subroutine Pumps_MainSolver \ No newline at end of file diff --git a/Equipments/Pumps/Pumps_MainSolver.i90 b/Equipments/Pumps/Pumps_MainSolver.i90 index 5170244..927ce95 100644 --- a/Equipments/Pumps/Pumps_MainSolver.i90 +++ b/Equipments/Pumps/Pumps_MainSolver.i90 @@ -1,27 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pumps_MainSolver.f90" -subroutine Pumps_MainSolver - - use SimulationVariables - - Implicit none - - - - Call DrillingConsole_ScrLEDs !koja bezaramesh????? - - Call Pumps_Inputs - - Call Pump1_MainSolver - - Call Pump2_MainSolver - - Call Pump3_MainSolver - - Call Pumps_TotalSolver - - - - Call Pumps_Outputs - - -end subroutine Pumps_MainSolver diff --git a/Equipments/Pumps/Pumps_Outputs.f90 b/Equipments/Pumps/Pumps_Outputs.f90 index 6b3bb42..e69de29 100644 --- a/Equipments/Pumps/Pumps_Outputs.f90 +++ b/Equipments/Pumps/Pumps_Outputs.f90 @@ -1,94 +0,0 @@ -subroutine Pumps_Outputs - - use CDataDisplayConsole - use SimulationVariables - ! Use CSimulationVariables - Use MudSystemModule - Use CSounds - - IMPLICIT NONE - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - If (data%State%Pump(1)%Open_Close==1) then - Call OpenPump1() - Else if (data%State%Pump(1)%Open_Close==0) then - Call ClosePump1() - End if - - data%Equipments%DrillingConsole%MP1BLWR = data%State%Pump(1)%BLWR - - Call SetSoundBlowerMP1( data%State%Pump(1)%SoundBlower ) !.true. or .false. - Call SetSoundMP1( data%State%Pump(1)%SoundSPM ) ![SPM] , integer - - if ((data%State%Pump(1)%Switch==-1) .or. (data%State%Pump(1)%Switch==0)) then - Call Set_MP1SPMGauge( sngl(1-data%State%Pump(1)%SPMGaugeMalf)*real((data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio),8) ) ![spm] , real - data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge - end if - - !data%State%Pump(1)%Flow_Rate !to other modules , [gpm] - - - - - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - If (data%State%Pump(2)%Open_Close==1) then - Call OpenPump2() - Else if (data%State%Pump(2)%Open_Close==0) then - Call ClosePump2() - End if - - data%Equipments%DrillingConsole%MP2BLWR = data%State%Pump(2)%BLWR - - Call SetSoundBlowerMP2( data%State%Pump(2)%SoundBlower ) - Call SetSoundMP2( data%State%Pump(2)%SoundSPM ) ![SPM] - - Call Set_MP2SPMGauge( sngl(1-data%State%Pump(2)%SPMGaugeMalf)*real((data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio),8) ) ![SPM] - data%Equipments%DrillingWatch%SPM2 = data%Equipments%DataDisplayConsole%MP2SPMGauge - - !data%State%Pump(2)%Flow_Rate !to other modules - - - - - - -!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - If (data%State%Pump(3)%Open_Close==1) then - Call OpenCementPump() - Else if (data%State%Pump(3)%Open_Close==0) then - Call CloseCementPump() - End if - - Call SetSoundMP3( data%State%Pump(3)%SoundSPM ) - - if (data%State%Pump(3)%Switch==1) then - Call Set_MP1SPMGauge( real((data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio),8) ) ![SPM] SPMGaugeMalf Malf nadarad???? - data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge - end if - - !data%State%Pump(3)%Flow_Rate !to other modules - - - -!>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< - - !data%State%MPumps%Total_Pump_Gpm = 100.d0 !??????????? - !data%State%MPumps%Total_Pump_SPM = 1000.d0 !????????????? - - !SCR1LED=1 - !SCR2LED=1 - !SCR3LED=1 - !SCR4LED=1 - - - - -end subroutine Pumps_Outputs \ No newline at end of file diff --git a/Equipments/Pumps/Pumps_Outputs.i90 b/Equipments/Pumps/Pumps_Outputs.i90 index d4a17f9..2a4ed3a 100644 --- a/Equipments/Pumps/Pumps_Outputs.i90 +++ b/Equipments/Pumps/Pumps_Outputs.i90 @@ -1,95 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pumps_Outputs.f90" -subroutine Pumps_Outputs - - use CDataDisplayConsole - use SimulationVariables -! Use CSimulationVariables - Use MudSystemModule - Use CSounds - - IMPLICIT NONE - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - If (data%State%Pump(1)%Open_Close==1) then - Call OpenPump1() - Else if (data%State%Pump(1)%Open_Close==0) then - Call ClosePump1() - End if - - data%Equipments%DrillingConsole%MP1BLWR = data%State%Pump(1)%BLWR - - Call SetSoundBlowerMP1( data%State%Pump(1)%SoundBlower ) !.true. or .false. - Call SetSoundMP1( data%State%Pump(1)%SoundSPM ) ![SPM] , integer - - if ((data%State%Pump(1)%Switch==-1) .or. (data%State%Pump(1)%Switch==0)) then - Call Set_MP1SPMGauge( sngl(1-data%State%Pump(1)%SPMGaugeMalf)*real((data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio),8) ) ![spm] , real - data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge - end if - -!data%State%Pump(1)%Flow_Rate !to other modules , [gpm] - - - - - - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - If (data%State%Pump(2)%Open_Close==1) then - Call OpenPump2() - Else if (data%State%Pump(2)%Open_Close==0) then - Call ClosePump2() - End if - - data%Equipments%DrillingConsole%MP2BLWR = data%State%Pump(2)%BLWR - - Call SetSoundBlowerMP2( data%State%Pump(2)%SoundBlower ) - Call SetSoundMP2( data%State%Pump(2)%SoundSPM ) ![SPM] - - Call Set_MP2SPMGauge( sngl(1-data%State%Pump(2)%SPMGaugeMalf)*real((data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio),8) ) ![SPM] - data%Equipments%DrillingWatch%SPM2 = data%Equipments%DataDisplayConsole%MP2SPMGauge - -!data%State%Pump(2)%Flow_Rate !to other modules - - - - - - -!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< - - If (data%State%Pump(3)%Open_Close==1) then - Call OpenCementPump() - Else if (data%State%Pump(3)%Open_Close==0) then - Call CloseCementPump() - End if - - Call SetSoundMP3( data%State%Pump(3)%SoundSPM ) - - if (data%State%Pump(3)%Switch==1) then - Call Set_MP1SPMGauge( real((data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio),8) ) ![SPM] SPMGaugeMalf Malf nadarad???? - data%Equipments%DrillingWatch%SPM1 = data%Equipments%DataDisplayConsole%MP1SPMGauge - end if - -!data%State%Pump(3)%Flow_Rate !to other modules - - - -!>>>>>>>>>>>>>>>>>>>>>>> Total Pumps <<<<<<<<<<<<<<<<<<<<<<<<<<< - -!data%State%MPumps%Total_Pump_Gpm = 100.d0 !??????????? -!data%State%MPumps%Total_Pump_SPM = 1000.d0 !????????????? - -!SCR1LED=1 -!SCR2LED=1 -!SCR3LED=1 -!SCR4LED=1 - - - - -end subroutine Pumps_Outputs diff --git a/Equipments/Pumps/Pumps_StartUp.f90 b/Equipments/Pumps/Pumps_StartUp.f90 index 78997ab..e69de29 100644 --- a/Equipments/Pumps/Pumps_StartUp.f90 +++ b/Equipments/Pumps/Pumps_StartUp.f90 @@ -1,62 +0,0 @@ -subroutine Pumps_StartUp - use CPumpsVariables - use CPumps - use SimulationVariables - IMPLICIT NONE - - - !>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< - data%State%Pump(1)%FlowRatePerSTK = data%Configuration%Pumps%MudPump1VolumetricOutput !.1d0 ![bbl/stk] - data%State%Pump(1)%RateChange = data%Configuration%Pumps%MudPump1PumpRateChange ![stk/min2 ??] - data%State%Pump(1)%DelayToShutdown = data%Configuration%Pumps%MudPump1DelayToShutdown ![min] - data%State%Pump(1)%Mech_Efficiency = data%Configuration%Pumps%MudPump1MechanicalEfficiency ![dimensionless] - !data%State%Pump(1)%Vol_Efficiency = MudPump1VolumetricEfficiency !bayad hazf beshe ? - data%State%Pump(1)%Max_Pressure = data%Configuration%Pumps%MudPump1MaximumPressure !6000.d0 ![psi] - data%State%Pump(1)%MaxSPM = data%Configuration%Pumps%MudPump1Maximum ![spm] - data%State%Pump(1)%Trans_Ratio = 965.d0/data%State%Pump(1)%MaxSPM - data%State%Pump(1)%time_step = 0.1d0 !?????? niaz hast ya na?? - - data%State%Pump(1)%RateChange = (data%State%Pump(1)%RateChange*data%State%Pump(1)%Trans_Ratio)/60.d0 ![rpm/s ??] 24/60 - data%State%Pump(1)%DelayToShutdown = data%State%Pump(1)%DelayToShutdown/60.d0 ![s] - data%State%Pump(1)%K_throttle = 0 - data%State%Pump(1)%N_old = 0.d0 - Call Pump_OffMode_Solver(1) - - - !>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< - data%State%Pump(2)%FlowRatePerSTK = data%Configuration%Pumps%MudPump2VolumetricOutput !.1d0 ![bbl/stk] - data%State%Pump(2)%RateChange = data%Configuration%Pumps%MudPump2PumpRateChange ![stk/min2 ??] - data%State%Pump(2)%DelayToShutdown = data%Configuration%Pumps%MudPump2DelayToShutdown ![min] - data%State%Pump(2)%Mech_Efficiency = data%Configuration%Pumps%MudPump2MechanicalEfficiency ![dimensionless] - !data%State%Pump(2)%Vol_Efficiency = MudPump2VolumetricEfficiency !bayad hazf beshe ? - data%State%Pump(2)%Max_Pressure = data%Configuration%Pumps%MudPump2MaximumPressure !6000.d0 ![psi] - data%State%Pump(2)%MaxSPM = data%Configuration%Pumps%MudPump2Maximum ![spm] - data%State%Pump(2)%Trans_Ratio = 965.d0/data%State%Pump(2)%MaxSPM - data%State%Pump(2)%time_step = 0.1d0 !?????? niaz hast ya na?? - - data%State%Pump(2)%RateChange = (data%State%Pump(2)%RateChange*data%State%Pump(2)%Trans_Ratio)/60.d0 ![rpm/s ??] - data%State%Pump(2)%DelayToShutdown = data%State%Pump(2)%DelayToShutdown/60.d0 ![s] - data%State%Pump(2)%K_throttle = 0 - data%State%Pump(2)%N_old = 0.d0 - Call Pump_OffMode_Solver(2) - - - !!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< - data%State%Pump(3)%FlowRatePerSTK = data%Configuration%Pumps%CementPumpVolumetricOutput !.1d0 ![bbl/stk] - data%State%Pump(3)%RateChange = data%Configuration%Pumps%CementPumpPumpRateChange ![stk/min2 ??] - data%State%Pump(3)%DelayToShutdown = data%Configuration%Pumps%CementPumpDelayToShutdown ![min] - data%State%Pump(3)%Mech_Efficiency = data%Configuration%Pumps%CementPumpMechanicalEfficiency ![dimensionless] - !data%State%Pump(3)%Vol_Efficiency = CementPumpVolumetricEfficiency !bayad hazf beshe ? - data%State%Pump(3)%Max_Pressure = data%Configuration%Pumps%CementPumpMaximumPressure !6000.d0 ![psi] - data%State%Pump(3)%MaxSPM = data%Configuration%Pumps%CementPumpMaximum ![spm] - data%State%Pump(3)%Trans_Ratio = 965.d0/data%State%Pump(3)%MaxSPM - data%State%Pump(3)%time_step = 0.1d0 !?????? niaz hast ya na?? - - data%State%Pump(3)%RateChange = (data%State%Pump(3)%RateChange*data%State%Pump(3)%Trans_Ratio)/60.d0 ![rpm/s ??] - data%State%Pump(3)%DelayToShutdown = data%State%Pump(3)%DelayToShutdown/60.d0 ![s] - data%State%Pump(3)%K_throttle = 0 - data%State%Pump(3)%N_old = 0.d0 - Call Pump_OffMode_Solver(3) - - -end subroutine Pumps_StartUp \ No newline at end of file diff --git a/Equipments/Pumps/Pumps_StartUp.i90 b/Equipments/Pumps/Pumps_StartUp.i90 index f466e5b..4365232 100644 --- a/Equipments/Pumps/Pumps_StartUp.i90 +++ b/Equipments/Pumps/Pumps_StartUp.i90 @@ -1,63 +1 @@ # 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pumps_StartUp.f90" -subroutine Pumps_StartUp - use CPumpsVariables - use CPumps - use SimulationVariables - IMPLICIT NONE - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 1 <<<<<<<<<<<<<<<<<<<<<<<<<<< - data%State%Pump(1)%FlowRatePerSTK = data%Configuration%Pumps%MudPump1VolumetricOutput !.1d0 ![bbl/stk] - data%State%Pump(1)%RateChange = data%Configuration%Pumps%MudPump1PumpRateChange ![stk/min2 ??] - data%State%Pump(1)%DelayToShutdown = data%Configuration%Pumps%MudPump1DelayToShutdown ![min] - data%State%Pump(1)%Mech_Efficiency = data%Configuration%Pumps%MudPump1MechanicalEfficiency ![dimensionless] -!data%State%Pump(1)%Vol_Efficiency = MudPump1VolumetricEfficiency !bayad hazf beshe ? - data%State%Pump(1)%Max_Pressure = data%Configuration%Pumps%MudPump1MaximumPressure !6000.d0 ![psi] - data%State%Pump(1)%MaxSPM = data%Configuration%Pumps%MudPump1Maximum ![spm] - data%State%Pump(1)%Trans_Ratio = 965.d0/data%State%Pump(1)%MaxSPM - data%State%Pump(1)%time_step = 0.1d0 !?????? niaz hast ya na?? - - data%State%Pump(1)%RateChange = (data%State%Pump(1)%RateChange*data%State%Pump(1)%Trans_Ratio)/60.d0 ![rpm/s ??] 24/60 - data%State%Pump(1)%DelayToShutdown = data%State%Pump(1)%DelayToShutdown/60.d0 ![s] - data%State%Pump(1)%K_throttle = 0 - data%State%Pump(1)%N_old = 0.d0 - Call Pump_OffMode_Solver(1) - - -!>>>>>>>>>>>>>>>>>>>>>>> PUMP 2 <<<<<<<<<<<<<<<<<<<<<<<<<<< - data%State%Pump(2)%FlowRatePerSTK = data%Configuration%Pumps%MudPump2VolumetricOutput !.1d0 ![bbl/stk] - data%State%Pump(2)%RateChange = data%Configuration%Pumps%MudPump2PumpRateChange ![stk/min2 ??] - data%State%Pump(2)%DelayToShutdown = data%Configuration%Pumps%MudPump2DelayToShutdown ![min] - data%State%Pump(2)%Mech_Efficiency = data%Configuration%Pumps%MudPump2MechanicalEfficiency ![dimensionless] -!data%State%Pump(2)%Vol_Efficiency = MudPump2VolumetricEfficiency !bayad hazf beshe ? - data%State%Pump(2)%Max_Pressure = data%Configuration%Pumps%MudPump2MaximumPressure !6000.d0 ![psi] - data%State%Pump(2)%MaxSPM = data%Configuration%Pumps%MudPump2Maximum ![spm] - data%State%Pump(2)%Trans_Ratio = 965.d0/data%State%Pump(2)%MaxSPM - data%State%Pump(2)%time_step = 0.1d0 !?????? niaz hast ya na?? - - data%State%Pump(2)%RateChange = (data%State%Pump(2)%RateChange*data%State%Pump(2)%Trans_Ratio)/60.d0 ![rpm/s ??] - data%State%Pump(2)%DelayToShutdown = data%State%Pump(2)%DelayToShutdown/60.d0 ![s] - data%State%Pump(2)%K_throttle = 0 - data%State%Pump(2)%N_old = 0.d0 - Call Pump_OffMode_Solver(2) - - -!!>>>>>>>>>>>>>>>>>>>>>>> PUMP 3 <<<<<<<<<<<<<<<<<<<<<<<<<<< - data%State%Pump(3)%FlowRatePerSTK = data%Configuration%Pumps%CementPumpVolumetricOutput !.1d0 ![bbl/stk] - data%State%Pump(3)%RateChange = data%Configuration%Pumps%CementPumpPumpRateChange ![stk/min2 ??] - data%State%Pump(3)%DelayToShutdown = data%Configuration%Pumps%CementPumpDelayToShutdown ![min] - data%State%Pump(3)%Mech_Efficiency = data%Configuration%Pumps%CementPumpMechanicalEfficiency ![dimensionless] -!data%State%Pump(3)%Vol_Efficiency = CementPumpVolumetricEfficiency !bayad hazf beshe ? - data%State%Pump(3)%Max_Pressure = data%Configuration%Pumps%CementPumpMaximumPressure !6000.d0 ![psi] - data%State%Pump(3)%MaxSPM = data%Configuration%Pumps%CementPumpMaximum ![spm] - data%State%Pump(3)%Trans_Ratio = 965.d0/data%State%Pump(3)%MaxSPM - data%State%Pump(3)%time_step = 0.1d0 !?????? niaz hast ya na?? - - data%State%Pump(3)%RateChange = (data%State%Pump(3)%RateChange*data%State%Pump(3)%Trans_Ratio)/60.d0 ![rpm/s ??] - data%State%Pump(3)%DelayToShutdown = data%State%Pump(3)%DelayToShutdown/60.d0 ![s] - data%State%Pump(3)%K_throttle = 0 - data%State%Pump(3)%N_old = 0.d0 - Call Pump_OffMode_Solver(3) - - -end subroutine Pumps_StartUp diff --git a/Equipments/Pumps/Pumps_TotalSolver.f90 b/Equipments/Pumps/Pumps_TotalSolver.f90 index 3ebfbce..e69de29 100644 --- a/Equipments/Pumps/Pumps_TotalSolver.f90 +++ b/Equipments/Pumps/Pumps_TotalSolver.f90 @@ -1,14 +0,0 @@ -subroutine Pumps_TotalSolver - - use SimulationVariables - - Implicit none - - - - data%State%MPumps%Total_Pump_Gpm = data%State%Pump(1)%Flow_Rate+data%State%Pump(2)%Flow_Rate+data%State%Pump(3)%Flow_Rate ![gpm] - data%State%MPumps%Total_Pump_SPM = (data%State%Pump(1)%Speed/data%State%Pump(1)%Trans_Ratio)+(data%State%Pump(2)%Speed/data%State%Pump(2)%Trans_Ratio)+(data%State%Pump(3)%Speed/data%State%Pump(3)%Trans_Ratio) ![stk/min] - - - -end subroutine Pumps_TotalSolver \ No newline at end of file diff --git a/Equipments/Pumps/Pumps_TotalSolver.i90 b/Equipments/Pumps/Pumps_TotalSolver.i90 new file mode 100644 index 0000000..cf6da90 --- /dev/null +++ b/Equipments/Pumps/Pumps_TotalSolver.i90 @@ -0,0 +1 @@ +# 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pumps_TotalSolver.f90" diff --git a/Equipments/Pumps/Pumps_VARIABLES.f90 b/Equipments/Pumps/Pumps_VARIABLES.f90 index bd4869c..c35db3d 100644 --- a/Equipments/Pumps/Pumps_VARIABLES.f90 +++ b/Equipments/Pumps/Pumps_VARIABLES.f90 @@ -12,7 +12,7 @@ MODULE Pumps_VARIABLES Type, public:: Pumps_Var REAL :: Total_Pump_GPM, Total_Pump_SPM, Total_Stroke_Counter_For_Plot end Type Pumps_Var - Type(Pumps_Var) :: MPumps + ! Type(Pumps_Var) :: MPumps @@ -20,25 +20,25 @@ MODULE Pumps_VARIABLES !**************** Define PUMP Array ************************************************************ TYPE, PUBLIC :: Pump_Var -!***** Pump_VARIABLES *************************** - INTEGER :: AssignmentSwitchh, Switch, K_throttle - INTEGER :: PowerFailMalf , BlowPopOffMalf , SPMGaugeMalf , Failure + !***** Pump_VARIABLES *************************** + INTEGER :: AssignmentSwitchh, Switch, K_throttle + INTEGER :: PowerFailMalf , BlowPopOffMalf , SPMGaugeMalf , Failure - REAL :: Throttle, RateChange, DelayToShutdown - REAL :: Mech_Efficiency, Vol_Efficiency, Trans_Ratio - REAL :: StandPipe_Pressure , Max_Pressure - REAL :: Speed, N_new, N_old, MaxSPM - REAL :: Flow_Rate, Hydraulic_HorsePower, Max_Horsepower, FlowRatePerSTK, Max_FlowRate, HorsePower - REAL :: time_step - - - - INTEGER :: BLWR ! 1=On , 0=Off - INTEGER :: Open_Close ! 1=Open , 0=Close - -!************* Sound_VARIABLES ********************** - INTEGER :: SoundSPM - Logical :: SoundBlower + REAL :: Throttle, RateChange, DelayToShutdown + REAL :: Mech_Efficiency, Vol_Efficiency, Trans_Ratio + REAL :: StandPipe_Pressure , Max_Pressure + REAL :: Speed, N_new, N_old, MaxSPM + REAL :: Flow_Rate, Hydraulic_HorsePower, Max_Horsepower, FlowRatePerSTK, Max_FlowRate, HorsePower + REAL :: time_step + + + + INTEGER :: BLWR ! 1=On , 0=Off + INTEGER :: Open_Close ! 1=Open , 0=Close + + !************* Sound_VARIABLES ********************** + INTEGER :: SoundSPM + Logical :: SoundBlower END TYPE Pump_Var diff --git a/Equipments/Pumps/Pumps_VARIABLES.i90 b/Equipments/Pumps/Pumps_VARIABLES.i90 index bea4591..311d927 100644 --- a/Equipments/Pumps/Pumps_VARIABLES.i90 +++ b/Equipments/Pumps/Pumps_VARIABLES.i90 @@ -13,7 +13,7 @@ MODULE Pumps_VARIABLES Type, public:: Pumps_Var REAL :: Total_Pump_GPM, Total_Pump_SPM, Total_Stroke_Counter_For_Plot end Type Pumps_Var - Type(Pumps_Var) :: MPumps +! Type(Pumps_Var) :: MPumps @@ -22,24 +22,24 @@ MODULE Pumps_VARIABLES TYPE, PUBLIC :: Pump_Var !***** Pump_VARIABLES *************************** - INTEGER :: AssignmentSwitchh, Switch, K_throttle - INTEGER :: PowerFailMalf , BlowPopOffMalf , SPMGaugeMalf , Failure + INTEGER :: AssignmentSwitchh, Switch, K_throttle + INTEGER :: PowerFailMalf , BlowPopOffMalf , SPMGaugeMalf , Failure - REAL :: Throttle, RateChange, DelayToShutdown - REAL :: Mech_Efficiency, Vol_Efficiency, Trans_Ratio - REAL :: StandPipe_Pressure , Max_Pressure - REAL :: Speed, N_new, N_old, MaxSPM - REAL :: Flow_Rate, Hydraulic_HorsePower, Max_Horsepower, FlowRatePerSTK, Max_FlowRate, HorsePower - REAL :: time_step - - - - INTEGER :: BLWR ! 1=On , 0=Off - INTEGER :: Open_Close ! 1=Open , 0=Close - + REAL :: Throttle, RateChange, DelayToShutdown + REAL :: Mech_Efficiency, Vol_Efficiency, Trans_Ratio + REAL :: StandPipe_Pressure , Max_Pressure + REAL :: Speed, N_new, N_old, MaxSPM + REAL :: Flow_Rate, Hydraulic_HorsePower, Max_Horsepower, FlowRatePerSTK, Max_FlowRate, HorsePower + REAL :: time_step + + + + INTEGER :: BLWR ! 1=On , 0=Off + INTEGER :: Open_Close ! 1=Open , 0=Close + !************* Sound_VARIABLES ********************** - INTEGER :: SoundSPM - Logical :: SoundBlower + INTEGER :: SoundSPM + Logical :: SoundBlower END TYPE Pump_Var diff --git a/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 b/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 index aeaa188..f95865d 100644 --- a/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 +++ b/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 @@ -37,7 +37,7 @@ use SimulationVariables !@ -IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! (mud circulation is normal wellhead may be open or closed) OR (kick is in the well and well head is open) +IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal wellhead may be open or closed) OR (kick is in the well and well head is open) !!!!! Determining flow rate in each section @@ -45,7 +45,7 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( j = data%State%FricPressDrop%OpenholeFirstEl - 1 !!!!!!!!!!!!!!!!!!!!!!!!! flowrates due to external sources like pump and tripping - FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate = (ClingingFactor * FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%Area + FlowEl(data%State%FricPressDrop%StringFirstEl)%Area) * KickVARIABLES%DrillStringSpeed * ConvMintoSec * Convft3toUSgal ! flowrate in annulus due to tripping + FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate = (ClingingFactor * FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%Area + FlowEl(data%State%FricPressDrop%StringFirstEl)%Area) * DrillStringSpeed * ConvMintoSec * Convft3toUSgal ! flowrate in annulus due to tripping FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate = FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate + REAL(data%State%MudSystem%MudVolume_InjectedToBH) * ConvMintoSec / dt ! flowrate in annulus due to pump @@ -62,14 +62,14 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!! initial guess flowrates for opening BOP or choke line - IF (KickVARIABLES%WellHeadWasOpen == .FALSE. .AND. KickVARIABLES%NoGasPocket > 0 .AND. KickIteration == 1) THEN - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN ! flow on choke line + IF (WellHeadWasOpen == .FALSE. .AND. NoGasPocket > 0 .AND. KickIteration == 1) THEN + IF (ChokeKroneckerDelta == 1) THEN ! flow on choke line IF (data%State%FricPressDrop%TotalOpenChokeArea < 0.01 * data%State%Choke%ChokeAreaFullyOpen) THEN WRITE (*,*) 'density , TotalOpenChokeArea' , "data%Equipments%DownHole%Density", data%State%FricPressDrop%TotalOpenChokeArea data%State%FricPressDrop%TotalOpenChokeArea = 0.01 * data%State%Choke%ChokeAreaFullyOpen END IF - data%State%FricPressDrop%Kchoke = (KickVARIABLES%ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.0 ! *4.d0: seyyed gofte - GasPocketFlowInduced%Array(:) = MIN((0.6 / KickVARIABLES%NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(2) / data%State%FricPressDrop%Kchoke)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) + data%State%FricPressDrop%Kchoke = (ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.0 ! *4.d0: seyyed gofte + GasPocketFlowInduced%Array(:) = MIN((0.6 / NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(2) / data%State%FricPressDrop%Kchoke)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) WRITE (*,*) ' PressureGauges(2) , Kchoke' , data%State%PressureDisplay%PressureGauges(2) , data%State%FricPressDrop%Kchoke WRITE (*,*) 'Initial guess after opening choke =', GasPocketFlowInduced%Array(1) @@ -88,7 +88,7 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( ELSE ! flow through bell nipple k = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl data%State%FricPressDrop%KBOP = FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Density / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%ShearRAM%MinimumOpenArea_InBOP)**2) - GasPocketFlowInduced%Array(:) = MIN((0.1 / KickVARIABLES%NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(6) / data%State%FricPressDrop%KBOP)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) + GasPocketFlowInduced%Array(:) = MIN((0.1 / NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(6) / data%State%FricPressDrop%KBOP)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) WRITE (*,*) 'PressureGauges(6), KBOP', data%State%PressureDisplay%PressureGauges(6), data%State%FricPressDrop%KBOP WRITE (*,*) 'Initial guess after opening BOP =', GasPocketFlowInduced%Array(1) END IF @@ -98,10 +98,10 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !!!!!!!!!!!!!!!!!!!!!!!!! flowrates due to expansion of gas pockets or kick influx !i = AnnulusFirstEl !j = OpenholeFirstEl - 1 - IF (KickVARIABLES%NoGasPocket > 0) THEN - DO l = 1 , KickVARIABLES%NoGasPocket !GasPocketFlowEl - k = KickVARIABLES%GasPocketFlowEl(l , 1) - !WRITE (*,*) 'KickVARIABLES%GasPocketFlowEl(l , 1)', l, k, j + IF (NoGasPocket > 0) THEN + DO l = 1 , NoGasPocket !GasPocketFlowEl + k = GasPocketFlowEl(l , 1) + !WRITE (*,*) 'GasPocketFlowEl(l , 1)', l, k, j IF (k == 0) CALL ERRORSTOP('GasPocketFlowEl(l , 1) == 0', l) IF (k >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! gas pocket is in open hole only @@ -131,7 +131,7 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !!!!!!!!!!!!!!!!!!!!!!!!! Calculating Back Pressure, in well to pit path back pressure = 0 ! in well to choke manifold path back pressure is equal to pressure before choke not casing pressure - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN + IF (ChokeKroneckerDelta == 1) THEN IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate < 0.0) THEN WRITE (*,*) ' Negative choke flowrate' @@ -147,16 +147,16 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !write(*,*) 'BackPressure=' , BackPressure !!!!!!!!!!!!!!!!!!!!!!!!! when flow passes through choke manifold, solution process may be unstable - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN ! thus we should stabilize solution + IF (ChokeKroneckerDelta == 1) THEN ! thus we should stabilize solution IF (data%State%FricPressDrop%TotalOpenChokeArea > 0.5 * data%State%Choke%ChokeAreaFullyOpen) THEN - KickVARIABLES%KickCorrectionUnderRelaxation = 0.6 + KickCorrectionUnderRelaxation = 0.6 ELSE IF (data%State%FricPressDrop%TotalOpenChokeArea > 0.1 * data%State%Choke%ChokeAreaFullyOpen) THEN - KickVARIABLES%KickCorrectionUnderRelaxation = 0.5 + KickCorrectionUnderRelaxation = 0.5 ELSE ! TotalOpenChokeArea < 0.1 * ChokeAreaFullyOpen - KickVARIABLES%KickCorrectionUnderRelaxation = 0.4 + KickCorrectionUnderRelaxation = 0.4 END IF ELSE - KickVARIABLES%KickCorrectionUnderRelaxation = 0.6 + KickCorrectionUnderRelaxation = 0.6 END IF !!!!!!!!!!!!!!!!!!!!!!!!! @@ -201,12 +201,12 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( ELSE ! wellhead is closed and kick is in the well !WRITE (*,*) ' well head is closed' - k = KickVARIABLES%GasPocketFlowEl(KickVARIABLES%NoGasPocket , 1) - !WRITE (*,*) 'k, Pocket Press', k, GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - StandardPress + k = GasPocketFlowEl(NoGasPocket , 1) + !WRITE (*,*) 'k, Pocket Press', k, GasPocketOldPress%Array(NoGasPocket) - StandardPress i = data%State%FricPressDrop%AnnulusFirstEl j = data%State%FricPressDrop%OpenholeFirstEl - 1 - FlowEl(k)%StartPress = GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - StandardPress - FlowEl(k)%EndPress = GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - StandardPress + FlowEl(k)%StartPress = GasPocketOldPress%Array(NoGasPocket) - StandardPress + FlowEl(k)%EndPress = GasPocketOldPress%Array(NoGasPocket) - StandardPress IF (k > data%State%FricPressDrop%OpenholeFirstEl - 1) THEN ! Top pocket StartX is in Open hole !WRITE (*,*) 'here 1' DO l = k - 1 , data%State%FricPressDrop%OpenholeFirstEl , -1 ! below elements in openhole @@ -274,7 +274,7 @@ END IF !!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! - KickVARIABLES%BottomHolePress = FlowEl(data%State%FricPressDrop%OpenholeFirstEl)%StartPress + BottomHolePress = FlowEl(data%State%FricPressDrop%OpenholeFirstEl)%StartPress !!!!!!!!!!!!!!!!!!!!!! diff --git a/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.i90 b/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.i90 index 90c37a2..3fbef2a 100644 --- a/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.i90 +++ b/FluidFlow/Annulus_and_Openhole_Pressure_Distribution.i90 @@ -38,7 +38,7 @@ use SimulationVariables !@ -IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! (mud circulation is normal wellhead may be open or closed) OR (kick is in the well and well head is open) +IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal wellhead may be open or closed) OR (kick is in the well and well head is open) !!!!! Determining flow rate in each section @@ -46,7 +46,7 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( j = data%State%FricPressDrop%OpenholeFirstEl - 1 !!!!!!!!!!!!!!!!!!!!!!!!! flowrates due to external sources like pump and tripping - FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate = (ClingingFactor * FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%Area + FlowEl(data%State%FricPressDrop%StringFirstEl)%Area) * KickVARIABLES%DrillStringSpeed * ConvMintoSec * Convft3toUSgal ! flowrate in annulus due to tripping + FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate = (ClingingFactor * FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%Area + FlowEl(data%State%FricPressDrop%StringFirstEl)%Area) * DrillStringSpeed * ConvMintoSec * Convft3toUSgal ! flowrate in annulus due to tripping FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate = FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate + REAL(data%State%MudSystem%MudVolume_InjectedToBH) * ConvMintoSec / dt ! flowrate in annulus due to pump @@ -63,14 +63,14 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!! initial guess flowrates for opening BOP or choke line - IF (KickVARIABLES%WellHeadWasOpen == .FALSE. .AND. KickVARIABLES%NoGasPocket > 0 .AND. KickIteration == 1) THEN - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN ! flow on choke line + IF (WellHeadWasOpen == .FALSE. .AND. NoGasPocket > 0 .AND. KickIteration == 1) THEN + IF (ChokeKroneckerDelta == 1) THEN ! flow on choke line IF (data%State%FricPressDrop%TotalOpenChokeArea < 0.01 * data%State%Choke%ChokeAreaFullyOpen) THEN WRITE (*,*) 'density , TotalOpenChokeArea' , "data%Equipments%DownHole%Density", data%State%FricPressDrop%TotalOpenChokeArea data%State%FricPressDrop%TotalOpenChokeArea = 0.01 * data%State%Choke%ChokeAreaFullyOpen END IF - data%State%FricPressDrop%Kchoke = (KickVARIABLES%ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.0 ! *4.d0: seyyed gofte - GasPocketFlowInduced%Array(:) = MIN((0.6 / KickVARIABLES%NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(2) / data%State%FricPressDrop%Kchoke)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) + data%State%FricPressDrop%Kchoke = (ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.0 ! *4.d0: seyyed gofte + GasPocketFlowInduced%Array(:) = MIN((0.6 / NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(2) / data%State%FricPressDrop%Kchoke)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) WRITE (*,*) ' PressureGauges(2) , Kchoke' , data%State%PressureDisplay%PressureGauges(2) , data%State%FricPressDrop%Kchoke WRITE (*,*) 'Initial guess after opening choke =', GasPocketFlowInduced%Array(1) @@ -89,7 +89,7 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( ELSE ! flow through bell nipple k = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl data%State%FricPressDrop%KBOP = FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Density / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%ShearRAM%MinimumOpenArea_InBOP)**2) - GasPocketFlowInduced%Array(:) = MIN((0.1 / KickVARIABLES%NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(6) / data%State%FricPressDrop%KBOP)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) + GasPocketFlowInduced%Array(:) = MIN((0.1 / NoGasPocket * SQRT(data%State%PressureDisplay%PressureGauges(6) / data%State%FricPressDrop%KBOP)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt)) WRITE (*,*) 'PressureGauges(6), KBOP', data%State%PressureDisplay%PressureGauges(6), data%State%FricPressDrop%KBOP WRITE (*,*) 'Initial guess after opening BOP =', GasPocketFlowInduced%Array(1) END IF @@ -99,10 +99,10 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !!!!!!!!!!!!!!!!!!!!!!!!! flowrates due to expansion of gas pockets or kick influx !i = AnnulusFirstEl !j = OpenholeFirstEl - 1 - IF (KickVARIABLES%NoGasPocket > 0) THEN - DO l = 1 , KickVARIABLES%NoGasPocket !GasPocketFlowEl - k = KickVARIABLES%GasPocketFlowEl(l , 1) -!WRITE (*,*) 'KickVARIABLES%GasPocketFlowEl(l , 1)', l, k, j + IF (NoGasPocket > 0) THEN + DO l = 1 , NoGasPocket !GasPocketFlowEl + k = GasPocketFlowEl(l , 1) +!WRITE (*,*) 'GasPocketFlowEl(l , 1)', l, k, j IF (k == 0) CALL ERRORSTOP('GasPocketFlowEl(l , 1) == 0', l) IF (k >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! gas pocket is in open hole only @@ -132,7 +132,7 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !!!!!!!!!!!!!!!!!!!!!!!!! Calculating Back Pressure, in well to pit path back pressure = 0 ! in well to choke manifold path back pressure is equal to pressure before choke not casing pressure - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN + IF (ChokeKroneckerDelta == 1) THEN IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%FlowRate < 0.0) THEN WRITE (*,*) ' Negative choke flowrate' @@ -148,16 +148,16 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( !write(*,*) 'BackPressure=' , BackPressure !!!!!!!!!!!!!!!!!!!!!!!!! when flow passes through choke manifold, solution process may be unstable - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN ! thus we should stabilize solution + IF (ChokeKroneckerDelta == 1) THEN ! thus we should stabilize solution IF (data%State%FricPressDrop%TotalOpenChokeArea > 0.5 * data%State%Choke%ChokeAreaFullyOpen) THEN - KickVARIABLES%KickCorrectionUnderRelaxation = 0.6 + KickCorrectionUnderRelaxation = 0.6 ELSE IF (data%State%FricPressDrop%TotalOpenChokeArea > 0.1 * data%State%Choke%ChokeAreaFullyOpen) THEN - KickVARIABLES%KickCorrectionUnderRelaxation = 0.5 + KickCorrectionUnderRelaxation = 0.5 ELSE ! TotalOpenChokeArea < 0.1 * ChokeAreaFullyOpen - KickVARIABLES%KickCorrectionUnderRelaxation = 0.4 + KickCorrectionUnderRelaxation = 0.4 END IF ELSE - KickVARIABLES%KickCorrectionUnderRelaxation = 0.6 + KickCorrectionUnderRelaxation = 0.6 END IF !!!!!!!!!!!!!!!!!!!!!!!!! @@ -202,12 +202,12 @@ IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket == 0) THEN !! ( ELSE ! wellhead is closed and kick is in the well !WRITE (*,*) ' well head is closed' - k = KickVARIABLES%GasPocketFlowEl(KickVARIABLES%NoGasPocket , 1) -!WRITE (*,*) 'k, Pocket Press', k, GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - StandardPress + k = GasPocketFlowEl(NoGasPocket , 1) +!WRITE (*,*) 'k, Pocket Press', k, GasPocketOldPress%Array(NoGasPocket) - StandardPress i = data%State%FricPressDrop%AnnulusFirstEl j = data%State%FricPressDrop%OpenholeFirstEl - 1 - FlowEl(k)%StartPress = GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - StandardPress - FlowEl(k)%EndPress = GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - StandardPress + FlowEl(k)%StartPress = GasPocketOldPress%Array(NoGasPocket) - StandardPress + FlowEl(k)%EndPress = GasPocketOldPress%Array(NoGasPocket) - StandardPress IF (k > data%State%FricPressDrop%OpenholeFirstEl - 1) THEN ! Top pocket StartX is in Open hole !WRITE (*,*) 'here 1' DO l = k - 1 , data%State%FricPressDrop%OpenholeFirstEl , -1 ! below elements in openhole @@ -275,7 +275,7 @@ END IF !!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! - KickVARIABLES%BottomHolePress = FlowEl(data%State%FricPressDrop%OpenholeFirstEl)%StartPress + BottomHolePress = FlowEl(data%State%FricPressDrop%OpenholeFirstEl)%StartPress !!!!!!!!!!!!!!!!!!!!!! diff --git a/FluidFlow/Flow_Startup.f90 b/FluidFlow/Flow_Startup.f90 index e306c25..013ea8e 100644 --- a/FluidFlow/Flow_Startup.f90 +++ b/FluidFlow/Flow_Startup.f90 @@ -26,36 +26,36 @@ use SimulationVariables !@, pi4 => pi Theta300Refrence = 37.2 Theta600Refrence = 60.2 - KickVARIABLES%KickSinglePocket = Reservoir%MakeKickSinglePacket - IF (KickVARIABLES%KickSinglePocket) THEN - KickVARIABLES%MaxGasPocket = 1 + KickSinglePocket = Reservoir%MakeKickSinglePacket + IF (KickSinglePocket) THEN + MaxGasPocket = 1 ELSE - KickVARIABLES%MaxGasPocket = 4 + MaxGasPocket = 4 END IF - KickVARIABLES%MaxChokeDensityChange = 25.0 ! [ppg/min] - KickVARIABLES%ChokeMinDensity = 2.0 + MaxChokeDensityChange = 25.0 ! [ppg/min] + ChokeMinDensity = 2.0 - KickVARIABLES%ChokeDensity = data%Configuration%Mud%ActiveDensity + ChokeDensity = data%Configuration%Mud%ActiveDensity - KickVARIABLES%MinKickVol = 0.5 ! USGal + MinKickVol = 0.5 ! USGal - KickVARIABLES%SecondaryKickVol = 0.0 - KickVARIABLES%SecondaryKickWeight = 0.0 + SecondaryKickVol = 0.0 + SecondaryKickWeight = 0.0 - KickVARIABLES%NoGasPocket = 0 ! No Kick - KickVARIABLES%WellHeadOpen = .TRUE. - KickVARIABLES%WellHeadWasOpen = .TRUE. + NoGasPocket = 0 ! No Kick + WellHeadOpen = .TRUE. + WellHeadWasOpen = .TRUE. data%State%FricPressDrop%BackPressure = 0.0 - KickVARIABLES%GasKickPumpFlowRate = 0.0 + GasKickPumpFlowRate = 0.0 data%Equipments%DownHole%KickVolume = 0.0 data%Equipments%DownHole%InfluxRate = 0.0 - KickVARIABLES%ExitMass = 0.0 - KickVARIABLES%MinAllowableKickVol = 1.0 * (42.0 / Convft3toUSgal) ! 1 bbl * 42 gal/bbl / 7.48 gal/ft^3 = ... ft^3 + ExitMass = 0.0 + MinAllowableKickVol = 1.0 * (42.0 / Convft3toUSgal) ! 1 bbl * 42 gal/bbl / 7.48 gal/ft^3 = ... ft^3 data%State%FricPressDrop%StCompressedMudVol = 0.0 data%State%FricPressDrop%AnnCompressedMudVol = 0.0 - KickVARIABLES%KickFlux = .FALSE. - KickVARIABLES%KickOffBottom = .FALSE. - KickVARIABLES%KickWasExitingThroughChoke = .FALSE. + KickFlux = .FALSE. + KickOffBottom = .FALSE. + KickWasExitingThroughChoke = .FALSE. data%State%FricPressDrop%FloatValveOpen = .TRUE. data%State%Choke%ChokeAreaFullyOpen = 123.0 / 64.0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2 diff --git a/FluidFlow/Flow_Startup.i90 b/FluidFlow/Flow_Startup.i90 index f92920b..a51584e 100644 --- a/FluidFlow/Flow_Startup.i90 +++ b/FluidFlow/Flow_Startup.i90 @@ -23,37 +23,40 @@ use SimulationVariables !@, pi4 => pi INTEGER :: i data%State%PressureDisplay%PressureGauges(:) = 0.0 + + Theta300Refrence = 37.2 + Theta600Refrence = 60.2 - KickVARIABLES%KickSinglePocket = Reservoir%MakeKickSinglePacket - IF (KickVARIABLES%KickSinglePocket) THEN - KickVARIABLES%MaxGasPocket = 1 + KickSinglePocket = Reservoir%MakeKickSinglePacket + IF (KickSinglePocket) THEN + MaxGasPocket = 1 ELSE - KickVARIABLES%MaxGasPocket = 4 + MaxGasPocket = 4 END IF - KickVARIABLES%MaxChokeDensityChange = 25.0 ! [ppg/min] - KickVARIABLES%ChokeMinDensity = 2.0 + MaxChokeDensityChange = 25.0 ! [ppg/min] + ChokeMinDensity = 2.0 - KickVARIABLES%ChokeDensity = data%Configuration%Mud%ActiveDensity + ChokeDensity = data%Configuration%Mud%ActiveDensity - KickVARIABLES%MinKickVol = 0.5 ! USGal + MinKickVol = 0.5 ! USGal - KickVARIABLES%SecondaryKickVol = 0.0 - KickVARIABLES%SecondaryKickWeight = 0.0 + SecondaryKickVol = 0.0 + SecondaryKickWeight = 0.0 - KickVARIABLES%NoGasPocket = 0 ! No Kick - KickVARIABLES%WellHeadOpen = .TRUE. - KickVARIABLES%WellHeadWasOpen = .TRUE. + NoGasPocket = 0 ! No Kick + WellHeadOpen = .TRUE. + WellHeadWasOpen = .TRUE. data%State%FricPressDrop%BackPressure = 0.0 - KickVARIABLES%GasKickPumpFlowRate = 0.0 + GasKickPumpFlowRate = 0.0 data%Equipments%DownHole%KickVolume = 0.0 data%Equipments%DownHole%InfluxRate = 0.0 - KickVARIABLES%ExitMass = 0.0 - KickVARIABLES%MinAllowableKickVol = 1.0 * (42.0 / Convft3toUSgal) ! 1 bbl * 42 gal/bbl / 7.48 gal/ft^3 = ... ft^3 + ExitMass = 0.0 + MinAllowableKickVol = 1.0 * (42.0 / Convft3toUSgal) ! 1 bbl * 42 gal/bbl / 7.48 gal/ft^3 = ... ft^3 data%State%FricPressDrop%StCompressedMudVol = 0.0 data%State%FricPressDrop%AnnCompressedMudVol = 0.0 - KickVARIABLES%KickFlux = .FALSE. - KickVARIABLES%KickOffBottom = .FALSE. - KickVARIABLES%KickWasExitingThroughChoke = .FALSE. + KickFlux = .FALSE. + KickOffBottom = .FALSE. + KickWasExitingThroughChoke = .FALSE. data%State%FricPressDrop%FloatValveOpen = .TRUE. data%State%Choke%ChokeAreaFullyOpen = 123.0 / 64.0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2 @@ -114,8 +117,8 @@ use SimulationVariables !@, pi4 => pi data%State%GasType(3)%GasConstant = RUniversal / data%State%GasType(2)%MolarWt !!!!!!!! Mud density and viscosity - Theta600Refrence = data%Configuration%Mud%ActiveThetaSixHundred - Theta300Refrence = data%Configuration%Mud%ActiveThetaThreeHundred +! Theta600Refrence = data%Configuration%Mud%ActiveThetaSixHundred +! Theta300Refrence = data%Configuration%Mud%ActiveThetaThreeHundred DensityRefrence = data%Configuration%Mud%ActiveDensity END SUBROUTINE diff --git a/FluidFlow/Flow_Startup_VARIABLES.i90 b/FluidFlow/Flow_Startup_VARIABLES.i90 new file mode 100644 index 0000000..0665f95 --- /dev/null +++ b/FluidFlow/Flow_Startup_VARIABLES.i90 @@ -0,0 +1,63 @@ +# 1 "/home/admin/SimulationCore2/FluidFlow/Flow_Startup_VARIABLES.f90" +MODULE Fluid_Flow_Startup_Vars + +!!! In this module constants and conversion factors are stated + + REAL , PARAMETER :: RUniversal = 10.73159 ! [psia.ft^3/(lbmole.R)] + REAL , PARAMETER :: RUniversalSI = 8.314 * 10**6 ! [Pa.cm^3/(mole.K)] +! REAL , PARAMETER :: PI = 3.141593 ! Pi number + REAL , PARAMETER :: StandardPress = 14.7 ! [psia] + REAL , PARAMETER :: StandardTemp = 519.67 ! 60 F [R] , Temp F = Temp R + 459.67 + REAL , PARAMETER :: dt = 0.1 ! time step = 0.1 [s] + REAL , PARAMETER :: GasDensityRefrence = 28.96 ! molar weight of air [lbm/lbmole] + +!! Tolerance and convergence or error criteria + REAL , PARAMETER :: UTubePressTolerance = 4 ! minimum pressure tolerance between two arms of U tube for which calculations will stop [psi] +!REAL , PARAMETER :: PressDensityTolerance = 2 ! Pressure Density Tolerance: for flow elements with density below this amount (usually gas pockets), +! frictional and gravitional pressure gradients are neglected [ppg] + REAL , PARAMETER :: PressLengthTolerance = 0.0 ! Pressure Length Tolerance: for flow elements with length below this amount, +! frictional and gravitional pressure gradients are neglected [ft] + REAL , PARAMETER :: PressFlowrateTolerance = 0.2 ! Pressure Flowrate Tolerance: for flow elements with flowrates below this amount, +! frictional pressure gradients are neglected [gpm] + REAL , PARAMETER :: KickConvergenceTolerance = 0.05 ! absolute value of maximum error in calculation of gas kick pressure and flowrate + +!!!!!!!!!!!!!!!!!! Conversion factors + REAL , PARAMETER :: Convlbftolbm = 32.174 ! 1 lbf = 32.174 lbm*ft/s^2 + REAL , PARAMETER :: Convft3toUSgal = 7.48052 ! 1 ft^3 = 7.48052 US gal + REAL , PARAMETER :: Convfttom = 0.3048 ! 1 ft = 0.3048 m + REAL , PARAMETER :: Convfttoinch = 12.0 ! 1 ft = 12 inch + REAL , PARAMETER :: Convdaytohour = 24.0 ! 1 day = 24 hour + REAL , PARAMETER :: Convhourtomin = 60.0 ! 1 hour = 60 min + REAL , PARAMETER :: Convmintosec = 60.0 ! 1 min = 60 sec + REAL , PARAMETER :: ConvpsitoPa = 6894.76 ! 1 psi = 6894.76 pa + REAL , PARAMETER :: ConvRtoK = 0.555556 ! 1 R = 0.555556 K + REAL , PARAMETER :: Convpcftogpcm3 = 0.0160185 ! 1 lbm/ft^3 = 0.0160185 gr/cm^3 +!!!!!!!!!!!!!!!!! + +!!!!!!! Bit data !!!!!! +! Type :: BitDataType + LOGICAL :: BitTrue ! bit may be present (.TRUE.) or may be absent(.FALSE.) + REAL :: BitNozzleArea ! area of a nozzle + INTEGER :: BitNozzleNum ! Number of bit nozzles + REAL :: BitNozzDia ! nozzle diameter in 1/32 in + REAL :: BitTotNozzArea ! Total bit area + REAL :: BitCd ! Discharge coefficient + REAL :: BitPressLoss ! bit pressure loss [psi] +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + REAL :: Theta600Refrence , Theta300Refrence ! Fann data (Theta600 and Theta300) of active tank (input from panel) + REAL :: DensityRefrence ! Density of active tank mud (input from panel) [gpm] +! End Type BitDataType +! Type(BitDataType)::BitData + + TYPE, PUBLIC :: GasData + REAL :: CritPress ! critical pressure [psia] + REAL :: CritTemp ! critical temperature [R] + REAL :: MolarWt ! molar weight [lbm/lbmole] + REAL :: StDensity ! density at standard pressure (14.7 psi) and temperature (60 F = 520 Ra) [lbm/ft^3] + REAL :: GasConstant ! Gas constant = RUniversal/MolarWt [psia.ft^3/(R.lbm)] + END TYPE GasData + + + END MODULE + diff --git a/FluidFlow/Fluid_Flow_Solver.f90 b/FluidFlow/Fluid_Flow_Solver.f90 index f33d996..2768c2e 100644 --- a/FluidFlow/Fluid_Flow_Solver.f90 +++ b/FluidFlow/Fluid_Flow_Solver.f90 @@ -37,13 +37,13 @@ subroutine Fluid_Flow_Solver CALL PressureAnnAndOHDistribution - IF (KickVARIABLES%NoGasPocket > 0) THEN + IF (NoGasPocket > 0) THEN !KickCorrectionVector(:) = 1. CALL GasKickCalculator END IF - IF (KickVARIABLES%NoGasPocket == 0 .OR. NOT(KickVARIABLES%WellHeadOpen)) EXIT - IF(MAXVAL(ABS(KickVARIABLES%KickVandPFunction(:))) < KickConvergenceTolerance) EXIT + IF (NoGasPocket == 0 .OR. NOT(WellHeadOpen)) EXIT + IF(MAXVAL(ABS(KickVandPFunction(:))) < KickConvergenceTolerance) EXIT !IF(MAXVAL(ABS(KickCorrectionVector(:))) < KickConvergenceTolerance) EXIT @@ -52,8 +52,8 @@ subroutine Fluid_Flow_Solver CALL PressureHorizAndStringDistribution IF (KickIteration == 41) THEN - WRITE (*,*) ' KickCorrectionVector ' , KickVARIABLES%KickCorrectionVector - WRITE (*,*) ' Kick Jacobian = ', KickVARIABLES%KickJacobian + WRITE (*,*) ' KickCorrectionVector ' , KickCorrectionVector + WRITE (*,*) ' Kick Jacobian = ', KickJacobian END IF end subroutine \ No newline at end of file diff --git a/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 b/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 index 7fa32a8..86def2e 100644 --- a/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 +++ b/FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 @@ -10,31 +10,23 @@ SUBROUTINE PressureHorizAndStringDistribution USE FricPressDropVarsModule use PressureDisplayVARIABLESModule USE MudSystemVARIABLES -use SimulationVariables !@@@ + use SimulationVariables !@@@ USE GeoElements_FluidModule USE Fluid_Flow_Startup_Vars use KickVARIABLESModule USE CMudPropertiesVariables use CDataDisplayConsole - use SimulationVariables !, StandPipePressureDataDisplay=> data%Equipments%ChokeControlPanel%StandPipePressure use CDataDisplayConsole - use SimulationVariables !, CasingPressureDataDisplay=> CasingPressure - use SimulationVariables !@ USE CShoeVariables USE CDownHoleVariables! , OperationScenarioCommon%ElevatorConnection => data%Equipments%DownHole%CasingPressure - use SimulationVariables !@ USE CManifolds - use SimulationVariables USE CError use UTUBEVARSModule use OperationScenariosModule - use SimulationVariables USE , INTRINSIC :: IEEE_ARITHMETIC Use TD_DrillStemComponents Use sROP_Variables - - - + IMPLICIT NONE INTEGER :: i , j , l @@ -47,12 +39,12 @@ use SimulationVariables !@@@ REAL(8) :: ShoeTVD !REAL(8) , DIMENSION(5) :: MDObserve , TVDObserve , StPressObserve , AnnPressObserve , NomMD - KickVARIABLES%ExitMass = 0.0 + ExitMass = 0.0 BitPressLoss = 0.0 - KickVARIABLES%WellHeadWasOpen = KickVARIABLES%WellHeadOpen - KickVARIABLES%WellToChokeManifoldWasOpen = data%State%MudSystem%WellToChokeManifoldOpen - KickVARIABLES%KickWasExitingThroughChoke = .FALSE. + WellHeadWasOpen = WellHeadOpen + WellToChokeManifoldWasOpen = data%State%MudSystem%WellToChokeManifoldOpen + KickWasExitingThroughChoke = .FALSE. IF (data%State%MudSystem%UtubeMode1Activated .OR. data%State%FricPressDrop%FloatValveWasOpen == .FALSE.) THEN ! Horizontal line flow rate @@ -72,11 +64,11 @@ use SimulationVariables !@@@ data%State%FricPressDrop%AnnMudVol = SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%Volume) * Convft3toUSGal - IF ( (data%Equipments%DownHole%KickVolume > 2.0) .or. (KickVARIABLES%NoGasPocket>1) .or. (any(FlowEl(data%State%FricPressDrop%OpenholeFirstEl:data%State%FricPressDrop%NumbEl)%Materialtype==1)) .or. (data%State%ROP_Bit%RateofPenetration > 0.0) ) THEN + IF ( (data%Equipments%DownHole%KickVolume > 2.0) .or. (NoGasPocket>1) .or. (any(FlowEl(data%State%FricPressDrop%OpenholeFirstEl:data%State%FricPressDrop%NumbEl)%Materialtype==1)) .or. (data%State%ROP_Bit%RateofPenetration > 0.0) ) THEN data%State%FricPressDrop%AnnCompressedMudVol = 0.0 data%State%FricPressDrop%AnnDeltaPDueToCompressibility = 0.0 - ELSE IF (KickVARIABLES%WellHeadOpen) THEN + ELSE IF (WellHeadOpen) THEN data%State%FricPressDrop%AnnDeltaPtoDeltaVCompressibility = 1.0 / (MudCompressibility * data%State%FricPressDrop%AnnMudVol) data%State%FricPressDrop%AnnCompressedMudVol = data%State%FricPressDrop%BackPressure / data%State%FricPressDrop%AnnDeltaPtoDeltaVCompressibility @@ -89,13 +81,13 @@ use SimulationVariables !@@@ data%State%FricPressDrop%AnnDeltaPDueToCompressibility = data%State%FricPressDrop%AnnCompressedMudVol / (MudCompressibility * data%State%FricPressDrop%AnnMudVol) END IF - IF (data%State%FricPressDrop%FloatValveIn == .FALSE. .OR. KickVARIABLES%NoGasPocket == 0 .OR. (data%State%FricPressDrop%FloatValveWasOpen .AND. REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol)) THEN ! float valve remains open + IF (data%State%FricPressDrop%FloatValveIn == .FALSE. .OR. NoGasPocket == 0 .OR. (data%State%FricPressDrop%FloatValveWasOpen .AND. REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol)) THEN ! float valve remains open data%State%FricPressDrop%FloatValveOpen = .TRUE. FlowEl(data%State%FricPressDrop%StringFirstEl : data%State%FricPressDrop%StringLastEl)%FlowRate = REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) / dt * ConvMinToSec !data%State%MudSystem%StringFlowRate ! String flow rate pump flow rate [gpm] !!!!!!!!!!!!!!! Calculating frictional pressure loss - IF (KickVARIABLES%WellHeadOpen) THEN + IF (WellHeadOpen) THEN DO ifric = 1 , data%State%FricPressDrop%StringLastEl CALL FricPressDrop(ifric) !WRITE (*,*) ' element No, FlowRate , Density, FricPressLoss', ifric, FlowEl(ifric)%FlowRate, FlowEl(ifric)%Density, FlowEl(ifric)%FricPressLoss @@ -115,7 +107,7 @@ use SimulationVariables !@@@ data%State%FricPressDrop%StCompressedMudVol = data%State%FricPressDrop%StCompressedMudVol + REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) data%State%FricPressDrop%StDeltaPDueToCompressibility = data%State%FricPressDrop%StCompressedMudVol * data%State%FricPressDrop%StDeltaPtoDeltaVCompressibility - ELSE IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket > 0) THEN + ELSE IF (WellHeadOpen .OR. NoGasPocket > 0) THEN IF (REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol) THEN data%State%MudSystem%MudVolume_InjectedToBH = data%State%MudSystem%St_Saved_MudDischarged_Volume_Final @@ -173,7 +165,7 @@ use SimulationVariables !@@@ END IF - IF (PressBelowFloatValve >= PressAboveFloatValve .AND. KickVARIABLES%KickFlux) THEN + IF (PressBelowFloatValve >= PressAboveFloatValve .AND. KickFlux) THEN data%State%FricPressDrop%FloatValveOpen = .FALSE. IF (data%State%FricPressDrop%FloatValveOpen /= data%State%FricPressDrop%FloatValveWasOpen) THEN ! float valve was open and now closed WRITE (*,*) 'Float valve was open and now closed' @@ -195,7 +187,7 @@ use SimulationVariables !@@@ END IF - IF (KickVARIABLES%NoGasPocket == 0 .AND. KickVARIABLES%WellHeadOpen == .FALSE.) THEN !*********** + IF (NoGasPocket == 0 .AND. WellHeadOpen == .FALSE.) THEN !*********** FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%StartPress = FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%StartPress + data%State%FricPressDrop%AnnDeltaPDueToCompressibility FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%EndPress = FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%EndPress + data%State%FricPressDrop%AnnDeltaPDueToCompressibility END IF @@ -251,9 +243,9 @@ use SimulationVariables !@@@ IF ((data%State%MudSystem%UtubePossibility == .TRUE. .AND. Get_KellyConnection() /= KELLY_CONNECTION_STRING) .OR. data%State%MudSystem%NewPipeFilling == 0) THEN FlowEl(data%State%FricPressDrop%NoHorizontalEl)%EndPress = 0.0 - ELSE IF (KickVARIABLES%WellHeadOpen == .FALSE.) THEN + ELSE IF (WellHeadOpen == .FALSE.) THEN FlowEl(data%State%FricPressDrop%NoHorizontalEl)%EndPress = FlowEl(data%State%FricPressDrop%StringFirstEl)%StartPress - 0.052 * FlowEl(data%State%FricPressDrop%NoHorizontalEl)%Density * FlowEl(data%State%FricPressDrop%StringFirstEl)%StartTVD - ELSE IF (KickVARIABLES%WellHeadOpen) THEN + ELSE IF (WellHeadOpen) THEN FlowEl(data%State%FricPressDrop%NoHorizontalEl)%EndPress = FlowEl(data%State%FricPressDrop%StringFirstEl)%StartPress - 2.0 * 0.052 * FlowEl(data%State%FricPressDrop%NoHorizontalEl)%Density * FlowEl(data%State%FricPressDrop%StringFirstEl)%StartTVD END IF @@ -283,7 +275,7 @@ use SimulationVariables !@@@ - IF (data%State%MudSystem%UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. KickVARIABLES%WellHeadOpen) THEN + IF (data%State%MudSystem%UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadOpen) THEN data%State%MudSystem%MudVolume_InjectedToBH = 0.d0 data%State%MudSystem%MudVolume_InjectedFromAnn = 0.d0 @@ -394,7 +386,7 @@ use SimulationVariables !@@@ END DO - KickVARIABLES%BottomHolePress = BottomHolePressureDelay%Array(data%State%PressureDisplay%PressureTimeStepDelay(2)) + BottomHolePress = BottomHolePressureDelay%Array(data%State%PressureDisplay%PressureTimeStepDelay(2)) data%Equipments%DownHole%BottomHolePressure = REAL(data%State%PressureDisplay%PressureGauges(3) , 8) !!!!!!!!!!!!!!!!! 4- Under Bit Pressure PressureGauges(4) @@ -462,43 +454,43 @@ use SimulationVariables !@@@ 101 FORMAT(4X, I2, 8X, (F8.1), 12X, (F8.3), 7X, (F8.2)) - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN + IF (ChokeKroneckerDelta == 1) THEN END IF !WRITE (*,*) 'Horiz 1' - KickVARIABLES%KickInFluxConditions = (Reservoir%FormationTop < data%State%TD_WellGeneral%WellTotalVerticalLength) .AND. (NOT(Reservoir%InactiveInflux)) .AND. (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress + 5.0) - IF (KickVARIABLES%KickInFluxConditions) THEN - KickVARIABLES%KickFlux = .TRUE. + KickInFluxConditions = (Reservoir%FormationTop < data%State%TD_WellGeneral%WellTotalVerticalLength) .AND. (NOT(Reservoir%InactiveInflux)) .AND. (FormPressure > BottomHolePress + 5.0) + IF (KickInFluxConditions) THEN + KickFlux = .TRUE. CALL NewGasKick !WRITE (*,*) 'Kick Flux top' , KickFlux - !WRITE (*,*) 'KickVARIABLES%FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength' , FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength + !WRITE (*,*) 'FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength' , FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength ELSE - IF (ALLOCATED(GasPocketWeight%Array) .AND. KickVARIABLES%KickFlux) THEN - KickVARIABLES%KickOffBottom = .TRUE. + IF (ALLOCATED(GasPocketWeight%Array) .AND. KickFlux) THEN + KickOffBottom = .TRUE. WRITE (*,*) 'Kick Off Bottom' - WRITE (*,*) 'FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress + WRITE (*,*) 'FormPressure , BottomHolePress' , FormPressure , BottomHolePress !WRITE (*,*) 'No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm) Flow El Press(psia)' - DO i = 1 , KickVARIABLES%NoGasPocket - WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i), FlowEl(KickVARIABLES%GasPocketFlowEl(i , 1))%StartPress + StandardPress + DO i = 1 , NoGasPocket + WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i), FlowEl(GasPocketFlowEl(i , 1))%StartPress + StandardPress END DO END IF - KickVARIABLES%KickFlux = .FALSE. + KickFlux = .FALSE. END IF - IF (ALLOCATED(KickVARIABLES%KickJacobian)) KickVARIABLES%OldKickJacobian = KickVARIABLES%KickJacobian + IF (ALLOCATED(KickJacobian)) OldKickJacobian = KickJacobian 102 FORMAT (I2, 3X, (F8.1), 2X, (F8.2), 2X, (F8.3), 8X, (F8.2), 10X, (F8.1)) !!!!!!!! Auto Choke Procedure ! DO i = 1 , 5 - ! AreaChange = -1.0 * (BottomHolePressure - (KickVARIABLES%FormPressure + BHPSafetyMargin)) / FlowEl(OpenholeFirstEl - 1)%Flowrare**2 * 89158.0 & - ! * (0.26 * 0.61)**2 * TotalOpenChokeArea**3 / (4.0 * KickVARIABLES%ChokeDensity) + ! AreaChange = -1.0 * (BottomHolePressure - (FormPressure + BHPSafetyMargin)) / FlowEl(OpenholeFirstEl - 1)%Flowrare**2 * 89158.0 & + ! * (0.26 * 0.61)**2 * TotalOpenChokeArea**3 / (4.0 * ChokeDensity) ! data%State%CHOOKE(1)%AreaChokeFinal = data%State%CHOOKE(1)%AreaChokeFinal + AreaChange / * Convfttoinch**2 ! ! @@ -511,19 +503,19 @@ use SimulationVariables !@@@ ! - !WRITE (*,*) ' SecondaryKickWeight', KickVARIABLES%SecondaryKickWeight - !WRITE (*,*) ' SecondaryKickVol', KickVARIABLES%SecondaryKickVol - data%Equipments%DownHole%SecondKickVolume = KickVARIABLES%SecondaryKickVol + !WRITE (*,*) ' SecondaryKickWeight', SecondaryKickWeight + !WRITE (*,*) ' SecondaryKickVol', SecondaryKickVol + data%Equipments%DownHole%SecondKickVolume = SecondaryKickVol - IF (KickVARIABLES%WellHeadOpen == .FALSE. .OR. (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate < PressFlowrateTolerance .AND. FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Flowrate < PressFlowrateTolerance)) THEN + IF (WellHeadOpen == .FALSE. .OR. (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate < PressFlowrateTolerance .AND. FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Flowrate < PressFlowrateTolerance)) THEN data%State%FricPressDrop%OnShakerDensity = 0.0 - ELSE IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%MaterialType == 1 .AND. KickVARIABLES%ChokeKroneckerDelta == 1) THEN + ELSE IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%MaterialType == 1 .AND. ChokeKroneckerDelta == 1) THEN data%State%FricPressDrop%OnShakerDensity = 2.0 - ELSE IF (KickVARIABLES%ChokeKroneckerDelta == 0) THEN + ELSE IF (ChokeKroneckerDelta == 0) THEN data%State%FricPressDrop%OnShakerDensity = FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Density - ELSE IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN !!!(FlowEl(OpenholeFirstEl - 1)%Flowrate > PressFlowrateTolerance .AND. FlowEl(AnnulusLastEl)%Flowrate < PressFlowrateTolerance) THEN + ELSE IF (ChokeKroneckerDelta == 1) THEN !!!(FlowEl(OpenholeFirstEl - 1)%Flowrate > PressFlowrateTolerance .AND. FlowEl(AnnulusLastEl)%Flowrate < PressFlowrateTolerance) THEN data%State%FricPressDrop%OnShakerDensity = FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Density ELSE data%State%FricPressDrop%OnShakerDensity = (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Density * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate & @@ -531,9 +523,10 @@ use SimulationVariables !@@@ END IF !WRITE (*,*) 'ANINT(OnShakerDensity * 100) / 100', ANINT(OnShakerDensity * 100) / 100 , OnShakerDensity CALL Set_MudWeightOut(ANINT(data%State%FricPressDrop%OnShakerDensity * 100) / 100) - + IF (ALLOCATED(FinalFlowEl)) DEALLOCATE(FinalFlowEl) + ! if (print_log) print *, "data%State%FricPressDrop%NumbEl = ",data%State%FricPressDrop%NumbEl ALLOCATE(FinalFlowEl(data%State%FricPressDrop%NumbEl)) FinalFlowEl(:)%StartX = FlowEl(:)%StartX @@ -562,6 +555,7 @@ SUBROUTINE SOLVE_LINEAR_EQUATIONS(A , x , b , error, dim) !! I use this subroutine to solve the linearized equations which uprising in calculation of volume and pressure of gas kick pockets use KickVARIABLESModule + use SimulationVariables IMPLICIT NONE INTEGER , INTENT(IN) :: dim @@ -583,7 +577,7 @@ SUBROUTINE SOLVE_LINEAR_EQUATIONS(A , x , b , error, dim) RETURN END IF n = SIZE(b) - + if (print_log) print *, "m,n = ",m,n ALLOCATE (m(n , n + 1) , temp_row(n + 1)) m(1:n , 1:n) = A m(1:n , n + 1) = b diff --git a/FluidFlow/Horizontal_and_String_Pressure_Distribution.i90 b/FluidFlow/Horizontal_and_String_Pressure_Distribution.i90 index ac0c2f7..a66ffdc 100644 --- a/FluidFlow/Horizontal_and_String_Pressure_Distribution.i90 +++ b/FluidFlow/Horizontal_and_String_Pressure_Distribution.i90 @@ -11,31 +11,23 @@ SUBROUTINE PressureHorizAndStringDistribution USE FricPressDropVarsModule use PressureDisplayVARIABLESModule USE MudSystemVARIABLES -use SimulationVariables !@@@ + use SimulationVariables !@@@ USE GeoElements_FluidModule USE Fluid_Flow_Startup_Vars use KickVARIABLESModule USE CMudPropertiesVariables use CDataDisplayConsole - use SimulationVariables !, StandPipePressureDataDisplay=> data%Equipments%ChokeControlPanel%StandPipePressure use CDataDisplayConsole - use SimulationVariables !, CasingPressureDataDisplay=> CasingPressure - use SimulationVariables !@ USE CShoeVariables USE CDownHoleVariables! , OperationScenarioCommon%ElevatorConnection => data%Equipments%DownHole%CasingPressure - use SimulationVariables !@ USE CManifolds - use SimulationVariables USE CError use UTUBEVARSModule use OperationScenariosModule - use SimulationVariables USE , INTRINSIC :: IEEE_ARITHMETIC Use TD_DrillStemComponents Use sROP_Variables - - - + IMPLICIT NONE INTEGER :: i , j , l @@ -48,12 +40,12 @@ use SimulationVariables !@@@ REAL(8) :: ShoeTVD !REAL(8) , DIMENSION(5) :: MDObserve , TVDObserve , StPressObserve , AnnPressObserve , NomMD - KickVARIABLES%ExitMass = 0.0 + ExitMass = 0.0 BitPressLoss = 0.0 - KickVARIABLES%WellHeadWasOpen = KickVARIABLES%WellHeadOpen - KickVARIABLES%WellToChokeManifoldWasOpen = data%State%MudSystem%WellToChokeManifoldOpen - KickVARIABLES%KickWasExitingThroughChoke = .FALSE. + WellHeadWasOpen = WellHeadOpen + WellToChokeManifoldWasOpen = data%State%MudSystem%WellToChokeManifoldOpen + KickWasExitingThroughChoke = .FALSE. IF (data%State%MudSystem%UtubeMode1Activated .OR. data%State%FricPressDrop%FloatValveWasOpen == .FALSE.) THEN ! Horizontal line flow rate @@ -73,11 +65,11 @@ use SimulationVariables !@@@ data%State%FricPressDrop%AnnMudVol = SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%Volume) * Convft3toUSGal - IF ( (data%Equipments%DownHole%KickVolume > 2.0) .or. (KickVARIABLES%NoGasPocket>1) .or. (any(FlowEl(data%State%FricPressDrop%OpenholeFirstEl:data%State%FricPressDrop%NumbEl)%Materialtype==1)) .or. (data%State%ROP_Bit%RateofPenetration > 0.0) ) THEN + IF ( (data%Equipments%DownHole%KickVolume > 2.0) .or. (NoGasPocket>1) .or. (any(FlowEl(data%State%FricPressDrop%OpenholeFirstEl:data%State%FricPressDrop%NumbEl)%Materialtype==1)) .or. (data%State%ROP_Bit%RateofPenetration > 0.0) ) THEN data%State%FricPressDrop%AnnCompressedMudVol = 0.0 data%State%FricPressDrop%AnnDeltaPDueToCompressibility = 0.0 - ELSE IF (KickVARIABLES%WellHeadOpen) THEN + ELSE IF (WellHeadOpen) THEN data%State%FricPressDrop%AnnDeltaPtoDeltaVCompressibility = 1.0 / (MudCompressibility * data%State%FricPressDrop%AnnMudVol) data%State%FricPressDrop%AnnCompressedMudVol = data%State%FricPressDrop%BackPressure / data%State%FricPressDrop%AnnDeltaPtoDeltaVCompressibility @@ -90,13 +82,13 @@ use SimulationVariables !@@@ data%State%FricPressDrop%AnnDeltaPDueToCompressibility = data%State%FricPressDrop%AnnCompressedMudVol / (MudCompressibility * data%State%FricPressDrop%AnnMudVol) END IF - IF (data%State%FricPressDrop%FloatValveIn == .FALSE. .OR. KickVARIABLES%NoGasPocket == 0 .OR. (data%State%FricPressDrop%FloatValveWasOpen .AND. REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol)) THEN ! float valve remains open + IF (data%State%FricPressDrop%FloatValveIn == .FALSE. .OR. NoGasPocket == 0 .OR. (data%State%FricPressDrop%FloatValveWasOpen .AND. REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol)) THEN ! float valve remains open data%State%FricPressDrop%FloatValveOpen = .TRUE. FlowEl(data%State%FricPressDrop%StringFirstEl : data%State%FricPressDrop%StringLastEl)%FlowRate = REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) / dt * ConvMinToSec !data%State%MudSystem%StringFlowRate ! String flow rate pump flow rate [gpm] !!!!!!!!!!!!!!! Calculating frictional pressure loss - IF (KickVARIABLES%WellHeadOpen) THEN + IF (WellHeadOpen) THEN DO ifric = 1 , data%State%FricPressDrop%StringLastEl CALL FricPressDrop(ifric) !WRITE (*,*) ' element No, FlowRate , Density, FricPressLoss', ifric, FlowEl(ifric)%FlowRate, FlowEl(ifric)%Density, FlowEl(ifric)%FricPressLoss @@ -116,7 +108,7 @@ use SimulationVariables !@@@ data%State%FricPressDrop%StCompressedMudVol = data%State%FricPressDrop%StCompressedMudVol + REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) data%State%FricPressDrop%StDeltaPDueToCompressibility = data%State%FricPressDrop%StCompressedMudVol * data%State%FricPressDrop%StDeltaPtoDeltaVCompressibility - ELSE IF (KickVARIABLES%WellHeadOpen .OR. KickVARIABLES%NoGasPocket > 0) THEN + ELSE IF (WellHeadOpen .OR. NoGasPocket > 0) THEN IF (REAL(data%State%MudSystem%St_Saved_MudDischarged_Volume_Final) >= PumpMinDischargedVol) THEN data%State%MudSystem%MudVolume_InjectedToBH = data%State%MudSystem%St_Saved_MudDischarged_Volume_Final @@ -174,7 +166,7 @@ use SimulationVariables !@@@ END IF - IF (PressBelowFloatValve >= PressAboveFloatValve .AND. KickVARIABLES%KickFlux) THEN + IF (PressBelowFloatValve >= PressAboveFloatValve .AND. KickFlux) THEN data%State%FricPressDrop%FloatValveOpen = .FALSE. IF (data%State%FricPressDrop%FloatValveOpen /= data%State%FricPressDrop%FloatValveWasOpen) THEN ! float valve was open and now closed WRITE (*,*) 'Float valve was open and now closed' @@ -196,7 +188,7 @@ use SimulationVariables !@@@ END IF - IF (KickVARIABLES%NoGasPocket == 0 .AND. KickVARIABLES%WellHeadOpen == .FALSE.) THEN !*********** + IF (NoGasPocket == 0 .AND. WellHeadOpen == .FALSE.) THEN !*********** FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%StartPress = FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%StartPress + data%State%FricPressDrop%AnnDeltaPDueToCompressibility FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%EndPress = FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%NumbEl)%EndPress + data%State%FricPressDrop%AnnDeltaPDueToCompressibility END IF @@ -252,9 +244,9 @@ use SimulationVariables !@@@ IF ((data%State%MudSystem%UtubePossibility == .TRUE. .AND. Get_KellyConnection() /= KELLY_CONNECTION_STRING) .OR. data%State%MudSystem%NewPipeFilling == 0) THEN FlowEl(data%State%FricPressDrop%NoHorizontalEl)%EndPress = 0.0 - ELSE IF (KickVARIABLES%WellHeadOpen == .FALSE.) THEN + ELSE IF (WellHeadOpen == .FALSE.) THEN FlowEl(data%State%FricPressDrop%NoHorizontalEl)%EndPress = FlowEl(data%State%FricPressDrop%StringFirstEl)%StartPress - 0.052 * FlowEl(data%State%FricPressDrop%NoHorizontalEl)%Density * FlowEl(data%State%FricPressDrop%StringFirstEl)%StartTVD - ELSE IF (KickVARIABLES%WellHeadOpen) THEN + ELSE IF (WellHeadOpen) THEN FlowEl(data%State%FricPressDrop%NoHorizontalEl)%EndPress = FlowEl(data%State%FricPressDrop%StringFirstEl)%StartPress - 2.0 * 0.052 * FlowEl(data%State%FricPressDrop%NoHorizontalEl)%Density * FlowEl(data%State%FricPressDrop%StringFirstEl)%StartTVD END IF @@ -284,7 +276,7 @@ use SimulationVariables !@@@ - IF (data%State%MudSystem%UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. KickVARIABLES%WellHeadOpen) THEN + IF (data%State%MudSystem%UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadOpen) THEN data%State%MudSystem%MudVolume_InjectedToBH = 0.d0 data%State%MudSystem%MudVolume_InjectedFromAnn = 0.d0 @@ -395,7 +387,7 @@ use SimulationVariables !@@@ END DO - KickVARIABLES%BottomHolePress = BottomHolePressureDelay%Array(data%State%PressureDisplay%PressureTimeStepDelay(2)) + BottomHolePress = BottomHolePressureDelay%Array(data%State%PressureDisplay%PressureTimeStepDelay(2)) data%Equipments%DownHole%BottomHolePressure = REAL(data%State%PressureDisplay%PressureGauges(3) , 8) !!!!!!!!!!!!!!!!! 4- Under Bit Pressure PressureGauges(4) @@ -414,6 +406,7 @@ use SimulationVariables !@@@ IF (ShoeFlowElNo > data%State%FricPressDrop%NumbEl) THEN WRITE (*,*) 'ShoeDepth =', data%Configuration%Shoe%ShoeDepth + WRITE (*,*) "ShoeFlowElNo= ",ShoeFlowElNo DO i = data%State%FricPressDrop%AnnulusFirstEl , data%State%FricPressDrop%NumbEl WRITE (*,*) 'i, StartX, EndX', i, FlowEl(i)%StartX, FlowEl(i)%EndX END DO @@ -462,43 +455,43 @@ use SimulationVariables !@@@ 101 FORMAT(4X, I2, 8X, (F8.1), 12X, (F8.3), 7X, (F8.2)) - IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN + IF (ChokeKroneckerDelta == 1) THEN END IF !WRITE (*,*) 'Horiz 1' - KickVARIABLES%KickInFluxConditions = (Reservoir%FormationTop < data%State%TD_WellGeneral%WellTotalVerticalLength) .AND. (NOT(Reservoir%InactiveInflux)) .AND. (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress + 5.0) - IF (KickVARIABLES%KickInFluxConditions) THEN - KickVARIABLES%KickFlux = .TRUE. + KickInFluxConditions = (Reservoir%FormationTop < data%State%TD_WellGeneral%WellTotalVerticalLength) .AND. (NOT(Reservoir%InactiveInflux)) .AND. (FormPressure > BottomHolePress + 5.0) + IF (KickInFluxConditions) THEN + KickFlux = .TRUE. CALL NewGasKick !WRITE (*,*) 'Kick Flux top' , KickFlux -!WRITE (*,*) 'KickVARIABLES%FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength' , FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength +!WRITE (*,*) 'FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength' , FormPressure, BottomHolePress, FormationTop, data%State%TD_WellGeneral%WellTotalVerticalLength ELSE - IF (ALLOCATED(GasPocketWeight%Array) .AND. KickVARIABLES%KickFlux) THEN - KickVARIABLES%KickOffBottom = .TRUE. + IF (ALLOCATED(GasPocketWeight%Array) .AND. KickFlux) THEN + KickOffBottom = .TRUE. WRITE (*,*) 'Kick Off Bottom' - WRITE (*,*) 'FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress + WRITE (*,*) 'FormPressure , BottomHolePress' , FormPressure , BottomHolePress !WRITE (*,*) 'No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm) Flow El Press(psia)' - DO i = 1 , KickVARIABLES%NoGasPocket - WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i), FlowEl(KickVARIABLES%GasPocketFlowEl(i , 1))%StartPress + StandardPress + DO i = 1 , NoGasPocket + WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i), FlowEl(GasPocketFlowEl(i , 1))%StartPress + StandardPress END DO END IF - KickVARIABLES%KickFlux = .FALSE. + KickFlux = .FALSE. END IF - IF (ALLOCATED(KickVARIABLES%KickJacobian)) KickVARIABLES%OldKickJacobian = KickVARIABLES%KickJacobian + IF (ALLOCATED(KickJacobian)) OldKickJacobian = KickJacobian 102 FORMAT (I2, 3X, (F8.1), 2X, (F8.2), 2X, (F8.3), 8X, (F8.2), 10X, (F8.1)) !!!!!!!! Auto Choke Procedure ! DO i = 1 , 5 -! AreaChange = -1.0 * (BottomHolePressure - (KickVARIABLES%FormPressure + BHPSafetyMargin)) / FlowEl(OpenholeFirstEl - 1)%Flowrare**2 * 89158.0 & -! * (0.26 * 0.61)**2 * TotalOpenChokeArea**3 / (4.0 * KickVARIABLES%ChokeDensity) +! AreaChange = -1.0 * (BottomHolePressure - (FormPressure + BHPSafetyMargin)) / FlowEl(OpenholeFirstEl - 1)%Flowrare**2 * 89158.0 & +! * (0.26 * 0.61)**2 * TotalOpenChokeArea**3 / (4.0 * ChokeDensity) ! data%State%CHOOKE(1)%AreaChokeFinal = data%State%CHOOKE(1)%AreaChokeFinal + AreaChange / * Convfttoinch**2 ! ! @@ -511,19 +504,19 @@ use SimulationVariables !@@@ ! -!WRITE (*,*) ' SecondaryKickWeight', KickVARIABLES%SecondaryKickWeight -!WRITE (*,*) ' SecondaryKickVol', KickVARIABLES%SecondaryKickVol - data%Equipments%DownHole%SecondKickVolume = KickVARIABLES%SecondaryKickVol +!WRITE (*,*) ' SecondaryKickWeight', SecondaryKickWeight +!WRITE (*,*) ' SecondaryKickVol', SecondaryKickVol + data%Equipments%DownHole%SecondKickVolume = SecondaryKickVol - IF (KickVARIABLES%WellHeadOpen == .FALSE. .OR. (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate < PressFlowrateTolerance .AND. FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Flowrate < PressFlowrateTolerance)) THEN + IF (WellHeadOpen == .FALSE. .OR. (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate < PressFlowrateTolerance .AND. FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Flowrate < PressFlowrateTolerance)) THEN data%State%FricPressDrop%OnShakerDensity = 0.0 - ELSE IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%MaterialType == 1 .AND. KickVARIABLES%ChokeKroneckerDelta == 1) THEN + ELSE IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%MaterialType == 1 .AND. ChokeKroneckerDelta == 1) THEN data%State%FricPressDrop%OnShakerDensity = 2.0 - ELSE IF (KickVARIABLES%ChokeKroneckerDelta == 0) THEN + ELSE IF (ChokeKroneckerDelta == 0) THEN data%State%FricPressDrop%OnShakerDensity = FlowEl(data%State%FricPressDrop%AnnulusLastEl)%Density - ELSE IF (KickVARIABLES%ChokeKroneckerDelta == 1) THEN !!!(FlowEl(OpenholeFirstEl - 1)%Flowrate > PressFlowrateTolerance .AND. FlowEl(AnnulusLastEl)%Flowrate < PressFlowrateTolerance) THEN + ELSE IF (ChokeKroneckerDelta == 1) THEN !!!(FlowEl(OpenholeFirstEl - 1)%Flowrate > PressFlowrateTolerance .AND. FlowEl(AnnulusLastEl)%Flowrate < PressFlowrateTolerance) THEN data%State%FricPressDrop%OnShakerDensity = FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Density ELSE data%State%FricPressDrop%OnShakerDensity = (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Density * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate & @@ -531,9 +524,10 @@ use SimulationVariables !@@@ END IF !WRITE (*,*) 'ANINT(OnShakerDensity * 100) / 100', ANINT(OnShakerDensity * 100) / 100 , OnShakerDensity CALL Set_MudWeightOut(ANINT(data%State%FricPressDrop%OnShakerDensity * 100) / 100) - + IF (ALLOCATED(FinalFlowEl)) DEALLOCATE(FinalFlowEl) +! if (print_log) print *, "data%State%FricPressDrop%NumbEl = ",data%State%FricPressDrop%NumbEl ALLOCATE(FinalFlowEl(data%State%FricPressDrop%NumbEl)) FinalFlowEl(:)%StartX = FlowEl(:)%StartX @@ -562,6 +556,7 @@ SUBROUTINE SOLVE_LINEAR_EQUATIONS(A , x , b , error, dim) !! I use this subroutine to solve the linearized equations which uprising in calculation of volume and pressure of gas kick pockets use KickVARIABLESModule + use SimulationVariables IMPLICIT NONE INTEGER , INTENT(IN) :: dim @@ -583,7 +578,7 @@ SUBROUTINE SOLVE_LINEAR_EQUATIONS(A , x , b , error, dim) RETURN END IF n = SIZE(b) - + if (print_log) print *, "m,n = ",m,n ALLOCATE (m(n , n + 1) , temp_row(n + 1)) m(1:n , 1:n) = A m(1:n , n + 1) = b diff --git a/FluidFlow/Pressure_Distribution_VARIABLES.f90 b/FluidFlow/Pressure_Distribution_VARIABLES.f90 index 07ab767..bf4710e 100644 --- a/FluidFlow/Pressure_Distribution_VARIABLES.f90 +++ b/FluidFlow/Pressure_Distribution_VARIABLES.f90 @@ -171,12 +171,12 @@ SUBROUTINE DeallocateFlowTypes IF (ALLOCATED(GasPocketFlowInduced%Array)) CALL GasPocketFlowInduced%Empty() IF (ALLOCATED(GasPocketDensity%Array)) CALL GasPocketDensity%Empty() IF (ALLOCATED(GasPocketCompressibility%Array)) CALL GasPocketCompressibility%Empty() - IF (ALLOCATED(KickVARIABLES%GasPocketFlowEl)) DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - IF (ALLOCATED(KickVARIABLES%KickJacobian)) DEALLOCATE(KickVARIABLES%KickJacobian) - IF (ALLOCATED(KickVARIABLES%OldKickJacobian)) DEALLOCATE(KickVARIABLES%OldKickJacobian) - IF (ALLOCATED(KickVARIABLES%KickVandPFunction)) DEALLOCATE(KickVARIABLES%KickVandPFunction) - IF (ALLOCATED(KickVARIABLES%KickUnknownVector)) DEALLOCATE(KickVARIABLES%KickUnknownVector) - IF (ALLOCATED(KickVARIABLES%KickCorrectionVector)) DEALLOCATE(KickVARIABLES%KickCorrectionVector) + IF (ALLOCATED(GasPocketFlowEl)) DEALLOCATE(GasPocketFlowEl) + IF (ALLOCATED(KickJacobian)) DEALLOCATE(KickJacobian) + IF (ALLOCATED(OldKickJacobian)) DEALLOCATE(OldKickJacobian) + IF (ALLOCATED(KickVandPFunction)) DEALLOCATE(KickVandPFunction) + IF (ALLOCATED(KickUnknownVector)) DEALLOCATE(KickUnknownVector) + IF (ALLOCATED(KickCorrectionVector)) DEALLOCATE(KickCorrectionVector) END SUBROUTINE DeallocateFlowTypes diff --git a/FluidFlow/Pressure_Distribution_VARIABLES.i90 b/FluidFlow/Pressure_Distribution_VARIABLES.i90 new file mode 100644 index 0000000..4a5e9c4 --- /dev/null +++ b/FluidFlow/Pressure_Distribution_VARIABLES.i90 @@ -0,0 +1,184 @@ +# 1 "/home/admin/SimulationCore2/FluidFlow/Pressure_Distribution_VARIABLES.f90" +MODULE FricPressDropVarsModule +!! Record of revisions +!! Date Programmer Discription of change +!! ------ ------------ ----------------------- +!! 1396/07/26 Sheikh Original code +!! + + IMPLICIT NONE + + TYPE :: FricPressDropVarsTYPE + + REAL :: TotFricPressLoss ! Total Frictional Pressure Loss [psi] + REAL :: FlowrateNearShoe + INTEGER :: NoHorizontalEl ! number of elements in horizontal pump to string line + INTEGER :: NoStringEl ! number of elements in string + INTEGER :: NoAnnulusEl ! number of elements in annulus space + INTEGER :: NoWellToChokeEl ! number of elements in well head to choke manifold + INTEGER :: NoOpenHoleEl ! number of elements in openhole + INTEGER :: NumbEl ! number of flow elements in horizontal line, string, annulus and openhole + INTEGER :: StringFirstEl ! number of first string element + INTEGER :: StringLastEl ! number of last string element + INTEGER :: AnnulusFirstEl ! number of first annulus element + INTEGER :: AnnulusLastEl ! number of last annulus element + INTEGER :: ChokeFirstEl ! number of first choke element + INTEGER :: ChokeLastEl ! number of last choke element + INTEGER :: OpenholeFirstEl ! number of first openhole element + REAL :: KBOP ! DeltaPBOP = KBOP * Q**2 [psi * min^2 / gal^2] + REAL :: KBit ! DeltaPBit = KBit * Q**2 [psi * min^2 / gal^2] + +!!!! Choke Variables + REAL :: BackPressure , NewBackPressure ! back pressure at riser or choke line [psi] + REAL :: Kchoke ! DeltaPchoke = Kchoke * Q**2 [psi * min^2 / gal^2] + REAL :: TotalOpenChokeArea , OldTotalOpenChokeArea , ChokeBypassArea , NewTotalOpenChokeArea , AreaChange + REAL :: BHPSafetyMargin , AChBHPTol ! BHP safety margin and BHP Tolerance in Auto Choke mode [psi] + REAL(8) :: OnShakerDensity ! Outlet Density of well for displaying in drillwatch and data [ppg] + + LOGICAL :: FloatValveIn + LOGICAL :: FloatValveOpen , FloatValveWasOpen + LOGICAL :: BitTotallyPluged + + REAL :: StMudVol ! Total mud volume of Horizontal and String that may be compressed [gal] + REAL :: AnnMudVol ! Total mud volume of Bottom hole, Annulus and Choke line that may be compressed [gal] + REAL :: PumpToManifoldMudVol + REAL :: StCompressedMudVol ! Compressed mud volume in Horizontal and String [gal] + REAL :: AnnCompressedMudVol ! Compressed mud volume in Bottom hole, Annulus and Choke line [gal] + REAL :: PumpToManifoldCompressedMudVol + REAL :: StDeltaPDueToCompressibility ! Pressure increase due to mud compressibility in Horizontal and String [psi] + REAL :: AnnDeltaPDueToCompressibility ! Pressure increase due to mud compressibility in Bottom hole, Annulus and Choke line [psi] (usually when wellhead is closed) + REAL :: PumpToManifoldDeltaPDueToCompressibility + REAL :: StDeltaPtoDeltaVCompressibility ! string pressure change due to compressibility [psi/gal] + REAL :: AnnDeltaPtoDeltaVCompressibility ! annulus and openhole pressure change due to compressibility [psi/gal] + + +!!!! Problem Variables (Choke and Bit) + + INTEGER :: ManChoke1Plug , ManChoke2Plug ! = 1 if choke is plugged , = 0 else + INTEGER :: ManChoke1Washout , ManChoke2Washout ! = 1 if choke is washed out , = 0 else + INTEGER :: BitJetsPlugged , BitJetsWashedOut + INTEGER :: CasingPressure_DataDisplayMalF, CasingPressure_ChokeMalF + +!!!!!! Note that bit is not an element in these calculations + END TYPE FricPressDropVarsTYPE + + + INTEGER :: ShoeFlowElNo ! the flow element that starts from shoe, in other word the number of upper element adjacent to shoe + + REAL :: ClingingFactor = 0.45 ! in calculating surge and swab pressure changes + REAL :: MudCompressibility = 2.7E-6 ! Volumne change relative to Volume/1psi, for example for change of 1000 psi in pressure, volume changes 0.27% [1/psi] + REAL :: FloatValveMinOpenPressure = 1.0 ! minimum pressure that opens the float valve [psi] + + + TYPE, PUBLIC :: PressDropCalcElemInfo + +!! Geometrical variables + REAL(8) :: Length ! Length of a Flow element [ft] + REAL(8) :: DepthDiff ! Difference between depth of start and end of element [ft] + REAL(8) :: StartX , EndX ! start and end point (measured depth) of flow element [ft] + REAL(8) :: StartTVD , EndTVD ! Start and End point True Vertical Depth of flow element [ft] + REAL :: Od , Id , Dhyd ! Outer, Inner and hydraulic diameter of flow element [in] + REAL :: Area ! area of element [ft^2] + INTEGER :: alpha ! geometry factor: 0 = pipe (ID=0) , 1 = annulus + INTEGER :: FrictionDirection ! = 1 if flowrate is positive, so frictional pressure gradient is in direction of preassumed +! flowrate, = -1 if not above condition usually in Swab conditions +!! Flow variables + INTEGER :: MaterialType ! = 0 for mud , = 2 for gas + REAL :: volume , vel , density , FlowRate ! volume [ft^3], velocity [ft/s], density of fluid flow [ppg], flow rate [gpm] + REAL :: Gf ! geometry shear rate correction [-] +!! Rheological and frictional variables + REAL :: Theta600 , Theta300 ! Fann data at 600 and 300 rpm as rheological data +! REAL(8) :: VelCritBing , VelCritPow ! critical velocity in Bingham Plastic and Power law model [ft/min] + REAL :: muPlastic , YieldP ! plastic viscosity [cp] and yield point [lbf/(100*ft^2)] + REAL :: mueff ! Effective or apparent viscosity which is used in calculation of generalized Reynolds number + REAL :: nIndex , kIndex ! n: flow behaivior index [-] and k: consistency factor [lbf*s^n/(100*ft^2)] + REAL :: gammaW , tauW ! shear rate at the wall [1/s] and wall shear stress [lbf/(100*ft^2)] + REAL :: GenRe ! generalized Reynolds number in power law model [-] + REAL :: ReCrit = 2100.0 ! Critical Reynolds number for Newtonian model and Bingham plastic model + REAL :: ReCritLam , ReCritTurb ! laminar and turbulent critical Reynolds + REAL :: f ! Fanning friction factor [-] + REAL :: a , b ! parameters for calculationg friction factor in turbulent regime for power law model [-] + LOGICAL :: LaminarRegime ! = .TRUE. if flow regime is laminar and = .FALSE. if flowregime is not + LOGICAL :: TurbulentRegime ! = .TRUE. if flow regime is turbulent and = .FALSE. if flowregime is not +!! Pressure change variables + REAL :: StartPress , EndPress ! Pressure at start and end of an element [psi] + REAL :: dPdLFric ! frictional pressure drop gradient in each element [psi/ft] + REAL :: dPdLGrav ! gravitional pressure gradient = 0.052 * Density [psi/ft] + REAL :: FricPressLoss ! frictional pressure loss in each element [psi] + REAL :: StaticPressDiff ! static pressure difference between top and bottom of a pocket [psi] always positive + REAL :: FricToQPartialDiff ! partial differentiation of friction relative to volume flow rate + + + + END TYPE PressDropCalcElemInfo + + TYPE (PressDropCalcElemInfo) , ALLOCATABLE :: FlowEl(:) ! FlowEl: Pressure Drop Calculation Elements The dimension is equal to the number of flow elements + + + TYPE, PUBLIC :: FinalPressDropCalcElemInfo + +!!! for use in calculationg properties of a point in 'downhole view' page + + REAL(8) :: StartX , EndX , StartTVD , EndTVD , Length , DepthDiff ! start and end point of flow element [ft] + REAL :: density ! density of fluid flow [ppg], flow rate [gpm] + REAL :: StartPress ! Pressure at start of an element [psi] + REAL :: EndPress ! Pressure at end of an element [psi] + REAL :: dPdLFric ! frictional pressure drop gradient in each element [psi/ft] + REAL :: dPdLGrav ! gravitional pressure gradient = 0.052 * Density [psi/ft] + + END TYPE FinalPressDropCalcElemInfo + + TYPE (FinalPressDropCalcElemInfo) , ALLOCATABLE :: FinalFlowEl(:) ! FlowEl: Pressure Drop Calculation Elements The dimension is equal to the number of flow elements + + + + +END MODULE FricPressDropVarsModule + +MODULE UTUBEVARSModule + + TYPE :: UTUBEVARSTYPE + + REAL :: QUTubeInput ! flow rate from string to annulus which caused by head difference at two sides of U-tube [gpm] + REAL :: QUtubeOutput ! flow rate from annulus to string which caused by head difference at two sides of U-tube [gpm] + REAL :: PressureDp ! pressure at bit or end of drill string from drill string path [psi] + REAL :: PressureAnn ! pressure at bit or end of drill string from annular path [psi] + + END TYPE UTUBEVARSTYPE + TYPE(UTUBEVARSTYPE) :: UTUBEVARS + +END MODULE UTUBEVARSModule + +SUBROUTINE DeallocateFlowTypes + + USE FricPressDropVarsModule + use PressureDisplayVARIABLESModule + use KickVARIABLESModule + + IMPLICIT NONE + + + IF (ALLOCATED(FlowEl)) DEALLOCATE(FlowEl) + IF (ALLOCATED(FinalFlowEl)) DEALLOCATE(FinalFlowEl) + IF (ALLOCATED(GasPocketWeight%Array)) CALL GasPocketWeight%Empty() + IF (ALLOCATED(GasPocketNewPress%Array)) CALL GasPocketNewPress%Empty() + IF (ALLOCATED(GasPocketOldPress%Array)) CALL GasPocketOldPress%Empty() + IF (ALLOCATED(GasPocketNewTemp%Array)) CALL GasPocketNewTemp%Empty() + IF (ALLOCATED(GasPocketOldTemp%Array)) CALL GasPocketOldTemp%Empty() + IF (ALLOCATED(GasPocketNewVol%Array)) CALL GasPocketNewVol%Empty() + IF (ALLOCATED(GasPocketOldVol%Array)) CALL GasPocketOldVol%Empty() + IF (ALLOCATED(GasPocketdeltaVol%Array)) CALL GasPocketdeltaVol%Empty() + IF (ALLOCATED(GasPocketModifiedVol%Array)) CALL GasPocketModifiedVol%Empty() + IF (ALLOCATED(GasPocketFlowInduced%Array)) CALL GasPocketFlowInduced%Empty() + IF (ALLOCATED(GasPocketDensity%Array)) CALL GasPocketDensity%Empty() + IF (ALLOCATED(GasPocketCompressibility%Array)) CALL GasPocketCompressibility%Empty() + IF (ALLOCATED(GasPocketFlowEl)) DEALLOCATE(GasPocketFlowEl) + IF (ALLOCATED(KickJacobian)) DEALLOCATE(KickJacobian) + IF (ALLOCATED(OldKickJacobian)) DEALLOCATE(OldKickJacobian) + IF (ALLOCATED(KickVandPFunction)) DEALLOCATE(KickVandPFunction) + IF (ALLOCATED(KickUnknownVector)) DEALLOCATE(KickUnknownVector) + IF (ALLOCATED(KickCorrectionVector)) DEALLOCATE(KickCorrectionVector) + + +END SUBROUTINE DeallocateFlowTypes + diff --git a/FluidFlow/Well_Pressure_Data_Transfer.f90 b/FluidFlow/Well_Pressure_Data_Transfer.f90 index 89b67ee..d56b806 100644 --- a/FluidFlow/Well_Pressure_Data_Transfer.f90 +++ b/FluidFlow/Well_Pressure_Data_Transfer.f90 @@ -37,7 +37,7 @@ SUBROUTINE WellPressureDataTransfer INTEGER :: i , j REAL :: InstantaneousTotalOpenChokeArea , VolumeDensityProduct - KickVARIABLES%ChokeIsClosing = .FALSE. + ChokeIsClosing = .FALSE. data%State%FricPressDrop%Kchoke = 0.0 data%State%FricPressDrop%KBit = 0.0 @@ -68,21 +68,21 @@ SUBROUTINE WellPressureDataTransfer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - IF(ALLOCATED(KickVARIABLES%GasPocketFlowEl)) DEALLOCATE(KickVARIABLES%GasPocketFlowEl) + IF(ALLOCATED(GasPocketFlowEl)) DEALLOCATE(GasPocketFlowEl) !!!!!!!!!!!!!!!!!!!! Well Head Condition ( Open or Closed ) - KickVARIABLES%ChokeKroneckerDelta = 0 + ChokeKroneckerDelta = 0 IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen == .FALSE.) THEN - KickVARIABLES%WellHeadOpen = .FALSE. + WellHeadOpen = .FALSE. !WRITE (*,*) ' Well Head is closed ' ELSE - KickVARIABLES%WellHeadOpen = .TRUE. + WellHeadOpen = .TRUE. END IF - IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) KickVARIABLES%ChokeKroneckerDelta = 1 + IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) ChokeKroneckerDelta = 1 !WRITE (*,*) ' WelltoPitsOpen=' , WelltoPitsOpen, 'WellToChokeManifoldOpen= ' , WellToChokeManifoldOpen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -92,10 +92,12 @@ SUBROUTINE WellPressureDataTransfer data%State%FricPressDrop%NoStringEl = data%State%MudSystem%NoStringMudElements data%State%FricPressDrop%NoAnnulusEl = data%State%MudSystem%NoCasingMudElements data%State%FricPressDrop%NoWellToChokeEl = 0 - IF (KickVARIABLES%ChokeKroneckerDelta == 1) data%State%FricPressDrop%NoWellToChokeEl = data%State%MudSystem%ChokeLine_Density%Length() + IF (ChokeKroneckerDelta == 1) data%State%FricPressDrop%NoWellToChokeEl = data%State%MudSystem%ChokeLine_Density%Length() data%State%FricPressDrop%NoOpenHoleEl = data%State%MudSystem%NoBottomHoleMudElements data%State%FricPressDrop%NumbEl = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl + data%State%FricPressDrop%NoWellToChokeEl + data%State%FricPressDrop%NoOpenHoleEl - IF(ALLOCATED(FlowEl)) DEALLOCATE(FlowEl) + IF(ALLOCATED(FlowEl)) then + DEALLOCATE(FlowEl) + endif ALLOCATE(FlowEl(data%State%FricPressDrop%NumbEl)) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Transfering Data from module:MudSystemVARIABLES to module:FricPressDropVars to calculate Pressure distribution in flow path @@ -377,32 +379,32 @@ SUBROUTINE WellPressureDataTransfer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! Well Head Condition ( Open or Closed ) - KickVARIABLES%ChokeKroneckerDelta = 0 + ChokeKroneckerDelta = 0 !WRITE (*,*) ' WelltoPitsOpen = ', WelltoPitsOpen !WRITE (*,*) ' WellToChokeManifoldOpen = ', WellToChokeManifoldOpen IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen == .FALSE.) THEN !WRITE (*,*) ' WelltoPitsOpen = ', WelltoPitsOpen !WRITE (*,*) ' WellToChokeManifoldOpen = ', WellToChokeManifoldOpen - KickVARIABLES%WellHeadOpen = .FALSE. + WellHeadOpen = .FALSE. !WRITE (*,*) ' Well Head is closed ' ELSE - KickVARIABLES%WellHeadOpen = .TRUE. + WellHeadOpen = .TRUE. END IF - IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) KickVARIABLES%ChokeKroneckerDelta = 1 + IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) ChokeKroneckerDelta = 1 !WRITE (*,*) ' WelltoPitsOpen=' , WelltoPitsOpen, 'WellToChokeManifoldOpen= ' , WellToChokeManifoldOpen - !WRITE (*,*) 'WellToChokeOpen , WellToChokeWasOpen', WellToChokeManifoldOpen, KickVARIABLES%WellToChokeManifoldWasOpen + !WRITE (*,*) 'WellToChokeOpen , WellToChokeWasOpen', WellToChokeManifoldOpen, WellToChokeManifoldWasOpen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - IF (KickVARIABLES%NoGasPocket > 0) THEN + IF (NoGasPocket > 0) THEN IF (data%State%MudSystem%Choke_Kick_Saved_Volume_Final > 0.d0) THEN !WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', Choke_Kick_Saved_Volume_Final, (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal) - KickVARIABLES%ExitMass = REAL(data%State%MudSystem%Choke_Kick_Saved_Volume_Final / (GasPocketModifiedVol%Array(KickVARIABLES%NoGasPocket) * Convft3ToUSgal)) * GasPocketWeight%Array(KickVARIABLES%NoGasPocket) + ExitMass = REAL(data%State%MudSystem%Choke_Kick_Saved_Volume_Final / (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal)) * GasPocketWeight%Array(NoGasPocket) !IF (NoGasPocket > 1) ExitMass = ExitMass + (SUM(GasPocketDeltaVol%Array(1 : NoGasPocket - 1)) / GasPocketNewVol%Array(NoGasPocket)) * GasPocketWeight%Array(NoGasPocket) !WRITE (*,*) 'Total Exit mass=' , ExitMass !, DeltaVolumePipe, data%State%MudSystem%StringFlowRate * dt / ConvMinToSec IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%MaterialType /= 1) THEN - CALL RemoveGasPocket(KickVARIABLES%NoGasPocket) + CALL RemoveGasPocket(NoGasPocket) WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', data%State%MudSystem%Choke_Kick_Saved_Volume_Final END IF @@ -410,19 +412,19 @@ SUBROUTINE WellPressureDataTransfer !NoGasPocket = SIZE(GasPocketWeight%Array) - IF (KickVARIABLES%NoGasPocket > 0) CALL GasPocketFlowElementTransformer + IF (NoGasPocket > 0) CALL GasPocketFlowElementTransformer END IF IF (data%State%FricPressDrop%NoWelltoChokeEl > 0) THEN - KickVARIABLES%OldChokeDensity = KickVARIABLES%ChokeDensity + OldChokeDensity = ChokeDensity VolumeDensityProduct = 0.0 Do i = data%State%FricPressDrop%AnnulusLastEl + 1 , data%State%FricPressDrop%OpenholeFirstEl - 1 - VolumeDensityProduct = VolumeDensityProduct + ((MAX(FlowEl(i)%Density , KickVARIABLES%ChokeMinDensity)) * FlowEl(i)%Volume) + VolumeDensityProduct = VolumeDensityProduct + ((MAX(FlowEl(i)%Density , ChokeMinDensity)) * FlowEl(i)%Volume) End Do - KickVARIABLES%ChokeDensity = VolumeDensityProduct / SUM(FlowEl(data%State%FricPressDrop%AnnulusLastEl + 1 : data%State%FricPressDrop%OpenholeFirstEl - 1)%Volume) + ChokeDensity = VolumeDensityProduct / SUM(FlowEl(data%State%FricPressDrop%AnnulusLastEl + 1 : data%State%FricPressDrop%OpenholeFirstEl - 1)%Volume) - !WRITE (*,*) 'ChokeDensity=', KickVARIABLES%ChokeDensity - data%State%FricPressDrop%Kchoke = (KickVARIABLES%ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.d0 ! *4.d0: seyyed gofte + !WRITE (*,*) 'ChokeDensity=', ChokeDensity + data%State%FricPressDrop%Kchoke = (ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.d0 ! *4.d0: seyyed gofte END IF IF (data%State%FricPressDrop%BitTotallyPluged == .FALSE.) THEN @@ -445,7 +447,7 @@ SUBROUTINE GasPocketFlowElementTransformer USE FricPressDropVarsModule USE MudSystemVARIABLES -use SimulationVariables !@@@ + use SimulationVariables USE GeoElements_FluidModule USE Fluid_Flow_Startup_Vars use KickVARIABLESModule @@ -460,8 +462,9 @@ use SimulationVariables !@@@ REAL :: PressureCorrection PressureCorrection = 1.0 - ALLOCATE(KickVARIABLES%GasPocketFlowEl(KickVARIABLES%NoGasPocket , 1)) - KickVARIABLES%GasPocketFlowEl(:,:) = 0 + if (print_log) print *, "NoGasPocket = ",NoGasPocket + ALLOCATE(GasPocketFlowEl(NoGasPocket , 1)) + GasPocketFlowEl(:,:) = 0 !WRITE (*,*) 'NoGasPocket=' , NoGasPocket i = 1 @@ -469,23 +472,24 @@ use SimulationVariables !@@@ DO k = data%State%FricPressDrop%OpenholeFirstEl , data%State%FricPressDrop%NumbEl IF (FlowEl(k)%MaterialType == 1) THEN IF (j > 1) THEN - IF (KickVARIABLES%GasPocketFlowEl(i , j - 1) /= k - 1) THEN + IF (GasPocketFlowEl(i , j - 1) /= k - 1) THEN i = i + 1 j = 1 END IF END IF - IF (SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2) < j) THEN - ALLOCATE(KickVARIABLES%tempGasPocketFlowEl(SIZE(KickVARIABLES%GasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2))) - KickVARIABLES%tempGasPocketFlowEl = KickVARIABLES%GasPocketFlowEl - DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - ALLOCATE(KickVARIABLES%GasPocketFlowEl(SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2) + 1)) - KickVARIABLES%GasPocketFlowEl(: , 1 : SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2)) = KickVARIABLES%tempGasPocketFlowEl - KickVARIABLES%GasPocketFlowEl(: , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2)) = 0 - DEALLOCATE(KickVARIABLES%tempGasPocketFlowEl) + IF (SIZE(GasPocketFlowEl , dim = 2) < j) THEN + if (print_log) print *, "GasPocketFlowEl = ",GasPocketFlowEl + ALLOCATE(tempGasPocketFlowEl(SIZE(GasPocketFlowEl , dim = 1) , SIZE(GasPocketFlowEl , dim = 2))) + tempGasPocketFlowEl = GasPocketFlowEl + DEALLOCATE(GasPocketFlowEl) + ALLOCATE(GasPocketFlowEl(SIZE(tempGasPocketFlowEl , dim = 1) , SIZE(tempGasPocketFlowEl , dim = 2) + 1)) + GasPocketFlowEl(: , 1 : SIZE(tempGasPocketFlowEl , dim = 2)) = tempGasPocketFlowEl + GasPocketFlowEl(: , SIZE(GasPocketFlowEl , dim = 2)) = 0 + DEALLOCATE(tempGasPocketFlowEl) END IF - KickVARIABLES%GasPocketFlowEl(i , j) = k + GasPocketFlowEl(i , j) = k j = j + 1 END IF END DO @@ -494,26 +498,27 @@ use SimulationVariables !@@@ DO k = data%State%FricPressDrop%AnnulusFirstEl , data%State%FricPressDrop%OpenholeFirstEl - 1 IF (FlowEl(k)%MaterialType == 1) THEN IF (j > 1) THEN - IF (k == data%State%FricPressDrop%AnnulusFirstEl .AND. KickVARIABLES%GasPocketFlowEl(i , j - 1) == data%State%FricPressDrop%NumbEl) THEN + IF (k == data%State%FricPressDrop%AnnulusFirstEl .AND. GasPocketFlowEl(i , j - 1) == data%State%FricPressDrop%NumbEl) THEN !WRITE (*,*) 'Kick is Around Bit' - ELSE IF (KickVARIABLES%GasPocketFlowEl(i , j - 1) /= k - 1) THEN + ELSE IF (GasPocketFlowEl(i , j - 1) /= k - 1) THEN i = i + 1 j = 1 !WRITE (*,*) 'i, j, k', i, j, k, FlowEl(k)%MaterialType END IF END IF - IF (j > SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2)) THEN - ALLOCATE(KickVARIABLES%tempGasPocketFlowEl(SIZE(KickVARIABLES%GasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2))) - KickVARIABLES%tempGasPocketFlowEl = KickVARIABLES%GasPocketFlowEl - DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - ALLOCATE(KickVARIABLES%GasPocketFlowEl(SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2) + 1)) - KickVARIABLES%GasPocketFlowEl(: , 1 : SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2)) = KickVARIABLES%tempGasPocketFlowEl - KickVARIABLES%GasPocketFlowEl(: , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2)) = 0 - DEALLOCATE(KickVARIABLES%tempGasPocketFlowEl) + IF (j > SIZE(GasPocketFlowEl , dim = 2)) THEN + if (print_log) print *, "GasPocketFlowEl = ",GasPocketFlowEl + ALLOCATE(tempGasPocketFlowEl(SIZE(GasPocketFlowEl , dim = 1) , SIZE(GasPocketFlowEl , dim = 2))) + tempGasPocketFlowEl = GasPocketFlowEl + DEALLOCATE(GasPocketFlowEl) + ALLOCATE(GasPocketFlowEl(SIZE(tempGasPocketFlowEl , dim = 1) , SIZE(tempGasPocketFlowEl , dim = 2) + 1)) + GasPocketFlowEl(: , 1 : SIZE(tempGasPocketFlowEl , dim = 2)) = tempGasPocketFlowEl + GasPocketFlowEl(: , SIZE(GasPocketFlowEl , dim = 2)) = 0 + DEALLOCATE(tempGasPocketFlowEl) END IF - IF (i > KickVARIABLES%NoGasPocket) THEN - WRITE (*,*) 'GasPocketFlowEl', KickVARIABLES%GasPocketFlowEl + IF (i > NoGasPocket) THEN + WRITE (*,*) 'GasPocketFlowEl', GasPocketFlowEl WRITE (*,*) 'i , j , k', i, j, k WRITE (*,*) 'H, S, A, Ch, O', data%State%FricPressDrop%NoHorizontalEl , data%State%FricPressDrop%StringFirstEl , data%State%FricPressDrop%AnnulusFirstEl , data%State%FricPressDrop%NoWellToChokeEl , data%State%FricPressDrop%OpenHoleFirstEl @@ -525,7 +530,7 @@ use SimulationVariables !@@@ CALL ErrorStop('Error in calculating GasPocketFlowEl') END IF - KickVARIABLES%GasPocketFlowEl(i , j) = k + GasPocketFlowEl(i , j) = k !WRITE (*,*) 'GasPocketFlowEl=' , GasPocketFlowEl j = j + 1 @@ -539,10 +544,10 @@ use SimulationVariables !@@@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GasPocketModifiedVol%Array(:) = 0.d0 - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket !WRITE(*,*) 'GasPocketFlowEl Data' , i , GasPocketFlowEl(: , i) - DO j = 1 , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2) - IF (KickVARIABLES%GasPocketFlowEl(i , j) > 0) GasPocketModifiedVol%Array(i) = GasPocketModifiedVol%Array(i) + FlowEl(KickVARIABLES%GasPocketFlowEl(i , j))%Volume + DO j = 1 , SIZE(GasPocketFlowEl , dim = 2) + IF (GasPocketFlowEl(i , j) > 0) GasPocketModifiedVol%Array(i) = GasPocketModifiedVol%Array(i) + FlowEl(GasPocketFlowEl(i , j))%Volume END DO END DO i = data%State%FricPressDrop%AnnulusLastEl @@ -553,41 +558,41 @@ use SimulationVariables !@@@ GasPocketOldPress%Array(:) = GasPocketNewPress%Array(:) !WRITE (*,*) ' GasPocketweight%Array(1)', GasPocketweight%Array(1) - IF (GasPocketWeight%Array(1) < 0.0) CALL ErrorStop(' Error in Calculating Mass ' , KickVARIABLES%KickmdotBCoef) + IF (GasPocketWeight%Array(1) < 0.0) CALL ErrorStop(' Error in Calculating Mass ' , KickmdotBCoef) GasPocketDensity%Array(:) = (GasPocketweight%Array(:) / GasPocketModifiedVol%Array(:)) / convft3toUSgal ! [lbm/ft^3 to ppg] - DO i = 1 , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 1) - DO j = 1 , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2) - IF (KickVARIABLES%GasPocketFlowEl(i , j) > 0) FlowEl(KickVARIABLES%GasPocketFlowEl(i , j))%Density = GasPocketDensity%Array(i) + DO i = 1 , SIZE(GasPocketFlowEl , dim = 1) + DO j = 1 , SIZE(GasPocketFlowEl , dim = 2) + IF (GasPocketFlowEl(i , j) > 0) FlowEl(GasPocketFlowEl(i , j))%Density = GasPocketDensity%Array(i) END DO END DO !WRITE (*,*) 'Kick density (ppg)=' , GasPocketDensity(1) - data%Equipments%DownHole%InfluxRate = MAX(((KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1))) / GasPocketDensity%Array(1) * ConvMinToSec) , 0.0) + data%Equipments%DownHole%InfluxRate = MAX(((KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1))) / GasPocketDensity%Array(1) * ConvMinToSec) , 0.0) !WRITE (*,*) ' InfluxRate (gpm) =', InfluxRate i = data%State%FricPressDrop%OpenholeFirstEl - 1 - IF (data%State%MudSystem%Choke_Kick_Saved_Volume_Final > 0.d0 .AND. KickVARIABLES%WellHeadOpen) THEN + IF (data%State%MudSystem%Choke_Kick_Saved_Volume_Final > 0.d0 .AND. WellHeadOpen) THEN WRITE (*,*) 'Kick is exiting through the choke' - !KickVARIABLES%ExitMass = GasPocketDensity%Array(NoGasPocket) * (SUM(GasPocketFlowInduced%Array(:)) + (DeltaVolumePipe * ConvMinToSec / dt) + data%State%MudSystem%StringFlowRate) / ConvMinToSec * dt - GasPocketWeight%Array(KickVARIABLES%NoGasPocket) = GasPocketweight%Array(KickVARIABLES%NoGasPocket) - KickVARIABLES%ExitMass - IF (GasPocketWeight%Array(KickVARIABLES%NoGasPocket) > 0.0) THEN - GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) = GasPocketWeight%Array(KickVARIABLES%NoGasPocket) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketCompressibility%Array(KickVARIABLES%NoGasPocket) * GasPocketNewTemp%Array(KickVARIABLES%NoGasPocket) / GasPocketModifiedVol%Array(KickVARIABLES%NoGasPocket) - GasPocketDensity%Array(KickVARIABLES%NoGasPocket) = (GasPocketweight%Array(KickVARIABLES%NoGasPocket) / GasPocketModifiedVol%Array(KickVARIABLES%NoGasPocket)) / convft3toUSgal + !ExitMass = GasPocketDensity%Array(NoGasPocket) * (SUM(GasPocketFlowInduced%Array(:)) + (DeltaVolumePipe * ConvMinToSec / dt) + data%State%MudSystem%StringFlowRate) / ConvMinToSec * dt + GasPocketWeight%Array(NoGasPocket) = GasPocketweight%Array(NoGasPocket) - ExitMass + IF (GasPocketWeight%Array(NoGasPocket) > 0.0) THEN + GasPocketOldPress%Array(NoGasPocket) = GasPocketWeight%Array(NoGasPocket) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketCompressibility%Array(NoGasPocket) * GasPocketNewTemp%Array(NoGasPocket) / GasPocketModifiedVol%Array(NoGasPocket) + GasPocketDensity%Array(NoGasPocket) = (GasPocketweight%Array(NoGasPocket) / GasPocketModifiedVol%Array(NoGasPocket)) / convft3toUSgal GasPocketNewVol%Array(:) = GasPocketOldVol%Array(:) ELSE ! gas pocket is escaped from the well completely WRITE (*,*) ' Last Pocket Removed' - WRITE (*,*) ' GasPocketFlowEl', KickVARIABLES%GasPocketFlowEl - CALL RemoveGasPocket(KickVARIABLES%NoGasPocket) + WRITE (*,*) ' GasPocketFlowEl', GasPocketFlowEl + CALL RemoveGasPocket(NoGasPocket) !WRITE (*,*) ' GasPocketFlowEl', GasPocketFlowEl END IF - ELSE IF (KickVARIABLES%NoGasPocket == 1 .OR. KickVARIABLES%WellHeadOpen) THEN ! kick is not last element of choke line or well head is closed + ELSE IF (NoGasPocket == 1 .OR. WellHeadOpen) THEN ! kick is not last element of choke line or well head is closed GasPocketNewPress%Array(:) = GasPocketNewPress%Array(:) * REAL(GasPocketNewVol%Array(:) / GasPocketOldVol%Array(:)) GasPocketOldPress%Array(:) = GasPocketNewPress%Array(:) GasPocketNewVol%Array(:) = GasPocketOldVol%Array(:) @@ -596,31 +601,31 @@ use SimulationVariables !@@@ 103 FORMAT (2I, 4X, (F9.3), 5X, (F9.3)) - GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) = GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - GasPocketNewVol%Array(KickVARIABLES%NoGasPocket) = GasPocketCompressibility%Array(KickVARIABLES%NoGasPocket) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketNewTemp%Array(KickVARIABLES%NoGasPocket) * GasPocketWeight%Array(KickVARIABLES%NoGasPocket) / GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) + GasPocketNewPress%Array(NoGasPocket) = GasPocketOldPress%Array(NoGasPocket) + GasPocketNewVol%Array(NoGasPocket) = GasPocketCompressibility%Array(NoGasPocket) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketNewTemp%Array(NoGasPocket) * GasPocketWeight%Array(NoGasPocket) / GasPocketNewPress%Array(NoGasPocket) !WRITE (*,*) 'Mid' DO WHILE (ABS(PressureCorrection * 10.0) > KickConvergenceTolerance) - DO j = KickVARIABLES%NoGasPocket - 1 , 1 , -1 + DO j = NoGasPocket - 1 , 1 , -1 CALL KickFunctionsCalculator(GasPocketNewPress%Array(j) , j , 5) - GasPocketNewVol%Array(j) = GasPocketCompressibility%Array(j) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & + GasPocketNewVol%Array(j) = GasPocketCompressibility%Array(j) * data%State%GasType(KickGasType)%GasConstant * & GasPocketNewTemp%Array(j) * GasPocketWeight%Array(j) / GasPocketNewPress%Array(j) !WRITE (*,*) j, REAL(GasPocketNewPress%Array(j)), REAL(GasPocketNewVol%Array(j) * Convft3toUSgal) END DO PressureCorrection = (SUM(GasPocketNewVol%Array(:)) - SUM(GasPocketOldVol%Array(:))) / SUM(GasPocketNewVol%Array(:) / GasPocketNewPress%Array(:)) - GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) = GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) + PressureCorrection - GasPocketNewVol%Array(KickVARIABLES%NoGasPocket) = GasPocketCompressibility%Array(KickVARIABLES%NoGasPocket) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketNewTemp%Array(KickVARIABLES%NoGasPocket) * GasPocketWeight%Array(KickVARIABLES%NoGasPocket) / GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) - j = KickVARIABLES%NoGasPocket + GasPocketNewPress%Array(NoGasPocket) = GasPocketNewPress%Array(NoGasPocket) + PressureCorrection + GasPocketNewVol%Array(NoGasPocket) = GasPocketCompressibility%Array(NoGasPocket) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketNewTemp%Array(NoGasPocket) * GasPocketWeight%Array(NoGasPocket) / GasPocketNewPress%Array(NoGasPocket) + j = NoGasPocket !WRITE (*,*) j, REAL(GasPocketNewPress%Array(j)), REAL(GasPocketNewVol%Array(j) * Convft3toUSgal) END DO !WRITE (*,*) 'Pressure Correction = ', PressureCorrection WRITE (*,*) 'After' - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket WRITE (*,*) i, REAL(GasPocketNewPress%Array(i)), REAL((GasPocketNewVol%Array(i) * Convft3toUSgal)) END DO @@ -629,7 +634,7 @@ use SimulationVariables !@@@ END IF - IF (KickVARIABLES%GasPocketFlowEl(KickVARIABLES%NoGasPocket , 1) == 0) THEN + IF (GasPocketFlowEl(NoGasPocket , 1) == 0) THEN CALL RemoveGasPocket(1) !WRITE (*,*) 'GasPocketFlowEl', GasPocketFlowEl @@ -660,7 +665,7 @@ use SimulationVariables !@@@ INTEGER :: ilocal - DEALLOCATE(KickVARIABLES%KickJacobian , KickVARIABLES%OldKickJacobian , KickVARIABLES%KickVandPFunction , KickVARIABLES%KickUnknownVector , KickVARIABLES%KickCorrectionVector) + DEALLOCATE(KickJacobian , OldKickJacobian , KickVandPFunction , KickUnknownVector , KickCorrectionVector) WRITE (*,*) 'Gas Pocket Will be Removed', ilocal @@ -677,19 +682,20 @@ use SimulationVariables !@@@ call GasPocketDensity%Remove(ilocal) call GasPocketCompressibility%Remove(ilocal) - KickVARIABLES%NoGasPocket = KickVARIABLES%NoGasPocket - 1 + NoGasPocket = NoGasPocket - 1 - IF (KickVARIABLES%NoGasPocket > 0) THEN - ALLOCATE(KickVARIABLES%KickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%OldKickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickVandPFunction(2 * KickVARIABLES%NoGasPocket)) - ALLOCATE(KickVARIABLES%KickUnknownVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickCorrectionVector(2 * KickVARIABLES%NoGasPocket)) - - IF (ALLOCATED(KickVARIABLES%GasPocketFlowEl)) THEN - ALLOCATE(KickVARIABLES%tempGasPocketFlowEl(KickVARIABLES%NoGasPocket , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2))) - KickVARIABLES%tempGasPocketFlowEl = KickVARIABLES%GasPocketFlowEl(1 : KickVARIABLES%NoGasPocket , :) - DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - ALLOCATE(KickVARIABLES%GasPocketFlowEl(SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2))) - KickVARIABLES%GasPocketFlowEl = KickVARIABLES%tempGasPocketFlowEl - DEALLOCATE(KickVARIABLES%tempGasPocketFlowEl) + IF (NoGasPocket > 0) THEN + if (print_log) print *, "2 * NoGasPocket , 2 * NoGasPocket = ",2 * NoGasPocket , 2 * NoGasPocket + ALLOCATE(KickJacobian(2 * NoGasPocket , 2 * NoGasPocket) , OldKickJacobian(2 * NoGasPocket , 2 * NoGasPocket) , KickVandPFunction(2 * NoGasPocket)) + ALLOCATE(KickUnknownVector(2 * NoGasPocket) , KickCorrectionVector(2 * NoGasPocket)) + + IF (ALLOCATED(GasPocketFlowEl)) THEN + ALLOCATE(tempGasPocketFlowEl(NoGasPocket , SIZE(GasPocketFlowEl , dim = 2))) + tempGasPocketFlowEl = GasPocketFlowEl(1 : NoGasPocket , :) + DEALLOCATE(GasPocketFlowEl) + ALLOCATE(GasPocketFlowEl(SIZE(tempGasPocketFlowEl , dim = 1) , SIZE(tempGasPocketFlowEl , dim = 2))) + GasPocketFlowEl = tempGasPocketFlowEl + DEALLOCATE(tempGasPocketFlowEl) END IF ELSE ! NoGasPocket = 0 diff --git a/FluidFlow/Well_Pressure_Data_Transfer.i90 b/FluidFlow/Well_Pressure_Data_Transfer.i90 index df4910d..932a5b0 100644 --- a/FluidFlow/Well_Pressure_Data_Transfer.i90 +++ b/FluidFlow/Well_Pressure_Data_Transfer.i90 @@ -38,7 +38,7 @@ SUBROUTINE WellPressureDataTransfer INTEGER :: i , j REAL :: InstantaneousTotalOpenChokeArea , VolumeDensityProduct - KickVARIABLES%ChokeIsClosing = .FALSE. + ChokeIsClosing = .FALSE. data%State%FricPressDrop%Kchoke = 0.0 data%State%FricPressDrop%KBit = 0.0 @@ -69,21 +69,21 @@ SUBROUTINE WellPressureDataTransfer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - IF(ALLOCATED(KickVARIABLES%GasPocketFlowEl)) DEALLOCATE(KickVARIABLES%GasPocketFlowEl) + IF(ALLOCATED(GasPocketFlowEl)) DEALLOCATE(GasPocketFlowEl) !!!!!!!!!!!!!!!!!!!! Well Head Condition ( Open or Closed ) - KickVARIABLES%ChokeKroneckerDelta = 0 + ChokeKroneckerDelta = 0 IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen == .FALSE.) THEN - KickVARIABLES%WellHeadOpen = .FALSE. + WellHeadOpen = .FALSE. !WRITE (*,*) ' Well Head is closed ' ELSE - KickVARIABLES%WellHeadOpen = .TRUE. + WellHeadOpen = .TRUE. END IF - IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) KickVARIABLES%ChokeKroneckerDelta = 1 + IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) ChokeKroneckerDelta = 1 !WRITE (*,*) ' WelltoPitsOpen=' , WelltoPitsOpen, 'WellToChokeManifoldOpen= ' , WellToChokeManifoldOpen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -93,18 +93,23 @@ SUBROUTINE WellPressureDataTransfer data%State%FricPressDrop%NoStringEl = data%State%MudSystem%NoStringMudElements data%State%FricPressDrop%NoAnnulusEl = data%State%MudSystem%NoCasingMudElements data%State%FricPressDrop%NoWellToChokeEl = 0 - IF (KickVARIABLES%ChokeKroneckerDelta == 1) data%State%FricPressDrop%NoWellToChokeEl = data%State%MudSystem%ChokeLine_Density%Length() + IF (ChokeKroneckerDelta == 1) data%State%FricPressDrop%NoWellToChokeEl = data%State%MudSystem%ChokeLine_Density%Length() data%State%FricPressDrop%NoOpenHoleEl = data%State%MudSystem%NoBottomHoleMudElements data%State%FricPressDrop%NumbEl = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl + data%State%FricPressDrop%NoWellToChokeEl + data%State%FricPressDrop%NoOpenHoleEl - IF(ALLOCATED(FlowEl)) DEALLOCATE(FlowEl) + IF(ALLOCATED(FlowEl)) then + DEALLOCATE(FlowEl) + endif ALLOCATE(FlowEl(data%State%FricPressDrop%NumbEl)) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Transfering Data from module:MudSystemVARIABLES to module:FricPressDropVars to calculate Pressure distribution in flow path !!!!!!!!!!!!!!!!!!!!!!! Horizontal line !WRITE (*,*) 'H', NoHorizontalEl DO i = 1 , data%State%FricPressDrop%NoHorizontalEl +! WRITE (*,*) 'H , i' , i FlowEl(i)%StartX = data%State%MudSystem%Xstart_MudElement%Array(i) +!WRITE (*,*) 'StartX', FlowEl(i)%StartX FlowEl(i)%EndX = data%State%MudSystem%Xend_MudElement%Array(i) +!WRITE (*,*) 'Endx', FlowEl(i)%EndX FlowEl(i)%StartTVD = 0.d0 FlowEl(i)%EndTVD = 0.d0 FlowEl(i)%Id = 0.0 @@ -135,11 +140,11 @@ SUBROUTINE WellPressureDataTransfer data%State%FricPressDrop%StringFirstEl = data%State%FricPressDrop%NoHorizontalEl + 1 data%State%FricPressDrop%StringLastEl = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl DO i = data%State%FricPressDrop%NoHorizontalEl + 1 , data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl -!WRITE (*,*) 'ST , i' , i +! WRITE (*,*) 'ST , i' , i FlowEl(i)%StartX = data%State%MudSystem%Xstart_MudElement%Array(i) !WRITE (*,*) 'StartX', FlowEl(i)%StartX FlowEl(i)%EndX = data%State%MudSystem%Xend_MudElement%Array(i) -!WRITE (*,*) 'EndX', FlowEl(i)%EndX +!WRITE (*,*) 'Endx', FlowEl(i)%EndX FlowEl(i)%StartTVD = data%State%MudSystem%TVDstart_MudElement%Array(i) !WRITE (*,*) 'StartTVD', FlowEl(i)%StartTVD FlowEl(i)%EndTVD = data%State%MudSystem%TVDend_MudElement%Array(i) @@ -184,8 +189,11 @@ SUBROUTINE WellPressureDataTransfer data%State%FricPressDrop%AnnulusFirstEl = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + 1 data%State%FricPressDrop%AnnulusLastEl = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl DO i = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + 1 , data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl +! WRITE (*,*) 'AN , i' , i FlowEl(i)%StartX = data%State%MudSystem%Xstart_MudElement%Array(i) +!WRITE (*,*) 'StartX', FlowEl(i)%StartX FlowEl(i)%EndX = data%State%MudSystem%Xend_MudElement%Array(i) +!WRITE (*,*) 'Endx', FlowEl(i)%EndX FlowEl(i)%StartTVD = data%State%MudSystem%TVDstart_MudElement%Array(i) FlowEl(i)%EndTVD = data%State%MudSystem%TVDend_MudElement%Array(i) FlowEl(i)%Id = data%State%MudSystem%PipeID_MudElement%Array(i) @@ -220,8 +228,11 @@ SUBROUTINE WellPressureDataTransfer !!!!!!!!!!!!!!! Well to choke manifold path j = 1 DO i = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl + 1 , data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl + data%State%FricPressDrop%NoWelltoChokeEl +! WRITE (*,*) 'CH , i' , i FlowEl(i)%StartX = data%State%MudSystem%ChokeLine_Mud_Backhead_X%Array(j) +!WRITE (*,*) 'StartX', FlowEl(i)%StartX FlowEl(i)%EndX = data%State%MudSystem%ChokeLine_Mud_Forehead_X%Array(j) +!WRITE (*,*) 'Endx', FlowEl(i)%EndX FlowEl(i)%StartTVD = 0.d0 FlowEl(i)%EndTVD = 0.d0 FlowEl(i)%Id = 0.0 @@ -255,8 +266,11 @@ SUBROUTINE WellPressureDataTransfer data%State%FricPressDrop%OpenholeFirstEl = data%State%FricPressDrop%NoHorizontalEl + data%State%FricPressDrop%NoStringEl + data%State%FricPressDrop%NoAnnulusEl + data%State%FricPressDrop%NoWelltoChokeEl + 1 j = 1 DO i = data%State%FricPressDrop%OpenholeFirstEl , data%State%FricPressDrop%NumbEl ! = NoHorizontalEl + NoStringEl + NoCasingEl + NoOpenHoleEl +! WRITE (*,*) 'OP , i' , i FlowEl(i)%StartX = data%State%MudSystem%Xstart_OpMudElement%Array(j) +!WRITE (*,*) 'StartX', FlowEl(i)%StartX FlowEl(i)%EndX = data%State%MudSystem%Xend_OpMudElement%Array(j) +!WRITE (*,*) 'Endx', FlowEl(i)%EndX FlowEl(i)%StartTVD = data%State%MudSystem%TVDstart_OpMudElement%Array(j) FlowEl(i)%EndTVD = data%State%MudSystem%TVDend_OpMudElement%Array(j) FlowEl(i)%Id = 0.0 @@ -366,32 +380,32 @@ SUBROUTINE WellPressureDataTransfer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! Well Head Condition ( Open or Closed ) - KickVARIABLES%ChokeKroneckerDelta = 0 + ChokeKroneckerDelta = 0 !WRITE (*,*) ' WelltoPitsOpen = ', WelltoPitsOpen !WRITE (*,*) ' WellToChokeManifoldOpen = ', WellToChokeManifoldOpen IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen == .FALSE.) THEN !WRITE (*,*) ' WelltoPitsOpen = ', WelltoPitsOpen !WRITE (*,*) ' WellToChokeManifoldOpen = ', WellToChokeManifoldOpen - KickVARIABLES%WellHeadOpen = .FALSE. + WellHeadOpen = .FALSE. !WRITE (*,*) ' Well Head is closed ' ELSE - KickVARIABLES%WellHeadOpen = .TRUE. + WellHeadOpen = .TRUE. END IF - IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) KickVARIABLES%ChokeKroneckerDelta = 1 + IF (data%State%MudSystem%WellToPitsOpen == .FALSE. .AND. data%State%MudSystem%WellToChokeManifoldOpen) ChokeKroneckerDelta = 1 !WRITE (*,*) ' WelltoPitsOpen=' , WelltoPitsOpen, 'WellToChokeManifoldOpen= ' , WellToChokeManifoldOpen -!WRITE (*,*) 'WellToChokeOpen , WellToChokeWasOpen', WellToChokeManifoldOpen, KickVARIABLES%WellToChokeManifoldWasOpen +!WRITE (*,*) 'WellToChokeOpen , WellToChokeWasOpen', WellToChokeManifoldOpen, WellToChokeManifoldWasOpen !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - IF (KickVARIABLES%NoGasPocket > 0) THEN + IF (NoGasPocket > 0) THEN IF (data%State%MudSystem%Choke_Kick_Saved_Volume_Final > 0.d0) THEN !WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', Choke_Kick_Saved_Volume_Final, (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal) - KickVARIABLES%ExitMass = REAL(data%State%MudSystem%Choke_Kick_Saved_Volume_Final / (GasPocketModifiedVol%Array(KickVARIABLES%NoGasPocket) * Convft3ToUSgal)) * GasPocketWeight%Array(KickVARIABLES%NoGasPocket) + ExitMass = REAL(data%State%MudSystem%Choke_Kick_Saved_Volume_Final / (GasPocketModifiedVol%Array(NoGasPocket) * Convft3ToUSgal)) * GasPocketWeight%Array(NoGasPocket) !IF (NoGasPocket > 1) ExitMass = ExitMass + (SUM(GasPocketDeltaVol%Array(1 : NoGasPocket - 1)) / GasPocketNewVol%Array(NoGasPocket)) * GasPocketWeight%Array(NoGasPocket) !WRITE (*,*) 'Total Exit mass=' , ExitMass !, DeltaVolumePipe, data%State%MudSystem%StringFlowRate * dt / ConvMinToSec IF (FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%MaterialType /= 1) THEN - CALL RemoveGasPocket(KickVARIABLES%NoGasPocket) + CALL RemoveGasPocket(NoGasPocket) WRITE (*,*) 'Choke_Kick_Saved_Volume_Final=', data%State%MudSystem%Choke_Kick_Saved_Volume_Final END IF @@ -399,19 +413,19 @@ SUBROUTINE WellPressureDataTransfer !NoGasPocket = SIZE(GasPocketWeight%Array) - IF (KickVARIABLES%NoGasPocket > 0) CALL GasPocketFlowElementTransformer + IF (NoGasPocket > 0) CALL GasPocketFlowElementTransformer END IF IF (data%State%FricPressDrop%NoWelltoChokeEl > 0) THEN - KickVARIABLES%OldChokeDensity = KickVARIABLES%ChokeDensity + OldChokeDensity = ChokeDensity VolumeDensityProduct = 0.0 Do i = data%State%FricPressDrop%AnnulusLastEl + 1 , data%State%FricPressDrop%OpenholeFirstEl - 1 - VolumeDensityProduct = VolumeDensityProduct + ((MAX(FlowEl(i)%Density , KickVARIABLES%ChokeMinDensity)) * FlowEl(i)%Volume) + VolumeDensityProduct = VolumeDensityProduct + ((MAX(FlowEl(i)%Density , ChokeMinDensity)) * FlowEl(i)%Volume) End Do - KickVARIABLES%ChokeDensity = VolumeDensityProduct / SUM(FlowEl(data%State%FricPressDrop%AnnulusLastEl + 1 : data%State%FricPressDrop%OpenholeFirstEl - 1)%Volume) + ChokeDensity = VolumeDensityProduct / SUM(FlowEl(data%State%FricPressDrop%AnnulusLastEl + 1 : data%State%FricPressDrop%OpenholeFirstEl - 1)%Volume) -!WRITE (*,*) 'ChokeDensity=', KickVARIABLES%ChokeDensity - data%State%FricPressDrop%Kchoke = (KickVARIABLES%ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.d0 ! *4.d0: seyyed gofte +!WRITE (*,*) 'ChokeDensity=', ChokeDensity + data%State%FricPressDrop%Kchoke = (ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * data%State%FricPressDrop%TotalOpenChokeArea)**2)) * 4.d0 ! *4.d0: seyyed gofte END IF IF (data%State%FricPressDrop%BitTotallyPluged == .FALSE.) THEN @@ -434,7 +448,7 @@ SUBROUTINE GasPocketFlowElementTransformer USE FricPressDropVarsModule USE MudSystemVARIABLES -use SimulationVariables !@@@ + use SimulationVariables USE GeoElements_FluidModule USE Fluid_Flow_Startup_Vars use KickVARIABLESModule @@ -449,8 +463,9 @@ use SimulationVariables !@@@ REAL :: PressureCorrection PressureCorrection = 1.0 - ALLOCATE(KickVARIABLES%GasPocketFlowEl(KickVARIABLES%NoGasPocket , 1)) - KickVARIABLES%GasPocketFlowEl(:,:) = 0 + if (print_log) print *, "NoGasPocket = ",NoGasPocket + ALLOCATE(GasPocketFlowEl(NoGasPocket , 1)) + GasPocketFlowEl(:,:) = 0 !WRITE (*,*) 'NoGasPocket=' , NoGasPocket i = 1 @@ -458,23 +473,24 @@ use SimulationVariables !@@@ DO k = data%State%FricPressDrop%OpenholeFirstEl , data%State%FricPressDrop%NumbEl IF (FlowEl(k)%MaterialType == 1) THEN IF (j > 1) THEN - IF (KickVARIABLES%GasPocketFlowEl(i , j - 1) /= k - 1) THEN + IF (GasPocketFlowEl(i , j - 1) /= k - 1) THEN i = i + 1 j = 1 END IF END IF - IF (SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2) < j) THEN - ALLOCATE(KickVARIABLES%tempGasPocketFlowEl(SIZE(KickVARIABLES%GasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2))) - KickVARIABLES%tempGasPocketFlowEl = KickVARIABLES%GasPocketFlowEl - DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - ALLOCATE(KickVARIABLES%GasPocketFlowEl(SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2) + 1)) - KickVARIABLES%GasPocketFlowEl(: , 1 : SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2)) = KickVARIABLES%tempGasPocketFlowEl - KickVARIABLES%GasPocketFlowEl(: , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2)) = 0 - DEALLOCATE(KickVARIABLES%tempGasPocketFlowEl) + IF (SIZE(GasPocketFlowEl , dim = 2) < j) THEN + if (print_log) print *, "GasPocketFlowEl = ",GasPocketFlowEl + ALLOCATE(tempGasPocketFlowEl(SIZE(GasPocketFlowEl , dim = 1) , SIZE(GasPocketFlowEl , dim = 2))) + tempGasPocketFlowEl = GasPocketFlowEl + DEALLOCATE(GasPocketFlowEl) + ALLOCATE(GasPocketFlowEl(SIZE(tempGasPocketFlowEl , dim = 1) , SIZE(tempGasPocketFlowEl , dim = 2) + 1)) + GasPocketFlowEl(: , 1 : SIZE(tempGasPocketFlowEl , dim = 2)) = tempGasPocketFlowEl + GasPocketFlowEl(: , SIZE(GasPocketFlowEl , dim = 2)) = 0 + DEALLOCATE(tempGasPocketFlowEl) END IF - KickVARIABLES%GasPocketFlowEl(i , j) = k + GasPocketFlowEl(i , j) = k j = j + 1 END IF END DO @@ -483,26 +499,27 @@ use SimulationVariables !@@@ DO k = data%State%FricPressDrop%AnnulusFirstEl , data%State%FricPressDrop%OpenholeFirstEl - 1 IF (FlowEl(k)%MaterialType == 1) THEN IF (j > 1) THEN - IF (k == data%State%FricPressDrop%AnnulusFirstEl .AND. KickVARIABLES%GasPocketFlowEl(i , j - 1) == data%State%FricPressDrop%NumbEl) THEN + IF (k == data%State%FricPressDrop%AnnulusFirstEl .AND. GasPocketFlowEl(i , j - 1) == data%State%FricPressDrop%NumbEl) THEN !WRITE (*,*) 'Kick is Around Bit' - ELSE IF (KickVARIABLES%GasPocketFlowEl(i , j - 1) /= k - 1) THEN + ELSE IF (GasPocketFlowEl(i , j - 1) /= k - 1) THEN i = i + 1 j = 1 !WRITE (*,*) 'i, j, k', i, j, k, FlowEl(k)%MaterialType END IF END IF - IF (j > SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2)) THEN - ALLOCATE(KickVARIABLES%tempGasPocketFlowEl(SIZE(KickVARIABLES%GasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2))) - KickVARIABLES%tempGasPocketFlowEl = KickVARIABLES%GasPocketFlowEl - DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - ALLOCATE(KickVARIABLES%GasPocketFlowEl(SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2) + 1)) - KickVARIABLES%GasPocketFlowEl(: , 1 : SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2)) = KickVARIABLES%tempGasPocketFlowEl - KickVARIABLES%GasPocketFlowEl(: , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2)) = 0 - DEALLOCATE(KickVARIABLES%tempGasPocketFlowEl) + IF (j > SIZE(GasPocketFlowEl , dim = 2)) THEN + if (print_log) print *, "GasPocketFlowEl = ",GasPocketFlowEl + ALLOCATE(tempGasPocketFlowEl(SIZE(GasPocketFlowEl , dim = 1) , SIZE(GasPocketFlowEl , dim = 2))) + tempGasPocketFlowEl = GasPocketFlowEl + DEALLOCATE(GasPocketFlowEl) + ALLOCATE(GasPocketFlowEl(SIZE(tempGasPocketFlowEl , dim = 1) , SIZE(tempGasPocketFlowEl , dim = 2) + 1)) + GasPocketFlowEl(: , 1 : SIZE(tempGasPocketFlowEl , dim = 2)) = tempGasPocketFlowEl + GasPocketFlowEl(: , SIZE(GasPocketFlowEl , dim = 2)) = 0 + DEALLOCATE(tempGasPocketFlowEl) END IF - IF (i > KickVARIABLES%NoGasPocket) THEN - WRITE (*,*) 'GasPocketFlowEl', KickVARIABLES%GasPocketFlowEl + IF (i > NoGasPocket) THEN + WRITE (*,*) 'GasPocketFlowEl', GasPocketFlowEl WRITE (*,*) 'i , j , k', i, j, k WRITE (*,*) 'H, S, A, Ch, O', data%State%FricPressDrop%NoHorizontalEl , data%State%FricPressDrop%StringFirstEl , data%State%FricPressDrop%AnnulusFirstEl , data%State%FricPressDrop%NoWellToChokeEl , data%State%FricPressDrop%OpenHoleFirstEl @@ -514,7 +531,7 @@ use SimulationVariables !@@@ CALL ErrorStop('Error in calculating GasPocketFlowEl') END IF - KickVARIABLES%GasPocketFlowEl(i , j) = k + GasPocketFlowEl(i , j) = k !WRITE (*,*) 'GasPocketFlowEl=' , GasPocketFlowEl j = j + 1 @@ -528,10 +545,10 @@ use SimulationVariables !@@@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GasPocketModifiedVol%Array(:) = 0.d0 - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket !WRITE(*,*) 'GasPocketFlowEl Data' , i , GasPocketFlowEl(: , i) - DO j = 1 , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2) - IF (KickVARIABLES%GasPocketFlowEl(i , j) > 0) GasPocketModifiedVol%Array(i) = GasPocketModifiedVol%Array(i) + FlowEl(KickVARIABLES%GasPocketFlowEl(i , j))%Volume + DO j = 1 , SIZE(GasPocketFlowEl , dim = 2) + IF (GasPocketFlowEl(i , j) > 0) GasPocketModifiedVol%Array(i) = GasPocketModifiedVol%Array(i) + FlowEl(GasPocketFlowEl(i , j))%Volume END DO END DO i = data%State%FricPressDrop%AnnulusLastEl @@ -542,41 +559,41 @@ use SimulationVariables !@@@ GasPocketOldPress%Array(:) = GasPocketNewPress%Array(:) !WRITE (*,*) ' GasPocketweight%Array(1)', GasPocketweight%Array(1) - IF (GasPocketWeight%Array(1) < 0.0) CALL ErrorStop(' Error in Calculating Mass ' , KickVARIABLES%KickmdotBCoef) + IF (GasPocketWeight%Array(1) < 0.0) CALL ErrorStop(' Error in Calculating Mass ' , KickmdotBCoef) GasPocketDensity%Array(:) = (GasPocketweight%Array(:) / GasPocketModifiedVol%Array(:)) / convft3toUSgal ! [lbm/ft^3 to ppg] - DO i = 1 , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 1) - DO j = 1 , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2) - IF (KickVARIABLES%GasPocketFlowEl(i , j) > 0) FlowEl(KickVARIABLES%GasPocketFlowEl(i , j))%Density = GasPocketDensity%Array(i) + DO i = 1 , SIZE(GasPocketFlowEl , dim = 1) + DO j = 1 , SIZE(GasPocketFlowEl , dim = 2) + IF (GasPocketFlowEl(i , j) > 0) FlowEl(GasPocketFlowEl(i , j))%Density = GasPocketDensity%Array(i) END DO END DO !WRITE (*,*) 'Kick density (ppg)=' , GasPocketDensity(1) - data%Equipments%DownHole%InfluxRate = MAX(((KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1))) / GasPocketDensity%Array(1) * ConvMinToSec) , 0.0) + data%Equipments%DownHole%InfluxRate = MAX(((KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1))) / GasPocketDensity%Array(1) * ConvMinToSec) , 0.0) !WRITE (*,*) ' InfluxRate (gpm) =', InfluxRate i = data%State%FricPressDrop%OpenholeFirstEl - 1 - IF (data%State%MudSystem%Choke_Kick_Saved_Volume_Final > 0.d0 .AND. KickVARIABLES%WellHeadOpen) THEN + IF (data%State%MudSystem%Choke_Kick_Saved_Volume_Final > 0.d0 .AND. WellHeadOpen) THEN WRITE (*,*) 'Kick is exiting through the choke' -!KickVARIABLES%ExitMass = GasPocketDensity%Array(NoGasPocket) * (SUM(GasPocketFlowInduced%Array(:)) + (DeltaVolumePipe * ConvMinToSec / dt) + data%State%MudSystem%StringFlowRate) / ConvMinToSec * dt - GasPocketWeight%Array(KickVARIABLES%NoGasPocket) = GasPocketweight%Array(KickVARIABLES%NoGasPocket) - KickVARIABLES%ExitMass - IF (GasPocketWeight%Array(KickVARIABLES%NoGasPocket) > 0.0) THEN - GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) = GasPocketWeight%Array(KickVARIABLES%NoGasPocket) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketCompressibility%Array(KickVARIABLES%NoGasPocket) * GasPocketNewTemp%Array(KickVARIABLES%NoGasPocket) / GasPocketModifiedVol%Array(KickVARIABLES%NoGasPocket) - GasPocketDensity%Array(KickVARIABLES%NoGasPocket) = (GasPocketweight%Array(KickVARIABLES%NoGasPocket) / GasPocketModifiedVol%Array(KickVARIABLES%NoGasPocket)) / convft3toUSgal +!ExitMass = GasPocketDensity%Array(NoGasPocket) * (SUM(GasPocketFlowInduced%Array(:)) + (DeltaVolumePipe * ConvMinToSec / dt) + data%State%MudSystem%StringFlowRate) / ConvMinToSec * dt + GasPocketWeight%Array(NoGasPocket) = GasPocketweight%Array(NoGasPocket) - ExitMass + IF (GasPocketWeight%Array(NoGasPocket) > 0.0) THEN + GasPocketOldPress%Array(NoGasPocket) = GasPocketWeight%Array(NoGasPocket) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketCompressibility%Array(NoGasPocket) * GasPocketNewTemp%Array(NoGasPocket) / GasPocketModifiedVol%Array(NoGasPocket) + GasPocketDensity%Array(NoGasPocket) = (GasPocketweight%Array(NoGasPocket) / GasPocketModifiedVol%Array(NoGasPocket)) / convft3toUSgal GasPocketNewVol%Array(:) = GasPocketOldVol%Array(:) ELSE ! gas pocket is escaped from the well completely WRITE (*,*) ' Last Pocket Removed' - WRITE (*,*) ' GasPocketFlowEl', KickVARIABLES%GasPocketFlowEl - CALL RemoveGasPocket(KickVARIABLES%NoGasPocket) + WRITE (*,*) ' GasPocketFlowEl', GasPocketFlowEl + CALL RemoveGasPocket(NoGasPocket) !WRITE (*,*) ' GasPocketFlowEl', GasPocketFlowEl END IF - ELSE IF (KickVARIABLES%NoGasPocket == 1 .OR. KickVARIABLES%WellHeadOpen) THEN ! kick is not last element of choke line or well head is closed + ELSE IF (NoGasPocket == 1 .OR. WellHeadOpen) THEN ! kick is not last element of choke line or well head is closed GasPocketNewPress%Array(:) = GasPocketNewPress%Array(:) * REAL(GasPocketNewVol%Array(:) / GasPocketOldVol%Array(:)) GasPocketOldPress%Array(:) = GasPocketNewPress%Array(:) GasPocketNewVol%Array(:) = GasPocketOldVol%Array(:) @@ -585,31 +602,31 @@ use SimulationVariables !@@@ 103 FORMAT (2I, 4X, (F9.3), 5X, (F9.3)) - GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) = GasPocketOldPress%Array(KickVARIABLES%NoGasPocket) - GasPocketNewVol%Array(KickVARIABLES%NoGasPocket) = GasPocketCompressibility%Array(KickVARIABLES%NoGasPocket) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketNewTemp%Array(KickVARIABLES%NoGasPocket) * GasPocketWeight%Array(KickVARIABLES%NoGasPocket) / GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) + GasPocketNewPress%Array(NoGasPocket) = GasPocketOldPress%Array(NoGasPocket) + GasPocketNewVol%Array(NoGasPocket) = GasPocketCompressibility%Array(NoGasPocket) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketNewTemp%Array(NoGasPocket) * GasPocketWeight%Array(NoGasPocket) / GasPocketNewPress%Array(NoGasPocket) !WRITE (*,*) 'Mid' DO WHILE (ABS(PressureCorrection * 10.0) > KickConvergenceTolerance) - DO j = KickVARIABLES%NoGasPocket - 1 , 1 , -1 + DO j = NoGasPocket - 1 , 1 , -1 CALL KickFunctionsCalculator(GasPocketNewPress%Array(j) , j , 5) - GasPocketNewVol%Array(j) = GasPocketCompressibility%Array(j) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & + GasPocketNewVol%Array(j) = GasPocketCompressibility%Array(j) * data%State%GasType(KickGasType)%GasConstant * & GasPocketNewTemp%Array(j) * GasPocketWeight%Array(j) / GasPocketNewPress%Array(j) !WRITE (*,*) j, REAL(GasPocketNewPress%Array(j)), REAL(GasPocketNewVol%Array(j) * Convft3toUSgal) END DO PressureCorrection = (SUM(GasPocketNewVol%Array(:)) - SUM(GasPocketOldVol%Array(:))) / SUM(GasPocketNewVol%Array(:) / GasPocketNewPress%Array(:)) - GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) = GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) + PressureCorrection - GasPocketNewVol%Array(KickVARIABLES%NoGasPocket) = GasPocketCompressibility%Array(KickVARIABLES%NoGasPocket) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketNewTemp%Array(KickVARIABLES%NoGasPocket) * GasPocketWeight%Array(KickVARIABLES%NoGasPocket) / GasPocketNewPress%Array(KickVARIABLES%NoGasPocket) - j = KickVARIABLES%NoGasPocket + GasPocketNewPress%Array(NoGasPocket) = GasPocketNewPress%Array(NoGasPocket) + PressureCorrection + GasPocketNewVol%Array(NoGasPocket) = GasPocketCompressibility%Array(NoGasPocket) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketNewTemp%Array(NoGasPocket) * GasPocketWeight%Array(NoGasPocket) / GasPocketNewPress%Array(NoGasPocket) + j = NoGasPocket !WRITE (*,*) j, REAL(GasPocketNewPress%Array(j)), REAL(GasPocketNewVol%Array(j) * Convft3toUSgal) END DO !WRITE (*,*) 'Pressure Correction = ', PressureCorrection WRITE (*,*) 'After' - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket WRITE (*,*) i, REAL(GasPocketNewPress%Array(i)), REAL((GasPocketNewVol%Array(i) * Convft3toUSgal)) END DO @@ -618,7 +635,7 @@ use SimulationVariables !@@@ END IF - IF (KickVARIABLES%GasPocketFlowEl(KickVARIABLES%NoGasPocket , 1) == 0) THEN + IF (GasPocketFlowEl(NoGasPocket , 1) == 0) THEN CALL RemoveGasPocket(1) !WRITE (*,*) 'GasPocketFlowEl', GasPocketFlowEl @@ -649,7 +666,7 @@ use SimulationVariables !@@@ INTEGER :: ilocal - DEALLOCATE(KickVARIABLES%KickJacobian , KickVARIABLES%OldKickJacobian , KickVARIABLES%KickVandPFunction , KickVARIABLES%KickUnknownVector , KickVARIABLES%KickCorrectionVector) + DEALLOCATE(KickJacobian , OldKickJacobian , KickVandPFunction , KickUnknownVector , KickCorrectionVector) WRITE (*,*) 'Gas Pocket Will be Removed', ilocal @@ -666,19 +683,20 @@ use SimulationVariables !@@@ call GasPocketDensity%Remove(ilocal) call GasPocketCompressibility%Remove(ilocal) - KickVARIABLES%NoGasPocket = KickVARIABLES%NoGasPocket - 1 + NoGasPocket = NoGasPocket - 1 - IF (KickVARIABLES%NoGasPocket > 0) THEN - ALLOCATE(KickVARIABLES%KickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%OldKickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickVandPFunction(2 * KickVARIABLES%NoGasPocket)) - ALLOCATE(KickVARIABLES%KickUnknownVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickCorrectionVector(2 * KickVARIABLES%NoGasPocket)) - - IF (ALLOCATED(KickVARIABLES%GasPocketFlowEl)) THEN - ALLOCATE(KickVARIABLES%tempGasPocketFlowEl(KickVARIABLES%NoGasPocket , SIZE(KickVARIABLES%GasPocketFlowEl , dim = 2))) - KickVARIABLES%tempGasPocketFlowEl = KickVARIABLES%GasPocketFlowEl(1 : KickVARIABLES%NoGasPocket , :) - DEALLOCATE(KickVARIABLES%GasPocketFlowEl) - ALLOCATE(KickVARIABLES%GasPocketFlowEl(SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 1) , SIZE(KickVARIABLES%tempGasPocketFlowEl , dim = 2))) - KickVARIABLES%GasPocketFlowEl = KickVARIABLES%tempGasPocketFlowEl - DEALLOCATE(KickVARIABLES%tempGasPocketFlowEl) + IF (NoGasPocket > 0) THEN + if (print_log) print *, "2 * NoGasPocket , 2 * NoGasPocket = ",2 * NoGasPocket , 2 * NoGasPocket + ALLOCATE(KickJacobian(2 * NoGasPocket , 2 * NoGasPocket) , OldKickJacobian(2 * NoGasPocket , 2 * NoGasPocket) , KickVandPFunction(2 * NoGasPocket)) + ALLOCATE(KickUnknownVector(2 * NoGasPocket) , KickCorrectionVector(2 * NoGasPocket)) + + IF (ALLOCATED(GasPocketFlowEl)) THEN + ALLOCATE(tempGasPocketFlowEl(NoGasPocket , SIZE(GasPocketFlowEl , dim = 2))) + tempGasPocketFlowEl = GasPocketFlowEl(1 : NoGasPocket , :) + DEALLOCATE(GasPocketFlowEl) + ALLOCATE(GasPocketFlowEl(SIZE(tempGasPocketFlowEl , dim = 1) , SIZE(tempGasPocketFlowEl , dim = 2))) + GasPocketFlowEl = tempGasPocketFlowEl + DEALLOCATE(tempGasPocketFlowEl) END IF ELSE ! NoGasPocket = 0 diff --git a/FluidFlow/kick/Formation_Information.f90 b/FluidFlow/kick/Formation_Information.f90 index d3631db..4f138f9 100644 --- a/FluidFlow/kick/Formation_Information.f90 +++ b/FluidFlow/kick/Formation_Information.f90 @@ -16,31 +16,31 @@ use SimulationVariables !@@@ INTEGER :: i REAL(8) :: WellGeoTopTVD - KickVARIABLES%KickGasType = 1 ! methane + KickGasType = 1 ! methane !==================================================== ! Formation Length Calculation !==================================================== WellGeoTopTVD = 0. - KickVARIABLES%KickFormTopMD = 0. - KickVARIABLES%KickFormDownMD = 0. + KickFormTopMD = 0. + KickFormDownMD = 0. !===> Top Measured Depth of Formation Do i = 1 , data%State%TD_WellGeneral%WellIntervalsCount if ( Reservoir%FormationTop >= data%State%TD_WellGeo(i)%VerticalDepth ) then - KickVARIABLES%KickFormTopMD = KickVARIABLES%KickFormTopMD + data%State%TD_WellGeo(i)%IntervalLength + KickFormTopMD = KickFormTopMD + data%State%TD_WellGeo(i)%IntervalLength !WRITE (*,*) ' here 11' , data%State%TD_WellGeo(i)%IntervalLength !WRITE (*,*) ' here v11' , data%State%TD_WellGeo(i)%VerticalDepth WellGeoTopTVD = data%State%TD_WellGeo(i)%VerticalDepth else if ( Reservoir%FormationTop < data%State%TD_WellGeo(i)%VerticalDepth ) then if ( data%State%TD_WellGeo(i)%HoleType == 0 ) then - KickVARIABLES%KickFormTopMD = KickVARIABLES%KickFormTopMD + ((Reservoir%FormationTop - WellGeoTopTVD)& + KickFormTopMD = KickFormTopMD + ((Reservoir%FormationTop - WellGeoTopTVD)& / cos(data%State%TD_WellGeo(i)%StartAngle)) !WRITE (*,*) ' here 12' , (FormationTop - WellGeoTopTVD) / cos(data%State%TD_WellGeo(i)%StartAngle) else - KickVARIABLES%KickFormTopMD = KickVARIABLES%KickFormTopMD + (data%State%TD_WellGeo(i)%RCurvature & + KickFormTopMD = KickFormTopMD + (data%State%TD_WellGeo(i)%RCurvature & * Asin((Reservoir%FormationTop - WellGeoTopTVD) / data%State%TD_WellGeo(i)%RCurvature)) !WRITE (*,*) ' here 13' , data%State%TD_WellGeo(i)%RCurvature * Asin((FormationTop - WellGeoTopTVD) / data%State%TD_WellGeo(i)%RCurvature) @@ -53,14 +53,14 @@ use SimulationVariables !@@@ WellGeoTopTVD = 0. Do i = 1 , data%State%TD_WellGeneral%WellIntervalsCount if ( (Reservoir%FormationTop + data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness)>=data%State%TD_WellGeo(i)%VerticalDepth ) then - KickVARIABLES%KickFormDownMD = KickVARIABLES%KickFormDownMD + data%State%TD_WellGeo(i)%IntervalLength + KickFormDownMD = KickFormDownMD + data%State%TD_WellGeo(i)%IntervalLength WellGeoTopTVD = data%State%TD_WellGeo(i)%VerticalDepth else if ( (Reservoir%FormationTop+data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness) Determination of Formation Length for Kick Modeling if (data%State%TD_WellGeneral%WellTotalVerticalLength >= Reservoir%FormationTop .AND. data%State%TD_WellGeneral%WellTotalVerticalLength < (Reservoir%FormationTop+data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness)) then - KickVARIABLES%KickFormLength = data%State%TD_WellGeneral%WellTotalLength - KickVARIABLES%KickFormTopMD ![ft] + KickFormLength = data%State%TD_WellGeneral%WellTotalLength - KickFormTopMD ![ft] else if ( data%State%TD_WellGeneral%WellTotalVerticalLength >= (Reservoir%FormationTop + data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness) ) then - KickVARIABLES%KickFormLength = KickVARIABLES%KickFormDownMD - KickVARIABLES%KickFormTopMD ![ft] + KickFormLength = KickFormDownMD - KickFormTopMD ![ft] else - KickVARIABLES%KickFormLength = 0. + KickFormLength = 0. end if - !PermeabilityExposedHeight = KickVARIABLES%KickFormLength * FormationPermeability + !PermeabilityExposedHeight = KickFormLength * FormationPermeability data%Equipments%DownHole%PermeabilityExposedHeight = data%State%MudSystem%FluidFlowCounter - data%State%MudSystem%MudSys_timeCounter !==================================================== ! Reservoir Data !==================================================== - KickVARIABLES%FormPermeability = Reservoir%FormationPermeability ! [mD] + FormPermeability = Reservoir%FormationPermeability ! [mD] - KickVARIABLES%FormPressure = data%State%TD_WellGeneral%WellTotalVerticalLength * data%Configuration%Formation%Formations(Reservoir%FormationNo)%PorePressureGradient ![psia] - data%Equipments%DownHole%FormationPressure = INT(KickVARIABLES%FormPressure) - !CALL Log_2('FormPressure =' , KickVARIABLES%FormPressure) + FormPressure = data%State%TD_WellGeneral%WellTotalVerticalLength * data%Configuration%Formation%Formations(Reservoir%FormationNo)%PorePressureGradient ![psia] + data%Equipments%DownHole%FormationPressure = INT(FormPressure) + !CALL Log_2('FormPressure =' , FormPressure) !if(print_log) print*, 'Formations(FormationNo)%PorePressureGradient=', Formations(FormationNo)%PorePressureGradient !print * , 'FormationNo=' , FormationNo !print * , 'data%State%TD_WellGeneral%WellTotalVerticalLength=' , data%State%TD_WellGeneral%WellTotalVerticalLength - KickVARIABLES%FormTemperature = 600 ! [Ra] - !WRITE (*,*) ' Formation pressure ' , KickVARIABLES%FormPressure + FormTemperature = 600 ! [Ra] + !WRITE (*,*) ' Formation pressure ' , FormPressure !==================================================== ! Gas Properties (Methane Gas) !==================================================== - KickVARIABLES%GasResTemperature = KickVARIABLES%FormTemperature - KickVARIABLES%GasResPressure = KickVARIABLES%FormPressure + GasResTemperature = FormTemperature + GasResPressure = FormPressure !!!! Methane , Gas type =1 - KickVARIABLES%GasKickMolarMass = data%State%GasType(KickVARIABLES%KickGasType)%MolarWt ! Methane Gas [gr/mol] - KickVARIABLES%GasSpecGravity = KickVARIABLES%GasKickMolarMass / GasDensityRefrence + GasKickMolarMass = data%State%GasType(KickGasType)%MolarWt ! Methane Gas [gr/mol] + GasSpecGravity = GasKickMolarMass / GasDensityRefrence - KickVARIABLES%KickTc = data%State%GasType(KickVARIABLES%KickGasType)%CritTemp - KickVARIABLES%KickPc = data%State%GasType(KickVARIABLES%KickGasType)%CritPress + KickTc = data%State%GasType(KickGasType)%CritTemp + KickPc = data%State%GasType(KickGasType)%CritPress !!!!!!!! Calculating Compressibility, viscosity for influx condition (Average of reservoir and bottomhole) - KickVARIABLES%KickTr = KickVARIABLES%GasResTemperature / KickVARIABLES%KickTc - KickVARIABLES%KickPr = KickVARIABLES%GasResPressure / KickVARIABLES%KickPc + KickTr = GasResTemperature / KickTc + KickPr = GasResPressure / KickPc - KickVARIABLES%K_A_Res = 3.53 * KickVARIABLES%KickPr - KickVARIABLES%K_B_Res = 10.0**(0.9813 * KickVARIABLES%KickTr) - KickVARIABLES%K_C_Res = 0.274 * (KickVARIABLES%KickPr**2) - KickVARIABLES%K_D_Res = 10.0**(0.8157 * KickVARIABLES%KickTr) + K_A_Res = 3.53 * KickPr + K_B_Res = 10.0**(0.9813 * KickTr) + K_C_Res = 0.274 * (KickPr**2) + K_D_Res = 10.0**(0.8157 * KickTr) - KickVARIABLES%GasResCompressibility = 0.98 !1. - (K_A_Res / K_B_Res) + (K_C_Res / K_D_Res) + GasResCompressibility = 0.98 !1. - (K_A_Res / K_B_Res) + (K_C_Res / K_D_Res) - KickVARIABLES%GasReservoirDensity = KickVARIABLES%GasResPressure / (KickVARIABLES%GasResCompressibility * & - KickVARIABLES%GasResTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) / Convft3toUSgal ! [ppg] + GasReservoirDensity = GasResPressure / (GasResCompressibility * & + GasResTemperature * data%State%GasType(KickGasType)%GasConstant) / Convft3toUSgal ! [ppg] END SUBROUTINE \ No newline at end of file diff --git a/FluidFlow/kick/Formation_Information.i90 b/FluidFlow/kick/Formation_Information.i90 index 31b09be..5302790 100644 --- a/FluidFlow/kick/Formation_Information.i90 +++ b/FluidFlow/kick/Formation_Information.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/FluidFlow/kick/Formation_Information.f90" +# 1 "/home/admin/SimulationCore2/FluidFlow/kick/Formation_Information.f90" SUBROUTINE FormationInformationCalculator use KickVARIABLESModule @@ -17,31 +17,31 @@ use SimulationVariables !@@@ INTEGER :: i REAL(8) :: WellGeoTopTVD - KickVARIABLES%KickGasType = 1 ! methane + KickGasType = 1 ! methane !==================================================== ! Formation Length Calculation !==================================================== WellGeoTopTVD = 0. - KickVARIABLES%KickFormTopMD = 0. - KickVARIABLES%KickFormDownMD = 0. + KickFormTopMD = 0. + KickFormDownMD = 0. !===> Top Measured Depth of Formation Do i = 1 , data%State%TD_WellGeneral%WellIntervalsCount if ( Reservoir%FormationTop >= data%State%TD_WellGeo(i)%VerticalDepth ) then - KickVARIABLES%KickFormTopMD = KickVARIABLES%KickFormTopMD + data%State%TD_WellGeo(i)%IntervalLength + KickFormTopMD = KickFormTopMD + data%State%TD_WellGeo(i)%IntervalLength !WRITE (*,*) ' here 11' , data%State%TD_WellGeo(i)%IntervalLength !WRITE (*,*) ' here v11' , data%State%TD_WellGeo(i)%VerticalDepth WellGeoTopTVD = data%State%TD_WellGeo(i)%VerticalDepth else if ( Reservoir%FormationTop < data%State%TD_WellGeo(i)%VerticalDepth ) then if ( data%State%TD_WellGeo(i)%HoleType == 0 ) then - KickVARIABLES%KickFormTopMD = KickVARIABLES%KickFormTopMD + ((Reservoir%FormationTop - WellGeoTopTVD)& + KickFormTopMD = KickFormTopMD + ((Reservoir%FormationTop - WellGeoTopTVD)& / cos(data%State%TD_WellGeo(i)%StartAngle)) !WRITE (*,*) ' here 12' , (FormationTop - WellGeoTopTVD) / cos(data%State%TD_WellGeo(i)%StartAngle) else - KickVARIABLES%KickFormTopMD = KickVARIABLES%KickFormTopMD + (data%State%TD_WellGeo(i)%RCurvature & + KickFormTopMD = KickFormTopMD + (data%State%TD_WellGeo(i)%RCurvature & * Asin((Reservoir%FormationTop - WellGeoTopTVD) / data%State%TD_WellGeo(i)%RCurvature)) !WRITE (*,*) ' here 13' , data%State%TD_WellGeo(i)%RCurvature * Asin((FormationTop - WellGeoTopTVD) / data%State%TD_WellGeo(i)%RCurvature) @@ -54,14 +54,14 @@ use SimulationVariables !@@@ WellGeoTopTVD = 0. Do i = 1 , data%State%TD_WellGeneral%WellIntervalsCount if ( (Reservoir%FormationTop + data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness)>=data%State%TD_WellGeo(i)%VerticalDepth ) then - KickVARIABLES%KickFormDownMD = KickVARIABLES%KickFormDownMD + data%State%TD_WellGeo(i)%IntervalLength + KickFormDownMD = KickFormDownMD + data%State%TD_WellGeo(i)%IntervalLength WellGeoTopTVD = data%State%TD_WellGeo(i)%VerticalDepth else if ( (Reservoir%FormationTop+data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness) Determination of Formation Length for Kick Modeling if (data%State%TD_WellGeneral%WellTotalVerticalLength >= Reservoir%FormationTop .AND. data%State%TD_WellGeneral%WellTotalVerticalLength < (Reservoir%FormationTop+data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness)) then - KickVARIABLES%KickFormLength = data%State%TD_WellGeneral%WellTotalLength - KickVARIABLES%KickFormTopMD ![ft] + KickFormLength = data%State%TD_WellGeneral%WellTotalLength - KickFormTopMD ![ft] else if ( data%State%TD_WellGeneral%WellTotalVerticalLength >= (Reservoir%FormationTop + data%Configuration%Formation%Formations(Reservoir%FormationNo)%Thickness) ) then - KickVARIABLES%KickFormLength = KickVARIABLES%KickFormDownMD - KickVARIABLES%KickFormTopMD ![ft] + KickFormLength = KickFormDownMD - KickFormTopMD ![ft] else - KickVARIABLES%KickFormLength = 0. + KickFormLength = 0. end if -!PermeabilityExposedHeight = KickVARIABLES%KickFormLength * FormationPermeability +!PermeabilityExposedHeight = KickFormLength * FormationPermeability data%Equipments%DownHole%PermeabilityExposedHeight = data%State%MudSystem%FluidFlowCounter - data%State%MudSystem%MudSys_timeCounter !==================================================== ! Reservoir Data !==================================================== - KickVARIABLES%FormPermeability = Reservoir%FormationPermeability ! [mD] + FormPermeability = Reservoir%FormationPermeability ! [mD] - KickVARIABLES%FormPressure = data%State%TD_WellGeneral%WellTotalVerticalLength * data%Configuration%Formation%Formations(Reservoir%FormationNo)%PorePressureGradient ![psia] - data%Equipments%DownHole%FormationPressure = INT(KickVARIABLES%FormPressure) -!CALL Log_2('FormPressure =' , KickVARIABLES%FormPressure) + FormPressure = data%State%TD_WellGeneral%WellTotalVerticalLength * data%Configuration%Formation%Formations(Reservoir%FormationNo)%PorePressureGradient ![psia] + data%Equipments%DownHole%FormationPressure = INT(FormPressure) +!CALL Log_2('FormPressure =' , FormPressure) !if(print_log) print*, 'Formations(FormationNo)%PorePressureGradient=', Formations(FormationNo)%PorePressureGradient !print * , 'FormationNo=' , FormationNo !print * , 'data%State%TD_WellGeneral%WellTotalVerticalLength=' , data%State%TD_WellGeneral%WellTotalVerticalLength - KickVARIABLES%FormTemperature = 600 ! [Ra] -!WRITE (*,*) ' Formation pressure ' , KickVARIABLES%FormPressure + FormTemperature = 600 ! [Ra] +!WRITE (*,*) ' Formation pressure ' , FormPressure !==================================================== ! Gas Properties (Methane Gas) !==================================================== - KickVARIABLES%GasResTemperature = KickVARIABLES%FormTemperature - KickVARIABLES%GasResPressure = KickVARIABLES%FormPressure + GasResTemperature = FormTemperature + GasResPressure = FormPressure !!!! Methane , Gas type =1 - KickVARIABLES%GasKickMolarMass = data%State%GasType(KickVARIABLES%KickGasType)%MolarWt ! Methane Gas [gr/mol] - KickVARIABLES%GasSpecGravity = KickVARIABLES%GasKickMolarMass / GasDensityRefrence + GasKickMolarMass = data%State%GasType(KickGasType)%MolarWt ! Methane Gas [gr/mol] + GasSpecGravity = GasKickMolarMass / GasDensityRefrence - KickVARIABLES%KickTc = data%State%GasType(KickVARIABLES%KickGasType)%CritTemp - KickVARIABLES%KickPc = data%State%GasType(KickVARIABLES%KickGasType)%CritPress + KickTc = data%State%GasType(KickGasType)%CritTemp + KickPc = data%State%GasType(KickGasType)%CritPress !!!!!!!! Calculating Compressibility, viscosity for influx condition (Average of reservoir and bottomhole) - KickVARIABLES%KickTr = KickVARIABLES%GasResTemperature / KickVARIABLES%KickTc - KickVARIABLES%KickPr = KickVARIABLES%GasResPressure / KickVARIABLES%KickPc + KickTr = GasResTemperature / KickTc + KickPr = GasResPressure / KickPc - KickVARIABLES%K_A_Res = 3.53 * KickVARIABLES%KickPr - KickVARIABLES%K_B_Res = 10.0**(0.9813 * KickVARIABLES%KickTr) - KickVARIABLES%K_C_Res = 0.274 * (KickVARIABLES%KickPr**2) - KickVARIABLES%K_D_Res = 10.0**(0.8157 * KickVARIABLES%KickTr) + K_A_Res = 3.53 * KickPr + K_B_Res = 10.0**(0.9813 * KickTr) + K_C_Res = 0.274 * (KickPr**2) + K_D_Res = 10.0**(0.8157 * KickTr) - KickVARIABLES%GasResCompressibility = 0.98 !1. - (K_A_Res / K_B_Res) + (K_C_Res / K_D_Res) + GasResCompressibility = 0.98 !1. - (K_A_Res / K_B_Res) + (K_C_Res / K_D_Res) - KickVARIABLES%GasReservoirDensity = KickVARIABLES%GasResPressure / (KickVARIABLES%GasResCompressibility * & - KickVARIABLES%GasResTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) / Convft3toUSgal ! [ppg] + GasReservoirDensity = GasResPressure / (GasResCompressibility * & + GasResTemperature * data%State%GasType(KickGasType)%GasConstant) / Convft3toUSgal ! [ppg] END SUBROUTINE diff --git a/FluidFlow/kick/Gas_Kick_Calculator.f90 b/FluidFlow/kick/Gas_Kick_Calculator.f90 index 5659c5c..0f494c2 100644 --- a/FluidFlow/kick/Gas_Kick_Calculator.f90 +++ b/FluidFlow/kick/Gas_Kick_Calculator.f90 @@ -23,159 +23,159 @@ use SimulationVariables !@@@ INTEGER :: i , j , k , l - KickVARIABLES%SolvingEquationError = .FALSE. - KickVARIABLES%KickVandPFunction(:) = 0.d0 - KickVARIABLES%KickJacobian(: , :) = 0.d0 + SolvingEquationError = .FALSE. + KickVandPFunction(:) = 0.d0 + KickJacobian(: , :) = 0.d0 !==================================================== ! Gas Properties (Methane Gas) !==================================================== !GasPocketNewTemp%Array(1) = 600 - KickVARIABLES%BottomHoleTemperature = 600 - KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress - KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 - KickVARIABLES%KickFluxAvgCompressibility = 0.98d0 - - KickVARIABLES%K_Aa = (5.8742362 * 10.**(-3) * KickVARIABLES%KickFluxAvgTemperature**1.2288) / (511.1728532 + KickVARIABLES%KickFluxAvgTemperature) - KickVARIABLES%K_Bb = 5.5565586 + (1000.01 / KickVARIABLES%KickFluxAvgTemperature) - KickVARIABLES%K_Cc = 2.47862 - 0.12294 * KickVARIABLES%K_Bb - KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & - KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 - - KickVARIABLES%GasKickViscosity = KickVARIABLES%K_Aa * EXP(KickVARIABLES%K_Bb * KickVARIABLES%GasKickSIDensity**KickVARIABLES%K_Cc) + BottomHoleTemperature = 600 + KickFluxAvgPressure = (BottomHolePress + FormPressure) / 2 + StandardPress + KickFluxAvgTemperature = (FormTemperature + BottomHoleTemperature) / 2 + KickFluxAvgCompressibility = 0.98d0 + + K_Aa = (5.8742362 * 10.**(-3) * KickFluxAvgTemperature**1.2288) / (511.1728532 + KickFluxAvgTemperature) + K_Bb = 5.5565586 + (1000.01 / KickFluxAvgTemperature) + K_Cc = 2.47862 - 0.12294 * K_Bb + GasKickSIDensity = KickFluxAvgPressure / (KickFluxAvgCompressibility * & + KickFluxAvgTemperature * data%State%GasType(KickGasType)%GasConstant) * Convpcftogpcm3 + + GasKickViscosity = K_Aa * EXP(K_Bb * GasKickSIDensity**K_Cc) !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!! Calculating compressibility for bottom hole condition - KickVARIABLES%BottomHoleCompressibility = 0.98d0 + BottomHoleCompressibility = 0.98d0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - KickVARIABLES%GasKickBg = 0.00504 * KickVARIABLES%KickFluxAvgCompressibility * KickVARIABLES%KickFluxAvgTemperature / KickVARIABLES%KickFluxAvgPressure ![bbl/SCF] + GasKickBg = 0.00504 * KickFluxAvgCompressibility * KickFluxAvgTemperature / KickFluxAvgPressure ![bbl/SCF] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !WRITE (*,*) 'Gas Kick Top' !===> Kick Flow Rate Calculation - IF (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress) THEN - KickVARIABLES%KickmdotACoef = 10.0**(-8) * 1.15741d0 * 7.080 * KickVARIABLES%FormPermeability * REAL(KickVARIABLES%KickFormLength) * data%State%GasType(KickVARIABLES%KickGasType)%StDensity / & - (KickVARIABLES%GasKickViscosity * KickVARIABLES%GasKickBg * LOG(10000.0)) - !IF (WellHeadOpen .AND. NoGasPocket == 1) KickVARIABLES%KickmdotACoef = (1.d0 + 2.d0) * KickmdotACoef + IF (FormPressure > BottomHolePress) THEN + KickmdotACoef = 10.0**(-8) * 1.15741d0 * 7.080 * FormPermeability * REAL(KickFormLength) * data%State%GasType(KickGasType)%StDensity / & + (GasKickViscosity * GasKickBg * LOG(10000.0)) + !IF (WellHeadOpen .AND. NoGasPocket == 1) KickmdotACoef = (1.d0 + 2.d0) * KickmdotACoef ELSE - KickVARIABLES%KickmdotACoef = 0.0 + KickmdotACoef = 0.0 END IF i = data%State%FricPressDrop%StringLastEl j = data%State%FricPressDrop%OpenholeFirstEl - 1 - k = KickVARIABLES%GasPocketFlowEl(1 , 1) - KickVARIABLES%KickmdotBCoef = KickVARIABLES%FormPressure + StandardPress !! - Sum(static and friction pressure loss) of flow elements below gas pocket, see below - IF (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress) THEN + k = GasPocketFlowEl(1 , 1) + KickmdotBCoef = FormPressure + StandardPress !! - Sum(static and friction pressure loss) of flow elements below gas pocket, see below + IF (FormPressure > BottomHolePress) THEN !WRITE (*,*) 'k , i, j' , k , i, j IF (k >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! Bottom of active kick is in openhole - KickVARIABLES%KickmdotBCoef = KickVARIABLES%KickmdotBCoef - (SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : k)%StaticPressDiff)) !+ SUM(FlowEl(j + 1 : GasPocketFlowEl(1 , 1) - 1)%FricPressLoss + KickmdotBCoef = KickmdotBCoef - (SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : k)%StaticPressDiff)) !+ SUM(FlowEl(j + 1 : GasPocketFlowEl(1 , 1) - 1)%FricPressLoss !WRITE (*,*) '1 SUM(FlowEl(j + 1 : k)%FricPressLoss', k, SUM(FlowEl(j + 1 : k)%FricPressLoss) ELSE IF (k < data%State%FricPressDrop%OpenholeFirstEl) THEN ! bottom of 1st gas pocket (active kick) is in annulus ond/or choke line only - KickVARIABLES%KickmdotBCoef = KickVARIABLES%KickmdotBCoef - SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : data%State%FricPressDrop%NumbEl)%StaticPressDiff) & + KickmdotBCoef = KickmdotBCoef - SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : data%State%FricPressDrop%NumbEl)%StaticPressDiff) & - (SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : k)%StaticPressDiff) + SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : k)%FricPressLoss)) END IF END IF - DO l = 1 , KickVARIABLES%NoGasPocket - KickVARIABLES%KickUnknownVector(2 * l - 1) = GasPocketNewVol%Array(l) - KickVARIABLES%KickUnknownVector(2 * l) = GasPocketNewPress%Array(l) + DO l = 1 , NoGasPocket + KickUnknownVector(2 * l - 1) = GasPocketNewVol%Array(l) + KickUnknownVector(2 * l) = GasPocketNewPress%Array(l) END DO - IF (KickVARIABLES%WellHeadOpen) THEN + IF (WellHeadOpen) THEN !!!!!!!!!! Calculation of functions of pocket Pressure and gas Volumes !IF (GasPocketElementNo(1) > 0) WRITE (*,*) ' GasPocketElementNo(1) ' , GasPocketElementNo(1) !WRITE (*,*) ' Kick Unknown Vector' , KickUnknownVector!(1) , KickUnknownVector(2) IF (KickIteration == 1) THEN ! updating initial guess based on previous time step data - DO l = 1 , KickVARIABLES%NoGasPocket - KickVARIABLES%KickUnknownVector(2 * l - 1) = KickVARIABLES%KickUnknownVector(2 * l - 1) + GasPocketDeltaVol%Array(l) + DO l = 1 , NoGasPocket + KickUnknownVector(2 * l - 1) = KickUnknownVector(2 * l - 1) + GasPocketDeltaVol%Array(l) END DO END IF - KickVARIABLES%KickVandPFunction(1) = KickVARIABLES%KickUnknownVector(1) - GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & ! VandP(1) = V(1) - GasPocketNewTemp%Array(1) * (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * MAX(((KickVARIABLES%KickmdotBCoef - KickVARIABLES%KickUnknownVector(2)) * dt) , 0.0)) / KickVARIABLES%KickUnknownVector(2) + KickVandPFunction(1) = KickUnknownVector(1) - GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * & ! VandP(1) = V(1) + GasPocketNewTemp%Array(1) * (GasPocketWeight%Array(1) + KickmdotACoef * MAX(((KickmdotBCoef - KickUnknownVector(2)) * dt) , 0.0)) / KickUnknownVector(2) !WRITE (*,*) 'KickVandPFunction(1)',KickVandPFunction(1) - l = 2 * KickVARIABLES%NoGasPocket - CALL KickFunctionsCalculator(KickVARIABLES%KickVandPFunction(l) , KickVARIABLES%NoGasPocket , 2) ! VandP(last) = P(last) + l = 2 * NoGasPocket + CALL KickFunctionsCalculator(KickVandPFunction(l) , NoGasPocket , 2) ! VandP(last) = P(last) !WRITE (*,*) 'KickVandPFunction(l)', l, KickVandPFunction(l) - DO l = 2 , KickVARIABLES%NoGasPocket ! VandP(Odd) = V(l, l > 1) - KickVARIABLES%KickVandPFunction(2 * l - 1) = KickVARIABLES%KickUnknownVector(2 * l - 1) - GasPocketCompressibility%Array(l) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketNewTemp%Array(l) * GasPocketWeight%Array(l) / KickVARIABLES%KickUnknownVector(2 * l) + DO l = 2 , NoGasPocket ! VandP(Odd) = V(l, l > 1) + KickVandPFunction(2 * l - 1) = KickUnknownVector(2 * l - 1) - GasPocketCompressibility%Array(l) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketNewTemp%Array(l) * GasPocketWeight%Array(l) / KickUnknownVector(2 * l) !WRITE(*,*) 'KickVandPFunction(V)', l, KickVandPFunction(2 * l - 1) END DO - DO l = KickVARIABLES%NoGasPocket - 1 , 1 , -1 - CALL KickFunctionsCalculator(KickVARIABLES%KickVandPFunction(2 * l) , l , 1) ! VandP(Even) = P(l, l < KickVARIABLES%NoGasPocket) + DO l = NoGasPocket - 1 , 1 , -1 + CALL KickFunctionsCalculator(KickVandPFunction(2 * l) , l , 1) ! VandP(Even) = P(l, l < NoGasPocket) !WRITE(*,*) 'KickVandPFunction(P)', l , KickVandPFunction(2 * l) END DO !!!!!!!!!! END - Calculation of functions of pocket Pressure and gas Volumes !!!!!!!!!! Calculation of Jacobian - DO k = 1 , 2 * KickVARIABLES%NoGasPocket ! Main Diagonal - KickVARIABLES%KickJacobian(k , k) = 1.d0 + DO k = 1 , 2 * NoGasPocket ! Main Diagonal + KickJacobian(k , k) = 1.d0 END DO - KickVARIABLES%KickJacobian(1,2) = (GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * GasPocketNewTemp%Array(1) & - * (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * KickVARIABLES%KickmdotBCoef * dt) / KickVARIABLES%KickUnknownVector(2)**2) ! Row 1 Finished - IF (KickVARIABLES%KickJacobian(1,2) == 0.d0) THEN + KickJacobian(1,2) = (GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * GasPocketNewTemp%Array(1) & + * (GasPocketWeight%Array(1) + KickmdotACoef * KickmdotBCoef * dt) / KickUnknownVector(2)**2) ! Row 1 Finished + IF (KickJacobian(1,2) == 0.d0) THEN CALL Error('KickJacobian(1,2) = 0.0') - KickVARIABLES%KickJacobian(1,2) = KickVARIABLES%OldKickJacobian(1,2) + KickJacobian(1,2) = OldKickJacobian(1,2) END IF !WRITE(*,*) 'KickJacobian(1,2)', KickJacobian(1,2) - l = KickVARIABLES%NoGasPocket - CALL KickFunctionsCalculator(KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) , KickVARIABLES%NoGasPocket , 4) ! for last Row - IF (KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) == 0.d0) THEN + l = NoGasPocket + CALL KickFunctionsCalculator(KickJacobian(2 * l , 2 * l - 1) , NoGasPocket , 4) ! for last Row + IF (KickJacobian(2 * l , 2 * l - 1) == 0.d0) THEN CALL Error ('KickJacobian(Last,Odd) = 0.0') - KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) = KickVARIABLES%OldKickJacobian(2 * l , 2 * l - 1) + KickJacobian(2 * l , 2 * l - 1) = OldKickJacobian(2 * l , 2 * l - 1) END IF - DO k = KickVARIABLES%NoGasPocket - 1 , 1 , -1 - KickVARIABLES%KickJacobian(2 * l , 2 * k - 1) = KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) + DO k = NoGasPocket - 1 , 1 , -1 + KickJacobian(2 * l , 2 * k - 1) = KickJacobian(2 * l , 2 * l - 1) END DO ! Last Row Finished !WRITE(*,*) 'KickJacobian(2,1)', KickJacobian(2,1) - DO k = 2 , KickVARIABLES%NoGasPocket - KickVARIABLES%KickJacobian(2 * k - 1 , 2 * k) = GasPocketCompressibility%Array(k) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * GasPocketNewTemp%Array(k) & - * GasPocketWeight%Array(k) / KickVARIABLES%KickUnknownVector(2 * k)**2 + DO k = 2 , NoGasPocket + KickJacobian(2 * k - 1 , 2 * k) = GasPocketCompressibility%Array(k) * data%State%GasType(KickGasType)%GasConstant * GasPocketNewTemp%Array(k) & + * GasPocketWeight%Array(k) / KickUnknownVector(2 * k)**2 END DO ! Odd Rows (V equations) Finished - DO k = 1 , KickVARIABLES%NoGasPocket - 1 - KickVARIABLES%KickJacobian(2 * k , 2 * k + 2) = -1.d0 + DO k = 1 , NoGasPocket - 1 + KickJacobian(2 * k , 2 * k + 2) = -1.d0 END DO ! Even Rows (P equations) effect of upper pocket - DO k = 2 , 2 * (KickVARIABLES%NoGasPocket - 1) , 2 + DO k = 2 , 2 * (NoGasPocket - 1) , 2 DO l = 1 , k - 1 , 2 - CALL KickFunctionsCalculator(KickVARIABLES%KickJacobian(k , l) , k / 2 , 3) - IF (KickVARIABLES%KickJacobian(k , l) == 0.d0) THEN + CALL KickFunctionsCalculator(KickJacobian(k , l) , k / 2 , 3) + IF (KickJacobian(k , l) == 0.d0) THEN WRITE (*,*) 'Jacobian Array = 0.0', k , l CALL Error ('KickJacobian(k , l) = 0.0') - KickVARIABLES%KickJacobian(k , l) = KickVARIABLES%OldKickJacobian(k , l) + KickJacobian(k , l) = OldKickJacobian(k , l) END IF END DO END DO - IF (ANY(IEEE_IS_NaN(KickVARIABLES%KickJacobian))) CALL ErrorStop ('NaN in calculating Kick Jacobian, Call your Service Provider') + IF (ANY(IEEE_IS_NaN(KickJacobian))) CALL ErrorStop ('NaN in calculating Kick Jacobian, Call your Service Provider') !!!!!!!!!! Solving linear equation in order to finding correction vector for correcting pocket pressure and gas induced flowrates - KickVARIABLES%KickVandPFunction = -1.d0 * KickVARIABLES%KickVandPFunction - CALL SOLVE_LINEAR_EQUATIONS(KickVARIABLES%KickJacobian , KickVARIABLES%KickCorrectionVector , KickVARIABLES%KickVandPFunction , KickVARIABLES%SolvingEquationError, SIZE(KickVARIABLES%KickCorrectionVector)) - IF (KickVARIABLES%SolvingEquationError) CALL ErrorStop( ' Error in solving kick equation ' ) + KickVandPFunction = -1.d0 * KickVandPFunction + CALL SOLVE_LINEAR_EQUATIONS(KickJacobian , KickCorrectionVector , KickVandPFunction , SolvingEquationError, SIZE(KickCorrectionVector)) + IF (SolvingEquationError) CALL ErrorStop( ' Error in solving kick equation ' ) - KickVARIABLES%KickUnknownVector = KickVARIABLES%KickUnknownVector + KickVARIABLES%KickCorrectionUnderRelaxation * KickVARIABLES%KickCorrectionVector + KickUnknownVector = KickUnknownVector + KickCorrectionUnderRelaxation * KickCorrectionVector - DO l = 1 , KickVARIABLES%NoGasPocket - GasPocketNewVol%Array(l) = KickVARIABLES%KickUnknownVector(2 * l - 1) + DO l = 1 , NoGasPocket + GasPocketNewVol%Array(l) = KickUnknownVector(2 * l - 1) IF (IEEE_IS_NaN(GasPocketNewVol%Array(l))) CALL ErrorStop('Volume of this pocket is Not a Number:', l) IF (GasPocketNewVol%Array(l) <= 0.d0) CALL Error('Volume of this pocket is Negative or Zero:', l) - GasPocketNewPress%Array(l) = KickVARIABLES%KickUnknownVector(2 * l) + GasPocketNewPress%Array(l) = KickUnknownVector(2 * l) IF (IEEE_IS_NaN(GasPocketNewPress%Array(l))) CALL ErrorStop('Pressure of this Pocket is Not a Number:', l) IF (GasPocketNewPress%Array(l) <= 0.d0) CALL ErrorStop('Pressure of this Pocket is Negative or Zero:', l) END DO @@ -186,19 +186,19 @@ use SimulationVariables !@@@ !WRITE (*,*) 'GasPocketOldPress (before)' , GasPocketOldPress(1) GasPocketNewPress%Array(1) = GasPocketOldPress%Array(1) * & - (REAL((GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * KickVARIABLES%KickmdotBCoef * dt) / (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * GasPocketOldPress%Array(1) * dt))) + (REAL((GasPocketWeight%Array(1) + KickmdotACoef * KickmdotBCoef * dt) / (GasPocketWeight%Array(1) + KickmdotACoef * GasPocketOldPress%Array(1) * dt))) END IF - !DO l = 1 , KickVARIABLES%NoGasPocket + !DO l = 1 , NoGasPocket GasPocketDeltaVol%Array(:) = GasPocketNewVol%Array(:) - GasPocketOldVol%Array(:) GasPocketFlowInduced%Array(:) = (GasPocketDeltaVol%Array(:)) / dt * 448.8 ! gpm !END DO - KickVARIABLES%GasKickPumpFlowRate = 0.0 - IF (NOT(KickVARIABLES%KickOffBottom) .AND. KickVARIABLES%WellHeadOpen) KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasKickPumpFlowRate = 0.0 + IF (NOT(KickOffBottom) .AND. WellHeadOpen) GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) @@ -223,8 +223,8 @@ use SimulationVariables !@@@ INTEGER :: y INTEGER :: z , i , j - x = KickVARIABLES%GasPocketFlowEl(GasPocketNo , 1) - IF (GasPocketNo < KickVARIABLES%NoGasPocket) y = KickVARIABLES%GasPocketFlowEl(GasPocketNo + 1 , 1) + x = GasPocketFlowEl(GasPocketNo , 1) + IF (GasPocketNo < NoGasPocket) y = GasPocketFlowEl(GasPocketNo + 1 , 1) i = data%State%FricPressDrop%StringLastEl j = data%State%FricPressDrop%OpenholeFirstEl - 1 @@ -242,7 +242,7 @@ use SimulationVariables !@@@ IF (CalcMode == 1) THEN ! calculating pressure difference between two pocket, include static pressure difference and frictional ! pressure difference, use in calculating 'KickVandPFunction' - ExitValue = KickVARIABLES%KickUnknownVector(2 * GasPocketNo) - KickVARIABLES%KickUnknownVector(2 * GasPocketNo + 2) + ExitValue = KickUnknownVector(2 * GasPocketNo) - KickUnknownVector(2 * GasPocketNo + 2) IF (x >= data%State%FricPressDrop%OpenholeFirstEl .AND. y < data%State%FricPressDrop%OpenholeFirstEl) THEN ! Case 2 , Case 3 ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricPressLoss) & - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%StaticPressDiff) - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%FricPressLoss) @@ -252,7 +252,7 @@ use SimulationVariables !@@@ ELSE IF (CalcMode == 2) THEN - ExitValue = KickVARIABLES%KickUnknownVector(2 * GasPocketNo) - StandardPress - data%State%FricPressDrop%Kchoke * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate**2 + ExitValue = KickUnknownVector(2 * GasPocketNo) - StandardPress - data%State%FricPressDrop%Kchoke * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate**2 IF (x >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! Gas Pocket is in Openhole ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricPressLoss) & - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%StaticPressDiff) - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FricPressLoss) @@ -346,14 +346,12 @@ use SimulationVariables !@@@ SUBROUTINE NewGasKick use SimulationVariables use KickVARIABLESModule - use SimulationVariables !@ Use CReservoirVariables Use CFormationVariables USE Fluid_Flow_Startup_Vars use PressureDisplayVARIABLESModule USE FricPressDropVarsModule USE MudSystemVARIABLES -use SimulationVariables !@@@ USE CMudPropertiesVariables USE CError USE , INTRINSIC :: IEEE_ARITHMETIC @@ -371,15 +369,15 @@ use SimulationVariables !@@@ IF (NOT(ALLOCATED(GasPocketWeight%Array))) THEN ! 1st kick WRITE (*,*) ' New Influx 1' - KickVARIABLES%NoGasPocket = 1 + NoGasPocket = 1 data%State%MudSystem%NewInfluxNumber = data%State%MudSystem%NewInfluxNumber + 1 data%State%MudSystem%NewInfluxElementCreated = 0 - KickVARIABLES%KickOffBottom = .FALSE. + KickOffBottom = .FALSE. - CALL GasPocketOldPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) - CALL GasPocketNewPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketOldPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketNewPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) CALL GasPocketOldTemp%AddToFirst(600.0) CALL GasPocketNewTemp%AddToFirst(600.0) CALL GasPocketOldVol%AddToFirst(0.d0) @@ -391,47 +389,47 @@ use SimulationVariables !@@@ CALL GasPocketDensity%AddToFirst(2.0) CALL GasPocketCompressibility%AddToFirst(0.98) - ALLOCATE(KickVARIABLES%KickJacobian(2 , 2) , KickVARIABLES%OldKickJacobian(2 , 2) , KickVARIABLES%KickVandPFunction(2) , KickVARIABLES%KickUnknownVector(2) , KickVARIABLES%KickCorrectionVector(2)) + ALLOCATE(KickJacobian(2 , 2) , OldKickJacobian(2 , 2) , KickVandPFunction(2) , KickUnknownVector(2) , KickCorrectionVector(2)) - KickVARIABLES%BottomHoleTemperature = 600 - KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress - KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 - KickVARIABLES%KickFluxAvgCompressibility = 0.98 + BottomHoleTemperature = 600 + KickFluxAvgPressure = (BottomHolePress + FormPressure) / 2 + StandardPress + KickFluxAvgTemperature = (FormTemperature + BottomHoleTemperature) / 2 + KickFluxAvgCompressibility = 0.98 - KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & - KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 - KickVARIABLES%GasKickDensity = KickVARIABLES%GasKickSIDensity * 8.3523 - GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * KickVARIABLES%MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + GasKickSIDensity = KickFluxAvgPressure / (KickFluxAvgCompressibility * & + KickFluxAvgTemperature * data%State%GasType(KickGasType)%GasConstant) * Convpcftogpcm3 + GasKickDensity = GasKickSIDensity * 8.3523 + GasPocketWeight%Array(1) = GasKickDensity * MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & + GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * & GasPocketNewTemp%Array(1) * GasPocketWeight%Array(1) / GasPocketNewPress%Array(1) GasPocketDeltaVol%Array(1) = 0.05 !GasPocketNewVol%Array(1) GasPocketFlowInduced%Array(1) = (GasPocketDeltaVol%Array(1)) / dt * 448.8 ! gpm - KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) - WRITE (*,*) ' FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress, KickVARIABLES%GasKickDensity + WRITE (*,*) ' FormPressure , BottomHolePress' , FormPressure , BottomHolePress, GasKickDensity WRITE (*,*) ' No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm)' - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i) END DO - !ELSE IF (NoGasPocket < MaxGasPocket .AND. KickVARIABLES%KickOffBottom .AND. (GasPocketNewVol%Array(1) > KickVARIABLES%MinAllowableKickVol .OR. KickWasExitingThroughChoke)) THEN - ELSE IF (KickVARIABLES%NoGasPocket < KickVARIABLES%MaxGasPocket .AND. KickVARIABLES%KickOffBottom .AND. (GasPocketNewVol%Array(1) > KickVARIABLES%MinAllowableKickVol .OR. ANY(KickVARIABLES%GasPocketFlowEl(1 , :) == data%State%FricPressDrop%OpenholeFirstEl - 1))) THEN - WRITE (*,*) ' New Influx', KickVARIABLES%NoGasPocket + 1 + !ELSE IF (NoGasPocket < MaxGasPocket .AND. KickOffBottom .AND. (GasPocketNewVol%Array(1) > MinAllowableKickVol .OR. KickWasExitingThroughChoke)) THEN + ELSE IF (NoGasPocket < MaxGasPocket .AND. KickOffBottom .AND. (GasPocketNewVol%Array(1) > MinAllowableKickVol .OR. ANY(GasPocketFlowEl(1 , :) == data%State%FricPressDrop%OpenholeFirstEl - 1))) THEN + WRITE (*,*) ' New Influx', NoGasPocket + 1 102 FORMAT (I2, 4X, (F8.1), 3X, (F8.3), 2X, (F8.3), 8X, (F8.3)) - KickVARIABLES%NoGasPocket = KickVARIABLES%NoGasPocket + 1 + NoGasPocket = NoGasPocket + 1 data%State%MudSystem%NewInfluxNumber = data%State%MudSystem%NewInfluxNumber + 1 data%State%MudSystem%NewInfluxElementCreated = 0 - KickVARIABLES%KickOffBottom = .FALSE. + KickOffBottom = .FALSE. - CALL GasPocketOldPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) - CALL GasPocketNewPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketOldPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketNewPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) CALL GasPocketOldTemp%AddToFirst(600.0) CALL GasPocketNewTemp%AddToFirst(600.0) CALL GasPocketOldVol%AddToFirst(0.d0) @@ -443,45 +441,45 @@ use SimulationVariables !@@@ CALL GasPocketDensity%AddToFirst(2.0) CALL GasPocketCompressibility%AddToFirst(0.98) - DEALLOCATE(KickVARIABLES%KickJacobian , KickVARIABLES%OldKickJacobian , KickVARIABLES%KickVandPFunction , KickVARIABLES%KickUnknownVector , KickVARIABLES%KickCorrectionVector) + DEALLOCATE(KickJacobian , OldKickJacobian , KickVandPFunction , KickUnknownVector , KickCorrectionVector) - ALLOCATE(KickVARIABLES%KickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%OldKickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket)) - ALLOCATE(KickVARIABLES%KickUnknownVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickCorrectionVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickVandPFunction(2 * KickVARIABLES%NoGasPocket)) + ALLOCATE(KickJacobian(2 * NoGasPocket , 2 * NoGasPocket) , OldKickJacobian(2 * NoGasPocket , 2 * NoGasPocket)) + ALLOCATE(KickUnknownVector(2 * NoGasPocket) , KickCorrectionVector(2 * NoGasPocket) , KickVandPFunction(2 * NoGasPocket)) - KickVARIABLES%BottomHoleTemperature = 600 - KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress - KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 - KickVARIABLES%KickFluxAvgCompressibility = 0.98 + BottomHoleTemperature = 600 + KickFluxAvgPressure = (BottomHolePress + FormPressure) / 2 + StandardPress + KickFluxAvgTemperature = (FormTemperature + BottomHoleTemperature) / 2 + KickFluxAvgCompressibility = 0.98 - KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & - KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 - KickVARIABLES%GasKickDensity = KickVARIABLES%GasKickSIDensity * 8.3523 + GasKickSIDensity = KickFluxAvgPressure / (KickFluxAvgCompressibility * & + KickFluxAvgTemperature * data%State%GasType(KickGasType)%GasConstant) * Convpcftogpcm3 + GasKickDensity = GasKickSIDensity * 8.3523 - !GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * 0.05 !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * KickVARIABLES%MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + !GasPocketWeight%Array(1) = GasKickDensity * 0.05 !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + GasPocketWeight%Array(1) = GasKickDensity * MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & + GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * & GasPocketNewTemp%Array(1) * GasPocketWeight%Array(1) / GasPocketNewPress%Array(1) GasPocketDeltaVol%Array(1) = 0.05 !GasPocketNewVol%Array(1) GasPocketFlowInduced%Array(1) = (GasPocketDeltaVol%Array(1)) / dt * 448.8 ! gpm - KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) - WRITE (*,*) ' FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress, KickVARIABLES%GasKickDensity + WRITE (*,*) ' FormPressure , BottomHolePress' , FormPressure , BottomHolePress, GasKickDensity WRITE (*,*) ' No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm)' - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i) END DO ELSE ! no new kick, so mass of 1st kick should increase - GasPocketWeight%Array(1) = GasPocketweight%Array(1) + KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasPocketWeight%Array(1) = GasPocketweight%Array(1) + KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) - IF (KickVARIABLES%NoGasPocket > 1 .OR. KickVARIABLES%SecondaryKickWeight > 0.0) THEN - KickVARIABLES%SecondaryKickWeight = KickVARIABLES%SecondaryKickWeight + KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - KickVARIABLES%SecondaryKickVol = KickVARIABLES%SecondaryKickWeight / KickVARIABLES%GasReservoirDensity / 42.0 ! 42 USGal = 1bbl + IF (NoGasPocket > 1 .OR. SecondaryKickWeight > 0.0) THEN + SecondaryKickWeight = SecondaryKickWeight + KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + SecondaryKickVol = SecondaryKickWeight / GasReservoirDensity / 42.0 ! 42 USGal = 1bbl END IF END IF diff --git a/FluidFlow/kick/Gas_Kick_Calculator.i90 b/FluidFlow/kick/Gas_Kick_Calculator.i90 index 3bf65c9..716d174 100644 --- a/FluidFlow/kick/Gas_Kick_Calculator.i90 +++ b/FluidFlow/kick/Gas_Kick_Calculator.i90 @@ -24,159 +24,159 @@ use SimulationVariables !@@@ INTEGER :: i , j , k , l - KickVARIABLES%SolvingEquationError = .FALSE. - KickVARIABLES%KickVandPFunction(:) = 0.d0 - KickVARIABLES%KickJacobian(: , :) = 0.d0 + SolvingEquationError = .FALSE. + KickVandPFunction(:) = 0.d0 + KickJacobian(: , :) = 0.d0 !==================================================== ! Gas Properties (Methane Gas) !==================================================== !GasPocketNewTemp%Array(1) = 600 - KickVARIABLES%BottomHoleTemperature = 600 - KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress - KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 - KickVARIABLES%KickFluxAvgCompressibility = 0.98d0 - - KickVARIABLES%K_Aa = (5.8742362 * 10.**(-3) * KickVARIABLES%KickFluxAvgTemperature**1.2288) / (511.1728532 + KickVARIABLES%KickFluxAvgTemperature) - KickVARIABLES%K_Bb = 5.5565586 + (1000.01 / KickVARIABLES%KickFluxAvgTemperature) - KickVARIABLES%K_Cc = 2.47862 - 0.12294 * KickVARIABLES%K_Bb - KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & - KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 - - KickVARIABLES%GasKickViscosity = KickVARIABLES%K_Aa * EXP(KickVARIABLES%K_Bb * KickVARIABLES%GasKickSIDensity**KickVARIABLES%K_Cc) + BottomHoleTemperature = 600 + KickFluxAvgPressure = (BottomHolePress + FormPressure) / 2 + StandardPress + KickFluxAvgTemperature = (FormTemperature + BottomHoleTemperature) / 2 + KickFluxAvgCompressibility = 0.98d0 + + K_Aa = (5.8742362 * 10.**(-3) * KickFluxAvgTemperature**1.2288) / (511.1728532 + KickFluxAvgTemperature) + K_Bb = 5.5565586 + (1000.01 / KickFluxAvgTemperature) + K_Cc = 2.47862 - 0.12294 * K_Bb + GasKickSIDensity = KickFluxAvgPressure / (KickFluxAvgCompressibility * & + KickFluxAvgTemperature * data%State%GasType(KickGasType)%GasConstant) * Convpcftogpcm3 + + GasKickViscosity = K_Aa * EXP(K_Bb * GasKickSIDensity**K_Cc) !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!! Calculating compressibility for bottom hole condition - KickVARIABLES%BottomHoleCompressibility = 0.98d0 + BottomHoleCompressibility = 0.98d0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - KickVARIABLES%GasKickBg = 0.00504 * KickVARIABLES%KickFluxAvgCompressibility * KickVARIABLES%KickFluxAvgTemperature / KickVARIABLES%KickFluxAvgPressure ![bbl/SCF] + GasKickBg = 0.00504 * KickFluxAvgCompressibility * KickFluxAvgTemperature / KickFluxAvgPressure ![bbl/SCF] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !WRITE (*,*) 'Gas Kick Top' !===> Kick Flow Rate Calculation - IF (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress) THEN - KickVARIABLES%KickmdotACoef = 10.0**(-8) * 1.15741d0 * 7.080 * KickVARIABLES%FormPermeability * REAL(KickVARIABLES%KickFormLength) * data%State%GasType(KickVARIABLES%KickGasType)%StDensity / & - (KickVARIABLES%GasKickViscosity * KickVARIABLES%GasKickBg * LOG(10000.0)) -!IF (WellHeadOpen .AND. NoGasPocket == 1) KickVARIABLES%KickmdotACoef = (1.d0 + 2.d0) * KickmdotACoef + IF (FormPressure > BottomHolePress) THEN + KickmdotACoef = 10.0**(-8) * 1.15741d0 * 7.080 * FormPermeability * REAL(KickFormLength) * data%State%GasType(KickGasType)%StDensity / & + (GasKickViscosity * GasKickBg * LOG(10000.0)) +!IF (WellHeadOpen .AND. NoGasPocket == 1) KickmdotACoef = (1.d0 + 2.d0) * KickmdotACoef ELSE - KickVARIABLES%KickmdotACoef = 0.0 + KickmdotACoef = 0.0 END IF i = data%State%FricPressDrop%StringLastEl j = data%State%FricPressDrop%OpenholeFirstEl - 1 - k = KickVARIABLES%GasPocketFlowEl(1 , 1) - KickVARIABLES%KickmdotBCoef = KickVARIABLES%FormPressure + StandardPress !! - Sum(static and friction pressure loss) of flow elements below gas pocket, see below - IF (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress) THEN + k = GasPocketFlowEl(1 , 1) + KickmdotBCoef = FormPressure + StandardPress !! - Sum(static and friction pressure loss) of flow elements below gas pocket, see below + IF (FormPressure > BottomHolePress) THEN !WRITE (*,*) 'k , i, j' , k , i, j IF (k >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! Bottom of active kick is in openhole - KickVARIABLES%KickmdotBCoef = KickVARIABLES%KickmdotBCoef - (SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : k)%StaticPressDiff)) !+ SUM(FlowEl(j + 1 : GasPocketFlowEl(1 , 1) - 1)%FricPressLoss + KickmdotBCoef = KickmdotBCoef - (SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : k)%StaticPressDiff)) !+ SUM(FlowEl(j + 1 : GasPocketFlowEl(1 , 1) - 1)%FricPressLoss !WRITE (*,*) '1 SUM(FlowEl(j + 1 : k)%FricPressLoss', k, SUM(FlowEl(j + 1 : k)%FricPressLoss) ELSE IF (k < data%State%FricPressDrop%OpenholeFirstEl) THEN ! bottom of 1st gas pocket (active kick) is in annulus ond/or choke line only - KickVARIABLES%KickmdotBCoef = KickVARIABLES%KickmdotBCoef - SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : data%State%FricPressDrop%NumbEl)%StaticPressDiff) & + KickmdotBCoef = KickmdotBCoef - SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : data%State%FricPressDrop%NumbEl)%StaticPressDiff) & - (SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : k)%StaticPressDiff) + SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : k)%FricPressLoss)) END IF END IF - DO l = 1 , KickVARIABLES%NoGasPocket - KickVARIABLES%KickUnknownVector(2 * l - 1) = GasPocketNewVol%Array(l) - KickVARIABLES%KickUnknownVector(2 * l) = GasPocketNewPress%Array(l) + DO l = 1 , NoGasPocket + KickUnknownVector(2 * l - 1) = GasPocketNewVol%Array(l) + KickUnknownVector(2 * l) = GasPocketNewPress%Array(l) END DO - IF (KickVARIABLES%WellHeadOpen) THEN + IF (WellHeadOpen) THEN !!!!!!!!!! Calculation of functions of pocket Pressure and gas Volumes !IF (GasPocketElementNo(1) > 0) WRITE (*,*) ' GasPocketElementNo(1) ' , GasPocketElementNo(1) !WRITE (*,*) ' Kick Unknown Vector' , KickUnknownVector!(1) , KickUnknownVector(2) IF (KickIteration == 1) THEN ! updating initial guess based on previous time step data - DO l = 1 , KickVARIABLES%NoGasPocket - KickVARIABLES%KickUnknownVector(2 * l - 1) = KickVARIABLES%KickUnknownVector(2 * l - 1) + GasPocketDeltaVol%Array(l) + DO l = 1 , NoGasPocket + KickUnknownVector(2 * l - 1) = KickUnknownVector(2 * l - 1) + GasPocketDeltaVol%Array(l) END DO END IF - KickVARIABLES%KickVandPFunction(1) = KickVARIABLES%KickUnknownVector(1) - GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & ! VandP(1) = V(1) - GasPocketNewTemp%Array(1) * (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * MAX(((KickVARIABLES%KickmdotBCoef - KickVARIABLES%KickUnknownVector(2)) * dt) , 0.0)) / KickVARIABLES%KickUnknownVector(2) + KickVandPFunction(1) = KickUnknownVector(1) - GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * & ! VandP(1) = V(1) + GasPocketNewTemp%Array(1) * (GasPocketWeight%Array(1) + KickmdotACoef * MAX(((KickmdotBCoef - KickUnknownVector(2)) * dt) , 0.0)) / KickUnknownVector(2) !WRITE (*,*) 'KickVandPFunction(1)',KickVandPFunction(1) - l = 2 * KickVARIABLES%NoGasPocket - CALL KickFunctionsCalculator(KickVARIABLES%KickVandPFunction(l) , KickVARIABLES%NoGasPocket , 2) ! VandP(last) = P(last) + l = 2 * NoGasPocket + CALL KickFunctionsCalculator(KickVandPFunction(l) , NoGasPocket , 2) ! VandP(last) = P(last) !WRITE (*,*) 'KickVandPFunction(l)', l, KickVandPFunction(l) - DO l = 2 , KickVARIABLES%NoGasPocket ! VandP(Odd) = V(l, l > 1) - KickVARIABLES%KickVandPFunction(2 * l - 1) = KickVARIABLES%KickUnknownVector(2 * l - 1) - GasPocketCompressibility%Array(l) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & - GasPocketNewTemp%Array(l) * GasPocketWeight%Array(l) / KickVARIABLES%KickUnknownVector(2 * l) + DO l = 2 , NoGasPocket ! VandP(Odd) = V(l, l > 1) + KickVandPFunction(2 * l - 1) = KickUnknownVector(2 * l - 1) - GasPocketCompressibility%Array(l) * data%State%GasType(KickGasType)%GasConstant * & + GasPocketNewTemp%Array(l) * GasPocketWeight%Array(l) / KickUnknownVector(2 * l) !WRITE(*,*) 'KickVandPFunction(V)', l, KickVandPFunction(2 * l - 1) END DO - DO l = KickVARIABLES%NoGasPocket - 1 , 1 , -1 - CALL KickFunctionsCalculator(KickVARIABLES%KickVandPFunction(2 * l) , l , 1) ! VandP(Even) = P(l, l < KickVARIABLES%NoGasPocket) + DO l = NoGasPocket - 1 , 1 , -1 + CALL KickFunctionsCalculator(KickVandPFunction(2 * l) , l , 1) ! VandP(Even) = P(l, l < NoGasPocket) !WRITE(*,*) 'KickVandPFunction(P)', l , KickVandPFunction(2 * l) END DO !!!!!!!!!! END - Calculation of functions of pocket Pressure and gas Volumes !!!!!!!!!! Calculation of Jacobian - DO k = 1 , 2 * KickVARIABLES%NoGasPocket ! Main Diagonal - KickVARIABLES%KickJacobian(k , k) = 1.d0 + DO k = 1 , 2 * NoGasPocket ! Main Diagonal + KickJacobian(k , k) = 1.d0 END DO - KickVARIABLES%KickJacobian(1,2) = (GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * GasPocketNewTemp%Array(1) & - * (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * KickVARIABLES%KickmdotBCoef * dt) / KickVARIABLES%KickUnknownVector(2)**2) ! Row 1 Finished - IF (KickVARIABLES%KickJacobian(1,2) == 0.d0) THEN + KickJacobian(1,2) = (GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * GasPocketNewTemp%Array(1) & + * (GasPocketWeight%Array(1) + KickmdotACoef * KickmdotBCoef * dt) / KickUnknownVector(2)**2) ! Row 1 Finished + IF (KickJacobian(1,2) == 0.d0) THEN CALL Error('KickJacobian(1,2) = 0.0') - KickVARIABLES%KickJacobian(1,2) = KickVARIABLES%OldKickJacobian(1,2) + KickJacobian(1,2) = OldKickJacobian(1,2) END IF !WRITE(*,*) 'KickJacobian(1,2)', KickJacobian(1,2) - l = KickVARIABLES%NoGasPocket - CALL KickFunctionsCalculator(KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) , KickVARIABLES%NoGasPocket , 4) ! for last Row - IF (KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) == 0.d0) THEN + l = NoGasPocket + CALL KickFunctionsCalculator(KickJacobian(2 * l , 2 * l - 1) , NoGasPocket , 4) ! for last Row + IF (KickJacobian(2 * l , 2 * l - 1) == 0.d0) THEN CALL Error ('KickJacobian(Last,Odd) = 0.0') - KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) = KickVARIABLES%OldKickJacobian(2 * l , 2 * l - 1) + KickJacobian(2 * l , 2 * l - 1) = OldKickJacobian(2 * l , 2 * l - 1) END IF - DO k = KickVARIABLES%NoGasPocket - 1 , 1 , -1 - KickVARIABLES%KickJacobian(2 * l , 2 * k - 1) = KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) + DO k = NoGasPocket - 1 , 1 , -1 + KickJacobian(2 * l , 2 * k - 1) = KickJacobian(2 * l , 2 * l - 1) END DO ! Last Row Finished !WRITE(*,*) 'KickJacobian(2,1)', KickJacobian(2,1) - DO k = 2 , KickVARIABLES%NoGasPocket - KickVARIABLES%KickJacobian(2 * k - 1 , 2 * k) = GasPocketCompressibility%Array(k) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * GasPocketNewTemp%Array(k) & - * GasPocketWeight%Array(k) / KickVARIABLES%KickUnknownVector(2 * k)**2 + DO k = 2 , NoGasPocket + KickJacobian(2 * k - 1 , 2 * k) = GasPocketCompressibility%Array(k) * data%State%GasType(KickGasType)%GasConstant * GasPocketNewTemp%Array(k) & + * GasPocketWeight%Array(k) / KickUnknownVector(2 * k)**2 END DO ! Odd Rows (V equations) Finished - DO k = 1 , KickVARIABLES%NoGasPocket - 1 - KickVARIABLES%KickJacobian(2 * k , 2 * k + 2) = -1.d0 + DO k = 1 , NoGasPocket - 1 + KickJacobian(2 * k , 2 * k + 2) = -1.d0 END DO ! Even Rows (P equations) effect of upper pocket - DO k = 2 , 2 * (KickVARIABLES%NoGasPocket - 1) , 2 + DO k = 2 , 2 * (NoGasPocket - 1) , 2 DO l = 1 , k - 1 , 2 - CALL KickFunctionsCalculator(KickVARIABLES%KickJacobian(k , l) , k / 2 , 3) - IF (KickVARIABLES%KickJacobian(k , l) == 0.d0) THEN + CALL KickFunctionsCalculator(KickJacobian(k , l) , k / 2 , 3) + IF (KickJacobian(k , l) == 0.d0) THEN WRITE (*,*) 'Jacobian Array = 0.0', k , l CALL Error ('KickJacobian(k , l) = 0.0') - KickVARIABLES%KickJacobian(k , l) = KickVARIABLES%OldKickJacobian(k , l) + KickJacobian(k , l) = OldKickJacobian(k , l) END IF END DO END DO - IF (ANY(IEEE_IS_NaN(KickVARIABLES%KickJacobian))) CALL ErrorStop ('NaN in calculating Kick Jacobian, Call your Service Provider') + IF (ANY(IEEE_IS_NaN(KickJacobian))) CALL ErrorStop ('NaN in calculating Kick Jacobian, Call your Service Provider') !!!!!!!!!! Solving linear equation in order to finding correction vector for correcting pocket pressure and gas induced flowrates - KickVARIABLES%KickVandPFunction = -1.d0 * KickVARIABLES%KickVandPFunction - CALL SOLVE_LINEAR_EQUATIONS(KickVARIABLES%KickJacobian , KickVARIABLES%KickCorrectionVector , KickVARIABLES%KickVandPFunction , KickVARIABLES%SolvingEquationError, SIZE(KickVARIABLES%KickCorrectionVector)) - IF (KickVARIABLES%SolvingEquationError) CALL ErrorStop( ' Error in solving kick equation ' ) + KickVandPFunction = -1.d0 * KickVandPFunction + CALL SOLVE_LINEAR_EQUATIONS(KickJacobian , KickCorrectionVector , KickVandPFunction , SolvingEquationError, SIZE(KickCorrectionVector)) + IF (SolvingEquationError) CALL ErrorStop( ' Error in solving kick equation ' ) - KickVARIABLES%KickUnknownVector = KickVARIABLES%KickUnknownVector + KickVARIABLES%KickCorrectionUnderRelaxation * KickVARIABLES%KickCorrectionVector + KickUnknownVector = KickUnknownVector + KickCorrectionUnderRelaxation * KickCorrectionVector - DO l = 1 , KickVARIABLES%NoGasPocket - GasPocketNewVol%Array(l) = KickVARIABLES%KickUnknownVector(2 * l - 1) + DO l = 1 , NoGasPocket + GasPocketNewVol%Array(l) = KickUnknownVector(2 * l - 1) IF (IEEE_IS_NaN(GasPocketNewVol%Array(l))) CALL ErrorStop('Volume of this pocket is Not a Number:', l) IF (GasPocketNewVol%Array(l) <= 0.d0) CALL Error('Volume of this pocket is Negative or Zero:', l) - GasPocketNewPress%Array(l) = KickVARIABLES%KickUnknownVector(2 * l) + GasPocketNewPress%Array(l) = KickUnknownVector(2 * l) IF (IEEE_IS_NaN(GasPocketNewPress%Array(l))) CALL ErrorStop('Pressure of this Pocket is Not a Number:', l) IF (GasPocketNewPress%Array(l) <= 0.d0) CALL ErrorStop('Pressure of this Pocket is Negative or Zero:', l) END DO @@ -187,19 +187,19 @@ use SimulationVariables !@@@ !WRITE (*,*) 'GasPocketOldPress (before)' , GasPocketOldPress(1) GasPocketNewPress%Array(1) = GasPocketOldPress%Array(1) * & - (REAL((GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * KickVARIABLES%KickmdotBCoef * dt) / (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * GasPocketOldPress%Array(1) * dt))) + (REAL((GasPocketWeight%Array(1) + KickmdotACoef * KickmdotBCoef * dt) / (GasPocketWeight%Array(1) + KickmdotACoef * GasPocketOldPress%Array(1) * dt))) END IF -!DO l = 1 , KickVARIABLES%NoGasPocket +!DO l = 1 , NoGasPocket GasPocketDeltaVol%Array(:) = GasPocketNewVol%Array(:) - GasPocketOldVol%Array(:) GasPocketFlowInduced%Array(:) = (GasPocketDeltaVol%Array(:)) / dt * 448.8 ! gpm !END DO - KickVARIABLES%GasKickPumpFlowRate = 0.0 - IF (NOT(KickVARIABLES%KickOffBottom) .AND. KickVARIABLES%WellHeadOpen) KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasKickPumpFlowRate = 0.0 + IF (NOT(KickOffBottom) .AND. WellHeadOpen) GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) @@ -224,8 +224,8 @@ use SimulationVariables !@@@ INTEGER :: y INTEGER :: z , i , j - x = KickVARIABLES%GasPocketFlowEl(GasPocketNo , 1) - IF (GasPocketNo < KickVARIABLES%NoGasPocket) y = KickVARIABLES%GasPocketFlowEl(GasPocketNo + 1 , 1) + x = GasPocketFlowEl(GasPocketNo , 1) + IF (GasPocketNo < NoGasPocket) y = GasPocketFlowEl(GasPocketNo + 1 , 1) i = data%State%FricPressDrop%StringLastEl j = data%State%FricPressDrop%OpenholeFirstEl - 1 @@ -243,7 +243,7 @@ use SimulationVariables !@@@ IF (CalcMode == 1) THEN ! calculating pressure difference between two pocket, include static pressure difference and frictional ! pressure difference, use in calculating 'KickVandPFunction' - ExitValue = KickVARIABLES%KickUnknownVector(2 * GasPocketNo) - KickVARIABLES%KickUnknownVector(2 * GasPocketNo + 2) + ExitValue = KickUnknownVector(2 * GasPocketNo) - KickUnknownVector(2 * GasPocketNo + 2) IF (x >= data%State%FricPressDrop%OpenholeFirstEl .AND. y < data%State%FricPressDrop%OpenholeFirstEl) THEN ! Case 2 , Case 3 ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricPressLoss) & - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%StaticPressDiff) - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%FricPressLoss) @@ -253,7 +253,7 @@ use SimulationVariables !@@@ ELSE IF (CalcMode == 2) THEN - ExitValue = KickVARIABLES%KickUnknownVector(2 * GasPocketNo) - StandardPress - data%State%FricPressDrop%Kchoke * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate**2 + ExitValue = KickUnknownVector(2 * GasPocketNo) - StandardPress - data%State%FricPressDrop%Kchoke * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate**2 IF (x >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! Gas Pocket is in Openhole ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricPressLoss) & - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%StaticPressDiff) - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FricPressLoss) @@ -372,15 +372,15 @@ use SimulationVariables !@@@ IF (NOT(ALLOCATED(GasPocketWeight%Array))) THEN ! 1st kick WRITE (*,*) ' New Influx 1' - KickVARIABLES%NoGasPocket = 1 + NoGasPocket = 1 data%State%MudSystem%NewInfluxNumber = data%State%MudSystem%NewInfluxNumber + 1 data%State%MudSystem%NewInfluxElementCreated = 0 - KickVARIABLES%KickOffBottom = .FALSE. + KickOffBottom = .FALSE. - CALL GasPocketOldPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) - CALL GasPocketNewPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketOldPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketNewPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) CALL GasPocketOldTemp%AddToFirst(600.0) CALL GasPocketNewTemp%AddToFirst(600.0) CALL GasPocketOldVol%AddToFirst(0.d0) @@ -392,47 +392,47 @@ use SimulationVariables !@@@ CALL GasPocketDensity%AddToFirst(2.0) CALL GasPocketCompressibility%AddToFirst(0.98) - ALLOCATE(KickVARIABLES%KickJacobian(2 , 2) , KickVARIABLES%OldKickJacobian(2 , 2) , KickVARIABLES%KickVandPFunction(2) , KickVARIABLES%KickUnknownVector(2) , KickVARIABLES%KickCorrectionVector(2)) + ALLOCATE(KickJacobian(2 , 2) , OldKickJacobian(2 , 2) , KickVandPFunction(2) , KickUnknownVector(2) , KickCorrectionVector(2)) - KickVARIABLES%BottomHoleTemperature = 600 - KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress - KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 - KickVARIABLES%KickFluxAvgCompressibility = 0.98 + BottomHoleTemperature = 600 + KickFluxAvgPressure = (BottomHolePress + FormPressure) / 2 + StandardPress + KickFluxAvgTemperature = (FormTemperature + BottomHoleTemperature) / 2 + KickFluxAvgCompressibility = 0.98 - KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & - KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 - KickVARIABLES%GasKickDensity = KickVARIABLES%GasKickSIDensity * 8.3523 - GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * KickVARIABLES%MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + GasKickSIDensity = KickFluxAvgPressure / (KickFluxAvgCompressibility * & + KickFluxAvgTemperature * data%State%GasType(KickGasType)%GasConstant) * Convpcftogpcm3 + GasKickDensity = GasKickSIDensity * 8.3523 + GasPocketWeight%Array(1) = GasKickDensity * MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & + GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * & GasPocketNewTemp%Array(1) * GasPocketWeight%Array(1) / GasPocketNewPress%Array(1) GasPocketDeltaVol%Array(1) = 0.05 !GasPocketNewVol%Array(1) GasPocketFlowInduced%Array(1) = (GasPocketDeltaVol%Array(1)) / dt * 448.8 ! gpm - KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) - WRITE (*,*) ' FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress, KickVARIABLES%GasKickDensity + WRITE (*,*) ' FormPressure , BottomHolePress' , FormPressure , BottomHolePress, GasKickDensity WRITE (*,*) ' No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm)' - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i) END DO -!ELSE IF (NoGasPocket < MaxGasPocket .AND. KickVARIABLES%KickOffBottom .AND. (GasPocketNewVol%Array(1) > KickVARIABLES%MinAllowableKickVol .OR. KickWasExitingThroughChoke)) THEN - ELSE IF (KickVARIABLES%NoGasPocket < KickVARIABLES%MaxGasPocket .AND. KickVARIABLES%KickOffBottom .AND. (GasPocketNewVol%Array(1) > KickVARIABLES%MinAllowableKickVol .OR. ANY(KickVARIABLES%GasPocketFlowEl(1 , :) == data%State%FricPressDrop%OpenholeFirstEl - 1))) THEN - WRITE (*,*) ' New Influx', KickVARIABLES%NoGasPocket + 1 +!ELSE IF (NoGasPocket < MaxGasPocket .AND. KickOffBottom .AND. (GasPocketNewVol%Array(1) > MinAllowableKickVol .OR. KickWasExitingThroughChoke)) THEN + ELSE IF (NoGasPocket < MaxGasPocket .AND. KickOffBottom .AND. (GasPocketNewVol%Array(1) > MinAllowableKickVol .OR. ANY(GasPocketFlowEl(1 , :) == data%State%FricPressDrop%OpenholeFirstEl - 1))) THEN + WRITE (*,*) ' New Influx', NoGasPocket + 1 102 FORMAT (I2, 4X, (F8.1), 3X, (F8.3), 2X, (F8.3), 8X, (F8.3)) - KickVARIABLES%NoGasPocket = KickVARIABLES%NoGasPocket + 1 + NoGasPocket = NoGasPocket + 1 data%State%MudSystem%NewInfluxNumber = data%State%MudSystem%NewInfluxNumber + 1 data%State%MudSystem%NewInfluxElementCreated = 0 - KickVARIABLES%KickOffBottom = .FALSE. + KickOffBottom = .FALSE. - CALL GasPocketOldPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) - CALL GasPocketNewPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketOldPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) + CALL GasPocketNewPress%AddToFirst((BottomHolePress + StandardPress) * 1.d0) CALL GasPocketOldTemp%AddToFirst(600.0) CALL GasPocketNewTemp%AddToFirst(600.0) CALL GasPocketOldVol%AddToFirst(0.d0) @@ -444,45 +444,45 @@ use SimulationVariables !@@@ CALL GasPocketDensity%AddToFirst(2.0) CALL GasPocketCompressibility%AddToFirst(0.98) - DEALLOCATE(KickVARIABLES%KickJacobian , KickVARIABLES%OldKickJacobian , KickVARIABLES%KickVandPFunction , KickVARIABLES%KickUnknownVector , KickVARIABLES%KickCorrectionVector) + DEALLOCATE(KickJacobian , OldKickJacobian , KickVandPFunction , KickUnknownVector , KickCorrectionVector) - ALLOCATE(KickVARIABLES%KickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%OldKickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket)) - ALLOCATE(KickVARIABLES%KickUnknownVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickCorrectionVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickVandPFunction(2 * KickVARIABLES%NoGasPocket)) + ALLOCATE(KickJacobian(2 * NoGasPocket , 2 * NoGasPocket) , OldKickJacobian(2 * NoGasPocket , 2 * NoGasPocket)) + ALLOCATE(KickUnknownVector(2 * NoGasPocket) , KickCorrectionVector(2 * NoGasPocket) , KickVandPFunction(2 * NoGasPocket)) - KickVARIABLES%BottomHoleTemperature = 600 - KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress - KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 - KickVARIABLES%KickFluxAvgCompressibility = 0.98 + BottomHoleTemperature = 600 + KickFluxAvgPressure = (BottomHolePress + FormPressure) / 2 + StandardPress + KickFluxAvgTemperature = (FormTemperature + BottomHoleTemperature) / 2 + KickFluxAvgCompressibility = 0.98 - KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & - KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 - KickVARIABLES%GasKickDensity = KickVARIABLES%GasKickSIDensity * 8.3523 + GasKickSIDensity = KickFluxAvgPressure / (KickFluxAvgCompressibility * & + KickFluxAvgTemperature * data%State%GasType(KickGasType)%GasConstant) * Convpcftogpcm3 + GasKickDensity = GasKickSIDensity * 8.3523 -!GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * 0.05 !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * KickVARIABLES%MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt +!GasPocketWeight%Array(1) = GasKickDensity * 0.05 !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + GasPocketWeight%Array(1) = GasKickDensity * MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & + GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickGasType)%GasConstant * & GasPocketNewTemp%Array(1) * GasPocketWeight%Array(1) / GasPocketNewPress%Array(1) GasPocketDeltaVol%Array(1) = 0.05 !GasPocketNewVol%Array(1) GasPocketFlowInduced%Array(1) = (GasPocketDeltaVol%Array(1)) / dt * 448.8 ! gpm - KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) - WRITE (*,*) ' FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress, KickVARIABLES%GasKickDensity + WRITE (*,*) ' FormPressure , BottomHolePress' , FormPressure , BottomHolePress, GasKickDensity WRITE (*,*) ' No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm)' - DO i = 1 , KickVARIABLES%NoGasPocket + DO i = 1 , NoGasPocket WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i) END DO ELSE ! no new kick, so mass of 1st kick should increase - GasPocketWeight%Array(1) = GasPocketweight%Array(1) + KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) + GasPocketWeight%Array(1) = GasPocketweight%Array(1) + KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) - IF (KickVARIABLES%NoGasPocket > 1 .OR. KickVARIABLES%SecondaryKickWeight > 0.0) THEN - KickVARIABLES%SecondaryKickWeight = KickVARIABLES%SecondaryKickWeight + KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1)) * dt - KickVARIABLES%SecondaryKickVol = KickVARIABLES%SecondaryKickWeight / KickVARIABLES%GasReservoirDensity / 42.0 ! 42 USGal = 1bbl + IF (NoGasPocket > 1 .OR. SecondaryKickWeight > 0.0) THEN + SecondaryKickWeight = SecondaryKickWeight + KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt + SecondaryKickVol = SecondaryKickWeight / GasReservoirDensity / 42.0 ! 42 USGal = 1bbl END IF END IF diff --git a/Geo/GeoMain.i90 b/Geo/GeoMain.i90 new file mode 100644 index 0000000..0979bcb --- /dev/null +++ b/Geo/GeoMain.i90 @@ -0,0 +1,76 @@ +# 1 "/home/admin/SimulationCore2/Geo/GeoMain.f90" +module GeoMain + use CLog4 + implicit none + + public + + integer :: SampleValue, TestValue + + contains +! subroutine Setup() +! use CPathChangeEvents +! implicit none + +! call BeforeTraverse%Add(InitialVarsBeforePathsChanges) +! call OnPathOpen%Add(WhenPathOpen) +! !call OnPathClose%Add(WhenPathClose) + +! end subroutine + +! subroutine InitialVarsBeforePathsChanges() +! implicit none + +! #ifdef deb +! if(print_log) print*, "ValveOne: FALSE (init)" +! #endif + +! end subroutine + +! subroutine WhenPathOpen(valves) +! implicit none +! integer, allocatable, intent (in) :: valves(:) + +! ! if ( any(valves == 1)) then +! !#ifdef deb +! ! if(print_log) print*, "ValveOne: TRUE" +! !#endif +! ! endif + +! end subroutine + +! subroutine Geo_Setup() +! ! use CSimulationVariables +! implicit none +! !call OnSimulationInitialization%Add(Geo_Init) +! call OnSimulationStop%Add(Geo_Stop) +! call OnGeoStart%Add(Geo_Start) +! call OnGeoStep%Add(Geo_Step) +! !call OnGeoOutput%Add(Geo_Output) +! call OnGeoMain%Add(GeoMainBody) +! end subroutine + + subroutine Geo_Stop + implicit none +!if(print_log) print*, 'Geo_Stop' + end subroutine Geo_Stop + +! subroutine Geo_Start +! implicit none +! !if(print_log) print*, '****************Geo_Start****************' +! end subroutine Geo_Start + + subroutine Geo_Step + implicit none + end subroutine Geo_Step + +! !subroutine Geo_Output +! ! implicit none +! ! !if(print_log) print*, 'Geo_Output' +! !end subroutine Geo_Output + +! subroutine GeoMainBody +! implicit none +! end subroutine GeoMainBody + +end module GeoMain diff --git a/Makefile b/Makefile index 6ba86d8..c2ed155 100644 --- a/Makefile +++ b/Makefile @@ -315,7 +315,6 @@ SRCS_F =\ Equipments/TopDrive/TopDrive_MainSolver.f90 \ CSharp/OperationScenarios/Common/OperationScenarios.f90 \ Equipments/ChokeControl/ChokeControlMain.f90 \ - Equipments/ChokeControl/ChokeStartup.f90 \ Equipments/MudSystem/MudSystemMain.f90 \ Equipments/Pumps/Pumps_Inputs.f90 \ Equipments/Pumps/Pumps_Outputs.f90 \ @@ -412,10 +411,9 @@ testjson: testredis: @echo "make test redis" - cc Redis/redis_io.c -c -o obj/redis_io.o + cc Redis/redis_io.c -c -g -o obj/redis_io.o $(FC) $(FCFLAGS) -c -o obj/Redis_Interface.o Redis/Redis_Interface.f90 - $(FC) $(FCFLAGS) -o Test_Redis obj/redis_io.o obj/Redis_Interface.o lib/libhiredis.a Test/test_redis.f90 - ./Test_Redis + $(FC) $(FCFLAGS) -o Test_Redis $(FCFLAGS) $(OBJS_F) obj/redis_io.o lib/libjsonfortran.a lib/libhiredis.a Test/test_redis.f90 testjson2: ifort -o test_json -module ./mod -fpp obj/Redis_Interface.o Test/testJson.f90 lib/libjsonfortran.a obj/redis_io.o lib/libhiredis.a diff --git a/Redis/Redis_Interface.f90 b/Redis/Redis_Interface.f90 index ae9eedf..636a2d0 100644 --- a/Redis/Redis_Interface.f90 +++ b/Redis/Redis_Interface.f90 @@ -49,11 +49,41 @@ Module RedisInterface use iso_c_binding, only: c_char character(kind=c_char) :: str(*) END SUBROUTINE publishMessageToChannel_C - + + ! Fortran subroutine to deallocate the memory + SUBROUTINE deallocate_c_string(c_pointer) BIND(C, NAME='free') + use iso_c_binding, only: c_char,c_ptr + ! IMPORT :: C_PTR + TYPE(c_ptr) :: c_pointer + ! No need for additional code here; the BIND attribute takes care of calling the C free function + END SUBROUTINE deallocate_c_string + + SUBROUTINE getData2_C(result,len) BIND(C, name='getData2') + USE ISO_C_BINDING, ONLY: C_PTR, C_INT + TYPE(C_PTR),VALUE :: result + INTEGER(C_INT) :: len + END SUBROUTINE getData2_C + End Interface contains +! Fortran subroutine to deallocate the memory + ! SUBROUTINE deallocate_c_string(c_ptr) BIND(C, NAME='free') + ! USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_FUNPTR, C_F_POINTER + ! IMPORT :: C_PTR, C_FUNPTR, C_F_POINTER + ! TYPE(C_PTR), INTENT(IN) :: c_ptr + ! TYPE(C_FUNPTR) :: free_func + ! INTERFACE + ! SUBROUTINE c_free(ptr) BIND(C, NAME='free') + ! IMPORT :: C_PTR + ! TYPE(C_PTR), VALUE :: ptr + ! END SUBROUTINE c_free + ! END INTERFACE + ! free_func = C_FUNLOC(c_free) + ! CALL C_F_POINTER(c_ptr, free_func) + ! END SUBROUTINE deallocate_c_string + SUBROUTINE initConnection(address,port,password, datakey,status) use iso_c_binding, only: c_null_char,c_char ! use json_module @@ -67,6 +97,18 @@ Module RedisInterface ! print *,"returned to initConnection" END SUBROUTINE initConnection + SUBROUTINE setState(str) + use SimulationVariables + use iso_c_binding, only: c_null_char + character(len=*):: str + character(len=len_trim(str)+1)::c_str + character(len=6)::part + part = "state"//c_null_char + c_str = str//c_null_char + if(log_level>4) print *,"setting Data: ",len_trim(str) + call setData_C(part,c_str) + END SUBROUTINE setState + SUBROUTINE setData(str) use SimulationVariables use iso_c_binding, only: c_null_char @@ -99,13 +141,37 @@ Module RedisInterface ! print *,"data read. l=",l ! len = int(c_len,kind=kind(len)) call c_f_pointer(c_string, string, string_shape) + ! call deallocateData() c_string=c_null_ptr + ! call deallocate_c_string(c_string) ! string = trim(string) ! print *,len_trim(string), "chars read." ! print *,string(1:l) ! getData2=string END SUBROUTINE getData + ! SUBROUTINE getData2(string, len) + ! USE ISO_C_BINDING, ONLY: C_PTR, C_INT,c_f_pointer + ! CHARACTER(LEN=:), ALLOCATABLE :: string + ! INTEGER :: len + ! TYPE(C_PTR) :: c_string + + ! ! Allocate the buffer in Fortran + ! ALLOCATE(CHARACTER(LEN=len) :: string) + + ! ! Call the C function to get the data + ! ! CALL getData2_C(c_string) + + ! ! Copy the data from the C pointer to the Fortran string + ! CALL C_F_POINTER(c_string, string, [len]) + + ! ! Deallocate the C pointer + ! CALL deallocate_c_string(c_string) + + ! ! Trim the string to remove any padding + ! string = TRIM(string) + ! END SUBROUTINE getData2 + subroutine ListenToChannel() print *, "ListenToChannel" call listenToChannel_C() @@ -120,7 +186,9 @@ Module RedisInterface use iso_c_binding, only: c_null_char character(len=*):: str character(len=len_trim(str)+1)::c_str - if(str .ne. 'ack') print *, "publishMessageToChannel: ", str + if(str .ne. 'ack') then + print *, "publishMessageToChannel: ", str + endif c_str = str//c_null_char ! if(log_level>4) print *,"Sending message: ",len_trim(str) call publishMessageToChannel_C(c_str) diff --git a/Redis/Redis_Interface.i90 b/Redis/Redis_Interface.i90 index 048f4bb..60b6fe0 100644 --- a/Redis/Redis_Interface.i90 +++ b/Redis/Redis_Interface.i90 @@ -43,10 +43,48 @@ Module RedisInterface SUBROUTINE deallocateData() BIND(C, name='deallocData') END SUBROUTINE deallocateData + SUBROUTINE listenToChannel_C() BIND(C,name='listenTochannel') + END SUBROUTINE listenToChannel_C + + SUBROUTINE publishMessageToChannel_C(str) BIND(C,name='publishMessageToChannel') + use iso_c_binding, only: c_char + character(kind=c_char) :: str(*) + END SUBROUTINE publishMessageToChannel_C + +! Fortran subroutine to deallocate the memory + SUBROUTINE deallocate_c_string(c_pointer) BIND(C, NAME='free') + use iso_c_binding, only: c_char,c_ptr +! IMPORT :: C_PTR + TYPE(c_ptr) :: c_pointer +! No need for additional code here; the BIND attribute takes care of calling the C free function + END SUBROUTINE deallocate_c_string + + SUBROUTINE getData2_C(result,len) BIND(C, name='getData2') + USE ISO_C_BINDING, ONLY: C_PTR, C_INT + TYPE(C_PTR),VALUE :: result + INTEGER(C_INT) :: len + END SUBROUTINE getData2_C + End Interface contains +! Fortran subroutine to deallocate the memory +! SUBROUTINE deallocate_c_string(c_ptr) BIND(C, NAME='free') +! USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_FUNPTR, C_F_POINTER +! IMPORT :: C_PTR, C_FUNPTR, C_F_POINTER +! TYPE(C_PTR), INTENT(IN) :: c_ptr +! TYPE(C_FUNPTR) :: free_func +! INTERFACE +! SUBROUTINE c_free(ptr) BIND(C, NAME='free') +! IMPORT :: C_PTR +! TYPE(C_PTR), VALUE :: ptr +! END SUBROUTINE c_free +! END INTERFACE +! free_func = C_FUNLOC(c_free) +! CALL C_F_POINTER(c_ptr, free_func) +! END SUBROUTINE deallocate_c_string + SUBROUTINE initConnection(address,port,password, datakey,status) use iso_c_binding, only: c_null_char,c_char ! use json_module @@ -60,6 +98,18 @@ Module RedisInterface ! print *,"returned to initConnection" END SUBROUTINE initConnection + SUBROUTINE setState(str) + use SimulationVariables + use iso_c_binding, only: c_null_char + character(len=*):: str + character(len=len_trim(str)+1)::c_str + character(len=6)::part + part = "state"//c_null_char + c_str = str//c_null_char + if(log_level>4) print *,"setting Data: ",len_trim(str) + call setData_C(part,c_str) + END SUBROUTINE setState + SUBROUTINE setData(str) use SimulationVariables use iso_c_binding, only: c_null_char @@ -72,18 +122,6 @@ Module RedisInterface call setData_C(part,c_str) END SUBROUTINE setData - SUBROUTINE setInput(str) - use SimulationVariables - use iso_c_binding, only: c_null_char - character(len=*):: str - character(len=len_trim(str)+1)::c_str - character(len=4)::part - part = "in"//c_null_char - c_str = str//c_null_char - if(log_level>4) print *,"setting Data: ",len_trim(str) - call setData_C(part,c_str) - END SUBROUTINE setInput - SUBROUTINE getData(string,len) use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_int ! character(:),allocatable :: getData2 @@ -94,7 +132,7 @@ Module RedisInterface integer::l l = 30000 string_shape(1) = l!int(l,kind=kind(Integer)) - print *,"reading data l=",l +! print *,"reading data l=",l if(.not. allocated(string)) then print *,"allocate string" allocate(character(l) :: string) @@ -104,85 +142,57 @@ Module RedisInterface ! print *,"data read. l=",l ! len = int(c_len,kind=kind(len)) call c_f_pointer(c_string, string, string_shape) +! call deallocateData() c_string=c_null_ptr +! call deallocate_c_string(c_string) ! string = trim(string) ! print *,len_trim(string), "chars read." ! print *,string(1:l) ! getData2=string END SUBROUTINE getData - SUBROUTINE getData2(string) !result(string) - use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_loc -! character(:),allocatable :: getData2 - character(len=:,kind=c_char),allocatable :: string - integer :: string_shape(1) - type(c_ptr) :: c_string - TYPE(FString), TARGET :: f_str - integer::l -! print *,"reading data (getData2)" - call getData_C_bystr(c_loc(f_str)) -! CALL MOVE_ALLOC(f_str%item, string) - string = trim(buffer) -! string = c_str -! len = int(c_len,kind=kind(len)) -! string_shape(1) = l! int(l,kind=kind(integer)) -! if(.not. allocated(string)) allocate(character(l) :: string) -! call c_f_pointer(c_string, string, string_shape) -! c_string=c_null_ptr -! print *,len_trim(string), "chars read." -! print *,string(1:l) - END SUBROUTINE getData2 - - SUBROUTINE getData3(key,string) - use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_loc -! character(:),allocatable :: getData2 - character(len=*) :: key - character(len=:),allocatable :: string - character(len=100) :: filename - integer::iostat -! print *,"reading data (getData2)" - filename = "/var/tmp/"//key - call getData_C_byfile() - open(unit=10, file=trim(filename)//".txt", status='old', action='read', iostat=iostat) - if (iostat /= 0) then - write(*, '(A)', advance='no') "Failed to open the file." - stop - end if -! Read the content of the file into the string - read(10, '(A)', iostat=iostat) string - if (iostat /= 0) then - write(*, '(A)', advance='no') "Failed to read the file." - stop - end if - -! Close the file - close(10) - END SUBROUTINE getData3 +! SUBROUTINE getData2(string, len) +! USE ISO_C_BINDING, ONLY: C_PTR, C_INT,c_f_pointer +! CHARACTER(LEN=:), ALLOCATABLE :: string +! INTEGER :: len +! TYPE(C_PTR) :: c_string + +! ! Allocate the buffer in Fortran +! ALLOCATE(CHARACTER(LEN=len) :: string) + +! ! Call the C function to get the data +! ! CALL getData2_C(c_string) - SUBROUTINE set_fortran_string(fstring_ptr, length, str) BIND(C, NAME='set_fortran_string') - USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_CHAR, C_INT, C_F_POINTER - TYPE(C_PTR), INTENT(IN), VALUE :: fstring_ptr - INTEGER(C_INT), INTENT(IN), VALUE :: length - CHARACTER(KIND=C_CHAR), INTENT(IN) :: str(length) -! Fortran pointer to the object referenced by fstring_ptr that -! holds the deferred length character component. - TYPE(FString), POINTER :: f_str - character(:),allocatable :: string - INTEGER :: i - integer :: string_shape(1) -!**** -! Associate the Fortran pointer with the object referenced by the -! C address. - string_shape(1) = length - allocate(character(length) :: string) - CALL C_F_POINTER(fstring_ptr, string,string_shape) -! Allocate the deferred length component to the given length. -! deallocate(f_str%item) -! ALLOCATE(CHARACTER(length) :: f_str%item) -! Copy over the data. -! FORALL (i=1:length) f_str%item(i:i) = str(i) - buffer(1:length) = string(1:length) - buffer(length+1:20000) = ' ' - END SUBROUTINE set_fortran_string +! ! Copy the data from the C pointer to the Fortran string +! CALL C_F_POINTER(c_string, string, [len]) + +! ! Deallocate the C pointer +! CALL deallocate_c_string(c_string) + +! ! Trim the string to remove any padding +! string = TRIM(string) +! END SUBROUTINE getData2 + + subroutine ListenToChannel() + print *, "ListenToChannel" + call listenToChannel_C() + end subroutine ListenToChannel + + subroutine test() bind (C,name="test") + print *, "test function in fortran." + end subroutine test + + subroutine publishMessageToChannel(str) + use SimulationVariables + use iso_c_binding, only: c_null_char + character(len=*):: str + character(len=len_trim(str)+1)::c_str + if(str .ne. 'ack') then + print *, "publishMessageToChannel: ", str + endif + c_str = str//c_null_char +! if(log_level>4) print *,"Sending message: ",len_trim(str) + call publishMessageToChannel_C(c_str) + end subroutine publishMessageToChannel END Module RedisInterface diff --git a/Redis/redis_io.c b/Redis/redis_io.c index 04fd1a4..77f5f4a 100644 --- a/Redis/redis_io.c +++ b/Redis/redis_io.c @@ -7,9 +7,10 @@ #include "../include/adapters/libevent.h" redisAsyncContext * asyncContext; redisContext *context; -char *result,*key,*pass,*channel_in,*channel_out; +char *key,*pass,*channel_in,*channel_out; extern void test(); +extern void writeState(); extern void setTongLever(int *v); extern void ButtonPress_Slips(); extern void ToggleValve(int *valve_number); @@ -81,7 +82,7 @@ char *getData(int *len) { redisReply *reply; reply = redisCommand(context, "GET %s.in",key); - result = (char*) malloc(*len); + char *result = (char*) malloc(*len); strcpy(result,reply->str); int paddingLength = (*len) - strlen(reply->str); if (paddingLength > 0) { @@ -92,11 +93,17 @@ char *getData(int *len) return result; } +void getData2(char *result, int *len) +{ + redisReply *reply; + reply = redisCommand(context, "GET %s.in",key); + strcpy(result,reply->str); + *len = strlen(reply->str); + freeReplyObject(reply); +} + void deallocData() { - free(result); - free(context); - free(key); } void onMessage(redisAsyncContext * c, void *reply, void * privdata) { @@ -110,15 +117,16 @@ void onMessage(redisAsyncContext * c, void *reply, void * privdata) { if(strcmp(r->element[0]->str,"message")==0) if(strcmp(r->element[1]->str,channel_in)==0) { - // char *message = malloc(srlen(r->element[2]->str)); - // strcpy(message,r->element[2]->str); char delimiter = ','; char *chptr = strchr(r->element[2]->str, delimiter); char *fn = strtok(r->element[2]->str,&delimiter); char *parameter = malloc(20); parameter = strtok(NULL,&delimiter); printf("calling %s\n",fn); - if(strcmp(fn,"test")==0) + if(strcmp(fn,"WRITE_STATE")==0){ + writeState(); + } + else if(strcmp(fn,"test")==0) test(); else if(strcmp(fn,"TONG_LEVER_MAKEUP")==0){ v = -1; @@ -132,10 +140,6 @@ void onMessage(redisAsyncContext * c, void *reply, void * privdata) { }else if(strcmp(fn,"ChangeValve")==0){ int valve_number = atoi(parameter); ToggleValve(&valve_number); - // }else if(strcmp(fn,"KellyConnected")==0){ - // KellyConnected(); - // }else if(strcmp(fn,"KellyDisconnected")==0){ - // KellyDisconnected(); }else printf("message: %s\n",r->element[2]->str); } diff --git a/Rop/sROP_Other_Variables.i90 b/Rop/sROP_Other_Variables.i90 new file mode 100644 index 0000000..d6699b1 --- /dev/null +++ b/Rop/sROP_Other_Variables.i90 @@ -0,0 +1,42 @@ +# 1 "/home/admin/SimulationCore2/Rop/sROP_Other_Variables.f90" +module sROP_Other_Variables + + implicit none + + +! real(8), parameter :: PI = 3.1415926 ! PI Number + + + + TYPE, PUBLIC :: ROPSpecificationInfo + + integer :: FormationNumber + real(8) :: FormationTopDepth +!CHARACTER(len=20) :: filename ! Name of file to open ??????????????????????????????????tuye type bemune ya bere biroon??? + INTEGER :: name , status ! I/O status + REAL(8) :: H1, H2, H3, wdmax ! The real value read in +! $$$$$**$$$$$**$$$$$**$$$$$**$$ End of Introduction of Module Inputs $$**$$$$$**$$$$$**$$$$$**$$$$$ +!character(len = 20) :: Formation_Type = 'Shale' ! Default = Shale +! -----**-----**-----**-----**-----** Bit Type: *-----**-----**-----**-----**----- + Integer :: BitClass ! Default = Rollar Cone + real(8) :: DiameterOfBit ! unit : [in.] (Typical Range: 3.0 to 30.0) + Integer :: NumberOfBitNozzles ! (Typical Range: 1 to 10) + real(8) :: DiameterOfBitNozzle ! unit : [1/32 in.] (Typical Values: 8.0 to 32.0) +! -----**-----**-----**-----**-----** End of Bit Type: *-----**-----**-----**-----**----- + real(8) :: CriticalMudDensity ! unit : [ppg] or [lb/gal] (Typical Range: 0 to 10.0) + real(8) :: CriticalWeightOnBit ! unit : [klb] (Typical Range: 0 to 10) + real(8) :: ReynoldsNumber ! unit : [klb] (Typical Range: 0.1 to 1000.0) +! -----**-----**-----**-----**-----** Other data%State%ROP_Bit%RateofPenetration Model Variables: *-----**-----**-----**-----**----- + real(8) :: f1, f2, f3, f4, f5, f6, f7, f8 + real(8) :: a1, a2, a3, a4, a5, a6, a7, a8 + real(8) :: BrCoef + real(8) :: dt , TouH +! -----**-----**-----**-----**--- End of Other data%State%ROP_Bit%RateofPenetration Model Variables ---**-----**-----**-----**----- +! $$$$$**$$$$$**$$$$$**$$$$$**$$$$$** End of Variable Definition *$$$$$**$$$$$**$$$$$**$$$$$**$$$$$ + + END TYPE ROPSpecificationInfo + + + + +end module sROP_Other_Variables diff --git a/Simulation/SimulationVariables.f90 b/Simulation/SimulationVariables.f90 index f0e3ffa..3cbf4fd 100644 --- a/Simulation/SimulationVariables.f90 +++ b/Simulation/SimulationVariables.f90 @@ -107,6 +107,7 @@ module SimulationVariables type(DownHoleType):: DownHole type(UnityInputsType)::UnityInputs type(UnityOutputsType):: UnityOutputs + Type(Pumps_Var) :: MPumps end type EquipmentControlType type SimulationStateType @@ -146,7 +147,6 @@ module SimulationVariables TYPE(MUD_TypeVars), DIMENSION(1:10) :: MUD !!Pumps - Type(Pumps_Var) :: MPumps TYPE(Pump_Var), DIMENSION(1:3) :: PUMP ! TYPE(RTable_Var) :: RTable diff --git a/Simulation/SimulationVariables.i90 b/Simulation/SimulationVariables.i90 index 7d03ce6..c16a03d 100644 --- a/Simulation/SimulationVariables.i90 +++ b/Simulation/SimulationVariables.i90 @@ -3,7 +3,8 @@ module SimulationVariables use Constants use logging use json_module - + + use ManifoldVariables use CUnityInputs use CUnityOutputs use COperationScenariosVariables @@ -90,7 +91,6 @@ module SimulationVariables Type(PathGenerationType)::Path ! Type(WellSurveyDataType)::WellSurveyData Type(MudPropertiesType)::Mud - end type ConfigurationType type EquipmentControlType @@ -106,12 +106,13 @@ module SimulationVariables Type(DrillingWatchType)::DrillingWatch Type(TankType)::Tank type(DownHoleType):: DownHole - type(UnityInputsType)::UnityInputs type(UnityOutputsType):: UnityOutputs + Type(Pumps_Var) :: MPumps end type EquipmentControlType type SimulationStateType + type(ManifoldType)::Manifold ! Type(HoistingType)::Hoisting !This ds placed twice in data (onece in configuration, once in state) type(OperationScenarioType)::OperationScenario type(NotificationType)::notifications @@ -147,7 +148,6 @@ module SimulationVariables TYPE(MUD_TypeVars), DIMENSION(1:10) :: MUD !!Pumps - Type(Pumps_Var) :: MPumps TYPE(Pump_Var), DIMENSION(1:3) :: PUMP ! TYPE(RTable_Var) :: RTable @@ -188,8 +188,6 @@ module SimulationVariables TYPE(TD_ROPHoleInfo), ALLOCATABLE, DIMENSION(:) :: TD_ROPHole TYPE(TD_WellGeneralInfo) :: TD_WellGeneral TYPE(TD_WellGeometryData), Allocatable :: TD_WellGeo(:) - - end type SimulationStateType type ProblemsType @@ -216,6 +214,7 @@ module SimulationVariables end type SimulationDataType type(SimulationDataType)::data + logical::print_log = .true. contains end module SimulationVariables diff --git a/SimulationCore2 b/SimulationCore2 index 63240aa..265915f 100755 Binary files a/SimulationCore2 and b/SimulationCore2 differ diff --git a/Simulator.f90 b/Simulator.f90 index 69bc851..514fd71 100644 --- a/Simulator.f90 +++ b/Simulator.f90 @@ -63,20 +63,27 @@ module Simulator use DrillingWatchModule use CTanks use UnityModule + use COperationScenariosSettings + use DownHoleModule + + use iso_c_binding, only: c_char,c_ptr,c_loc implicit none type(json_core):: jsoncore integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep logical::Kelly_ConnectionNothing_in_progress=.false. - character(len=:),allocatable::redisInput - character(len=:),allocatable::redisOutput,operationScenarioEvent + character(len=:),allocatable::redisInput,operationScenarioEvent,stateStr + character(kind=c_char,len=:),allocatable,target::redisOutput + type(c_ptr) :: c_string_ptr + character(len=100)::simulationId enum, bind(c) enumerator :: PLAY = 1 enumerator :: PAUSE = 2 enumerator :: STOP = 3 - enumerator :: PLAY_TO_DETERMINED_TIME = 4 + enumerator :: PLAY_TO_DETERMINED_TIME = 4 + enumerator :: LOAD_STATE = 5 end enum contains @@ -99,11 +106,16 @@ module Simulator end do ! call initSimulation(configFilename) call initConnection(redis_host,redis_port,redis_password, sim_id,status) + allocate(character(len=30000) :: redisOutput) if (status<0) then print *,"Can not init connection to redis." stop endif + call read_configuration() + if(simulationStatus==LOAD_STATE) then + call readState() + endif ! call read_variables() print *,"connection initialized" call init_modules() @@ -111,11 +123,11 @@ module Simulator ! call cpu_time(T1) simulationStep = 1 !$omp parallel sections + !$omp section call listenToChannel() - !$omp section - ! call sleepqq(100000) + !$omp section do while (.true.) if(mod(simulationStep,print_freq)==0) then print_log=.true. @@ -123,7 +135,7 @@ module Simulator print_log=.false. endif if(mod(simulationStep,10)==0) call publishMessageToChannel("ack") - if(simulationStep>100) exit + ! if(simulationStep>100) exit t0 = time_ms() if(print_log) print *,"simulationStep = ",simulationStep call read_variables() @@ -136,7 +148,7 @@ module Simulator endif t1 = time_ms() t_read = t_read+t1-t0 - call logg(4,"read completed") + ! call logg(4,"read completed") !! Rafiee, nothing changed call BopStack_Step() @@ -240,26 +252,26 @@ module Simulator subroutine write_variables() - ! use CAccumulator use json_module implicit none type(json_value),pointer :: jsonroot - ! character(len=:),allocatable::redisInput character(len=10)::str + type(json_value),pointer :: p 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 jsoncore%add(jsonroot,'step',simulationStep) - - ! call ConfigurationToJson(jsonroot) call WarningsToJson(jsonroot) ! call ProblemsToJson(jsonroot) call EquipmentsToJson(jsonroot) - call StateToJson(jsonroot) + ! call StateToJson(jsonroot) + + ! some data from state + call jsoncore%create_object(p,'State') + call ManifoldToJson(p) + call notificationsToJson(p) + call UnitySignalsToJson(p) + call jsoncore%add(jsonroot,p) call jsoncore%print_to_string(jsonroot,redisInput) if(log_level>4) then @@ -275,6 +287,82 @@ module Simulator ! print *,"write ends" end subroutine + subroutine readState() + ! type(json_value),pointer :: jsonroot,pval + type(json_file) :: jsonfile + type(json_core)::json + integer::len + ! logical::is_found + + c_string_ptr = c_loc(redisOutput) + call getData2_C(c_string_ptr,len) + + call jsonfile%initialize() + call jsonfile%get_core(json) + call jsonfile%deserialize(redisOutput(1:len)) + + + ! ! call OperationScenarioFromJson(jsonfile) + ! call notificationsFromJson(jsonfile) + ! call permissionsFromJson(jsonfile) + ! call unitySignalsFromJson(jsonfile) + ! call StudentStationFromJson(jsonfile) + ! call BopStackInputFromJson(jsonfile) + ! call BopStackAccFromJson(jsonfile) + ! call RamLineFromJson(jsonfile) + ! call AnnularComputationalFromJson(jsonfile) + ! call AnnularFromJson(jsonfile) + ! call PipeRam1FromJson(jsonfile) + ! call ShearRamFromJson(jsonfile) + ! call PipeRam2FromJson(jsonfile) + ! call ChokeLineFromJson(jsonfile) + ! call KillLineFromJson(jsonfile) + ! call PumpsFromJson(jsonfile) + ! call RAMFromJson(jsonfile) + ! call RAMSFromJson(jsonfile) + ! call ChokeFromJson(jsonfile) + ! call AirDrivenPumpFromJson(jsonfile) + ! call AirPumpLineFromJson(jsonfile) + ! call CHOOKEFromJson(jsonfile) + ! call DrawworksFromJson(jsonfile) + ! call MudSystemFromJson(jsonfile) + ! call MUDFromJson(jsonfile) + ! call MPumpsFromJson(jsonfile) + ! call PUMPFromJson(jsonfile) + ! call RTableFromJson(jsonfile) + ! call TDSFromJson(jsonfile) + ! call GasType(3)FromJson(jsonfile) + ! call PressureDisplayFromJson(jsonfile) + ! call FricPressDropFromJson(jsonfile) + ! call ROP_SpecFromJson(jsonfile) + ! call ROP_BitFromJson(jsonfile) + ! call TDGeoFromJson(jsonfile) + ! call F_String(:)FromJson(jsonfile) + ! call F_CountsFromJson(jsonfile) + ! call F_Interval(:)FromJson(jsonfile) + ! call OD_Annulus(4)FromJson(jsonfile) + ! call TD_DrillStemFromJson(jsonfile) + ! call TD_DrillStemsFromJson(jsonfile) + ! call TD_StringFromJson(jsonfile) + ! call TD_CountFromJson(jsonfile) + ! call G_StringElementFromJson(jsonfile) + ! call TD_VolFromJson(jsonfile) + ! call TD_GeneralFromJson(jsonfile) + ! call TD_BOPFromJson(jsonfile) + ! call TD_BOPElement(4)FromJson(jsonfile) + ! call TD_StConnFromJson(jsonfile) + ! call TD_LoadFromJson(jsonfile) + ! call TD_WellElFromJson(jsonfile) + ! call TD_CasingFromJson(jsonfile) + ! call TD_LinerFromJson(jsonfile) + ! call TD_OpenHoleFromJson(jsonfile) + ! call TD_ROPHoleFromJson(jsonfile) + ! call TD_WellGeneralFromJson(jsonfile) + ! call TD_WellGeo(:)FromJson(jsonfile) + + call jsonfile%destroy() + end subroutine + subroutine read_configuration() type(json_value),pointer :: jsonroot,pval type(json_file) :: jsonfile @@ -282,11 +370,12 @@ module Simulator integer::len ! character(len=:),allocatable::redisOutput ! call getData3(simulationId,redisOutput) - call getData(redisOutput,len) + c_string_ptr = c_loc(redisOutput) + call getData2_C(c_string_ptr,len) ! print *,len(redisOutput)," bytes read from redis" - open(1,file="redisContent.json",status="REPLACE") - write(1,"(A)") redisOutput - close(1) + ! open(1,file="redisContent.json",status="REPLACE") + ! write(1,"(A)") redisOutput + ! close(1) call jsonfile%initialize() call jsonfile%get_core(json) @@ -313,19 +402,16 @@ module Simulator integer::stat,leng logical::found - call getData(redisOutput,leng) + c_string_ptr = c_loc(redisOutput) + call getData2_C(c_string_ptr,leng) ! open(1,file="redisContent.json",status="REPLACE") ! write(1,"(A)") redisOutput ! close(1) call jsonfile%initialize() call jsonfile%get_core(json) - ! print *,"len_trim(redidOutput)=",len_trim(redisOutput) call jsonfile%deserialize(redisOutput(1:leng)) 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,stat) + call jsonfile%get('status',stat,found) if (stat==0) then if(print_log) print *,"Status is oddly zero" return @@ -343,7 +429,7 @@ module Simulator call json%get(pval,simulationEnd) ! call ProblemsFromJson(jsonfile) call EquipmentsFromJson(jsonfile) - call UnitySignalsFromJson(jsonfile) + ! call UnitySignalsFromJson(jsonfile) call jsonfile%destroy() end subroutine @@ -380,16 +466,14 @@ module Simulator !! Ahmadi call PathFinding_Init() + call OperationScenarios_Init() print *,"Modules are initialized" ! Calls OSInitialization and that sub only subscribes some notif - ! call OperationScenarios_Init() end subroutine init_modules subroutine EquipmentsFromJson(jsonfile) - type(json_value),pointer :: parent type(json_value),pointer :: p type(json_file)::jsonfile - integer::n_children logical::is_found ! 1. get related root @@ -410,13 +494,15 @@ module Simulator call TopDrivePanelFromJson(p) ! call DrillingWatchFromJson(p) call TankFromJson(p) - call UnityInputsFromJson(jsonfile) + ! call UnityInputsFromJson(jsonfile) - ! call HookFromJson(p) call jsonfile%get('Equipments.HookHeight',data%State%Drawworks%Hook_Height_final,is_found) if ( .not. is_found ) call logg(4,"Not found: Equipments.HookHeight") - if(print_log) print *,"HookHeight=",data%State%Drawworks%Hook_Height_final + ! if(print_log) print *,"HookHeight=",data%State%Drawworks%Hook_Height_final + ! call jsonfile%get('Equipments.TdsStemIn',data%Equipments%UnityInputs%TdsStemIn,is_found) + ! if ( .not. is_found ) call logg(4,"Not found: Equipments.TdsStemIn") + if (print_log .AND. data%Equipments%UnityInputs%TdsStemIn) print *,"TdsStemIn" end subroutine subroutine EquipmentsToJson(parent) @@ -437,43 +523,16 @@ module Simulator call StandPipeManifoldToJson(p) call TopDrivePanelToJson(p) call DrillingWatchToJson(p) + call DownHoleToJson(p) - ! call HookToJson(p) call jsoncore%add(p,"HookVelocity",data%State%Drawworks%HookLinearVelocity_final) + call jsoncore%add(p,"TotalSPM",data%Equipments%MPumps%Total_Pump_SPM) + ! 3. add new node to parent call jsoncore%add(parent,p) end subroutine - ! subroutine ConfigurationToJson(parent) - ! type(json_value),pointer :: parent - ! type(json_value),pointer :: p - - ! ! 1. create new node - ! call jsoncore%create_object(p,'Configuration') - - - ! ! 2. add member of data type to new node - ! call StringConfigurationToJson(p) - ! call FormationToJson(p) - ! call ReservoirToJson(p) - ! call ShoeToJson(p) - ! call AccumulatorToJson(p) - ! call BopStackToJson(p) - ! call HoistingToJson(p) - ! call PowerToJson(p) - ! call PumpsToJson(p) - ! call RigSizeToJson(p) - ! call CasingLinerChokeToJson(p) - ! call PathGenerationToJson(p) - ! ! call WellSurveyDataToJson(p) - ! call MudPropertiesToJson(p) - ! call UnityOutputsToJson(p) - - ! ! 3. add new node to parent - ! call jsoncore%add(parent,p) - ! end subroutine - subroutine WarningsToJson(parent) type(json_value),pointer :: parent type(json_value),pointer :: p @@ -537,20 +596,20 @@ module Simulator call jsoncore%add(parent,p) end subroutine - subroutine StateToJson(parent) - - type(json_value),pointer :: parent - + subroutine writeState() bind(C,name="writeState") + use json_module + implicit none type(json_value),pointer :: p + type(json_value),pointer :: jsonroot + character(len=10)::str - ! 1. create new node - call jsoncore%create_object(p,'State') + call jsoncore%initialize() + call jsoncore%create_object(p,'') call ManifoldToJson(p) - ! call OperationScenarioToJson(p) call notificationsToJson(p) - + call UnitySignalsToJson(p) + call OperationScenariosToJson(p) ! call permissionsToJson(p) - ! call unitySignalsToJson(p) ! call StudentStationToJson(p) ! call BopStackInputToJson(p) ! call BopStackAccToJson(p) @@ -604,11 +663,15 @@ module Simulator ! call TD_ROPHoleToJson(p) ! call TD_WellGeneralToJson(p) ! call TD_WellGeo(:)ToJson(p) - - ! 2. add member of data type to new node - ! 3. add new node to parent - call jsoncore%add(parent,p) + call jsoncore%print_to_string(p,stateStr) + if(log_level>4) then + write(str, '(I0)') len(stateStr) + print *,"Writing to redis:"//trim(stateStr) + endif + + call setState(stateStr) + call jsoncore%destroy(jsonroot) end subroutine !use this as a template @@ -729,9 +792,22 @@ module Simulator call RotaryProblemsFromJson(p) end subroutine - subroutine StateFromJson(parent) - type(json_value),pointer :: parent + subroutine StateFromJson(jsonfile) type(json_value),pointer :: p + type(json_file)::jsonfile + logical::is_found + + ! 1. get related root + ! call jsonfile%json_file_get_root(parent) + ! call jsoncore%get(parent,"Equipments",p) + call jsonfile%get("Equipments",p,is_found) + + ! call jsoncore%info(p, n_children=n_children) + ! print *,"number of Equipments =",n_children + + ! 2. add member of data type to new node + call BopControlPanelFromJson(p) + call ChokeControlPanelFromJson(jsonfile) ! 1. create new node ! call json%create_object(p,'State') @@ -825,5 +901,6 @@ module Simulator ! Kelly_ConnectionNothing_in_progress = .false. ! endif ! end subroutine + end module Simulator diff --git a/Simulator.i90 b/Simulator.i90 index 35adf5f..c8cfc70 100644 --- a/Simulator.i90 +++ b/Simulator.i90 @@ -64,18 +64,27 @@ module Simulator use DrillingWatchModule use CTanks use UnityModule + use COperationScenariosSettings + use DownHoleModule + + use iso_c_binding, only: c_char,c_ptr,c_loc implicit none type(json_core):: jsoncore integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep - character(len=:),allocatable::redisInput - character(len=:),allocatable::redisOutput + logical::Kelly_ConnectionNothing_in_progress=.false. + character(len=:),allocatable::redisInput,operationScenarioEvent,stateStr + character(kind=c_char,len=:),allocatable,target::redisOutput + type(c_ptr) :: c_string_ptr + character(len=100)::simulationId + enum, bind(c) enumerator :: PLAY = 1 enumerator :: PAUSE = 2 enumerator :: STOP = 3 - enumerator :: PLAY_TO_DETERMINED_TIME = 4 + enumerator :: PLAY_TO_DETERMINED_TIME = 4 + enumerator :: LOAD_STATE = 5 end enum contains @@ -87,9 +96,9 @@ module Simulator RETURN END FUNCTION - subroutine Simulate(redis_host,redis_port,redis_password, sim_id,stepTime) + subroutine Simulate(redis_host,redis_port,redis_password, sim_id,stepTime,print_freq) character(len=*) :: redis_host,redis_password, sim_id - integer::t0,t1,t2,t3,t_read=0,t_write=0,t_exec=0,i,status,redis_port,stepTime + integer::t0,t1,t2,t3,t_read=0,t_write=0,t_exec=0,i,status,redis_port,stepTime,print_freq integer(8),dimension(12)::t,t_modules !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! simulationId = sim_id @@ -98,33 +107,50 @@ module Simulator end do ! call initSimulation(configFilename) call initConnection(redis_host,redis_port,redis_password, sim_id,status) + allocate(character(len=30000) :: redisOutput) if (status<0) then print *,"Can not init connection to redis." stop endif + call read_configuration() + if(simulationStatus==LOAD_STATE) then + call readState() + endif ! call read_variables() print *,"connection initialized" call init_modules() print *,"modules initialized" ! call cpu_time(T1) simulationStep = 1 +!$omp parallel sections + +!$omp section + call listenToChannel() + +!$omp section do while (.true.) -! print *,"simulationStep=",simulationStep + if(mod(simulationStep,print_freq)==0) then + print_log=.true. + else + print_log=.false. + endif + if(mod(simulationStep,10)==0) call publishMessageToChannel("ack") +! if(simulationStep>100) exit t0 = time_ms() -! print *,"start reading." + if(print_log) print *,"simulationStep = ",simulationStep call read_variables() if(simulationStatus==PLAY_TO_DETERMINED_TIME .and. simulationStep>simulationEnd) exit if(simulationStatus==STOP) exit if(simulationStatus==PAUSE) then - print *, "paused" + if(print_log) print *, "Paused" call sleepqq(stepTime) go to 211 endif - call logg(4,"end reading") t1 = time_ms() t_read = t_read+t1-t0 - call logg(4,"read completed") +! call logg(4,"read completed") + !! Rafiee, nothing changed call BopStack_Step() t(1) = time_ms() @@ -210,10 +236,12 @@ module Simulator ! print *,"t=",t simulationStep = simulationStep + 1 211 end do +!$omp end parallel sections + ! call write_variables() ! call json%print(jsonroot,'test.json') ! call json%destroy(jsonroot) - do i=1,size(t) + do i=1,size(t) print *,"t_modules(",i,")=",t_modules(i) end do print *,"Number of steps =",simulationStep-1 @@ -223,50 +251,28 @@ module Simulator print *,"Total Time =",t_read+t_write+t_exec end subroutine Simulate -! subroutine initSimulation(configFilename) -! use json_module -! use iso_c_binding, only: c_null_char,c_char -! character(len=*) :: configFilename -! ! type(json_file) :: jsonfile -! type(json_value),pointer :: jsonvalue -! type(json_core) :: jsoncore -! ! logical :: is_found -! ! character(len=:),allocatable :: password,address,datakey -! ! character(len=:),allocatable::c_address,c_password,c_datakey - -! call jsonfile%initialize() -! ! print *,"init simulation with ",configFilename -! call jsonfile%load_file(configFilename); -! if (jsonfile%failed()) then -! print *,"can not open config file: ",configFilename ; -! stop -! endif -! ! print *,"file read" -! call jsonfile%json_file_get_root(jsonvalue) -! call jsoncore%get(jsonvalue,'log_level',log_level) -! print *,"log_level=",log_level -! end subroutine - + subroutine write_variables() -! use CAccumulator use json_module implicit none type(json_value),pointer :: jsonroot -! character(len=:),allocatable::redisInput character(len=10)::str + type(json_value),pointer :: p 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 jsoncore%add(jsonroot,'step',simulationStep) - -! call ConfigurationToJson(jsonroot) call WarningsToJson(jsonroot) ! call ProblemsToJson(jsonroot) call EquipmentsToJson(jsonroot) +! call StateToJson(jsonroot) + +! some data from state + call jsoncore%create_object(p,'State') + call ManifoldToJson(p) + call notificationsToJson(p) + call UnitySignalsToJson(p) + call jsoncore%add(jsonroot,p) call jsoncore%print_to_string(jsonroot,redisInput) if(log_level>4) then @@ -282,6 +288,82 @@ module Simulator ! print *,"write ends" end subroutine + subroutine readState() +! type(json_value),pointer :: jsonroot,pval + type(json_file) :: jsonfile + type(json_core)::json + integer::len +! logical::is_found + + c_string_ptr = c_loc(redisOutput) + call getData2_C(c_string_ptr,len) + + call jsonfile%initialize() + call jsonfile%get_core(json) + call jsonfile%deserialize(redisOutput(1:len)) + + +! ! call OperationScenarioFromJson(jsonfile) +! call notificationsFromJson(jsonfile) +! call permissionsFromJson(jsonfile) +! call unitySignalsFromJson(jsonfile) +! call StudentStationFromJson(jsonfile) +! call BopStackInputFromJson(jsonfile) +! call BopStackAccFromJson(jsonfile) +! call RamLineFromJson(jsonfile) +! call AnnularComputationalFromJson(jsonfile) +! call AnnularFromJson(jsonfile) +! call PipeRam1FromJson(jsonfile) +! call ShearRamFromJson(jsonfile) +! call PipeRam2FromJson(jsonfile) +! call ChokeLineFromJson(jsonfile) +! call KillLineFromJson(jsonfile) +! call PumpsFromJson(jsonfile) +! call RAMFromJson(jsonfile) +! call RAMSFromJson(jsonfile) +! call ChokeFromJson(jsonfile) +! call AirDrivenPumpFromJson(jsonfile) +! call AirPumpLineFromJson(jsonfile) +! call CHOOKEFromJson(jsonfile) +! call DrawworksFromJson(jsonfile) +! call MudSystemFromJson(jsonfile) +! call MUDFromJson(jsonfile) +! call MPumpsFromJson(jsonfile) +! call PUMPFromJson(jsonfile) +! call RTableFromJson(jsonfile) +! call TDSFromJson(jsonfile) +! call GasType(3)FromJson(jsonfile) +! call PressureDisplayFromJson(jsonfile) +! call FricPressDropFromJson(jsonfile) +! call ROP_SpecFromJson(jsonfile) +! call ROP_BitFromJson(jsonfile) +! call TDGeoFromJson(jsonfile) +! call F_String(:)FromJson(jsonfile) +! call F_CountsFromJson(jsonfile) +! call F_Interval(:)FromJson(jsonfile) +! call OD_Annulus(4)FromJson(jsonfile) +! call TD_DrillStemFromJson(jsonfile) +! call TD_DrillStemsFromJson(jsonfile) +! call TD_StringFromJson(jsonfile) +! call TD_CountFromJson(jsonfile) +! call G_StringElementFromJson(jsonfile) +! call TD_VolFromJson(jsonfile) +! call TD_GeneralFromJson(jsonfile) +! call TD_BOPFromJson(jsonfile) +! call TD_BOPElement(4)FromJson(jsonfile) +! call TD_StConnFromJson(jsonfile) +! call TD_LoadFromJson(jsonfile) +! call TD_WellElFromJson(jsonfile) +! call TD_CasingFromJson(jsonfile) +! call TD_LinerFromJson(jsonfile) +! call TD_OpenHoleFromJson(jsonfile) +! call TD_ROPHoleFromJson(jsonfile) +! call TD_WellGeneralFromJson(jsonfile) +! call TD_WellGeo(:)FromJson(jsonfile) + + call jsonfile%destroy() + end subroutine + subroutine read_configuration() type(json_value),pointer :: jsonroot,pval type(json_file) :: jsonfile @@ -289,11 +371,12 @@ module Simulator integer::len ! character(len=:),allocatable::redisOutput ! call getData3(simulationId,redisOutput) - call getData(redisOutput,len) + c_string_ptr = c_loc(redisOutput) + call getData2_C(c_string_ptr,len) ! print *,len(redisOutput)," bytes read from redis" - open(1,file="redisContent.json",status="REPLACE") - write(1,"(A)") redisOutput - close(1) +! open(1,file="redisContent.json",status="REPLACE") +! write(1,"(A)") redisOutput +! close(1) call jsonfile%initialize() call jsonfile%get_core(json) @@ -317,36 +400,37 @@ module Simulator type(json_value),pointer :: jsonroot,pval type(json_file) :: jsonfile type(json_core)::json -! character(len=:),allocatable::redisOutput integer::stat,leng -! call getData3(simulationId,redisOutput) - call getData(redisOutput,leng) - print *,len(redisOutput)," bytes read from redis" - open(1,file="redisContent.json",status="REPLACE") - write(1,"(A)") redisOutput - close(1) + logical::found + + c_string_ptr = c_loc(redisOutput) + call getData2_C(c_string_ptr,leng) +! open(1,file="redisContent.json",status="REPLACE") +! write(1,"(A)") redisOutput +! close(1) call jsonfile%initialize() call jsonfile%get_core(json) - print *,"len_trim(redidOutput)=",len_trim(redisOutput) call jsonfile%deserialize(redisOutput(1:leng)) 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,stat) + call jsonfile%get('status',stat,found) if (stat==0) then + if(print_log) print *,"Status is oddly zero" return endif - simulationStatus = stat + simulationStatus = stat + +! call jsonfile%get('OperationScenarioEvent',operationScenarioEvent,found) +! if ( .not. found .and. print_log) print *,"Not found: operationScenarioEvent" + call json%get(jsonroot,'speed',pval) call json%get(pval,simulationSpeed) if(simulationSpeed==0) simulationSpeed = 1 msPerStep = 100/simulationSpeed call json%get(jsonroot,'endstep',pval) call json%get(pval,simulationEnd) - print *,simulationStep,"/",simulationEnd ! call ProblemsFromJson(jsonfile) call EquipmentsFromJson(jsonfile) +! call UnitySignalsFromJson(jsonfile) call jsonfile%destroy() end subroutine @@ -371,8 +455,6 @@ module Simulator call BopStack_Init() call ChokeControl_Init() call MudSystem_Init() - print *,"Mudsystem initialized" -!Again calls Bop_Startup ! call PipeRams1_Init() ! call PipeRams2_Step() ! call KillLine_Step() @@ -382,19 +464,17 @@ module Simulator !! Sheikh call FluidFlow_Init() -! print *,"Mudsystem initialized" !! Ahmadi call PathFinding_Init() + call OperationScenarios_Init() + print *,"Modules are initialized" ! Calls OSInitialization and that sub only subscribes some notif -! call OperationScenarios_Init() end subroutine init_modules subroutine EquipmentsFromJson(jsonfile) - type(json_value),pointer :: parent type(json_value),pointer :: p type(json_file)::jsonfile - integer::n_children logical::is_found ! 1. get related root @@ -407,15 +487,23 @@ module Simulator ! 2. add member of data type to new node call BopControlPanelFromJson(p) - call ChokeControlPanelFromJson(p) + call ChokeControlPanelFromJson(jsonfile) call ChokeManifoldFromJson(p) call DataDisplayConsoleFromJson(p) call DrillingConsoleFromJson(jsonfile) -! call HookFromJson(p) call StandPipeManifoldFromJson(p) call TopDrivePanelFromJson(p) ! call DrillingWatchFromJson(p) call TankFromJson(p) +! call UnityInputsFromJson(jsonfile) + + call jsonfile%get('Equipments.HookHeight',data%State%Drawworks%Hook_Height_final,is_found) + if ( .not. is_found ) call logg(4,"Not found: Equipments.HookHeight") +! if(print_log) print *,"HookHeight=",data%State%Drawworks%Hook_Height_final + +! call jsonfile%get('Equipments.TdsStemIn',data%Equipments%UnityInputs%TdsStemIn,is_found) +! if ( .not. is_found ) call logg(4,"Not found: Equipments.TdsStemIn") + if (print_log .AND. data%Equipments%UnityInputs%TdsStemIn) print *,"TdsStemIn" end subroutine subroutine EquipmentsToJson(parent) @@ -433,45 +521,19 @@ module Simulator call ChokeManifoldToJson(p) call DataDisplayConsoleToJson(p) call DrillingConsoleToJson(p) - call HookToJson(p) call StandPipeManifoldToJson(p) call TopDrivePanelToJson(p) call DrillingWatchToJson(p) -! call TankToJson(p) + call DownHoleToJson(p) + + call jsoncore%add(p,"HookVelocity",data%State%Drawworks%HookLinearVelocity_final) + call jsoncore%add(p,"TotalSPM",data%Equipments%MPumps%Total_Pump_SPM) + ! 3. add new node to parent call jsoncore%add(parent,p) end subroutine -! subroutine ConfigurationToJson(parent) -! type(json_value),pointer :: parent -! type(json_value),pointer :: p - -! ! 1. create new node -! call jsoncore%create_object(p,'Configuration') - - -! ! 2. add member of data type to new node -! call StringConfigurationToJson(p) -! call FormationToJson(p) -! call ReservoirToJson(p) -! call ShoeToJson(p) -! call AccumulatorToJson(p) -! call BopStackToJson(p) -! call HoistingToJson(p) -! call PowerToJson(p) -! call PumpsToJson(p) -! call RigSizeToJson(p) -! call CasingLinerChokeToJson(p) -! call PathGenerationToJson(p) -! ! call WellSurveyDataToJson(p) -! call MudPropertiesToJson(p) -! call UnityOutputsToJson(p) - -! ! 3. add new node to parent -! call jsoncore%add(parent,p) -! end subroutine - subroutine WarningsToJson(parent) type(json_value),pointer :: parent type(json_value),pointer :: p @@ -535,19 +597,20 @@ module Simulator call jsoncore%add(parent,p) end subroutine - subroutine StateToJson(parent) - - type(json_value),pointer :: parent - + subroutine writeState() bind(C,name="writeState") + use json_module + implicit none type(json_value),pointer :: p + type(json_value),pointer :: jsonroot + character(len=10)::str -! 1. create new node - call jsoncore%create_object(p,'State') - -! call OperationScenarioToJson(p) + call jsoncore%initialize() + call jsoncore%create_object(p,'') + call ManifoldToJson(p) call notificationsToJson(p) + call UnitySignalsToJson(p) + call OperationScenariosToJson(p) ! call permissionsToJson(p) -! call unitySignalsToJson(p) ! call StudentStationToJson(p) ! call BopStackInputToJson(p) ! call BopStackAccToJson(p) @@ -601,25 +664,24 @@ module Simulator ! call TD_ROPHoleToJson(p) ! call TD_WellGeneralToJson(p) ! call TD_WellGeo(:)ToJson(p) - -! 2. add member of data type to new node -! 3. add new node to parent - call jsoncore%add(parent,p) + call jsoncore%print_to_string(p,stateStr) + if(log_level>4) then + write(str, '(I0)') len(stateStr) + print *,"Writing to redis:"//trim(stateStr) + endif + + call setState(stateStr) + call jsoncore%destroy(jsonroot) end subroutine !use this as a template subroutine notificationsToJson(parent) - type(json_value),pointer :: parent - type(json_value),pointer :: p - ! 1. create new node call jsoncore%create_object(p,'Notifications') - ! 2. add member of data type to new node - ! 3. add new node to parent call jsoncore%add(parent,p) end subroutine @@ -646,7 +708,6 @@ module Simulator call CasingLinerChokeFromJson(p) call PathGenerationFromJson(p) call MudPropertiesFromJson(p) - call UnityInputsFromJson(p) ! 3. add new node to parent ! nullify(parent) end subroutine @@ -732,9 +793,22 @@ module Simulator call RotaryProblemsFromJson(p) end subroutine - subroutine StateFromJson(parent) - type(json_value),pointer :: parent + subroutine StateFromJson(jsonfile) type(json_value),pointer :: p + type(json_file)::jsonfile + logical::is_found + +! 1. get related root +! call jsonfile%json_file_get_root(parent) +! call jsoncore%get(parent,"Equipments",p) + call jsonfile%get("Equipments",p,is_found) + +! call jsoncore%info(p, n_children=n_children) +! print *,"number of Equipments =",n_children + +! 2. add member of data type to new node + call BopControlPanelFromJson(p) + call ChokeControlPanelFromJson(jsonfile) ! 1. create new node ! call json%create_object(p,'State') @@ -818,5 +892,16 @@ module Simulator ! call json%add(parent,p) end subroutine +! subroutine fireOperationScenarioEvent() +! print *,"fireOperationScenarioEvent starts" +! if(operationScenarioEvent=='Kelly_ConnectionNothing'.and. .not. Kelly_ConnectionNothing_in_progress) then +! Kelly_ConnectionNothing_in_progress = .true. +! print *, "Starting Kelly_ConnectionNothing" +! call Kelly_ConnectionNothing() +! print *, "Kelly_ConnectionNothing ends." +! Kelly_ConnectionNothing_in_progress = .false. +! endif +! end subroutine + end module Simulator diff --git a/Test/test_redis.f90 b/Test/test_redis.f90 index 6bd733a..69fe192 100644 --- a/Test/test_redis.f90 +++ b/Test/test_redis.f90 @@ -5,30 +5,50 @@ module test_redis use RedisInterface use SimulationVariables use json_module + use iso_c_binding, only: c_ptr, c_char, c_f_pointer,c_null_char,c_loc character(len=:),allocatable::s2 character(len=:),allocatable::redisContent type(json_value),pointer :: jsonvalue type(json_core) :: jsoncore + type(json_file) :: jsonfile + type(json_core)::json - call initConnection() - print *,"redis exmaple program" - - call jsoncore%create_object(jsonvalue,'') - call ConfigurationToJson(jsonvalue) - call WarningsToJson(jsonvalue) - call ProblemsToJson(jsonvalue) - print *,"write starts" - call jsoncore%serialize(jsonvalue,redisContent) - ! s = "Test redis write!" - call setData(redisContent) - print *,"write ends len=",len(redisContent) - - call getData(s2) - print *,"len(read)=",len(s2) - print *, s2(1:10),' .... ', s2(len(s2)-10:len(s2)) - call deallocateData() - ! print *,"S2 = ",s2 - deallocate(s2) + type(c_ptr) :: c_string_ptr + character(len=20) :: f_string + character(kind=c_char, len=20),target,allocatable :: c_string + integer :: i,len + character(len=:),allocatable :: password,address,datakey + integer::port,status + integer :: string_shape(1) + logical :: found + + address = "78.109.201.86" + port = 6379 + password = "1qazxsw2$$" + datakey = "37364875-c9cf-43a3-de45-08dc0c6103c9" + status = 4 + + call initConnection(address,port,password, datakey,status) + print *,"redis exmaple program. status =",status + + allocate(character(len=20) :: c_string) + c_string = 'Hello' // c_null_char + c_string_ptr = c_loc(c_string) + len=19 + call getData2_C(c_string_ptr,len) + ! string_shape(1)=20 + ! call c_f_pointer(c_string_ptr, f_string, string_shape) + ! f_string(1:len) = c_string(1:len) + ! print *, "Fortran string: ", f_string(1:len) + + ! do i = 1, len + ! print *, "Character at position ", i, ": ", f_string(i:i) + ! end do + call jsonfile%initialize() + call jsonfile%deserialize(c_string(1:len)) + call jsonfile%get("status",status,found) + print *,"Status = ",status + call jsonfile%destroy() end SUBROUTINE end module test_redis @@ -36,3 +56,14 @@ program redis_example use test_redis call test() end program redis_example + + + ! call jsoncore%create_object(jsonvalue,'') + ! call ConfigurationToJson(jsonvalue) + ! call WarningsToJson(jsonvalue) + ! call ProblemsToJson(jsonvalue) + ! print *,"write starts" + ! call jsoncore%serialize(jsonvalue,redisContent) + ! ! s = "Test redis write!" + ! call setData(redisContent) + ! print *,"write ends len=",len(redisContent) diff --git a/Test_Redis b/Test_Redis new file mode 100755 index 0000000..3411574 Binary files /dev/null and b/Test_Redis differ diff --git a/Text1.txt b/Text1.txt index 0e24cd0..f57a4b0 100644 --- a/Text1.txt +++ b/Text1.txt @@ -1,8 +1,21 @@ - logical :: ElevatorConnectionPossible - logical :: JointConnectionPossible - logical :: IsKellyBushingSetInTable - logical :: ElevatorPickup - logical :: NearFloorPosition - logical :: SingleSetInMouseHole - logical :: TdsConnectionPossible - logical :: TdsStemIn + integer :: MudBucket = 0 + integer :: Elevator = 0 + integer :: FillupHead = 0 + integer :: Ibop = 0 + integer :: Kelly = 0 + integer :: MouseHole = 0 + integer :: OperationCondition = 0 + integer :: SafetyValve = 0 + integer :: operation = 0 + integer :: Slips = SLIPS_SET_END + integer :: Slips_S = 0 + integer :: Swing = 0 + integer :: Swing_S = 0 + integer :: TdsBackupClamp = 0 + integer :: TdsSpine = 0 + integer :: TdsSwing = 0 + integer :: TdsTong = 0 + integer :: Tong = 0 + integer :: Tong_S = 0 + integer :: TdsConnectionModes = 0 + integer :: TdsElevatorModes = 0 diff --git a/TorqueDrag/TD_DrillingSubs/TD_AddComponents.i90 b/TorqueDrag/TD_DrillingSubs/TD_AddComponents.i90 new file mode 100644 index 0000000..0883731 --- /dev/null +++ b/TorqueDrag/TD_DrillingSubs/TD_AddComponents.i90 @@ -0,0 +1,309 @@ +# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_DrillingSubs/TD_AddComponents.f90" +subroutine TD_AddComponents + + Use CStringConfigurationVariables + use UnitySignalVariables + use UnitySignalsModule + use OperationScenariosModule!, only: Get_ElevatorConnection + use CHoistingVariables + use SimulationVariables + Use TD_DrillStemComponents + use SimulationVariables !@ + use SimulationVariables !@ + Use TD_StringConnectionData + + implicit none + + integer :: i , kk , TD_NumOfAddedComponents + + + + + + + +!==================================================== +! Add Single +!==================================================== + + if ( Get_StringUpdate() == STRING_UPDATE_ADD_SINGLE ) then + kk = 0 + Do i= data%State%TD_String%DrillStemComponentsNumbs , 1 , -1 + if (data%State%TD_DrillStems(i)%ComponentType==3) then + kk = i + exit + end if + End Do +! DrillStems Array: + TD_NumOfAddedComponents = 1 + Do i= (data%State%TD_String%DrillStemComponentsNumbs+1) , (data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) + data%State%TD_DrillStems(i)%ComponentType = 3 + data%State%TD_DrillStems(i)%Id = data%State%TD_DrillStems(kk)%Id + data%State%TD_DrillStems(i)%Od = data%State%TD_DrillStems(kk)%Od + data%State%TD_DrillStems(i)%Area = (pi*((data%State%TD_DrillStems(i)%Od**2)-(data%State%TD_DrillStems(i)%Id**2)))/4.d0 + data%State%TD_DrillStems(i)%RtoolJoint = data%State%TD_DrillStems(i)%Od*1.3d0/2.d0 + data%State%TD_DrillStems(i)%ToolJointRange = data%State%TD_String%ToolJointRange + data%State%TD_DrillStems(i)%Length = data%State%TD_DrillStems(kk)%LengthIni + data%State%TD_DrillStems(i)%LengthIni = data%State%TD_DrillStems(kk)%LengthIni + data%State%TD_DrillStems(i)%WeightperLength = data%State%TD_DrillStems(kk)%WeightperLength + data%State%TD_DrillStems(i)%Weight = data%State%TD_DrillStems(i)%WeightperLength*data%State%TD_DrillStems(i)%Length + data%State%TD_DrillStems(i)%Density = data%State%TD_DrillStems(kk)%Density + data%State%TD_DrillStems(i)%ElasticModule = data%State%TD_DrillStems(kk)%ElasticModule + End Do + data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents +! DrillStem Array: + i = data%State%TD_String%StringConfigurationCount+1 + data%State%TD_DrillStem(i)%ComponentType = 3 + data%State%TD_DrillStem(i)%Numbs = 1 + data%State%TD_DrillStem(i)%Id = data%State%TD_DrillStems(kk)%Id ! [ft] + data%State%TD_DrillStem(i)%Od = data%State%TD_DrillStems(kk)%Od ! [ft] + data%State%TD_DrillStem(i)%Length = data%State%TD_DrillStems(kk)%LengthIni + data%State%TD_DrillStem(i)%WeightperLength = data%State%TD_DrillStems(kk)%WeightperLength + data%State%TD_DrillStem(i)%TotalLength = data%State%TD_DrillStem(i)%Numbs*data%State%TD_DrillStem(i)%Length + data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength + data%State%TD_String%StringConfigurationCount = data%State%TD_String%StringConfigurationCount+1 + + + Call Set_StringUpdate(STRING_UPDATE_NEUTRAL) + end if + + + + + +!==================================================== +! Add Stand +!==================================================== + + if ( Get_StringUpdate() == STRING_UPDATE_ADD_STAND ) then + kk = 0 + Do i= data%State%TD_String%DrillStemComponentsNumbs , 1 , -1 + if (data%State%TD_DrillStems(i)%ComponentType==3) then + kk = i + exit + end if + End Do +! DrillStems Array: + TD_NumOfAddedComponents = 3 + Do i= (data%State%TD_String%DrillStemComponentsNumbs+1) , (data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) + data%State%TD_DrillStems(i)%ComponentType = 3 + data%State%TD_DrillStems(i)%Id = data%State%TD_DrillStems(kk)%Id + data%State%TD_DrillStems(i)%Od = data%State%TD_DrillStems(kk)%Od + data%State%TD_DrillStems(i)%Area = (pi*((data%State%TD_DrillStems(i)%Od**2)-(data%State%TD_DrillStems(i)%Id**2)))/4.0d0 + data%State%TD_DrillStems(i)%RtoolJoint = data%State%TD_DrillStems(i)%Od*1.30d0/2.0d0 + data%State%TD_DrillStems(i)%ToolJointRange = data%State%TD_String%ToolJointRange + data%State%TD_DrillStems(i)%Length = data%State%TD_DrillStems(kk)%LengthIni + data%State%TD_DrillStems(i)%LengthIni = data%State%TD_DrillStems(kk)%LengthIni + data%State%TD_DrillStems(i)%WeightperLength = data%State%TD_DrillStems(kk)%WeightperLength + data%State%TD_DrillStems(i)%Weight = data%State%TD_DrillStems(i)%WeightperLength*data%State%TD_DrillStems(i)%Length + data%State%TD_DrillStems(i)%Density = data%State%TD_DrillStems(kk)%Density + data%State%TD_DrillStems(i)%ElasticModule = data%State%TD_DrillStems(kk)%ElasticModule + End Do + data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents + +! DrillStem Array: + i = data%State%TD_String%StringConfigurationCount+1 + data%State%TD_DrillStem(i)%ComponentType = 3 + data%State%TD_DrillStem(i)%Numbs = 3 + data%State%TD_DrillStem(i)%Id = data%State%TD_DrillStems(kk)%Id ! [ft] + data%State%TD_DrillStem(i)%Od = data%State%TD_DrillStems(kk)%Od ! [ft] + data%State%TD_DrillStem(i)%Length = data%State%TD_DrillStems(kk)%LengthIni + data%State%TD_DrillStem(i)%WeightperLength = data%State%TD_DrillStems(kk)%WeightperLength + data%State%TD_DrillStem(i)%TotalLength = data%State%TD_DrillStem(i)%Numbs*data%State%TD_DrillStem(i)%Length + data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength + data%State%TD_String%StringConfigurationCount = data%State%TD_String%StringConfigurationCount+1 + + + Call Set_StringUpdate(STRING_UPDATE_NEUTRAL) + end if + + + + + + +!==================================================== +! Add IBOP +!==================================================== + +!if ( Get_Ibop()==IBOP_INSTALL ) then +! data%State%TD_Count%IBOPNewAdd = 1 +!else +! data%State%TD_Count%IBOPNewAdd = 0 +! data%State%TD_Count%IBOPOldAdd = 0 +! end if + + if ( Get_Ibop()==IBOP_INSTALL .and. data%State%TD_Count%IBOPOldAdd==0 ) then + kk = 0 + Do i= data%State%TD_String%DrillStemComponentsNumbs , 1 , -1 + if (data%State%TD_DrillStems(i)%ComponentType==3) then + kk = i + exit + end if + End Do +! DrillStems Array: + TD_NumOfAddedComponents = 1 + Do i= (data%State%TD_String%DrillStemComponentsNumbs+1) , (data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) + data%State%TD_DrillStems(i)%ComponentType = 5 + data%State%TD_DrillStems(i)%Id = data%State%TD_DrillStems(kk)%Id + data%State%TD_DrillStems(i)%Od = data%State%TD_DrillStems(kk)%RtoolJoint + data%State%TD_DrillStems(i)%Area = (pi*((data%State%TD_DrillStems(i)%Od**2)-(data%State%TD_DrillStems(i)%Id**2)))/4.0d0 + data%State%TD_DrillStems(i)%RtoolJoint = data%State%TD_DrillStems(kk)%RtoolJoint + data%State%TD_DrillStems(i)%ToolJointRange = 0.0d0 + data%State%TD_DrillStems(i)%Length = data%State%TD_StConn%IBOPLength ! [ft] + data%State%TD_DrillStems(i)%LengthIni = data%State%TD_StConn%IBOPLength ! [ft] + data%State%TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft] + data%State%TD_DrillStems(i)%Weight = data%State%TD_DrillStems(i)%WeightperLength*data%State%TD_DrillStems(i)%Length + data%State%TD_DrillStems(i)%Density = data%State%TD_DrillStems(kk)%Density !???????????? + data%State%TD_DrillStems(i)%ElasticModule = data%State%TD_DrillStems(kk)%ElasticModule !???????????? + End Do + data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents + +! DrillStem Array: + i = data%State%TD_String%StringConfigurationCount+1 + data%State%TD_DrillStem(i)%ComponentType = 5 + data%State%TD_DrillStem(i)%Numbs = 1 + data%State%TD_DrillStem(i)%Id = data%State%TD_DrillStems(kk)%Id ! [ft] + data%State%TD_DrillStem(i)%Od = data%State%TD_DrillStems(kk)%RtoolJoint ! [ft] + data%State%TD_DrillStem(i)%Length = 1.540d0 ! [ft] + data%State%TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft] + data%State%TD_DrillStem(i)%TotalLength = data%State%TD_DrillStem(i)%Numbs*data%State%TD_DrillStem(i)%Length + data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength + data%State%TD_String%StringConfigurationCount = data%State%TD_String%StringConfigurationCount+1 + + +!data%State%TD_Count%IBOPOldAdd = data%State%TD_Count%IBOPNewAdd + + if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then + data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+data%State%TD_DrillStem(i)%Length + end if + + end if + + if ( Get_Ibop()==IBOP_INSTALL ) then + data%State%TD_Count%IBOPOldAdd = 1 + else + data%State%TD_Count%IBOPOldAdd = 0 + end if + + + + +!==================================================== +! Add Safety Valve & Kelly (OPERATION_DRILL) +!==================================================== + + if ( data%Configuration%Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then + data%State%TD_Count%KellyNewAdd = 1 + else + data%State%TD_Count%KellyNewAdd = 0 + data%State%TD_Count%KellyOldAdd = 0 + end if + + if ( data%Configuration%Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING .and. data%State%TD_Count%KellyNewAdd/=data%State%TD_Count%KellyOldAdd ) then +! DrillStems Array: + TD_NumOfAddedComponents = 1 + Do i= (data%State%TD_String%DrillStemComponentsNumbs+1) , (data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) + data%State%TD_DrillStems(i)%ComponentType = 6 + data%State%TD_DrillStems(i)%Id = data%State%TD_StConn%KellyElementID ! [ft] + data%State%TD_DrillStems(i)%Od = data%State%TD_StConn%KellyElementOD ! [ft] + data%State%TD_DrillStems(i)%Area = (pi*((data%State%TD_DrillStems(i)%Od**2)-(data%State%TD_DrillStems(i)%Id**2)))/4.0d0 + data%State%TD_DrillStems(i)%RtoolJoint = data%State%TD_DrillStems(i)%Od*1.30d0/2.0d0 + data%State%TD_DrillStems(i)%ToolJointRange = 0.0d0 + data%State%TD_DrillStems(i)%Length = data%State%TD_StConn%KellyElementConst ! [ft] + data%State%TD_DrillStems(i)%LengthIni = data%State%TD_StConn%KellyElementConst ! [ft] + data%State%TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft] + data%State%TD_DrillStems(i)%Weight = data%State%TD_DrillStems(i)%WeightperLength*data%State%TD_DrillStems(i)%Length + data%State%TD_DrillStems(i)%Density = 7850.d0*0.06242796d0 ! [kg/m3]*0.06242796=[lb/ft3] + data%State%TD_DrillStems(i)%ElasticModule = 200.0d9*0.02088543d0 ! [lb/ft2] !200GPa=29Mpsi (steel) + End Do + data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents + +! DrillStem Array: + i = data%State%TD_String%StringConfigurationCount+1 + data%State%TD_DrillStem(i)%ComponentType = 6 + data%State%TD_DrillStem(i)%Numbs = 1 + data%State%TD_DrillStem(i)%Id = 3.0d0/12.d0 ! [ft] + data%State%TD_DrillStem(i)%Od = 5.90d0/12.d0 ! [ft] + data%State%TD_DrillStem(i)%Length = data%State%TD_StConn%KellyElementConst ! [ft] + data%State%TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft] + data%State%TD_DrillStem(i)%TotalLength = data%State%TD_DrillStem(i)%Numbs*data%State%TD_DrillStem(i)%Length + data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength + data%State%TD_String%StringConfigurationCount = data%State%TD_String%StringConfigurationCount+1 + + + data%State%TD_Count%KellyOldAdd = data%State%TD_Count%KellyNewAdd + + end if + + + + + +!==================================================== +! Add Safety Valve (OPERATION_TRIP) +!==================================================== + +!if ( Get_OperationCondition()==OPERATION_TRIP .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then +! data%State%TD_Count%SafetyValveNewAdd = 1 +!else +! data%State%TD_Count%SafetyValveNewAdd = 0 +! data%State%TD_Count%SafetyValveOldAdd = 0 +!end if + + if ( data%State%TD_StConn%KellyDriveTypeMode/=0 .and. data%State%TD_StConn%OldOperationCondition/=0 .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL .and. data%State%TD_Count%SafetyValveOldAdd==0 ) then + kk = 0 + Do i= data%State%TD_String%DrillStemComponentsNumbs , 1 , -1 + if (data%State%TD_DrillStems(i)%ComponentType==3) then + kk = i + exit + end if + End Do +! DrillStems Array: + TD_NumOfAddedComponents = 1 + Do i= (data%State%TD_String%DrillStemComponentsNumbs+1) , (data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) + data%State%TD_DrillStems(i)%ComponentType = 7 + data%State%TD_DrillStems(i)%Id = data%State%TD_DrillStems(kk)%Id + data%State%TD_DrillStems(i)%Od = data%State%TD_DrillStems(kk)%RtoolJoint + data%State%TD_DrillStems(i)%Area = (pi*((data%State%TD_DrillStems(i)%Od**2)-(data%State%TD_DrillStems(i)%Id**2)))/4.0d0 + data%State%TD_DrillStems(i)%RtoolJoint = data%State%TD_DrillStems(kk)%RtoolJoint + data%State%TD_DrillStems(i)%ToolJointRange = 0.0d0 + data%State%TD_DrillStems(i)%Length = data%State%TD_StConn%SafetyValveLength ! [ft] + data%State%TD_DrillStems(i)%LengthIni = data%State%TD_StConn%SafetyValveLength ! [ft] + data%State%TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft] + data%State%TD_DrillStems(i)%Weight = data%State%TD_DrillStems(i)%WeightperLength*data%State%TD_DrillStems(i)%Length + data%State%TD_DrillStems(i)%Density = data%State%TD_DrillStems(kk)%Density !???????????? + data%State%TD_DrillStems(i)%ElasticModule = data%State%TD_DrillStems(kk)%ElasticModule !???????????? + End Do + data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents + +! DrillStem Array: + i = data%State%TD_String%StringConfigurationCount+1 + data%State%TD_DrillStem(i)%ComponentType = 7 + data%State%TD_DrillStem(i)%Numbs = 1 + data%State%TD_DrillStem(i)%Id = data%State%TD_DrillStems(kk)%Id ! [ft] + data%State%TD_DrillStem(i)%Od = data%State%TD_DrillStems(kk)%RtoolJoint ! [ft] + data%State%TD_DrillStem(i)%Length = 1.540d0 ! [ft] + data%State%TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft] + data%State%TD_DrillStem(i)%TotalLength = data%State%TD_DrillStem(i)%Numbs*data%State%TD_DrillStem(i)%Length + data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength + data%State%TD_String%StringConfigurationCount = data%State%TD_String%StringConfigurationCount+1 + + +!data%State%TD_Count%SafetyValveOldAdd = data%State%TD_Count%SafetyValveNewAdd + + if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then + data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+data%State%TD_DrillStem(i)%Length + end if + + end if + + if ( Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then + data%State%TD_Count%SafetyValveOldAdd = 1 + else + data%State%TD_Count%SafetyValveOldAdd = 0 + end if + + + +end subroutine diff --git a/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.f90 b/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.f90 index fddf097..7c51f65 100644 --- a/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.f90 +++ b/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.f90 @@ -20,7 +20,7 @@ subroutine TD_DrillStemConfiguration implicit none - Integer :: i , j , k , kk , TD_Status + Integer :: i , j , k , kk diff --git a/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.i90 b/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.i90 index 8baafce..8d3e383 100644 --- a/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.i90 +++ b/TorqueDrag/TD_DrillingSubs/TD_DrillStemConfiguration.i90 @@ -21,7 +21,7 @@ subroutine TD_DrillStemConfiguration implicit none - Integer :: i , j , k , kk , TD_Status + Integer :: i , j , k , kk diff --git a/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90 b/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90 index 9de5a9d..7d39ad5 100644 --- a/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90 +++ b/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90 @@ -1,11 +1,10 @@ subroutine TD_StringConnectionModes - - use CHoistingVariables + use CHoistingVariables use SimulationVariables - use CDrillingConsoleVariables + use CDrillingConsoleVariables use SimulationVariables use SimulationVariables - use UnitySignalVariables + use UnitySignalVariables use UnitySignalsModule ! use OperationScenariosModule ! use OperationScenariosModule !!CElevator... @@ -97,19 +96,12 @@ subroutine TD_StringConnectionModes data%State%TD_StConn%HookVelocity = (data%State%TD_StConn%HookHeight-data%State%TD_StConn%HookHeightOld)/data%State%TD_General%TimeStep ! [ft/s] - - - - - - - !==================================================== ! Add or Remove DrillStem Components !==================================================== - Call TD_AddComponents + Call TD_AddComponents() - Call TD_RemoveComponents + Call TD_RemoveComponents() !=====> Read Data diff --git a/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.i90 b/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.i90 index f29ba15..03eb7ae 100644 --- a/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.i90 +++ b/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.i90 @@ -1,12 +1,11 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90" +# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_DrillingSubs/TD_StringConnectionModes.f90" subroutine TD_StringConnectionModes - - use CHoistingVariables + use CHoistingVariables use SimulationVariables - use CDrillingConsoleVariables + use CDrillingConsoleVariables use SimulationVariables use SimulationVariables - use UnitySignalVariables + use UnitySignalVariables use UnitySignalsModule ! use OperationScenariosModule ! use OperationScenariosModule !!CElevator... @@ -98,19 +97,12 @@ subroutine TD_StringConnectionModes data%State%TD_StConn%HookVelocity = (data%State%TD_StConn%HookHeight-data%State%TD_StConn%HookHeightOld)/data%State%TD_General%TimeStep ! [ft/s] - - - - - - - !==================================================== ! Add or Remove DrillStem Components !==================================================== - Call TD_AddComponents + Call TD_AddComponents() - Call TD_RemoveComponents + Call TD_RemoveComponents() !=====> Read Data diff --git a/TorqueDrag/TD_Forces/TD_HookLoadCalculation.i90 b/TorqueDrag/TD_Forces/TD_HookLoadCalculation.i90 index 215e9d3..61431d3 100644 --- a/TorqueDrag/TD_Forces/TD_HookLoadCalculation.i90 +++ b/TorqueDrag/TD_Forces/TD_HookLoadCalculation.i90 @@ -1,4 +1,4 @@ -# 1 "/mnt/c/Projects/VSIM/SimulationCore2/TorqueDrag/TD_Forces/TD_HookLoadCalculation.f90" +# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_Forces/TD_HookLoadCalculation.f90" subroutine TD_HookLoadCalculation Use TD_DrillStemComponents diff --git a/TorqueDrag/TD_Forces/TD_StaticHookLoadCalculation.i90 b/TorqueDrag/TD_Forces/TD_StaticHookLoadCalculation.i90 new file mode 100644 index 0000000..9774985 --- /dev/null +++ b/TorqueDrag/TD_Forces/TD_StaticHookLoadCalculation.i90 @@ -0,0 +1,72 @@ +# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_Forces/TD_StaticHookLoadCalculation.f90" +subroutine TD_StaticHookLoadCalculation + + Use TD_DrillStemComponents + use SimulationVariables !@ + use SimulationVariables !@ + use SimulationVariables !@ + + + implicit none + + Integer :: i + + + + + + i = 1 + if(data%State%TD_DrillStems(i)%HoleType == 0) then + data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%Length * & + data%State%TD_DrillStems(i)%BouyancyFactor * cos(data%State%TD_DrillStems(i)%StartAngle) + + else if (data%State%TD_DrillStems(i)%HoleType == 1) then + data%State%TD_DrillStems(i)%StaticHookLoad = -(data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * & + (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle))) + + else if (data%State%TD_DrillStems(i)%HoleType == 2) then + data%State%TD_DrillStems(i)%StaticHookLoad = (data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * & + (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle))) + end if + + + + do i = 2, data%State%TD_String%DrillStemComponentsNumbs + + if(data%State%TD_DrillStems(i)%HoleType == 0) then + data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i-1)%StaticHookLoad + data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%Length * & + data%State%TD_DrillStems(i)%BouyancyFactor * cos(data%State%TD_DrillStems(i)%StartAngle) + + else if (data%State%TD_DrillStems(i)%HoleType == 1) then + data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i-1)%StaticHookLoad -(data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * & + (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle))) + + else if (data%State%TD_DrillStems(i)%HoleType == 2) then + data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i-1)%StaticHookLoad +(data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * & + (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle))) + end if + + end do +! +!--------------------------------------------------------------------------------------------------- +! + i = 1 +!data%State%TD_DrillStems(i)%TotalSHookLoad = data%State%TD_DrillStems(i)%StaticHookLoad ???????????????????????????? + data%State%TD_DrillStems(i)%Dl = data%State%TD_DrillStems(i)%StaticHookLoad * data%State%TD_DrillStems(i)%Length / data%State%TD_DrillStems(i)%Area / data%State%TD_DrillStems(i)%ElasticModule + data%State%TD_DrillStems(i)%DlTotal = data%State%TD_DrillStems(i)%Dl + do i = 2 , data%State%TD_String%DrillStemComponentsNumbs +!data%State%TD_DrillStems(i)%TotalSHookLoad = data%State%TD_DrillStems(i-1)%TotalSHookLoad + data%State%TD_DrillStems(i)%StaticHookLoad ????????????????????????? + data%State%TD_DrillStems(i)%Dl = data%State%TD_DrillStems(i)%StaticHookLoad * data%State%TD_DrillStems(i)%Length / data%State%TD_DrillStems(i)%Area / data%State%TD_DrillStems(i)%ElasticModule + data%State%TD_DrillStems(i)%DlTotal = data%State%TD_DrillStems(i-1)%DlTotal + data%State%TD_DrillStems(i)%Dl + end do + + data%State%TD_String%StaticHookLoad = data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%StaticHookLoad + data%State%TD_String%DlMax = data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%DlTotal + + + + + + + +end subroutine diff --git a/TorqueDrag/TD_StartUp/TD_DrillStemStartUp.i90 b/TorqueDrag/TD_StartUp/TD_DrillStemStartUp.i90 new file mode 100644 index 0000000..1c6080f --- /dev/null +++ b/TorqueDrag/TD_StartUp/TD_DrillStemStartUp.i90 @@ -0,0 +1,82 @@ +# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_StartUp/TD_DrillStemStartUp.f90" +subroutine TD_DrillStemStartUp + + Use CCasingLinerChokeVariables + Use CStringConfigurationVariables +! Use CSimulationVariables + Use TD_DrillStemComponents + use SimulationVariables !@ + use SimulationVariables !@ + use SimulationVariables !@ + Use TD_StringConnectionData + + + implicit none + + + + + data%State%TD_String%DrillStemTotalLength = 500.d0 !??????????????????? + data%State%TD_String%DrillStemTotalLengthIni = 500.d0 !??????????????????? + data%State%TD_String%OutOfWellLength = 3.48d0 + data%State%TD_String%DrillStemAxialVelocity = 0.d0 + data%State%TD_String%DrillStemRotVelocity = 0.d0 + data%State%TD_String%WeightOnBit = 0.d0 + data%State%TD_String%BitTorque = 0.d0 + data%State%TD_String%TotalTorque = 0.d0 + data%State%TD_String%StaticHookLoad = 0.d0 + data%State%TD_String%DlMax = 0.d0 + data%State%TD_String%DlTotal = 0.d0 + data%State%TD_String%DlTouch = 1.d0 !(=/0.) because of TD_StringConnectionModes subroutine (initial value for first iteration in if condition) + data%State%TD_String%HookLoad = 0.d0 + data%State%TD_String%StringTorque = 0.d0 + data%State%TD_String%ToolJointRange = 0.4005d0*3.28d0 ![m]*3.28=[ft] , ToolJointLength=400.5mm + data%State%TD_Vol%RemoveVolume = 0.0d0 + + data%State%TD_String%DrillStemBottom = data%State%TD_String%DrillStemTotalLength-data%State%TD_String%OutOfWellLength !???????????? +!data%State%TD_DrillStems%TopDepth = +!data%State%TD_DrillStems%DownDepth = +!data%State%TD_DrillStems%StartAngle = +!data%State%TD_DrillStems%EndAngle = + data%State%TD_DrillStems%Area = 0.d0 + data%State%TD_DrillStems%RCurvature = 0.d0 + data%State%TD_DrillStems%RtoolJoint = 0.d0 + data%State%TD_DrillStems%ToolJointRange = 0.d0 + data%State%TD_DrillStems%HoleDiameter = 0.d0 + + data%State%TD_DrillStems%Force1 = 0.d0 + data%State%TD_DrillStems%Force2 = 0.d0 + data%State%TD_DrillStems%Torque = 0.d0 + data%State%TD_DrillStems%Drag = 0.d0 + data%State%TD_DrillStems%CombVelRatio = 0.d0 + + data%State%TD_DrillStems%MudDensityIn = 10.d0*7.48051948d0 + data%State%TD_DrillStems%MudDensityOut = 10.d0*7.48051948d0 + data%State%TD_DrillStems%MudViscosity = 0.16d0 !???????????????? + data%State%TD_DrillStems%MudVisCorrectCoef = 1.d0 !???????????????? + data%State%TD_DrillStems%MudWeight = 10.d0 +!data%State%TD_DrillStems%MudPlasticVis = !???????????????? +!data%State%TD_DrillStems%MudYieldPoint = !???????????????? + +!data%State%TD_DrillStems%FricFactor = +!data%State%TD_DrillStems% = +!data%State%TD_DrillStems% = + +!data%State%TD_DrillStems%StaticHookLoad = +!data%State%TD_DrillStems%TotalSHookLoad = +!data%State%TD_DrillStems%Dl = +!data%State%TD_DrillStems%DlTotal = + +!if (allocated(data%State%TD_String%FluidMudDensity)) deallocate(data%State%TD_String%FluidMudDensity) +!if (allocated(data%State%TD_String%FluidMudEndX)) deallocate(data%State%TD_String%FluidMudEndX) +!if (allocated(data%State%TD_String%FluidMudStartX)) deallocate(data%State%TD_String%FluidMudStartX) +!Allocate (data%State%TD_String%FluidMudDensity(1) , data%State%TD_String%FluidMudEndX(1) , data%State%TD_String%FluidMudStartX(1)) +!data%State%TD_String%FluidMudDensity(:) = 10.d0 +!data%State%TD_String%FluidMudStartX(:) = -268.d0 !?????????? +!data%State%TD_String%FluidMudEndX(:) = 9990.d0 !?????????? + + + + + +end subroutine diff --git a/TorqueDrag/TD_StartUp/TD_StartUp.i90 b/TorqueDrag/TD_StartUp/TD_StartUp.i90 new file mode 100644 index 0000000..fc86b41 --- /dev/null +++ b/TorqueDrag/TD_StartUp/TD_StartUp.i90 @@ -0,0 +1,161 @@ +# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_StartUp/TD_StartUp.f90" +subroutine TD_StartUp + + Use CCasingLinerChokeVariables + Use CStringConfigurationVariables +! use CSimulationVariables + use UnitySignalVariables + use UnitySignalsModule +! use UnitySignalsModuleVariables + use CHoistingVariables + use SimulationVariables + use SimulationVariables !@ + Use TD_DrillStemComponents + use SimulationVariables !@ + use SimulationVariables !@ + use SimulationVariables !@ + Use TD_StringConnectionData + use SimulationVariables !@!, only: Drawworks + Use sROP_Variables + Use sROP_Other_Variables + + + implicit none + + +!!==================================================== +!! Allocate Modules +!!==================================================== +! !=====> Set WellGeo Dimension +! data%State%TD_WellGeneral%WellIntervalsCount = data%Configuration%Path%ItemCount + 1 ! +1 is belong to ROP hole +! Allocate (data%State%TD_WellGeo(data%State%TD_WellGeneral%WellIntervalsCount)) +! +! !=====> Set WellGeo Dimension + + +!=====> Set ROP StartUp + data%State%ROP_Bit%BitWearing = 0.d0 + data%State%ROP_Bit%RateOfPenetration = 0.d0 + data%State%ROP_Bit%BearingWear = 0.d0 + data%State%ROP_Spec%FormationNumber = 0 + data%State%ROP_Bit%OldROPDepth = data%Configuration%Path%Items(data%Configuration%Path%ItemCount)%MeasuredDepth + data%State%ROP_Bit%OldROPValue = 0.d0 + data%State%ROP_Bit%SetROPGauge = 0.d0 + + + +!=====> Set BOP StartUp + data%State%TD_BOP%BOPCondition = 0 + data%State%TD_BOP%BOPThickness = (0.13477d0/2.d0)*3.28d0 ![m]*3.28=[ft] , Total Thickness (RAM)= 134.77mm + data%State%TD_BOP%AnnularFillingFinal = 0.d0 + + + + data%State%Drawworks%Hook_Height_ini = 75.d0 ![ft] +!data%State%Drawworks%Hook_Height_final = 75.d0 ![ft] + data%State%Drawworks%HookLinearVelocity_final = 0.d0 ![ft/s] + data%State%Drawworks%TDHookHeight = data%State%Drawworks%Hook_Height_final ![ft] + + + +!=====> String Connection Mode + if ( Get_OperationCondition()==OPERATION_TRIP ) then + data%State%TD_StConn%OldOperationCondition = 1 + else + data%State%TD_StConn%OldOperationCondition = 0 + end if + data%State%TD_StConn%KellyDriveTypeMode = 0 !Kelly Mode + data%State%TD_StConn%FluidStringConnectionMode = 0 + data%State%TD_StConn%ConnectionHeight = 3.48d0 ![ft] + data%State%TD_StConn%RigidConnectionHeight = 3.48d0 ![ft] + data%State%TD_StConn%GRigidConnectionHeight = 3.48d0 ![ft] + data%State%TD_String%TopJointHeight = 3.48d0 ![ft] +!data%State%TD_StConn%TouchConnectionHeight = + data%State%TD_StConn%StringVelocity = 0.0d0 + data%State%TD_StConn%HookHeightOld = 75.d0 ![ft] + data%State%TD_StConn%HookHeight = 75.d0 ![ft] + data%State%TD_StConn%HookVelocity = 0.0d0 + +!=====> Element Specification + data%State%TD_StConn%HookHeight = data%State%Drawworks%TDHookHeight ! unit: [ft] + data%State%TD_StConn%ElevatorConst = 17.985 ! [ft] Elevator Length(14.84) ????????????????? adad ha daghigh shavand + data%State%TD_StConn%ElevatorECG = 2.217 ! [ft] + data%State%TD_StConn%KellyConst = 63.280d0 ! [ft] Kelly Length(61.74) + Safety Valve Length(1.54) + data%State%TD_StConn%KellyElementConst = 41.840d0 ! [ft] Kelly Element Length(40.3) + Safety Valve Length(1.54) + data%State%TD_StConn%TDSLength = 24.08d0 !??????????????????? ! [ft] + data%State%TD_StConn%TDSToolJointLength = 0.77d0 !??????????????????? ! [ft] + data%State%TD_StConn%TDSElevatorLength = 26.837d0 !?????? ! TDS with Elevator Length [ft] + data%State%TD_StConn%TDSElevatorToolLength= 0.859d0 !??????????????????? ! [ft] + data%State%TD_StConn%TDSElevatorECG = 2.454 ! [ft] + data%State%TD_Load%NumOfCables = data%Configuration%Hoisting%NumberOfLine + data%State%TD_Load%WeightTB = data%Configuration%Hoisting%TravelingBlockWeight ! [lb] + data%State%TD_Load%WeightTD = data%Configuration%Hoisting%TopDriveWeight ! [lb] + data%State%TD_Load%KellyWeight = data%Configuration%Hoisting%KellyWeight ! [lb] + data%State%TD_StConn%SafetyValveLength = 1.54d0 ! [ft] + data%State%TD_StConn%IBOPLength = 1.54d0 ! [ft] + data%State%TD_StConn%KellyElementID = 3.0d0/12.d0 ! [ft] + data%State%TD_StConn%KellyElementOD = 5.90d0/12.d0 ! [ft] + data%State%TD_Load%DrawworksLoadInput = data%Configuration%Hoisting%TravelingBlockWeight/data%Configuration%Hoisting%NumberOfLine + + data%State%TD_Count%IBOPNewAdd = 0 + data%State%TD_Count%IBOPOldAdd = 0 !Remove + data%State%TD_Count%SafetyValveNewAdd = 0 + data%State%TD_Count%SafetyValveOldAdd = 1 !Install + data%State%TD_Count%KellyNewAdd = 0 + data%State%TD_Count%KellyOldAdd = 0 + data%State%TD_Count%IBOPNewRemove = 0 + data%State%TD_Count%IBOPOldRemove = 1 !Remove + data%State%TD_Count%SafetyValveNewRemove = 0 + data%State%TD_Count%SafetyValveOldRemove = 0 !Install + data%State%TD_Count%KellyNewRemove = 0 + data%State%TD_Count%KellyOldRemove = 1 + + data%State%TD_Count%KellyOldStatus(1) = 0 + data%State%TD_Count%KellyNewStatus(1) = 0 + data%State%TD_Count%KellyOldStatus(2) = 1 ! Kelly Connected Nothing + data%State%TD_Count%KellyNewStatus(2) = 1 ! Kelly Connected Nothing + data%State%TD_Count%KellyOldStatus(3) = 0 + data%State%TD_Count%KellyNewStatus(3) = 0 + + data%State%TD_Count%KellyOldStatus(4) = 0 + data%State%TD_Count%KellyNewStatus(4) = 0 + data%State%TD_Count%KellyOldStatus(5) = 0 + data%State%TD_Count%KellyNewStatus(5) = 0 + data%State%TD_Count%KellyOldStatus(6) = 0 + data%State%TD_Count%KellyNewStatus(6) = 0 + data%State%TD_Count%KellyOldStatus(7) = 0 + data%State%TD_Count%KellyNewStatus(7) = 0 + data%State%TD_Count%KellyOldStatus(8) = 0 + data%State%TD_Count%KellyNewStatus(8) = 0 + data%State%TD_Count%KellyOldStatus(18) = 0 + data%State%TD_Count%KellyNewStatus(18) = 0 + data%State%TD_Count%KellyOldStatus(19) = 0 + data%State%TD_Count%KellyNewStatus(19) = 0 + + data%State%TD_Count%KellyOldStatus(9) = 0 + data%State%TD_Count%KellyNewStatus(9) = 0 + data%State%TD_Count%KellyOldStatus(10) = 0 + data%State%TD_Count%KellyNewStatus(10) = 0 + data%State%TD_Count%KellyOldStatus(11) = 0 + data%State%TD_Count%KellyNewStatus(11) = 0 + data%State%TD_Count%KellyOldStatus(12) = 0 + data%State%TD_Count%KellyNewStatus(12) = 0 + data%State%TD_Count%KellyOldStatus(13) = 1 + data%State%TD_Count%KellyNewStatus(13) = 1 + data%State%TD_Count%KellyOldStatus(14) = 0 + data%State%TD_Count%KellyNewStatus(14) = 0 + data%State%TD_Count%KellyOldStatus(15) = 0 + data%State%TD_Count%KellyNewStatus(15) = 0 + data%State%TD_Count%KellyOldStatus(16) = 0 + data%State%TD_Count%KellyNewStatus(16) = 0 + data%State%TD_Count%KellyOldStatus(17) = 0 + data%State%TD_Count%KellyNewStatus(17) = 0 + + + + +!=====> Problems + data%State%TD_General%WeightIndicatorMalf = 0 + + +end subroutine diff --git a/helper.ipynb b/helper.ipynb index d1b7f10..aa68d16 100644 --- a/helper.ipynb +++ b/helper.ipynb @@ -1,5 +1,53 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAApQAAAHzCAYAAACe1o1DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/xnp5ZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3hVZbb48e8+/aR3EgIEEiD0FjooUgWlCEhRQVGwje3O6Nzpo+N1fjNXrzqjoiKoIxYQlK6iNOmdAAklQAIESEhCej9t//6IOaSTkJ6sz/P4aE72Puc98ZS13/ddaymqqqoIIYQQQghxmzSNPQAhhBBCCNG8SUAphBBCCCFqRQJKIYQQQghRKxJQCiGEEEKIWpGAUgghhBBC1IoElEIIIYQQolYkoBRCCCGEELUiAaUQQgghhKgVCSiFEEIIIUStSEAphBBCCCFqRQJKIYQQQghRKxJQCiGEEEKIWpGAUgghhBBC1IoElEIIIYQQolYkoBRCCCGEELUiAaUQQgghhKgVCSiFEEIIIUStSEAphBBCCCFqRQJKIYQQQghRKxJQCiGEEEKIWpGAUgghhBBC1IoElEIIIYQQolYkoBRCCCGEELUiAaUQQgghhKgVCSiFEEIIIUStSEAphBBCCCFqRQJKIYQQQghRKxJQCiGEEEKIWpGAUgghhBBC1IoElEIIIYQQolYkoBRCCCGEELUiAaUQQgghhKgVCSiFEEIIIUStSEAphBBCCCFqRQJKIYQQQghRKxJQCiGEEEKIWpGAUgghhBBC1IoElEIIIYQQolYkoBRCCCGEELUiAaUQQgghhKgVCSiFEEIIIUStSEAphBBCCCFqRdfYAxBCCCGaAlVVyberWOwqBq2CWaugKEpjD0uIZkECSiGEEK1agc1BVFohR1PyybA4nLd7GTRE+Jvp7WPEpJMFPSGqoqiqqjb2IIQQQojGEJdlYe3FLKyOyo/Ra2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UBIRERGRSxgoiYiIiMglDJRERERE5BIGSiIiIiJyCQMlEREREbmEgZKIiIiIXMJASUREREQuYaAkIiIiIpcwUBIRERGRSxgoiYiIiMglDJRERERE5BIGSiIiIiJyCQMlEREREbmEgZKIiIiIXMJASUREREQu+X9rkW7GjzNm+wAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import re\n", + "import networkx as nx\n", + "import matplotlib.pyplot as plt\n", + "\n", + "G = nx.Graph()\n", + "f = open(\"Text1.txt\")\n", + "lines = f.readlines()\n", + "lines = [l.strip() for l in lines]\n", + "for line in lines:\n", + " if len(line)==0 or line.startswith(\"!\"):\n", + " continue\n", + " matches = re.findall(r\"\\((\\d+)\\)\", line)\n", + " G.add_edge(matches[0], matches[1])\n", + "\n", + "node_types = {}\n", + "for i in range(1,71):\n", + " node_types[i] = 'valve'\n", + "for i in range(71,91):\n", + " node_types[i] = 'source'\n", + "for i in range(91,129):\n", + " node_types[i] = 'relation'\n", + "\n", + "\n", + "\n", + "pos = nx.spring_layout(G, seed=30)\n", + "nx.draw(G, pos, node_size=100, node_color='skyblue', edge_color='gray')\n", + "nx.draw_networkx_labels(G, pos, font_size=6, font_family='sans-serif')\n", + "\n", + "plt.show()\n" + ] + }, { "attachments": {}, "cell_type": "markdown", @@ -1015,23 +1063,32 @@ "name": "stdout", "output_type": "stream", "text": [ - "call json%add(p,\"KellyHoseVibrationRate\",data%Equipments%UnityOutputs%KellyHoseVibrationRate)\n", - "call json%add(p,\"BlowoutFromStringPercent\",data%Equipments%UnityOutputs%BlowoutFromStringPercent)\n", - "call json%add(p,\"Pedal\",data%Equipments%UnityOutputs%Pedal)\n", - "call json%add(p,\"FlowRate\",data%Equipments%UnityOutputs%FlowRate)\n", - "call json%add(p,\"RotaryRpm\",data%Equipments%UnityOutputs%RotaryRpm)\n", - "call json%add(p,\"BlowoutFromString\",data%Equipments%UnityOutputs%BlowoutFromString)\n", - "call json%add(p,\"BlowoutFromAnnular\",data%Equipments%UnityOutputs%BlowoutFromAnnular)\n", - "call json%add(p,\"FlowFromReturnLine\",data%Equipments%UnityOutputs%FlowFromReturnLine)\n", - "call json%add(p,\"FlowFromKelly\",data%Equipments%UnityOutputs%FlowFromKelly)\n", - "call json%add(p,\"FlowFromFillupHead\",data%Equipments%UnityOutputs%FlowFromFillupHead)\n", - "call json%add(p,\"FlowKellyDisconnect\",data%Equipments%UnityOutputs%FlowKellyDisconnect)\n", - "call json%add(p,\"FlowPipeDisconnect\",data%Equipments%UnityOutputs%FlowPipeDisconnect)\n" + "call json%add(p,\"MudBucket\",data%State%unitySignals%MudBucket)\n", + "call json%add(p,\"Elevator\",data%State%unitySignals%Elevator)\n", + "call json%add(p,\"FillupHead\",data%State%unitySignals%FillupHead)\n", + "call json%add(p,\"Ibop\",data%State%unitySignals%Ibop)\n", + "call json%add(p,\"Kelly\",data%State%unitySignals%Kelly)\n", + "call json%add(p,\"MouseHole\",data%State%unitySignals%MouseHole)\n", + "call json%add(p,\"OperationCondition\",data%State%unitySignals%OperationCondition)\n", + "call json%add(p,\"SafetyValve\",data%State%unitySignals%SafetyValve)\n", + "call json%add(p,\"operation\",data%State%unitySignals%operation)\n", + "call json%add(p,\"Slips\",data%State%unitySignals%Slips)\n", + "call json%add(p,\"Slips_S\",data%State%unitySignals%Slips_S)\n", + "call json%add(p,\"Swing\",data%State%unitySignals%Swing)\n", + "call json%add(p,\"Swing_S\",data%State%unitySignals%Swing_S)\n", + "call json%add(p,\"TdsBackupClamp\",data%State%unitySignals%TdsBackupClamp)\n", + "call json%add(p,\"TdsSpine\",data%State%unitySignals%TdsSpine)\n", + "call json%add(p,\"TdsSwing\",data%State%unitySignals%TdsSwing)\n", + "call json%add(p,\"TdsTong\",data%State%unitySignals%TdsTong)\n", + "call json%add(p,\"Tong\",data%State%unitySignals%Tong)\n", + "call json%add(p,\"Tong_S\",data%State%unitySignals%Tong_S)\n", + "call json%add(p,\"TdsConnectionModes\",data%State%unitySignals%TdsConnectionModes)\n", + "call json%add(p,\"TdsElevatorModes\",data%State%unitySignals%TdsElevatorModes)\n" ] } ], "source": [ - "precode = \"\"\"call json%add(p,\"\",data%Equipments%UnityOutputs%\"\"\"\n", + "precode = \"\"\"call json%add(p,\"\",data%State%unitySignals%\"\"\"\n", "input = open(\"Text1.txt\")\n", "lines = input.readlines()\n", "for line in lines:\n", diff --git a/output.txt b/output.txt deleted file mode 100644 index e7f7141..0000000 --- a/output.txt +++ /dev/null @@ -1,316 +0,0 @@ - allocate string - connection initialized - initializing modules - pump1 initialized - RT initialized - TD initialized - time step delay 4 18 10 - KellyDisconnected() - Modules are initialized - modules initialized - ListenToChannel - simulationStep = 1 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 1402 - simulationStep = 2 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 242 - simulationStep = 3 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 321 - simulationStep = 4 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 185 - simulationStep = 5 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 212 - simulationStep = 6 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 165 - simulationStep = 7 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 284 - simulationStep = 8 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 272 - simulationStep = 9 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 208 - simulationStep = 10 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 190 - simulationStep = 11 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 170 - simulationStep = 12 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 188 - simulationStep = 13 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 176 - simulationStep = 14 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 158 - simulationStep = 15 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 16 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 17 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 18 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 19 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 150 - simulationStep = 20 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 142 - simulationStep = 21 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 22 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 151 - simulationStep = 23 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 24 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 150 - simulationStep = 25 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 26 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 27 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 28 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 29 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 30 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 31 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 141 - simulationStep = 32 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 144 - simulationStep = 33 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 150 - simulationStep = 34 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 35 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 36 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 37 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 152 - simulationStep = 38 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 39 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 144 - simulationStep = 40 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 142 - simulationStep = 41 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 42 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 43 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 44 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 143 - simulationStep = 45 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 46 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 144 - simulationStep = 47 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 48 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 49 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 50 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 51 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 52 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 53 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 154 - simulationStep = 54 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 142 - simulationStep = 55 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 56 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 57 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 58 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 59 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 60 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 141 - simulationStep = 61 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 62 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 63 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 64 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 65 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 66 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 150 - simulationStep = 67 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 68 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 69 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 161 - simulationStep = 70 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 162 - simulationStep = 71 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 72 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 73 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 74 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 75 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 152 - simulationStep = 76 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 146 - simulationStep = 77 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 262 - simulationStep = 78 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 173 - simulationStep = 79 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 172 - simulationStep = 80 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 176 - simulationStep = 81 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 178 - simulationStep = 82 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 255 - simulationStep = 83 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 179 - simulationStep = 84 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 174 - simulationStep = 85 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 180 - simulationStep = 86 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 164 - simulationStep = 87 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 88 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 89 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 144 - simulationStep = 90 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 154 - simulationStep = 91 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 152 - simulationStep = 92 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 93 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 - simulationStep = 94 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 145 - simulationStep = 95 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 152 - simulationStep = 96 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 150 - simulationStep = 97 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 98 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 149 - simulationStep = 99 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 148 - simulationStep = 100 - HookHeight= 10.67848 - Simulation step can not be complete in 100 ms. step time= 147 -Connection Stablished to 78.109.201.86 -Authentication is done. -Listening To channel (C) -Subscribed to channel 37364875-c9cf-43a3-de45-08dc0c6103c9.ch_in -got a message of type: 2 diff --git a/redisContent.json b/redisContent.json index 0e0f9d7..53da61a 100644 --- a/redisContent.json +++ b/redisContent.json @@ -1 +1 @@ -{"Signals":{"MudBucket":0,"Elevator":0,"FillupHead":0,"Ibop":0,"Kelly":0,"MouseHole":0,"OperationCondition":0,"SafetyValve":0,"operation":0,"Slips":0,"Slips_S":0,"Swing":0,"Swing_S":0,"TdsBackupClamp":0,"TdsSpine":0,"TdsSwing":0,"TdsTong":0,"Tong":0,"Tong_S":0,"TdsConnectionModes":0,"TdsElevatorModes":0},"OperationScenarioEvent":"","status":1,"speed":2,"endstep":0,"Configuration":{"StringConfiguration":{"StringConfigurationItems":[{"ComponentLength":1.0,"ComponentType":0,"Grade":null,"LengthPerJoint":1.0,"NominalId":203.0,"NominalOd":0.0,"NominalToolJointOd":0.0,"NumberOfJoint":1.0,"WeightPerLength":74.41},{"ComponentLength":600.0,"ComponentType":2,"Grade":null,"LengthPerJoint":30.0,"NominalId":203.0,"NominalOd":0.0,"NominalToolJointOd":0.0,"NumberOfJoint":20.0,"WeightPerLength":74.41},{"ComponentLength":600.0,"ComponentType":3,"Grade":null,"LengthPerJoint":30.0,"NominalId":228.0,"NominalOd":0.0,"NominalToolJointOd":0.0,"NumberOfJoint":20.0,"WeightPerLength":74.41}],"BitDefenition":{"BitCodeHundreds":1,"BitCodeOnes":3,"BitCodeTens":2,"BitLength":1.0,"BitNozzleNo":3,"BitNozzleSize":355.6,"BitSize":215.9,"BitType":0,"BitWeightPerLength":74.41,"FloatValve":true}},"Formations":[{"Abrasiveness":80.0,"Drillablity":5.0,"PorePressureGradient":10.43,"Thickness":990.0,"ThresholdWeight":0.5,"Top":10.0},{"Abrasiveness":85.0,"Drillablity":30.0,"PorePressureGradient":11.31,"Thickness":600.0,"ThresholdWeight":0.7,"Top":1000.0},{"Abrasiveness":85.0,"Drillablity":30.0,"PorePressureGradient":12.44,"Thickness":1.0,"ThresholdWeight":0.8,"Top":1600.0},{"Abrasiveness":90.0,"Drillablity":15.0,"PorePressureGradient":14.7,"Thickness":200.0,"ThresholdWeight":0.8,"Top":1601.0}],"Reservoir":{"AutoMigrationRate":100.0,"FluidGradient":0.0,"FluidType":0,"FluidViscosity":0.0,"FormationNo":3,"FormationPermeability":500.0,"FormationTop":1601.0,"GeothermalGradient":0.0,"InactiveInflux":false,"IsAutoMigrationRateSelected":false,"MakeKickSinglePacket":false,"PressureGradient":14.7},"Shoe":{"Breakdown":6.21,"FormationNo":0,"FracturePropagation":5.86,"InactiveFracture":false,"LeakOff":6.21,"ShoeDepth":5200.0},"Accumulator":{"AccumulatorMinimumOperatingPressure":8273.0,"AccumulatorSystemSize":1.0,"AirPlungerPumpOutput":1.0,"ElectricPumpOutput":0.0,"NumberOfBottels":20,"OilTankVolume":1.0,"PrechargePressure":6901.0,"StartPressure":19305.0,"StartPressure2":17926.0,"StopPressure":20684.0,"StopPressure2":20070.0},"BopStack":{"AboveAnnularHeight":10.0,"AnnularPreventerClose":2.86,"AnnularPreventerHeight":10.0,"AnnularPreventerOpen":2.25,"AnnularStringDrag":100.0,"BlindRamClose":0.92,"BlindRamHeight":16.24,"BlindRamOpen":0.87,"ChokeClose":0.24,"ChokeLineId":2800.0,"ChokeLineLength":12.0,"ChokeOpen":0.24,"GroundLevel":30.0,"KillClose":0.24,"KillHeight":18.8,"KillOpen":0.24,"LowerRamClose":0.59,"LowerRamHeight":21.35,"LowerRamOpen":0.56,"RamStringDrag":102800.65,"UpperRamClose":0.59,"UpperRamHeight":14.632,"UpperRamOpen":0.56},"Hoisting":{"DrillingLineBreakingLoad":0.0,"DriveType":0,"KellyWeight":0.0,"NumberOfLine":0,"TopDriveWeight":0.0,"TravelingBlockWeight":0.0},"Power":{"CementPump":298.0,"Drawworks":604.0,"GeneratorPowerRating":1200.0,"MudPump1":1194.0,"MudPump2":1194.0,"NumberOfgenerators":4,"RotaryTable":604.0,"TopDrive":775.0},"Pumps":{"MudPump1LinerDiameter":6.4,"MudPump1Stroke":120.0,"MudPump1MechanicalEfficiency":0.9,"MudPump1VolumetricEfficiency":6.4,"MudPump1Output":10.0,"MudPump1OutputBblStroke":10.0,"MudPump1Maximum":120.0,"MudPump1ReliefValvePressure":41368.469,"MudPump2LinerDiameter":6.4,"MudPump2Stroke":120.0,"MudPump2MechanicalEfficiency":0.9,"MudPump2VolumetricEfficiency":6.4,"MudPump2Output":10.0,"MudPump2OutputBblStroke":10.0,"MudPump2Maximum":120.0,"MudPump2ReliefValvePressure":41368.469,"CementPumpLinerDiameter":6.4,"CementPumpStroke":120.0,"CementPumpMechanicalEfficiency":1.0,"CementPumpVolumetricEfficiency":6.4,"CementPumpOutput":10.0,"CementPumpOutputBblStroke":10.0,"CementPumpMaximum":120.0,"CementPumpReliefValvePressure":68.947,"MudPump1ReliefValveIsSet":true,"MudPump2ReliefValveIsSet":true,"CementPumpReliefValveIsSet":true,"ManualPumpPower":false,"Valve1":false,"Valve2":false,"Valve3":false,"Valve4":false,"Valve5":false,"MudPump1MaximumPressure":41368.469,"MudPump1PumpRateChange":5000.0,"MudPump1SurfaceLineLength":2.0,"MudPump1DelayToShutdown":5.0,"MudPump2MaximumPressure":41368.469,"MudPump2PumpRateChange":5000.0,"MudPump2SurfaceLineLength":4.0,"MudPump2DelayToShutdown":5.0,"CementPumpMaximumPressure":41368.469,"CementPumpPumpRateChange":5000.0,"CementPumpSurfaceLineLength":2.0,"CementPumpDelayToShutdown":5.0,"MudPump1VolumetricOutput":10.0,"MudPump2VolumetricOutput":10.0,"CementPumpVolumetricOutput":10.0},"RigSize":{"RigType":0,"CrownHeight":0.0,"MonkeyBoandHeight":0.0,"RigFloorHeight":0.0},"CasingLinerChoke":{"CasingDepth":1524.0,"CasingId":254.0,"CasingOd":243.84,"CasingWeight":69.94,"CasingCollapsePressure":17236.86,"CasingTensileStrength":1270.06,"LinerTopDepth":0.0,"LinerLength":0.0,"LinerId":0.0,"LinerOd":0.0,"LinerWeight":0.0,"LinerCollapsePressure":0.0,"LinerTensileStrength":0.0,"OpenHoleId":215.9,"OpenHoleLength":476.006},"Path":{"Items":[{"HoleType":0,"Angle":0.0,"Length":9144.0,"FinalAngle":0.0,"TotalLength":9144.0,"MeasuredDepth":9144.0,"TotalVerticalDepth":0.0}]},"Mud":{"ActiveMudType":0,"ActiveRheologyModel":0,"ActiveMudVolume":68.68,"ActiveMudVolumeGal":2884.5600000000004,"ActiveDensity":1269.461181640625,"ActivePlasticViscosity":23.0,"ActiveYieldPoint":18.3,"ActiveThetaThreeHundred":0.0,"ActiveThetaSixHundred":0.0,"ReserveMudType":0,"ReserveMudVolume":63.59,"ReserveMudVolumeGal":0.0,"ReserveDensity":1497.0059814453125,"ReservePlasticViscosity":23.0,"ReserveYieldPoint":21.13,"ReserveThetaThreeHundred":0.0,"ReserveThetaSixHundred":0.0,"ActiveTotalTankCapacity":190.78,"ActiveTotalTankCapacityGal":8012.76,"ActiveSettledContents":0.0,"ActiveSettledContentsGal":0.0,"ActiveTotalContents":0.0,"ActiveTotalContentsGal":0.0,"ActiveAutoDensity":false,"InitialTripTankMudVolume":3.18,"InitialTripTankMudVolumeGal":133.56,"PedalFlowMeter":1600.0}},"Problems":{"BitProblems":{"JetWashout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"PlugJets":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"JetWashoutCount":0,"PlugJetsCount":0},"BopProblems":{"AnnularWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AnnularFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AnnularLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"UpperRamWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"UpperRamFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"UpperRamLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MiddleRamWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MiddleRamFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MiddleRamLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"LowerRamWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"LowerRamFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"LowerRamLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorPumpFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorPumpLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorSystemFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorSystemLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"ChokeProblems":{"HydraulicChoke1Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke1Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke1Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke2Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke2Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke2Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke2Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke2Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke2Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ChokePanelAirFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1PluggedPercent":0,"HydraulicChoke2PluggedPercent":0,"HydraulicChoke1PluggedPercent":0,"ManualChoke2PluggedPercent":0},"DrillStemsProblems":{"StringDragIncrease":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StringTorqueIncrease":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StringTorqueFluctuation":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StringDragIncreaseTime":0.0,"StringTorqueIncreaseTime":0.0},"GaugesProblems":{"WeightIndicator":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RotaryRpm":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RotaryTorque":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StandPipePressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CasingPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump1Strokes":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump2Strokes":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ReturnLineTemperature":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"TripTank":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"PitGainLoss":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MudTankVolume":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ReturnMudFlow":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"TorqueLimit":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"PowerLimit":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManifoldPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AnnularPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RigAirPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StandPipe1":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StandPipe2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"DrillPipePressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ChokePosition":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CasingPressure2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"HoistingProblems":{"MotorFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ClutchEngage":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ClutchDisengage":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"KickProblems":{"Kick":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"FluidType":0,"FlowRate":0,"OverBalancePressure":0,"IsAutoMigrationRateSelected":false,"AutoMigrationRate":0.0},"LostProblems":{"LostCirculation":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"FlowRate":0.0},"MudTreatmentProblems":{"Degasser":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ShaleShaker":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Desander":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Desilter":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"OtherProblems":{"RigAlarm":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RigWaterSupply":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RigAir":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen1":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen3":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen4":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr1":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr3":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr4":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"PumpProblems":{"Pump1PowerFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump1BlowPopOffValve":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump2PowerFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump2BlowPopOffValve":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CementPumpPowerFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CementPumpBlowPopOffValve":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"RotaryProblems":{"MotorFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"OverideTorqueLimit":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}}},"Equipments":{"HookVelocity":0.0,"HookHeight":10.67848503986859,"BopControl":{"ManifoldPressureGauge":0.0,"AirSupplyPressureGauge":0.0,"AccumulatorPressureGauge":0.0,"AnnularPressureGauge":0.0,"AnnularOpenLED":0,"AnnularCloseLED":0,"UpperRamsOpenLED":0,"UpperRamsCloseLED":0,"MiddleRamsOpenLED":0,"MiddleRamsCloseLED":0,"KillLineOpenLED":0,"KillLineCloseLED":0,"ChokeLineOpenLED":0,"ChokeLineCloseLED":0,"LowerRamsOpenLED":0,"LowerRamsCloseLED":0,"AnnularStatus":0.0,"UpperRamsStatus":0.0,"MiddleRamsStatus":0.0,"LowerRamsStatus":0.0,"AirMasterValve":0.0,"KillLineValve":0.0,"ChokeLineValve":0.0,"UpperRamsValve":0.0,"LowerRamsValve":0.0,"AnnularValve":0.0,"ByePassValve":0.0,"MiddleRamsValve":0.0,"AnnularRegulatorSetControl":0.0},"ChokeControl":{"StandPipePressure":0.0,"CasingPressure":0.0,"ChokePosition":0.0,"ChokePanelSPMCounter":0.0,"ChokePanelTotalStrokeCounter":0.0,"Choke1LED":0,"Choke2LED":0,"ChokePanelRigAirSwitch":false,"ChokePanelStrokeResetSwitch":false,"ChokeControlLever":0.0,"ChokePanelPumpSelectorSwitch":0.0,"ChokeRateControlKnob":0.0,"ChokeSelectorSwitch":false},"ChokeManifold":{"HydraulicChock1":0,"HydraulicChock2":0,"HyChock1OnProblem":false,"HyChock2OnProblem":false,"LeftManChokeOnProblem":false,"RightManChokeOnProblem":false,"ChokeManifoldValve1":false,"ChokeManifoldValve2":false,"ChokeManifoldValve3":false,"ChokeManifoldValve4":false,"ChokeManifoldValve5":false,"ChokeManifoldValve6":false,"ChokeManifoldValve7":false,"ChokeManifoldValve8":false,"ChokeManifoldValve9":false,"ChokeManifoldValve10":false,"ChokeManifoldValve11":false,"ChokeManifoldValve12":false,"ChokeManifoldValve13":false,"LeftManualChoke":0.0,"RightManualChoke":0.0},"DataDisplay":{"WOBPointer":0.0,"HookLoadPointer":0.0,"TripTankGauge":0.0,"TripTankAlarmLED":0,"TripTankPumpLED":0,"StandPipePressureGauge":0.0,"CasingPressureGauge":0.0,"MP1SPMGauge":0.0,"MP2SPMGauge":0.0,"ReturnLineTempGauge":0.0,"RotaryTorqueGauge":0.0,"RotaryRPMGauge":0.0,"AcidGasDetectionLED":0,"TotalStrokeCounter":0.0,"PitGainLossGauge":0.0,"MudTanksVolumeGauge":0.0,"MVTAlarmLED":0,"MVTSetAlarmSwitch":0,"ReturnMudFlowGauge":0.0,"FillStrokeCounter":0.0,"MFFITotalStrokeCounter":0.0,"MFFIAlarmLED":0,"MFFISetAlarmSwitch":0,"MFFIPumpLED":0,"TotalWellDepth":0.0,"BitDepth":0.0,"HookLoad":0.0,"StandPipePressure":0.0,"CasingPressure":0.0,"MP1SPM":0.0,"MP2SPM":0.0,"RTTorque":0.0,"RTRPM":0.0,"WOP":0.0,"ROP":0.0,"MudWeightIn":0.0,"MudWeightOut":0.0,"Buzzer1":false,"Buzzer2":false,"Buzzer3":false,"Buzzer4":false,"MVTAlarmHigh":0.0,"MVTAlarmLow":0.0,"MFFIAlarmHigh":0.0,"MFFIAlarmLow":0.0,"TotalStrokeCounterResetSwitch":0,"ResetWob":0},"Drilling":{"MP1Throttle":9.0,"MP2Throttle":0.0,"RTThrottle":0.0,"DWThrottle":0.0,"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.0,"RTTorqueLimitGauge":0.0,"AutoDWLED":0,"GEN1BTNLED":0,"GEN2BTNLED":0,"GEN3BTNLED":0,"GEN4BTNLED":0,"OpenKellyCockLed":0,"CloseKellyCockLed":0,"OpenSafetyValveLed":0,"CloseSafetyValveLed":0,"IRSafetyValveLed":0,"IRIBopLed":0,"LatchPipeLED":0,"UnlatchPipeLED":0,"SwingLed":0,"FillMouseHoleLed":0,"MP1CPSwitch":0,"MP2Switch":0,"DWSwitch":0,"RTSwitch":-1,"TongLever":0.0},"Hook":{"HookHeight_S":0.0,"HookHeight":0.0},"StandPipeManifold":{"StandPipeGauge1":0.0,"StandPipeGauge2":0.0,"StandPipeManifoldValve1":false,"StandPipeManifoldValve2":false,"StandPipeManifoldValve3":false,"StandPipeManifoldValve4":false,"StandPipeManifoldValve5":false,"StandPipeManifoldValve6":false,"StandPipeManifoldValve7":false,"StandPipeManifoldValve8":false,"StandPipeManifoldValve9":false,"StandPipeManifoldValve10":false,"StandPipeManifoldValve11":false,"StandPipeManifoldValve12":false,"StandPipeManifoldValve13":false,"StandPipeManifoldValve14":false,"StandPipeManifoldValve15":false},"DrillingWatch":{"Depth":0.0,"BitPosition":0.0,"HookLoad":0.0,"WeightOnBit":0.0,"RPM":0.0,"ROP":0.0,"Torque":0.0,"PumpPressure":0.0,"SPM1":0.0,"SPM2":0.0,"CasingPressure":0.0,"PercentFlow":0.0,"PitGainLose":0.0,"PitVolume":0.0,"KillMudVolume":0.0,"TripTankVolume":0.0,"MudWeightIn":0.0,"FillVolume":0.0,"MudWeightOut":0.0}}} +{"Signals":{"MudBucket":0,"Elevator":0,"FillupHead":0,"Ibop":0,"Kelly":0,"MouseHole":0,"OperationCondition":0,"SafetyValve":0,"operation":0,"Slips":0,"Slips_S":0,"Swing":0,"Swing_S":0,"TdsBackupClamp":0,"TdsSpine":0,"TdsSwing":0,"TdsTong":0,"Tong":0,"Tong_S":0,"TdsConnectionModes":0,"TdsElevatorModes":0},"OperationScenarioEvent":"","status":1,"speed":2,"endstep":0,"Configuration":{"StringConfiguration":{"StringConfigurationItems":[{"ComponentLength":1.0,"ComponentType":0,"Grade":null,"LengthPerJoint":1.0,"NominalId":203.0,"NominalOd":0.0,"NominalToolJointOd":0.0,"NumberOfJoint":1.0,"WeightPerLength":74.41},{"ComponentLength":600.0,"ComponentType":2,"Grade":null,"LengthPerJoint":30.0,"NominalId":203.0,"NominalOd":0.0,"NominalToolJointOd":0.0,"NumberOfJoint":20.0,"WeightPerLength":74.41},{"ComponentLength":600.0,"ComponentType":3,"Grade":null,"LengthPerJoint":30.0,"NominalId":228.0,"NominalOd":0.0,"NominalToolJointOd":0.0,"NumberOfJoint":20.0,"WeightPerLength":74.41}],"BitDefenition":{"BitCodeHundreds":1,"BitCodeOnes":3,"BitCodeTens":2,"BitLength":1.0,"BitNozzleNo":3,"BitNozzleSize":355.6,"BitSize":215.9,"BitType":0,"BitWeightPerLength":74.41,"FloatValve":true}},"Formations":[{"Abrasiveness":80.0,"Drillablity":5.0,"PorePressureGradient":10.43,"Thickness":990.0,"ThresholdWeight":0.5,"Top":10.0},{"Abrasiveness":85.0,"Drillablity":30.0,"PorePressureGradient":11.31,"Thickness":600.0,"ThresholdWeight":0.7,"Top":1000.0},{"Abrasiveness":85.0,"Drillablity":30.0,"PorePressureGradient":12.44,"Thickness":1.0,"ThresholdWeight":0.8,"Top":1600.0},{"Abrasiveness":90.0,"Drillablity":15.0,"PorePressureGradient":14.7,"Thickness":200.0,"ThresholdWeight":0.8,"Top":1601.0}],"Reservoir":{"AutoMigrationRate":100.0,"FluidGradient":0.0,"FluidType":0,"FluidViscosity":0.0,"FormationNo":3,"FormationPermeability":500.0,"FormationTop":1601.0,"GeothermalGradient":0.0,"InactiveInflux":false,"IsAutoMigrationRateSelected":false,"MakeKickSinglePacket":false,"PressureGradient":14.7},"Shoe":{"Breakdown":6.21,"FormationNo":0,"FracturePropagation":5.86,"InactiveFracture":false,"LeakOff":6.21,"ShoeDepth":5200.0},"Accumulator":{"AccumulatorMinimumOperatingPressure":8273.0,"AccumulatorSystemSize":1.0,"AirPlungerPumpOutput":1.0,"ElectricPumpOutput":0.0,"NumberOfBottels":20,"OilTankVolume":1.0,"PrechargePressure":6901.0,"StartPressure":19305.0,"StartPressure2":17926.0,"StopPressure":20684.0,"StopPressure2":20070.0},"BopStack":{"AboveAnnularHeight":10.0,"AnnularPreventerClose":2.86,"AnnularPreventerHeight":10.0,"AnnularPreventerOpen":2.25,"AnnularStringDrag":100.0,"BlindRamClose":0.92,"BlindRamHeight":16.24,"BlindRamOpen":0.87,"ChokeClose":0.24,"ChokeLineId":2800.0,"ChokeLineLength":12.0,"ChokeOpen":0.24,"GroundLevel":30.0,"KillClose":0.24,"KillHeight":18.8,"KillOpen":0.24,"LowerRamClose":0.59,"LowerRamHeight":21.35,"LowerRamOpen":0.56,"RamStringDrag":102800.65,"UpperRamClose":0.59,"UpperRamHeight":14.632,"UpperRamOpen":0.56},"Hoisting":{"DrillingLineBreakingLoad":0.0,"DriveType":0,"KellyWeight":0.0,"NumberOfLine":0,"TopDriveWeight":0.0,"TravelingBlockWeight":0.0},"Power":{"CementPump":298.0,"Drawworks":604.0,"GeneratorPowerRating":1200.0,"MudPump1":1194.0,"MudPump2":1194.0,"NumberOfgenerators":4,"RotaryTable":604.0,"TopDrive":775.0},"Pumps":{"MudPump1LinerDiameter":6.4,"MudPump1Stroke":120.0,"MudPump1MechanicalEfficiency":0.9,"MudPump1VolumetricEfficiency":6.4,"MudPump1Output":10.0,"MudPump1OutputBblStroke":10.0,"MudPump1Maximum":120.0,"MudPump1ReliefValvePressure":41368.469,"MudPump2LinerDiameter":6.4,"MudPump2Stroke":120.0,"MudPump2MechanicalEfficiency":0.9,"MudPump2VolumetricEfficiency":6.4,"MudPump2Output":10.0,"MudPump2OutputBblStroke":10.0,"MudPump2Maximum":120.0,"MudPump2ReliefValvePressure":41368.469,"CementPumpLinerDiameter":6.4,"CementPumpStroke":120.0,"CementPumpMechanicalEfficiency":1.0,"CementPumpVolumetricEfficiency":6.4,"CementPumpOutput":10.0,"CementPumpOutputBblStroke":10.0,"CementPumpMaximum":120.0,"CementPumpReliefValvePressure":68.947,"MudPump1ReliefValveIsSet":true,"MudPump2ReliefValveIsSet":true,"CementPumpReliefValveIsSet":true,"ManualPumpPower":false,"Valve1":false,"Valve2":false,"Valve3":false,"Valve4":false,"Valve5":false,"MudPump1MaximumPressure":41368.469,"MudPump1PumpRateChange":5000.0,"MudPump1SurfaceLineLength":2.0,"MudPump1DelayToShutdown":5.0,"MudPump2MaximumPressure":41368.469,"MudPump2PumpRateChange":5000.0,"MudPump2SurfaceLineLength":4.0,"MudPump2DelayToShutdown":5.0,"CementPumpMaximumPressure":41368.469,"CementPumpPumpRateChange":5000.0,"CementPumpSurfaceLineLength":2.0,"CementPumpDelayToShutdown":5.0,"MudPump1VolumetricOutput":10.0,"MudPump2VolumetricOutput":10.0,"CementPumpVolumetricOutput":10.0},"RigSize":{"RigType":0,"CrownHeight":0.0,"MonkeyBoandHeight":0.0,"RigFloorHeight":0.0},"CasingLinerChoke":{"CasingDepth":1524.0,"CasingId":254.0,"CasingOd":243.84,"CasingWeight":69.94,"CasingCollapsePressure":17236.86,"CasingTensileStrength":1270.06,"LinerTopDepth":0.0,"LinerLength":0.0,"LinerId":0.0,"LinerOd":0.0,"LinerWeight":0.0,"LinerCollapsePressure":0.0,"LinerTensileStrength":0.0,"OpenHoleId":215.9,"OpenHoleLength":476.006},"Path":{"Items":[{"HoleType":0,"Angle":0.0,"Length":9144.0,"FinalAngle":0.0,"TotalLength":9144.0,"MeasuredDepth":9144.0,"TotalVerticalDepth":0.0}]},"Mud":{"ActiveMudType":0,"ActiveRheologyModel":0,"ActiveMudVolume":68.68,"ActiveMudVolumeGal":2884.5600000000004,"ActiveDensity":1269.461181640625,"ActivePlasticViscosity":23.0,"ActiveYieldPoint":18.3,"ActiveThetaThreeHundred":0.0,"ActiveThetaSixHundred":0.0,"ReserveMudType":0,"ReserveMudVolume":63.59,"ReserveMudVolumeGal":0.0,"ReserveDensity":1497.0059814453125,"ReservePlasticViscosity":23.0,"ReserveYieldPoint":21.13,"ReserveThetaThreeHundred":0.0,"ReserveThetaSixHundred":0.0,"ActiveTotalTankCapacity":190.78,"ActiveTotalTankCapacityGal":8012.76,"ActiveSettledContents":0.0,"ActiveSettledContentsGal":0.0,"ActiveTotalContents":0.0,"ActiveTotalContentsGal":0.0,"ActiveAutoDensity":false,"InitialTripTankMudVolume":3.18,"InitialTripTankMudVolumeGal":133.56,"PedalFlowMeter":1600.0}},"Problems":{"BitProblems":{"JetWashout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"PlugJets":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"JetWashoutCount":0,"PlugJetsCount":0},"BopProblems":{"AnnularWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AnnularFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AnnularLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"UpperRamWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"UpperRamFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"UpperRamLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MiddleRamWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MiddleRamFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MiddleRamLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"LowerRamWash":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"LowerRamFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"LowerRamLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorPumpFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorPumpLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorSystemFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorSystemLeak":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"ChokeProblems":{"HydraulicChoke1Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke1Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke1Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke2Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke2Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"HydraulicChoke2Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke2Plugged":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke2Fail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke2Washout":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ChokePanelAirFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManualChoke1PluggedPercent":0,"HydraulicChoke2PluggedPercent":0,"HydraulicChoke1PluggedPercent":0,"ManualChoke2PluggedPercent":0},"DrillStemsProblems":{"StringDragIncrease":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StringTorqueIncrease":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StringTorqueFluctuation":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StringDragIncreaseTime":0.0,"StringTorqueIncreaseTime":0.0},"GaugesProblems":{"WeightIndicator":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RotaryRpm":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RotaryTorque":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StandPipePressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CasingPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump1Strokes":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump2Strokes":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ReturnLineTemperature":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"TripTank":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"PitGainLoss":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"MudTankVolume":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ReturnMudFlow":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"TorqueLimit":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"PowerLimit":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AccumulatorPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ManifoldPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"AnnularPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RigAirPressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StandPipe1":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"StandPipe2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"DrillPipePressure":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ChokePosition":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CasingPressure2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"HoistingProblems":{"MotorFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ClutchEngage":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ClutchDisengage":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"KickProblems":{"Kick":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"FluidType":0,"FlowRate":0,"OverBalancePressure":0,"IsAutoMigrationRateSelected":false,"AutoMigrationRate":0.0},"LostProblems":{"LostCirculation":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"FlowRate":0.0},"MudTreatmentProblems":{"Degasser":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"ShaleShaker":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Desander":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Desilter":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"OtherProblems":{"RigAlarm":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RigWaterSupply":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"RigAir":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen1":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen3":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Gen4":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr1":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr2":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr3":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Scr4":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"PumpProblems":{"Pump1PowerFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump1BlowPopOffValve":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump2PowerFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"Pump2BlowPopOffValve":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CementPumpPowerFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"CementPumpBlowPopOffValve":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}},"RotaryProblems":{"MotorFail":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0},"OverideTorqueLimit":{"ProblemType":0,"StatusType":0,"Value":0.0,"DueValue":0.0}}},"Equipments":{"HookVelocity":0.0,"HookHeight":10.67848503986859,"BopControl":{"ManifoldPressureGauge":0.0,"AirSupplyPressureGauge":0.0,"AccumulatorPressureGauge":0.0,"AnnularPressureGauge":0.0,"AnnularOpenLED":0,"AnnularCloseLED":0,"UpperRamsOpenLED":0,"UpperRamsCloseLED":0,"MiddleRamsOpenLED":0,"MiddleRamsCloseLED":0,"KillLineOpenLED":0,"KillLineCloseLED":0,"ChokeLineOpenLED":0,"ChokeLineCloseLED":0,"LowerRamsOpenLED":0,"LowerRamsCloseLED":0,"AnnularStatus":0.0,"UpperRamsStatus":0.0,"MiddleRamsStatus":0.0,"LowerRamsStatus":0.0,"AirMasterValve":-1.0,"KillLineValve":1.0,"ChokeLineValve":-1.0,"UpperRamsValve":1.0,"LowerRamsValve":1.0,"AnnularValve":1.0,"ByePassValve":1.0,"MiddleRamsValve":1.0,"AnnularRegulatorSetControl":1374.0},"ChokeControl":{"StandPipePressure":0.0,"CasingPressure":0.0,"ChokePosition":0.0,"ChokePanelSPMCounter":0.0,"ChokePanelTotalStrokeCounter":0.0,"Choke1LED":0,"Choke2LED":0,"ChokePanelRigAirSwitch":true,"ChokePanelStrokeResetSwitch":false,"ChokeControlLever":1.0,"ChokePanelPumpSelectorSwitch":3.0,"ChokeRateControlKnob":3.0,"ChokeSelectorSwitch":true},"ChokeManifold":{"HydraulicChock1":0,"HydraulicChock2":0,"HyChock1OnProblem":false,"HyChock2OnProblem":false,"LeftManChokeOnProblem":false,"RightManChokeOnProblem":false,"ChokeManifoldValve1":false,"ChokeManifoldValve2":false,"ChokeManifoldValve3":false,"ChokeManifoldValve4":false,"ChokeManifoldValve5":false,"ChokeManifoldValve6":false,"ChokeManifoldValve7":false,"ChokeManifoldValve8":false,"ChokeManifoldValve9":false,"ChokeManifoldValve10":false,"ChokeManifoldValve11":false,"ChokeManifoldValve12":false,"ChokeManifoldValve13":false,"LeftManualChoke":0.0,"RightManualChoke":0.0},"DataDisplay":{"WOBPointer":0.0,"HookLoadPointer":0.0,"TripTankGauge":0.0,"TripTankAlarmLED":0,"TripTankPumpLED":0,"StandPipePressureGauge":0.0,"CasingPressureGauge":0.0,"MP1SPMGauge":0.0,"MP2SPMGauge":0.0,"ReturnLineTempGauge":0.0,"RotaryTorqueGauge":0.0,"RotaryRPMGauge":0.0,"AcidGasDetectionLED":0,"TotalStrokeCounter":0.0,"PitGainLossGauge":0.0,"MudTanksVolumeGauge":0.0,"MVTAlarmLED":0,"MVTSetAlarmSwitch":-1,"ReturnMudFlowGauge":0.0,"FillStrokeCounter":0.0,"MFFITotalStrokeCounter":0.0,"MFFIAlarmLED":0,"MFFISetAlarmSwitch":-1,"MFFIPumpLED":0,"TotalWellDepth":0.0,"BitDepth":0.0,"HookLoad":0.0,"StandPipePressure":0.0,"CasingPressure":0.0,"MP1SPM":0.0,"MP2SPM":0.0,"RTTorque":0.0,"RTRPM":0.0,"WOP":0.0,"ROP":0.0,"MudWeightIn":0.0,"MudWeightOut":0.0,"Buzzer1":false,"Buzzer2":false,"Buzzer3":false,"Buzzer4":false,"MVTAlarmHigh":0.0,"MVTAlarmLow":0.0,"MFFIAlarmHigh":26.0,"MFFIAlarmLow":0.0,"TotalStrokeCounterResetSwitch":0,"ResetWob":0},"Drilling":{"MP1Throttle":0.0,"MP2Throttle":0.0,"RTThrottle":4.0,"DWThrottle":0.0,"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.0,"RTTorqueLimitGauge":0.0,"AutoDWLED":0,"GEN1BTNLED":0,"GEN2BTNLED":0,"GEN3BTNLED":0,"GEN4BTNLED":0,"OpenKellyCockLed":0,"CloseKellyCockLed":0,"OpenSafetyValveLed":0,"CloseSafetyValveLed":0,"IRSafetyValveLed":0,"IRIBopLed":0,"LatchPipeLED":0,"UnlatchPipeLED":0,"SwingLed":0,"FillMouseHoleLed":0,"MP1CPSwitch":0,"MP2Switch":0,"DWSwitch":-1,"RTSwitch":-1,"TongLever":0.0},"Hook":{"HookHeight_S":0.0,"HookHeight":0.0},"StandPipeManifold":{"StandPipeGauge1":0.0,"StandPipeGauge2":0.0,"StandPipeManifoldValve1":false,"StandPipeManifoldValve2":false,"StandPipeManifoldValve3":false,"StandPipeManifoldValve4":false,"StandPipeManifoldValve5":false,"StandPipeManifoldValve6":false,"StandPipeManifoldValve7":false,"StandPipeManifoldValve8":false,"StandPipeManifoldValve9":false,"StandPipeManifoldValve10":false,"StandPipeManifoldValve11":false,"StandPipeManifoldValve12":false,"StandPipeManifoldValve13":false,"StandPipeManifoldValve14":false,"StandPipeManifoldValve15":false},"DrillingWatch":{"Depth":0.0,"BitPosition":0.0,"HookLoad":0.0,"WeightOnBit":0.0,"RPM":0.0,"ROP":0.0,"Torque":0.0,"PumpPressure":0.0,"SPM1":0.0,"SPM2":0.0,"CasingPressure":0.0,"PercentFlow":0.0,"PitGainLose":0.0,"PitVolume":0.0,"KillMudVolume":0.0,"TripTankVolume":0.0,"MudWeightIn":0.0,"FillVolume":0.0,"MudWeightOut":0.0}}}