@@ -0,0 +1,134 @@ | |||||
CSharp: | |||||
BasicInputs: | |||||
Bha: | |||||
StringConfiguration | |||||
Geology: | |||||
Formation | |||||
Reservoir | |||||
Shoe | |||||
RigSpecification: | |||||
Accumulator | |||||
BopStackSpecification | |||||
Hoisting | |||||
Power | |||||
PumpsSpecification | |||||
RigSize | |||||
WellProfile: | |||||
CasingLinerChoke | |||||
PathGeneration | |||||
WellSurveyData | |||||
MudProperties | |||||
Equipments: | |||||
ControlPanel: | |||||
BopControlPanel | |||||
CholeControlPanel | |||||
ChokeManifold | |||||
DataDisplayConsole | |||||
DrillingConsole | |||||
Hook | |||||
StandPipleManifold | |||||
TopDrivePanel | |||||
ِDrillWatch | |||||
DrillingWatch | |||||
MudPathfinding: | |||||
Manifold | |||||
Tanks: | |||||
Tank | |||||
Common: | |||||
Common | |||||
Lesson | |||||
DownHole: | |||||
DownHole | |||||
OperationScenario: | |||||
Common: | |||||
OperationScenario: Constants? or Variables? | |||||
Enums: | |||||
ElevatorConnectionEnum: merged into OperationScenario | |||||
KellyConnectionEnum | |||||
TdsConnectionModesEnum | |||||
Notifications: | |||||
Notifications | |||||
Permissions: | |||||
Permissions | |||||
SoftwareInputs | |||||
Unity: | |||||
UnityInputs | |||||
UnityOutputs | |||||
UnitySignals: | |||||
UnitySignals | |||||
StudentStation: | |||||
StudentStation | |||||
Warnings: | |||||
Warnings | |||||
Problems: | |||||
BitProblems | |||||
BopProblems | |||||
ChockProblems | |||||
DrillStemProblems | |||||
GaugesProblems | |||||
HoistingProblems | |||||
KickProblems | |||||
LostProblems | |||||
MudTreatmentProblems | |||||
OtherProblems | |||||
PumpProblems | |||||
RotaryProblems | |||||
Equipments: | |||||
BopStack: | |||||
BopStackInput | |||||
BopStackAcc | |||||
RamLine | |||||
AnnularComputational | |||||
Annular | |||||
PipeRam1 | |||||
ShearRam | |||||
PipeRam2 | |||||
ChokeLine | |||||
KillLine | |||||
Pumps | |||||
RAM (previously exists) | |||||
RAMS | |||||
ChokeControl: | |||||
Choke | |||||
AirDrivenPump | |||||
AirPumpLine | |||||
CHOOKE (previously exists) | |||||
MudSystem: | |||||
MudSystem | |||||
Pumps: | |||||
MPumps | |||||
Pump(1:3) | |||||
RotaryTable: | |||||
RTable | |||||
TopDrive: | |||||
TDS | |||||
TorqueDrag: | |||||
TDGeo | |||||
data%State%F_String(:) | |||||
F_Counts | |||||
data%State%F_Interval(:) | |||||
data%State%OD_Annulus(4) | |||||
data%State%TD_String | |||||
data%State%TD_DrillStem(:) | |||||
data%State%TD_DrillStems(:) | |||||
data%State%TD_Count | |||||
data%State%G_StringElement | |||||
data%State%TD_Vol | |||||
data%State%TD_General | |||||
data%State%TD_BOP | |||||
data%State%TD_BOPElement(4) | |||||
data%State%TD_StConn | |||||
data%State%TD_Load | |||||
data%State%TD_WellEl | |||||
data%State%TD_Casing | |||||
data%State%TD_Liner | |||||
data%State%TD_OpenHole | |||||
data%State%TD_ROPHole | |||||
data%State%TD_WellGeneral | |||||
data%State%TD_WellGeo(:) | |||||
FluidFlow: | |||||
Rop: | |||||
ROP_Bit | |||||
ROP_Spec |
@@ -0,0 +1,11 @@ | |||||
{ | |||||
"redis":{ | |||||
"address":"85.198.9.229", | |||||
"port":6379, | |||||
"password":"1qazxsw2$$" | |||||
}, | |||||
"logging":3, | |||||
"process_name": "SimulationCore2", | |||||
"work_dir" : ".", | |||||
"step_time" : 100 | |||||
} |
@@ -0,0 +1 @@ | |||||
./SimulationCore2 aberama.iran.liara.ir 32815 4YKFnubfFFjfh4yTK7b0Rg9X 60f8144a-c1b7-4d1a-5d99-08db9e4e35f5 5 |
@@ -0,0 +1,42 @@ | |||||
import sys | |||||
import redis | |||||
import json | |||||
import time | |||||
import subprocess | |||||
import psutil | |||||
if __name__=='__main__': | |||||
if len(sys.argv)<=1: | |||||
configFN = 'config-remote.json' | |||||
else: | |||||
configFN = sys.argv[1] | |||||
f = open(configFN) | |||||
config = json.load(f) | |||||
redis_address = config['redis']['address'] | |||||
redis_password = config['redis']['password'] | |||||
redis_port = config['redis']['port'] | |||||
log_level = config['logging'] | |||||
work_dir = config['work_dir'] | |||||
stepTime = config['step_time'] | |||||
process_name = config['process_name'] | |||||
r = redis.Redis(host=redis_address, port=redis_port, decode_responses=True,password=redis_password) | |||||
runnings = [] | |||||
while True: | |||||
sims = r.get('Simulations') | |||||
sims = json.loads(sims) | |||||
for sim in sims: | |||||
simulation_id = sim['Id'] | |||||
process_exists = False | |||||
for proc in psutil.process_iter(['pid', 'name', 'cmdline']): | |||||
if proc.info['name'] == process_name and len(proc.info['cmdline']) > 1 and proc.info['cmdline'][1] == simulation_id: | |||||
process_exists = True | |||||
break | |||||
if not simulation_id in runnings: #process_exists: | |||||
runnings.append(simulation_id) | |||||
command = ['./SimulationCore2', redis_address,str(redis_port),redis_password,simulation_id,str(log_level),str(stepTime)] | |||||
print(command) | |||||
subprocess.Popen(command, cwd=work_dir) | |||||
time.sleep(5) |
@@ -0,0 +1,15 @@ | |||||
Bit Class H1 H2 H3 (w/d)max | |||||
11 , 1.9 , 7. , 1. , 7. | |||||
12 , 1.9 , 7. , 1. , 7. | |||||
13 , 1.84 , 6. , 0.8 , 8. | |||||
14 , 1.84 , 6. , 0.8 , 8. | |||||
21 , 1.8 , 5. , 0.6 , 8.5 | |||||
22 , 1.8 , 5. , 0.6 , 8.5 | |||||
23 , 1.76 , 4. , 0.48 , 9. | |||||
24 , 1.76 , 4. , 0.48 , 9. | |||||
31 , 1.7 , 3. , 0.36 , 10. | |||||
32 , 1.65 , 2. , 0.26 , 10. | |||||
33 , 1.6 , 2. , 0.2 , 10. | |||||
34 , 1.6 , 2. , 0.2 , 10. | |||||
41 , 1.5 , 2. , 0.18 , 10. | |||||
10 , 1.5 , 1. , 0.02 , 10. |
@@ -1,4 +1,4 @@ | |||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/BasicInputs/RigSpecifications/CAccumulator.f90" | |||||
# 1 "/home/admin/SimulationCore2/CSharp/BasicInputs/RigSpecifications/CAccumulator.f90" | |||||
module CAccumulator | module CAccumulator | ||||
use SimulationVariables | use SimulationVariables | ||||
! use CAccumulatorVariables | ! use CAccumulatorVariables | ||||
@@ -0,0 +1,58 @@ | |||||
# 1 "/home/admin/SimulationCore2/CSharp/BasicInputs/RigSpecifications/CHoisting.f90" | |||||
module CHoisting | |||||
use SimulationVariables | |||||
use json_module | |||||
implicit none | |||||
public | |||||
contains | |||||
subroutine HoistingFromJson(parent) | |||||
use json_module,IK =>json_ik | |||||
type(json_value),pointer :: parent | |||||
type(json_core) :: json | |||||
type(json_value),pointer :: p,pitem,pval | |||||
logical::is_found | |||||
integer::i,n_children | |||||
CHARACTER(KIND=JSON_CK, LEN=:), ALLOCATABLE :: val | |||||
call json%get(parent,'Hoisting',p) | |||||
call json%get(p,'DriveType',pval) | |||||
call json%get(pval,data%Configuration%Hoisting%DriveType) | |||||
call json%get(p,'TravelingBlockWeight',pval) | |||||
call json%get(pval,data%Configuration%Hoisting%TravelingBlockWeight) | |||||
call json%get(p,'TopDriveWeight',pval) | |||||
call json%get(pval,data%Configuration%Hoisting%TopDriveWeight) | |||||
call json%get(p,'KellyWeight',pval) | |||||
call json%get(pval,data%Configuration%Hoisting%KellyWeight) | |||||
call json%get(p,'NumberOfLine',pval) | |||||
call json%get(pval,data%Configuration%Hoisting%NumberOfLine) | |||||
call json%get(p,'DrillingLineBreakingLoad',pval) | |||||
call json%get(pval,data%Configuration%Hoisting%DrillingLineBreakingLoad) | |||||
!@@@ | |||||
data%Configuration%Hoisting%NumberOfLine = 10 | |||||
end subroutine | |||||
subroutine HoistingToJson(parent) | |||||
type(json_value),pointer :: parent | |||||
type(json_core) :: json | |||||
type(json_value),pointer :: p | |||||
! 1. create new node | |||||
call json%create_object(p,'Hoisting') | |||||
! 2. add member of data type to new node | |||||
! call StringConfigurationToJson(p) | |||||
! call FormationToJson(p) | |||||
call json%add(p,"DrillingLineBreakingLoad",data%Configuration%Hoisting%DrillingLineBreakingLoad) | |||||
call json%add(p,"DriveType",data%Configuration%Hoisting%DriveType) | |||||
call json%add(p,"KellyWeight",data%Configuration%Hoisting%KellyWeight) | |||||
call json%add(p,"NumberOfLine",data%Configuration%Hoisting%NumberOfLine) | |||||
call json%add(p,"TopDriveWeight",data%Configuration%Hoisting%TopDriveWeight) | |||||
call json%add(p,"TravelingBlockWeight",data%Configuration%Hoisting%TravelingBlockWeight) | |||||
! 3. add new node to parent | |||||
call json%add(parent,p) | |||||
end subroutine | |||||
end module CHoisting |
@@ -1,4 +1,4 @@ | |||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeControlPanel.f90" | |||||
# 1 "/home/admin/SimulationCore2/CSharp/Equipments/ControlPanels/CChokeControlPanel.f90" | |||||
module CChokeControlPanel | module CChokeControlPanel | ||||
use CChokeControlPanelVariables | use CChokeControlPanelVariables | ||||
use SimulationVariables | use SimulationVariables | ||||
@@ -14,26 +14,6 @@ module CDataDisplayConsole | |||||
call json%get(parent,'DataDisplay',p) | call json%get(parent,'DataDisplay',p) | ||||
! 2. get member of data type from node | ! 2. get member of data type from node | ||||
! call json%get(p,'TripAlarmLow',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripAlarmLow) | |||||
! call json%get(p,'TripAlarmHigh',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripAlarmHigh) | |||||
! call json%get(p,'RetFlowAlarmLow',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RetFlowAlarmLow) | |||||
! call json%get(p,'RetFlowAlarmHigh',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RetFlowAlarmHigh) | |||||
! call json%get(p,'PitAlarmLow',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PitAlarmLow) | |||||
! call json%get(p,'PitAlarmHigh',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PitAlarmHigh) | |||||
! call json%get(p,'PortWeightOnBit',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortWeightOnBit) | |||||
! call json%get(p,'PortHookLoad',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortHookLoad) | |||||
! call json%get(p,'PortCasingPressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortCasingPressure) | |||||
! call json%get(p,'PortPumpPressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortPumpPressure) | |||||
call json%get(p,'TripTankSetAlarmLow',pval) | call json%get(p,'TripTankSetAlarmLow',pval) | ||||
call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) | call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) | ||||
call json%get(p,'TripTankSetAlarmHigh',pval) | call json%get(p,'TripTankSetAlarmHigh',pval) | ||||
@@ -97,85 +77,6 @@ module CDataDisplayConsole | |||||
call json%get(p,'ResetWob',pval) | call json%get(p,'ResetWob',pval) | ||||
call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob) | call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob) | ||||
call json%get(p,'Clutch',pval) | call json%get(p,'Clutch',pval) | ||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Clutch) | |||||
! call json%get(p,'WOBPointer',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%WOBPointer) | |||||
! call json%get(p,'HookLoadPointer',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%HookLoadPointer) | |||||
! call json%get(p,'TripTankGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripTankGauge) | |||||
! call json%get(p,'TripTankAlarmLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripTankAlarmLED) | |||||
! call json%get(p,'TripTankPumpLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripTankPumpLED) | |||||
! call json%get(p,'StandPipePressureGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%StandPipePressureGauge) | |||||
! call json%get(p,'CasingPressureGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%CasingPressureGauge) | |||||
! call json%get(p,'MP1SPMGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP1SPMGauge) | |||||
! call json%get(p,'MP2SPMGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP2SPMGauge) | |||||
! call json%get(p,'ReturnLineTempGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%ReturnLineTempGauge) | |||||
! call json%get(p,'RotaryTorqueGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RotaryTorqueGauge) | |||||
! call json%get(p,'RotaryRPMGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RotaryRPMGauge) | |||||
! call json%get(p,'AcidGasDetectionLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%AcidGasDetectionLED) | |||||
! call json%get(p,'TotalStrokeCounter',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TotalStrokeCounter) | |||||
! call json%get(p,'PitGainLossGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PitGainLossGauge) | |||||
! call json%get(p,'MudTanksVolumeGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MudTanksVolumeGauge) | |||||
! call json%get(p,'MVTAlarmLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MVTAlarmLED) | |||||
! call json%get(p,'ReturnMudFlowGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%ReturnMudFlowGauge) | |||||
! call json%get(p,'FillStrokeCounter',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%FillStrokeCounter) | |||||
! call json%get(p,'MFFITotalStrokeCounter',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MFFITotalStrokeCounter) | |||||
! call json%get(p,'MFFIAlarmLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MFFIAlarmLED) | |||||
! call json%get(p,'MFFIPumpLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MFFIPumpLED) | |||||
! call json%get(p,'TotalWellDepth',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TotalWellDepth) | |||||
! call json%get(p,'BitDepth',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%BitDepth) | |||||
! call json%get(p,'HookLoad',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%HookLoad) | |||||
! call json%get(p,'StandPipePressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%StandPipePressure) | |||||
! call json%get(p,'CasingPressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%CasingPressure) | |||||
! call json%get(p,'MP1SPM',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP1SPM) | |||||
! call json%get(p,'MP2SPM',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP2SPM) | |||||
! call json%get(p,'RTTorque',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RTTorque) | |||||
! call json%get(p,'RTRPM',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RTRPM) | |||||
! call json%get(p,'WOP',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%WOP) | |||||
! call json%get(p,'ROP',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%ROP) | |||||
! call json%get(p,'MudWeightIn',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MudWeightIn) | |||||
! call json%get(p,'MudWeightOut',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MudWeightOut) | |||||
! call json%get(p,'Buzzer1',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer1) | |||||
! call json%get(p,'Buzzer2',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer2) | |||||
! call json%get(p,'Buzzer3',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer3) | |||||
! call json%get(p,'Buzzer4',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer4) | |||||
end subroutine | end subroutine | ||||
subroutine DataDisplayConsoleToJson(parent) | subroutine DataDisplayConsoleToJson(parent) | ||||
@@ -186,49 +87,6 @@ module CDataDisplayConsole | |||||
! 1. create new node | ! 1. create new node | ||||
call json%create_object(p,'DataDisplay') | call json%create_object(p,'DataDisplay') | ||||
! call json%add(p,"TripAlarmLow",data%Equipments%DataDisplayConsole%TripAlarmLow) | |||||
! call json%add(p,"TripAlarmHigh",data%Equipments%DataDisplayConsole%TripAlarmHigh) | |||||
! call json%add(p,"RetFlowAlarmLow",data%Equipments%DataDisplayConsole%RetFlowAlarmLow) | |||||
! call json%add(p,"RetFlowAlarmHigh",data%Equipments%DataDisplayConsole%RetFlowAlarmHigh) | |||||
! call json%add(p,"PitAlarmLow",data%Equipments%DataDisplayConsole%PitAlarmLow) | |||||
! call json%add(p,"PitAlarmHigh",data%Equipments%DataDisplayConsole%PitAlarmHigh) | |||||
! call json%add(p,"PortWeightOnBit",data%Equipments%DataDisplayConsole%PortWeightOnBit) | |||||
! call json%add(p,"PortHookLoad",data%Equipments%DataDisplayConsole%PortHookLoad) | |||||
! call json%add(p,"PortCasingPressure",data%Equipments%DataDisplayConsole%PortCasingPressure) | |||||
! call json%add(p,"PortPumpPressure",data%Equipments%DataDisplayConsole%PortPumpPressure) | |||||
! call json%add(p,"TripTankSetAlarmLow",data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) | |||||
! call json%add(p,"TripTankSetAlarmHigh",data%Equipments%DataDisplayConsole%TripTankSetAlarmHigh) | |||||
! call json%add(p,"TripTankSetAlarmSwitch",data%Equipments%DataDisplayConsole%TripTankSetAlarmSwitch) | |||||
! call json%add(p,"TripTankPowerSwitch",data%Equipments%DataDisplayConsole%TripTankPowerSwitch) | |||||
! call json%add(p,"TripTankPumpSwitch",data%Equipments%DataDisplayConsole%TripTankPumpSwitch) | |||||
! call json%add(p,"TripTankHornSwitch",data%Equipments%DataDisplayConsole%TripTankHornSwitch) | |||||
! call json%add(p,"AcidGasDetectionHornSwitch",data%Equipments%DataDisplayConsole%AcidGasDetectionHornSwitch) | |||||
! call json%add(p,"TotalStrokeCounterResetSwitch",data%Equipments%DataDisplayConsole%TotalStrokeCounterResetSwitch) | |||||
! call json%add(p,"DrillingTrippingSelectorSwitch",data%Equipments%DataDisplayConsole%DrillingTrippingSelectorSwitch) | |||||
! call json%add(p,"MVTSetAlarmLowKnob",data%Equipments%DataDisplayConsole%MVTSetAlarmLowKnob) | |||||
! call json%add(p,"MVTSetAlarmHighKnob",data%Equipments%DataDisplayConsole%MVTSetAlarmHighKnob) | |||||
! call json%add(p,"MVTSetAlarmSwitch",data%Equipments%DataDisplayConsole%MVTSetAlarmSwitch) | |||||
! call json%add(p,"MudTank1Switch",data%Equipments%DataDisplayConsole%MudTank1Switch) | |||||
! call json%add(p,"MudTank2Switch",data%Equipments%DataDisplayConsole%MudTank2Switch) | |||||
! call json%add(p,"MudTank3Switch",data%Equipments%DataDisplayConsole%MudTank3Switch) | |||||
! call json%add(p,"MudTank4Switch",data%Equipments%DataDisplayConsole%MudTank4Switch) | |||||
! call json%add(p,"MVTFineKnob",data%Equipments%DataDisplayConsole%MVTFineKnob) | |||||
! call json%add(p,"MVTCoarseKnob",data%Equipments%DataDisplayConsole%MVTCoarseKnob) | |||||
! call json%add(p,"MVTHornSwitch",data%Equipments%DataDisplayConsole%MVTHornSwitch) | |||||
! call json%add(p,"MVTDeviationTripSelectionSwitch",data%Equipments%DataDisplayConsole%MVTDeviationTripSelectionSwitch) | |||||
! call json%add(p,"MVTPowerSwitch",data%Equipments%DataDisplayConsole%MVTPowerSwitch) | |||||
! call json%add(p,"MFFIResetTotalStrokes",data%Equipments%DataDisplayConsole%MFFIResetTotalStrokes) | |||||
! call json%add(p,"MFFIResetFillCounter",data%Equipments%DataDisplayConsole%MFFIResetFillCounter) | |||||
! call json%add(p,"MFFIPumpSelectorSwitch",data%Equipments%DataDisplayConsole%MFFIPumpSelectorSwitch) | |||||
! call json%add(p,"MFFIFillSPMSelectorSwitch",data%Equipments%DataDisplayConsole%MFFIFillSPMSelectorSwitch) | |||||
! call json%add(p,"MFFISetAlarmLowKnob",data%Equipments%DataDisplayConsole%MFFISetAlarmLowKnob) | |||||
! call json%add(p,"MFFISetAlarmHighKnob",data%Equipments%DataDisplayConsole%MFFISetAlarmHighKnob) | |||||
! call json%add(p,"MFFISetAlarmSwitch",data%Equipments%DataDisplayConsole%MFFISetAlarmSwitch) | |||||
! call json%add(p,"MFFIPowerSwitch",data%Equipments%DataDisplayConsole%MFFIPowerSwitch) | |||||
! call json%add(p,"MFFIHornSwitch",data%Equipments%DataDisplayConsole%MFFIHornSwitch) | |||||
! call json%add(p,"ResetWob",data%Equipments%DataDisplayConsole%ResetWob) | |||||
! call json%add(p,"Clutch",data%Equipments%DataDisplayConsole%Clutch) | |||||
call json%add(p,"WOBPointer",data%Equipments%DataDisplayConsole%WOBPointer) | call json%add(p,"WOBPointer",data%Equipments%DataDisplayConsole%WOBPointer) | ||||
call json%add(p,"HookLoadPointer",data%Equipments%DataDisplayConsole%HookLoadPointer) | call json%add(p,"HookLoadPointer",data%Equipments%DataDisplayConsole%HookLoadPointer) | ||||
@@ -253,7 +111,6 @@ module CDataDisplayConsole | |||||
call json%add(p,"MFFIAlarmLED",data%Equipments%DataDisplayConsole%MFFIAlarmLED) | call json%add(p,"MFFIAlarmLED",data%Equipments%DataDisplayConsole%MFFIAlarmLED) | ||||
call json%add(p,"MFFIPumpLED",data%Equipments%DataDisplayConsole%MFFIPumpLED) | call json%add(p,"MFFIPumpLED",data%Equipments%DataDisplayConsole%MFFIPumpLED) | ||||
call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) | call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) | ||||
! call json%add(p,"TotalWellDepth",1000) | |||||
call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) | call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) | ||||
call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) | call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) | ||||
call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) | call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) | ||||
@@ -277,8 +134,6 @@ module CDataDisplayConsole | |||||
subroutine Set_TotalDepth(v) | subroutine Set_TotalDepth(v) | ||||
use SimulationVariables !@!!, only: data%Equipments%DrillingWatch%Depth | |||||
! use CSimulationVariables, only: SetDistanceDrilled | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
! print *,"total depth = ",v | ! print *,"total depth = ",v | ||||
@@ -288,7 +143,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_BitPosition(v) | subroutine Set_BitPosition(v) | ||||
use SimulationVariables !@!!, only: data%Equipments%DrillingWatch%BitPosition | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%BitDepth = v | data%Equipments%DataDisplayConsole%BitDepth = v | ||||
@@ -296,7 +150,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_RotaryTorque(v) | subroutine Set_RotaryTorque(v) | ||||
use SimulationVariables !@!!, only: data%Equipments%DrillingWatch%Torque | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%RotaryTorqueGauge = v | data%Equipments%DataDisplayConsole%RotaryTorqueGauge = v | ||||
@@ -306,7 +159,7 @@ module CDataDisplayConsole | |||||
subroutine Set_MudWeightIn(v) | subroutine Set_MudWeightIn(v) | ||||
use SimulationVariables !@!, only: MudWeightInDw => data%Equipments%DataDisplayConsole%MudWeightIn | |||||
use SimulationVariables | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%MudWeightIn = v | data%Equipments%DataDisplayConsole%MudWeightIn = v | ||||
@@ -354,7 +207,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_ROP(v) | subroutine Set_ROP(v) | ||||
use SimulationVariables !@!, only: ROPDw => data%Equipments%DataDisplayConsole%ROP | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%ROP = v | data%Equipments%DataDisplayConsole%ROP = v | ||||
@@ -362,9 +214,7 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_CasingPressure(v) | subroutine Set_CasingPressure(v) | ||||
use SimulationVariables !@!, only: CasingPressureDw => CasingPressure | |||||
use CChokeControlPanelVariables | |||||
use SimulationVariables!, only: CasingPressureChoke => CasingPressure | |||||
! use CChokeControlPanelVariables | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%CasingPressureGauge = v | data%Equipments%DataDisplayConsole%CasingPressureGauge = v | ||||
@@ -374,9 +224,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_StandPipePressure(v) | subroutine Set_StandPipePressure(v) | ||||
use SimulationVariables !@!, only: data%Equipments%DrillingWatch%PumpPressure | |||||
use CChokeControlPanelVariables | |||||
use SimulationVariables!, only: StandPipePressureChoke => data%Equipments%DataDisplayConsole%StandPipePressure | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%StandPipePressureGauge = v | data%Equipments%DataDisplayConsole%StandPipePressureGauge = v | ||||
@@ -390,7 +237,6 @@ module CDataDisplayConsole | |||||
subroutine Set_RotaryRPMGauge(v) | subroutine Set_RotaryRPMGauge(v) | ||||
use SimulationVariables !@!, only: data%Equipments%DrillingWatch%RPM | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%RotaryRPMGauge = v | data%Equipments%DataDisplayConsole%RotaryRPMGauge = v | ||||
@@ -408,9 +254,9 @@ module CDataDisplayConsole | |||||
data%Equipments%DataDisplayConsole%MP1SPMGauge = v | data%Equipments%DataDisplayConsole%MP1SPMGauge = v | ||||
data%Equipments%DataDisplayConsole%MP1SPM = v | data%Equipments%DataDisplayConsole%MP1SPM = v | ||||
!@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | ||||
#ifdef deb | |||||
print*, 'MP1SPMGauge=', data%Equipments%DataDisplayConsole%MP1SPMGauge | |||||
#endif | |||||
#ifdef deb | |||||
print*, 'MP1SPMGauge=', data%Equipments%DataDisplayConsole%MP1SPMGauge | |||||
#endif | |||||
end subroutine | end subroutine | ||||
subroutine Set_MP2SPMGauge(v) | subroutine Set_MP2SPMGauge(v) | ||||
@@ -419,8 +265,8 @@ module CDataDisplayConsole | |||||
data%Equipments%DataDisplayConsole%MP2SPMGauge = v | data%Equipments%DataDisplayConsole%MP2SPMGauge = v | ||||
data%Equipments%DataDisplayConsole%MP2SPM = v | data%Equipments%DataDisplayConsole%MP2SPM = v | ||||
!@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | ||||
#ifdef deb | |||||
print*, 'MP2SPMGauge=', data%Equipments%DataDisplayConsole%MP2SPMGauge | |||||
#endif | |||||
#ifdef deb | |||||
print*, 'MP2SPMGauge=', data%Equipments%DataDisplayConsole%MP2SPMGauge | |||||
#endif | |||||
end subroutine | end subroutine | ||||
end module CDataDisplayConsole | end module CDataDisplayConsole |
@@ -15,26 +15,6 @@ module CDataDisplayConsole | |||||
call json%get(parent,'DataDisplay',p) | call json%get(parent,'DataDisplay',p) | ||||
! 2. get member of data type from node | ! 2. get member of data type from node | ||||
! call json%get(p,'TripAlarmLow',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripAlarmLow) | |||||
! call json%get(p,'TripAlarmHigh',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripAlarmHigh) | |||||
! call json%get(p,'RetFlowAlarmLow',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RetFlowAlarmLow) | |||||
! call json%get(p,'RetFlowAlarmHigh',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RetFlowAlarmHigh) | |||||
! call json%get(p,'PitAlarmLow',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PitAlarmLow) | |||||
! call json%get(p,'PitAlarmHigh',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PitAlarmHigh) | |||||
! call json%get(p,'PortWeightOnBit',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortWeightOnBit) | |||||
! call json%get(p,'PortHookLoad',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortHookLoad) | |||||
! call json%get(p,'PortCasingPressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortCasingPressure) | |||||
! call json%get(p,'PortPumpPressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PortPumpPressure) | |||||
call json%get(p,'TripTankSetAlarmLow',pval) | call json%get(p,'TripTankSetAlarmLow',pval) | ||||
call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) | call json%get(pval,data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) | ||||
call json%get(p,'TripTankSetAlarmHigh',pval) | call json%get(p,'TripTankSetAlarmHigh',pval) | ||||
@@ -98,85 +78,6 @@ module CDataDisplayConsole | |||||
call json%get(p,'ResetWob',pval) | call json%get(p,'ResetWob',pval) | ||||
call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob) | call json%get(pval,data%Equipments%DataDisplayConsole%ResetWob) | ||||
call json%get(p,'Clutch',pval) | call json%get(p,'Clutch',pval) | ||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Clutch) | |||||
! call json%get(p,'WOBPointer',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%WOBPointer) | |||||
! call json%get(p,'HookLoadPointer',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%HookLoadPointer) | |||||
! call json%get(p,'TripTankGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripTankGauge) | |||||
! call json%get(p,'TripTankAlarmLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripTankAlarmLED) | |||||
! call json%get(p,'TripTankPumpLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TripTankPumpLED) | |||||
! call json%get(p,'StandPipePressureGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%StandPipePressureGauge) | |||||
! call json%get(p,'CasingPressureGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%CasingPressureGauge) | |||||
! call json%get(p,'MP1SPMGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP1SPMGauge) | |||||
! call json%get(p,'MP2SPMGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP2SPMGauge) | |||||
! call json%get(p,'ReturnLineTempGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%ReturnLineTempGauge) | |||||
! call json%get(p,'RotaryTorqueGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RotaryTorqueGauge) | |||||
! call json%get(p,'RotaryRPMGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RotaryRPMGauge) | |||||
! call json%get(p,'AcidGasDetectionLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%AcidGasDetectionLED) | |||||
! call json%get(p,'TotalStrokeCounter',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TotalStrokeCounter) | |||||
! call json%get(p,'PitGainLossGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%PitGainLossGauge) | |||||
! call json%get(p,'MudTanksVolumeGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MudTanksVolumeGauge) | |||||
! call json%get(p,'MVTAlarmLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MVTAlarmLED) | |||||
! call json%get(p,'ReturnMudFlowGauge',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%ReturnMudFlowGauge) | |||||
! call json%get(p,'FillStrokeCounter',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%FillStrokeCounter) | |||||
! call json%get(p,'MFFITotalStrokeCounter',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MFFITotalStrokeCounter) | |||||
! call json%get(p,'MFFIAlarmLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MFFIAlarmLED) | |||||
! call json%get(p,'MFFIPumpLED',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MFFIPumpLED) | |||||
! call json%get(p,'TotalWellDepth',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%TotalWellDepth) | |||||
! call json%get(p,'BitDepth',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%BitDepth) | |||||
! call json%get(p,'HookLoad',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%HookLoad) | |||||
! call json%get(p,'StandPipePressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%StandPipePressure) | |||||
! call json%get(p,'CasingPressure',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%CasingPressure) | |||||
! call json%get(p,'MP1SPM',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP1SPM) | |||||
! call json%get(p,'MP2SPM',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MP2SPM) | |||||
! call json%get(p,'RTTorque',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RTTorque) | |||||
! call json%get(p,'RTRPM',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%RTRPM) | |||||
! call json%get(p,'WOP',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%WOP) | |||||
! call json%get(p,'ROP',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%ROP) | |||||
! call json%get(p,'MudWeightIn',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MudWeightIn) | |||||
! call json%get(p,'MudWeightOut',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%MudWeightOut) | |||||
! call json%get(p,'Buzzer1',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer1) | |||||
! call json%get(p,'Buzzer2',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer2) | |||||
! call json%get(p,'Buzzer3',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer3) | |||||
! call json%get(p,'Buzzer4',pval) | |||||
! call json%get(pval,data%Equipments%DataDisplayConsole%Buzzer4) | |||||
end subroutine | end subroutine | ||||
subroutine DataDisplayConsoleToJson(parent) | subroutine DataDisplayConsoleToJson(parent) | ||||
@@ -187,49 +88,6 @@ module CDataDisplayConsole | |||||
! 1. create new node | ! 1. create new node | ||||
call json%create_object(p,'DataDisplay') | call json%create_object(p,'DataDisplay') | ||||
! call json%add(p,"TripAlarmLow",data%Equipments%DataDisplayConsole%TripAlarmLow) | |||||
! call json%add(p,"TripAlarmHigh",data%Equipments%DataDisplayConsole%TripAlarmHigh) | |||||
! call json%add(p,"RetFlowAlarmLow",data%Equipments%DataDisplayConsole%RetFlowAlarmLow) | |||||
! call json%add(p,"RetFlowAlarmHigh",data%Equipments%DataDisplayConsole%RetFlowAlarmHigh) | |||||
! call json%add(p,"PitAlarmLow",data%Equipments%DataDisplayConsole%PitAlarmLow) | |||||
! call json%add(p,"PitAlarmHigh",data%Equipments%DataDisplayConsole%PitAlarmHigh) | |||||
! call json%add(p,"PortWeightOnBit",data%Equipments%DataDisplayConsole%PortWeightOnBit) | |||||
! call json%add(p,"PortHookLoad",data%Equipments%DataDisplayConsole%PortHookLoad) | |||||
! call json%add(p,"PortCasingPressure",data%Equipments%DataDisplayConsole%PortCasingPressure) | |||||
! call json%add(p,"PortPumpPressure",data%Equipments%DataDisplayConsole%PortPumpPressure) | |||||
! call json%add(p,"TripTankSetAlarmLow",data%Equipments%DataDisplayConsole%TripTankSetAlarmLow) | |||||
! call json%add(p,"TripTankSetAlarmHigh",data%Equipments%DataDisplayConsole%TripTankSetAlarmHigh) | |||||
! call json%add(p,"TripTankSetAlarmSwitch",data%Equipments%DataDisplayConsole%TripTankSetAlarmSwitch) | |||||
! call json%add(p,"TripTankPowerSwitch",data%Equipments%DataDisplayConsole%TripTankPowerSwitch) | |||||
! call json%add(p,"TripTankPumpSwitch",data%Equipments%DataDisplayConsole%TripTankPumpSwitch) | |||||
! call json%add(p,"TripTankHornSwitch",data%Equipments%DataDisplayConsole%TripTankHornSwitch) | |||||
! call json%add(p,"AcidGasDetectionHornSwitch",data%Equipments%DataDisplayConsole%AcidGasDetectionHornSwitch) | |||||
! call json%add(p,"TotalStrokeCounterResetSwitch",data%Equipments%DataDisplayConsole%TotalStrokeCounterResetSwitch) | |||||
! call json%add(p,"DrillingTrippingSelectorSwitch",data%Equipments%DataDisplayConsole%DrillingTrippingSelectorSwitch) | |||||
! call json%add(p,"MVTSetAlarmLowKnob",data%Equipments%DataDisplayConsole%MVTSetAlarmLowKnob) | |||||
! call json%add(p,"MVTSetAlarmHighKnob",data%Equipments%DataDisplayConsole%MVTSetAlarmHighKnob) | |||||
! call json%add(p,"MVTSetAlarmSwitch",data%Equipments%DataDisplayConsole%MVTSetAlarmSwitch) | |||||
! call json%add(p,"MudTank1Switch",data%Equipments%DataDisplayConsole%MudTank1Switch) | |||||
! call json%add(p,"MudTank2Switch",data%Equipments%DataDisplayConsole%MudTank2Switch) | |||||
! call json%add(p,"MudTank3Switch",data%Equipments%DataDisplayConsole%MudTank3Switch) | |||||
! call json%add(p,"MudTank4Switch",data%Equipments%DataDisplayConsole%MudTank4Switch) | |||||
! call json%add(p,"MVTFineKnob",data%Equipments%DataDisplayConsole%MVTFineKnob) | |||||
! call json%add(p,"MVTCoarseKnob",data%Equipments%DataDisplayConsole%MVTCoarseKnob) | |||||
! call json%add(p,"MVTHornSwitch",data%Equipments%DataDisplayConsole%MVTHornSwitch) | |||||
! call json%add(p,"MVTDeviationTripSelectionSwitch",data%Equipments%DataDisplayConsole%MVTDeviationTripSelectionSwitch) | |||||
! call json%add(p,"MVTPowerSwitch",data%Equipments%DataDisplayConsole%MVTPowerSwitch) | |||||
! call json%add(p,"MFFIResetTotalStrokes",data%Equipments%DataDisplayConsole%MFFIResetTotalStrokes) | |||||
! call json%add(p,"MFFIResetFillCounter",data%Equipments%DataDisplayConsole%MFFIResetFillCounter) | |||||
! call json%add(p,"MFFIPumpSelectorSwitch",data%Equipments%DataDisplayConsole%MFFIPumpSelectorSwitch) | |||||
! call json%add(p,"MFFIFillSPMSelectorSwitch",data%Equipments%DataDisplayConsole%MFFIFillSPMSelectorSwitch) | |||||
! call json%add(p,"MFFISetAlarmLowKnob",data%Equipments%DataDisplayConsole%MFFISetAlarmLowKnob) | |||||
! call json%add(p,"MFFISetAlarmHighKnob",data%Equipments%DataDisplayConsole%MFFISetAlarmHighKnob) | |||||
! call json%add(p,"MFFISetAlarmSwitch",data%Equipments%DataDisplayConsole%MFFISetAlarmSwitch) | |||||
! call json%add(p,"MFFIPowerSwitch",data%Equipments%DataDisplayConsole%MFFIPowerSwitch) | |||||
! call json%add(p,"MFFIHornSwitch",data%Equipments%DataDisplayConsole%MFFIHornSwitch) | |||||
! call json%add(p,"ResetWob",data%Equipments%DataDisplayConsole%ResetWob) | |||||
! call json%add(p,"Clutch",data%Equipments%DataDisplayConsole%Clutch) | |||||
call json%add(p,"WOBPointer",data%Equipments%DataDisplayConsole%WOBPointer) | call json%add(p,"WOBPointer",data%Equipments%DataDisplayConsole%WOBPointer) | ||||
call json%add(p,"HookLoadPointer",data%Equipments%DataDisplayConsole%HookLoadPointer) | call json%add(p,"HookLoadPointer",data%Equipments%DataDisplayConsole%HookLoadPointer) | ||||
@@ -254,7 +112,6 @@ module CDataDisplayConsole | |||||
call json%add(p,"MFFIAlarmLED",data%Equipments%DataDisplayConsole%MFFIAlarmLED) | call json%add(p,"MFFIAlarmLED",data%Equipments%DataDisplayConsole%MFFIAlarmLED) | ||||
call json%add(p,"MFFIPumpLED",data%Equipments%DataDisplayConsole%MFFIPumpLED) | call json%add(p,"MFFIPumpLED",data%Equipments%DataDisplayConsole%MFFIPumpLED) | ||||
call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) | call json%add(p,"TotalWellDepth",data%Equipments%DataDisplayConsole%TotalWellDepth) | ||||
! call json%add(p,"TotalWellDepth",1000) | |||||
call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) | call json%add(p,"BitDepth",data%Equipments%DataDisplayConsole%BitDepth) | ||||
call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) | call json%add(p,"HookLoad",data%Equipments%DataDisplayConsole%HookLoad) | ||||
call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) | call json%add(p,"StandPipePressure",data%Equipments%DataDisplayConsole%StandPipePressure) | ||||
@@ -278,8 +135,6 @@ module CDataDisplayConsole | |||||
subroutine Set_TotalDepth(v) | subroutine Set_TotalDepth(v) | ||||
use SimulationVariables !@!!, only: data%Equipments%DrillingWatch%Depth | |||||
! use CSimulationVariables, only: SetDistanceDrilled | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
! print *,"total depth = ",v | ! print *,"total depth = ",v | ||||
@@ -289,7 +144,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_BitPosition(v) | subroutine Set_BitPosition(v) | ||||
use SimulationVariables !@!!, only: data%Equipments%DrillingWatch%BitPosition | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%BitDepth = v | data%Equipments%DataDisplayConsole%BitDepth = v | ||||
@@ -297,7 +151,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_RotaryTorque(v) | subroutine Set_RotaryTorque(v) | ||||
use SimulationVariables !@!!, only: data%Equipments%DrillingWatch%Torque | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%RotaryTorqueGauge = v | data%Equipments%DataDisplayConsole%RotaryTorqueGauge = v | ||||
@@ -307,7 +160,7 @@ module CDataDisplayConsole | |||||
subroutine Set_MudWeightIn(v) | subroutine Set_MudWeightIn(v) | ||||
use SimulationVariables !@!, only: MudWeightInDw => data%Equipments%DataDisplayConsole%MudWeightIn | |||||
use SimulationVariables | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%MudWeightIn = v | data%Equipments%DataDisplayConsole%MudWeightIn = v | ||||
@@ -355,7 +208,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_ROP(v) | subroutine Set_ROP(v) | ||||
use SimulationVariables !@!, only: ROPDw => data%Equipments%DataDisplayConsole%ROP | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%ROP = v | data%Equipments%DataDisplayConsole%ROP = v | ||||
@@ -363,9 +215,7 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_CasingPressure(v) | subroutine Set_CasingPressure(v) | ||||
use SimulationVariables !@!, only: CasingPressureDw => CasingPressure | |||||
use CChokeControlPanelVariables | |||||
use SimulationVariables!, only: CasingPressureChoke => CasingPressure | |||||
! use CChokeControlPanelVariables | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%CasingPressureGauge = v | data%Equipments%DataDisplayConsole%CasingPressureGauge = v | ||||
@@ -375,9 +225,6 @@ module CDataDisplayConsole | |||||
end subroutine | end subroutine | ||||
subroutine Set_StandPipePressure(v) | subroutine Set_StandPipePressure(v) | ||||
use SimulationVariables !@!, only: data%Equipments%DrillingWatch%PumpPressure | |||||
use CChokeControlPanelVariables | |||||
use SimulationVariables!, only: StandPipePressureChoke => data%Equipments%DataDisplayConsole%StandPipePressure | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%StandPipePressureGauge = v | data%Equipments%DataDisplayConsole%StandPipePressureGauge = v | ||||
@@ -391,7 +238,6 @@ module CDataDisplayConsole | |||||
subroutine Set_RotaryRPMGauge(v) | subroutine Set_RotaryRPMGauge(v) | ||||
use SimulationVariables !@!, only: data%Equipments%DrillingWatch%RPM | |||||
implicit none | implicit none | ||||
real(8), intent(in) :: v | real(8), intent(in) :: v | ||||
data%Equipments%DataDisplayConsole%RotaryRPMGauge = v | data%Equipments%DataDisplayConsole%RotaryRPMGauge = v | ||||
@@ -409,8 +255,9 @@ module CDataDisplayConsole | |||||
data%Equipments%DataDisplayConsole%MP1SPMGauge = v | data%Equipments%DataDisplayConsole%MP1SPMGauge = v | ||||
data%Equipments%DataDisplayConsole%MP1SPM = v | data%Equipments%DataDisplayConsole%MP1SPM = v | ||||
!@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | ||||
# 413 | |||||
#ifdef deb | |||||
print*, 'MP1SPMGauge=', data%Equipments%DataDisplayConsole%MP1SPMGauge | |||||
#endif | |||||
end subroutine | end subroutine | ||||
subroutine Set_MP2SPMGauge(v) | subroutine Set_MP2SPMGauge(v) | ||||
@@ -419,7 +266,8 @@ module CDataDisplayConsole | |||||
data%Equipments%DataDisplayConsole%MP2SPMGauge = v | data%Equipments%DataDisplayConsole%MP2SPMGauge = v | ||||
data%Equipments%DataDisplayConsole%MP2SPM = v | data%Equipments%DataDisplayConsole%MP2SPM = v | ||||
!@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%Equipments%DataDisplayConsole%MP1SPMGauge, data%Equipments%DataDisplayConsole%MP2SPMGauge) | ||||
# 424 | |||||
#ifdef deb | |||||
print*, 'MP2SPMGauge=', data%Equipments%DataDisplayConsole%MP2SPMGauge | |||||
#endif | |||||
end subroutine | end subroutine | ||||
end module CDataDisplayConsole | end module CDataDisplayConsole |
@@ -16,6 +16,7 @@ module CDrillingConsole | |||||
type(json_value),pointer :: p,pval | type(json_value),pointer :: p,pval | ||||
type(json_file)::jsonfile | type(json_file)::jsonfile | ||||
logical::found | logical::found | ||||
integer :: i | |||||
call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) | call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) | ||||
if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") | if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") | ||||
@@ -44,15 +45,20 @@ module CDrillingConsole | |||||
call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) | call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) | ||||
if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") | if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") | ||||
call jsonfile%get('Equipments.Drilling.MP2Throttle',data%Equipments%DrillingConsole%MP2Throttle,found) | call jsonfile%get('Equipments.Drilling.MP2Throttle',data%Equipments%DrillingConsole%MP2Throttle,found) | ||||
if ( .not. found ) call logg(4,"Not found: MP2Throttle") | |||||
! call jsonfile%get('Equipments.Drilling.DWSwitch',data%Equipments%DrillingConsole%DWSwitch,found) | |||||
if ( .not. found ) then | |||||
call logg(4,"Not found: MP2Throttle") | |||||
endif | |||||
! call jsonfile%get('Equipments.Drilling.DWSwitch',data%Equipments%DrillingConsole%DWSwitch,found) | |||||
! if ( .not. found ) call logg(4,"Not found: DWSwitch") | ! if ( .not. found ) call logg(4,"Not found: DWSwitch") | ||||
call jsonfile%get('Equipments.Drilling.DWThrottle',data%Equipments%DrillingConsole%DWThrottle,found) | call jsonfile%get('Equipments.Drilling.DWThrottle',data%Equipments%DrillingConsole%DWThrottle,found) | ||||
if ( .not. found ) call logg(4,"Not found: DWThrottle") | if ( .not. found ) call logg(4,"Not found: DWThrottle") | ||||
call jsonfile%get('Equipments.Drilling.RTSwitch',data%Equipments%DrillingConsole%RTSwitch,found) | call jsonfile%get('Equipments.Drilling.RTSwitch',data%Equipments%DrillingConsole%RTSwitch,found) | ||||
if ( .not. found ) call logg(4,"Not found: RTSwitch") | if ( .not. found ) call logg(4,"Not found: RTSwitch") | ||||
call jsonfile%get('Equipments.Drilling.RTThrottle',data%Equipments%DrillingConsole%RTThrottle,found) | |||||
if ( .not. found ) call logg(4,"Not found: RTThrottle") | |||||
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) | call jsonfile%get('Equipments.Drilling.DWBreak',data%Equipments%DrillingConsole%DWBreak,found) | ||||
if ( .not. found ) call logg(4,"Not found: DWBreak") | if ( .not. found ) call logg(4,"Not found: DWBreak") | ||||
call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) | call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) | ||||
@@ -124,6 +130,8 @@ module CDrillingConsole | |||||
call jsonfile%get('Equipments.Drilling.ParkingBrakeBtn',data%Equipments%DrillingConsole%ParkingBrakeBtn,found) | 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: ParkingBrakeBtn") | ||||
! call jsonfile%destroy() | |||||
data%Equipments%DrillingConsole%DWSwitch = -1 | data%Equipments%DrillingConsole%DWSwitch = -1 | ||||
data%Equipments%DrillingConsole%AssignmentSwitch = 1 | data%Equipments%DrillingConsole%AssignmentSwitch = 1 | ||||
data%Equipments%DrillingConsole%MP1CPSwitch = -1 | data%Equipments%DrillingConsole%MP1CPSwitch = -1 | ||||
@@ -17,6 +17,7 @@ module CDrillingConsole | |||||
type(json_value),pointer :: p,pval | type(json_value),pointer :: p,pval | ||||
type(json_file)::jsonfile | type(json_file)::jsonfile | ||||
logical::found | logical::found | ||||
integer :: i | |||||
call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) | call jsonfile%get('Equipments.Drilling.AssignmentSwitch',data%Equipments%DrillingConsole%AssignmentSwitch,found) | ||||
if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") | if ( .not. found ) call logg(4,"Not found: AssignmentSwitch") | ||||
@@ -45,15 +46,20 @@ module CDrillingConsole | |||||
call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) | call jsonfile%get('Equipments.Drilling.MP2ThrottleUpdate',data%Equipments%DrillingConsole%MP2ThrottleUpdate,found) | ||||
if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") | if ( .not. found ) call logg(4,"Not found: MP2ThrottleUpdate") | ||||
call jsonfile%get('Equipments.Drilling.MP2Throttle',data%Equipments%DrillingConsole%MP2Throttle,found) | call jsonfile%get('Equipments.Drilling.MP2Throttle',data%Equipments%DrillingConsole%MP2Throttle,found) | ||||
if ( .not. found ) call logg(4,"Not found: MP2Throttle") | |||||
if ( .not. found ) then | |||||
call logg(4,"Not found: MP2Throttle") | |||||
endif | |||||
! call jsonfile%get('Equipments.Drilling.DWSwitch',data%Equipments%DrillingConsole%DWSwitch,found) | ! call jsonfile%get('Equipments.Drilling.DWSwitch',data%Equipments%DrillingConsole%DWSwitch,found) | ||||
! if ( .not. found ) call logg(4,"Not found: DWSwitch") | ! if ( .not. found ) call logg(4,"Not found: DWSwitch") | ||||
call jsonfile%get('Equipments.Drilling.DWThrottle',data%Equipments%DrillingConsole%DWThrottle,found) | call jsonfile%get('Equipments.Drilling.DWThrottle',data%Equipments%DrillingConsole%DWThrottle,found) | ||||
if ( .not. found ) call logg(4,"Not found: DWThrottle") | if ( .not. found ) call logg(4,"Not found: DWThrottle") | ||||
call jsonfile%get('Equipments.Drilling.RTSwitch',data%Equipments%DrillingConsole%RTSwitch,found) | call jsonfile%get('Equipments.Drilling.RTSwitch',data%Equipments%DrillingConsole%RTSwitch,found) | ||||
if ( .not. found ) call logg(4,"Not found: RTSwitch") | if ( .not. found ) call logg(4,"Not found: RTSwitch") | ||||
call jsonfile%get('Equipments.Drilling.RTThrottle',data%Equipments%DrillingConsole%RTThrottle,found) | |||||
if ( .not. found ) call logg(4,"Not found: RTThrottle") | |||||
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) | call jsonfile%get('Equipments.Drilling.DWBreak',data%Equipments%DrillingConsole%DWBreak,found) | ||||
if ( .not. found ) call logg(4,"Not found: DWBreak") | if ( .not. found ) call logg(4,"Not found: DWBreak") | ||||
call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) | call jsonfile%get('Equipments.Drilling.PreviousDWBreak',data%Equipments%DrillingConsole%PreviousDWBreak,found) | ||||
@@ -125,6 +131,8 @@ module CDrillingConsole | |||||
call jsonfile%get('Equipments.Drilling.ParkingBrakeBtn',data%Equipments%DrillingConsole%ParkingBrakeBtn,found) | 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: ParkingBrakeBtn") | ||||
! call jsonfile%destroy() | |||||
data%Equipments%DrillingConsole%DWSwitch = -1 | data%Equipments%DrillingConsole%DWSwitch = -1 | ||||
data%Equipments%DrillingConsole%AssignmentSwitch = 1 | data%Equipments%DrillingConsole%AssignmentSwitch = 1 | ||||
data%Equipments%DrillingConsole%MP1CPSwitch = -1 | data%Equipments%DrillingConsole%MP1CPSwitch = -1 | ||||
@@ -0,0 +1,12 @@ | |||||
# 1 "/home/admin/SimulationCore2/CSharp/Equipments/ControlPanels/CEquipmentsConstants.f90" | |||||
module CEquipmentsConstants | |||||
implicit none | |||||
public | |||||
! LED State Types | |||||
integer :: LedOff = 0 | |||||
integer :: LedOn = 1 | |||||
integer :: LedBlinking = 2 | |||||
contains | |||||
end module CEquipmentsConstants |
@@ -1,4 +1,4 @@ | |||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/Notifications/CUnlatchLedNotification.f90" | |||||
# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/CUnlatchLedNotification.f90" | |||||
module CUnlatchLedNotification | module CUnlatchLedNotification | ||||
use OperationScenariosModule | use OperationScenariosModule | ||||
use UnityModule | use UnityModule | ||||
@@ -0,0 +1,92 @@ | |||||
# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Permissions/CIrIbopPermission.f90" | |||||
module CIrIbopPermission | |||||
use OperationScenariosModule | |||||
implicit none | |||||
contains | |||||
subroutine Evaluate_IrIbopPermission() | |||||
use TD_DrillStemComponents | |||||
use UnitySignalsModule !for CTdsConnectionModesEnum | |||||
use CStudentStationVariables!, only: data%State%StudentStation%FillupHeadInstallation | |||||
implicit none | |||||
if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then | |||||
# 16 | |||||
!TOPDRIVE-CODE=58 | |||||
if (GetRotaryRpm() == 0.0d0 .and.& | |||||
Get_NearFloorConnection() >= 3 .and. Get_NearFloorConnection() <= 10 .and.& | |||||
Get_JointConnectionPossible() == .false. .and.& | |||||
Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING .and.& | |||||
data%State%StudentStation%FillupHeadInstallation == .false.) then | |||||
call Set_IrIbopPermission(.true.) | |||||
return | |||||
end if | |||||
call Set_IrIbopPermission(.false.) | |||||
endif | |||||
if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then | |||||
# 46 | |||||
!OPERATION-CODE=62 | |||||
if (GetRotaryRpm() == 0.0d0 .and.& | |||||
Get_OperationCondition() == OPERATION_TRIP .and.& | |||||
!(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.& | |||||
data%State%TD_String%TopJointHeight >= 3.0 .and. data%State%TD_String%TopJointHeight <= 10.0 .and.& | |||||
!Get_IbopHeight() >= 22.0 .and. Get_IbopHeight() <= 35.0 .and.& | |||||
Get_JointConnectionPossible() == .false. .and.& | |||||
Get_Swing() == SWING_WELL_END .and.& | |||||
Get_FillupHead() == FILLUP_HEAD_REMOVE) then | |||||
call Set_IrIbopPermission(.true.) | |||||
return | |||||
end if | |||||
!if (Get_OperationCondition() == OPERATION_DRILL .and.& | |||||
! Get_IbopHeight() >= 1 .and. Get_IbopHeight() <= 8 .and.& | |||||
! Get_NearFloorConnection() >= 1 .and. Get_NearFloorConnection() <= 8 .and.& | |||||
! Get_JointConnectionPossible() == .false. .and.& | |||||
! Get_KellyConnection() /= KELLY_CONNECTION_STRING .and.& | |||||
! Get_Swing() == SWING_WELL_END .and.& | |||||
! Get_Slips() == SLIPS_SET_END) then | |||||
! call Set_IrIbopPermission(.true.) | |||||
! return | |||||
!end if | |||||
call Set_IrIbopPermission(.false.) | |||||
endif | |||||
end subroutine | |||||
subroutine Subscribe_IrIbopPermission() | |||||
implicit none | |||||
end subroutine | |||||
end module CIrIbopPermission |
@@ -1,4 +1,4 @@ | |||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/UnitySignals/UnitySignals.f90" | |||||
# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/UnitySignals.f90" | |||||
module UnitySignalsModule | module UnitySignalsModule | ||||
use UnitySignalVariables | use UnitySignalVariables | ||||
use SimulationVariables | use SimulationVariables | ||||
@@ -33,7 +33,8 @@ module UnitySignalVariables | |||||
enumerator TONG_BREAKOUT_END | enumerator TONG_BREAKOUT_END | ||||
enumerator TONG_MAKEUP_BEGIN | enumerator TONG_MAKEUP_BEGIN | ||||
enumerator TONG_MAKEUP_END | enumerator TONG_MAKEUP_END | ||||
end enum | |||||
enum, bind(c) | |||||
enumerator TDS_SWING_NEUTRAL | enumerator TDS_SWING_NEUTRAL | ||||
enumerator TDS_SWING_OFF_BEGIN | enumerator TDS_SWING_OFF_BEGIN | ||||
enumerator TDS_SWING_OFF_END | enumerator TDS_SWING_OFF_END | ||||
@@ -41,18 +42,21 @@ module UnitySignalVariables | |||||
enumerator TDS_SWING_DRILL_END | enumerator TDS_SWING_DRILL_END | ||||
enumerator TDS_SWING_TILT_BEGIN | enumerator TDS_SWING_TILT_BEGIN | ||||
enumerator TDS_SWING_TILT_END | enumerator TDS_SWING_TILT_END | ||||
end enum | |||||
enum, bind(c) | |||||
enumerator TDS_SPINE_NEUTRAL | enumerator TDS_SPINE_NEUTRAL | ||||
enumerator TDS_SPINE_CONNECT_BEGIN | enumerator TDS_SPINE_CONNECT_BEGIN | ||||
enumerator TDS_SPINE_CONNECT_END | enumerator TDS_SPINE_CONNECT_END | ||||
enumerator TDS_SPINE_DISCONNECT_BEGIN | enumerator TDS_SPINE_DISCONNECT_BEGIN | ||||
enumerator TDS_SPINE_DISCONNECT_END | enumerator TDS_SPINE_DISCONNECT_END | ||||
end enum | |||||
enum, bind(c) | |||||
enumerator BACKUP_CLAMP_OFF_END | enumerator BACKUP_CLAMP_OFF_END | ||||
enumerator BACKUP_CLAMP_OFF_BEGIN | enumerator BACKUP_CLAMP_OFF_BEGIN | ||||
enumerator BACKUP_CLAMP_FW_BEGIN | enumerator BACKUP_CLAMP_FW_BEGIN | ||||
enumerator BACKUP_CLAMP_FW_END | enumerator BACKUP_CLAMP_FW_END | ||||
end enum | |||||
enum, bind(c) | |||||
enumerator SWING_NEUTRAL | enumerator SWING_NEUTRAL | ||||
enumerator SWING_MOUSE_HOLE_BEGIN | enumerator SWING_MOUSE_HOLE_BEGIN | ||||
enumerator SWING_MOUSE_HOLE_END | enumerator SWING_MOUSE_HOLE_END | ||||
@@ -66,11 +70,11 @@ module UnitySignalVariables | |||||
enumerator TDS_TONG_BREAKOUT_BEGIN | enumerator TDS_TONG_BREAKOUT_BEGIN | ||||
enumerator TDS_TONG_MAKEUP_BEGIN | enumerator TDS_TONG_MAKEUP_BEGIN | ||||
enumerator TDS_TONG_MAKEUP_END | enumerator TDS_TONG_MAKEUP_END | ||||
end enum | |||||
enum, bind(c) | |||||
enumerator SAFETY_VALVE_NEUTRAL | enumerator SAFETY_VALVE_NEUTRAL | ||||
enumerator SAFETY_VALVE_REMOVE | enumerator SAFETY_VALVE_REMOVE | ||||
enumerator SAFETY_VALVE_INSTALL | enumerator SAFETY_VALVE_INSTALL | ||||
end enum | end enum | ||||
enum, bind(c) | enum, bind(c) | ||||
enumerator OPERATION_DRILL | enumerator OPERATION_DRILL | ||||
@@ -1,4 +1,4 @@ | |||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90" | |||||
# 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/UnitySignals/UnitySignalsVariables.f90" | |||||
module UnitySignalVariables | module UnitySignalVariables | ||||
! use CVoidEventHandlerCollection | ! use CVoidEventHandlerCollection | ||||
! use CIntegerEventHandlerCollection | ! use CIntegerEventHandlerCollection | ||||
@@ -0,0 +1,158 @@ | |||||
# 1 "/home/admin/SimulationCore2/Common/DynamicDoubleArray.f90" | |||||
module DynamicDoubleArray | |||||
implicit none | |||||
public | |||||
type, public :: DynamicDoubleArrayType | |||||
real(8), allocatable :: Array(:) | |||||
contains | |||||
procedure :: First => First | |||||
procedure :: Last => Last | |||||
procedure :: Length => Length | |||||
procedure :: Add => Add | |||||
procedure :: AddToFirst => AddToFirst | |||||
procedure :: AddTo => AddTo | |||||
procedure :: Remove => Remove | |||||
procedure :: Empty => Empty | |||||
end type DynamicDoubleArrayType | |||||
private::First,Last,Length | |||||
contains | |||||
real(8) function First(this) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(in) :: this | |||||
if(allocated(this%Array) .and. size(this%Array) > 0) then | |||||
First = this%Array(1) | |||||
return | |||||
end if | |||||
First = 0 | |||||
end function | |||||
real(8) function Last(this) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(in) :: this | |||||
if(allocated(this%Array) .and. size(this%Array) > 0) then | |||||
Last = this%Array(size(this%Array)) | |||||
return | |||||
end if | |||||
Last = 0 | |||||
end function | |||||
integer function Length(this) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(in) :: this | |||||
if(allocated(this%Array)) then | |||||
Length = size(this%Array) | |||||
return | |||||
end if | |||||
Length = 0 | |||||
end function | |||||
subroutine AddToFirst(this, value) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(inout) :: this | |||||
real(8), allocatable :: tempArr(:) | |||||
real(8), intent(in) :: value | |||||
integer :: i, isize | |||||
if(allocated(this%Array)) then | |||||
isize = size(this%Array) | |||||
allocate(tempArr(isize+1)) | |||||
tempArr(1) = value | |||||
do i=2,isize+1 | |||||
tempArr(i) = this%Array(i-1) | |||||
end do | |||||
deallocate(this%Array) | |||||
call move_alloc(tempArr, this%Array) | |||||
else | |||||
allocate(this%Array(1)) | |||||
this%Array(1) = value | |||||
end if | |||||
end subroutine | |||||
subroutine AddTo(this, index, value) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(inout) :: this | |||||
real(8), allocatable :: tempArr(:) | |||||
integer, intent(in) :: index | |||||
real(8), intent(in) :: value | |||||
integer :: isize | |||||
if(index <= 0) return | |||||
if(index > size(this%Array)) then | |||||
call this%Add(value) | |||||
return | |||||
endif | |||||
if(allocated(this%Array)) then | |||||
isize = size(this%Array) | |||||
allocate(tempArr(isize+1)) | |||||
tempArr(:index-1) = this%Array(:index-1) | |||||
tempArr(index) = value | |||||
tempArr(index+1:) = this%Array(index:) | |||||
deallocate(this%Array) | |||||
call move_alloc(tempArr, this%Array) | |||||
end if | |||||
end subroutine | |||||
subroutine Add(this, value) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(inout) :: this | |||||
real(8), allocatable :: tempArr(:) | |||||
real(8), intent(in) :: value | |||||
integer :: i, isize | |||||
if(allocated(this%Array)) then | |||||
isize = size(this%Array) | |||||
allocate(tempArr(isize+1)) | |||||
do i=1,isize | |||||
tempArr(i) = this%Array(i) | |||||
end do | |||||
tempArr(isize+1) = value | |||||
deallocate(this%Array) | |||||
call move_alloc(tempArr, this%Array) | |||||
else | |||||
allocate(this%Array(1)) | |||||
this%Array(1) = value | |||||
end if | |||||
end subroutine | |||||
subroutine Empty(this) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(inout) :: this | |||||
if(allocated(this%Array)) deallocate(this%Array) | |||||
end subroutine | |||||
subroutine Remove(this, index) | |||||
implicit none | |||||
class(DynamicDoubleArrayType), intent(inout) :: this | |||||
integer, intent(in) :: index | |||||
real(8), allocatable :: tempArr(:) | |||||
integer :: i | |||||
logical :: found | |||||
if(index <= 0 .or. index > size(this%Array)) return | |||||
if(.not.allocated(this%Array))return | |||||
allocate(tempArr(size(this%Array)-1)) | |||||
found = .false. | |||||
do i=1, size(this%Array) | |||||
if(i==index) then | |||||
found = .true. | |||||
cycle | |||||
end if | |||||
if(found) then | |||||
tempArr(i-1) = this%Array(i) | |||||
else | |||||
tempArr(i) = this%Array(i) | |||||
endif | |||||
end do | |||||
deallocate(this%Array) | |||||
call move_alloc(tempArr, this%Array) | |||||
end subroutine | |||||
end module DynamicDoubleArray |
@@ -1,4 +1,4 @@ | |||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" | |||||
!***************************************************************************************** | !***************************************************************************************** | ||||
!> author: Jacob Williams | !> author: Jacob Williams | ||||
! license: BSD | ! license: BSD | ||||
@@ -22,7 +22,7 @@ | |||||
private | private | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_macros.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_macros.inc" 1 | |||||
! JSON-Fortran preprocessor macros. | ! JSON-Fortran preprocessor macros. | ||||
! | ! | ||||
! License | ! License | ||||
@@ -60,7 +60,7 @@ | |||||
!********************************************************* | !********************************************************* | ||||
# 25 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 25 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
!********************************************************* | !********************************************************* | ||||
!> author: Jacob Williams | !> author: Jacob Williams | ||||
@@ -512,7 +512,7 @@ | |||||
! all have a similar interface. | ! all have a similar interface. | ||||
subroutine initialize_json_core_in_file(me,& | subroutine initialize_json_core_in_file(me,& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -538,13 +538,13 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 506 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 506 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) | ) | ||||
implicit none | implicit none | ||||
class(json_file),intent(inout) :: me | class(json_file),intent(inout) :: me | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
! The argument list for the various `initialize` subroutines. | ! The argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_dummy_arguments.inc | ! See also: json_initialize_dummy_arguments.inc | ||||
@@ -659,10 +659,10 @@ logical(LK),intent(in),optional :: strict_integer_type_checking | |||||
!! value cannot be read. | !! value cannot be read. | ||||
!! | !! | ||||
!! (default is true) | !! (default is true) | ||||
# 512 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 512 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
call me%core%initialize(& | call me%core%initialize(& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -688,7 +688,7 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 515 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 515 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) | ) | ||||
end subroutine initialize_json_core_in_file | end subroutine initialize_json_core_in_file | ||||
!***************************************************************************************** | !***************************************************************************************** | ||||
@@ -745,7 +745,7 @@ strict_integer_type_checking & | |||||
! all have a similar interface. | ! all have a similar interface. | ||||
function initialize_json_file(p,& | function initialize_json_file(p,& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -771,7 +771,7 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 572 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 572 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) result(file_object) | ) result(file_object) | ||||
implicit none | implicit none | ||||
@@ -780,7 +780,7 @@ strict_integer_type_checking & | |||||
type(json_value),pointer,optional :: p !! `json_value` object to cast | type(json_value),pointer,optional :: p !! `json_value` object to cast | ||||
!! as a `json_file` object. This | !! as a `json_file` object. This | ||||
!! will be nullified. | !! will be nullified. | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
! The argument list for the various `initialize` subroutines. | ! The argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_dummy_arguments.inc | ! See also: json_initialize_dummy_arguments.inc | ||||
@@ -895,10 +895,10 @@ logical(LK),intent(in),optional :: strict_integer_type_checking | |||||
!! value cannot be read. | !! value cannot be read. | ||||
!! | !! | ||||
!! (default is true) | !! (default is true) | ||||
# 581 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 581 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
call file_object%initialize(& | call file_object%initialize(& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -924,7 +924,7 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 584 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 584 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) | ) | ||||
if (present(p)) then | if (present(p)) then | ||||
@@ -981,7 +981,7 @@ strict_integer_type_checking & | |||||
! all have a similar interface. | ! all have a similar interface. | ||||
function initialize_json_file_from_string(str,& | function initialize_json_file_from_string(str,& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -1007,14 +1007,14 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 641 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 641 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) result(file_object) | ) result(file_object) | ||||
implicit none | implicit none | ||||
type(json_file) :: file_object | type(json_file) :: file_object | ||||
character(kind=CK,len=*),intent(in) :: str !! string to load JSON data from | character(kind=CK,len=*),intent(in) :: str !! string to load JSON data from | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
! The argument list for the various `initialize` subroutines. | ! The argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_dummy_arguments.inc | ! See also: json_initialize_dummy_arguments.inc | ||||
@@ -1129,10 +1129,10 @@ logical(LK),intent(in),optional :: strict_integer_type_checking | |||||
!! value cannot be read. | !! value cannot be read. | ||||
!! | !! | ||||
!! (default is true) | !! (default is true) | ||||
# 648 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 648 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
call file_object%initialize(& | call file_object%initialize(& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -1158,7 +1158,7 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 651 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 651 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) | ) | ||||
call file_object%deserialize(str) | call file_object%deserialize(str) | ||||
@@ -1170,7 +1170,7 @@ strict_integer_type_checking & | |||||
! Alternate version of [[initialize_json_file_from_string]], where "str" is kind=CDK. | ! Alternate version of [[initialize_json_file_from_string]], where "str" is kind=CDK. | ||||
function wrap_initialize_json_file_from_string(str,& | function wrap_initialize_json_file_from_string(str,& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -1196,14 +1196,14 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 663 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 663 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) result(file_object) | ) result(file_object) | ||||
implicit none | implicit none | ||||
type(json_file) :: file_object | type(json_file) :: file_object | ||||
character(kind=CDK,len=*),intent(in) :: str !! string to load JSON data from | character(kind=CDK,len=*),intent(in) :: str !! string to load JSON data from | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_arguments.inc" 1 | |||||
! The argument list for the various `initialize` subroutines. | ! The argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_dummy_arguments.inc | ! See also: json_initialize_dummy_arguments.inc | ||||
@@ -1318,11 +1318,11 @@ logical(LK),intent(in),optional :: strict_integer_type_checking | |||||
!! value cannot be read. | !! value cannot be read. | ||||
!! | !! | ||||
!! (default is true) | !! (default is true) | ||||
# 670 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 670 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
file_object = initialize_json_file_from_string(& | file_object = initialize_json_file_from_string(& | ||||
to_unicode(str),& | to_unicode(str),& | ||||
# 1 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
# 1 "/home/admin/SimulationCore2/Common/json-fortran/json_initialize_dummy_arguments.inc" 1 | |||||
! The dummy argument list for the various `initialize` subroutines. | ! The dummy argument list for the various `initialize` subroutines. | ||||
! | ! | ||||
! See also: json_initialize_argument.inc | ! See also: json_initialize_argument.inc | ||||
@@ -1348,7 +1348,7 @@ null_to_real_mode,& | |||||
non_normal_mode,& | non_normal_mode,& | ||||
use_quiet_nan, & | use_quiet_nan, & | ||||
strict_integer_type_checking & | strict_integer_type_checking & | ||||
# 674 "/mnt/c/Projects/VSIM/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
# 674 "/home/admin/SimulationCore2/Common/json-fortran/json_file_module.F90" 2 | |||||
) | ) | ||||
end function wrap_initialize_json_file_from_string | end function wrap_initialize_json_file_from_string | ||||
@@ -9,11 +9,6 @@ subroutine Drawworks_Direction | |||||
IMPLICIT NONE | IMPLICIT NONE | ||||
if (data%State%Drawworks%Switch==1) then !Up | if (data%State%Drawworks%Switch==1) then !Up | ||||
data%State%Drawworks%motion = +1 | 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_old_drum = data%State%Drawworks%w_drum !(pi*(data%State%Drawworks%N_old/data%State%Drawworks%Conv_Ratio)/30.d0) ? | ||||
@@ -0,0 +1,148 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_Direction.f90" | |||||
subroutine Drawworks_Direction | |||||
use CDrillingConsoleVariables | |||||
use SimulationVariables | |||||
use SimulationVariables | |||||
use CDataDisplayConsole | |||||
use SimulationVariables | |||||
use SimulationVariables !@ | |||||
IMPLICIT NONE | |||||
if (data%State%Drawworks%Switch==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%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%Conv_Ratio==1.d0) then | |||||
! | |||||
! | |||||
! IF (data%State%Drawworks%motion==+1) THEN | |||||
! Call Drawworks_Free_Traction_motor_Dir | |||||
! if (data%State%Drawworks%w_drum_Dir<=0.) then | |||||
! data%State%Drawworks%motion = 0 | |||||
! else | |||||
! data%State%Drawworks%motion = +1 | |||||
! Call Drawworks_Free_Traction_motor | |||||
! data%State%Drawworks%w = data%State%Drawworks%w_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%w_old = data%State%Drawworks%w_old_drum*data%State%Drawworks%Conv_Ratio | |||||
! end if | |||||
! ELSE | |||||
! if (((data%State%Drawworks%F_fastline*(data%State%Drawworks%Diameter/2.0d0))-(((data%State%Drawworks%Diameter/2.0d0)*data%State%Drawworks%BreakLoad)*(data%State%Drawworks%ManualBreak/100.0d0)))<=0.) then | |||||
! data%State%Drawworks%motion = 0 | |||||
! data%State%Drawworks%w_drum = 0.0d0 | |||||
! data%State%Drawworks%w_old_drum = 0.0d0 | |||||
! data%State%Drawworks%w = data%State%Drawworks%w_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%w_old = data%State%Drawworks%w_old_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height | |||||
! | |||||
! data%State%Drawworks%ia = 0. | |||||
! data%State%Drawworks%ia_old = 0. | |||||
! data%State%Drawworks%x = 0. | |||||
! data%State%Drawworks%x_old = 0. | |||||
! data%State%Drawworks%y = 0. | |||||
! data%State%Drawworks%y_old = 0. | |||||
! else | |||||
! data%State%Drawworks%motion = -1 | |||||
! Call Drawworks_Free_Traction_motor_dawn_motion | |||||
! data%State%Drawworks%w = data%State%Drawworks%w_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%w_old = data%State%Drawworks%w_old_drum*data%State%Drawworks%Conv_Ratio | |||||
! end if | |||||
! | |||||
! END IF | |||||
! | |||||
! | |||||
!else | |||||
! | |||||
! IF (data%State%Drawworks%motion==-1) THEN | |||||
! data%State%Drawworks%w = -data%State%Drawworks%w | |||||
! data%State%Drawworks%w_old = -data%State%Drawworks%w_old | |||||
! data%State%Drawworks%w_drum = -data%State%Drawworks%w_drum | |||||
! data%State%Drawworks%w_old_drum = -data%State%Drawworks%w_old_drum | |||||
! END IF | |||||
! Call Drawworks_Traction_motor_ClutchMode_Dir | |||||
! IF (data%State%Drawworks%w_Dir>0.d0) then | |||||
! | |||||
! data%State%Drawworks%motion = +1 | |||||
! Call Drawworks_Traction_motor_ClutchMode | |||||
! data%State%Drawworks%w_drum = data%State%Drawworks%w/data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%w_old_drum = data%State%Drawworks%w_old/data%State%Drawworks%Conv_Ratio | |||||
! ELSE | |||||
! data%State%Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(data%State%Drawworks%w/data%State%Drawworks%Conv_Ratio)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(data%State%Drawworks%w/data%State%Drawworks%Conv_Ratio)/pi))) !Lbf.ft | |||||
! if (data%State%Drawworks%EddyTorque>115000.) then | |||||
! data%State%Drawworks%EddyTorque = 115000.0d0 | |||||
! end if | |||||
! data%State%Drawworks%EddyTorque = 1.355817948*data%State%Drawworks%EddyTorque ![N.m] | |||||
! if ((data%State%Drawworks%F_fastline*(data%State%Drawworks%Diameter/2.0d0))>((((data%State%Drawworks%Diameter/2.0d0)*data%State%Drawworks%BreakLoad)*(data%State%Drawworks%ManualBreak/100.0d0))+(data%State%Drawworks%EddyTorque*(data%State%Drawworks%EddyBreak/100.0d0)))) then | |||||
! data%State%Drawworks%motion = -1 | |||||
! | |||||
! IF (data%State%Drawworks%w_drum<0.) THEN | |||||
! data%State%Drawworks%w = -data%State%Drawworks%w | |||||
! data%State%Drawworks%w_old = -data%State%Drawworks%w_old | |||||
! !data%State%Drawworks%w = 0. !??????????????? | |||||
! !data%State%Drawworks%w_old = 0. !??????????????? | |||||
! data%State%Drawworks%w_drum = -data%State%Drawworks%w_drum | |||||
! data%State%Drawworks%w_old_drum = -data%State%Drawworks%w_old_drum | |||||
! END IF | |||||
! | |||||
! data%State%Drawworks%Conv_Ratio = 1. | |||||
! Call Drawworks_Free_Traction_motor_dawn_motion | |||||
! data%State%Drawworks%w = data%State%Drawworks%w_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%w_old = data%State%Drawworks%w_old_drum*data%State%Drawworks%Conv_Ratio | |||||
! !data%State%Drawworks%w_drum = data%State%Drawworks%w/data%State%Drawworks%Conv_Ratio | |||||
! !data%State%Drawworks%w_old_drum = data%State%Drawworks%w_old/data%State%Drawworks%Conv_Ratio | |||||
! else | |||||
! data%State%Drawworks%motion = 0 | |||||
! data%State%Drawworks%w_drum = 0.0d0 | |||||
! data%State%Drawworks%w_old_drum = 0.0d0 | |||||
! data%State%Drawworks%w = data%State%Drawworks%w_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%w_old = data%State%Drawworks%w_old_drum*data%State%Drawworks%Conv_Ratio | |||||
! data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height | |||||
! | |||||
! data%State%Drawworks%ia = 0. | |||||
! data%State%Drawworks%ia_old = 0. | |||||
! data%State%Drawworks%x = 0. | |||||
! data%State%Drawworks%x_old = 0. | |||||
! data%State%Drawworks%y = 0. | |||||
! data%State%Drawworks%y_old = 0. | |||||
! end if | |||||
! | |||||
! END IF | |||||
! | |||||
!end if | |||||
!Call DWBrakeSound | |||||
end subroutine Drawworks_Direction |
@@ -0,0 +1,285 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_Solver.f90" | |||||
subroutine Drawworks_Solver | |||||
Use CUnityInputs | |||||
use UnitySignalVariables | |||||
use UnitySignalsModule | |||||
use SimulationVariables !@ | |||||
use OperationScenariosModule | |||||
use OperationScenariosModule !!CElevator... | |||||
use UnitySignalsModule | |||||
! Use CTdsElevatorModesEnumVariables | |||||
use OperationScenariosModule | |||||
IMPLICIT NONE | |||||
Integer :: j | |||||
Integer :: CrownCollision_Status , FloorCollision_Status , CrownWarning_Status , FloorWarning_Status | |||||
!>>>>>>>>>>>>>>>>>>>> Speed <<<<<<<<<<<<<<<<<<<<<<<< | |||||
data%State%Drawworks%N_Throtle = 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 | |||||
data%State%Drawworks%N_new = data%State%Drawworks%N_Throtle | |||||
!ELSE | |||||
! data%State%Drawworks%N_new = data%State%Drawworks%N_Accelarator | |||||
!END IF | |||||
!========================== Drawworks Rate limit ========================== | |||||
if (((data%State%Drawworks%N_new-data%State%Drawworks%N_old)/data%State%Drawworks%time_step)>data%State%Drawworks%RateChange) then | |||||
data%State%Drawworks%Speed =(data%State%Drawworks%RateChange*data%State%Drawworks%time_step)+data%State%Drawworks%N_old ![rpm] | |||||
else if (((data%State%Drawworks%N_old-data%State%Drawworks%N_new)/data%State%Drawworks%time_step)>data%State%Drawworks%RateChange) then | |||||
data%State%Drawworks%Speed = (-data%State%Drawworks%RateChange*data%State%Drawworks%time_step)+data%State%Drawworks%N_old | |||||
else | |||||
data%State%Drawworks%Speed = data%State%Drawworks%N_new | |||||
end if | |||||
!======================================================================= | |||||
!========================== Speed Correction ========================== | |||||
!===> SLIPS SET , No Motion | |||||
if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||||
data%State%Drawworks%Speed = 0.d0 | |||||
end if | |||||
if ( data%State%Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then | |||||
data%State%Drawworks%Speed = 0.d0 | |||||
end if | |||||
!===> Closed BOP Rams , No Motion | |||||
if ( data%State%Drawworks%ShearBopSituation==1 .and. (any(data%State%Drawworks%DrillModeCond==(/3,10,19,20,24/))) ) then | |||||
data%State%Drawworks%Speed = 0.d0 | |||||
end if | |||||
!======================================================================= | |||||
Call Drawworks_Direction | |||||
!==================================================== | |||||
! Collision & Warning | |||||
!==================================================== | |||||
if ( data%State%Drawworks%CrownCollision == .false. ) then | |||||
CrownCollision_Status = 0 | |||||
end if | |||||
if ( data%State%Drawworks%FloorCollision == .false. ) then | |||||
FloorCollision_Status = 0 | |||||
end if | |||||
!==================================================== | |||||
! Crown Collision (Max_Hook_Height) | |||||
!==================================================== | |||||
if ( ((3.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 | |||||
!==================================================== | |||||
! 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 | |||||
!==================================================== | |||||
! 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 | |||||
!==================================================== | |||||
! 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 | |||||
!==================================================== | |||||
! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion) | |||||
!==================================================== | |||||
if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. data%State%Drawworks%motion/=-1 ) then | |||||
Call DWFixModeMotion | |||||
return | |||||
end if | |||||
if ( data%State%Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. data%State%Drawworks%motion/=-1 ) then | |||||
Call DWFixModeMotion | |||||
return | |||||
end if | |||||
!==================================================== | |||||
! RAM & ToolJoint Collision (Top of RAM) | |||||
!==================================================== | |||||
Do j = 2,4 !startup problem ??????? | |||||
if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then | |||||
if ( ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)<=(data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))+data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)>data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))) .and. (data%State%Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDBOPElementNo(j)))) ) then | |||||
if ( data%State%Drawworks%motion==1 ) then | |||||
data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] | |||||
else | |||||
Call DWFixModeMotion | |||||
end if | |||||
return | |||||
end if | |||||
end if | |||||
End Do | |||||
!==================================================== | |||||
! RAM & ToolJoint Collision (Bottom of RAM) | |||||
!==================================================== | |||||
Do j = 2,4 | |||||
if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then | |||||
if ( ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness)>=(data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDBOPElementNo(j))-data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness)<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] | |||||
else | |||||
Call DWFixModeMotion | |||||
end if | |||||
return | |||||
end if | |||||
end if | |||||
End Do | |||||
!==================================================== | |||||
! TopDrive (TdsStemIn) | |||||
!==================================================== | |||||
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] | |||||
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%StringIsBottomOfWell = 1 | |||||
end if | |||||
Call DWFixModeMotion | |||||
return | |||||
else | |||||
data%State%Drawworks%StringIsBottomOfWell = 0 | |||||
end if | |||||
data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft] | |||||
data%State%Drawworks%HookHeight_graph_output = 0.1189d0*((3.280839895d0*data%State%Drawworks%Hook_Height)-28.d0)-2.6d0 ![ft] | |||||
end subroutine Drawworks_Solver |
@@ -0,0 +1,58 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_StartUp.f90" | |||||
subroutine Drawworks_StartUp | |||||
use CDrillingConsoleVariables | |||||
use SimulationVariables | |||||
use SimulationVariables | |||||
use CHoistingVariables | |||||
use SimulationVariables | |||||
use SimulationVariables !@ | |||||
!use CWarnings | |||||
IMPLICIT NONE | |||||
data%State%Drawworks%RateChange = 193.d0 ! [rpm/s?] !??????? motaghayere voroudi | |||||
!===> Hook Height | |||||
data%State%Drawworks%Hook_Height_ini = 75.0d0 ![ft] | |||||
data%State%Drawworks%Hook_Height_ini_graph_output = -1.54090d0 ![ft] | |||||
data%State%Drawworks%Hook_Height_inim = 0.3048d0*data%State%Drawworks%Hook_Height_ini ![m] | |||||
data%State%Drawworks%Hook_Height = data%State%Drawworks%Hook_Height_inim ![m] | |||||
data%State%Drawworks%Hook_Height_final = 75.d0 ![ft] | |||||
data%State%Drawworks%TDHookHeight = 75.d0 ![ft] | |||||
!===> Drum (Drawworks) Diameter | |||||
data%State%Drawworks%Diameter = 2.50d0 ![ft] | |||||
data%State%Drawworks%Diameter = 0.3048d0*data%State%Drawworks%Diameter ![m] | |||||
!===> Number of Line | |||||
data%State%Drawworks%NumberOfLine = data%Configuration%Hoisting%NumberOfLine | |||||
!===> Simulation time step | |||||
data%State%Drawworks%time_step = 0.10d0 ![s] | |||||
!===> Initial Values | |||||
data%State%Drawworks%w_drum = 0.d0 | |||||
data%State%Drawworks%w_old_drum = 0.d0 | |||||
data%State%Drawworks%motion = 0 | |||||
data%State%Drawworks%K_Throttle = 0 | |||||
data%State%Drawworks%StringIsBottomOfWell = 0 ! 1= string is at the bottom of the well | |||||
!data%State%Drawworks%CrownCollision = 0 | |||||
!data%State%Drawworks%FloorCollision = 0 | |||||
end subroutine Drawworks_StartUp |
@@ -0,0 +1,56 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_VARIABLES.f90" | |||||
MODULE Drawworks_VARIABLES | |||||
IMPLICIT NONE | |||||
PUBLIC | |||||
! REAL, PARAMETER :: pi=3.14159265 | |||||
!************************************************************************************************** | |||||
!**************** Define Drawworks Array **************************************************** | |||||
TYPE, PUBLIC :: Drawworks_Var | |||||
!***** Drawworks_VARIABLES ********************** | |||||
logical :: CrownCollision, FloorCollision | |||||
INTEGER :: AssignmentSwitch , K_Throttle , Switch | |||||
INTEGER :: MotorFaileMalf , ClutchEngageMalf , ClutchDisengageMalf | |||||
INTEGER :: motion, DriveType, ShearBopSituation, TDDrillStemComponentsNumbs | |||||
INTEGER :: DrillModeCond, StringIsBottomOfWell | |||||
INTEGER , Dimension(6) :: TDBOPElementNo | |||||
REAL :: Throttle, RateChange | |||||
REAL :: Diameter | |||||
REAL :: Hook_Height, Hook_Height_ini, Hook_Height_inim, Hook_Height_ini_graph_output, Hook_Height_final, max_Hook_Height, min_Hook_Height, HookHeight_graph_output | |||||
REAL :: N_Throtle, Conv_Ratio, NumberOfLine, Speed, N_new, N_old ! N[RPM] | |||||
REAL :: w_drum, w_old_drum ! w[rad/s] | |||||
REAL , Dimension(6) :: TDBOPHeight | |||||
REAL , Dimension(4) :: TDBOPRamDiam | |||||
REAL :: TDBOPThickness, TDDrillStemBottom, TDWellTotalLength, TDDlMax | |||||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsDownDepth | |||||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsTopDepth | |||||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsToolJointRange | |||||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsRtoolJoint | |||||
REAL :: TDHookHeight | |||||
REAL :: time_step | |||||
INTEGER :: BLWR ! 1=On , 0=Off | |||||
!************* Sound_VARIABLES ********************** | |||||
INTEGER :: SoundFw , SoundRev | |||||
Logical :: SoundBlower | |||||
Logical :: SoundFloorCollision , SoundCrownCollision | |||||
END TYPE Drawworks_Var | |||||
!*********************************************************************************************** | |||||
!**************************************************************************************************** | |||||
END MODULE Drawworks_VARIABLES |
@@ -0,0 +1,58 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump1_MainSolver.f90" | |||||
subroutine Pump1_MainSolver | |||||
use SimulationVariables | |||||
Implicit none | |||||
if (data%State%Pump(1)%Throttle<=0.d0) then | |||||
data%State%Pump(1)%K_throttle = 1 | |||||
end if | |||||
if((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%K_throttle==1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then | |||||
data%State%Pump(1)%SoundBlower = .true. | |||||
data%State%Pump(1)%BLWR = 1 | |||||
!========================== Pump 1 Rate limit ========================== | |||||
if (((data%State%Pump(1)%N_new-data%State%Pump(1)%N_old)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then | |||||
data%State%Pump(1)%Speed =(data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old ![RPM] | |||||
else if (((data%State%Pump(1)%N_old-data%State%Pump(1)%N_new)/data%State%Pump(1)%time_step)>data%State%Pump(1)%RateChange) then | |||||
data%State%Pump(1)%Speed = (-data%State%Pump(1)%RateChange*data%State%Pump(1)%time_step)+data%State%Pump(1)%N_old | |||||
else | |||||
data%State%Pump(1)%Speed = data%State%Pump(1)%N_new | |||||
end if | |||||
!======================================================================= | |||||
Call Pump_OnMode_Solver(1) | |||||
else | |||||
if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1)) then | |||||
data%State%Pump(1)%SoundBlower = .true. | |||||
else | |||||
data%State%Pump(1)%SoundBlower = .false. | |||||
end if | |||||
if ((any(data%State%Pump(1)%AssignmentSwitchh==(/1,2,3,4,9,10/))) .and. (data%State%Pump(1)%Switch==-1) .and. (data%State%Pump(1)%PowerFailMalf==0) .and. (data%State%Pump(1)%Failure==0)) then | |||||
data%State%Pump(1)%BLWR = 1 | |||||
else | |||||
data%State%Pump(1)%BLWR = 0 | |||||
end if | |||||
Call Pump_OffMode_Solver(1) | |||||
data%State%Pump(1)%K_throttle = 0 | |||||
end if | |||||
data%State%Pump(1)%N_old = data%State%Pump(1)%Speed | |||||
end subroutine Pump1_MainSolver |
@@ -0,0 +1,47 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pump_OffMode_Solver.f90" | |||||
subroutine Pump_OffMode_Solver(Pump_No) | |||||
use SimulationVariables | |||||
IMPLICIT NONE | |||||
INTEGER :: Pump_No | |||||
data%State%Pump(Pump_No)%N_new = 0.d0 | |||||
!========================== Pump Rate limit ========================== | |||||
if (((data%State%Pump(Pump_No)%N_new-data%State%Pump(Pump_No)%N_old)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then | |||||
data%State%Pump(Pump_No)%Speed =(data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old | |||||
else if (((data%State%Pump(Pump_No)%N_old-data%State%Pump(Pump_No)%N_new)/data%State%Pump(Pump_No)%time_step)>data%State%Pump(Pump_No)%RateChange) then | |||||
data%State%Pump(Pump_No)%Speed = (-data%State%Pump(Pump_No)%RateChange*data%State%Pump(Pump_No)%time_step)+data%State%Pump(Pump_No)%N_old | |||||
else | |||||
data%State%Pump(Pump_No)%Speed = data%State%Pump(Pump_No)%N_new | |||||
end if | |||||
!======================================================================= | |||||
data%State%Pump(Pump_No)%Flow_Rate = data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0*(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) ![gpm] | |||||
data%State%Pump(Pump_No)%HorsePower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%StandPipe_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] | |||||
!data%State%Pump(Pump_No)%Max_Horsepower = ((data%State%Pump(Pump_No)%Flow_Rate/0.01d0)*data%State%Pump(Pump_No)%Max_Pressure)/(168067.d0*data%State%Pump(Pump_No)%Mech_Efficiency) ![HHP] | |||||
data%State%Pump(Pump_No)%Max_Horsepower = (data%State%Pump(Pump_No)%Flow_Rate*data%State%Pump(Pump_No)%Max_Pressure)/(1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency) | |||||
if ( data%State%Pump(Pump_No)%StandPipe_Pressure>data%State%Pump(Pump_No)%Max_Pressure ) then ! in shart check shavad | |||||
!if ( (data%State%Pump(Pump_No)%StandPipe_Pressure*data%State%Pump(Pump_No)%Flow_Rate)>(1714.d0*data%State%Pump(Pump_No)%Max_Horsepower*data%State%Pump(Pump_No)%Mech_Efficiency) ) then | |||||
data%State%Pump(Pump_No)%Flow_Rate = (1714.d0*data%State%Pump(Pump_No)%Mech_Efficiency*data%State%Pump(Pump_No)%Max_Horsepower)/data%State%Pump(Pump_No)%StandPipe_Pressure ![gpm] | |||||
data%State%Pump(Pump_No)%Speed = ( data%State%Pump(Pump_No)%Flow_Rate/(data%State%Pump(Pump_No)%FlowRatePerSTK*4118.d0*0.01d0) )*data%State%Pump(Pump_No)%Trans_Ratio ![rpm] | |||||
end if | |||||
data%State%Pump(Pump_No)%SoundSPM = INT(data%State%Pump(Pump_No)%Speed/data%State%Pump(Pump_No)%Trans_Ratio) | |||||
If (data%State%Pump(Pump_No)%Flow_Rate>0.d0) Then | |||||
data%State%Pump(Pump_No)%Open_Close = 1 | |||||
Else | |||||
data%State%Pump(Pump_No)%Open_Close = 0 | |||||
End if | |||||
end subroutine Pump_OffMode_Solver |
@@ -0,0 +1,27 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/Pumps/Pumps_MainSolver.f90" | |||||
subroutine Pumps_MainSolver | |||||
use SimulationVariables | |||||
Implicit none | |||||
Call DrillingConsole_ScrLEDs !koja bezaramesh????? | |||||
Call Pumps_Inputs | |||||
Call Pump1_MainSolver | |||||
Call Pump2_MainSolver | |||||
Call Pump3_MainSolver | |||||
Call Pumps_TotalSolver | |||||
Call Pumps_Outputs | |||||
end subroutine Pumps_MainSolver |
@@ -0,0 +1,78 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/RTable_INPUTS.f90" | |||||
subroutine RTable_INPUTS | |||||
use CDrillingConsoleVariables | |||||
use SimulationVariables | |||||
! use CSimulationVariables | |||||
use UnitySignalsModule | |||||
! use CTdsElevatorModesEnumVariables | |||||
use CHoistingVariables | |||||
use TD_DrillStemComponents | |||||
use UnityModule | |||||
use CWarnings | |||||
use UnitySignalVariables | |||||
use UnitySignalsModule | |||||
IMPLICIT NONE | |||||
integer :: i | |||||
data%State%RTable%AssignmentSwitch = data%Equipments%DrillingConsole%AssignmentSwitch | |||||
data%State%RTable%Switch = data%Equipments%DrillingConsole%RTSwitch | |||||
!data%State%RTable%GearsAbuse = RotaryGearsAbuse | |||||
data%State%RTable%Throttle = data%Equipments%DrillingConsole%RTThrottle ![RPM] | |||||
data%State%RTable%String_Torque = data%State%TD_String%StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||||
!data%State%RTable%RpmGaugeMalf !:dar module haye C meghdardehi mishe | |||||
data%State%RTable%N_new = data%State%RTable%Throttle | |||||
if ( data%State%RTable%MotorFaileMalf==1 ) then | |||||
data%State%RTable%N_new = 0.d0 | |||||
end if | |||||
data%State%RTable%String_Torque = 0.112984d0*data%State%RTable%String_Torque ![N.m] | |||||
!===> String_JCoef Calculation | |||||
if ( data%Configuration%Hoisting%DriveType==0 ) then | |||||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||||
data%State%RTable%RotaryMode = 1 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
Do i = 1,data%State%TD_String%StringConfigurationCount | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef+( (data%State%TD_DrillStem(i)%TotalWeight*((data%State%TD_DrillStem(i)%Id**2.d0)+(data%State%TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||||
End Do | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef*0.0421401d0 ![kg.m^2] | |||||
else if ( Get_Slips() /= SLIPS_SET_END ) then | |||||
data%State%RTable%RotaryMode = 2 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
data%State%RTable%String_Torque = 0.d0 | |||||
else | |||||
data%State%RTable%RotaryMode = 3 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
data%State%RTable%String_Torque = 0.d0 | |||||
end if | |||||
else if ( data%Configuration%Hoisting%DriveType==1 ) then | |||||
if ( Get_IsKellyBushingSetInTable() .or. Get_Slips() == SLIPS_SET_END ) then !if rotary connected to string | |||||
data%State%RTable%RotaryMode = 4 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
Do i = 1,data%State%TD_String%StringConfigurationCount | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef+( (data%State%TD_DrillStem(i)%TotalWeight*((data%State%TD_DrillStem(i)%Id**2.d0)+(data%State%TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||||
End Do | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef*0.0421401e0 ![kg.m^2] | |||||
else | |||||
data%State%RTable%RotaryMode = 5 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
data%State%RTable%String_Torque = 0.d0 | |||||
end if | |||||
end if | |||||
!===> Transmission Mode | |||||
data%State%RTable%Conv_Ratio = data%State%RTable%High_Conv_Ratio | |||||
end subroutine RTable_INPUTS |
@@ -0,0 +1,77 @@ | |||||
subroutine RTable_INPUTS | |||||
use CDrillingConsoleVariables | |||||
use SimulationVariables | |||||
! use CSimulationVariables | |||||
use UnitySignalsModule | |||||
! use CTdsElevatorModesEnumVariables | |||||
use CHoistingVariables | |||||
use TD_DrillStemComponents | |||||
use UnityModule | |||||
use CWarnings | |||||
use UnitySignalVariables | |||||
use UnitySignalsModule | |||||
IMPLICIT NONE | |||||
integer :: i | |||||
data%State%RTable%AssignmentSwitch = data%Equipments%DrillingConsole%AssignmentSwitch | |||||
data%State%RTable%Switch = data%Equipments%DrillingConsole%RTSwitch | |||||
!data%State%RTable%GearsAbuse = RotaryGearsAbuse | |||||
data%State%RTable%Throttle = data%Equipments%DrillingConsole%RTThrottle ![RPM] | |||||
data%State%RTable%String_Torque = data%State%TD_String%StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||||
!data%State%RTable%RpmGaugeMalf !:dar module haye C meghdardehi mishe | |||||
data%State%RTable%N_new = data%State%RTable%Throttle | |||||
if ( data%State%RTable%MotorFaileMalf==1 ) then | |||||
data%State%RTable%N_new = 0.d0 | |||||
end if | |||||
data%State%RTable%String_Torque = 0.112984d0*data%State%RTable%String_Torque ![N.m] | |||||
!===> String_JCoef Calculation | |||||
if ( data%Configuration%Hoisting%DriveType==0 ) then | |||||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||||
data%State%RTable%RotaryMode = 1 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
Do i = 1,data%State%TD_String%StringConfigurationCount | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef+( (data%State%TD_DrillStem(i)%TotalWeight*((data%State%TD_DrillStem(i)%Id**2.d0)+(data%State%TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||||
End Do | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef*0.0421401d0 ![kg.m^2] | |||||
else if ( Get_Slips() /= SLIPS_SET_END ) then | |||||
data%State%RTable%RotaryMode = 2 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
data%State%RTable%String_Torque = 0.d0 | |||||
else | |||||
data%State%RTable%RotaryMode = 3 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
data%State%RTable%String_Torque = 0.d0 | |||||
end if | |||||
else if ( data%Configuration%Hoisting%DriveType==1 ) then | |||||
if ( Get_IsKellyBushingSetInTable() .or. Get_Slips() == SLIPS_SET_END ) then !if rotary connected to string | |||||
data%State%RTable%RotaryMode = 4 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
Do i = 1,data%State%TD_String%StringConfigurationCount | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef+( (data%State%TD_DrillStem(i)%TotalWeight*((data%State%TD_DrillStem(i)%Id**2.d0)+(data%State%TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||||
End Do | |||||
data%State%RTable%String_JCoef = data%State%RTable%String_JCoef*0.0421401e0 ![kg.m^2] | |||||
else | |||||
data%State%RTable%RotaryMode = 5 | |||||
data%State%RTable%String_JCoef = 0.d0 | |||||
data%State%RTable%String_Torque = 0.d0 | |||||
end if | |||||
end if | |||||
!===> Transmission Mode | |||||
data%State%RTable%Conv_Ratio = data%State%RTable%High_Conv_Ratio | |||||
end subroutine RTable_INPUTS |
@@ -0,0 +1,67 @@ | |||||
subroutine RTable_MainSolver | |||||
use SimulationVariables !@ | |||||
IMPLICIT NONE | |||||
Call RTable_Inputs | |||||
if (data%State%RTable%Throttle<=0.d0) then | |||||
data%State%RTable%K_throttle = 1 | |||||
end if | |||||
if ( (any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch==-1) ) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
CALL RTable_OnModeSolver | |||||
else if ( (any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch==1) .and. (data%State%RTable%K_throttle==1) ) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
CALL RTable_OnModeSolver | |||||
else | |||||
if((any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch/=0)) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
else | |||||
data%State%RTable%SoundBlower = .false. | |||||
data%State%RTable%BLWR = 0 | |||||
end if | |||||
Call RTable_OffMode | |||||
data%State%RTable%K_throttle = 0 | |||||
end if | |||||
Call RTable_Outputs | |||||
data%State%RTable%N_old = data%State%RTable%N_ref | |||||
end subroutine RTable_MainSolver |
@@ -0,0 +1,68 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/RTable_MainSolver.f90" | |||||
subroutine RTable_MainSolver | |||||
use SimulationVariables !@ | |||||
IMPLICIT NONE | |||||
Call RTable_Inputs | |||||
if (data%State%RTable%Throttle<=0.d0) then | |||||
data%State%RTable%K_throttle = 1 | |||||
end if | |||||
if ( (any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch==-1) ) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
CALL RTable_OnModeSolver | |||||
else if ( (any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch==1) .and. (data%State%RTable%K_throttle==1) ) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
CALL RTable_OnModeSolver | |||||
else | |||||
if((any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch/=0)) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
else | |||||
data%State%RTable%SoundBlower = .false. | |||||
data%State%RTable%BLWR = 0 | |||||
end if | |||||
Call RTable_OffMode | |||||
data%State%RTable%K_throttle = 0 | |||||
end if | |||||
Call RTable_Outputs | |||||
data%State%RTable%N_old = data%State%RTable%N_ref | |||||
end subroutine RTable_MainSolver |
@@ -0,0 +1,63 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/RTable_OffModeSolver.f90" | |||||
subroutine RTable_OffMode | |||||
use SimulationVariables !@ | |||||
IMPLICIT NONE | |||||
REAL :: RT_OldSpeed, RT_OldRpmGauge | |||||
RT_OldSpeed = data%State%RTable%Speed | |||||
RT_OldRpmGauge = data%State%RTable%RpmGaugeOutput | |||||
data%State%RTable%N_new = 0.d0 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
if ( any(data%State%RTable%RotaryMode==(/1,4/)) ) then !if rotary connected to string | |||||
!==> RPM | |||||
data%State%RTable%Speed = data%State%RTable%N_ref/data%State%RTable%Conv_Ratio | |||||
data%State%RTable%Speed = min(data%State%RTable%Speed,data%State%RTable%MaxRPM) !Speed [RPM] | |||||
data%State%RTable%RpmGaugeOutput = data%State%RTable%Speed | |||||
!==> Sound | |||||
data%State%RTable%SoundRPM = INT(data%State%RTable%Speed) | |||||
!==> Torque | |||||
data%State%RTable%Torque = ( ((data%State%RTable%J_coef+data%State%RTable%String_JCoef)*((((pi*data%State%RTable%Speed)/30.d0)-((pi*RT_OldSpeed)/30.d0))/data%State%RTable%time_step))+(data%State%RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||||
data%State%RTable%Torque = min(data%State%RTable%Torque,data%State%RTable%MaxTorque) | |||||
data%State%RTable%TorqueGaugeOutput = data%State%RTable%Torque | |||||
else if ( any(data%State%RTable%RotaryMode==(/2,5/)) ) then | |||||
!==> RPM | |||||
data%State%RTable%Speed = 0.d0 | |||||
data%State%RTable%RpmGaugeOutput = data%State%RTable%N_ref/data%State%RTable%Conv_Ratio | |||||
data%State%RTable%RpmGaugeOutput = min(data%State%RTable%RpmGaugeOutput,data%State%RTable%MaxRPM) | |||||
!==> Sound | |||||
data%State%RTable%SoundRPM = INT(data%State%RTable%RpmGaugeOutput) | |||||
!==> Torque | |||||
data%State%RTable%Torque = 0.d0 | |||||
data%State%RTable%TorqueGaugeOutput = ( ((data%State%RTable%J_coef+data%State%RTable%String_JCoef)*((((pi*data%State%RTable%RpmGaugeOutput)/30.d0)-((pi*RT_OldRpmGauge)/30.d0))/data%State%RTable%time_step))+(data%State%RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||||
data%State%RTable%TorqueGaugeOutput = min(data%State%RTable%TorqueGaugeOutput,data%State%RTable%MaxTorque) | |||||
else if ( data%State%RTable%RotaryMode==3 ) then | |||||
!==> RPM | |||||
data%State%RTable%Speed = 0.d0 | |||||
data%State%RTable%RpmGaugeOutput = 0.d0 | |||||
!==> Sound | |||||
data%State%RTable%SoundRPM = INT(data%State%RTable%RpmGaugeOutput) | |||||
!==> Torque | |||||
data%State%RTable%Torque = 0.d0 | |||||
data%State%RTable%TorqueGaugeOutput = 0.d0 | |||||
end if | |||||
end subroutine RTable_OffMode |
@@ -0,0 +1,52 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/RTable_OnModeSolver.f90" | |||||
subroutine RTable_OnModeSolver | |||||
use SimulationVariables !@ | |||||
IMPLICIT NONE | |||||
REAL :: RT_OldSpeed, RT_OldRpmGauge | |||||
RT_OldSpeed = data%State%RTable%Speed | |||||
RT_OldRpmGauge = data%State%RTable%RpmGaugeOutput | |||||
if ( any(data%State%RTable%RotaryMode==(/1,4/)) ) then !if rotary connected to string | |||||
!==> RPM | |||||
data%State%RTable%Speed = data%State%RTable%N_ref/data%State%RTable%Conv_Ratio | |||||
data%State%RTable%Speed = min(data%State%RTable%Speed,data%State%RTable%MaxRPM) !Speed [RPM] | |||||
data%State%RTable%RpmGaugeOutput = data%State%RTable%Speed | |||||
!==> Sound | |||||
data%State%RTable%SoundRPM = INT(data%State%RTable%Speed) | |||||
!==> Torque | |||||
data%State%RTable%Torque = ( ((data%State%RTable%J_coef+data%State%RTable%String_JCoef)*((((pi*data%State%RTable%Speed)/30.d0)-((pi*RT_OldSpeed)/30.d0))/data%State%RTable%time_step))+(data%State%RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||||
data%State%RTable%Torque = min(data%State%RTable%Torque,data%State%RTable%MaxTorque) | |||||
data%State%RTable%TorqueGaugeOutput = data%State%RTable%Torque | |||||
else if ( any(data%State%RTable%RotaryMode==(/2,5/)) ) then | |||||
!==> RPM | |||||
data%State%RTable%Speed = 0.d0 | |||||
data%State%RTable%RpmGaugeOutput = data%State%RTable%N_ref/data%State%RTable%Conv_Ratio | |||||
data%State%RTable%RpmGaugeOutput = min(data%State%RTable%RpmGaugeOutput,data%State%RTable%MaxRPM) !inja bayad bashe ya na??? | |||||
!==> Sound | |||||
data%State%RTable%SoundRPM = INT(data%State%RTable%RpmGaugeOutput) | |||||
!==> Torque | |||||
data%State%RTable%Torque = 0.d0 | |||||
data%State%RTable%TorqueGaugeOutput = ( ((data%State%RTable%J_coef+data%State%RTable%String_JCoef)*((((pi*data%State%RTable%RpmGaugeOutput)/30.d0)-((pi*RT_OldRpmGauge)/30.d0))/data%State%RTable%time_step))+(data%State%RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||||
data%State%RTable%TorqueGaugeOutput = min(data%State%RTable%TorqueGaugeOutput,data%State%RTable%MaxTorque) | |||||
else if ( data%State%RTable%RotaryMode==3 ) then | |||||
!==> RPM | |||||
data%State%RTable%Speed = 0.d0 | |||||
data%State%RTable%RpmGaugeOutput = 0.d0 | |||||
!==> Sound | |||||
data%State%RTable%SoundRPM = INT(data%State%RTable%RpmGaugeOutput) | |||||
!==> Torque | |||||
data%State%RTable%Torque = 0.d0 | |||||
data%State%RTable%TorqueGaugeOutput = 0.d0 | |||||
end if | |||||
END subroutine RTable_OnModeSolver |
@@ -0,0 +1,41 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/RTable_VARIABLES.f90" | |||||
MODULE RTable_VARIABLES | |||||
IMPLICIT NONE | |||||
PUBLIC | |||||
! REAL, PARAMETER :: pi=3.14159265 | |||||
!**************************************************************************************************** | |||||
!**************** Define Rotary Table Array **************************************************** | |||||
TYPE, PUBLIC :: RTable_Var | |||||
!********* RTable_VARIABLES ************************* | |||||
INTEGER :: AssignmentSwitch , Switch , K_throttle , RotaryMode | |||||
INTEGER :: MotorFaileMalf , OverideTorqueLimitMalf , RpmGaugeMalf , TorqueGaugeMalf , TorqueLimitGaugeMalf | |||||
REAL(8) :: RpmGaugeOutput , TorqueGaugeOutput | |||||
REAL :: Throttle, RateChange | |||||
REAL :: Speed, Inertia_Moment, Mech_Efficiency, Torque, MaxRPM, MaxTorque | |||||
REAL :: Conv_Ratio, High_Conv_Ratio, Low_Conv_Ratio | |||||
REAL :: String_Torque, String_JCoef | |||||
REAL :: time_step, J_coef | |||||
REAL :: N_new, N_old, N_ref ! N(rpm) , w(rad/s) | |||||
!********* Traction Motor_VARIABLES ***************** | |||||
!****************************************************** | |||||
INTEGER :: BLWR ! On=1 , Off=0 | |||||
!************* Sound_VARIABLES ********************** | |||||
INTEGER :: SoundRPM | |||||
Logical :: SoundBlower | |||||
END TYPE RTable_Var | |||||
!*********************************************************************************************** | |||||
!**************************************************************************************************** | |||||
END MODULE RTable_VARIABLES |
@@ -0,0 +1,68 @@ | |||||
# 1 "/home/admin/SimulationCore2/Equipments/RotaryTable/Rtable_MainSolver.f90" | |||||
subroutine RTable_MainSolver | |||||
use SimulationVariables !@ | |||||
IMPLICIT NONE | |||||
Call RTable_Inputs | |||||
if (data%State%RTable%Throttle<=0.d0) then | |||||
data%State%RTable%K_throttle = 1 | |||||
end if | |||||
if ( (any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch==-1) ) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
CALL RTable_OnModeSolver | |||||
else if ( (any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch==1) .and. (data%State%RTable%K_throttle==1) ) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
!======================= Rotary Table Rate_limit ======================= | |||||
if (((data%State%RTable%N_new-data%State%RTable%N_old)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else if (((data%State%RTable%N_old-data%State%RTable%N_new)/data%State%RTable%time_step)>data%State%RTable%RateChange) then | |||||
data%State%RTable%N_ref = (-data%State%RTable%RateChange*data%State%RTable%time_step)+data%State%RTable%N_old | |||||
else | |||||
data%State%RTable%N_ref = data%State%RTable%N_new | |||||
end if | |||||
!======================================================================= | |||||
CALL RTable_OnModeSolver | |||||
else | |||||
if((any(data%State%RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (data%State%RTable%Switch/=0)) then | |||||
data%State%RTable%SoundBlower = .true. | |||||
data%State%RTable%BLWR = 1 | |||||
else | |||||
data%State%RTable%SoundBlower = .false. | |||||
data%State%RTable%BLWR = 0 | |||||
end if | |||||
Call RTable_OffMode | |||||
data%State%RTable%K_throttle = 0 | |||||
end if | |||||
Call RTable_Outputs | |||||
data%State%RTable%N_old = data%State%RTable%N_ref | |||||
end subroutine RTable_MainSolver |
@@ -0,0 +1,45 @@ | |||||
subroutine TopDrive_Inputs | |||||
! Use CSimulationVariables | |||||
use CTopDrivePanelVariables | |||||
use SimulationVariables | |||||
use UnitySignalsModule | |||||
use SimulationVariables | |||||
Use TD_DrillStemComponents | |||||
IMPLICIT NONE | |||||
integer :: i | |||||
data%State%TDS%String_Torque = data%State%TD_String%StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||||
!data%State%TDS%String_Torque = 20000. | |||||
data%State%TDS%String_Torque = 0.112984829d0*data%State%TDS%String_Torque ![N.m] | |||||
data%State%TDS%PowerState = data%Equipments%TopDrivePanel%TopDriveTdsPowerState | |||||
data%State%TDS%RpmKnob = data%Equipments%TopDrivePanel%RpmKnob | |||||
!data%State%TDS%MotorFaileMalf ! jayi meghdardehi nashode ?????????????????? | |||||
data%State%TDS%RateChange = 193.d0 ![RPM/s] motaghayere voroudi ??? | |||||
data%State%TDS%DrillTorqueState = data%Equipments%TopDrivePanel%TopDriveDrillTorqueState | |||||
data%State%TDS%TorqueLimitKnob = data%Equipments%TopDrivePanel%TopDriveTorqueLimitKnob ! bayad hazf shavad??????????????/ | |||||
!===> data%State%TDS%String_JCoef Calculation | |||||
if ( (data%State%TDS%DrillTorqueState==-1) .and. ((Get_TdsConnectionModes()==TDS_CONNECTION_STRING).or.(Get_TdsConnectionModes()==TDS_CONNECTION_SPINE)) ) then !if TopDrive connected to string | |||||
data%State%TDS%String_JCoef = 0.d0 | |||||
Do i = 1,data%State%TD_String%StringConfigurationCount | |||||
data%State%TDS%String_JCoef = data%State%TDS%String_JCoef+( (data%State%TD_DrillStem(i)%TotalWeight*((data%State%TD_DrillStem(i)%Id**2.d0)+(data%State%TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||||
End Do | |||||
data%State%TDS%String_JCoef = data%State%TDS%String_JCoef*0.0421401d0 ![kg.m^2] | |||||
else | |||||
data%State%TDS%String_JCoef = 0.d0 | |||||
data%State%TDS%String_Torque = 0.d0 | |||||
end if | |||||
data%State%TDS%String_JCoef = data%State%TDS%String_JCoef/10.d0 !???????? /10: bi dalil, check it | |||||
end subroutine |
@@ -0,0 +1,492 @@ | |||||
# 1 "/home/admin/SimulationCore2/FluidFlow/kick/Gas_Kick_Calculator.f90" | |||||
SUBROUTINE GasKickCalculator | |||||
use SimulationVariables | |||||
use KickVARIABLESModule | |||||
use SimulationVariables !@ | |||||
Use CReservoirVariables | |||||
Use CFormationVariables | |||||
USE Fluid_Flow_Startup_Vars | |||||
use PressureDisplayVARIABLESModule | |||||
USE FricPressDropVarsModule | |||||
USE MudSystemVARIABLES | |||||
use SimulationVariables !@@@ | |||||
USE CMudPropertiesVariables | |||||
USE CError | |||||
USE , INTRINSIC :: IEEE_ARITHMETIC | |||||
!! Note: a subject that may be confusing is that when we use gauge pressure and when're using absolute pressure?! | |||||
!! all stated pressure are gauge pressure, so I do like this. | |||||
!! only when we want to use a state equation (like ideal gas equation), we should use absolute equation and so I do this. | |||||
!! Thus gas pocket pressure are all absolute pressure. | |||||
IMPLICIT NONE | |||||
INTEGER :: i , j , k , l | |||||
KickVARIABLES%SolvingEquationError = .FALSE. | |||||
KickVARIABLES%KickVandPFunction(:) = 0.d0 | |||||
KickVARIABLES%KickJacobian(: , :) = 0.d0 | |||||
!==================================================== | |||||
! Gas Properties (Methane Gas) | |||||
!==================================================== | |||||
!GasPocketNewTemp%Array(1) = 600 | |||||
KickVARIABLES%BottomHoleTemperature = 600 | |||||
KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress | |||||
KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 | |||||
KickVARIABLES%KickFluxAvgCompressibility = 0.98d0 | |||||
KickVARIABLES%K_Aa = (5.8742362 * 10.**(-3) * KickVARIABLES%KickFluxAvgTemperature**1.2288) / (511.1728532 + KickVARIABLES%KickFluxAvgTemperature) | |||||
KickVARIABLES%K_Bb = 5.5565586 + (1000.01 / KickVARIABLES%KickFluxAvgTemperature) | |||||
KickVARIABLES%K_Cc = 2.47862 - 0.12294 * KickVARIABLES%K_Bb | |||||
KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & | |||||
KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 | |||||
KickVARIABLES%GasKickViscosity = KickVARIABLES%K_Aa * EXP(KickVARIABLES%K_Bb * KickVARIABLES%GasKickSIDensity**KickVARIABLES%K_Cc) | |||||
!!!!!!!!!!!!!!!!!!!!!!!!! | |||||
!!!!!!!!!!!!!! Calculating compressibility for bottom hole condition | |||||
KickVARIABLES%BottomHoleCompressibility = 0.98d0 | |||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |||||
KickVARIABLES%GasKickBg = 0.00504 * KickVARIABLES%KickFluxAvgCompressibility * KickVARIABLES%KickFluxAvgTemperature / KickVARIABLES%KickFluxAvgPressure ![bbl/SCF] | |||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |||||
!WRITE (*,*) 'Gas Kick Top' | |||||
!===> Kick Flow Rate Calculation | |||||
IF (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress) THEN | |||||
KickVARIABLES%KickmdotACoef = 10.0**(-8) * 1.15741d0 * 7.080 * KickVARIABLES%FormPermeability * REAL(KickVARIABLES%KickFormLength) * data%State%GasType(KickVARIABLES%KickGasType)%StDensity / & | |||||
(KickVARIABLES%GasKickViscosity * KickVARIABLES%GasKickBg * LOG(10000.0)) | |||||
!IF (WellHeadOpen .AND. NoGasPocket == 1) KickVARIABLES%KickmdotACoef = (1.d0 + 2.d0) * KickmdotACoef | |||||
ELSE | |||||
KickVARIABLES%KickmdotACoef = 0.0 | |||||
END IF | |||||
i = data%State%FricPressDrop%StringLastEl | |||||
j = data%State%FricPressDrop%OpenholeFirstEl - 1 | |||||
k = KickVARIABLES%GasPocketFlowEl(1 , 1) | |||||
KickVARIABLES%KickmdotBCoef = KickVARIABLES%FormPressure + StandardPress !! - Sum(static and friction pressure loss) of flow elements below gas pocket, see below | |||||
IF (KickVARIABLES%FormPressure > KickVARIABLES%BottomHolePress) THEN | |||||
!WRITE (*,*) 'k , i, j' , k , i, j | |||||
IF (k >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! Bottom of active kick is in openhole | |||||
KickVARIABLES%KickmdotBCoef = KickVARIABLES%KickmdotBCoef - (SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : k)%StaticPressDiff)) !+ SUM(FlowEl(j + 1 : GasPocketFlowEl(1 , 1) - 1)%FricPressLoss | |||||
!WRITE (*,*) '1 SUM(FlowEl(j + 1 : k)%FricPressLoss', k, SUM(FlowEl(j + 1 : k)%FricPressLoss) | |||||
ELSE IF (k < data%State%FricPressDrop%OpenholeFirstEl) THEN ! bottom of 1st gas pocket (active kick) is in annulus ond/or choke line only | |||||
KickVARIABLES%KickmdotBCoef = KickVARIABLES%KickmdotBCoef - SUM(FlowEl(data%State%FricPressDrop%OpenholeFirstEl : data%State%FricPressDrop%NumbEl)%StaticPressDiff) & | |||||
- (SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : k)%StaticPressDiff) + SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : k)%FricPressLoss)) | |||||
END IF | |||||
END IF | |||||
DO l = 1 , KickVARIABLES%NoGasPocket | |||||
KickVARIABLES%KickUnknownVector(2 * l - 1) = GasPocketNewVol%Array(l) | |||||
KickVARIABLES%KickUnknownVector(2 * l) = GasPocketNewPress%Array(l) | |||||
END DO | |||||
IF (KickVARIABLES%WellHeadOpen) THEN | |||||
!!!!!!!!!! Calculation of functions of pocket Pressure and gas Volumes | |||||
!IF (GasPocketElementNo(1) > 0) WRITE (*,*) ' GasPocketElementNo(1) ' , GasPocketElementNo(1) | |||||
!WRITE (*,*) ' Kick Unknown Vector' , KickUnknownVector!(1) , KickUnknownVector(2) | |||||
IF (KickIteration == 1) THEN ! updating initial guess based on previous time step data | |||||
DO l = 1 , KickVARIABLES%NoGasPocket | |||||
KickVARIABLES%KickUnknownVector(2 * l - 1) = KickVARIABLES%KickUnknownVector(2 * l - 1) + GasPocketDeltaVol%Array(l) | |||||
END DO | |||||
END IF | |||||
KickVARIABLES%KickVandPFunction(1) = KickVARIABLES%KickUnknownVector(1) - GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & ! VandP(1) = V(1) | |||||
GasPocketNewTemp%Array(1) * (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * MAX(((KickVARIABLES%KickmdotBCoef - KickVARIABLES%KickUnknownVector(2)) * dt) , 0.0)) / KickVARIABLES%KickUnknownVector(2) | |||||
!WRITE (*,*) 'KickVandPFunction(1)',KickVandPFunction(1) | |||||
l = 2 * KickVARIABLES%NoGasPocket | |||||
CALL KickFunctionsCalculator(KickVARIABLES%KickVandPFunction(l) , KickVARIABLES%NoGasPocket , 2) ! VandP(last) = P(last) | |||||
!WRITE (*,*) 'KickVandPFunction(l)', l, KickVandPFunction(l) | |||||
DO l = 2 , KickVARIABLES%NoGasPocket ! VandP(Odd) = V(l, l > 1) | |||||
KickVARIABLES%KickVandPFunction(2 * l - 1) = KickVARIABLES%KickUnknownVector(2 * l - 1) - GasPocketCompressibility%Array(l) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & | |||||
GasPocketNewTemp%Array(l) * GasPocketWeight%Array(l) / KickVARIABLES%KickUnknownVector(2 * l) | |||||
!WRITE(*,*) 'KickVandPFunction(V)', l, KickVandPFunction(2 * l - 1) | |||||
END DO | |||||
DO l = KickVARIABLES%NoGasPocket - 1 , 1 , -1 | |||||
CALL KickFunctionsCalculator(KickVARIABLES%KickVandPFunction(2 * l) , l , 1) ! VandP(Even) = P(l, l < KickVARIABLES%NoGasPocket) | |||||
!WRITE(*,*) 'KickVandPFunction(P)', l , KickVandPFunction(2 * l) | |||||
END DO | |||||
!!!!!!!!!! END - Calculation of functions of pocket Pressure and gas Volumes | |||||
!!!!!!!!!! Calculation of Jacobian | |||||
DO k = 1 , 2 * KickVARIABLES%NoGasPocket ! Main Diagonal | |||||
KickVARIABLES%KickJacobian(k , k) = 1.d0 | |||||
END DO | |||||
KickVARIABLES%KickJacobian(1,2) = (GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * GasPocketNewTemp%Array(1) & | |||||
* (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * KickVARIABLES%KickmdotBCoef * dt) / KickVARIABLES%KickUnknownVector(2)**2) ! Row 1 Finished | |||||
IF (KickVARIABLES%KickJacobian(1,2) == 0.d0) THEN | |||||
CALL Error('KickJacobian(1,2) = 0.0') | |||||
KickVARIABLES%KickJacobian(1,2) = KickVARIABLES%OldKickJacobian(1,2) | |||||
END IF | |||||
!WRITE(*,*) 'KickJacobian(1,2)', KickJacobian(1,2) | |||||
l = KickVARIABLES%NoGasPocket | |||||
CALL KickFunctionsCalculator(KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) , KickVARIABLES%NoGasPocket , 4) ! for last Row | |||||
IF (KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) == 0.d0) THEN | |||||
CALL Error ('KickJacobian(Last,Odd) = 0.0') | |||||
KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) = KickVARIABLES%OldKickJacobian(2 * l , 2 * l - 1) | |||||
END IF | |||||
DO k = KickVARIABLES%NoGasPocket - 1 , 1 , -1 | |||||
KickVARIABLES%KickJacobian(2 * l , 2 * k - 1) = KickVARIABLES%KickJacobian(2 * l , 2 * l - 1) | |||||
END DO ! Last Row Finished | |||||
!WRITE(*,*) 'KickJacobian(2,1)', KickJacobian(2,1) | |||||
DO k = 2 , KickVARIABLES%NoGasPocket | |||||
KickVARIABLES%KickJacobian(2 * k - 1 , 2 * k) = GasPocketCompressibility%Array(k) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * GasPocketNewTemp%Array(k) & | |||||
* GasPocketWeight%Array(k) / KickVARIABLES%KickUnknownVector(2 * k)**2 | |||||
END DO ! Odd Rows (V equations) Finished | |||||
DO k = 1 , KickVARIABLES%NoGasPocket - 1 | |||||
KickVARIABLES%KickJacobian(2 * k , 2 * k + 2) = -1.d0 | |||||
END DO ! Even Rows (P equations) effect of upper pocket | |||||
DO k = 2 , 2 * (KickVARIABLES%NoGasPocket - 1) , 2 | |||||
DO l = 1 , k - 1 , 2 | |||||
CALL KickFunctionsCalculator(KickVARIABLES%KickJacobian(k , l) , k / 2 , 3) | |||||
IF (KickVARIABLES%KickJacobian(k , l) == 0.d0) THEN | |||||
WRITE (*,*) 'Jacobian Array = 0.0', k , l | |||||
CALL Error ('KickJacobian(k , l) = 0.0') | |||||
KickVARIABLES%KickJacobian(k , l) = KickVARIABLES%OldKickJacobian(k , l) | |||||
END IF | |||||
END DO | |||||
END DO | |||||
IF (ANY(IEEE_IS_NaN(KickVARIABLES%KickJacobian))) CALL ErrorStop ('NaN in calculating Kick Jacobian, Call your Service Provider') | |||||
!!!!!!!!!! Solving linear equation in order to finding correction vector for correcting pocket pressure and gas induced flowrates | |||||
KickVARIABLES%KickVandPFunction = -1.d0 * KickVARIABLES%KickVandPFunction | |||||
CALL SOLVE_LINEAR_EQUATIONS(KickVARIABLES%KickJacobian , KickVARIABLES%KickCorrectionVector , KickVARIABLES%KickVandPFunction , KickVARIABLES%SolvingEquationError, SIZE(KickVARIABLES%KickCorrectionVector)) | |||||
IF (KickVARIABLES%SolvingEquationError) CALL ErrorStop( ' Error in solving kick equation ' ) | |||||
KickVARIABLES%KickUnknownVector = KickVARIABLES%KickUnknownVector + KickVARIABLES%KickCorrectionUnderRelaxation * KickVARIABLES%KickCorrectionVector | |||||
DO l = 1 , KickVARIABLES%NoGasPocket | |||||
GasPocketNewVol%Array(l) = KickVARIABLES%KickUnknownVector(2 * l - 1) | |||||
IF (IEEE_IS_NaN(GasPocketNewVol%Array(l))) CALL ErrorStop('Volume of this pocket is Not a Number:', l) | |||||
IF (GasPocketNewVol%Array(l) <= 0.d0) CALL Error('Volume of this pocket is Negative or Zero:', l) | |||||
GasPocketNewPress%Array(l) = KickVARIABLES%KickUnknownVector(2 * l) | |||||
IF (IEEE_IS_NaN(GasPocketNewPress%Array(l))) CALL ErrorStop('Pressure of this Pocket is Not a Number:', l) | |||||
IF (GasPocketNewPress%Array(l) <= 0.d0) CALL ErrorStop('Pressure of this Pocket is Negative or Zero:', l) | |||||
END DO | |||||
ELSE ! well haed is closed, so build up process or migration occurs | |||||
!WRITE (*,*) 'GasPocketOldPress (before)' , GasPocketOldPress(1) | |||||
GasPocketNewPress%Array(1) = GasPocketOldPress%Array(1) * & | |||||
(REAL((GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * KickVARIABLES%KickmdotBCoef * dt) / (GasPocketWeight%Array(1) + KickVARIABLES%KickmdotACoef * GasPocketOldPress%Array(1) * dt))) | |||||
END IF | |||||
!DO l = 1 , KickVARIABLES%NoGasPocket | |||||
GasPocketDeltaVol%Array(:) = GasPocketNewVol%Array(:) - GasPocketOldVol%Array(:) | |||||
GasPocketFlowInduced%Array(:) = (GasPocketDeltaVol%Array(:)) / dt * 448.8 ! gpm | |||||
!END DO | |||||
KickVARIABLES%GasKickPumpFlowRate = 0.0 | |||||
IF (NOT(KickVARIABLES%KickOffBottom) .AND. KickVARIABLES%WellHeadOpen) KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) | |||||
END SUBROUTINE | |||||
SUBROUTINE KickFunctionsCalculator(ExitValue , GasPocketNo , CalcMode) | |||||
use SimulationVariables | |||||
use KickVARIABLESModule | |||||
USE FricPressDropVarsModule | |||||
USE Fluid_Flow_Startup_Vars | |||||
USE CError | |||||
USE , INTRINSIC :: IEEE_Arithmetic | |||||
IMPLICIT NONE | |||||
REAL(8) :: ExitValue | |||||
INTEGER :: GasPocketNo , CalcMode | |||||
INTEGER :: x | |||||
INTEGER :: y | |||||
INTEGER :: z , i , j | |||||
x = KickVARIABLES%GasPocketFlowEl(GasPocketNo , 1) | |||||
IF (GasPocketNo < KickVARIABLES%NoGasPocket) y = KickVARIABLES%GasPocketFlowEl(GasPocketNo + 1 , 1) | |||||
i = data%State%FricPressDrop%StringLastEl | |||||
j = data%State%FricPressDrop%OpenholeFirstEl - 1 | |||||
! Case 1: gas pocket is completely in OP and STARTX of upper gas pocket is also | |||||
! Case 2: gas pocket is completely in OP and STARTX of upper gas pocket is above Bit | |||||
! Case 3: gas pocket is AROUNDBIT and so upper gas pocket is in ANN (or Choke line) | |||||
! Case 4: gas pocket is completely in ANN and upper gas pocket is also | |||||
! CalcMode 1: KickVandPFunction between 2 pocket | |||||
! CalcMode 2: KickVandPFunction for top gas pocket | |||||
! CalcMode 3: KickJacobian between 2 Pocket | |||||
! CalcMode 4: KickJacobian for top (last) gas pocket | |||||
! CalcMode 5: Calculating pressure of bottom pocket based on upper pocket | |||||
IF (CalcMode == 1) THEN ! calculating pressure difference between two pocket, include static pressure difference and frictional | |||||
! pressure difference, use in calculating 'KickVandPFunction' | |||||
ExitValue = KickVARIABLES%KickUnknownVector(2 * GasPocketNo) - KickVARIABLES%KickUnknownVector(2 * GasPocketNo + 2) | |||||
IF (x >= data%State%FricPressDrop%OpenholeFirstEl .AND. y < data%State%FricPressDrop%OpenholeFirstEl) THEN ! Case 2 , Case 3 | |||||
ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricPressLoss) & | |||||
- SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%StaticPressDiff) - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%FricPressLoss) | |||||
ELSE ! Case 1 , Case 4 | |||||
ExitValue = ExitValue - SUM(FlowEl(x : y)%StaticPressDiff) - SUM(FlowEl(x : y)%FricPressLoss) | |||||
END IF | |||||
ELSE IF (CalcMode == 2) THEN | |||||
ExitValue = KickVARIABLES%KickUnknownVector(2 * GasPocketNo) - StandardPress - data%State%FricPressDrop%Kchoke * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate**2 | |||||
IF (x >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! Gas Pocket is in Openhole | |||||
ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricPressLoss) & | |||||
- SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%StaticPressDiff) - SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FricPressLoss) | |||||
ELSE ! Gas Pocket is in Annulus | |||||
ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%OpenholeFirstEl - 1)%StaticPressDiff) - SUM(FlowEl(x : data%State%FricPressDrop%OpenholeFirstEl - 1)%FricPressLoss) | |||||
END IF | |||||
ELSE IF (CalcMode == 3) THEN ! calculating derivative of pressure difference between two pocket, relative to change in flowrate | |||||
! use in calculating 'KickJacobian' | |||||
IF (x >= data%State%FricPressDrop%OpenholeFirstEl .AND. y < data%State%FricPressDrop%OpenholeFirstEl) THEN ! Top kick STARTX is in Annulus | |||||
DO z = x , data%State%FricPressDrop%NumbEl ! open hole elements | |||||
CALL PartialDerivativeFricToFlowRate(z) | |||||
IF (IEEE_IS_NaN(FlowEl(z)%FricToQPartialDiff)) THEN | |||||
WRITE (*,*) ' FricToQPartialDiff , GenRe ' , x , FlowEl(z)%FricToQPartialDiff , FlowEl(z)%GenRe | |||||
WRITE (*,*) ' Op start, end, density, Q, mu' , FlowEl(z)%StartX, FlowEl(z)%EndX, FlowEl(z)%Density, FlowEl(z)%FlowRate, FlowEl(z)%mueff | |||||
CALL ErrorStop('NaN in calculating partial derivative') | |||||
END IF | |||||
END DO | |||||
DO z = data%State%FricPressDrop%AnnulusFirstEl , y ! Annulus elements | |||||
CALL PartialDerivativeFricToFlowRate(z) | |||||
IF (IEEE_IS_NaN(FlowEl(z)%FricToQPartialDiff)) THEN | |||||
WRITE (*,*) ' FricToQPartialDiff , GenRe ' , x , FlowEl(z)%FricToQPartialDiff , FlowEl(z)%GenRe | |||||
WRITE (*,*) ' Op start, end, density, Q, mu' , FlowEl(z)%StartX, FlowEl(z)%EndX, FlowEl(z)%Density, FlowEl(z)%FlowRate, FlowEl(z)%mueff | |||||
CALL ErrorStop('NaN in calculating partial derivative') | |||||
END IF | |||||
END DO | |||||
ExitValue = ExitValue - (SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricToQPartialDiff) + SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%FricToQPartialDiff)) * 448.8 / dt | |||||
ELSE ! both pockets are one side of bit | |||||
DO z = x , y | |||||
CALL PartialDerivativeFricToFlowRate(z) | |||||
IF (IEEE_IS_NaN(FlowEl(z)%FricToQPartialDiff)) THEN | |||||
WRITE (*,*) ' FricToQPartialDiff , GenRe ' , x , FlowEl(z)%FricToQPartialDiff , FlowEl(z)%GenRe | |||||
WRITE (*,*) ' Op start, end, density, Q, mu' , FlowEl(z)%StartX, FlowEl(z)%EndX, FlowEl(z)%Density, FlowEl(z)%FlowRate, FlowEl(z)%mueff | |||||
CALL ErrorStop('NaN in calculating partial derivative') | |||||
END IF | |||||
END DO | |||||
ExitValue = ExitValue - SUM(FlowEl(x : y)%FricToQPartialDiff) * 448.8 / dt | |||||
END IF | |||||
ELSE IF (CalcMode == 4) THEN ! partial derivative of frictional pressure drop relative to flowrate for top gas pocket | |||||
ExitValue = - 2.d0 * data%State%FricPressDrop%Kchoke * FlowEl(data%State%FricPressDrop%OpenholeFirstEl - 1)%Flowrate * 448.8 / dt | |||||
IF (x >= data%State%FricPressDrop%OpenholeFirstEl) THEN ! kick STARTX is in openhole | |||||
DO z = x , data%State%FricPressDrop%NumbEl ! open hole elements | |||||
CALL PartialDerivativeFricToFlowRate(z) | |||||
IF (IEEE_IS_NaN(FlowEl(z)%FricToQPartialDiff)) THEN | |||||
WRITE (*,*) ' FricToQPartialDiff , GenRe ' , x , FlowEl(z)%FricToQPartialDiff , FlowEl(z)%GenRe | |||||
WRITE (*,*) ' Op start, end, density, Q, mu' , FlowEl(z)%StartX, FlowEl(z)%EndX, FlowEl(z)%Density, FlowEl(z)%FlowRate, FlowEl(z)%mueff | |||||
CALL ErrorStop('NaN in calculating partial derivative') | |||||
END IF | |||||
END DO | |||||
DO z = data%State%FricPressDrop%AnnulusFirstEl , data%State%FricPressDrop%OpenholeFirstEl - 1 ! Annulus elements | |||||
CALL PartialDerivativeFricToFlowRate(z) | |||||
IF (IEEE_IS_NaN(FlowEl(z)%FricToQPartialDiff)) THEN | |||||
WRITE (*,*) ' FricToQPartialDiff , GenRe ' , x , FlowEl(z)%FricToQPartialDiff , FlowEl(z)%GenRe | |||||
WRITE (*,*) ' Op start, end, density, Q, mu' , FlowEl(z)%StartX, FlowEl(z)%EndX, FlowEl(z)%Density, FlowEl(z)%FlowRate, FlowEl(z)%mueff | |||||
CALL ErrorStop('NaN in calculating partial derivative') | |||||
END IF | |||||
END DO | |||||
ExitValue = ExitValue - (SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%FricToQPartialDiff) + SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : data%State%FricPressDrop%OpenholeFirstEl - 1)%FricToQPartialDiff)) * 448.8 / dt | |||||
ELSE | |||||
DO z = x , data%State%FricPressDrop%OpenholeFirstEl - 1 ! Annulus elements | |||||
CALL PartialDerivativeFricToFlowRate(z) | |||||
IF (IEEE_IS_NaN(FlowEl(z)%FricToQPartialDiff)) THEN | |||||
WRITE (*,*) ' FricToQPartialDiff , GenRe ' , x , FlowEl(z)%FricToQPartialDiff , FlowEl(z)%GenRe | |||||
WRITE (*,*) ' Op start, end, density, Q, mu' , FlowEl(z)%StartX, FlowEl(z)%EndX, FlowEl(z)%Density, FlowEl(z)%FlowRate, FlowEl(z)%mueff | |||||
CALL ErrorStop('NaN in calculating partial derivative') | |||||
END IF | |||||
END DO | |||||
ExitValue = ExitValue - SUM(FlowEl(x : data%State%FricPressDrop%OpenholeFirstEl - 1)%FricToQPartialDiff) * 448.8 / dt | |||||
END IF | |||||
ELSE IF (CalcMode == 5) THEN | |||||
IF (x >= data%State%FricPressDrop%OpenholeFirstEl .AND. y < data%State%FricPressDrop%OpenholeFirstEl) THEN ! Gas Pocket is in Openhole and upper pocket is in annulus | |||||
!WRITE (*,*) 'x , y 1' , x, y | |||||
ExitValue = GasPocketNewPress%Array(GasPocketNo + 1) + SUM(FlowEl(x : data%State%FricPressDrop%NumbEl)%StaticPressDiff) + SUM(FlowEl(data%State%FricPressDrop%AnnulusFirstEl : y)%StaticPressDiff) | |||||
ELSE ! Both gas pockets are in Annulus or openhole | |||||
!WRITE (*,*) 'x , y 2' , x, y | |||||
ExitValue = GasPocketNewPress%Array(GasPocketNo + 1) + SUM(FlowEl(x : y)%StaticPressDiff) | |||||
END IF | |||||
END IF | |||||
END SUBROUTINE | |||||
SUBROUTINE NewGasKick | |||||
use SimulationVariables | |||||
use KickVARIABLESModule | |||||
use SimulationVariables !@ | |||||
Use CReservoirVariables | |||||
Use CFormationVariables | |||||
USE Fluid_Flow_Startup_Vars | |||||
use PressureDisplayVARIABLESModule | |||||
USE FricPressDropVarsModule | |||||
USE MudSystemVARIABLES | |||||
use SimulationVariables !@@@ | |||||
USE CMudPropertiesVariables | |||||
USE CError | |||||
USE , INTRINSIC :: IEEE_ARITHMETIC | |||||
!! Note: a subject that may be confusing is that when we use gauge pressure and when using absolute pressure?! | |||||
!! all stated pressure are gauge pressure, so I do like this. | |||||
!! only when we want to use a state equation (like ideal gas equation), we should use absolute equation and so I do this. | |||||
!! Thus gas pocket pressure are all absolute pressure. | |||||
IMPLICIT NONE | |||||
INTEGER :: i , j , k , l | |||||
IF (NOT(ALLOCATED(GasPocketWeight%Array))) THEN ! 1st kick | |||||
WRITE (*,*) ' New Influx 1' | |||||
KickVARIABLES%NoGasPocket = 1 | |||||
data%State%MudSystem%NewInfluxNumber = data%State%MudSystem%NewInfluxNumber + 1 | |||||
data%State%MudSystem%NewInfluxElementCreated = 0 | |||||
KickVARIABLES%KickOffBottom = .FALSE. | |||||
CALL GasPocketOldPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) | |||||
CALL GasPocketNewPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) | |||||
CALL GasPocketOldTemp%AddToFirst(600.0) | |||||
CALL GasPocketNewTemp%AddToFirst(600.0) | |||||
CALL GasPocketOldVol%AddToFirst(0.d0) | |||||
CALL GasPocketNewVol%AddToFirst(0.d0) | |||||
CALL GasPocketdeltaVol%AddToFirst(0.0) | |||||
CALL GasPocketFlowInduced%AddToFirst(0.0) | |||||
CALL GasPocketModifiedVol%AddToFirst(0.0) | |||||
CALL GasPocketWeight%AddToFirst(0.0) | |||||
CALL GasPocketDensity%AddToFirst(2.0) | |||||
CALL GasPocketCompressibility%AddToFirst(0.98) | |||||
ALLOCATE(KickVARIABLES%KickJacobian(2 , 2) , KickVARIABLES%OldKickJacobian(2 , 2) , KickVARIABLES%KickVandPFunction(2) , KickVARIABLES%KickUnknownVector(2) , KickVARIABLES%KickCorrectionVector(2)) | |||||
KickVARIABLES%BottomHoleTemperature = 600 | |||||
KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress | |||||
KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 | |||||
KickVARIABLES%KickFluxAvgCompressibility = 0.98 | |||||
KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & | |||||
KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 | |||||
KickVARIABLES%GasKickDensity = KickVARIABLES%GasKickSIDensity * 8.3523 | |||||
GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * KickVARIABLES%MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt | |||||
GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & | |||||
GasPocketNewTemp%Array(1) * GasPocketWeight%Array(1) / GasPocketNewPress%Array(1) | |||||
GasPocketDeltaVol%Array(1) = 0.05 !GasPocketNewVol%Array(1) | |||||
GasPocketFlowInduced%Array(1) = (GasPocketDeltaVol%Array(1)) / dt * 448.8 ! gpm | |||||
KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) | |||||
WRITE (*,*) ' FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress, KickVARIABLES%GasKickDensity | |||||
WRITE (*,*) ' No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm)' | |||||
DO i = 1 , KickVARIABLES%NoGasPocket | |||||
WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i) | |||||
END DO | |||||
!ELSE IF (NoGasPocket < MaxGasPocket .AND. KickVARIABLES%KickOffBottom .AND. (GasPocketNewVol%Array(1) > KickVARIABLES%MinAllowableKickVol .OR. KickWasExitingThroughChoke)) THEN | |||||
ELSE IF (KickVARIABLES%NoGasPocket < KickVARIABLES%MaxGasPocket .AND. KickVARIABLES%KickOffBottom .AND. (GasPocketNewVol%Array(1) > KickVARIABLES%MinAllowableKickVol .OR. ANY(KickVARIABLES%GasPocketFlowEl(1 , :) == data%State%FricPressDrop%OpenholeFirstEl - 1))) THEN | |||||
WRITE (*,*) ' New Influx', KickVARIABLES%NoGasPocket + 1 | |||||
102 FORMAT (I2, 4X, (F8.1), 3X, (F8.3), 2X, (F8.3), 8X, (F8.3)) | |||||
KickVARIABLES%NoGasPocket = KickVARIABLES%NoGasPocket + 1 | |||||
data%State%MudSystem%NewInfluxNumber = data%State%MudSystem%NewInfluxNumber + 1 | |||||
data%State%MudSystem%NewInfluxElementCreated = 0 | |||||
KickVARIABLES%KickOffBottom = .FALSE. | |||||
CALL GasPocketOldPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) | |||||
CALL GasPocketNewPress%AddToFirst((KickVARIABLES%BottomHolePress + StandardPress) * 1.d0) | |||||
CALL GasPocketOldTemp%AddToFirst(600.0) | |||||
CALL GasPocketNewTemp%AddToFirst(600.0) | |||||
CALL GasPocketOldVol%AddToFirst(0.d0) | |||||
CALL GasPocketNewVol%AddToFirst(0.d0) | |||||
CALL GasPocketdeltaVol%AddToFirst(0.0) | |||||
CALL GasPocketFlowInduced%AddToFirst(0.0) | |||||
CALL GasPocketModifiedVol%AddToFirst(0.0) | |||||
CALL GasPocketWeight%AddToFirst(0.0) | |||||
CALL GasPocketDensity%AddToFirst(2.0) | |||||
CALL GasPocketCompressibility%AddToFirst(0.98) | |||||
DEALLOCATE(KickVARIABLES%KickJacobian , KickVARIABLES%OldKickJacobian , KickVARIABLES%KickVandPFunction , KickVARIABLES%KickUnknownVector , KickVARIABLES%KickCorrectionVector) | |||||
ALLOCATE(KickVARIABLES%KickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%OldKickJacobian(2 * KickVARIABLES%NoGasPocket , 2 * KickVARIABLES%NoGasPocket)) | |||||
ALLOCATE(KickVARIABLES%KickUnknownVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickCorrectionVector(2 * KickVARIABLES%NoGasPocket) , KickVARIABLES%KickVandPFunction(2 * KickVARIABLES%NoGasPocket)) | |||||
KickVARIABLES%BottomHoleTemperature = 600 | |||||
KickVARIABLES%KickFluxAvgPressure = (KickVARIABLES%BottomHolePress + KickVARIABLES%FormPressure) / 2 + StandardPress | |||||
KickVARIABLES%KickFluxAvgTemperature = (KickVARIABLES%FormTemperature + KickVARIABLES%BottomHoleTemperature) / 2 | |||||
KickVARIABLES%KickFluxAvgCompressibility = 0.98 | |||||
KickVARIABLES%GasKickSIDensity = KickVARIABLES%KickFluxAvgPressure / (KickVARIABLES%KickFluxAvgCompressibility * & | |||||
KickVARIABLES%KickFluxAvgTemperature * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant) * Convpcftogpcm3 | |||||
KickVARIABLES%GasKickDensity = KickVARIABLES%GasKickSIDensity * 8.3523 | |||||
!GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * 0.05 !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt | |||||
GasPocketWeight%Array(1) = KickVARIABLES%GasKickDensity * KickVARIABLES%MinKickVol !1.0:seyyed gofte !KickmdotACoef * (KickmdotBCoef - GasPocketNewPress%Array(1)) * dt | |||||
GasPocketNewVol%Array(1) = GasPocketCompressibility%Array(1) * data%State%GasType(KickVARIABLES%KickGasType)%GasConstant * & | |||||
GasPocketNewTemp%Array(1) * GasPocketWeight%Array(1) / GasPocketNewPress%Array(1) | |||||
GasPocketDeltaVol%Array(1) = 0.05 !GasPocketNewVol%Array(1) | |||||
GasPocketFlowInduced%Array(1) = (GasPocketDeltaVol%Array(1)) / dt * 448.8 ! gpm | |||||
KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) | |||||
WRITE (*,*) ' FormPressure , BottomHolePress' , KickVARIABLES%FormPressure , KickVARIABLES%BottomHolePress, KickVARIABLES%GasKickDensity | |||||
WRITE (*,*) ' No Press(psia) Vol(gal) Weight(lbm) Flow Induced(gpm)' | |||||
DO i = 1 , KickVARIABLES%NoGasPocket | |||||
WRITE (*,102) i , GasPocketNewPress%Array(i), GasPocketNewVol%Array(i) * Convft3toUSgal, GasPocketWeight%Array(i), GasPocketFlowInduced%Array(i) | |||||
END DO | |||||
ELSE ! no new kick, so mass of 1st kick should increase | |||||
GasPocketWeight%Array(1) = GasPocketweight%Array(1) + KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1)) * dt | |||||
KickVARIABLES%GasKickPumpFlowRate = GasPocketFlowInduced%Array(1) | |||||
IF (KickVARIABLES%NoGasPocket > 1 .OR. KickVARIABLES%SecondaryKickWeight > 0.0) THEN | |||||
KickVARIABLES%SecondaryKickWeight = KickVARIABLES%SecondaryKickWeight + KickVARIABLES%KickmdotACoef * (KickVARIABLES%KickmdotBCoef - GasPocketNewPress%Array(1)) * dt | |||||
KickVARIABLES%SecondaryKickVol = KickVARIABLES%SecondaryKickWeight / KickVARIABLES%GasReservoirDensity / 42.0 ! 42 USGal = 1bbl | |||||
END IF | |||||
END IF | |||||
END SUBROUTINE | |||||
@@ -390,6 +390,9 @@ OBJS_F = $(patsubst %.o,$(OBJ_DIR)/%.o,$(OBJS_T2)) | |||||
all: $(TARGET) | all: $(TARGET) | ||||
c: | |||||
cc Redis/redis_io.c -c -o obj/redis_io.o | |||||
$(TARGET): $(OBJS_F) | $(TARGET): $(OBJS_F) | ||||
@echo "make TARGET" | @echo "make TARGET" | ||||
cc Redis/redis_io.c -c -o obj/redis_io.o | cc Redis/redis_io.c -c -o obj/redis_io.o | ||||
@@ -1,5 +1,10 @@ | |||||
Module RedisInterface | Module RedisInterface | ||||
! use iso_c_binding, only: c_char | |||||
use iso_c_binding, only: c_char | |||||
! USE Kinds, ONLY: rk, ck | |||||
TYPE FString | |||||
CHARACTER(KIND=c_char,LEN=:),allocatable :: item | |||||
END TYPE FString | |||||
character(len=20000)::buffer | |||||
Interface | Interface | ||||
SUBROUTINE addnums(a, b) BIND(C,name='addnums') | SUBROUTINE addnums(a, b) BIND(C,name='addnums') | ||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT | USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT | ||||
@@ -26,6 +31,14 @@ Module RedisInterface | |||||
type(c_ptr) :: getData_C | type(c_ptr) :: getData_C | ||||
END FUNCTION getData_C | END FUNCTION getData_C | ||||
SUBROUTINE getData_C_bystr(str) BIND(C,name='getData_bystr') | |||||
use iso_c_binding, only: c_ptr,c_int,c_char | |||||
type(c_ptr) :: str | |||||
END SUBROUTINE getData_C_bystr | |||||
SUBROUTINE getData_C_byfile() BIND(C,name='getData_byfile') | |||||
END SUBROUTINE getData_C_byfile | |||||
SUBROUTINE deallocateData() BIND(C, name='deallocData') | SUBROUTINE deallocateData() BIND(C, name='deallocData') | ||||
END SUBROUTINE deallocateData | END SUBROUTINE deallocateData | ||||
@@ -39,25 +52,6 @@ Module RedisInterface | |||||
character(len=*) :: password,address,datakey | character(len=*) :: password,address,datakey | ||||
integer::port,status | integer::port,status | ||||
character(len=:),allocatable::c_address,c_password,c_datakey | character(len=:),allocatable::c_address,c_password,c_datakey | ||||
! type(json_file) :: jsonfile | |||||
! type(json_value),pointer :: jsonvalue,jsonvalue2 | |||||
! type(json_core) :: jsoncore | |||||
! call jsonfile%initialize() | |||||
! print *,"Initilized: simulation with ",configFilename | |||||
! call jsonfile%load_file(configFilename); | |||||
! if (jsonfile%failed()) then | |||||
! print *,"can not open config file: ",configFilename ; | |||||
! stop | |||||
! endif | |||||
! ! print *,"file read" | |||||
! call jsonfile%json_file_get_root(jsonvalue) | |||||
! call jsoncore%get(jsonvalue,'redis',jsonvalue2) | |||||
! call jsoncore%get(jsonvalue2,"address",address); | |||||
! call jsoncore%get(jsonvalue2,"port",port); | |||||
! call jsoncore%get(jsonvalue2,"password",password); | |||||
! call jsoncore%get(jsonvalue2,"datakey",datakey); | |||||
c_datakey = datakey//c_null_char | c_datakey = datakey//c_null_char | ||||
c_password = password//c_null_char | c_password = password//c_null_char | ||||
c_address = address//c_null_char | c_address = address//c_null_char | ||||
@@ -89,49 +83,105 @@ Module RedisInterface | |||||
call setData_C(part,c_str) | call setData_C(part,c_str) | ||||
END SUBROUTINE setInput | END SUBROUTINE setInput | ||||
SUBROUTINE getData(string) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr | |||||
SUBROUTINE getData(string,len) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_int | |||||
! character(:),allocatable :: getData2 | ! character(:),allocatable :: getData2 | ||||
character(:),allocatable :: string | character(:),allocatable :: string | ||||
integer :: string_shape(1) | integer :: string_shape(1) | ||||
integer(c_int):: len | |||||
type(c_ptr) :: c_string | type(c_ptr) :: c_string | ||||
integer::l | integer::l | ||||
l = 30000 | l = 30000 | ||||
! print *,"reading data l=",l | |||||
c_string = getData_C(l) | |||||
! print *,"data read. l=",l | |||||
! len = int(c_len,kind=kind(len)) | |||||
string_shape(1) = l!int(l,kind=kind(Integer)) | string_shape(1) = l!int(l,kind=kind(Integer)) | ||||
print *,"reading data l=",l | |||||
if(.not. allocated(string)) then | if(.not. allocated(string)) then | ||||
print *,"allocate string" | print *,"allocate string" | ||||
allocate(character(l) :: string) | allocate(character(l) :: string) | ||||
endif | endif | ||||
len = l | |||||
c_string = getData_C(len) | |||||
! print *,"data read. l=",l | |||||
! len = int(c_len,kind=kind(len)) | |||||
call c_f_pointer(c_string, string, string_shape) | call c_f_pointer(c_string, string, string_shape) | ||||
c_string=c_null_ptr | c_string=c_null_ptr | ||||
string = trim(string) | |||||
! string = trim(string) | |||||
! print *,len_trim(string), "chars read." | ! print *,len_trim(string), "chars read." | ||||
! print *,string(1:l) | ! print *,string(1:l) | ||||
! getData2=string | ! getData2=string | ||||
END SUBROUTINE getData | END SUBROUTINE getData | ||||
! SUBROUTINE getData2(string) !result(string) | |||||
! use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr | |||||
! ! character(:),allocatable :: getData2 | |||||
! character(:),allocatable :: string | |||||
! integer :: string_shape(1) | |||||
! type(c_ptr) :: c_string | |||||
! integer::l | |||||
! ! print *,"reading data (getData2)" | |||||
! c_string = getData_C(l) | |||||
! ! string = c_str | |||||
! ! len = int(c_len,kind=kind(len)) | |||||
! string_shape(1) = l! int(l,kind=kind(integer)) | |||||
! if(.not. allocated(string)) allocate(character(l) :: string) | |||||
! call c_f_pointer(c_string, string, string_shape) | |||||
! c_string=c_null_ptr | |||||
! ! print *,len_trim(string), "chars read." | |||||
! ! print *,string(1:l) | |||||
! ! getData2=string | |||||
! END SUBROUTINE getData2 | |||||
SUBROUTINE getData2(string) !result(string) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_loc | |||||
! character(:),allocatable :: getData2 | |||||
character(len=:,kind=c_char),allocatable :: string | |||||
integer :: string_shape(1) | |||||
type(c_ptr) :: c_string | |||||
TYPE(FString), TARGET :: f_str | |||||
integer::l | |||||
! print *,"reading data (getData2)" | |||||
call getData_C_bystr(c_loc(f_str)) | |||||
! CALL MOVE_ALLOC(f_str%item, string) | |||||
string = trim(buffer) | |||||
! string = c_str | |||||
! len = int(c_len,kind=kind(len)) | |||||
! string_shape(1) = l! int(l,kind=kind(integer)) | |||||
! if(.not. allocated(string)) allocate(character(l) :: string) | |||||
! call c_f_pointer(c_string, string, string_shape) | |||||
! c_string=c_null_ptr | |||||
! print *,len_trim(string), "chars read." | |||||
! print *,string(1:l) | |||||
END SUBROUTINE getData2 | |||||
SUBROUTINE getData3(key,string) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_loc | |||||
! character(:),allocatable :: getData2 | |||||
character(len=*) :: key | |||||
character(len=:),allocatable :: string | |||||
character(len=100) :: filename | |||||
integer::iostat | |||||
! print *,"reading data (getData2)" | |||||
filename = "/var/tmp/"//key | |||||
call getData_C_byfile() | |||||
open(unit=10, file=trim(filename)//".txt", status='old', action='read', iostat=iostat) | |||||
if (iostat /= 0) then | |||||
write(*, '(A)', advance='no') "Failed to open the file." | |||||
stop | |||||
end if | |||||
! Read the content of the file into the string | |||||
read(10, '(A)', iostat=iostat) string | |||||
if (iostat /= 0) then | |||||
write(*, '(A)', advance='no') "Failed to read the file." | |||||
stop | |||||
end if | |||||
! Close the file | |||||
close(10) | |||||
END SUBROUTINE getData3 | |||||
SUBROUTINE set_fortran_string(fstring_ptr, length, str) BIND(C, NAME='set_fortran_string') | |||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_CHAR, C_INT, C_F_POINTER | |||||
TYPE(C_PTR), INTENT(IN), VALUE :: fstring_ptr | |||||
INTEGER(C_INT), INTENT(IN), VALUE :: length | |||||
CHARACTER(KIND=C_CHAR), INTENT(IN) :: str(length) | |||||
! Fortran pointer to the object referenced by fstring_ptr that | |||||
! holds the deferred length character component. | |||||
TYPE(FString), POINTER :: f_str | |||||
character(:),allocatable :: string | |||||
INTEGER :: i | |||||
integer :: string_shape(1) | |||||
!**** | |||||
! Associate the Fortran pointer with the object referenced by the | |||||
! C address. | |||||
string_shape(1) = length | |||||
allocate(character(length) :: string) | |||||
CALL C_F_POINTER(fstring_ptr, string,string_shape) | |||||
! Allocate the deferred length component to the given length. | |||||
! deallocate(f_str%item) | |||||
! ALLOCATE(CHARACTER(length) :: f_str%item) | |||||
! Copy over the data. | |||||
! FORALL (i=1:length) f_str%item(i:i) = str(i) | |||||
buffer(1:length) = string(1:length) | |||||
buffer(length+1:20000) = ' ' | |||||
END SUBROUTINE set_fortran_string | |||||
END Module RedisInterface | END Module RedisInterface |
@@ -1,6 +1,11 @@ | |||||
# 1 "/home/admin/SimulationCore2/Redis/Redis_Interface.f90" | # 1 "/home/admin/SimulationCore2/Redis/Redis_Interface.f90" | ||||
Module RedisInterface | Module RedisInterface | ||||
! use iso_c_binding, only: c_char | |||||
use iso_c_binding, only: c_char | |||||
! USE Kinds, ONLY: rk, ck | |||||
TYPE FString | |||||
CHARACTER(KIND=c_char,LEN=:),allocatable :: item | |||||
END TYPE FString | |||||
character(len=20000)::buffer | |||||
Interface | Interface | ||||
SUBROUTINE addnums(a, b) BIND(C,name='addnums') | SUBROUTINE addnums(a, b) BIND(C,name='addnums') | ||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT | USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT | ||||
@@ -27,6 +32,14 @@ Module RedisInterface | |||||
type(c_ptr) :: getData_C | type(c_ptr) :: getData_C | ||||
END FUNCTION getData_C | END FUNCTION getData_C | ||||
SUBROUTINE getData_C_bystr(str) BIND(C,name='getData_bystr') | |||||
use iso_c_binding, only: c_ptr,c_int,c_char | |||||
type(c_ptr) :: str | |||||
END SUBROUTINE getData_C_bystr | |||||
SUBROUTINE getData_C_byfile() BIND(C,name='getData_byfile') | |||||
END SUBROUTINE getData_C_byfile | |||||
SUBROUTINE deallocateData() BIND(C, name='deallocData') | SUBROUTINE deallocateData() BIND(C, name='deallocData') | ||||
END SUBROUTINE deallocateData | END SUBROUTINE deallocateData | ||||
@@ -40,25 +53,6 @@ Module RedisInterface | |||||
character(len=*) :: password,address,datakey | character(len=*) :: password,address,datakey | ||||
integer::port,status | integer::port,status | ||||
character(len=:),allocatable::c_address,c_password,c_datakey | character(len=:),allocatable::c_address,c_password,c_datakey | ||||
! type(json_file) :: jsonfile | |||||
! type(json_value),pointer :: jsonvalue,jsonvalue2 | |||||
! type(json_core) :: jsoncore | |||||
! call jsonfile%initialize() | |||||
! print *,"Initilized: simulation with ",configFilename | |||||
! call jsonfile%load_file(configFilename); | |||||
! if (jsonfile%failed()) then | |||||
! print *,"can not open config file: ",configFilename ; | |||||
! stop | |||||
! endif | |||||
! ! print *,"file read" | |||||
! call jsonfile%json_file_get_root(jsonvalue) | |||||
! call jsoncore%get(jsonvalue,'redis',jsonvalue2) | |||||
! call jsoncore%get(jsonvalue2,"address",address); | |||||
! call jsoncore%get(jsonvalue2,"port",port); | |||||
! call jsoncore%get(jsonvalue2,"password",password); | |||||
! call jsoncore%get(jsonvalue2,"datakey",datakey); | |||||
c_datakey = datakey//c_null_char | c_datakey = datakey//c_null_char | ||||
c_password = password//c_null_char | c_password = password//c_null_char | ||||
c_address = address//c_null_char | c_address = address//c_null_char | ||||
@@ -90,49 +84,105 @@ Module RedisInterface | |||||
call setData_C(part,c_str) | call setData_C(part,c_str) | ||||
END SUBROUTINE setInput | END SUBROUTINE setInput | ||||
SUBROUTINE getData(string) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr | |||||
SUBROUTINE getData(string,len) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_int | |||||
! character(:),allocatable :: getData2 | ! character(:),allocatable :: getData2 | ||||
character(:),allocatable :: string | character(:),allocatable :: string | ||||
integer :: string_shape(1) | integer :: string_shape(1) | ||||
integer(c_int):: len | |||||
type(c_ptr) :: c_string | type(c_ptr) :: c_string | ||||
integer::l | integer::l | ||||
l = 30000 | l = 30000 | ||||
! print *,"reading data l=",l | |||||
c_string = getData_C(l) | |||||
! print *,"data read. l=",l | |||||
! len = int(c_len,kind=kind(len)) | |||||
string_shape(1) = l!int(l,kind=kind(Integer)) | string_shape(1) = l!int(l,kind=kind(Integer)) | ||||
print *,"reading data l=",l | |||||
if(.not. allocated(string)) then | if(.not. allocated(string)) then | ||||
print *,"allocate string" | print *,"allocate string" | ||||
allocate(character(l) :: string) | allocate(character(l) :: string) | ||||
endif | endif | ||||
len = l | |||||
c_string = getData_C(len) | |||||
! print *,"data read. l=",l | |||||
! len = int(c_len,kind=kind(len)) | |||||
call c_f_pointer(c_string, string, string_shape) | call c_f_pointer(c_string, string, string_shape) | ||||
c_string=c_null_ptr | c_string=c_null_ptr | ||||
string = trim(string) | |||||
! string = trim(string) | |||||
! print *,len_trim(string), "chars read." | ! print *,len_trim(string), "chars read." | ||||
! print *,string(1:l) | ! print *,string(1:l) | ||||
! getData2=string | ! getData2=string | ||||
END SUBROUTINE getData | END SUBROUTINE getData | ||||
! SUBROUTINE getData2(string) !result(string) | |||||
! use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr | |||||
! ! character(:),allocatable :: getData2 | |||||
! character(:),allocatable :: string | |||||
! integer :: string_shape(1) | |||||
! type(c_ptr) :: c_string | |||||
! integer::l | |||||
! ! print *,"reading data (getData2)" | |||||
! c_string = getData_C(l) | |||||
! ! string = c_str | |||||
! ! len = int(c_len,kind=kind(len)) | |||||
! string_shape(1) = l! int(l,kind=kind(integer)) | |||||
! if(.not. allocated(string)) allocate(character(l) :: string) | |||||
! call c_f_pointer(c_string, string, string_shape) | |||||
! c_string=c_null_ptr | |||||
! ! print *,len_trim(string), "chars read." | |||||
! ! print *,string(1:l) | |||||
! ! getData2=string | |||||
! END SUBROUTINE getData2 | |||||
SUBROUTINE getData2(string) !result(string) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_loc | |||||
! character(:),allocatable :: getData2 | |||||
character(len=:,kind=c_char),allocatable :: string | |||||
integer :: string_shape(1) | |||||
type(c_ptr) :: c_string | |||||
TYPE(FString), TARGET :: f_str | |||||
integer::l | |||||
! print *,"reading data (getData2)" | |||||
call getData_C_bystr(c_loc(f_str)) | |||||
! CALL MOVE_ALLOC(f_str%item, string) | |||||
string = trim(buffer) | |||||
! string = c_str | |||||
! len = int(c_len,kind=kind(len)) | |||||
! string_shape(1) = l! int(l,kind=kind(integer)) | |||||
! if(.not. allocated(string)) allocate(character(l) :: string) | |||||
! call c_f_pointer(c_string, string, string_shape) | |||||
! c_string=c_null_ptr | |||||
! print *,len_trim(string), "chars read." | |||||
! print *,string(1:l) | |||||
END SUBROUTINE getData2 | |||||
SUBROUTINE getData3(key,string) | |||||
use iso_c_binding, only: c_char,c_ptr,c_f_pointer,c_null_ptr,c_loc | |||||
! character(:),allocatable :: getData2 | |||||
character(len=*) :: key | |||||
character(len=:),allocatable :: string | |||||
character(len=100) :: filename | |||||
integer::iostat | |||||
! print *,"reading data (getData2)" | |||||
filename = "/var/tmp/"//key | |||||
call getData_C_byfile() | |||||
open(unit=10, file=trim(filename)//".txt", status='old', action='read', iostat=iostat) | |||||
if (iostat /= 0) then | |||||
write(*, '(A)', advance='no') "Failed to open the file." | |||||
stop | |||||
end if | |||||
! Read the content of the file into the string | |||||
read(10, '(A)', iostat=iostat) string | |||||
if (iostat /= 0) then | |||||
write(*, '(A)', advance='no') "Failed to read the file." | |||||
stop | |||||
end if | |||||
! Close the file | |||||
close(10) | |||||
END SUBROUTINE getData3 | |||||
SUBROUTINE set_fortran_string(fstring_ptr, length, str) BIND(C, NAME='set_fortran_string') | |||||
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_CHAR, C_INT, C_F_POINTER | |||||
TYPE(C_PTR), INTENT(IN), VALUE :: fstring_ptr | |||||
INTEGER(C_INT), INTENT(IN), VALUE :: length | |||||
CHARACTER(KIND=C_CHAR), INTENT(IN) :: str(length) | |||||
! Fortran pointer to the object referenced by fstring_ptr that | |||||
! holds the deferred length character component. | |||||
TYPE(FString), POINTER :: f_str | |||||
character(:),allocatable :: string | |||||
INTEGER :: i | |||||
integer :: string_shape(1) | |||||
!**** | |||||
! Associate the Fortran pointer with the object referenced by the | |||||
! C address. | |||||
string_shape(1) = length | |||||
allocate(character(length) :: string) | |||||
CALL C_F_POINTER(fstring_ptr, string,string_shape) | |||||
! Allocate the deferred length component to the given length. | |||||
! deallocate(f_str%item) | |||||
! ALLOCATE(CHARACTER(length) :: f_str%item) | |||||
! Copy over the data. | |||||
! FORALL (i=1:length) f_str%item(i:i) = str(i) | |||||
buffer(1:length) = string(1:length) | |||||
buffer(length+1:20000) = ' ' | |||||
END SUBROUTINE set_fortran_string | |||||
END Module RedisInterface | END Module RedisInterface |
@@ -5,6 +5,9 @@ | |||||
redisContext *context; | redisContext *context; | ||||
char *result,*key; | char *result,*key; | ||||
extern void set_fortran_string(void* fstring_ptr, int length, const char* str); | |||||
void addnums( int* a, int* b ) | void addnums( int* a, int* b ) | ||||
{ | { | ||||
int c = (*a) + (*b); /* convert pointers to values, then add them */ | int c = (*a) + (*b); /* convert pointers to values, then add them */ | ||||
@@ -54,18 +57,60 @@ void setData(char *part, char *data) | |||||
freeReplyObject(reply); | freeReplyObject(reply); | ||||
} | } | ||||
void getData_bystr(void *s) | |||||
{ | |||||
redisReply *reply; | |||||
reply = redisCommand(context, "GET %s.in",key); | |||||
// printf("strlen read from redis: %ld", strlen(reply->str)); | |||||
// strncpy(s,reply->str,strlen(reply->str)); | |||||
// printf("strlen read from redis: %ld", strlen(result)); | |||||
// printf("before free"); | |||||
freeReplyObject(reply); | |||||
// printf("after free"); | |||||
set_fortran_string(s, strlen(reply->str), reply->str); | |||||
return; | |||||
} | |||||
void getData_byfile() | |||||
{ | |||||
redisReply *reply; | |||||
reply = redisCommand(context, "GET %s.in",key); | |||||
char filename[100]; | |||||
sprintf(filename,"/var/tmp/%s.txt",key); | |||||
printf("filename=%s\n",filename); | |||||
FILE* file = fopen(filename, "w"); | |||||
if (file == NULL) { | |||||
printf("Failed to open the file.\n"); | |||||
return; | |||||
} | |||||
// Write a string to the file | |||||
const char* message = "Hello, world!"; | |||||
fprintf(file, "%s", message); | |||||
// Close the file | |||||
fclose(file); | |||||
freeReplyObject(reply); | |||||
printf("String written to file successfully.\n"); | |||||
return; | |||||
} | |||||
char *getData(int *len) | char *getData(int *len) | ||||
{ | { | ||||
redisReply *reply; | redisReply *reply; | ||||
// printf("reading data from redis (key=%s)\n",key); | // printf("reading data from redis (key=%s)\n",key); | ||||
reply = redisCommand(context, "GET %s.in",key); | reply = redisCommand(context, "GET %s.in",key); | ||||
// printf("data read from redis: %ld chars\n",strlen(reply->str)); | |||||
printf("data read from redis: %ld chars\n",strlen(reply->str)); | |||||
// printf("len(reply->str): %ld\n",strlen(reply->str)); | // printf("len(reply->str): %ld\n",strlen(reply->str)); | ||||
// result = (char*) malloc(strlen(reply->str)); | // result = (char*) malloc(strlen(reply->str)); | ||||
result = (char*) malloc(*len); | result = (char*) malloc(*len); | ||||
// printf("after malloc"); | // printf("after malloc"); | ||||
strcpy(result,reply->str); | strcpy(result,reply->str); | ||||
*len = strlen(result); | |||||
int paddingLength = (*len) - strlen(reply->str); | |||||
printf("len, padding length = %d, %d\n",*len,paddingLength); | |||||
if (paddingLength > 0) { | |||||
memset(result + strlen(reply->str), ' ', paddingLength-1); | |||||
// result[*len-1] = '\0'; | |||||
} | |||||
*len = strlen(reply->str); | |||||
// printf("before free"); | // printf("before free"); | ||||
freeReplyObject(reply); | freeReplyObject(reply); | ||||
// printf("after free"); | // printf("after free"); | ||||
@@ -0,0 +1,15 @@ | |||||
Bit Class H1 H2 H3 (w/d)max | |||||
11 , 1.9 , 7. , 1. , 7. | |||||
12 , 1.9 , 7. , 1. , 7. | |||||
13 , 1.84 , 6. , 0.8 , 8. | |||||
14 , 1.84 , 6. , 0.8 , 8. | |||||
21 , 1.8 , 5. , 0.6 , 8.5 | |||||
22 , 1.8 , 5. , 0.6 , 8.5 | |||||
23 , 1.76 , 4. , 0.48 , 9. | |||||
24 , 1.76 , 4. , 0.48 , 9. | |||||
31 , 1.7 , 3. , 0.36 , 10. | |||||
32 , 1.65 , 2. , 0.26 , 10. | |||||
33 , 1.6 , 2. , 0.2 , 10. | |||||
34 , 1.6 , 2. , 0.2 , 10. | |||||
41 , 1.5 , 2. , 0.18 , 10. | |||||
10 , 1.5 , 1. , 0.02 , 10. |
@@ -0,0 +1,78 @@ | |||||
# 1 "/home/admin/SimulationCore2/Rop/Bit_Specification.f90" | |||||
subroutine Bit_Specification | |||||
use sROP_Other_Variables | |||||
use sROP_Variables | |||||
use CStringConfigurationVariables | |||||
use SimulationVariables | |||||
implicit none | |||||
INTEGER :: io | |||||
integer :: i , BitClass_name | |||||
real(8) :: rd | |||||
!data%State%ROP_Spec%H1=1.9 | |||||
!data%State%ROP_Spec%H2=7. | |||||
!data%State%ROP_Spec%H3=1. | |||||
!data%State%ROP_Spec%wdmax=7. | |||||
data%State%ROP_Spec%BitClass = (data%Configuration%StringConfiguration%BitDefinition%BitCodeHundreds*100)+(data%Configuration%StringConfiguration%BitDefinition%BitCodeTens*10)+data%Configuration%StringConfiguration%BitDefinition%BitCodeOnes | |||||
rd = SNGL(data%State%ROP_Spec%BitClass)/10.d0 | |||||
data%State%ROP_Spec%BrCoef = ( (SNGL(data%State%ROP_Spec%BitClass)/10.d0)-(DINT(rd)) )*10.d0 | |||||
BitClass_name = (data%State%ROP_Spec%BitClass)/10 | |||||
if ( (any(BitClass_name==(/11,12,13,14,21,22,23,24,31,32,33,34,41/))) ) then | |||||
open(unit=233,file="Bit_Database.TXT") | |||||
READ (233,*) | |||||
DO i=1,13!(14-1(/=10)) | |||||
READ (233,*) data%State%ROP_Spec%name, data%State%ROP_Spec%H1, data%State%ROP_Spec%H2, data%State%ROP_Spec%H3, data%State%ROP_Spec%wdmax | |||||
if ( data%State%ROP_Spec%name==BitClass_name ) then | |||||
exit | |||||
end if | |||||
END DO | |||||
close (233) | |||||
else | |||||
data%State%ROP_Spec%H1=1.50d0 | |||||
data%State%ROP_Spec%H2=1.0d0 | |||||
data%State%ROP_Spec%H3=.020d0 | |||||
data%State%ROP_Spec%wdmax=10.0d0 | |||||
end if | |||||
!print*, 'data%State%ROP_Spec%H1=' , data%State%ROP_Spec%H1 | |||||
!print*, 'data%State%ROP_Spec%H2=' , data%State%ROP_Spec%H2 | |||||
!print*, 'data%State%ROP_Spec%H3=' , data%State%ROP_Spec%H3 | |||||
!print*, 'data%State%ROP_Spec%wdmax=' , data%State%ROP_Spec%wdmax | |||||
!print*, 'data%State%ROP_Spec%name=' , data%State%ROP_Spec%name | |||||
! filename = 'Bit_Database.TXT' | |||||
!open (UNIT=3, FILE=filename ) | |||||
!!print*, 'data%State%ROP_Spec%wdmax1=' , data%State%ROP_Spec%wdmax | |||||
! !print*, 'data%State%ROP_Spec%name1=' , data%State%ROP_Spec%name | |||||
!!openif: if ( data%State%ROP_Spec%status == 0 ) then | |||||
! read (3,*,IOSTAT=data%State%ROP_Spec%status) ! Get next value | |||||
! readloop: do i=1,14 | |||||
! read (3,*,IOSTAT=data%State%ROP_Spec%status) data%State%ROP_Spec%name, data%State%ROP_Spec%H1, data%State%ROP_Spec%H2, data%State%ROP_Spec%H3, data%State%ROP_Spec%wdmax ! Get next value | |||||
! !print*, 'data%State%ROP_Spec%wdmax=' , data%State%ROP_Spec%wdmax | |||||
! !print*, 'data%State%ROP_Spec%name=' , data%State%ROP_Spec%name | |||||
! if ( data%State%ROP_Spec%status /= 0 ) exit ! EXIT if not valid. | |||||
! if ( data%State%ROP_Spec%name == data%State%ROP_Spec%BitClass/10) exit | |||||
! end do readloop | |||||
!!endif openif | |||||
end subroutine |
@@ -0,0 +1,6 @@ | |||||
# 1 "/home/admin/SimulationCore2/Simulation/Constants.f90" | |||||
module Constants | |||||
real,parameter::PI=3.14159265 | |||||
REAL:: SG=1.12,WDENS=1000,GRAVITY=9.81,RE_CR=2000,NU=9e-6 | |||||
end module Constants |
@@ -0,0 +1,12 @@ | |||||
module logging | |||||
integer::log_level=0 | |||||
contains | |||||
subroutine logg(level,message) | |||||
integer::level | |||||
character(len=*)::message | |||||
if(log_level>=level) then | |||||
print *,message | |||||
endif | |||||
end subroutine | |||||
end module |
@@ -0,0 +1,13 @@ | |||||
# 1 "/home/admin/SimulationCore2/Simulation/logging.f90" | |||||
module logging | |||||
integer::log_level=0 | |||||
contains | |||||
subroutine logg(level,message) | |||||
integer::level | |||||
character(len=*)::message | |||||
if(log_level>=level) then | |||||
print *,message | |||||
endif | |||||
end subroutine | |||||
end module |
@@ -67,7 +67,9 @@ module Simulator | |||||
implicit none | implicit none | ||||
type(json_core):: jsoncore | type(json_core):: jsoncore | ||||
integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep | integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep | ||||
character(len=:),allocatable::redisInput,redisOutput | |||||
character(len=:),allocatable::redisInput | |||||
character(len=:),allocatable::redisOutput | |||||
character(len=100)::simulationId | |||||
enum, bind(c) | enum, bind(c) | ||||
enumerator :: PLAY = 1 | enumerator :: PLAY = 1 | ||||
enumerator :: PAUSE = 2 | enumerator :: PAUSE = 2 | ||||
@@ -76,7 +78,6 @@ module Simulator | |||||
end enum | end enum | ||||
contains | contains | ||||
FUNCTION time_ms() | FUNCTION time_ms() | ||||
INTEGER(8) :: time_ms | INTEGER(8) :: time_ms | ||||
integer,dimension(8)::timearray | integer,dimension(8)::timearray | ||||
@@ -90,7 +91,7 @@ module Simulator | |||||
integer::t0,t1,t2,t3,t_read=0,t_write=0,t_exec=0,i,status,redis_port,stepTime | integer::t0,t1,t2,t3,t_read=0,t_write=0,t_exec=0,i,status,redis_port,stepTime | ||||
integer(8),dimension(12)::t,t_modules | integer(8),dimension(12)::t,t_modules | ||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||
simulationId = sim_id | |||||
do i=1,size(t_modules) | do i=1,size(t_modules) | ||||
t_modules(i)=0 | t_modules(i)=0 | ||||
end do | end do | ||||
@@ -246,10 +247,11 @@ module Simulator | |||||
! end subroutine | ! end subroutine | ||||
subroutine write_variables() | subroutine write_variables() | ||||
use CAccumulator | |||||
! use CAccumulator | |||||
use json_module | use json_module | ||||
implicit none | implicit none | ||||
type(json_value),pointer :: jsonroot | type(json_value),pointer :: jsonroot | ||||
! character(len=:),allocatable::redisInput | |||||
character(len=10)::str | character(len=10)::str | ||||
call jsoncore%initialize() | call jsoncore%initialize() | ||||
@@ -283,7 +285,10 @@ module Simulator | |||||
type(json_value),pointer :: jsonroot,pval | type(json_value),pointer :: jsonroot,pval | ||||
type(json_file) :: jsonfile | type(json_file) :: jsonfile | ||||
type(json_core)::json | type(json_core)::json | ||||
call getData(redisOutput) | |||||
integer::len | |||||
! character(len=:),allocatable::redisOutput | |||||
! call getData3(simulationId,redisOutput) | |||||
call getData(redisOutput,len) | |||||
! print *,len(redisOutput)," bytes read from redis" | ! print *,len(redisOutput)," bytes read from redis" | ||||
open(1,file="redisContent.json",status="REPLACE") | open(1,file="redisContent.json",status="REPLACE") | ||||
write(1,"(A)") redisOutput | write(1,"(A)") redisOutput | ||||
@@ -291,7 +296,7 @@ module Simulator | |||||
call jsonfile%initialize() | call jsonfile%initialize() | ||||
call jsonfile%get_core(json) | call jsonfile%get_core(json) | ||||
call jsonfile%deserialize(redisOutput) | |||||
call jsonfile%deserialize(redisOutput(1:len)) | |||||
call jsonfile%json_file_get_root(jsonroot) | call jsonfile%json_file_get_root(jsonroot) | ||||
! call json%info(jsonvalue, n_children=n_children) | ! call json%info(jsonvalue, n_children=n_children) | ||||
! print *,"n_children =",n_children | ! print *,"n_children =",n_children | ||||
@@ -306,21 +311,23 @@ module Simulator | |||||
call ConfigurationFromJson(jsonfile) | call ConfigurationFromJson(jsonfile) | ||||
call jsonfile%destroy() | call jsonfile%destroy() | ||||
end subroutine | end subroutine | ||||
subroutine read_variables() | subroutine read_variables() | ||||
type(json_value),pointer :: jsonroot,pval | type(json_value),pointer :: jsonroot,pval | ||||
type(json_file) :: jsonfile | type(json_file) :: jsonfile | ||||
type(json_core)::json | type(json_core)::json | ||||
integer::stat | |||||
call getData(redisOutput) | |||||
! character(len=:),allocatable::redisOutput | |||||
integer::stat,leng | |||||
! call getData3(simulationId,redisOutput) | |||||
call getData(redisOutput,leng) | |||||
print *,len(redisOutput)," bytes read from redis" | print *,len(redisOutput)," bytes read from redis" | ||||
open(1,file="redisContent.json",status="REPLACE") | open(1,file="redisContent.json",status="REPLACE") | ||||
write(1,"(A)") redisOutput | write(1,"(A)") redisOutput | ||||
close(1) | close(1) | ||||
call jsonfile%initialize() | call jsonfile%initialize() | ||||
call jsonfile%get_core(json) | call jsonfile%get_core(json) | ||||
call jsonfile%deserialize(redisOutput) | |||||
print *,"len_trim(redidOutput)=",len_trim(redisOutput) | |||||
call jsonfile%deserialize(redisOutput(1:leng)) | |||||
call jsonfile%json_file_get_root(jsonroot) | call jsonfile%json_file_get_root(jsonroot) | ||||
! call json%info(jsonvalue, n_children=n_children) | ! call json%info(jsonvalue, n_children=n_children) | ||||
! print *,"n_children =",n_children | ! print *,"n_children =",n_children | ||||
@@ -68,7 +68,9 @@ module Simulator | |||||
implicit none | implicit none | ||||
type(json_core):: jsoncore | type(json_core):: jsoncore | ||||
integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep | integer :: simulationStatus,simulationSpeed,msPerStep,simulationEnd,simulationStep | ||||
character(len=:),allocatable::redisInput,redisOutput | |||||
character(len=:),allocatable::redisInput | |||||
character(len=:),allocatable::redisOutput | |||||
character(len=100)::simulationId | |||||
enum, bind(c) | enum, bind(c) | ||||
enumerator :: PLAY = 1 | enumerator :: PLAY = 1 | ||||
enumerator :: PAUSE = 2 | enumerator :: PAUSE = 2 | ||||
@@ -77,7 +79,6 @@ module Simulator | |||||
end enum | end enum | ||||
contains | contains | ||||
FUNCTION time_ms() | FUNCTION time_ms() | ||||
INTEGER(8) :: time_ms | INTEGER(8) :: time_ms | ||||
integer,dimension(8)::timearray | integer,dimension(8)::timearray | ||||
@@ -91,7 +92,7 @@ module Simulator | |||||
integer::t0,t1,t2,t3,t_read=0,t_write=0,t_exec=0,i,status,redis_port,stepTime | integer::t0,t1,t2,t3,t_read=0,t_write=0,t_exec=0,i,status,redis_port,stepTime | ||||
integer(8),dimension(12)::t,t_modules | integer(8),dimension(12)::t,t_modules | ||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||
simulationId = sim_id | |||||
do i=1,size(t_modules) | do i=1,size(t_modules) | ||||
t_modules(i)=0 | t_modules(i)=0 | ||||
end do | end do | ||||
@@ -247,10 +248,11 @@ module Simulator | |||||
! end subroutine | ! end subroutine | ||||
subroutine write_variables() | subroutine write_variables() | ||||
use CAccumulator | |||||
! use CAccumulator | |||||
use json_module | use json_module | ||||
implicit none | implicit none | ||||
type(json_value),pointer :: jsonroot | type(json_value),pointer :: jsonroot | ||||
! character(len=:),allocatable::redisInput | |||||
character(len=10)::str | character(len=10)::str | ||||
call jsoncore%initialize() | call jsoncore%initialize() | ||||
@@ -284,7 +286,10 @@ module Simulator | |||||
type(json_value),pointer :: jsonroot,pval | type(json_value),pointer :: jsonroot,pval | ||||
type(json_file) :: jsonfile | type(json_file) :: jsonfile | ||||
type(json_core)::json | type(json_core)::json | ||||
call getData(redisOutput) | |||||
integer::len | |||||
! character(len=:),allocatable::redisOutput | |||||
! call getData3(simulationId,redisOutput) | |||||
call getData(redisOutput,len) | |||||
! print *,len(redisOutput)," bytes read from redis" | ! print *,len(redisOutput)," bytes read from redis" | ||||
open(1,file="redisContent.json",status="REPLACE") | open(1,file="redisContent.json",status="REPLACE") | ||||
write(1,"(A)") redisOutput | write(1,"(A)") redisOutput | ||||
@@ -292,7 +297,7 @@ module Simulator | |||||
call jsonfile%initialize() | call jsonfile%initialize() | ||||
call jsonfile%get_core(json) | call jsonfile%get_core(json) | ||||
call jsonfile%deserialize(redisOutput) | |||||
call jsonfile%deserialize(redisOutput(1:len)) | |||||
call jsonfile%json_file_get_root(jsonroot) | call jsonfile%json_file_get_root(jsonroot) | ||||
! call json%info(jsonvalue, n_children=n_children) | ! call json%info(jsonvalue, n_children=n_children) | ||||
! print *,"n_children =",n_children | ! print *,"n_children =",n_children | ||||
@@ -307,21 +312,23 @@ module Simulator | |||||
call ConfigurationFromJson(jsonfile) | call ConfigurationFromJson(jsonfile) | ||||
call jsonfile%destroy() | call jsonfile%destroy() | ||||
end subroutine | end subroutine | ||||
subroutine read_variables() | subroutine read_variables() | ||||
type(json_value),pointer :: jsonroot,pval | type(json_value),pointer :: jsonroot,pval | ||||
type(json_file) :: jsonfile | type(json_file) :: jsonfile | ||||
type(json_core)::json | type(json_core)::json | ||||
integer::stat | |||||
call getData(redisOutput) | |||||
! character(len=:),allocatable::redisOutput | |||||
integer::stat,leng | |||||
! call getData3(simulationId,redisOutput) | |||||
call getData(redisOutput,leng) | |||||
print *,len(redisOutput)," bytes read from redis" | print *,len(redisOutput)," bytes read from redis" | ||||
open(1,file="redisContent.json",status="REPLACE") | open(1,file="redisContent.json",status="REPLACE") | ||||
write(1,"(A)") redisOutput | write(1,"(A)") redisOutput | ||||
close(1) | close(1) | ||||
call jsonfile%initialize() | call jsonfile%initialize() | ||||
call jsonfile%get_core(json) | call jsonfile%get_core(json) | ||||
call jsonfile%deserialize(redisOutput) | |||||
print *,"len_trim(redidOutput)=",len_trim(redisOutput) | |||||
call jsonfile%deserialize(redisOutput(1:leng)) | |||||
call jsonfile%json_file_get_root(jsonroot) | call jsonfile%json_file_get_root(jsonroot) | ||||
! call json%info(jsonvalue, n_children=n_children) | ! call json%info(jsonvalue, n_children=n_children) | ||||
! print *,"n_children =",n_children | ! print *,"n_children =",n_children | ||||
@@ -0,0 +1,122 @@ | |||||
# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_MainCalculations.f90" | |||||
subroutine TD_MainCalculations | |||||
Use CCasingLinerChokeVariables | |||||
Use CStringConfigurationVariables | |||||
! Use CSimulationVariables | |||||
Use TD_DrillStemComponents | |||||
use SimulationVariables !@ | |||||
use SimulationVariables !@ | |||||
use SimulationVariables !@ | |||||
Use TD_StringConnectionData | |||||
USE FricPressDropVarsModule | |||||
USE MudSystemVARIABLES | |||||
use SimulationVariables !@@@ | |||||
implicit none | |||||
Integer :: i | |||||
!Integer :: TD_SolDuration | |||||
!integer,dimension(8) :: TD_StartTime , TD_EndTime | |||||
data%State%TD_General%TimeStep = 0.1d0 ! Unit: [s] | |||||
!Call TD_StartUp | |||||
!Call TD_WellReadData | |||||
!Call TD_WellElementsReadData | |||||
!Call TD_DrillStemReadData | |||||
!Call TD_PipePropertiesReadData | |||||
!!Call TD_WellGeoConfiguration | |||||
!!Call TD_WellElementsConfiguration | |||||
!!Call TD_StringConnectionModes | |||||
!!Call TD_DrillStemConfiguration | |||||
!loop1: do | |||||
Call TD_WellGeoConfiguration | |||||
Call TD_WellElementsConfiguration | |||||
Call TD_StringConnectionModes | |||||
Call TD_DrillStemConfiguration | |||||
Call TD_ForceReadData | |||||
!===> Mud properties Read_Data from Fluid Module | |||||
!!TD_StringNoHorizontalMudElements = TDNoHorizontalMudElements | |||||
!!data%State%TD_String%NoStringMudElements = TDNoStringMudElements | |||||
!!data%State%TD_String%NoCasingMudElements = TDNoCasingMudElements | |||||
!! | |||||
!!if (allocated(TDDensity_MudElementArray) .and. (TD_StringNoHorizontalMudElements+data%State%TD_String%NoStringMudElements+data%State%TD_String%NoCasingMudElements)/=0) then | |||||
!! if (Allocated(data%State%TD_String%FluidMudDensity)) Deallocate(data%State%TD_String%FluidMudDensity) | |||||
!! Allocate(data%State%TD_String%FluidMudDensity(TD_StringNoHorizontalMudElements+data%State%TD_String%NoStringMudElements+data%State%TD_String%NoCasingMudElements)) | |||||
!! data%State%TD_String%FluidMudDensity(:) = TDDensity_MudElementArray(:) | |||||
!!end if | |||||
!! | |||||
!!if (allocated(TDXend_MudElementArray)) then | |||||
!! if (Allocated(data%State%TD_String%FluidMudEndX)) Deallocate(data%State%TD_String%FluidMudEndX) | |||||
!! Allocate(data%State%TD_String%FluidMudEndX(TD_StringNoHorizontalMudElements+data%State%TD_String%NoStringMudElements+data%State%TD_String%NoCasingMudElements)) | |||||
!! data%State%TD_String%FluidMudEndX(:) = TDXend_MudElementArray(:) | |||||
!!end if | |||||
!! | |||||
!!if (allocated(TDXstart_MudElementArray)) then | |||||
!! if (Allocated(data%State%TD_String%FluidMudStartX)) Deallocate(data%State%TD_String%FluidMudStartX) | |||||
!! Allocate(data%State%TD_String%FluidMudStartX(TD_StringNoHorizontalMudElements+data%State%TD_String%NoStringMudElements+data%State%TD_String%NoCasingMudElements)) | |||||
!! data%State%TD_String%FluidMudStartX(:) = TDXstart_MudElementArray(:) | |||||
!!end if | |||||
if (data%State%TD_DrillStem(1)%ComponentType==0) then | |||||
Do i = 2 , data%State%TD_String%DrillStemComponentsNumbs | |||||
Call TD_MudPropertiesReadData(i) | |||||
Call TD_BouyancyFactor(i) | |||||
Call TD_CombinedMotionData(i) | |||||
End Do | |||||
data%State%TD_DrillStems(1)%MudDensityIn = data%State%TD_DrillStems(2)%MudDensityIn !(1): bit mud properties | |||||
data%State%TD_DrillStems(1)%MudDensityOut = data%State%TD_DrillStems(2)%MudDensityOut | |||||
data%State%TD_DrillStems(1)%MudWeight = data%State%TD_DrillStems(2)%MudWeight | |||||
data%State%TD_DrillStems(1)%MudPlasticVis = 5.d0+(5.d0*(data%State%TD_DrillStems(1)%MudWeight-8.3d0)) | |||||
data%State%TD_DrillStems(1)%MudViscosity = 0.2d0 !data%State%TD_DrillStems(i)%MudPlasticVis | |||||
data%State%TD_DrillStems(1)%MudYieldPoint = 10.d0+(data%State%TD_DrillStems(1)%MudWeight-8.3d0) | |||||
Call TD_BouyancyFactor(1) | |||||
Call TD_CombinedMotionData(1) | |||||
else | |||||
Do i = 1 , data%State%TD_String%DrillStemComponentsNumbs | |||||
Call TD_MudPropertiesReadData(i) | |||||
Call TD_BouyancyFactor(i) | |||||
Call TD_CombinedMotionData(i) | |||||
End Do | |||||
end if | |||||
!================================================ | |||||
Call TD_BOPDiamCalculation | |||||
Call TD_StaticHookLoadCalculation | |||||
Call TD_WeightOnBitCalculation | |||||
if (abs(data%State%TD_String%DrillStemAxialVelocity)>3.2808d0) then !1[m/s]=3.2808[ft/s] | |||||
Call TD_ViscousDragForce | |||||
else | |||||
data%State%TD_DrillStems%Drag = 0.d0 | |||||
data%State%TD_String%DrillStemForceType = 5 | |||||
end if | |||||
Call TD_ForceCalculation | |||||
Call TD_HookLoadCalculation | |||||
data%State%TD_StConn%HookHeightOld = data%State%TD_StConn%HookHeight | |||||
end subroutine TD_MainCalculations |
@@ -0,0 +1,146 @@ | |||||
# 1 "/home/admin/SimulationCore2/TorqueDrag/TD_ReadDataSubroutines/TD_DrillStemReadData.f90" | |||||
subroutine TD_DrillStemReadData | |||||
use SimulationVariables | |||||
Use CStringConfigurationVariables | |||||
Use TD_DrillStemComponents | |||||
use SimulationVariables !@ | |||||
use SimulationVariables !@ | |||||
Use TD_StringConnectionData | |||||
! use ConfigurationVariables !@, only: Drawworks | |||||
implicit none | |||||
Integer :: i | |||||
Integer :: TD_FirstIndex , TD_LastIndex | |||||
!==================================================== | |||||
! Set Drill Stem Components Data | |||||
!==================================================== | |||||
data%State%TD_String%StringConfigurationCount = data%Configuration%StringConfiguration%StringConfigurationCount | |||||
data%State%TD_String%DrillStemComponentsNumbs = 0 | |||||
!########## data%State%TD_DrillStem%ComponentType :: | |||||
!#Bit_ComponentType = 0 | |||||
!#Stabilizer_ComponentType = 1 | |||||
!#Collar_ComponentType = 2 | |||||
!#DrillPipe_ComponentType = 3 | |||||
!#Heavyweight_ComponentType = 4 | |||||
!#IBOP = 5 | |||||
!#Kelly & SafetyValve (DrillMode) = 6 | |||||
!#SafetyValve (TripMode) = 7 | |||||
if (Allocated(data%State%TD_DrillStem)) deAllocate (data%State%TD_DrillStem) | |||||
Allocate (data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount+100)) | |||||
Do i=1, data%State%TD_String%StringConfigurationCount | |||||
data%State%TD_DrillStem(i)%ComponentType = data%Configuration%StringConfiguration%StringConfigurations(i)%ComponentType | |||||
data%State%TD_DrillStem(i)%Numbs = data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint | |||||
data%State%TD_DrillStem(i)%Id = data%Configuration%StringConfiguration%StringConfigurations(i)%NominalId/12.d0 ![ft] | |||||
data%State%TD_DrillStem(i)%Od = data%Configuration%StringConfiguration%StringConfigurations(i)%NominalOd/12.d0 ![ft] | |||||
data%State%TD_DrillStem(i)%Length = data%Configuration%StringConfiguration%StringConfigurations(i)%LengthPerJoint ![ft] | |||||
data%State%TD_DrillStem(i)%WeightperLength = data%Configuration%StringConfiguration%StringConfigurations(i)%WeightPerLength ![lb/ft] | |||||
data%State%TD_DrillStem(i)%TotalLength = data%Configuration%StringConfiguration%StringConfigurations(i)%ComponentLength | |||||
data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength | |||||
data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint | |||||
!!=========> Set Separated Drill Stem Components Data | |||||
! TD_LastIndex = TD_LastIndex+StringConfigurations(i)%NumberOfJoint | |||||
! | |||||
! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ComponentType = data%State%TD_DrillStem(i)%ComponentType | |||||
! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Id = data%State%TD_DrillStem(i)%Id | |||||
! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Od = data%State%TD_DrillStem(i)%Od | |||||
! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Length = data%State%TD_DrillStem(i)%Length | |||||
! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Weight = data%State%TD_DrillStem(i)%Weight | |||||
! | |||||
! TD_FirstIndex = TD_LastIndex+1 | |||||
End Do | |||||
!===> Initial Values of Removed-Volume Variables | |||||
if (data%State%TD_DrillStem(1)%ComponentType==0) then | |||||
data%State%TD_Vol%PreCount = data%State%TD_String%StringConfigurationCount-1 | |||||
else | |||||
data%State%TD_Vol%PreCount = data%State%TD_String%StringConfigurationCount | |||||
end if | |||||
data%State%TD_Vol%PreElementVolume = data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount)%TotalLength*(((pi*((data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount)%Id)**2))/4.d0)) ![ft^3] | |||||
data%State%TD_Vol%PreElementLength = data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount)%TotalLength | |||||
!==================================================== | |||||
! Set Separated Drill Stem Components Data | |||||
!==================================================== | |||||
TD_FirstIndex = 1 | |||||
TD_LastIndex = 0 | |||||
if (Allocated(data%State%TD_DrillStems)) deAllocate (data%State%TD_DrillStems) | |||||
Allocate (data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs+300)) ! +300: because of: Add or Remove DrillStem Components | |||||
Call TD_DrillStemStartUp | |||||
Do i=1, data%State%TD_String%StringConfigurationCount | |||||
TD_LastIndex = TD_LastIndex+data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ComponentType = data%State%TD_DrillStem(i)%ComponentType | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Id = data%State%TD_DrillStem(i)%Id | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Od = data%State%TD_DrillStem(i)%Od | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Area = (pi*((data%State%TD_DrillStem(i)%Od**2)-(data%State%TD_DrillStem(i)%Id**2)))/4.0d0 | |||||
if (data%State%TD_DrillStem(i)%ComponentType == 3 .or. data%State%TD_DrillStem(i)%ComponentType == 4) then | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = data%State%TD_DrillStem(i)%Od*1.30d0/2.0d0 | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = data%State%TD_String%ToolJointRange | |||||
else if (data%State%TD_DrillStem(i)%ComponentType == 1 .or. data%State%TD_DrillStem(i)%ComponentType == 2) then | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = data%State%TD_DrillStem(i)%Od/2.0d0 | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = data%State%TD_String%ToolJointRange | |||||
else if (data%State%TD_DrillStem(i)%ComponentType == 0) then | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = data%State%TD_DrillStem(i)%Od | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = 0.0d0 | |||||
end if | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Length = data%State%TD_DrillStem(i)%Length | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%LengthIni = data%State%TD_DrillStem(i)%Length | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%WeightperLength= data%State%TD_DrillStem(i)%WeightperLength | |||||
data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Weight = data%State%TD_DrillStem(i)%WeightperLength*data%State%TD_DrillStem(i)%Length | |||||
TD_FirstIndex = TD_LastIndex+1 | |||||
End Do | |||||
!==================================================== | |||||
! Set Hook Height Data | |||||
!==================================================== | |||||
data%State%TD_StConn%HookHeightOld = data%State%Drawworks%Hook_Height_ini | |||||
data%State%TD_StConn%HookHeight = data%State%TD_StConn%HookHeightOld | |||||
end subroutine |
@@ -0,0 +1 @@ | |||||
./SimulationCore2 aberama.iran.liara.ir 32815 4YKFnubfFFjfh4yTK7b0Rg9X 60f8144a-c1b7-4d1a-5d99-08db9e4e35f5 5 |