Browse Source

General Commit - 14030713

master
Mahmood 3 months ago
parent
commit
a57ac8edd6
100 changed files with 4633 additions and 3528 deletions
  1. +4
    -28
      .vscode/launch.json
  2. +8
    -0
      .vscode/tasks.json
  3. +1
    -0
      CSharp/BasicInputs/Geology/CFormation.i90
  4. +8
    -12
      CSharp/BasicInputs/MudProperties.i90
  5. +106
    -0
      CSharp/DownHole/CDownHoleActions.i90
  6. +1
    -1
      CSharp/DownHole/CDownHoleTypes.i90
  7. +1
    -1
      CSharp/DownHole/CDownHoleVariables.f90
  8. +2
    -2
      CSharp/DownHole/CDownHoleVariables.i90
  9. +53
    -23
      CSharp/DownHole/DownHole.f90
  10. +57
    -27
      CSharp/DownHole/DownHole.i90
  11. BIN
     
  12. +0
    -1
      CSharp/Equipments/ControlPanels/CBopControlPanel.i90
  13. +20
    -43
      CSharp/Equipments/ControlPanels/CChokeControlPanel.i90
  14. +5
    -5
      CSharp/Equipments/ControlPanels/CChokeManifold.i90
  15. +1
    -1
      CSharp/Equipments/ControlPanels/CChokeManifoldVariables.i90
  16. +2
    -0
      CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90
  17. +6
    -8
      CSharp/Equipments/ControlPanels/CDataDisplayConsole.i90
  18. +82
    -88
      CSharp/Equipments/ControlPanels/CDrillingConsole.f90
  19. +99
    -92
      CSharp/Equipments/ControlPanels/CDrillingConsole.i90
  20. +1
    -1
      CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.f90
  21. +2
    -2
      CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.i90
  22. +15
    -25
      CSharp/Equipments/ControlPanels/CHook.i90
  23. +1
    -1
      CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.i90
  24. +0
    -50
      CSharp/Equipments/DrillWatch/DrillWatch.f90
  25. +0
    -50
      CSharp/Equipments/DrillWatch/DrillWatch.i90
  26. +138
    -0
      CSharp/Equipments/MudPathFinding/CArrangement.i90
  27. +8
    -36
      CSharp/Equipments/MudPathFinding/CManifolds.f90
  28. +508
    -563
      CSharp/Equipments/MudPathFinding/CManifolds.i90
  29. +232
    -0
      CSharp/Equipments/MudPathFinding/CPath.i90
  30. +43
    -0
      CSharp/Equipments/MudPathFinding/CStack.i90
  31. +38
    -0
      CSharp/Equipments/MudPathFinding/ManifoldVariables.i90
  32. +3
    -4
      CSharp/Equipments/Tanks/CTanks.i90
  33. +1
    -1
      CSharp/Equipments/Tanks/CTanksVariables.i90
  34. +10
    -18
      CSharp/OperationScenarios/Common/COperationScenariosMain.f90
  35. +42
    -66
      CSharp/OperationScenarios/Common/COperationScenariosMain.i90
  36. +9
    -23
      CSharp/OperationScenarios/Common/COperationScenariosSettings.f90
  37. +476
    -0
      CSharp/OperationScenarios/Common/COperationScenariosSettings.i90
  38. +46
    -0
      CSharp/OperationScenarios/Common/COperationScenariosVariables.i90
  39. +85
    -29
      CSharp/OperationScenarios/Common/OperationScenarios.i90
  40. +5
    -20
      CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90
  41. +7
    -20
      CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.i90
  42. +105
    -0
      CSharp/OperationScenarios/Notifications/COpenSafetyValveLedNotification.i90
  43. +12
    -62
      CSharp/OperationScenarios/Notifications/CSlipsNotification.f90
  44. +13
    -61
      CSharp/OperationScenarios/Notifications/CSlipsNotification.i90
  45. +1
    -1
      CSharp/OperationScenarios/Notifications/CSwingLedNotification.i90
  46. +1
    -1
      CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.i90
  47. +18
    -97
      CSharp/OperationScenarios/Notifications/CTongNotification.i90
  48. +42
    -67
      CSharp/OperationScenarios/Notifications/Notifications.i90
  49. +1
    -13
      CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90
  50. +43
    -0
      CSharp/OperationScenarios/Permissions/CFillupHeadPermission.i90
  51. +0
    -22
      CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90
  52. +1
    -24
      CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.i90
  53. +2
    -25
      CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90
  54. +4
    -26
      CSharp/OperationScenarios/Permissions/CSwingDrillPermission.i90
  55. +7
    -28
      CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90
  56. +9
    -29
      CSharp/OperationScenarios/Permissions/CSwingOffPermission.i90
  57. +4
    -18
      CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90
  58. +6
    -19
      CSharp/OperationScenarios/Permissions/CSwingTiltPermission.i90
  59. +169
    -0
      CSharp/OperationScenarios/Permissions/Permissions.i90
  60. +17
    -0
      CSharp/OperationScenarios/Permissions/PermissionsVariables.i90
  61. +9
    -2
      CSharp/OperationScenarios/SoftwareInputs.f90
  62. +46
    -57
      CSharp/OperationScenarios/SoftwareInputs.i90
  63. +0
    -1
      CSharp/OperationScenarios/SoftwareInputsVariables.i90
  64. +4
    -2
      CSharp/OperationScenarios/Unity/CUnityInputs.i90
  65. +33
    -37
      CSharp/OperationScenarios/Unity/UnityModule.i90
  66. +8
    -27
      CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90
  67. +9
    -26
      CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.i90
  68. +3
    -17
      CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90
  69. +5
    -17
      CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.i90
  70. +3
    -19
      CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90
  71. +5
    -20
      CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.i90
  72. +10
    -28
      CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90
  73. +9
    -25
      CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.i90
  74. +92
    -0
      CSharp/OperationScenarios/UnitySignals/CTongEnum.i90
  75. +36
    -13
      CSharp/OperationScenarios/UnitySignals/UnitySignals.f90
  76. +153
    -107
      CSharp/OperationScenarios/UnitySignals/UnitySignals.i90
  77. +15
    -10
      CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90
  78. +28
    -18
      CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.i90
  79. +1
    -1
      CSharp/Problems/CRotaryProblems.i90
  80. +124
    -124
      Equipments/BopStack/ANNULAR.f90
  81. +108
    -108
      Equipments/BopStack/ANNULAR.i90
  82. +2
    -1
      Equipments/BopStack/BOP.f90
  83. +3
    -2
      Equipments/BopStack/BOP.i90
  84. +83
    -83
      Equipments/BopStack/KILL_LINE.f90
  85. +81
    -81
      Equipments/BopStack/KILL_LINE.i90
  86. +37
    -0
      Equipments/BopStack/KillLineMain.i90
  87. +0
    -1
      Equipments/BopStack/LOSS_INPUTS.i90
  88. +0
    -337
      Equipments/ChokeControl/AirPump_Choke_Subs.f90
  89. +1
    -338
      Equipments/ChokeControl/AirPump_Choke_Subs.i90
  90. +2
    -8
      Equipments/ChokeControl/CHOKE.f90
  91. +3
    -9
      Equipments/ChokeControl/CHOKE.i90
  92. +79
    -0
      Equipments/ChokeControl/CHOKE_VARIABLES.i90
  93. +454
    -3
      Equipments/ChokeControl/ChokeControlMain.f90
  94. +455
    -4
      Equipments/ChokeControl/ChokeControlMain.i90
  95. +0
    -127
      Equipments/ChokeControl/ChokeStartup.f90
  96. +44
    -49
      Equipments/ChokeControl/ChokeStartup.i90
  97. +32
    -11
      Equipments/Drawworks/Drawworks_Direction.i90
  98. +0
    -4
      Equipments/Drawworks/Drawworks_Outputs.f90
  99. +2
    -5
      Equipments/Drawworks/Drawworks_Outputs.i90
  100. +73
    -72
      Equipments/Drawworks/Drawworks_Solver.i90

+ 4
- 28
.vscode/launch.json View File

@@ -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",
}
]

+ 8
- 0
.vscode/tasks.json View File

@@ -1,6 +1,14 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "make testredis",
"type": "shell",
"command": "make testredis",
"options": {
"cwd": "${workspaceRoot}"
}
},
{
"label": "make",
"type": "shell",


+ 1
- 0
CSharp/BasicInputs/Geology/CFormation.i90 View File

@@ -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


+ 8
- 12
CSharp/BasicInputs/MudProperties.i90 View File

@@ -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


+ 106
- 0
CSharp/DownHole/CDownHoleActions.i90 View File

@@ -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

+ 1
- 1
CSharp/DownHole/CDownHoleTypes.i90 View File

@@ -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


+ 1
- 1
CSharp/DownHole/CDownHoleVariables.f90 View File

@@ -3,7 +3,7 @@ module CDownHoleVariables
! use CStringConfigurationVariables
! use CDownHoleActions
use CLog4
implicit none
implicit none
public
!!!!!!!!!!!!!!!!!!!!!
! Outputs to user interface


+ 2
- 2
CSharp/DownHole/CDownHoleVariables.i90 View File

@@ -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


+ 53
- 23
CSharp/DownHole/DownHole.f90 View File

@@ -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)


+ 57
- 27
CSharp/DownHole/DownHole.i90 View File

@@ -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


BIN
View File


+ 0
- 1
CSharp/Equipments/ControlPanels/CBopControlPanel.i90 View File

@@ -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


+ 20
- 43
CSharp/Equipments/ControlPanels/CChokeControlPanel.i90 View File

@@ -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)


+ 5
- 5
CSharp/Equipments/ControlPanels/CChokeManifold.i90 View File

@@ -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


+ 1
- 1
CSharp/Equipments/ControlPanels/CChokeManifoldVariables.i90 View File

@@ -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


+ 2
- 0
CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 View File

@@ -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)


+ 6
- 8
CSharp/Equipments/ControlPanels/CDataDisplayConsole.i90 View File

@@ -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

+ 82
- 88
CSharp/Equipments/ControlPanels/CDrillingConsole.f90 View File

@@ -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()



+ 99
- 92
CSharp/Equipments/ControlPanels/CDrillingConsole.i90 View File

@@ -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

+ 1
- 1
CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.f90 View File

@@ -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


+ 2
- 2
CSharp/Equipments/ControlPanels/CDrillingConsoleVariables.i90 View File

@@ -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


+ 15
- 25
CSharp/Equipments/ControlPanels/CHook.i90 View File

@@ -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


+ 1
- 1
CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.i90 View File

@@ -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


+ 0
- 50
CSharp/Equipments/DrillWatch/DrillWatch.f90 View File

@@ -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


+ 0
- 50
CSharp/Equipments/DrillWatch/DrillWatch.i90 View File

@@ -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


+ 138
- 0
CSharp/Equipments/MudPathFinding/CArrangement.i90 View File

@@ -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

+ 8
- 36
CSharp/Equipments/MudPathFinding/CManifolds.f90 View File

@@ -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)


+ 508
- 563
CSharp/Equipments/MudPathFinding/CManifolds.i90
File diff suppressed because it is too large
View File


+ 232
- 0
CSharp/Equipments/MudPathFinding/CPath.i90 View File

@@ -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

+ 43
- 0
CSharp/Equipments/MudPathFinding/CStack.i90 View File

@@ -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

+ 38
- 0
CSharp/Equipments/MudPathFinding/ManifoldVariables.i90 View File

@@ -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

+ 3
- 4
CSharp/Equipments/Tanks/CTanks.i90 View File

@@ -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



+ 1
- 1
CSharp/Equipments/Tanks/CTanksVariables.i90 View File

@@ -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


+ 10
- 18
CSharp/OperationScenarios/Common/COperationScenariosMain.f90 View File

@@ -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()


+ 42
- 66
CSharp/OperationScenarios/Common/COperationScenariosMain.i90 View File

@@ -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


+ 9
- 23
CSharp/OperationScenarios/Common/COperationScenariosSettings.f90 View File

@@ -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

+ 476
- 0
CSharp/OperationScenarios/Common/COperationScenariosSettings.i90 View File

@@ -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

+ 46
- 0
CSharp/OperationScenarios/Common/COperationScenariosVariables.i90 View File

@@ -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

+ 85
- 29
CSharp/OperationScenarios/Common/OperationScenarios.i90 View File

@@ -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

+ 5
- 20
CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.f90 View File

@@ -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

+ 7
- 20
CSharp/OperationScenarios/Enums/CTdsElevatorModesEnum.i90 View File

@@ -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


+ 105
- 0
CSharp/OperationScenarios/Notifications/COpenSafetyValveLedNotification.i90 View File

@@ -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

+ 12
- 62
CSharp/OperationScenarios/Notifications/CSlipsNotification.f90 View File

@@ -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()


+ 13
- 61
CSharp/OperationScenarios/Notifications/CSlipsNotification.i90 View File

@@ -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()


+ 1
- 1
CSharp/OperationScenarios/Notifications/CSwingLedNotification.i90 View File

@@ -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


+ 1
- 1
CSharp/OperationScenarios/Notifications/CTdsPowerLedNotification.i90 View File

@@ -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


+ 18
- 97
CSharp/OperationScenarios/Notifications/CTongNotification.i90 View File

@@ -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()


+ 42
- 67
CSharp/OperationScenarios/Notifications/Notifications.i90 View File

@@ -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()


+ 1
- 13
CSharp/OperationScenarios/Permissions/CFillupHeadPermission.f90 View File

@@ -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'


+ 43
- 0
CSharp/OperationScenarios/Permissions/CFillupHeadPermission.i90 View File

@@ -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

+ 0
- 22
CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.f90 View File

@@ -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


+ 1
- 24
CSharp/OperationScenarios/Permissions/CIrSafetyValvePermission.i90 View File

@@ -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


+ 2
- 25
CSharp/OperationScenarios/Permissions/CSwingDrillPermission.f90 View File

@@ -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'


+ 4
- 26
CSharp/OperationScenarios/Permissions/CSwingDrillPermission.i90 View File

@@ -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'


+ 7
- 28
CSharp/OperationScenarios/Permissions/CSwingOffPermission.f90 View File

@@ -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


+ 9
- 29
CSharp/OperationScenarios/Permissions/CSwingOffPermission.i90 View File

@@ -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


+ 4
- 18
CSharp/OperationScenarios/Permissions/CSwingTiltPermission.f90 View File

@@ -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'


+ 6
- 19
CSharp/OperationScenarios/Permissions/CSwingTiltPermission.i90 View File

@@ -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'


+ 169
- 0
CSharp/OperationScenarios/Permissions/Permissions.i90 View File

@@ -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

+ 17
- 0
CSharp/OperationScenarios/Permissions/PermissionsVariables.i90 View File

@@ -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

+ 9
- 2
CSharp/OperationScenarios/SoftwareInputs.f90 View File

@@ -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

+ 46
- 57
CSharp/OperationScenarios/SoftwareInputs.i90 View File

@@ -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

+ 0
- 1
CSharp/OperationScenarios/SoftwareInputsVariables.i90 View File

@@ -12,7 +12,6 @@ module SoftwareInputsVariables
real :: TdsStemJointHeight = 0
logical :: ZeroStringSpeed = .false.
end type SoftwareInputsType
! type(SoftwareInputsType):: softwareInputs

contains



+ 4
- 2
CSharp/OperationScenarios/Unity/CUnityInputs.i90 View File

@@ -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


+ 33
- 37
CSharp/OperationScenarios/Unity/UnityModule.i90 View File

@@ -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



+ 8
- 27
CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.f90 View File

@@ -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


+ 9
- 26
CSharp/OperationScenarios/UnitySignals/CTdsBackupClamp.i90 View File

@@ -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


+ 3
- 17
CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.f90 View File

@@ -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


+ 5
- 17
CSharp/OperationScenarios/UnitySignals/CTdsSpineEnum.i90 View File

@@ -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


+ 3
- 19
CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.f90 View File

@@ -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'


+ 5
- 20
CSharp/OperationScenarios/UnitySignals/CTdsSwingEnum.i90 View File

@@ -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'


+ 10
- 28
CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.f90 View File

@@ -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


+ 9
- 25
CSharp/OperationScenarios/UnitySignals/CTdsTongEnum.i90 View File

@@ -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


+ 92
- 0
CSharp/OperationScenarios/UnitySignals/CTongEnum.i90 View File

@@ -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

+ 36
- 13
CSharp/OperationScenarios/UnitySignals/UnitySignals.f90 View File

@@ -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


+ 153
- 107
CSharp/OperationScenarios/UnitySignals/UnitySignals.i90 View File

@@ -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



+ 15
- 10
CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90 View File

@@ -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

+ 28
- 18
CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.i90 View File

@@ -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

+ 1
- 1
CSharp/Problems/CRotaryProblems.i90 View File

@@ -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


+ 124
- 124
Equipments/BopStack/ANNULAR.f90 View File

@@ -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


+ 108
- 108
Equipments/BopStack/ANNULAR.i90 View File

@@ -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


+ 2
- 1
Equipments/BopStack/BOP.f90 View File

@@ -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, &


+ 3
- 2
Equipments/BopStack/BOP.i90 View File

@@ -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, &


+ 83
- 83
Equipments/BopStack/KILL_LINE.f90 View File

@@ -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
!==========================================================================


+ 81
- 81
Equipments/BopStack/KILL_LINE.i90 View File

@@ -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
!==========================================================================


+ 37
- 0
Equipments/BopStack/KillLineMain.i90 View File

@@ -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

+ 0
- 1
Equipments/BopStack/LOSS_INPUTS.i90 View File

@@ -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


+ 0
- 337
Equipments/ChokeControl/AirPump_Choke_Subs.f90 View File

@@ -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)<Re_cr) then
data%State%AirPumpLine%fric_air(i)=64/data%State%AirPumpLine%Re_air(i)
else
data%State%AirPumpLine%fric_air(i)=1/(-1.8*log10((data%State%AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/data%State%AirPumpLine%Re_air(i)))**2
endif
data%State%AirPumpLine%fricloss_air(i)=((data%State%AirPumpLine%fric_air(i)*(wdens*sg*data%State%AirPumpLine%LENGT_AIR(i)*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%AREA_AIR(i))**2))/(2*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895
enddo
data%State%AirPumpLine%pipe_loss1air=sum(data%State%AirPumpLine%fricloss_air) !loss before regulator(psi)
do i=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE
if (data%State%AirPumpLine%LF_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%LF_AIR(i)*wdens*sg*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (data%State%AirPumpLine%CV_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(data%State%AirPumpLine%CV_AIR(i)))**2 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo
data%State%AirPumpLine%minor_loss1air=sum(data%State%AirPumpLine%minloss_air) !loss before regulator(psi)
data%State%AirPumpLine%static_loss1air=0
data%State%AirPumpLine%losses_air=data%State%AirPumpLine%pipe_loss1air+data%State%AirPumpLine%minor_loss1air+data%State%AirPumpLine%static_loss1air !(psi)
!=========================================================================
end do !returns correct QAIR_PUMP for 1 counter
data%State%AirPumpLine%QITER=data%State%AirDrivenPump%QAIR_PUMP
data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP*(data%Equipments%ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke + ((data%State%AirDrivenPump%QAIR_PUMP * data%State%AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
if ( data%State%Choke%Cumulative_AirVolume_Choke > 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
- 338
Equipments/ChokeControl/AirPump_Choke_Subs.i90 View File

@@ -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)<Re_cr) then
data%State%AirPumpLine%fric_air(i)=64/data%State%AirPumpLine%Re_air(i)
else
data%State%AirPumpLine%fric_air(i)=1/(-1.8*log10((data%State%AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/data%State%AirPumpLine%Re_air(i)))**2
endif
data%State%AirPumpLine%fricloss_air(i)=((data%State%AirPumpLine%fric_air(i)*(wdens*sg*data%State%AirPumpLine%LENGT_AIR(i)*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%AREA_AIR(i))**2))/(2*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895
enddo

data%State%AirPumpLine%pipe_loss1air=sum(data%State%AirPumpLine%fricloss_air) !loss before regulator(psi)

do i=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE
if (data%State%AirPumpLine%LF_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%LF_AIR(i)*wdens*sg*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (data%State%AirPumpLine%CV_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(data%State%AirPumpLine%CV_AIR(i)))**2 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo
data%State%AirPumpLine%minor_loss1air=sum(data%State%AirPumpLine%minloss_air) !loss before regulator(psi)
data%State%AirPumpLine%static_loss1air=0
data%State%AirPumpLine%losses_air=data%State%AirPumpLine%pipe_loss1air+data%State%AirPumpLine%minor_loss1air+data%State%AirPumpLine%static_loss1air !(psi)
!=========================================================================
end do !returns correct QAIR_PUMP for 1 counter

data%State%AirPumpLine%QITER=data%State%AirDrivenPump%QAIR_PUMP
data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP*(data%Equipments%ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke + ((data%State%AirDrivenPump%QAIR_PUMP * data%State%AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
if ( data%State%Choke%Cumulative_AirVolume_Choke > 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"

+ 2
- 8
Equipments/ChokeControl/CHOKE.f90 View File

@@ -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)


+ 3
- 9
Equipments/ChokeControl/CHOKE.i90 View File

@@ -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)


+ 79
- 0
Equipments/ChokeControl/CHOKE_VARIABLES.i90 View File

@@ -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

+ 454
- 3
Equipments/ChokeControl/ChokeControlMain.f90 View File

@@ -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)<Re_cr) then
data%State%AirPumpLine%fric_air(i)=64/data%State%AirPumpLine%Re_air(i)
else
data%State%AirPumpLine%fric_air(i)=1/(-1.8*log10((data%State%AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/data%State%AirPumpLine%Re_air(i)))**2
endif
data%State%AirPumpLine%fricloss_air(i)=((data%State%AirPumpLine%fric_air(i)*(wdens*sg*data%State%AirPumpLine%LENGT_AIR(i)*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%AREA_AIR(i))**2))/(2*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895
enddo
data%State%AirPumpLine%pipe_loss1air=sum(data%State%AirPumpLine%fricloss_air) !loss before regulator(psi)
do i=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE
if (data%State%AirPumpLine%LF_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%LF_AIR(i)*wdens*sg*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (data%State%AirPumpLine%CV_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(data%State%AirPumpLine%CV_AIR(i)))**2 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo
data%State%AirPumpLine%minor_loss1air=sum(data%State%AirPumpLine%minloss_air) !loss before regulator(psi)
data%State%AirPumpLine%static_loss1air=0
data%State%AirPumpLine%losses_air=data%State%AirPumpLine%pipe_loss1air+data%State%AirPumpLine%minor_loss1air+data%State%AirPumpLine%static_loss1air !(psi)
!=========================================================================
end do !returns correct QAIR_PUMP for 1 counter
data%State%AirPumpLine%QITER=data%State%AirDrivenPump%QAIR_PUMP
data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP*(data%Equipments%ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke + ((data%State%AirDrivenPump%QAIR_PUMP * data%State%AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
if ( data%State%Choke%Cumulative_AirVolume_Choke > 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

+ 455
- 4
Equipments/ChokeControl/ChokeControlMain.i90 View File

@@ -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)<Re_cr) then
data%State%AirPumpLine%fric_air(i)=64/data%State%AirPumpLine%Re_air(i)
else
data%State%AirPumpLine%fric_air(i)=1/(-1.8*log10((data%State%AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/data%State%AirPumpLine%Re_air(i)))**2
endif
data%State%AirPumpLine%fricloss_air(i)=((data%State%AirPumpLine%fric_air(i)*(wdens*sg*data%State%AirPumpLine%LENGT_AIR(i)*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%AREA_AIR(i))**2))/(2*data%State%AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895
enddo
data%State%AirPumpLine%pipe_loss1air=sum(data%State%AirPumpLine%fricloss_air) !loss before regulator(psi)
do i=1,data%State%AirPumpLine%NO_MINORS_AIRPLINE
if (data%State%AirPumpLine%LF_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%LF_AIR(i)*wdens*sg*(data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005/data%State%AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (data%State%AirPumpLine%CV_AIR(i)/=0) then
data%State%AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*data%State%AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(data%State%AirPumpLine%CV_AIR(i)))**2 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
data%State%AirPumpLine%minlosspa_air(i)=data%State%AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
data%State%AirPumpLine%minloss_air(i)=data%State%AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo
data%State%AirPumpLine%minor_loss1air=sum(data%State%AirPumpLine%minloss_air) !loss before regulator(psi)
data%State%AirPumpLine%static_loss1air=0
data%State%AirPumpLine%losses_air=data%State%AirPumpLine%pipe_loss1air+data%State%AirPumpLine%minor_loss1air+data%State%AirPumpLine%static_loss1air !(psi)
!=========================================================================
end do !returns correct QAIR_PUMP for 1 counter
data%State%AirPumpLine%QITER=data%State%AirDrivenPump%QAIR_PUMP
data%State%AirDrivenPump%QAIR_PUMP=data%State%AirDrivenPump%QAIR_PUMP*(data%Equipments%ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
data%State%Choke%Cumulative_AirVolume_Choke= data%State%Choke%Cumulative_AirVolume_Choke + ((data%State%AirDrivenPump%QAIR_PUMP * data%State%AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
if ( data%State%Choke%Cumulative_AirVolume_Choke > 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

+ 0
- 127
Equipments/ChokeControl/ChokeStartup.f90 View File

@@ -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

+ 44
- 49
Equipments/ChokeControl/ChokeStartup.i90 View File

@@ -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

+ 32
- 11
Equipments/Drawworks/Drawworks_Direction.i90 View File

@@ -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
!
!


+ 0
- 4
Equipments/Drawworks/Drawworks_Outputs.f90 View File

@@ -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

+ 2
- 5
Equipments/Drawworks/Drawworks_Outputs.i90 View File

@@ -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

+ 73
- 72
Equipments/Drawworks/Drawworks_Solver.i90 View File

@@ -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)<data%State%Drawworks%TDDrillStemsDownDepth(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
@@ -242,25 +248,19 @@ subroutine Drawworks_Solver
!====================================================
if ( (data%State%Drawworks%DriveType==0) .and. (Get_TdsStemIn()) .and. Get_Slips() == SLIPS_SET_END ) 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
return
end if
!=====> 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]


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save