diff --git a/.ipynb_checkpoints/helper-checkpoint.ipynb b/.ipynb_checkpoints/helper-checkpoint.ipynb new file mode 100644 index 0000000..420b07f --- /dev/null +++ b/.ipynb_checkpoints/helper-checkpoint.ipynb @@ -0,0 +1,557 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[' real(8) :: AnnularRegulatorSetControl\\n',\n", + " ' real(8) :: AirMasterValve\\n',\n", + " ' real(8) :: ByePassValve\\n',\n", + " ' real(8) :: AnnularValve\\n',\n", + " ' real(8) :: UpperRamsValve\\n',\n", + " ' real(8) :: MiddleRamsValve\\n',\n", + " ' real(8) :: KillLineValve\\n',\n", + " ' real(8) :: ChokeLineValve\\n',\n", + " ' real(8) :: LowerRamsValve\\n',\n", + " ' real(8) :: ManifoldPressureGauge\\n',\n", + " ' real(8) :: AirSupplyPressureGauge\\n',\n", + " ' real(8) :: AccumulatorPressureGauge\\n',\n", + " ' real(8) :: AnnularPressureGauge\\n',\n", + " ' integer :: AnnularOpenLED\\n',\n", + " ' integer :: AnnularCloseLED\\n',\n", + " ' integer :: UpperRamsOpenLED\\n',\n", + " ' integer :: UpperRamsCloseLED\\n',\n", + " ' integer :: MiddleRamsOpenLED\\n',\n", + " ' integer :: MiddleRamsCloseLED\\n',\n", + " ' integer :: KillLineOpenLED\\n',\n", + " ' integer :: KillLineCloseLED\\n',\n", + " ' integer :: ChokeLineOpenLED\\n',\n", + " ' integer :: ChokeLineCloseLED\\n',\n", + " ' integer :: LowerRamsOpenLED\\n',\n", + " ' integer :: LowerRamsCloseLED\\n',\n", + " ' real(8) :: AnnularStatus\\n',\n", + " ' real(8) :: UpperRamsStatus\\n',\n", + " ' real(8) :: MiddleRamsStatus\\n',\n", + " ' real(8) :: LowerRamsStatus']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lines" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "call json%add(p,\"TopDriveTdsPowerState\",data%Equipments%ControlPanel%CTopDrive%TopDriveTdsPowerState)\n", + "call json%add(p,\"TopDriveTorqueWrench\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueWrench)\n", + "call json%add(p,\"TopDriveDrillTorqueState\",data%Equipments%ControlPanel%CTopDrive%TopDriveDrillTorqueState)\n", + "call json%add(p,\"TopDriveLinkTiltState\",data%Equipments%ControlPanel%CTopDrive%TopDriveLinkTiltState)\n", + "call json%add(p,\"TopDriveIbop\",data%Equipments%ControlPanel%CTopDrive%TopDriveIbop)\n", + "call json%add(p,\"TopDriveTorqueLimitKnob\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueLimitKnob)\n", + "call json%add(p,\"RpmKnob\",data%Equipments%ControlPanel%CTopDrive%RpmKnob)\n", + "call json%add(p,\"TopDriveOperationFaultLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveOperationFaultLed)\n", + "call json%add(p,\"TopDriveTdsPowerLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveTdsPowerLed)\n", + "call json%add(p,\"TopDriveTorqueWrenchLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueWrenchLed)\n", + "call json%add(p,\"TopDriveLinkTiltLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveLinkTiltLed)\n", + "call json%add(p,\"TopDriveIbopLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveIbopLed)\n", + "call json%add(p,\"TopDriveTorqueLimitGauge\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueLimitGauge)\n", + "call json%add(p,\"TopDriveTorqueGauge\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueGauge)\n", + "call json%add(p,\"TopDriveRpmGauge\",data%Equipments%ControlPanel%CTopDrive%TopDriveRpmGauge)\n" + ] + } + ], + "source": [ + "precode = \"\"\"call json%add(pform,\"\",data%Equipments%ControlPanel%CTopDrive%\"\"\"\n", + "input = open(\"Text1.txt\")\n", + "lines = input.readlines()\n", + "for line in lines:\n", + " name = line.split(\"::\")[-1].strip()\n", + " icoute = precode.index(\"\\\"\")+1\n", + " # name = line.split(\"%\")[-1][:-1]\n", + " # print(name)\n", + " newline = precode[:icoute]+name+precode[icoute:]+name+\")\"\n", + " print(newline)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\tGeo/GeoMain.f90 \\\n", + "\n" + ] + } + ], + "source": [ + "##Replace space with _ in filenames and list them for put them in makefile\n", + "import os\n", + "dir = 'Geo'\n", + "files = os.listdir(dir)\n", + "fstring = ''\n", + "for f in files:\n", + " if f.endswith('90'):\n", + " newf = f.replace(' ','_')\n", + " os.rename(os.path.join(dir,f),os.path.join(dir,newf))\n", + " if newf.lower().endswith('variables.f90'):\n", + " fstring = '\\t'+os.path.join(dir,newf).replace('\\\\','/') +' \\\\\\n' + fstring\n", + " else:\n", + " fstring = fstring + '\\t'+os.path.join(dir,newf).replace('\\\\','/') +' \\\\\\n'\n", + "\n", + "print(fstring)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Extract variable names from definition lines" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "# %pwd\n", + "lines = input(\"Enter lines:\").split(\" \")\n", + "lines = [l.strip() for l in lines if len(l.strip())>0]\n", + "vars = []\n", + "for l in lines:\n", + " if '::' in l:\n", + " vars.append(l.split('::')[1].strip())" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import string\n", + "string.ascii_letters" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "var: AnnularRegulatorSetControl\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AirMasterValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: ByePassValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AnnularValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: UpperRamsValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: MiddleRamsValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: KillLineValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: ChokeLineValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: LowerRamsValve\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: ManifoldPressureGauge\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AirSupplyPressureGauge\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AccumulatorPressureGauge\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AnnularPressureGauge\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AnnularOpenLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AnnularCloseLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: UpperRamsOpenLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: UpperRamsCloseLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: MiddleRamsOpenLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: MiddleRamsCloseLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: KillLineOpenLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: KillLineCloseLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: ChokeLineOpenLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: ChokeLineCloseLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: LowerRamsOpenLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: LowerRamsCloseLED\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: AnnularStatus\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: UpperRamsStatus\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: MiddleRamsStatus\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n", + "var: LowerRamsStatus\n", + "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n", + "Char before: \n", + "Char after: \n", + "\n" + ] + } + ], + "source": [ + "import os\n", + "import sys\n", + "import re\n", + "dir = '.'\n", + "varNameChars = string.ascii_letters + '_'\n", + "log = open(os.path.join(dir,'ReplaceVars.log',),'a')\n", + "end=False\n", + "for dir,subdirs,files in os.walk(dir):\n", + " for filename in files:\n", + " if filename.lower().endswith('.f90'):\n", + " # print(filename)\n", + " file = open(os.path.join(dir,filename))\n", + " code = file.read()\n", + " for var in vars:\n", + " if var not in code:\n", + " continue\n", + " occurs = [m.start() for m in re.finditer(var, code)]\n", + " for occurance in occurs:\n", + " if code[occurs[0]-1] in varNameChars or code[occurs[0]+len(var)] in varNameChars:\n", + " continue\n", + " print(f\"var: {var}\")\n", + " print(f\"file = {os.path.join(dir,filename)}\")\n", + " print(f\"Char before: {code[occurs[0]-1]}\")\n", + " print(f\"Char after: {code[occurs[0]+len(var)]}\")\n", + " end = True\n", + " if end:\n", + " break" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "State\n", + "Hoisting\n", + "OperationScenario\n", + "notifications\n", + "permissions\n", + "unitySignals\n", + "StudentStation\n", + "BopStackInput\n", + "BopStackAcc\n", + "RamLine\n", + "AnnularComputational\n", + "Annular\n", + "PipeRam1\n", + "ShearRam\n", + "PipeRam2\n", + "ChokeLine\n", + "KillLine\n", + "Pumps\n", + "RAM\n", + "RAMS\n", + "Choke\n", + "AirDrivenPump\n", + "AirPumpLine\n", + "CHOOKE\n", + "Drawworks\n", + "MudSystem\n", + "MUD\n", + "PUMP\n", + "RTable\n", + "TDS\n", + "GasType(3)\n", + "PressureDisplay\n", + "ObservationPoint(:)\n", + "FricPressDrop\n", + "ROP_Spec\n", + "ROP_Bit\n", + "TDGeo\n", + "F_String(:)\n", + "F_Counts\n", + "F_Interval(:)\n", + "OD_Annulus(4)\n", + "TD_DrillStem\n", + "TD_DrillStems\n", + "TD_String\n", + "TD_Count\n", + "G_StringElement\n", + "TD_Vol\n", + "TD_General\n", + "TD_BOP\n", + "TD_BOPElement(4)\n", + "TD_StConn\n", + "TD_Load\n", + "TD_WellEl\n", + "TD_Casing\n", + "data%State%TD_Liner\n", + "TD_OpenHole\n", + "TD_ROPHole\n", + "TD_WellGeneral\n", + "TD_WellGeo(:)\n", + "EquipmentControl\n", + "BopControlPanel\n", + "ChokeControlPanel\n", + "ChokeManifold\n", + "DataDisplayConsole\n", + "DrillingConsole\n", + "Hook\n", + "StandPipeManifold\n", + "TopDrivePanel\n", + "DrillingWatch\n", + "Tank\n", + "Configuration\n", + "StringConfiguration\n", + "Formation\n", + "Reservoir\n", + "Shoe\n", + "Accumulator\n", + "BopStackSpecification\n", + "Hoisting\n", + "Power\n", + "PumpsSpecification\n", + "RigSize\n", + "CasingLinerChoke\n", + "PathGeneration\n", + "WellSurveyData\n", + "MudProperties\n", + "problems\n", + "BitProblems\n", + "BopProblems\n", + "ChokeProblems\n", + "DrillStemProblems\n", + "GaugesProblems\n", + "HoistingProblems\n", + "KickProblems\n", + "LostProblems\n", + "MudTreatmentProblems\n", + "OtherProblems\n", + "PumpProblems\n", + "RotaryProblems\n" + ] + }, + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32mc:\\Projects\\VSIM\\SimulationCore2\\helper.ipynb Cell 6\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m nsp\u001b[39m+\u001b[39m\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m\n\u001b[0;32m 7\u001b[0m splits \u001b[39m=\u001b[39m line\u001b[39m.\u001b[39msplit(\u001b[39m\"\u001b[39m\u001b[39m::\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m----> 8\u001b[0m \u001b[39mprint\u001b[39m(splits[\u001b[39m1\u001b[39;49m]\u001b[39m.\u001b[39mstrip())\n", + "\u001b[1;31mIndexError\u001b[0m: list index out of range" + ] + } + ], + "source": [ + "f = open(\"hier.txt\")\n", + "lines = f.readlines()\n", + "for line in lines[1:]:\n", + " nsp=0\n", + " while line[nsp]==' ':\n", + " nsp+=1\n", + " splits = line.split(\"::\")\n", + " print(splits[1].strip())" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'type SimulationDataType type(SimulationStateType)::State Type(HoistingType)::Hoisting type(OperationScenarioType)::OperationScenario type(NotificationType)::notifications type(PermissionsType):: permissions type(UnitySignalsType):: unitySignals type(StudentStationType)::StudentStation type(BopStackInputType)::BopStackInput type(BopStackAccType)::BopStackAcc type(RamLineType)::RamLine type(AnnularComputationalType)::AnnularComputational type(AnnularType)::Annular type(PipeRams1Type)::PipeRam1 type(ShearRamType)::ShearRam type(PipeRam2Type)::PipeRam2 type(ChokeLineType)::ChokeLine type(KillLineType)::KillLine type(PumpsType)::Pumps TYPE(BOP_TypeVars), DIMENSION(1:6) :: RAM TYPE(BOP_TypeVars2D) :: RAMS type(ChokeType)::Choke type(AirDrivenPumpType)::AirDrivenPump type(AirPumpLineType)::AirPumpLine TYPE(CHOKE_TypeVars), DIMENSION(1:2) :: CHOOKE TYPE(Drawworks_Var) :: Drawworks type(MudSystemType)::MudSystem TYPE(MUD_TypeVars), DIMENSION(1:10) :: MUD TYPE(Pump_Var), DIMENSION(1:3) :: PUMP TYPE(RTable_Var) :: RTable TYPE(TDS_Var) :: TDS TYPE(GasData) :: GasType(3) ! 1 = methane , 2 = Hydrogen sulfide , 3 = Carbon dioxid TYPE(PressureDisplayVARIABLESTYPE) :: PressureDisplay TYPE(ObservationAndGaugePointsInformations) , ALLOCATABLE :: ObservationPoint(:) TYPE(FricPressDropVarsTYPE) :: FricPressDrop TYPE(ROPSpecificationInfo) :: ROP_Spec TYPE(ROPInfo) :: ROP_Bit TYPE(Geo_Data) :: TDGeo TYPE(F_StringData) , Allocatable :: F_String(:) TYPE(F_IntervalsCountsData):: F_Counts TYPE(F_IntervalData) , Allocatable :: F_Interval(:) TYPE(OD_AnnulusData) :: OD_Annulus(4) TYPE(TD_DrillStemInfo), ALLOCATABLE, DIMENSION(:) :: TD_DrillStem TYPE(TD_SeparatedDrillStemInfo), ALLOCATABLE, DIMENSION(:) :: TD_DrillStems TYPE(TD_StringInfo) :: TD_String TYPE(TD_AddRemoveInfo) :: TD_Count TYPE(CStringComponents), ALLOCATABLE, DIMENSION(:) :: G_StringElement TYPE(TD_RemovedVolumeInfo) :: TD_Vol TYPE(TD_GeneralInfo) :: TD_General TYPE(TD_BOPInfo) :: TD_BOP TYPE(CBopElement) :: TD_BOPElement(4) TYPE(TD_StringconnectionInfo) :: TD_StConn TYPE(TD_LoadInfo) :: TD_Load TYPE(TD_WellElementsInfo) :: TD_WellEl TYPE(TD_CasingInfo), ALLOCATABLE, DIMENSION(:) :: TD_Casing TYPE(TD_LinerInfo), ALLOCATABLE, DIMENSION(:) :: data%State%TD_Liner TYPE(TD_OpenHoleInfo), ALLOCATABLE, DIMENSION(:) :: TD_OpenHole TYPE(TD_ROPHoleInfo), ALLOCATABLE, DIMENSION(:) :: TD_ROPHole TYPE(TD_WellGeneralInfo) :: TD_WellGeneral TYPE(TD_WellGeometryData), Allocatable :: TD_WellGeo(:) type(EquipmentControlType)::EquipmentControl type(BopControlPanelType) :: BopControlPanel Type(ChokeControlPanelType)::ChokeControlPanel Type(ChokeManifoldType)::ChokeManifold Type(DataDisplayConsoleType) :: DataDisplayConsole TYPE(DrillingConsoleType) :: DrillingConsole Type(HookType)::Hook type(StandPipeManifoldType)::StandPipeManifold Type(TopDrivePanelType)::TopDrivePanel Type(DrillingWatchType)::DrillingWatch Type(TankType)::Tank type(ConfigurationType)::Configuration Type(StringConfigurationType)::StringConfiguration Type(FormationType) :: Formation Type(ReservoirType)::Reservoir Type(ShoeType)::Shoe Type(AccumulatorType)::Accumulator Type(BopStackSpecificationType)::BopStackSpecification Type(HoistingType)::Hoisting Type(PowerType)::Power Type(PumpSpecificationType)::PumpsSpecification Type(RigSizeType)::RigSize Type(CasingLinerChokeType)::CasingLinerChoke Type(PathGenerationType)::PathGeneration Type(WellSurveyDataType)::WellSurveyData Type(MudPropertiesType)::MudProperties type(ProblemsType)::problems type(BitProblemsType)::BitProblems type(BopProblemsType)::BopProblems type(ChokeProblemsType)::ChokeProblems type(DrillStemProblemsType)::DrillStemProblems type(GaugesProblemsType)::GaugesProblems type(HoistingProblemsType):: HoistingProblems type(KickProblemsType)::KickProblems type(LostProblemsType)::LostProblems type(MudTreatmentProblemsType)::MudTreatmentProblems type(OtherProblemsType)::OtherProblems type(PumpProblemsType)::PumpProblems type(RotaryProblemsType)::RotaryProblems end type SimulationDataType'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "line" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for fn in modules:\n", + " f = open(fn)\n", + " lines = f.readlines()\n", + " module_filenames = {}\n", + " used_modules = []\n", + " mod_count = 0\n", + " for l in lines:\n", + " l = l.strip().lower()\n", + " if l.startswith('module ') and not l.startswith('module procedure '):\n", + " mod_name = l.split(' ')[1]\n", + " module_filenames[mod_name] = fn\n", + " mod_count +=1\n", + " if l.startswith('use'):\n", + " used_modules.append(l.split(' ')[1])\n", + " if mod_count !=1:\n", + " print(f\"{fn} has {mod_count} modules\")\n", + " module_filenames,used_modules" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + }, + "vscode": { + "interpreter": { + "hash": "1ef4a26de7183d96d6da1045a38581e0a15b2215d0c1b98c7b273c6e514c6c7e" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 b/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 index 7d263fe..5dd4d95 100644 --- a/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 +++ b/CSharp/BasicInputs/WellProfile/CPathGeneration.f90 @@ -1,3 +1,4 @@ +<<<<<<< HEAD module CPathGeneration use SimulationVariables !@ use json_module @@ -42,4 +43,31 @@ module CPathGeneration call json%add(parent,ppath) end subroutine +======= +module CPathGeneration + use SimulationVariables !@ + use json_module + implicit none + public + contains + + subroutine PathGenerationToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'Path') + + ! 2. add member of data type to new node + ! call StringConfigurationToJson(p) + ! call FormationToJson(p) + ! call json%add(p,"",data%Configuration%Formation%Formations(i)%Abrasiveness) + + ! 3. add new node to parent + call json%add(parent,p) + end subroutine + +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 end module CPathGeneration \ No newline at end of file diff --git a/CSharp/Equipments/ControlPanels/CBopControlPanel.f90 b/CSharp/Equipments/ControlPanels/CBopControlPanel.f90 index f03d5de..19e2753 100644 --- a/CSharp/Equipments/ControlPanels/CBopControlPanel.f90 +++ b/CSharp/Equipments/ControlPanels/CBopControlPanel.f90 @@ -1,87 +1,129 @@ -module CBopControlPanel - ! use CBopControlPanel - use SimulationVariables - implicit none - public - contains - - ! subroutine BopControlPanelToJson(parent) - - ! end subroutine - subroutine OpenAnnular() - use CManifolds - implicit none - call ChangeValve(52, .true.) - end subroutine - - subroutine CloseAnnular() - use CManifolds - implicit none - call ChangeValve(52, .false.) - end subroutine - - subroutine OpenUpperRams() - use CManifolds - implicit none - call ChangeValve(51, .true.) - end subroutine - - subroutine CloseUpperRams() - use CManifolds - implicit none - call ChangeValve(51, .false.) - end subroutine - - subroutine OpenMiddleRams() - use CManifolds - implicit none - call ToggleMiddleRams(.true.) - end subroutine - - subroutine CloseMiddleRams() - use CManifolds - implicit none - call ToggleMiddleRams(.false.) - end subroutine - - subroutine OpenKillLine() - use CManifolds - implicit none - call ChangeValve(46, .true.) - end subroutine - - subroutine CloseKillLine() - use CManifolds - implicit none - call ChangeValve(46, .false.) - end subroutine - - subroutine OpenChokeLine() - use CManifolds - implicit none - call ChangeValve(47, .true.) - !WRITE (*,*) ' valve 47 true ' - end subroutine - - subroutine CloseChokeLine() - use CManifolds - implicit none - call ChangeValve(47, .false.) - !WRITE (*,*) ' valve 47 false ' - end subroutine - - subroutine OpenLowerRams() - use CManifolds - implicit none - call ChangeValve(49, .true.) - !WRITE (*,*) ' valve 49 true ' - end subroutine - - subroutine CloseLowerRams() - use CManifolds - implicit none - call ChangeValve(49, .false.) - !WRITE (*,*) ' valve 49 false ' - end subroutine - - end module CBopControlPanel +module CBopControlPanel + ! use CBopControlPanel + use SimulationVariables + implicit none + public + contains + + subroutine CBopToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CBop') + + call json%add(p,"AnnularRegulatorSetControl",data%Equipments%ContolPanel%CBop%AnnularRegulatorSetControl) + call json%add(p,"AirMasterValve",data%Equipments%ContolPanel%CBop%AirMasterValve) + call json%add(p,"ByePassValve",data%Equipments%ContolPanel%CBop%ByePassValve) + call json%add(p,"AnnularValve",data%Equipments%ContolPanel%CBop%AnnularValve) + call json%add(p,"UpperRamsValve",data%Equipments%ContolPanel%CBop%UpperRamsValve) + call json%add(p,"MiddleRamsValve",data%Equipments%ContolPanel%CBop%MiddleRamsValve) + call json%add(p,"KillLineValve",data%Equipments%ContolPanel%CBop%KillLineValve) + call json%add(p,"ChokeLineValve",data%Equipments%ContolPanel%CBop%ChokeLineValve) + call json%add(p,"LowerRamsValve",data%Equipments%ContolPanel%CBop%LowerRamsValve) + call json%add(p,"ManifoldPressureGauge",data%Equipments%ContolPanel%CBop%ManifoldPressureGauge) + call json%add(p,"AirSupplyPressureGauge",data%Equipments%ContolPanel%CBop%AirSupplyPressureGauge) + call json%add(p,"AccumulatorPressureGauge",data%Equipments%ContolPanel%CBop%AccumulatorPressureGauge) + call json%add(p,"AnnularPressureGauge",data%Equipments%ContolPanel%CBop%AnnularPressureGauge) + call json%add(p,"AnnularOpenLED",data%Equipments%ContolPanel%CBop%AnnularOpenLED) + call json%add(p,"AnnularCloseLED",data%Equipments%ContolPanel%CBop%AnnularCloseLED) + call json%add(p,"UpperRamsOpenLED",data%Equipments%ContolPanel%CBop%UpperRamsOpenLED) + call json%add(p,"UpperRamsCloseLED",data%Equipments%ContolPanel%CBop%UpperRamsCloseLED) + call json%add(p,"MiddleRamsOpenLED",data%Equipments%ContolPanel%CBop%MiddleRamsOpenLED) + call json%add(p,"MiddleRamsCloseLED",data%Equipments%ContolPanel%CBop%MiddleRamsCloseLED) + call json%add(p,"KillLineOpenLED",data%Equipments%ContolPanel%CBop%KillLineOpenLED) + call json%add(p,"KillLineCloseLED",data%Equipments%ContolPanel%CBop%KillLineCloseLED) + call json%add(p,"ChokeLineOpenLED",data%Equipments%ContolPanel%CBop%ChokeLineOpenLED) + call json%add(p,"ChokeLineCloseLED",data%Equipments%ContolPanel%CBop%ChokeLineCloseLED) + call json%add(p,"LowerRamsOpenLED",data%Equipments%ContolPanel%CBop%LowerRamsOpenLED) + call json%add(p,"LowerRamsCloseLED",data%Equipments%ContolPanel%CBop%LowerRamsCloseLED) + call json%add(p,"AnnularStatus",data%Equipments%ContolPanel%CBop%AnnularStatus) + call json%add(p,"UpperRamsStatus",data%Equipments%ContolPanel%CBop%UpperRamsStatus) + call json%add(p,"MiddleRamsStatus",data%Equipments%ContolPanel%CBop%MiddleRamsStatus) + call json%add(p,"LowerRamsStatus",data%Equipments%ContolPanel%CBop%LowerRamsStatus) + + + call json%add(parent,p) + end subroutine + + + + subroutine OpenAnnular() + use CManifolds + implicit none + call ChangeValve(52, .true.) + end subroutine + + subroutine CloseAnnular() + use CManifolds + implicit none + call ChangeValve(52, .false.) + end subroutine + + subroutine OpenUpperRams() + use CManifolds + implicit none + call ChangeValve(51, .true.) + end subroutine + + subroutine CloseUpperRams() + use CManifolds + implicit none + call ChangeValve(51, .false.) + end subroutine + + subroutine OpenMiddleRams() + use CManifolds + implicit none + call ToggleMiddleRams(.true.) + end subroutine + + subroutine CloseMiddleRams() + use CManifolds + implicit none + call ToggleMiddleRams(.false.) + end subroutine + + subroutine OpenKillLine() + use CManifolds + implicit none + call ChangeValve(46, .true.) + end subroutine + + subroutine CloseKillLine() + use CManifolds + implicit none + call ChangeValve(46, .false.) + end subroutine + + subroutine OpenChokeLine() + use CManifolds + implicit none + call ChangeValve(47, .true.) + !WRITE (*,*) ' valve 47 true ' + end subroutine + + subroutine CloseChokeLine() + use CManifolds + implicit none + call ChangeValve(47, .false.) + !WRITE (*,*) ' valve 47 false ' + end subroutine + + subroutine OpenLowerRams() + use CManifolds + implicit none + call ChangeValve(49, .true.) + !WRITE (*,*) ' valve 49 true ' + end subroutine + + subroutine CloseLowerRams() + use CManifolds + implicit none + call ChangeValve(49, .false.) + !WRITE (*,*) ' valve 49 false ' + end subroutine + + end module CBopControlPanel diff --git a/CSharp/Equipments/ControlPanels/CChokeControlPanel.f90 b/CSharp/Equipments/ControlPanels/CChokeControlPanel.f90 index bec639c..d8e8fe5 100644 --- a/CSharp/Equipments/ControlPanels/CChokeControlPanel.f90 +++ b/CSharp/Equipments/ControlPanels/CChokeControlPanel.f90 @@ -1,162 +1,189 @@ -module CChokeControlPanel - use CChokeControlPanelVariables - use SimulationVariables - implicit none - public - contains - - ! Input routines - subroutine SetChokePanelPumpSelectorSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetChokePanelPumpSelectorSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetChokePanelPumpSelectorSwitch' :: SetChokePanelPumpSelectorSwitch - implicit none - integer, intent(in) :: v - data%EquipmentControl%ChokeControlPanel%ChokePanelPumpSelectorSwitch = v -#ifdef deb - print*, 'ChokePanelPumpSelectorSwitch=', data%EquipmentControl%ChokeControlPanel%ChokePanelPumpSelectorSwitch -#endif - end subroutine - - subroutine SetChokePanelStrokeResetSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetChokePanelStrokeResetSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetChokePanelStrokeResetSwitch' :: SetChokePanelStrokeResetSwitch - implicit none - logical, intent(in) :: v - data%EquipmentControl%ChokeControlPanel%ChokePanelStrokeResetSwitch = v -#ifdef deb - print*, 'ChokePanelStrokeResetSwitch=', data%EquipmentControl%ChokeControlPanel%ChokePanelStrokeResetSwitch -#endif - end subroutine - - subroutine SetChokeSelectorSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetChokeSelectorSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetChokeSelectorSwitch' :: SetChokeSelectorSwitch - implicit none - logical, intent(in) :: v - data%EquipmentControl%ChokeControlPanel%ChokeSelectorSwitch = v -#ifdef deb - print*, 'ChokeSelectorSwitch=', data%EquipmentControl%ChokeControlPanel%ChokeSelectorSwitch -#endif - end subroutine - - subroutine SetChokeRateControlKnob(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetChokeRateControlKnob - !DEC$ ATTRIBUTES ALIAS: 'SetChokeRateControlKnob' :: SetChokeRateControlKnob - implicit none - real*8, intent(in) :: v - - !character(8) :: date - !character(10) :: time - !character(5) :: zone - !integer,dimension(8) :: values - - data%EquipmentControl%ChokeControlPanel%ChokeRateControlKnob = v -#ifdef deb - !call date_and_time(date,time,zone,values) - !!print '(a,2x,a,2x,a)', date, time, zone - !print '(8i5)', values - print*, 'ChokeRateControlKnob=', data%EquipmentControl%ChokeControlPanel%ChokeRateControlKnob -#endif - end subroutine - - subroutine SetChokeControlLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetChokeControlLever - !DEC$ ATTRIBUTES ALIAS: 'SetChokeControlLever' :: SetChokeControlLever - implicit none - real*8, intent(in) :: v - data%EquipmentControl%ChokeControlPanel%ChokeControlLever = v -#ifdef deb - print*, 'ChokeControlLever=', data%EquipmentControl%ChokeControlPanel%ChokeControlLever -#endif - end subroutine - - subroutine SetChokePanelRigAirSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetChokePanelRigAirSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetChokePanelRigAirSwitch' :: SetChokePanelRigAirSwitch - implicit none - logical, intent(in) :: v - data%EquipmentControl%ChokeControlPanel%ChokePanelRigAirSwitch = v -#ifdef deb - print*, 'ChokePanelRigAirSwitch=', data%EquipmentControl%ChokeControlPanel%ChokePanelRigAirSwitch -#endif - end subroutine - - - subroutine SetEnableAutoChoke(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetEnableAutoChoke - !DEC$ ATTRIBUTES ALIAS: 'SetEnableAutoChoke' :: SetEnableAutoChoke - implicit none - logical, intent(in) :: v - data%EquipmentControl%ChokeControlPanel%EnableAutoChoke = v -#ifdef deb - print*, 'EnableAutoChoke=', data%EquipmentControl%ChokeControlPanel%EnableAutoChoke -#endif - end subroutine - - - - - - - - - - - - - ! Output routines - real(8) function GetStandPipePressure() - !DEC$ ATTRIBUTES DLLEXPORT :: GetStandPipePressure - !DEC$ ATTRIBUTES ALIAS: 'GetStandPipePressure' :: GetStandPipePressure - implicit none - GetStandPipePressure = data%EquipmentControl%ChokeControlPanel%StandPipePressure - end function - - real(8) function GetCasingPressure() - !DEC$ ATTRIBUTES DLLEXPORT :: GetCasingPressure - !DEC$ ATTRIBUTES ALIAS: 'GetCasingPressure' :: GetCasingPressure - implicit none - GetCasingPressure = data%EquipmentControl%ChokeControlPanel%CasingPressure - end function - - real(8) function GetChokePosition() - !DEC$ ATTRIBUTES DLLEXPORT :: GetChokePosition - !DEC$ ATTRIBUTES ALIAS: 'GetChokePosition' :: GetChokePosition - implicit none - GetChokePosition = data%EquipmentControl%ChokeControlPanel%ChokePosition - end function - - real(8) function GetChokePanelSPMCounter() - !DEC$ ATTRIBUTES DLLEXPORT :: GetChokePanelSPMCounter - !DEC$ ATTRIBUTES ALIAS: 'GetChokePanelSPMCounter' :: GetChokePanelSPMCounter - implicit none - !GetChokePanelSPMCounter = 0 - GetChokePanelSPMCounter = data%EquipmentControl%ChokeControlPanel%ChokePanelSPMCounter - end function - - real(8) function GetChokePanelTotalStrokeCounter() - !DEC$ ATTRIBUTES DLLEXPORT :: GetChokePanelTotalStrokeCounter - !DEC$ ATTRIBUTES ALIAS: 'GetChokePanelTotalStrokeCounter' :: GetChokePanelTotalStrokeCounter - implicit none - !GetChokePanelTotalStrokeCounter = 0 - GetChokePanelTotalStrokeCounter = data%EquipmentControl%ChokeControlPanel%ChokePanelTotalStrokeCounter - end function - - integer function GetChoke1LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetChoke1LED - !DEC$ ATTRIBUTES ALIAS: 'GetChoke1LED' :: GetChoke1LED - implicit none - GetChoke1LED = data%EquipmentControl%ChokeControlPanel%Choke1LED - end function - - integer function GetChoke2LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetChoke2LED - !DEC$ ATTRIBUTES ALIAS: 'GetChoke2LED' :: GetChoke2LED - implicit none - GetChoke2LED = data%EquipmentControl%ChokeControlPanel%Choke2LED - end function - - - - +module CChokeControlPanel + use CChokeControlPanelVariables + use SimulationVariables + implicit none + public + contains + + subroutine CChokeToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CChoke') + call json%add(p,"ChokePanelPumpSelectorSwitch",data%Equipments%ContolPanel%CChoke%ChokePanelPumpSelectorSwitch) + call json%add(p,"ChokePanelStrokeResetSwitch",data%Equipments%ContolPanel%CChoke%ChokePanelStrokeResetSwitch) + call json%add(p,"ChokeSelectorSwitch",data%Equipments%ContolPanel%CChoke%ChokeSelectorSwitch) + call json%add(p,"ChokeRateControlKnob",data%Equipments%ContolPanel%CChoke%ChokeRateControlKnob) + call json%add(p,"ChokeControlLever",data%Equipments%ContolPanel%CChoke%ChokeControlLever) + call json%add(p,"ChokePanelRigAirSwitch",data%Equipments%ContolPanel%CChoke%ChokePanelRigAirSwitch) + call json%add(p,"EnableAutoChoke",data%Equipments%ContolPanel%CChoke%EnableAutoChoke) + call json%add(p,"StandPipePressure",data%Equipments%ContolPanel%CChoke%StandPipePressure) + call json%add(p,"CasingPressure",data%Equipments%ContolPanel%CChoke%CasingPressure) + call json%add(p,"ChokePosition",data%Equipments%ContolPanel%CChoke%ChokePosition) + call json%add(p,"ChokePanelSPMCounter",data%Equipments%ContolPanel%CChoke%ChokePanelSPMCounter) + call json%add(p,"ChokePanelTotalStrokeCounter",data%Equipments%ContolPanel%CChoke%ChokePanelTotalStrokeCounter) + call json%add(p,"Choke1LED",data%Equipments%ContolPanel%CChoke%Choke1LED) + call json%add(p,"Choke2LED",data%Equipments%ContolPanel%CChoke%Choke2LED) + + + call json%add(parent,p) + end subroutine + + ! Input routines + subroutine SetChokePanelPumpSelectorSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetChokePanelPumpSelectorSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetChokePanelPumpSelectorSwitch' :: SetChokePanelPumpSelectorSwitch + implicit none + integer, intent(in) :: v + data%EquipmentControl%ChokeControlPanel%ChokePanelPumpSelectorSwitch = v +#ifdef deb + print*, 'ChokePanelPumpSelectorSwitch=', data%EquipmentControl%ChokeControlPanel%ChokePanelPumpSelectorSwitch +#endif + end subroutine + + subroutine SetChokePanelStrokeResetSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetChokePanelStrokeResetSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetChokePanelStrokeResetSwitch' :: SetChokePanelStrokeResetSwitch + implicit none + logical, intent(in) :: v + data%EquipmentControl%ChokeControlPanel%ChokePanelStrokeResetSwitch = v +#ifdef deb + print*, 'ChokePanelStrokeResetSwitch=', data%EquipmentControl%ChokeControlPanel%ChokePanelStrokeResetSwitch +#endif + end subroutine + + subroutine SetChokeSelectorSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetChokeSelectorSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetChokeSelectorSwitch' :: SetChokeSelectorSwitch + implicit none + logical, intent(in) :: v + data%EquipmentControl%ChokeControlPanel%ChokeSelectorSwitch = v +#ifdef deb + print*, 'ChokeSelectorSwitch=', data%EquipmentControl%ChokeControlPanel%ChokeSelectorSwitch +#endif + end subroutine + + subroutine SetChokeRateControlKnob(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetChokeRateControlKnob + !DEC$ ATTRIBUTES ALIAS: 'SetChokeRateControlKnob' :: SetChokeRateControlKnob + implicit none + real*8, intent(in) :: v + + !character(8) :: date + !character(10) :: time + !character(5) :: zone + !integer,dimension(8) :: values + + data%EquipmentControl%ChokeControlPanel%ChokeRateControlKnob = v +#ifdef deb + !call date_and_time(date,time,zone,values) + !!print '(a,2x,a,2x,a)', date, time, zone + !print '(8i5)', values + print*, 'ChokeRateControlKnob=', data%EquipmentControl%ChokeControlPanel%ChokeRateControlKnob +#endif + end subroutine + + subroutine SetChokeControlLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetChokeControlLever + !DEC$ ATTRIBUTES ALIAS: 'SetChokeControlLever' :: SetChokeControlLever + implicit none + real*8, intent(in) :: v + data%EquipmentControl%ChokeControlPanel%ChokeControlLever = v +#ifdef deb + print*, 'ChokeControlLever=', data%EquipmentControl%ChokeControlPanel%ChokeControlLever +#endif + end subroutine + + subroutine SetChokePanelRigAirSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetChokePanelRigAirSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetChokePanelRigAirSwitch' :: SetChokePanelRigAirSwitch + implicit none + logical, intent(in) :: v + data%EquipmentControl%ChokeControlPanel%ChokePanelRigAirSwitch = v +#ifdef deb + print*, 'ChokePanelRigAirSwitch=', data%EquipmentControl%ChokeControlPanel%ChokePanelRigAirSwitch +#endif + end subroutine + + + subroutine SetEnableAutoChoke(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetEnableAutoChoke + !DEC$ ATTRIBUTES ALIAS: 'SetEnableAutoChoke' :: SetEnableAutoChoke + implicit none + logical, intent(in) :: v + data%EquipmentControl%ChokeControlPanel%EnableAutoChoke = v +#ifdef deb + print*, 'EnableAutoChoke=', data%EquipmentControl%ChokeControlPanel%EnableAutoChoke +#endif + end subroutine + + + + + + + + + + + + + ! Output routines + real(8) function GetStandPipePressure() + !DEC$ ATTRIBUTES DLLEXPORT :: GetStandPipePressure + !DEC$ ATTRIBUTES ALIAS: 'GetStandPipePressure' :: GetStandPipePressure + implicit none + GetStandPipePressure = data%EquipmentControl%ChokeControlPanel%StandPipePressure + end function + + real(8) function GetCasingPressure() + !DEC$ ATTRIBUTES DLLEXPORT :: GetCasingPressure + !DEC$ ATTRIBUTES ALIAS: 'GetCasingPressure' :: GetCasingPressure + implicit none + GetCasingPressure = data%EquipmentControl%ChokeControlPanel%CasingPressure + end function + + real(8) function GetChokePosition() + !DEC$ ATTRIBUTES DLLEXPORT :: GetChokePosition + !DEC$ ATTRIBUTES ALIAS: 'GetChokePosition' :: GetChokePosition + implicit none + GetChokePosition = data%EquipmentControl%ChokeControlPanel%ChokePosition + end function + + real(8) function GetChokePanelSPMCounter() + !DEC$ ATTRIBUTES DLLEXPORT :: GetChokePanelSPMCounter + !DEC$ ATTRIBUTES ALIAS: 'GetChokePanelSPMCounter' :: GetChokePanelSPMCounter + implicit none + !GetChokePanelSPMCounter = 0 + GetChokePanelSPMCounter = data%EquipmentControl%ChokeControlPanel%ChokePanelSPMCounter + end function + + real(8) function GetChokePanelTotalStrokeCounter() + !DEC$ ATTRIBUTES DLLEXPORT :: GetChokePanelTotalStrokeCounter + !DEC$ ATTRIBUTES ALIAS: 'GetChokePanelTotalStrokeCounter' :: GetChokePanelTotalStrokeCounter + implicit none + !GetChokePanelTotalStrokeCounter = 0 + GetChokePanelTotalStrokeCounter = data%EquipmentControl%ChokeControlPanel%ChokePanelTotalStrokeCounter + end function + + integer function GetChoke1LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetChoke1LED + !DEC$ ATTRIBUTES ALIAS: 'GetChoke1LED' :: GetChoke1LED + implicit none + GetChoke1LED = data%EquipmentControl%ChokeControlPanel%Choke1LED + end function + + integer function GetChoke2LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetChoke2LED + !DEC$ ATTRIBUTES ALIAS: 'GetChoke2LED' :: GetChoke2LED + implicit none + GetChoke2LED = data%EquipmentControl%ChokeControlPanel%Choke2LED + end function + + + + end module CChokeControlPanel \ No newline at end of file diff --git a/CSharp/Equipments/ControlPanels/CChokeManifold.f90 b/CSharp/Equipments/ControlPanels/CChokeManifold.f90 index 8c2cd01..bea8250 100644 --- a/CSharp/Equipments/ControlPanels/CChokeManifold.f90 +++ b/CSharp/Equipments/ControlPanels/CChokeManifold.f90 @@ -1,41 +1,75 @@ -module CChokeManifold -! use CChokeManifoldVariables - use SimulationVariables - use CManifolds - use CLog2 - implicit none - public - contains - subroutine SetHydraulicChock1(v) - implicit none - integer, intent(in) :: v - data%EquipmentControl%ChokeManifold%HydraulicChock1 = v - if(data%EquipmentControl%ChokeManifold%HyChock1OnProblem) then - call ChangeValve(33, .true.) - else - if(v == 100) then - if(Manifold%Valve(33)%Status) call ChangeValve(33, .false.) - else - if(.not.Manifold%Valve(33)%Status) call ChangeValve(33, .true.) - endif - endif - !WRITE (*,*) ' valve 33 ', Valve(33)%Status, ' arg ', v -end subroutine - -subroutine SetHydraulicChock2(v) - implicit none - integer, intent(in) :: v - data%EquipmentControl%ChokeManifold%HydraulicChock2 = v - if(data%EquipmentControl%ChokeManifold%HyChock2OnProblem) then - call ChangeValve(34, .true.) - else - if(v==100) then - if(Manifold%Valve(34)%Status) call ChangeValve(34, .false.) - else - if(.not.Manifold%Valve(34)%Status) call ChangeValve(34, .true.) - endif - endif - !WRITE (*,*) ' valve 34 ', Valve(34)%Status, ' arg ', v -end subroutine - +module CChokeManifold +! use CChokeManifoldVariables + use SimulationVariables + use CManifolds + use CLog2 + implicit none + public + contains + + subroutine CChokeManifoldToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CChokeManifold') + call json%add(p,"ChokeManifoldValve1",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve1) + call json%add(p,"ChokeManifoldValve2",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve2) + call json%add(p,"LeftManualChoke",data%Equipments%ContolPanel%CChokeManifold%LeftManualChoke) + call json%add(p,"ChokeManifoldValve4",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve4) + call json%add(p,"ChokeManifoldValve5",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve5) + call json%add(p,"RightManualChoke",data%Equipments%ContolPanel%CChokeManifold%RightManualChoke) + call json%add(p,"ChokeManifoldValve7",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve7) + call json%add(p,"ChokeManifoldValve8",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve8) + call json%add(p,"ChokeManifoldValve9",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve9) + call json%add(p,"ChokeManifoldValve10",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve10) + call json%add(p,"ChokeManifoldValve11",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve11) + call json%add(p,"ChokeManifoldValve12",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve12) + call json%add(p,"ChokeManifoldValve13",data%Equipments%ContolPanel%CChokeManifold%ChokeManifoldValve13) + call json%add(p,"HydraulicChock1",data%Equipments%ContolPanel%CChokeManifold%HydraulicChock1) + call json%add(p,"HydraulicChock2",data%Equipments%ContolPanel%CChokeManifold%HydraulicChock2) + call json%add(p,"HyChock1OnProblem",data%Equipments%ContolPanel%CChokeManifold%HyChock1OnProblem) + call json%add(p,"HyChock2OnProblem",data%Equipments%ContolPanel%CChokeManifold%HyChock2OnProblem) + call json%add(p,"LeftManChokeOnProblem",data%Equipments%ContolPanel%CChokeManifold%LeftManChokeOnProblem) + call json%add(p,"RightManChokeOnProblem",data%Equipments%ContolPanel%CChokeManifold%RightManChokeOnProblem) + + + + call json%add(parent,p) + end subroutine + + subroutine SetHydraulicChock1(v) + implicit none + integer, intent(in) :: v + data%EquipmentControl%ChokeManifold%HydraulicChock1 = v + if(data%EquipmentControl%ChokeManifold%HyChock1OnProblem) then + call ChangeValve(33, .true.) + else + if(v == 100) then + if(Manifold%Valve(33)%Status) call ChangeValve(33, .false.) + else + if(.not.Manifold%Valve(33)%Status) call ChangeValve(33, .true.) + endif + endif + !WRITE (*,*) ' valve 33 ', Valve(33)%Status, ' arg ', v +end subroutine + +subroutine SetHydraulicChock2(v) + implicit none + integer, intent(in) :: v + data%EquipmentControl%ChokeManifold%HydraulicChock2 = v + if(data%EquipmentControl%ChokeManifold%HyChock2OnProblem) then + call ChangeValve(34, .true.) + else + if(v==100) then + if(Manifold%Valve(34)%Status) call ChangeValve(34, .false.) + else + if(.not.Manifold%Valve(34)%Status) call ChangeValve(34, .true.) + endif + endif + !WRITE (*,*) ' valve 34 ', Valve(34)%Status, ' arg ', v +end subroutine + end module CChokeManifold \ No newline at end of file diff --git a/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 b/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 index a8c5679..784e0d8 100644 --- a/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 +++ b/CSharp/Equipments/ControlPanels/CDataDisplayConsole.f90 @@ -1,153 +1,250 @@ -module CDataDisplayConsole - ! use CDataDisplayConsole - use SimulationVariables - implicit none - public - contains - subroutine Set_TotalDepth(v) - use SimulationVariables !@!!, only: data%EquipmentControl%DrillingWatch%Depth - ! use CSimulationVariables, only: SetDistanceDrilled - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%TotalWellDepth = v - data%EquipmentControl%DrillingWatch%Depth = v - ! call SetDistanceDrilled(v) - end subroutine - - subroutine Set_BitPosition(v) - use SimulationVariables !@!!, only: data%EquipmentControl%DrillingWatch%BitPosition - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%BitDepth = v - data%EquipmentControl%DrillingWatch%BitPosition = v - end subroutine - - subroutine Set_RotaryTorque(v) - use SimulationVariables !@!!, only: data%EquipmentControl%DrillingWatch%Torque - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%RotaryTorqueGauge = v - data%EquipmentControl%DrillingWatch%Torque = v - data%EquipmentControl%DataDisplayConsole%RTTorque = v - end subroutine - - - subroutine Set_MudWeightIn(v) - use SimulationVariables !@!, only: MudWeightInDw => data%EquipmentControl%DataDisplayConsole%MudWeightIn - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%MudWeightIn = v - data%EquipmentControl%DrillingWatch%MudWeightIn = v - end subroutine - - subroutine Set_MudWeightOut(v) - use SimulationVariables !@!, only: MudWeightOutDw => data%EquipmentControl%DataDisplayConsole%MudWeightOut - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%MudWeightOut = v - data%EquipmentControl%DrillingWatch%MudWeightOut = v - end subroutine - - subroutine Set_TripTankVolume(v) - use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%TripTankVolume - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DrillingWatch%TripTankVolume = v - end subroutine - - subroutine Set_FillVolume(v) - use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%FillVolume - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DrillingWatch%FillVolume = v - end subroutine - - subroutine Set_HookLoad(v) - use SimulationVariables !@!, only: HookLoadDw => data%EquipmentControl%DataDisplayConsole%HookLoad - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%HookLoadPointer = v - data%EquipmentControl%DrillingWatch%HookLoad = v * 1000 - data%EquipmentControl%DataDisplayConsole%HookLoad = v - end subroutine - - subroutine Set_WeightOnBit(v) - use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%WeightOnBit - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%WOBPointer = v - data%EquipmentControl%DrillingWatch%WeightOnBit = v - data%EquipmentControl%DataDisplayConsole%WOP = v - end subroutine - - subroutine Set_ROP(v) - use SimulationVariables !@!, only: ROPDw => data%EquipmentControl%DataDisplayConsole%ROP - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%ROP = v - data%EquipmentControl%DrillingWatch%ROP = v - end subroutine - - subroutine Set_CasingPressure(v) - use SimulationVariables !@!, only: CasingPressureDw => CasingPressure - use CChokeControlPanelVariables - use SimulationVariables!, only: CasingPressureChoke => CasingPressure - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%CasingPressureGauge = v - data%EquipmentControl%DrillingWatch%CasingPressure = v - data%EquipmentControl%ChokeControlPanel%CasingPressure = v - data%EquipmentControl%DataDisplayConsole%CasingPressure = v - end subroutine - - subroutine Set_StandPipePressure(v) - use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%PumpPressure - use CChokeControlPanelVariables - use SimulationVariables!, only: StandPipePressureChoke => data%EquipmentControl%DataDisplayConsole%StandPipePressure - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%StandPipePressureGauge = v - data%EquipmentControl%DrillingWatch%PumpPressure = v - data%EquipmentControl%ChokeControlPanel%StandPipePressure = v - data%EquipmentControl%DataDisplayConsole%StandPipePressure = v - - - - end subroutine - - - subroutine Set_RotaryRPMGauge(v) - use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%RPM - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%RotaryRPMGauge = v - data%EquipmentControl%DrillingWatch%RPM = v - data%EquipmentControl%DataDisplayConsole%RTRPM = v - ! call data%EquipmentControl%DataDisplayConsole%OnRotaryRpmChange%RunAll(v) - end subroutine - - - - - subroutine Set_MP1SPMGauge(v) - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%MP1SPMGauge = v - data%EquipmentControl%DataDisplayConsole%MP1SPM = v - !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%EquipmentControl%DataDisplayConsole%MP1SPMGauge, data%EquipmentControl%DataDisplayConsole%MP2SPMGauge) -#ifdef deb - print*, 'MP1SPMGauge=', data%EquipmentControl%DataDisplayConsole%MP1SPMGauge -#endif - end subroutine - - subroutine Set_MP2SPMGauge(v) - implicit none - real(8), intent(in) :: v - data%EquipmentControl%DataDisplayConsole%MP2SPMGauge = v - data%EquipmentControl%DataDisplayConsole%MP2SPM = v - !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%EquipmentControl%DataDisplayConsole%MP1SPMGauge, data%EquipmentControl%DataDisplayConsole%MP2SPMGauge) -#ifdef deb - print*, 'MP2SPMGauge=', data%EquipmentControl%DataDisplayConsole%MP2SPMGauge -#endif - end subroutine +module CDataDisplayConsole + ! use CDataDisplayConsole + use SimulationVariables + implicit none + public + contains + + subroutine CDataDisplayToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CDataDisplay') + call json%add(p,"TripAlarmLow",data%Equipments%ControlPanel%CDataDisplay%TripAlarmLow) + call json%add(p,"TripAlarmHigh",data%Equipments%ControlPanel%CDataDisplay%TripAlarmHigh) + call json%add(p,"RetFlowAlarmLow",data%Equipments%ControlPanel%CDataDisplay%RetFlowAlarmLow) + call json%add(p,"RetFlowAlarmHigh",data%Equipments%ControlPanel%CDataDisplay%RetFlowAlarmHigh) + call json%add(p,"PitAlarmLow",data%Equipments%ControlPanel%CDataDisplay%PitAlarmLow) + call json%add(p,"PitAlarmHigh",data%Equipments%ControlPanel%CDataDisplay%PitAlarmHigh) + call json%add(p,"PortWeightOnBit",data%Equipments%ControlPanel%CDataDisplay%PortWeightOnBit) + call json%add(p,"PortHookLoad",data%Equipments%ControlPanel%CDataDisplay%PortHookLoad) + call json%add(p,"PortCasingPressure",data%Equipments%ControlPanel%CDataDisplay%PortCasingPressure) + call json%add(p,"PortPumpPressure",data%Equipments%ControlPanel%CDataDisplay%PortPumpPressure) + call json%add(p,"TripTankSetAlarmLow",data%Equipments%ControlPanel%CDataDisplay%TripTankSetAlarmLow) + call json%add(p,"TripTankSetAlarmHigh",data%Equipments%ControlPanel%CDataDisplay%TripTankSetAlarmHigh) + call json%add(p,"TripTankSetAlarmSwitch",data%Equipments%ControlPanel%CDataDisplay%TripTankSetAlarmSwitch) + call json%add(p,"TripTankPowerSwitch",data%Equipments%ControlPanel%CDataDisplay%TripTankPowerSwitch) + call json%add(p,"TripTankPumpSwitch",data%Equipments%ControlPanel%CDataDisplay%TripTankPumpSwitch) + call json%add(p,"TripTankHornSwitch",data%Equipments%ControlPanel%CDataDisplay%TripTankHornSwitch) + call json%add(p,"AcidGasDetectionHornSwitch",data%Equipments%ControlPanel%CDataDisplay%AcidGasDetectionHornSwitch) + call json%add(p,"TotalStrokeCounterResetSwitch",data%Equipments%ControlPanel%CDataDisplay%TotalStrokeCounterResetSwitch) + call json%add(p,"DrillingTrippingSelectorSwitch",data%Equipments%ControlPanel%CDataDisplay%DrillingTrippingSelectorSwitch) + call json%add(p,"MVTSetAlarmLowKnob",data%Equipments%ControlPanel%CDataDisplay%MVTSetAlarmLowKnob) + call json%add(p,"MVTSetAlarmHighKnob",data%Equipments%ControlPanel%CDataDisplay%MVTSetAlarmHighKnob) + call json%add(p,"MVTSetAlarmSwitch",data%Equipments%ControlPanel%CDataDisplay%MVTSetAlarmSwitch) + call json%add(p,"MudTank1Switch",data%Equipments%ControlPanel%CDataDisplay%MudTank1Switch) + call json%add(p,"MudTank2Switch",data%Equipments%ControlPanel%CDataDisplay%MudTank2Switch) + call json%add(p,"MudTank3Switch",data%Equipments%ControlPanel%CDataDisplay%MudTank3Switch) + call json%add(p,"MudTank4Switch",data%Equipments%ControlPanel%CDataDisplay%MudTank4Switch) + call json%add(p,"MVTFineKnob",data%Equipments%ControlPanel%CDataDisplay%MVTFineKnob) + call json%add(p,"MVTCoarseKnob",data%Equipments%ControlPanel%CDataDisplay%MVTCoarseKnob) + call json%add(p,"MVTHornSwitch",data%Equipments%ControlPanel%CDataDisplay%MVTHornSwitch) + call json%add(p,"MVTDeviationTripSelectionSwitch",data%Equipments%ControlPanel%CDataDisplay%MVTDeviationTripSelectionSwitch) + call json%add(p,"MVTPowerSwitch",data%Equipments%ControlPanel%CDataDisplay%MVTPowerSwitch) + call json%add(p,"MFFIResetTotalStrokes",data%Equipments%ControlPanel%CDataDisplay%MFFIResetTotalStrokes) + call json%add(p,"MFFIResetFillCounter",data%Equipments%ControlPanel%CDataDisplay%MFFIResetFillCounter) + call json%add(p,"MFFIPumpSelectorSwitch",data%Equipments%ControlPanel%CDataDisplay%MFFIPumpSelectorSwitch) + call json%add(p,"MFFIFillSPMSelectorSwitch",data%Equipments%ControlPanel%CDataDisplay%MFFIFillSPMSelectorSwitch) + call json%add(p,"MFFISetAlarmLowKnob",data%Equipments%ControlPanel%CDataDisplay%MFFISetAlarmLowKnob) + call json%add(p,"MFFISetAlarmHighKnob",data%Equipments%ControlPanel%CDataDisplay%MFFISetAlarmHighKnob) + call json%add(p,"MFFISetAlarmSwitch",data%Equipments%ControlPanel%CDataDisplay%MFFISetAlarmSwitch) + call json%add(p,"MFFIPowerSwitch",data%Equipments%ControlPanel%CDataDisplay%MFFIPowerSwitch) + call json%add(p,"MFFIHornSwitch",data%Equipments%ControlPanel%CDataDisplay%MFFIHornSwitch) + call json%add(p,"ResetWob",data%Equipments%ControlPanel%CDataDisplay%ResetWob) + call json%add(p,"Clutch",data%Equipments%ControlPanel%CDataDisplay%Clutch) + call json%add(p,"WOBPointer",data%Equipments%ControlPanel%CDataDisplay%WOBPointer) + call json%add(p,"HookLoadPointer",data%Equipments%ControlPanel%CDataDisplay%HookLoadPointer) + call json%add(p,"TripTankGauge",data%Equipments%ControlPanel%CDataDisplay%TripTankGauge) + call json%add(p,"TripTankAlarmLED",data%Equipments%ControlPanel%CDataDisplay%TripTankAlarmLED) + call json%add(p,"TripTankPumpLED",data%Equipments%ControlPanel%CDataDisplay%TripTankPumpLED) + call json%add(p,"StandPipePressureGauge",data%Equipments%ControlPanel%CDataDisplay%StandPipePressureGauge) + call json%add(p,"CasingPressureGauge",data%Equipments%ControlPanel%CDataDisplay%CasingPressureGauge) + call json%add(p,"MP1SPMGauge",data%Equipments%ControlPanel%CDataDisplay%MP1SPMGauge) + call json%add(p,"MP2SPMGauge",data%Equipments%ControlPanel%CDataDisplay%MP2SPMGauge) + call json%add(p,"ReturnLineTempGauge",data%Equipments%ControlPanel%CDataDisplay%ReturnLineTempGauge) + call json%add(p,"RotaryTorqueGauge",data%Equipments%ControlPanel%CDataDisplay%RotaryTorqueGauge) + call json%add(p,"RotaryRPMGauge",data%Equipments%ControlPanel%CDataDisplay%RotaryRPMGauge) + call json%add(p,"AcidGasDetectionLED",data%Equipments%ControlPanel%CDataDisplay%AcidGasDetectionLED) + call json%add(p,"TotalStrokeCounter",data%Equipments%ControlPanel%CDataDisplay%TotalStrokeCounter) + call json%add(p,"TotalStrokeCounter_temp",data%Equipments%ControlPanel%CDataDisplay%TotalStrokeCounter_temp) + call json%add(p,"PitGainLossGauge",data%Equipments%ControlPanel%CDataDisplay%PitGainLossGauge) + call json%add(p,"MudTanksVolumeGauge",data%Equipments%ControlPanel%CDataDisplay%MudTanksVolumeGauge) + call json%add(p,"MVTAlarmLED",data%Equipments%ControlPanel%CDataDisplay%MVTAlarmLED) + call json%add(p,"ReturnMudFlowGauge",data%Equipments%ControlPanel%CDataDisplay%ReturnMudFlowGauge) + call json%add(p,"FillStrokeCounter",data%Equipments%ControlPanel%CDataDisplay%FillStrokeCounter) + call json%add(p,"MFFITotalStrokeCounter",data%Equipments%ControlPanel%CDataDisplay%MFFITotalStrokeCounter) + call json%add(p,"MFFIAlarmLED",data%Equipments%ControlPanel%CDataDisplay%MFFIAlarmLED) + call json%add(p,"MFFIPumpLED",data%Equipments%ControlPanel%CDataDisplay%MFFIPumpLED) + call json%add(p,"TotalWellDepth",data%Equipments%ControlPanel%CDataDisplay%TotalWellDepth) + call json%add(p,"BitDepth",data%Equipments%ControlPanel%CDataDisplay%BitDepth) + call json%add(p,"HookLoad",data%Equipments%ControlPanel%CDataDisplay%HookLoad) + call json%add(p,"StandPipePressure",data%Equipments%ControlPanel%CDataDisplay%StandPipePressure) + call json%add(p,"CasingPressure",data%Equipments%ControlPanel%CDataDisplay%CasingPressure) + call json%add(p,"MP1SPM",data%Equipments%ControlPanel%CDataDisplay%MP1SPM) + call json%add(p,"MP2SPM",data%Equipments%ControlPanel%CDataDisplay%MP2SPM) + call json%add(p,"RTTorque",data%Equipments%ControlPanel%CDataDisplay%RTTorque) + call json%add(p,"RTRPM",data%Equipments%ControlPanel%CDataDisplay%RTRPM) + call json%add(p,"WOP",data%Equipments%ControlPanel%CDataDisplay%WOP) + call json%add(p,"ROP",data%Equipments%ControlPanel%CDataDisplay%ROP) + call json%add(p,"MudWeightIn",data%Equipments%ControlPanel%CDataDisplay%MudWeightIn) + call json%add(p,"MudWeightOut",data%Equipments%ControlPanel%CDataDisplay%MudWeightOut) + call json%add(p,"Buzzer1",data%Equipments%ControlPanel%CDataDisplay%Buzzer1) + call json%add(p,"Buzzer2",data%Equipments%ControlPanel%CDataDisplay%Buzzer2) + call json%add(p,"Buzzer3",data%Equipments%ControlPanel%CDataDisplay%Buzzer3) + call json%add(p,"Buzzer4",data%Equipments%ControlPanel%CDataDisplay%Buzzer4) + + + call json%add(parent,p) + end subroutine + + + subroutine Set_TotalDepth(v) + use SimulationVariables !@!!, only: data%EquipmentControl%DrillingWatch%Depth + ! use CSimulationVariables, only: SetDistanceDrilled + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%TotalWellDepth = v + data%EquipmentControl%DrillingWatch%Depth = v + ! call SetDistanceDrilled(v) + end subroutine + + subroutine Set_BitPosition(v) + use SimulationVariables !@!!, only: data%EquipmentControl%DrillingWatch%BitPosition + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%BitDepth = v + data%EquipmentControl%DrillingWatch%BitPosition = v + end subroutine + + subroutine Set_RotaryTorque(v) + use SimulationVariables !@!!, only: data%EquipmentControl%DrillingWatch%Torque + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%RotaryTorqueGauge = v + data%EquipmentControl%DrillingWatch%Torque = v + data%EquipmentControl%DataDisplayConsole%RTTorque = v + end subroutine + + + subroutine Set_MudWeightIn(v) + use SimulationVariables !@!, only: MudWeightInDw => data%EquipmentControl%DataDisplayConsole%MudWeightIn + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%MudWeightIn = v + data%EquipmentControl%DrillingWatch%MudWeightIn = v + end subroutine + + subroutine Set_MudWeightOut(v) + use SimulationVariables !@!, only: MudWeightOutDw => data%EquipmentControl%DataDisplayConsole%MudWeightOut + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%MudWeightOut = v + data%EquipmentControl%DrillingWatch%MudWeightOut = v + end subroutine + + subroutine Set_TripTankVolume(v) + use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%TripTankVolume + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DrillingWatch%TripTankVolume = v + end subroutine + + subroutine Set_FillVolume(v) + use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%FillVolume + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DrillingWatch%FillVolume = v + end subroutine + + subroutine Set_HookLoad(v) + use SimulationVariables !@!, only: HookLoadDw => data%EquipmentControl%DataDisplayConsole%HookLoad + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%HookLoadPointer = v + data%EquipmentControl%DrillingWatch%HookLoad = v * 1000 + data%EquipmentControl%DataDisplayConsole%HookLoad = v + end subroutine + + subroutine Set_WeightOnBit(v) + use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%WeightOnBit + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%WOBPointer = v + data%EquipmentControl%DrillingWatch%WeightOnBit = v + data%EquipmentControl%DataDisplayConsole%WOP = v + end subroutine + + subroutine Set_ROP(v) + use SimulationVariables !@!, only: ROPDw => data%EquipmentControl%DataDisplayConsole%ROP + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%ROP = v + data%EquipmentControl%DrillingWatch%ROP = v + end subroutine + + subroutine Set_CasingPressure(v) + use SimulationVariables !@!, only: CasingPressureDw => CasingPressure + use CChokeControlPanelVariables + use SimulationVariables!, only: CasingPressureChoke => CasingPressure + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%CasingPressureGauge = v + data%EquipmentControl%DrillingWatch%CasingPressure = v + data%EquipmentControl%ChokeControlPanel%CasingPressure = v + data%EquipmentControl%DataDisplayConsole%CasingPressure = v + end subroutine + + subroutine Set_StandPipePressure(v) + use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%PumpPressure + use CChokeControlPanelVariables + use SimulationVariables!, only: StandPipePressureChoke => data%EquipmentControl%DataDisplayConsole%StandPipePressure + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%StandPipePressureGauge = v + data%EquipmentControl%DrillingWatch%PumpPressure = v + data%EquipmentControl%ChokeControlPanel%StandPipePressure = v + data%EquipmentControl%DataDisplayConsole%StandPipePressure = v + + + + end subroutine + + + subroutine Set_RotaryRPMGauge(v) + use SimulationVariables !@!, only: data%EquipmentControl%DrillingWatch%RPM + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%RotaryRPMGauge = v + data%EquipmentControl%DrillingWatch%RPM = v + data%EquipmentControl%DataDisplayConsole%RTRPM = v + ! call data%EquipmentControl%DataDisplayConsole%OnRotaryRpmChange%RunAll(v) + end subroutine + + + + + subroutine Set_MP1SPMGauge(v) + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%MP1SPMGauge = v + data%EquipmentControl%DataDisplayConsole%MP1SPM = v + !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%EquipmentControl%DataDisplayConsole%MP1SPMGauge, data%EquipmentControl%DataDisplayConsole%MP2SPMGauge) +#ifdef deb + print*, 'MP1SPMGauge=', data%EquipmentControl%DataDisplayConsole%MP1SPMGauge +#endif + end subroutine + + subroutine Set_MP2SPMGauge(v) + implicit none + real(8), intent(in) :: v + data%EquipmentControl%DataDisplayConsole%MP2SPMGauge = v + data%EquipmentControl%DataDisplayConsole%MP2SPM = v + !@data%State%unitySignals%(PumpsSpmChanges)) call PumpsSpmChanges(data%EquipmentControl%DataDisplayConsole%MP1SPMGauge, data%EquipmentControl%DataDisplayConsole%MP2SPMGauge) +#ifdef deb + print*, 'MP2SPMGauge=', data%EquipmentControl%DataDisplayConsole%MP2SPMGauge +#endif + end subroutine end module CDataDisplayConsole \ No newline at end of file diff --git a/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 b/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 index da07e2c..f074386 100644 --- a/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 +++ b/CSharp/Equipments/ControlPanels/CDrillingConsole.f90 @@ -1,873 +1,969 @@ -module CDrillingConsole - use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables - ! use CSimulationVariables - use CLog4 - use CLog3 - implicit none - public - contains - - ! Input routines - subroutine SetAssignmentSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetAssignmentSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetAssignmentSwitch' :: SetAssignmentSwitch - implicit none - integer, intent(in) :: v - data%EquipmentControl%DrillingConsole%AssignmentSwitch = v -#ifdef deb - call Log_4( 'AssignmentSwitch=', data%EquipmentControl%DrillingConsole%AssignmentSwitch) -#endif - end subroutine - - subroutine SetEmergencySwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetEmergencySwitch - !DEC$ ATTRIBUTES ALIAS: 'SetEmergencySwitch' :: SetEmergencySwitch - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%EmergencySwitch = v -#ifdef deb - print*, 'EmergencySwitch=', data%EquipmentControl%DrillingConsole%EmergencySwitch -#endif - end subroutine - - subroutine SetRTTorqueLimitKnob(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetRTTorqueLimitKnob - !DEC$ ATTRIBUTES ALIAS: 'SetRTTorqueLimitKnob' :: SetRTTorqueLimitKnob - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = v -#ifdef deb - print*, 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob -#endif - end subroutine - - subroutine SetMP1CPSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetMP1CPSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetMP1CPSwitch' :: SetMP1CPSwitch - implicit none - integer, intent(in) :: v - - if(data%EquipmentControl%DrillingConsole%MP1CPSwitch == v) return - - if(SimulationState == SimulationState_Started) then - data%EquipmentControl%DrillingConsole%MP1CPSwitchI = data%EquipmentControl%DrillingConsole%MP1CPSwitchI + 1 - if(data%EquipmentControl%DrillingConsole%MP1CPSwitchI >= 1) data%EquipmentControl%DrillingConsole%MP1CPSwitch = v - if(data%EquipmentControl%DrillingConsole%MP1CPSwitchI >= 100) data%EquipmentControl%DrillingConsole%MP1CPSwitchI = 1 - !call Log_3( "MP1CPSwitchI=", MP1CPSwitchI) - !call Log_3( "MP1CPSwitch=", MP1CPSwitch) - - !MP1CPSwitch = v - endif -! if(SimulationState == SimulationState_Started) then -! !call Log_3( 'MP1CPSwitc(s)h=', MP1CPSwitch) -! if(MP1CPSwitchT /= v) then -! MP1CPSwitchT = v -! MP1CPSwitch = v -!#ifdef deb -! !print*, 'MP1CPSwitch=', MP1CPSwitch -! !call Log_3( 'MP1CPSwitch=', MP1CPSwitch) -!#endif -! endif -! else -! MP1CPSwitchT = v -! endif - end subroutine - - subroutine SetMP1Throttle(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetMP1Throttle - !DEC$ ATTRIBUTES ALIAS: 'SetMP1Throttle' :: SetMP1Throttle - implicit none - real*8, intent(in) :: v - if(data%EquipmentControl%DrillingConsole%MP1Throttle == v) return - if(SimulationState == SimulationState_Started) then - if( abs(v - data%EquipmentControl%DrillingConsole%MP1Throttle) > 0.1) data%EquipmentControl%DrillingConsole%MP1ThrottleUpdate = .true. - if(data%EquipmentControl%DrillingConsole%MP1ThrottleUpdate) data%EquipmentControl%DrillingConsole%MP1Throttle = v - - !call Log_3( 'v-mp1=', v) - !call Log_3( 'MP1Throttle=', MP1Throttle) - !call Log_3( 'MP1ThrottleUpdate=', MP1ThrottleUpdate) - - !MP1Throttle = v - endif -#ifdef deb - print*, 'MP1Throttle=', data%EquipmentControl%DrillingConsole%MP1Throttle -#endif - end subroutine - - subroutine SetMP2Switch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetMP2Switch - !DEC$ ATTRIBUTES ALIAS: 'SetMP2Switch' :: SetMP2Switch - implicit none - logical, intent(in) :: v - !call Log_3( 'v=', MP2SwitchT) - - if(data%EquipmentControl%DrillingConsole%MP2Switch == v) return - - if(SimulationState == SimulationState_Started) then - data%EquipmentControl%DrillingConsole%MP2SwitchI = data%EquipmentControl%DrillingConsole%MP2SwitchI + 1 - if(data%EquipmentControl%DrillingConsole%MP2SwitchI >= 1) data%EquipmentControl%DrillingConsole%MP2Switch = v - if(data%EquipmentControl%DrillingConsole%MP2SwitchI >= 100) data%EquipmentControl%DrillingConsole%MP2SwitchI = 1 - !call Log_3( "MP1CPSwitchI=", MP1CPSwitchI) - !call Log_3( "MP2Switch=", MP2Switch) - - !MP2Switch = v - endif - -! if(SimulationState == SimulationState_Started) then -! !call Log_3( 'MP2Switch(s)=', MP2Switch) -! if(MP2SwitchT /= v) then -! MP2SwitchT = v -! MP2Switch = v -!#ifdef deb -! !print*, 'MP2Switch=', MP2Switch -! !call Log_3( 'MP2Switch=', MP2Switch) -!#endif -! endif -! else -! MP2SwitchT = v -! !call Log_3( 'MP2SwitchTMP2SwitchTMP2SwitchT=', MP2SwitchT) -! endif - end subroutine - - subroutine SetMP2Throttle(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetMP2Throttle - !DEC$ ATTRIBUTES ALIAS: 'SetMP2Throttle' :: SetMP2Throttle - implicit none - real*8, intent(in) :: v - if(data%EquipmentControl%DrillingConsole%MP2Throttle == v) return - if(SimulationState == SimulationState_Started) then - if( abs(v - data%EquipmentControl%DrillingConsole%MP2Throttle) > 0.1) data%EquipmentControl%DrillingConsole%MP2ThrottleUpdate = .true. - if(data%EquipmentControl%DrillingConsole%MP2ThrottleUpdate) data%EquipmentControl%DrillingConsole%MP2Throttle = v - - !call Log_3( 'v-mp2=', v) - !call Log_3( 'MP2Throttle=', MP2Throttle) - !call Log_3( 'MP2ThrottleUpdate=', MP2ThrottleUpdate) - - !MP2Throttle = v - endif -#ifdef deb - print*, 'MP2Throttle=', data%EquipmentControl%DrillingConsole%MP2Throttle -#endif - end subroutine - - subroutine SetDWSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetDWSwitch' :: SetDWSwitch - implicit none - integer, intent(in) :: v - data%EquipmentControl%DrillingConsole%DWSwitch = v -#ifdef deb - print*, 'DWSwitch=', data%EquipmentControl%DrillingConsole%DWSwitch -#endif - end subroutine - - subroutine SetDWThrottle(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWThrottle - !DEC$ ATTRIBUTES ALIAS: 'SetDWThrottle' :: SetDWThrottle - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%DWThrottle = v -#ifdef deb - print*, 'DWThrottle=', data%EquipmentControl%DrillingConsole%DWThrottle -#endif - end subroutine - - subroutine SetRTSwitch(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetRTSwitch - !DEC$ ATTRIBUTES ALIAS: 'SetRTSwitch' :: SetRTSwitch - implicit none - integer, intent(in) :: v - data%EquipmentControl%DrillingConsole%RTSwitch = v -#ifdef deb - print*, 'RTSwitch=', data%EquipmentControl%DrillingConsole%RTSwitch -#endif - end subroutine - - subroutine SetRTThrottle(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetRTThrottle - !DEC$ ATTRIBUTES ALIAS: 'SetRTThrottle' :: SetRTThrottle - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%RTThrottle = v -#ifdef deb - print*, 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle -#endif - end subroutine - - subroutine SetDWBreak(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWBreak - !DEC$ ATTRIBUTES ALIAS: 'SetDWBreak' :: SetDWBreak - implicit none - real*8, intent(in) :: v - !if(ForceBreak) return - data%EquipmentControl%DrillingConsole%PreviousDWBreak = data%EquipmentControl%DrillingConsole%DWBreak - data%EquipmentControl%DrillingConsole%DWBreak = v -#ifdef deb - print*, 'DWBreak=', data%EquipmentControl%DrillingConsole%DWBreak -#endif - end subroutine - - subroutine SetDWAcceleretor(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWAcceleretor - !DEC$ ATTRIBUTES ALIAS: 'SetDWAcceleretor' :: SetDWAcceleretor - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%DWAcceleretor = v -#ifdef deb - print*, 'DWAcceleretor=', data%EquipmentControl%DrillingConsole%DWAcceleretor -#endif - end subroutine - - subroutine SetDWTransmisionLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWTransmisionLever - !DEC$ ATTRIBUTES ALIAS: 'SetDWTransmisionLever' :: SetDWTransmisionLever - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%DWTransmisionLever = v -#ifdef deb - print*, 'DWTransmisionLever=', data%EquipmentControl%DrillingConsole%DWTransmisionLever -#endif - end subroutine - - subroutine SetDWPowerLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWPowerLever - !DEC$ ATTRIBUTES ALIAS: 'SetDWPowerLever' :: SetDWPowerLever - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%DWPowerLever = v -#ifdef deb - print*, 'DWPowerLever=', data%EquipmentControl%DrillingConsole%DWPowerLever -#endif - end subroutine - - subroutine SetTongLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTongLever - !DEC$ ATTRIBUTES ALIAS: 'SetTongLever' :: SetTongLever - implicit none - real*8, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%TongLever == v) return - data%EquipmentControl%DrillingConsole%TongLever = v - - ! if(dint(TongLever) == 1.0) then - ! call OnBreakoutLeverPress%RunAll() -! #ifdef deb - ! print*, 'OnBreakoutLeverPress=', size(OnBreakoutLeverPress%Delegates) -! #endif - ! endif - ! if(dint(TongLever) == -1.0) then - ! call OnMakeupLeverPress%RunAll() - -! #ifdef deb -! print*, 'OnMakeupPress=', size(OnMakeupLeverPress%Delegates) -! #endif -! endif - ! if(dint(TongLever) == 0.0) then - ! call OnTongNeutralPress%RunAll() -! #ifdef deb -! print*, 'OnTongNeutralPress=', size(OnTongNeutralPress%Delegates) -! #endif -! endif - -#ifdef deb - print*, 'TongLever=', data%EquipmentControl%DrillingConsole%TongLever -#endif - end subroutine - - subroutine SetRTTransmissionLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetRTTransmissionLever - !DEC$ ATTRIBUTES ALIAS: 'SetRTTransmissionLever' :: SetRTTransmissionLever - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%RTTransmissionLever = v -#ifdef deb - print*, 'RTTransmissionLever=', data%EquipmentControl%DrillingConsole%RTTransmissionLever -#endif - end subroutine - - subroutine SetDWClutchLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetDWClutchLever - !DEC$ ATTRIBUTES ALIAS: 'SetDWClutchLever' :: SetDWClutchLever - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%DWClutchLever = v -#ifdef deb - print*, 'DWClutchLever=', data%EquipmentControl%DrillingConsole%DWClutchLever -#endif - end subroutine - - subroutine SetEddyBreakLever(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetEddyBreakLever - !DEC$ ATTRIBUTES ALIAS: 'SetEddyBreakLever' :: SetEddyBreakLever - implicit none - real*8, intent(in) :: v - data%EquipmentControl%DrillingConsole%EddyBreakLever = v -#ifdef deb - print*, 'EddyBreakLever=', data%EquipmentControl%DrillingConsole%EddyBreakLever -#endif - end subroutine - - subroutine SetAutoDW(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetAutoDW - !DEC$ ATTRIBUTES ALIAS: 'SetAutoDW' :: SetAutoDW - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%AutoDW = v -#ifdef deb - print*, 'AutoDW=', data%EquipmentControl%DrillingConsole%AutoDW -#endif - end subroutine - - subroutine SetGEN1(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN1 - !DEC$ ATTRIBUTES ALIAS: 'SetGEN1' :: SetGEN1 - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%GEN1 = v -#ifdef deb - print*, 'GEN1=', data%EquipmentControl%DrillingConsole%GEN1 -#endif - end subroutine - - subroutine SetGEN2(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN2 - !DEC$ ATTRIBUTES ALIAS: 'SetGEN2' :: SetGEN2 - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%GEN2 = v -#ifdef deb - print*, 'GEN2=', data%EquipmentControl%DrillingConsole%GEN2 -#endif - end subroutine - - subroutine SetGEN3(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN3 - !DEC$ ATTRIBUTES ALIAS: 'SetGEN3' :: SetGEN3 - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%GEN3 = v -#ifdef deb - print*, 'GEN3=', data%EquipmentControl%DrillingConsole%GEN3 -#endif - end subroutine - - subroutine SetGEN4(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN4 - !DEC$ ATTRIBUTES ALIAS: 'SetGEN4' :: SetGEN4 - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%GEN4 = v -#ifdef deb - print*, 'GEN4=', data%EquipmentControl%DrillingConsole%GEN4 -#endif - end subroutine - -! subroutine SetInstallSafetyValve(v) -! !DEC$ ATTRIBUTES DLLEXPORT :: SetInstallSafetyValve -! !DEC$ ATTRIBUTES ALIAS: 'SetInstallSafetyValve' :: SetInstallSafetyValve -! implicit none -! logical, intent(in) :: v -! InstallSafetyValve = v -!#ifdef deb -! print*, 'InstallSafetyValve=', InstallSafetyValve -!#endif -! end subroutine -! -! subroutine SetOpenSafetyValve(v) -! !DEC$ ATTRIBUTES DLLEXPORT :: SetOpenSafetyValve -! !DEC$ ATTRIBUTES ALIAS: 'SetOpenSafetyValve' :: SetOpenSafetyValve -! implicit none -! logical, intent(in) :: v -! OpenSafetyValve = v -!#ifdef deb -! print*, 'OpenSafetyValve=', OpenSafetyValve -!#endif -! end subroutine -! -! subroutine SetRemoveSafetyValve(v) -! !DEC$ ATTRIBUTES DLLEXPORT :: SetRemoveSafetyValve -! !DEC$ ATTRIBUTES ALIAS: 'SetRemoveSafetyValve' :: SetRemoveSafetyValve -! implicit none -! logical, intent(in) :: v -! RemoveSafetyValve = v -!#ifdef deb -! print*, 'RemoveSafetyValve=', RemoveSafetyValve -!#endif -! end subroutine -! -! subroutine SetCloseSafetyValve(v) -! !DEC$ ATTRIBUTES DLLEXPORT :: SetCloseSafetyValve -! !DEC$ ATTRIBUTES ALIAS: 'SetCloseSafetyValve' :: SetCloseSafetyValve -! implicit none -! logical, intent(in) :: v -! CloseSafetyValve = v -!#ifdef deb -! print*, 'CloseSafetyValve=', CloseSafetyValve -!#endif -! end subroutine -! -! subroutine SetMakeJoint(v) -! !DEC$ ATTRIBUTES DLLEXPORT :: SetMakeJoint -! !DEC$ ATTRIBUTES ALIAS: 'SetMakeJoint' :: SetMakeJoint -! implicit none -! logical, intent(in) :: v -! MakeJoint = v -!#ifdef deb -! print*, 'MakeJoint=', MakeJoint -!#endif -! end subroutine -! -! subroutine SetBreakJoint(v) -! !DEC$ ATTRIBUTES DLLEXPORT :: SetBreakJoint -! !DEC$ ATTRIBUTES ALIAS: 'SetBreakJoint' :: SetBreakJoint -! implicit none -! logical, intent(in) :: v -! BreakJoint = v -!#ifdef deb -! print*, 'BreakJoint=', BreakJoint -!#endif -! end subroutine - - subroutine SetOpenKellyCock(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetOpenKellyCock - !DEC$ ATTRIBUTES ALIAS: 'SetOpenKellyCock' :: SetOpenKellyCock - use CManifolds, OpenKellyCockSub => OpenKellyCock - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%OpenKellyCock == v) return - data%EquipmentControl%DrillingConsole%OpenKellyCock = v - ! if (v) call OnOpenKellyCockPress%RunAll() - if(v .and. data%EquipmentControl%DrillingConsole%Permission_OpenKellyCock) call OpenKellyCockSub() -#ifdef deb - print*, 'OpenKellyCock=', data%EquipmentControl%DrillingConsole%OpenKellyCock -#endif - end subroutine - - subroutine SetCloseKellyCock(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetCloseKellyCock - !DEC$ ATTRIBUTES ALIAS: 'SetCloseKellyCock' :: SetCloseKellyCock - use CManifolds, CloseKellyCockSub => CloseKellyCock - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%CloseKellyCock == v) return - data%EquipmentControl%DrillingConsole%CloseKellyCock = v - ! if (v) call OnCloseKellyCockPress%RunAll() - if(v .and. data%EquipmentControl%DrillingConsole%Permission_CloseKellyCock) call CloseKellyCockSub() -#ifdef deb - print*, 'CloseKellyCock=', data%EquipmentControl%DrillingConsole%CloseKellyCock -#endif - end subroutine - - subroutine SetOpenSafetyValve(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetOpenSafetyValve - !DEC$ ATTRIBUTES ALIAS: 'SetOpenSafetyValve' :: SetOpenSafetyValve - !use CManifolds, OpenSafetyValveSub => OpenSafetyValve - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%OpenSafetyValve == v) return - data%EquipmentControl%DrillingConsole%OpenSafetyValve = v - ! if (v) call OnOpenSafetyValvePress%RunAll() - !if(v .and. Permission_OpenSafetyValve) call OpenSafetyValveSub() -#ifdef deb - print*, 'OpenSafetyValve=', data%EquipmentControl%DrillingConsole%OpenSafetyValve -#endif - end subroutine - - subroutine SetCloseSafetyValve(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetCloseSafetyValve - !DEC$ ATTRIBUTES ALIAS: 'SetCloseSafetyValve' :: SetCloseSafetyValve - !use CManifolds, CloseSafetyValveSub => CloseSafetyValve - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%CloseSafetyValve == v) return - data%EquipmentControl%DrillingConsole%CloseSafetyValve = v - ! if (v) call OnCloseSafetyValvePress%RunAll() - !if(v .and. Permission_CloseSafetyValve) call CloseSafetyValveSub() -#ifdef deb - print*, 'CloseSafetyValve=', data%EquipmentControl%DrillingConsole%CloseSafetyValve -#endif - end subroutine - - subroutine SetIRSafetyValve(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetIRSafetyValve - !DEC$ ATTRIBUTES ALIAS: 'SetIRSafetyValve' :: SetIRSafetyValve - use CManifolds - implicit none - logical, intent(in) :: v - logical :: prev - if (data%EquipmentControl%DrillingConsole%IRSafetyValve == v) return - prev = data%EquipmentControl%DrillingConsole%IRSafetyValve - data%EquipmentControl%DrillingConsole%IRSafetyValve = v - ! if (v) call OnIRSafetyValvePress%RunAll() - !if(prev /= IRSafetyValve .and. v .and. Permission_IRSafetyValve) call ToggleSafetyValve() - !if(prev /= IRSafetyValve .and. v) call ToggleSafetyValve() -#ifdef deb - print*, 'IRSafetyValve=', data%EquipmentControl%DrillingConsole%IRSafetyValve -#endif - end subroutine - - subroutine SetIRIBop(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetIRIBop - !DEC$ ATTRIBUTES ALIAS: 'SetIRIBop' :: SetIRIBop - use CManifolds - implicit none - logical, intent(in) :: v - logical :: prev - if (data%EquipmentControl%DrillingConsole%IRIBop == v) return - prev = data%EquipmentControl%DrillingConsole%IRIBop - data%EquipmentControl%DrillingConsole%IRIBop = v - ! if (v) call OnIRIBopPress%RunAll() - !if(prev /= IRIBop .and. v .and. Permission_IRIBop) call ToggleIBop() - !if(prev /= IRIBop .and. v) call ToggleIBop() -#ifdef deb - print*, 'IRIBop=', data%EquipmentControl%DrillingConsole%IRIBop -#endif - end subroutine - - - - subroutine SetLatchPipe(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetLatchPipe - !DEC$ ATTRIBUTES ALIAS: 'SetLatchPipe' :: SetLatchPipe - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%LatchPipe .eqv. v) return - data%EquipmentControl%DrillingConsole%LatchPipe = v - ! if (v) call OnLatchPipePress%RunAll() -#ifdef deb - print*, 'LatchPipe=', data%EquipmentControl%DrillingConsole%LatchPipe -#endif - end subroutine - - subroutine SetUnlatchPipe(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetUnlatchPipe - !DEC$ ATTRIBUTES ALIAS: 'SetUnlatchPipe' :: SetUnlatchPipe - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%UnlatchPipe .eqv. v) return - data%EquipmentControl%DrillingConsole%UnlatchPipe = v - ! if (v) call OnUnlatchPipePress%RunAll() -#ifdef deb - print*, 'UnlatchPipe=', data%EquipmentControl%DrillingConsole%UnlatchPipe -#endif - end subroutine - - subroutine SetSwing(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetSwing - !DEC$ ATTRIBUTES ALIAS: 'SetSwing' :: SetSwing - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%Swing .eqv. v) return - data%EquipmentControl%DrillingConsole%Swing = v - ! if (v) call OnSwingPress%RunAll() -#ifdef deb - print*, 'Swing=', data%EquipmentControl%DrillingConsole%Swing -#endif - end subroutine - - subroutine SetFillMouseHole(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetFillMouseHole - !DEC$ ATTRIBUTES ALIAS: 'SetFillMouseHole' :: SetFillMouseHole - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%FillMouseHole .eqv. v) return - data%EquipmentControl%DrillingConsole%FillMouseHole = v - ! if (v) call OnFillMouseHolePress%RunAll() -#ifdef deb - print*, 'FillMouseHole=', data%EquipmentControl%DrillingConsole%FillMouseHole -#endif - end subroutine - - subroutine SetSlips(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetSlips - !DEC$ ATTRIBUTES ALIAS: 'SetSlips' :: SetSlips - implicit none - logical, intent(in) :: v - if (data%EquipmentControl%DrillingConsole%Slips .eqv. v) return - data%EquipmentControl%DrillingConsole%Slips = v -#ifdef deb - print*, 'Slips=', data%EquipmentControl%DrillingConsole%Slips -#endif - ! if (v) call OnSlipsPress%RunAll() - end subroutine - - - subroutine SetBrakeLeverCoefficient(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetBrakeLeverCoefficient - !DEC$ ATTRIBUTES ALIAS: 'SetBrakeLeverCoefficient' :: SetBrakeLeverCoefficient - implicit none - real, intent(in) :: v - data%EquipmentControl%DrillingConsole%BrakeLeverCoefficient = v -#ifdef deb - print*, 'BrakeLeverCoefficient=', data%EquipmentControl%DrillingConsole%BrakeLeverCoefficient -#endif - end subroutine - - subroutine SetHideDrillingBrake(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetHideDrillingBrake - !DEC$ ATTRIBUTES ALIAS: 'SetHideDrillingBrake' :: SetHideDrillingBrake - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%HideDrillingBrake = v -#ifdef deb - print*, 'HideDrillingBrake=', data%EquipmentControl%DrillingConsole%HideDrillingBrake -#endif - end subroutine - - - - - - - - - subroutine SetParkingBrake(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetParkingBrake - !DEC$ ATTRIBUTES ALIAS: 'SetParkingBrake' :: SetParkingBrake - implicit none - logical, intent(in) :: v - data%EquipmentControl%DrillingConsole%ParkingBrakeBtn = v -#ifdef deb - print*, 'ParkingBrakeBtn=', data%EquipmentControl%DrillingConsole%ParkingBrakeBtn -#endif - end subroutine - - - - - - - - - - - - - ! Output routines - - logical function GetParkingBrakeLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetParkingBrakeLed - !DEC$ ATTRIBUTES ALIAS: 'GetParkingBrakeLed' :: GetParkingBrakeLed - implicit none - GetParkingBrakeLed = data%EquipmentControl%DrillingConsole%ParkingBrakeLed - !GetParkingBrakeLed = .true. - end function - - - integer function GetGEN1LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN1LED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN1LED' :: GetGEN1LED - implicit none - GetGEN1LED = 1 - !GetGEN1LED = GEN1LED - end function - - integer function GetGEN2LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN2LED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN2LED' :: GetGEN2LED - implicit none - GetGEN2LED = 1 - !GetGEN2LED = GEN2LED - end function - - integer function GetGEN3LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN3LED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN3LED' :: GetGEN3LED - implicit none - GetGEN3LED = 1 - !GetGEN3LED = GEN3LED - end function - - integer function GetGEN4LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN4LED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN4LED' :: GetGEN4LED - implicit none - GetGEN4LED = 1 - !GetGEN4LED = GEN4LED - end function - - integer function GetSCR1LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR1LED - !DEC$ ATTRIBUTES ALIAS: 'GetSCR1LED' :: GetSCR1LED - implicit none - GetSCR1LED = data%EquipmentControl%DrillingConsole%SCR1LED - end function - - integer function GetSCR2LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR2LED - !DEC$ ATTRIBUTES ALIAS: 'GetSCR2LED' :: GetSCR2LED - implicit none - GetSCR2LED = data%EquipmentControl%DrillingConsole%SCR2LED - end function - - integer function GetSCR3LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR3LED - !DEC$ ATTRIBUTES ALIAS: 'GetSCR3LED' :: GetSCR3LED - implicit none - GetSCR3LED = data%EquipmentControl%DrillingConsole%SCR3LED - end function - - integer function GetSCR4LED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR4LED - !DEC$ ATTRIBUTES ALIAS: 'GetSCR4LED' :: GetSCR4LED - implicit none - GetSCR4LED = data%EquipmentControl%DrillingConsole%SCR4LED - end function - - integer function GetMP1BLWR() - !DEC$ ATTRIBUTES DLLEXPORT :: GetMP1BLWR - !DEC$ ATTRIBUTES ALIAS: 'GetMP1BLWR' :: GetMP1BLWR - implicit none - GetMP1BLWR = data%EquipmentControl%DrillingConsole%MP1BLWR - end function - - integer function GetMP2BLWR() - !DEC$ ATTRIBUTES DLLEXPORT :: GetMP2BLWR - !DEC$ ATTRIBUTES ALIAS: 'GetMP2BLWR' :: GetMP2BLWR - implicit none - GetMP2BLWR = data%EquipmentControl%DrillingConsole%MP2BLWR - end function - - integer function GetDWBLWR() - !DEC$ ATTRIBUTES DLLEXPORT :: GetDWBLWR - !DEC$ ATTRIBUTES ALIAS: 'GetDWBLWR' :: GetDWBLWR - implicit none - GetDWBLWR = data%EquipmentControl%DrillingConsole%DWBLWR - end function - - integer function GetRTBLWR() - !DEC$ ATTRIBUTES DLLEXPORT :: GetRTBLWR - !DEC$ ATTRIBUTES ALIAS: 'GetRTBLWR' :: GetRTBLWR - implicit none - GetRTBLWR = data%EquipmentControl%DrillingConsole%RTBLWR - end function - - integer function GetPWRLIM() - !DEC$ ATTRIBUTES DLLEXPORT :: GetPWRLIM - !DEC$ ATTRIBUTES ALIAS: 'GetPWRLIM' :: GetPWRLIM - implicit none - GetPWRLIM = data%EquipmentControl%DrillingConsole%PWRLIM - end function - - real(8) function GetPWRLIMMTR() - !DEC$ ATTRIBUTES DLLEXPORT :: GetPWRLIMMTR - !DEC$ ATTRIBUTES ALIAS: 'GetPWRLIMMTR' :: GetPWRLIMMTR - implicit none - GetPWRLIMMTR = data%EquipmentControl%DrillingConsole%PWRLIMMTR - end function - - real(8) function GetRTTorqueLimitGauge() - !DEC$ ATTRIBUTES DLLEXPORT :: GetRTTorqueLimitGauge - !DEC$ ATTRIBUTES ALIAS: 'GetRTTorqueLimitGauge' :: GetRTTorqueLimitGauge - implicit none - GetRTTorqueLimitGauge = data%EquipmentControl%DrillingConsole%RTTorqueLimitGauge - end function - - integer function GetAutoDWLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetAutoDWLED - !DEC$ ATTRIBUTES ALIAS: 'GetAutoDWLED' :: GetAutoDWLED - implicit none - GetAutoDWLED = data%EquipmentControl%DrillingConsole%AutoDWLED - end function - - integer function GetGEN1BTNLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN1BTNLED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN1BTNLED' :: GetGEN1BTNLED - implicit none - GetGEN1BTNLED = data%EquipmentControl%DrillingConsole%GEN1BTNLED - end function - - integer function GetGEN2BTNLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN2BTNLED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN2BTNLED' :: GetGEN2BTNLED - implicit none - GetGEN2BTNLED = data%EquipmentControl%DrillingConsole%GEN2BTNLED - end function - - integer function GetGEN3BTNLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN3BTNLED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN3BTNLED' :: GetGEN3BTNLED - implicit none - GetGEN3BTNLED = data%EquipmentControl%DrillingConsole%GEN3BTNLED - end function - - integer function GetGEN4BTNLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN4BTNLED - !DEC$ ATTRIBUTES ALIAS: 'GetGEN4BTNLED' :: GetGEN4BTNLED - implicit none - GetGEN4BTNLED = data%EquipmentControl%DrillingConsole%GEN4BTNLED - end function - - integer function GetOpenKellyCockLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetOpenKellyCockLed - !DEC$ ATTRIBUTES ALIAS: 'GetOpenKellyCockLed' :: GetOpenKellyCockLed - implicit none - GetOpenKellyCockLed = data%EquipmentControl%DrillingConsole%OpenKellyCockLed - end function - - integer function GetCloseKellyCockLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetCloseKellyCockLed - !DEC$ ATTRIBUTES ALIAS: 'GetCloseKellyCockLed' :: GetCloseKellyCockLed - implicit none - GetCloseKellyCockLed = data%EquipmentControl%DrillingConsole%CloseKellyCockLed - end function - - integer function GetOpenSafetyValveLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetOpenSafetyValveLed - !DEC$ ATTRIBUTES ALIAS: 'GetOpenSafetyValveLed' :: GetOpenSafetyValveLed - implicit none - GetOpenSafetyValveLed = data%EquipmentControl%DrillingConsole%OpenSafetyValveLed - end function - - integer function GetCloseSafetyValveLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetCloseSafetyValveLed - !DEC$ ATTRIBUTES ALIAS: 'GetCloseSafetyValveLed' :: GetCloseSafetyValveLed - implicit none - GetCloseSafetyValveLed = data%EquipmentControl%DrillingConsole%CloseSafetyValveLed - end function - - integer function GetIRSafetyValveLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetIRSafetyValveLed - !DEC$ ATTRIBUTES ALIAS: 'GetIRSafetyValveLed' :: GetIRSafetyValveLed - implicit none - GetIRSafetyValveLed = data%EquipmentControl%DrillingConsole%IRSafetyValveLed - end function - - integer function GetIRIBopLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetIRIBopLed - !DEC$ ATTRIBUTES ALIAS: 'GetIRIBopLed' :: GetIRIBopLed - implicit none - GetIRIBopLed = data%EquipmentControl%DrillingConsole%IRIBopLed - end function - - - integer function GetLatchPipeLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetLatchPipeLED - !DEC$ ATTRIBUTES ALIAS: 'GetLatchPipeLED' :: GetLatchPipeLED - implicit none - GetLatchPipeLED = data%EquipmentControl%DrillingConsole%LatchPipeLED - end function - - integer function GetUnlatchPipeLED() - !DEC$ ATTRIBUTES DLLEXPORT :: GetUnlatchPipeLED - !DEC$ ATTRIBUTES ALIAS: 'GetUnlatchPipeLED' :: GetUnlatchPipeLED - implicit none - GetUnlatchPipeLED = data%EquipmentControl%DrillingConsole%UnlatchPipeLED - end function - - integer function GetSwingLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetSwingLed - !DEC$ ATTRIBUTES ALIAS: 'GetSwingLed' :: GetSwingLed - implicit none - GetSwingLed = data%EquipmentControl%DrillingConsole%SwingLed - end function - - integer function GetFillMouseHoleLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetFillMouseHoleLed - !DEC$ ATTRIBUTES ALIAS: 'GetFillMouseHoleLed' :: GetFillMouseHoleLed - implicit none - GetFillMouseHoleLed = data%EquipmentControl%DrillingConsole%FillMouseHoleLed - end function - +module CDrillingConsole + use CDrillingConsoleVariables + use SimulationVariables + use SimulationVariables + ! use CSimulationVariables + use CLog4 + use CLog3 + implicit none + public + contains + + + subroutine CDrillingToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CDrilling') + call json%add(p,"AssignmentSwitch",data%Equipments%ControlPanel%CDriling%AssignmentSwitch) + call json%add(p,"EmergencySwitch",data%Equipments%ControlPanel%CDriling%EmergencySwitch) + call json%add(p,"RTTorqueLimitKnob",data%Equipments%ControlPanel%CDriling%RTTorqueLimitKnob) + call json%add(p,"MP1CPSwitchI",data%Equipments%ControlPanel%CDriling%MP1CPSwitchI) + call json%add(p,"MP1CPSwitchT",data%Equipments%ControlPanel%CDriling%MP1CPSwitchT) + call json%add(p,"MP1CPSwitch",data%Equipments%ControlPanel%CDriling%MP1CPSwitch) + call json%add(p,"MP1ThrottleUpdate",data%Equipments%ControlPanel%CDriling%MP1ThrottleUpdate) + call json%add(p,"MP1Throttle",data%Equipments%ControlPanel%CDriling%MP1Throttle) + call json%add(p,"MP2SwitchI",data%Equipments%ControlPanel%CDriling%MP2SwitchI) + call json%add(p,"MP2SwitchT",data%Equipments%ControlPanel%CDriling%MP2SwitchT) + call json%add(p,"MP2Switch",data%Equipments%ControlPanel%CDriling%MP2Switch) + call json%add(p,"MP2ThrottleUpdate",data%Equipments%ControlPanel%CDriling%MP2ThrottleUpdate) + call json%add(p,"MP2Throttle",data%Equipments%ControlPanel%CDriling%MP2Throttle) + call json%add(p,"DWSwitch",data%Equipments%ControlPanel%CDriling%DWSwitch) + call json%add(p,"DWThrottle",data%Equipments%ControlPanel%CDriling%DWThrottle) + call json%add(p,"RTSwitch",data%Equipments%ControlPanel%CDriling%RTSwitch) + call json%add(p,"RTThrottle",data%Equipments%ControlPanel%CDriling%RTThrottle) + call json%add(p,"DWBreak",data%Equipments%ControlPanel%CDriling%DWBreak) + call json%add(p,"PreviousDWBreak",data%Equipments%ControlPanel%CDriling%PreviousDWBreak) + call json%add(p,"ForceBreak",data%Equipments%ControlPanel%CDriling%ForceBreak) + call json%add(p,"DWAcceleretor",data%Equipments%ControlPanel%CDriling%DWAcceleretor) + call json%add(p,"DWTransmisionLever",data%Equipments%ControlPanel%CDriling%DWTransmisionLever) + call json%add(p,"DWPowerLever",data%Equipments%ControlPanel%CDriling%DWPowerLever) + call json%add(p,"TongLever",data%Equipments%ControlPanel%CDriling%TongLever) + call json%add(p,"RTTransmissionLever",data%Equipments%ControlPanel%CDriling%RTTransmissionLever) + call json%add(p,"DWClutchLever",data%Equipments%ControlPanel%CDriling%DWClutchLever) + call json%add(p,"EddyBreakLever",data%Equipments%ControlPanel%CDriling%EddyBreakLever) + call json%add(p,"AutoDW",data%Equipments%ControlPanel%CDriling%AutoDW) + call json%add(p,"GEN1",data%Equipments%ControlPanel%CDriling%GEN1) + call json%add(p,"GEN2",data%Equipments%ControlPanel%CDriling%GEN2) + call json%add(p,"GEN3",data%Equipments%ControlPanel%CDriling%GEN3) + call json%add(p,"GEN4",data%Equipments%ControlPanel%CDriling%GEN4) + call json%add(p,"Permission_OpenKellyCock",data%Equipments%ControlPanel%CDriling%Permission_OpenKellyCock) + call json%add(p,"OpenKellyCock",data%Equipments%ControlPanel%CDriling%OpenKellyCock) + call json%add(p,"Permission_CloseKellyCock",data%Equipments%ControlPanel%CDriling%Permission_CloseKellyCock) + call json%add(p,"CloseKellyCock",data%Equipments%ControlPanel%CDriling%CloseKellyCock) + call json%add(p,"Permission_OpenSafetyValve",data%Equipments%ControlPanel%CDriling%Permission_OpenSafetyValve) + call json%add(p,"OpenSafetyValve",data%Equipments%ControlPanel%CDriling%OpenSafetyValve) + call json%add(p,"Permission_CloseSafetyValve",data%Equipments%ControlPanel%CDriling%Permission_CloseSafetyValve) + call json%add(p,"CloseSafetyValve",data%Equipments%ControlPanel%CDriling%CloseSafetyValve) + call json%add(p,"Permission_IRSafetyValve",data%Equipments%ControlPanel%CDriling%Permission_IRSafetyValve) + call json%add(p,"IRSafetyValve",data%Equipments%ControlPanel%CDriling%IRSafetyValve) + call json%add(p,"Permission_IRIBop",data%Equipments%ControlPanel%CDriling%Permission_IRIBop) + call json%add(p,"IRIBop",data%Equipments%ControlPanel%CDriling%IRIBop) + call json%add(p,"LatchPipe",data%Equipments%ControlPanel%CDriling%LatchPipe) + call json%add(p,"UnlatchPipe",data%Equipments%ControlPanel%CDriling%UnlatchPipe) + call json%add(p,"Swing",data%Equipments%ControlPanel%CDriling%Swing) + call json%add(p,"FillMouseHole",data%Equipments%ControlPanel%CDriling%FillMouseHole) + call json%add(p,"Slips",data%Equipments%ControlPanel%CDriling%Slips) + call json%add(p,"BrakeLeverCoefficient",data%Equipments%ControlPanel%CDriling%BrakeLeverCoefficient) + call json%add(p,"HideDrillingBrake",data%Equipments%ControlPanel%CDriling%HideDrillingBrake) + call json%add(p,"ParkingBrakeBtn",data%Equipments%ControlPanel%CDriling%ParkingBrakeBtn) + call json%add(p,"ParkingBrakeLed",data%Equipments%ControlPanel%CDriling%ParkingBrakeLed) + call json%add(p,"GEN1LED",data%Equipments%ControlPanel%CDriling%GEN1LED) + call json%add(p,"GEN2LED",data%Equipments%ControlPanel%CDriling%GEN2LED) + call json%add(p,"GEN3LED",data%Equipments%ControlPanel%CDriling%GEN3LED) + call json%add(p,"GEN4LED",data%Equipments%ControlPanel%CDriling%GEN4LED) + call json%add(p,"SCR1LED",data%Equipments%ControlPanel%CDriling%SCR1LED) + call json%add(p,"SCR2LED",data%Equipments%ControlPanel%CDriling%SCR2LED) + call json%add(p,"SCR3LED",data%Equipments%ControlPanel%CDriling%SCR3LED) + call json%add(p,"SCR4LED",data%Equipments%ControlPanel%CDriling%SCR4LED) + call json%add(p,"MP1BLWR",data%Equipments%ControlPanel%CDriling%MP1BLWR) + call json%add(p,"MP2BLWR",data%Equipments%ControlPanel%CDriling%MP2BLWR) + call json%add(p,"DWBLWR",data%Equipments%ControlPanel%CDriling%DWBLWR) + call json%add(p,"RTBLWR",data%Equipments%ControlPanel%CDriling%RTBLWR) + call json%add(p,"PWRLIM",data%Equipments%ControlPanel%CDriling%PWRLIM) + call json%add(p,"PWRLIMMTR",data%Equipments%ControlPanel%CDriling%PWRLIMMTR) + call json%add(p,"RTTorqueLimitGauge",data%Equipments%ControlPanel%CDriling%RTTorqueLimitGauge) + call json%add(p,"AutoDWLED",data%Equipments%ControlPanel%CDriling%AutoDWLED) + call json%add(p,"GEN1BTNLED",data%Equipments%ControlPanel%CDriling%GEN1BTNLED) + call json%add(p,"GEN2BTNLED",data%Equipments%ControlPanel%CDriling%GEN2BTNLED) + call json%add(p,"GEN3BTNLED",data%Equipments%ControlPanel%CDriling%GEN3BTNLED) + call json%add(p,"GEN4BTNLED",data%Equipments%ControlPanel%CDriling%GEN4BTNLED) + call json%add(p,"OpenKellyCockLed",data%Equipments%ControlPanel%CDriling%OpenKellyCockLed) + call json%add(p,"CloseKellyCockLed",data%Equipments%ControlPanel%CDriling%CloseKellyCockLed) + call json%add(p,"OpenSafetyValveLed",data%Equipments%ControlPanel%CDriling%OpenSafetyValveLed) + call json%add(p,"CloseSafetyValveLed",data%Equipments%ControlPanel%CDriling%CloseSafetyValveLed) + call json%add(p,"IRSafetyValveLed",data%Equipments%ControlPanel%CDriling%IRSafetyValveLed) + call json%add(p,"IRIBopLed",data%Equipments%ControlPanel%CDriling%IRIBopLed) + call json%add(p,"LatchPipeLED",data%Equipments%ControlPanel%CDriling%LatchPipeLED) + call json%add(p,"UnlatchPipeLED",data%Equipments%ControlPanel%CDriling%UnlatchPipeLED) + call json%add(p,"SwingLed",data%Equipments%ControlPanel%CDriling%SwingLed) + call json%add(p,"FillMouseHoleLed",data%Equipments%ControlPanel%CDriling%FillMouseHoleLed) + + call json%add(parent,p) + end subroutine + + ! Input routines + subroutine SetAssignmentSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetAssignmentSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetAssignmentSwitch' :: SetAssignmentSwitch + implicit none + integer, intent(in) :: v + data%EquipmentControl%DrillingConsole%AssignmentSwitch = v +#ifdef deb + call Log_4( 'AssignmentSwitch=', data%EquipmentControl%DrillingConsole%AssignmentSwitch) +#endif + end subroutine + + subroutine SetEmergencySwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetEmergencySwitch + !DEC$ ATTRIBUTES ALIAS: 'SetEmergencySwitch' :: SetEmergencySwitch + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%EmergencySwitch = v +#ifdef deb + print*, 'EmergencySwitch=', data%EquipmentControl%DrillingConsole%EmergencySwitch +#endif + end subroutine + + subroutine SetRTTorqueLimitKnob(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetRTTorqueLimitKnob + !DEC$ ATTRIBUTES ALIAS: 'SetRTTorqueLimitKnob' :: SetRTTorqueLimitKnob + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = v +#ifdef deb + print*, 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob +#endif + end subroutine + + subroutine SetMP1CPSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetMP1CPSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetMP1CPSwitch' :: SetMP1CPSwitch + implicit none + integer, intent(in) :: v + + if(data%EquipmentControl%DrillingConsole%MP1CPSwitch == v) return + + if(SimulationState == SimulationState_Started) then + data%EquipmentControl%DrillingConsole%MP1CPSwitchI = data%EquipmentControl%DrillingConsole%MP1CPSwitchI + 1 + if(data%EquipmentControl%DrillingConsole%MP1CPSwitchI >= 1) data%EquipmentControl%DrillingConsole%MP1CPSwitch = v + if(data%EquipmentControl%DrillingConsole%MP1CPSwitchI >= 100) data%EquipmentControl%DrillingConsole%MP1CPSwitchI = 1 + !call Log_3( "MP1CPSwitchI=", MP1CPSwitchI) + !call Log_3( "MP1CPSwitch=", MP1CPSwitch) + + !MP1CPSwitch = v + endif +! if(SimulationState == SimulationState_Started) then +! !call Log_3( 'MP1CPSwitc(s)h=', MP1CPSwitch) +! if(MP1CPSwitchT /= v) then +! MP1CPSwitchT = v +! MP1CPSwitch = v +!#ifdef deb +! !print*, 'MP1CPSwitch=', MP1CPSwitch +! !call Log_3( 'MP1CPSwitch=', MP1CPSwitch) +!#endif +! endif +! else +! MP1CPSwitchT = v +! endif + end subroutine + + subroutine SetMP1Throttle(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetMP1Throttle + !DEC$ ATTRIBUTES ALIAS: 'SetMP1Throttle' :: SetMP1Throttle + implicit none + real*8, intent(in) :: v + if(data%EquipmentControl%DrillingConsole%MP1Throttle == v) return + if(SimulationState == SimulationState_Started) then + if( abs(v - data%EquipmentControl%DrillingConsole%MP1Throttle) > 0.1) data%EquipmentControl%DrillingConsole%MP1ThrottleUpdate = .true. + if(data%EquipmentControl%DrillingConsole%MP1ThrottleUpdate) data%EquipmentControl%DrillingConsole%MP1Throttle = v + + !call Log_3( 'v-mp1=', v) + !call Log_3( 'MP1Throttle=', MP1Throttle) + !call Log_3( 'MP1ThrottleUpdate=', MP1ThrottleUpdate) + + !MP1Throttle = v + endif +#ifdef deb + print*, 'MP1Throttle=', data%EquipmentControl%DrillingConsole%MP1Throttle +#endif + end subroutine + + subroutine SetMP2Switch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetMP2Switch + !DEC$ ATTRIBUTES ALIAS: 'SetMP2Switch' :: SetMP2Switch + implicit none + logical, intent(in) :: v + !call Log_3( 'v=', MP2SwitchT) + + if(data%EquipmentControl%DrillingConsole%MP2Switch == v) return + + if(SimulationState == SimulationState_Started) then + data%EquipmentControl%DrillingConsole%MP2SwitchI = data%EquipmentControl%DrillingConsole%MP2SwitchI + 1 + if(data%EquipmentControl%DrillingConsole%MP2SwitchI >= 1) data%EquipmentControl%DrillingConsole%MP2Switch = v + if(data%EquipmentControl%DrillingConsole%MP2SwitchI >= 100) data%EquipmentControl%DrillingConsole%MP2SwitchI = 1 + !call Log_3( "MP1CPSwitchI=", MP1CPSwitchI) + !call Log_3( "MP2Switch=", MP2Switch) + + !MP2Switch = v + endif + +! if(SimulationState == SimulationState_Started) then +! !call Log_3( 'MP2Switch(s)=', MP2Switch) +! if(MP2SwitchT /= v) then +! MP2SwitchT = v +! MP2Switch = v +!#ifdef deb +! !print*, 'MP2Switch=', MP2Switch +! !call Log_3( 'MP2Switch=', MP2Switch) +!#endif +! endif +! else +! MP2SwitchT = v +! !call Log_3( 'MP2SwitchTMP2SwitchTMP2SwitchT=', MP2SwitchT) +! endif + end subroutine + + subroutine SetMP2Throttle(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetMP2Throttle + !DEC$ ATTRIBUTES ALIAS: 'SetMP2Throttle' :: SetMP2Throttle + implicit none + real*8, intent(in) :: v + if(data%EquipmentControl%DrillingConsole%MP2Throttle == v) return + if(SimulationState == SimulationState_Started) then + if( abs(v - data%EquipmentControl%DrillingConsole%MP2Throttle) > 0.1) data%EquipmentControl%DrillingConsole%MP2ThrottleUpdate = .true. + if(data%EquipmentControl%DrillingConsole%MP2ThrottleUpdate) data%EquipmentControl%DrillingConsole%MP2Throttle = v + + !call Log_3( 'v-mp2=', v) + !call Log_3( 'MP2Throttle=', MP2Throttle) + !call Log_3( 'MP2ThrottleUpdate=', MP2ThrottleUpdate) + + !MP2Throttle = v + endif +#ifdef deb + print*, 'MP2Throttle=', data%EquipmentControl%DrillingConsole%MP2Throttle +#endif + end subroutine + + subroutine SetDWSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetDWSwitch' :: SetDWSwitch + implicit none + integer, intent(in) :: v + data%EquipmentControl%DrillingConsole%DWSwitch = v +#ifdef deb + print*, 'DWSwitch=', data%EquipmentControl%DrillingConsole%DWSwitch +#endif + end subroutine + + subroutine SetDWThrottle(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWThrottle + !DEC$ ATTRIBUTES ALIAS: 'SetDWThrottle' :: SetDWThrottle + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%DWThrottle = v +#ifdef deb + print*, 'DWThrottle=', data%EquipmentControl%DrillingConsole%DWThrottle +#endif + end subroutine + + subroutine SetRTSwitch(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetRTSwitch + !DEC$ ATTRIBUTES ALIAS: 'SetRTSwitch' :: SetRTSwitch + implicit none + integer, intent(in) :: v + data%EquipmentControl%DrillingConsole%RTSwitch = v +#ifdef deb + print*, 'RTSwitch=', data%EquipmentControl%DrillingConsole%RTSwitch +#endif + end subroutine + + subroutine SetRTThrottle(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetRTThrottle + !DEC$ ATTRIBUTES ALIAS: 'SetRTThrottle' :: SetRTThrottle + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%RTThrottle = v +#ifdef deb + print*, 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle +#endif + end subroutine + + subroutine SetDWBreak(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWBreak + !DEC$ ATTRIBUTES ALIAS: 'SetDWBreak' :: SetDWBreak + implicit none + real*8, intent(in) :: v + !if(ForceBreak) return + data%EquipmentControl%DrillingConsole%PreviousDWBreak = data%EquipmentControl%DrillingConsole%DWBreak + data%EquipmentControl%DrillingConsole%DWBreak = v +#ifdef deb + print*, 'DWBreak=', data%EquipmentControl%DrillingConsole%DWBreak +#endif + end subroutine + + subroutine SetDWAcceleretor(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWAcceleretor + !DEC$ ATTRIBUTES ALIAS: 'SetDWAcceleretor' :: SetDWAcceleretor + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%DWAcceleretor = v +#ifdef deb + print*, 'DWAcceleretor=', data%EquipmentControl%DrillingConsole%DWAcceleretor +#endif + end subroutine + + subroutine SetDWTransmisionLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWTransmisionLever + !DEC$ ATTRIBUTES ALIAS: 'SetDWTransmisionLever' :: SetDWTransmisionLever + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%DWTransmisionLever = v +#ifdef deb + print*, 'DWTransmisionLever=', data%EquipmentControl%DrillingConsole%DWTransmisionLever +#endif + end subroutine + + subroutine SetDWPowerLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWPowerLever + !DEC$ ATTRIBUTES ALIAS: 'SetDWPowerLever' :: SetDWPowerLever + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%DWPowerLever = v +#ifdef deb + print*, 'DWPowerLever=', data%EquipmentControl%DrillingConsole%DWPowerLever +#endif + end subroutine + + subroutine SetTongLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTongLever + !DEC$ ATTRIBUTES ALIAS: 'SetTongLever' :: SetTongLever + implicit none + real*8, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%TongLever == v) return + data%EquipmentControl%DrillingConsole%TongLever = v + + ! if(dint(TongLever) == 1.0) then + ! call OnBreakoutLeverPress%RunAll() +! #ifdef deb + ! print*, 'OnBreakoutLeverPress=', size(OnBreakoutLeverPress%Delegates) +! #endif + ! endif + ! if(dint(TongLever) == -1.0) then + ! call OnMakeupLeverPress%RunAll() + +! #ifdef deb +! print*, 'OnMakeupPress=', size(OnMakeupLeverPress%Delegates) +! #endif +! endif + ! if(dint(TongLever) == 0.0) then + ! call OnTongNeutralPress%RunAll() +! #ifdef deb +! print*, 'OnTongNeutralPress=', size(OnTongNeutralPress%Delegates) +! #endif +! endif + +#ifdef deb + print*, 'TongLever=', data%EquipmentControl%DrillingConsole%TongLever +#endif + end subroutine + + subroutine SetRTTransmissionLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetRTTransmissionLever + !DEC$ ATTRIBUTES ALIAS: 'SetRTTransmissionLever' :: SetRTTransmissionLever + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%RTTransmissionLever = v +#ifdef deb + print*, 'RTTransmissionLever=', data%EquipmentControl%DrillingConsole%RTTransmissionLever +#endif + end subroutine + + subroutine SetDWClutchLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetDWClutchLever + !DEC$ ATTRIBUTES ALIAS: 'SetDWClutchLever' :: SetDWClutchLever + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%DWClutchLever = v +#ifdef deb + print*, 'DWClutchLever=', data%EquipmentControl%DrillingConsole%DWClutchLever +#endif + end subroutine + + subroutine SetEddyBreakLever(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetEddyBreakLever + !DEC$ ATTRIBUTES ALIAS: 'SetEddyBreakLever' :: SetEddyBreakLever + implicit none + real*8, intent(in) :: v + data%EquipmentControl%DrillingConsole%EddyBreakLever = v +#ifdef deb + print*, 'EddyBreakLever=', data%EquipmentControl%DrillingConsole%EddyBreakLever +#endif + end subroutine + + subroutine SetAutoDW(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetAutoDW + !DEC$ ATTRIBUTES ALIAS: 'SetAutoDW' :: SetAutoDW + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%AutoDW = v +#ifdef deb + print*, 'AutoDW=', data%EquipmentControl%DrillingConsole%AutoDW +#endif + end subroutine + + subroutine SetGEN1(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN1 + !DEC$ ATTRIBUTES ALIAS: 'SetGEN1' :: SetGEN1 + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%GEN1 = v +#ifdef deb + print*, 'GEN1=', data%EquipmentControl%DrillingConsole%GEN1 +#endif + end subroutine + + subroutine SetGEN2(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN2 + !DEC$ ATTRIBUTES ALIAS: 'SetGEN2' :: SetGEN2 + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%GEN2 = v +#ifdef deb + print*, 'GEN2=', data%EquipmentControl%DrillingConsole%GEN2 +#endif + end subroutine + + subroutine SetGEN3(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN3 + !DEC$ ATTRIBUTES ALIAS: 'SetGEN3' :: SetGEN3 + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%GEN3 = v +#ifdef deb + print*, 'GEN3=', data%EquipmentControl%DrillingConsole%GEN3 +#endif + end subroutine + + subroutine SetGEN4(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetGEN4 + !DEC$ ATTRIBUTES ALIAS: 'SetGEN4' :: SetGEN4 + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%GEN4 = v +#ifdef deb + print*, 'GEN4=', data%EquipmentControl%DrillingConsole%GEN4 +#endif + end subroutine + +! subroutine SetInstallSafetyValve(v) +! !DEC$ ATTRIBUTES DLLEXPORT :: SetInstallSafetyValve +! !DEC$ ATTRIBUTES ALIAS: 'SetInstallSafetyValve' :: SetInstallSafetyValve +! implicit none +! logical, intent(in) :: v +! InstallSafetyValve = v +!#ifdef deb +! print*, 'InstallSafetyValve=', InstallSafetyValve +!#endif +! end subroutine +! +! subroutine SetOpenSafetyValve(v) +! !DEC$ ATTRIBUTES DLLEXPORT :: SetOpenSafetyValve +! !DEC$ ATTRIBUTES ALIAS: 'SetOpenSafetyValve' :: SetOpenSafetyValve +! implicit none +! logical, intent(in) :: v +! OpenSafetyValve = v +!#ifdef deb +! print*, 'OpenSafetyValve=', OpenSafetyValve +!#endif +! end subroutine +! +! subroutine SetRemoveSafetyValve(v) +! !DEC$ ATTRIBUTES DLLEXPORT :: SetRemoveSafetyValve +! !DEC$ ATTRIBUTES ALIAS: 'SetRemoveSafetyValve' :: SetRemoveSafetyValve +! implicit none +! logical, intent(in) :: v +! RemoveSafetyValve = v +!#ifdef deb +! print*, 'RemoveSafetyValve=', RemoveSafetyValve +!#endif +! end subroutine +! +! subroutine SetCloseSafetyValve(v) +! !DEC$ ATTRIBUTES DLLEXPORT :: SetCloseSafetyValve +! !DEC$ ATTRIBUTES ALIAS: 'SetCloseSafetyValve' :: SetCloseSafetyValve +! implicit none +! logical, intent(in) :: v +! CloseSafetyValve = v +!#ifdef deb +! print*, 'CloseSafetyValve=', CloseSafetyValve +!#endif +! end subroutine +! +! subroutine SetMakeJoint(v) +! !DEC$ ATTRIBUTES DLLEXPORT :: SetMakeJoint +! !DEC$ ATTRIBUTES ALIAS: 'SetMakeJoint' :: SetMakeJoint +! implicit none +! logical, intent(in) :: v +! MakeJoint = v +!#ifdef deb +! print*, 'MakeJoint=', MakeJoint +!#endif +! end subroutine +! +! subroutine SetBreakJoint(v) +! !DEC$ ATTRIBUTES DLLEXPORT :: SetBreakJoint +! !DEC$ ATTRIBUTES ALIAS: 'SetBreakJoint' :: SetBreakJoint +! implicit none +! logical, intent(in) :: v +! BreakJoint = v +!#ifdef deb +! print*, 'BreakJoint=', BreakJoint +!#endif +! end subroutine + + subroutine SetOpenKellyCock(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetOpenKellyCock + !DEC$ ATTRIBUTES ALIAS: 'SetOpenKellyCock' :: SetOpenKellyCock + use CManifolds, OpenKellyCockSub => OpenKellyCock + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%OpenKellyCock == v) return + data%EquipmentControl%DrillingConsole%OpenKellyCock = v + ! if (v) call OnOpenKellyCockPress%RunAll() + if(v .and. data%EquipmentControl%DrillingConsole%Permission_OpenKellyCock) call OpenKellyCockSub() +#ifdef deb + print*, 'OpenKellyCock=', data%EquipmentControl%DrillingConsole%OpenKellyCock +#endif + end subroutine + + subroutine SetCloseKellyCock(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetCloseKellyCock + !DEC$ ATTRIBUTES ALIAS: 'SetCloseKellyCock' :: SetCloseKellyCock + use CManifolds, CloseKellyCockSub => CloseKellyCock + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%CloseKellyCock == v) return + data%EquipmentControl%DrillingConsole%CloseKellyCock = v + ! if (v) call OnCloseKellyCockPress%RunAll() + if(v .and. data%EquipmentControl%DrillingConsole%Permission_CloseKellyCock) call CloseKellyCockSub() +#ifdef deb + print*, 'CloseKellyCock=', data%EquipmentControl%DrillingConsole%CloseKellyCock +#endif + end subroutine + + subroutine SetOpenSafetyValve(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetOpenSafetyValve + !DEC$ ATTRIBUTES ALIAS: 'SetOpenSafetyValve' :: SetOpenSafetyValve + !use CManifolds, OpenSafetyValveSub => OpenSafetyValve + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%OpenSafetyValve == v) return + data%EquipmentControl%DrillingConsole%OpenSafetyValve = v + ! if (v) call OnOpenSafetyValvePress%RunAll() + !if(v .and. Permission_OpenSafetyValve) call OpenSafetyValveSub() +#ifdef deb + print*, 'OpenSafetyValve=', data%EquipmentControl%DrillingConsole%OpenSafetyValve +#endif + end subroutine + + subroutine SetCloseSafetyValve(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetCloseSafetyValve + !DEC$ ATTRIBUTES ALIAS: 'SetCloseSafetyValve' :: SetCloseSafetyValve + !use CManifolds, CloseSafetyValveSub => CloseSafetyValve + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%CloseSafetyValve == v) return + data%EquipmentControl%DrillingConsole%CloseSafetyValve = v + ! if (v) call OnCloseSafetyValvePress%RunAll() + !if(v .and. Permission_CloseSafetyValve) call CloseSafetyValveSub() +#ifdef deb + print*, 'CloseSafetyValve=', data%EquipmentControl%DrillingConsole%CloseSafetyValve +#endif + end subroutine + + subroutine SetIRSafetyValve(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetIRSafetyValve + !DEC$ ATTRIBUTES ALIAS: 'SetIRSafetyValve' :: SetIRSafetyValve + use CManifolds + implicit none + logical, intent(in) :: v + logical :: prev + if (data%EquipmentControl%DrillingConsole%IRSafetyValve == v) return + prev = data%EquipmentControl%DrillingConsole%IRSafetyValve + data%EquipmentControl%DrillingConsole%IRSafetyValve = v + ! if (v) call OnIRSafetyValvePress%RunAll() + !if(prev /= IRSafetyValve .and. v .and. Permission_IRSafetyValve) call ToggleSafetyValve() + !if(prev /= IRSafetyValve .and. v) call ToggleSafetyValve() +#ifdef deb + print*, 'IRSafetyValve=', data%EquipmentControl%DrillingConsole%IRSafetyValve +#endif + end subroutine + + subroutine SetIRIBop(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetIRIBop + !DEC$ ATTRIBUTES ALIAS: 'SetIRIBop' :: SetIRIBop + use CManifolds + implicit none + logical, intent(in) :: v + logical :: prev + if (data%EquipmentControl%DrillingConsole%IRIBop == v) return + prev = data%EquipmentControl%DrillingConsole%IRIBop + data%EquipmentControl%DrillingConsole%IRIBop = v + ! if (v) call OnIRIBopPress%RunAll() + !if(prev /= IRIBop .and. v .and. Permission_IRIBop) call ToggleIBop() + !if(prev /= IRIBop .and. v) call ToggleIBop() +#ifdef deb + print*, 'IRIBop=', data%EquipmentControl%DrillingConsole%IRIBop +#endif + end subroutine + + + + subroutine SetLatchPipe(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetLatchPipe + !DEC$ ATTRIBUTES ALIAS: 'SetLatchPipe' :: SetLatchPipe + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%LatchPipe .eqv. v) return + data%EquipmentControl%DrillingConsole%LatchPipe = v + ! if (v) call OnLatchPipePress%RunAll() +#ifdef deb + print*, 'LatchPipe=', data%EquipmentControl%DrillingConsole%LatchPipe +#endif + end subroutine + + subroutine SetUnlatchPipe(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetUnlatchPipe + !DEC$ ATTRIBUTES ALIAS: 'SetUnlatchPipe' :: SetUnlatchPipe + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%UnlatchPipe .eqv. v) return + data%EquipmentControl%DrillingConsole%UnlatchPipe = v + ! if (v) call OnUnlatchPipePress%RunAll() +#ifdef deb + print*, 'UnlatchPipe=', data%EquipmentControl%DrillingConsole%UnlatchPipe +#endif + end subroutine + + subroutine SetSwing(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetSwing + !DEC$ ATTRIBUTES ALIAS: 'SetSwing' :: SetSwing + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%Swing .eqv. v) return + data%EquipmentControl%DrillingConsole%Swing = v + ! if (v) call OnSwingPress%RunAll() +#ifdef deb + print*, 'Swing=', data%EquipmentControl%DrillingConsole%Swing +#endif + end subroutine + + subroutine SetFillMouseHole(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetFillMouseHole + !DEC$ ATTRIBUTES ALIAS: 'SetFillMouseHole' :: SetFillMouseHole + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%FillMouseHole .eqv. v) return + data%EquipmentControl%DrillingConsole%FillMouseHole = v + ! if (v) call OnFillMouseHolePress%RunAll() +#ifdef deb + print*, 'FillMouseHole=', data%EquipmentControl%DrillingConsole%FillMouseHole +#endif + end subroutine + + subroutine SetSlips(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetSlips + !DEC$ ATTRIBUTES ALIAS: 'SetSlips' :: SetSlips + implicit none + logical, intent(in) :: v + if (data%EquipmentControl%DrillingConsole%Slips .eqv. v) return + data%EquipmentControl%DrillingConsole%Slips = v +#ifdef deb + print*, 'Slips=', data%EquipmentControl%DrillingConsole%Slips +#endif + ! if (v) call OnSlipsPress%RunAll() + end subroutine + + + subroutine SetBrakeLeverCoefficient(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetBrakeLeverCoefficient + !DEC$ ATTRIBUTES ALIAS: 'SetBrakeLeverCoefficient' :: SetBrakeLeverCoefficient + implicit none + real, intent(in) :: v + data%EquipmentControl%DrillingConsole%BrakeLeverCoefficient = v +#ifdef deb + print*, 'BrakeLeverCoefficient=', data%EquipmentControl%DrillingConsole%BrakeLeverCoefficient +#endif + end subroutine + + subroutine SetHideDrillingBrake(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetHideDrillingBrake + !DEC$ ATTRIBUTES ALIAS: 'SetHideDrillingBrake' :: SetHideDrillingBrake + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%HideDrillingBrake = v +#ifdef deb + print*, 'HideDrillingBrake=', data%EquipmentControl%DrillingConsole%HideDrillingBrake +#endif + end subroutine + + + + + + + + + subroutine SetParkingBrake(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetParkingBrake + !DEC$ ATTRIBUTES ALIAS: 'SetParkingBrake' :: SetParkingBrake + implicit none + logical, intent(in) :: v + data%EquipmentControl%DrillingConsole%ParkingBrakeBtn = v +#ifdef deb + print*, 'ParkingBrakeBtn=', data%EquipmentControl%DrillingConsole%ParkingBrakeBtn +#endif + end subroutine + + + + + + + + + + + + + ! Output routines + + logical function GetParkingBrakeLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetParkingBrakeLed + !DEC$ ATTRIBUTES ALIAS: 'GetParkingBrakeLed' :: GetParkingBrakeLed + implicit none + GetParkingBrakeLed = data%EquipmentControl%DrillingConsole%ParkingBrakeLed + !GetParkingBrakeLed = .true. + end function + + + integer function GetGEN1LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN1LED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN1LED' :: GetGEN1LED + implicit none + GetGEN1LED = 1 + !GetGEN1LED = GEN1LED + end function + + integer function GetGEN2LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN2LED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN2LED' :: GetGEN2LED + implicit none + GetGEN2LED = 1 + !GetGEN2LED = GEN2LED + end function + + integer function GetGEN3LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN3LED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN3LED' :: GetGEN3LED + implicit none + GetGEN3LED = 1 + !GetGEN3LED = GEN3LED + end function + + integer function GetGEN4LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN4LED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN4LED' :: GetGEN4LED + implicit none + GetGEN4LED = 1 + !GetGEN4LED = GEN4LED + end function + + integer function GetSCR1LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR1LED + !DEC$ ATTRIBUTES ALIAS: 'GetSCR1LED' :: GetSCR1LED + implicit none + GetSCR1LED = data%EquipmentControl%DrillingConsole%SCR1LED + end function + + integer function GetSCR2LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR2LED + !DEC$ ATTRIBUTES ALIAS: 'GetSCR2LED' :: GetSCR2LED + implicit none + GetSCR2LED = data%EquipmentControl%DrillingConsole%SCR2LED + end function + + integer function GetSCR3LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR3LED + !DEC$ ATTRIBUTES ALIAS: 'GetSCR3LED' :: GetSCR3LED + implicit none + GetSCR3LED = data%EquipmentControl%DrillingConsole%SCR3LED + end function + + integer function GetSCR4LED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetSCR4LED + !DEC$ ATTRIBUTES ALIAS: 'GetSCR4LED' :: GetSCR4LED + implicit none + GetSCR4LED = data%EquipmentControl%DrillingConsole%SCR4LED + end function + + integer function GetMP1BLWR() + !DEC$ ATTRIBUTES DLLEXPORT :: GetMP1BLWR + !DEC$ ATTRIBUTES ALIAS: 'GetMP1BLWR' :: GetMP1BLWR + implicit none + GetMP1BLWR = data%EquipmentControl%DrillingConsole%MP1BLWR + end function + + integer function GetMP2BLWR() + !DEC$ ATTRIBUTES DLLEXPORT :: GetMP2BLWR + !DEC$ ATTRIBUTES ALIAS: 'GetMP2BLWR' :: GetMP2BLWR + implicit none + GetMP2BLWR = data%EquipmentControl%DrillingConsole%MP2BLWR + end function + + integer function GetDWBLWR() + !DEC$ ATTRIBUTES DLLEXPORT :: GetDWBLWR + !DEC$ ATTRIBUTES ALIAS: 'GetDWBLWR' :: GetDWBLWR + implicit none + GetDWBLWR = data%EquipmentControl%DrillingConsole%DWBLWR + end function + + integer function GetRTBLWR() + !DEC$ ATTRIBUTES DLLEXPORT :: GetRTBLWR + !DEC$ ATTRIBUTES ALIAS: 'GetRTBLWR' :: GetRTBLWR + implicit none + GetRTBLWR = data%EquipmentControl%DrillingConsole%RTBLWR + end function + + integer function GetPWRLIM() + !DEC$ ATTRIBUTES DLLEXPORT :: GetPWRLIM + !DEC$ ATTRIBUTES ALIAS: 'GetPWRLIM' :: GetPWRLIM + implicit none + GetPWRLIM = data%EquipmentControl%DrillingConsole%PWRLIM + end function + + real(8) function GetPWRLIMMTR() + !DEC$ ATTRIBUTES DLLEXPORT :: GetPWRLIMMTR + !DEC$ ATTRIBUTES ALIAS: 'GetPWRLIMMTR' :: GetPWRLIMMTR + implicit none + GetPWRLIMMTR = data%EquipmentControl%DrillingConsole%PWRLIMMTR + end function + + real(8) function GetRTTorqueLimitGauge() + !DEC$ ATTRIBUTES DLLEXPORT :: GetRTTorqueLimitGauge + !DEC$ ATTRIBUTES ALIAS: 'GetRTTorqueLimitGauge' :: GetRTTorqueLimitGauge + implicit none + GetRTTorqueLimitGauge = data%EquipmentControl%DrillingConsole%RTTorqueLimitGauge + end function + + integer function GetAutoDWLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetAutoDWLED + !DEC$ ATTRIBUTES ALIAS: 'GetAutoDWLED' :: GetAutoDWLED + implicit none + GetAutoDWLED = data%EquipmentControl%DrillingConsole%AutoDWLED + end function + + integer function GetGEN1BTNLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN1BTNLED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN1BTNLED' :: GetGEN1BTNLED + implicit none + GetGEN1BTNLED = data%EquipmentControl%DrillingConsole%GEN1BTNLED + end function + + integer function GetGEN2BTNLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN2BTNLED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN2BTNLED' :: GetGEN2BTNLED + implicit none + GetGEN2BTNLED = data%EquipmentControl%DrillingConsole%GEN2BTNLED + end function + + integer function GetGEN3BTNLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN3BTNLED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN3BTNLED' :: GetGEN3BTNLED + implicit none + GetGEN3BTNLED = data%EquipmentControl%DrillingConsole%GEN3BTNLED + end function + + integer function GetGEN4BTNLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetGEN4BTNLED + !DEC$ ATTRIBUTES ALIAS: 'GetGEN4BTNLED' :: GetGEN4BTNLED + implicit none + GetGEN4BTNLED = data%EquipmentControl%DrillingConsole%GEN4BTNLED + end function + + integer function GetOpenKellyCockLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetOpenKellyCockLed + !DEC$ ATTRIBUTES ALIAS: 'GetOpenKellyCockLed' :: GetOpenKellyCockLed + implicit none + GetOpenKellyCockLed = data%EquipmentControl%DrillingConsole%OpenKellyCockLed + end function + + integer function GetCloseKellyCockLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetCloseKellyCockLed + !DEC$ ATTRIBUTES ALIAS: 'GetCloseKellyCockLed' :: GetCloseKellyCockLed + implicit none + GetCloseKellyCockLed = data%EquipmentControl%DrillingConsole%CloseKellyCockLed + end function + + integer function GetOpenSafetyValveLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetOpenSafetyValveLed + !DEC$ ATTRIBUTES ALIAS: 'GetOpenSafetyValveLed' :: GetOpenSafetyValveLed + implicit none + GetOpenSafetyValveLed = data%EquipmentControl%DrillingConsole%OpenSafetyValveLed + end function + + integer function GetCloseSafetyValveLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetCloseSafetyValveLed + !DEC$ ATTRIBUTES ALIAS: 'GetCloseSafetyValveLed' :: GetCloseSafetyValveLed + implicit none + GetCloseSafetyValveLed = data%EquipmentControl%DrillingConsole%CloseSafetyValveLed + end function + + integer function GetIRSafetyValveLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetIRSafetyValveLed + !DEC$ ATTRIBUTES ALIAS: 'GetIRSafetyValveLed' :: GetIRSafetyValveLed + implicit none + GetIRSafetyValveLed = data%EquipmentControl%DrillingConsole%IRSafetyValveLed + end function + + integer function GetIRIBopLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetIRIBopLed + !DEC$ ATTRIBUTES ALIAS: 'GetIRIBopLed' :: GetIRIBopLed + implicit none + GetIRIBopLed = data%EquipmentControl%DrillingConsole%IRIBopLed + end function + + + integer function GetLatchPipeLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetLatchPipeLED + !DEC$ ATTRIBUTES ALIAS: 'GetLatchPipeLED' :: GetLatchPipeLED + implicit none + GetLatchPipeLED = data%EquipmentControl%DrillingConsole%LatchPipeLED + end function + + integer function GetUnlatchPipeLED() + !DEC$ ATTRIBUTES DLLEXPORT :: GetUnlatchPipeLED + !DEC$ ATTRIBUTES ALIAS: 'GetUnlatchPipeLED' :: GetUnlatchPipeLED + implicit none + GetUnlatchPipeLED = data%EquipmentControl%DrillingConsole%UnlatchPipeLED + end function + + integer function GetSwingLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetSwingLed + !DEC$ ATTRIBUTES ALIAS: 'GetSwingLed' :: GetSwingLed + implicit none + GetSwingLed = data%EquipmentControl%DrillingConsole%SwingLed + end function + + integer function GetFillMouseHoleLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetFillMouseHoleLed + !DEC$ ATTRIBUTES ALIAS: 'GetFillMouseHoleLed' :: GetFillMouseHoleLed + implicit none + GetFillMouseHoleLed = data%EquipmentControl%DrillingConsole%FillMouseHoleLed + end function + end module CDrillingConsole \ No newline at end of file diff --git a/CSharp/Equipments/ControlPanels/CHook.f90 b/CSharp/Equipments/ControlPanels/CHook.f90 index c702a4e..c80b292 100644 --- a/CSharp/Equipments/ControlPanels/CHook.f90 +++ b/CSharp/Equipments/ControlPanels/CHook.f90 @@ -1,64 +1,78 @@ -module CHook - use CHookVariables - use SimulationVariables - implicit none - public - contains - - subroutine Set_HookHeight(v) - use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables - implicit none - real , intent(in) :: v - -#ifdef ExcludeExtraChanges - if(data%EquipmentControl%Hook%HookHeight == v) return -#endif - data%EquipmentControl%Hook%HookHeight = v - - ! if(associated(HookHeightPtr)) then - ! call HookHeightPtr(data%EquipmentControl%Hook%HookHeight) - ! end if - -#ifdef deb - print*, 'HookHeight=', data%EquipmentControl%Hook%HookHeight -#endif - - !**call data%EquipmentControl%Hook%OnHookHeightChange%RunAll(data%EquipmentControl%Hook%HookHeight) - end subroutine - - - subroutine Set_HookHeight_S(v) - implicit none - real , intent(in) :: v - - if(v == data%EquipmentControl%Hook%HookHeight) then - return - elseif (v > data%EquipmentControl%Hook%HookHeight) then - loop1: do - call Set_HookHeight(data%EquipmentControl%Hook%HookHeight + 0.2) - if(abs(v - data%EquipmentControl%Hook%HookHeight) <= 0.1) then - call Set_HookHeight(v) - exit loop1 - endif - call sleepqq(100) - enddo loop1 - else ! v < HookHeight - loop2: do - call Set_HookHeight(data%EquipmentControl%Hook%HookHeight - 0.2) - if(abs(data%EquipmentControl%Hook%HookHeight - v) <= 0.1) then - call Set_HookHeight(v) - exit loop2 - endif - call sleepqq(100) - enddo loop2 - endif - - end subroutine - - subroutine Update_HookHeight_From_Snapshot() - implicit none - call Set_HookHeight_S(data%EquipmentControl%Hook%HookHeight_S) - end subroutine - end module CHook +module CHook + use CHookVariables + use SimulationVariables + implicit none + public + contains + + subroutine CHookToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CHook') + call json%add(p,"HookHeight_S",data%Equipments%ControlPanel%CHook%HookHeight_S) + call json%add(p,"HookHeight",data%Equipments%ControlPanel%CHook%HookHeight) + + call json%add(parent,p) + end subroutine + + subroutine Set_HookHeight(v) + use CDrillingConsoleVariables + use SimulationVariables + use SimulationVariables + implicit none + real , intent(in) :: v + +#ifdef ExcludeExtraChanges + if(data%EquipmentControl%Hook%HookHeight == v) return +#endif + data%EquipmentControl%Hook%HookHeight = v + + ! if(associated(HookHeightPtr)) then + ! call HookHeightPtr(data%EquipmentControl%Hook%HookHeight) + ! end if + +#ifdef deb + print*, 'HookHeight=', data%EquipmentControl%Hook%HookHeight +#endif + + !**call data%EquipmentControl%Hook%OnHookHeightChange%RunAll(data%EquipmentControl%Hook%HookHeight) + end subroutine + + + subroutine Set_HookHeight_S(v) + implicit none + real , intent(in) :: v + + if(v == data%EquipmentControl%Hook%HookHeight) then + return + elseif (v > data%EquipmentControl%Hook%HookHeight) then + loop1: do + call Set_HookHeight(data%EquipmentControl%Hook%HookHeight + 0.2) + if(abs(v - data%EquipmentControl%Hook%HookHeight) <= 0.1) then + call Set_HookHeight(v) + exit loop1 + endif + call sleepqq(100) + enddo loop1 + else ! v < HookHeight + loop2: do + call Set_HookHeight(data%EquipmentControl%Hook%HookHeight - 0.2) + if(abs(data%EquipmentControl%Hook%HookHeight - v) <= 0.1) then + call Set_HookHeight(v) + exit loop2 + endif + call sleepqq(100) + enddo loop2 + endif + + end subroutine + + subroutine Update_HookHeight_From_Snapshot() + implicit none + call Set_HookHeight_S(data%EquipmentControl%Hook%HookHeight_S) + end subroutine + end module CHook diff --git a/CSharp/Equipments/ControlPanels/CStandPipeManifold.f90 b/CSharp/Equipments/ControlPanels/CStandPipeManifold.f90 index fcbe597..d58f1b4 100644 --- a/CSharp/Equipments/ControlPanels/CStandPipeManifold.f90 +++ b/CSharp/Equipments/ControlPanels/CStandPipeManifold.f90 @@ -1,207 +1,238 @@ -module CStandPipeManifold - use CStandPipeManifoldVariables - use SimulationVariables - use CManifolds - implicit none - public - contains - - ! Input routines - subroutine SetStandPipeManifoldValve1(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve1 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve1' :: SetStandPipeManifoldValve1 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve1 = v - call ChangeValve(13, v) -#ifdef deb - print*, 'StandPipeManifoldValve1=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve1 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve2(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve2 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve2' :: SetStandPipeManifoldValve2 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve2 = v - call ChangeValve(14, v) -#ifdef deb - print*, 'StandPipeManifoldValve2=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve2 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve3(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve3 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve3' :: SetStandPipeManifoldValve3 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve3 = v - call ChangeValve(15, v) -#ifdef deb - print*, 'StandPipeManifoldValve3=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve3 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve4(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve4 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve4' :: SetStandPipeManifoldValve4 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve4 = v - call ChangeValve(11, v) -#ifdef deb - print*, 'StandPipeManifoldValve4=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve4 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve5(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve5 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve5' :: SetStandPipeManifoldValve5 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve5 = v - call ChangeValve(12, v) -#ifdef deb - print*, 'StandPipeManifoldValve5=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve5 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve6(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve6 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve6' :: SetStandPipeManifoldValve6 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve6 = v - call ChangeValve(9, v) -#ifdef deb - print*, 'StandPipeManifoldValve6=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve6 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve7(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve7 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve7' :: SetStandPipeManifoldValve7 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve7 = v - call ChangeValve(10, v) -#ifdef deb - print*, 'StandPipeManifoldValve7=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve7 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve8(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve8 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve8' :: SetStandPipeManifoldValve8 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve8 = v - call ChangeValve(6, v) -#ifdef deb - print*, 'StandPipeManifoldValve8=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve8 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve9(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve9 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve9' :: SetStandPipeManifoldValve9 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve9 = v - call ChangeValve(7, v) -#ifdef deb - print*, 'StandPipeManifoldValve9=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve9 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve10(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve10 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve10' :: SetStandPipeManifoldValve10 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve10 = v - call ChangeValve(8, v) -#ifdef deb - print*, 'StandPipeManifoldValve10=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve10 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve11(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve11 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve11' :: SetStandPipeManifoldValve11 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve11 = v - call ChangeValve(1, v) -#ifdef deb - print*, 'StandPipeManifoldValve11=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve11 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve12(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve12 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve12' :: SetStandPipeManifoldValve12 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve12 = v - call ChangeValve(2, v) -#ifdef deb - print*, 'StandPipeManifoldValve12=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve12 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve13(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve13 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve13' :: SetStandPipeManifoldValve13 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve13 = v - call ChangeValve(3, v) -#ifdef deb - print*, 'StandPipeManifoldValve13=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve13 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve14(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve14 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve14' :: SetStandPipeManifoldValve14 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve14 = v - call ChangeValve(4, v) -#ifdef deb - print*, 'StandPipeManifoldValve14=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve14 -#endif - end subroutine - - subroutine SetStandPipeManifoldValve15(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve15 - !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve15' :: SetStandPipeManifoldValve15 - implicit none - logical, intent(in) :: v - data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve15 = v - call ChangeValve(5, v) -#ifdef deb - print*, 'StandPipeManifoldValve15=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve15 -#endif - end subroutine - - ! Output routines - real(8) function GetStandPipeGauge1() - !DEC$ ATTRIBUTES DLLEXPORT :: GetStandPipeGauge1 - !DEC$ ATTRIBUTES ALIAS: 'GetStandPipeGauge1' :: GetStandPipeGauge1 - implicit none - GetStandPipeGauge1 = data%EquipmentControl%StandPipeManifold%StandPipeGauge1 - !GetStandPipeGauge1 = 567.4 - end function - - real(8) function GetStandPipeGauge2() - !DEC$ ATTRIBUTES DLLEXPORT :: GetStandPipeGauge2 - !DEC$ ATTRIBUTES ALIAS: 'GetStandPipeGauge2' :: GetStandPipeGauge2 - implicit none - GetStandPipeGauge2 = data%EquipmentControl%StandPipeManifold%StandPipeGauge2 - !GetStandPipeGauge2 = 1564.0 - end function - +module CStandPipeManifold + use CStandPipeManifoldVariables + use SimulationVariables + use CManifolds + implicit none + public + contains + + + subroutine CStandPipeToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p + + ! 1. create new node + call json%create_object(p,'CStandPipe') + + call json%add(p,"StandPipeManifoldValve1",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve1) + call json%add(p,"StandPipeManifoldValve2",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve2) + call json%add(p,"StandPipeManifoldValve3",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve3) + call json%add(p,"StandPipeManifoldValve4",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve4) + call json%add(p,"StandPipeManifoldValve5",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve5) + call json%add(p,"StandPipeManifoldValve6",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve6) + call json%add(p,"StandPipeManifoldValve7",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve7) + call json%add(p,"StandPipeManifoldValve8",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve8) + call json%add(p,"StandPipeManifoldValve9",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve9) + call json%add(p,"StandPipeManifoldValve10",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve10) + call json%add(p,"StandPipeManifoldValve11",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve11) + call json%add(p,"StandPipeManifoldValve12",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve12) + call json%add(p,"StandPipeManifoldValve13",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve13) + call json%add(p,"StandPipeManifoldValve14",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve14) + call json%add(p,"StandPipeManifoldValve15",data%Equipments%ControlPanel%CStandPipe%StandPipeManifoldValve15) + call json%add(p,"StandPipeGauge1",data%Equipments%ControlPanel%CStandPipe%StandPipeGauge1) + call json%add(p,"StandPipeGauge2",data%Equipments%ControlPanel%CStandPipe%StandPipeGauge2) + + call json%add(parent,p) + end subroutine + + ! Input routines + subroutine SetStandPipeManifoldValve1(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve1 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve1' :: SetStandPipeManifoldValve1 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve1 = v + call ChangeValve(13, v) +#ifdef deb + print*, 'StandPipeManifoldValve1=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve1 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve2(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve2 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve2' :: SetStandPipeManifoldValve2 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve2 = v + call ChangeValve(14, v) +#ifdef deb + print*, 'StandPipeManifoldValve2=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve2 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve3(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve3 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve3' :: SetStandPipeManifoldValve3 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve3 = v + call ChangeValve(15, v) +#ifdef deb + print*, 'StandPipeManifoldValve3=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve3 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve4(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve4 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve4' :: SetStandPipeManifoldValve4 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve4 = v + call ChangeValve(11, v) +#ifdef deb + print*, 'StandPipeManifoldValve4=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve4 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve5(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve5 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve5' :: SetStandPipeManifoldValve5 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve5 = v + call ChangeValve(12, v) +#ifdef deb + print*, 'StandPipeManifoldValve5=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve5 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve6(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve6 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve6' :: SetStandPipeManifoldValve6 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve6 = v + call ChangeValve(9, v) +#ifdef deb + print*, 'StandPipeManifoldValve6=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve6 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve7(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve7 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve7' :: SetStandPipeManifoldValve7 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve7 = v + call ChangeValve(10, v) +#ifdef deb + print*, 'StandPipeManifoldValve7=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve7 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve8(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve8 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve8' :: SetStandPipeManifoldValve8 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve8 = v + call ChangeValve(6, v) +#ifdef deb + print*, 'StandPipeManifoldValve8=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve8 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve9(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve9 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve9' :: SetStandPipeManifoldValve9 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve9 = v + call ChangeValve(7, v) +#ifdef deb + print*, 'StandPipeManifoldValve9=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve9 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve10(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve10 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve10' :: SetStandPipeManifoldValve10 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve10 = v + call ChangeValve(8, v) +#ifdef deb + print*, 'StandPipeManifoldValve10=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve10 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve11(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve11 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve11' :: SetStandPipeManifoldValve11 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve11 = v + call ChangeValve(1, v) +#ifdef deb + print*, 'StandPipeManifoldValve11=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve11 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve12(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve12 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve12' :: SetStandPipeManifoldValve12 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve12 = v + call ChangeValve(2, v) +#ifdef deb + print*, 'StandPipeManifoldValve12=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve12 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve13(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve13 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve13' :: SetStandPipeManifoldValve13 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve13 = v + call ChangeValve(3, v) +#ifdef deb + print*, 'StandPipeManifoldValve13=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve13 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve14(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve14 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve14' :: SetStandPipeManifoldValve14 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve14 = v + call ChangeValve(4, v) +#ifdef deb + print*, 'StandPipeManifoldValve14=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve14 +#endif + end subroutine + + subroutine SetStandPipeManifoldValve15(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetStandPipeManifoldValve15 + !DEC$ ATTRIBUTES ALIAS: 'SetStandPipeManifoldValve15' :: SetStandPipeManifoldValve15 + implicit none + logical, intent(in) :: v + data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve15 = v + call ChangeValve(5, v) +#ifdef deb + print*, 'StandPipeManifoldValve15=', data%EquipmentControl%StandPipeManifold%StandPipeManifoldValve15 +#endif + end subroutine + + ! Output routines + real(8) function GetStandPipeGauge1() + !DEC$ ATTRIBUTES DLLEXPORT :: GetStandPipeGauge1 + !DEC$ ATTRIBUTES ALIAS: 'GetStandPipeGauge1' :: GetStandPipeGauge1 + implicit none + GetStandPipeGauge1 = data%EquipmentControl%StandPipeManifold%StandPipeGauge1 + !GetStandPipeGauge1 = 567.4 + end function + + real(8) function GetStandPipeGauge2() + !DEC$ ATTRIBUTES DLLEXPORT :: GetStandPipeGauge2 + !DEC$ ATTRIBUTES ALIAS: 'GetStandPipeGauge2' :: GetStandPipeGauge2 + implicit none + GetStandPipeGauge2 = data%EquipmentControl%StandPipeManifold%StandPipeGauge2 + !GetStandPipeGauge2 = 1564.0 + end function + end module CStandPipeManifold \ No newline at end of file diff --git a/CSharp/Equipments/ControlPanels/CTopDrivePanel.f90 b/CSharp/Equipments/ControlPanels/CTopDrivePanel.f90 index ccfa66c..e0e2441 100644 --- a/CSharp/Equipments/ControlPanels/CTopDrivePanel.f90 +++ b/CSharp/Equipments/ControlPanels/CTopDrivePanel.f90 @@ -1,216 +1,267 @@ -module CTopDrivePanel - use CTopDrivePanelVariables - use SimulationVariables - use CLog3 - implicit none - public - contains - - ! Input routines - subroutine SetTopDriveTdsPowerState(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTdsPowerState - !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTdsPowerState' :: SetTopDriveTdsPowerState - implicit none - integer, intent(in) :: v - data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState = v -#ifdef deb - call Log_3( 'TopDriveTdsPowerState=', data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState) -#endif - end subroutine - - subroutine SetTopDriveTorqueWrench(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTorqueWrench - !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTorqueWrench' :: SetTopDriveTorqueWrench - implicit none - logical, intent(in) :: v - data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrench = v -#ifdef deb - call Log_3( 'TopDriveTorqueWrench=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrench) -#endif - end subroutine - - subroutine SetTopDriveDrillTorqueState(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveDrillTorqueState - !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveDrillTorqueState' :: SetTopDriveDrillTorqueState - implicit none - integer, intent(in) :: v - data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState = v -#ifdef deb - call Log_3( 'TopDriveDrillTorqueState=', data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState) -#endif - end subroutine - - subroutine SetTopDriveLinkTiltState(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveLinkTiltState - !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveLinkTiltState' :: SetTopDriveLinkTiltState - implicit none - integer, intent(in) :: v - data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltState = v -#ifdef deb - call Log_3( 'TopDriveLinkTiltState=', data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltState) -#endif - end subroutine - - subroutine SetTopDriveIbop(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveIbop - !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveIbop' :: SetTopDriveIbop - implicit none - logical, intent(in) :: v - data%EquipmentControl%TopDrivePanel%TopDriveIbop = v -#ifdef deb - call Log_3( 'TopDriveIbop=', data%EquipmentControl%TopDrivePanel%TopDriveIbop) -#endif - end subroutine - - subroutine SetTopDriveTorqueLimitKnob(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTorqueLimitKnob - !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTorqueLimitKnob' :: SetTopDriveTorqueLimitKnob - ! use CSimulationVariables, only: IsPortable - use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables!, only: data%EquipmentControl%DrillingConsole%RTSwitch, data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob - use CWarnings, only: Activate_TopdriveRotaryTableConfilict - use CScaleRange - implicit none - real, intent(in) :: v - if (IsPortable) then - if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) call Activate_TopdriveRotaryTableConfilict() - if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch == 0) then - data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = 0 - data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = v -#ifdef deb - call Log_3( 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob ) - call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob ) -#endif - endif - if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) then - data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = 0 - data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = real(ScaleRange(v, 0.0, 10.0, 0.0, 6000.0), 8) -#ifdef deb - call Log_3( 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob ) - call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob ) -#endif - endif - else - data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = v -#ifdef deb - call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob) -#endif - endif - - end subroutine - - subroutine SetRpmKnob(v) - !DEC$ ATTRIBUTES DLLEXPORT :: SetRpmKnob - !DEC$ ATTRIBUTES ALIAS: 'SetRpmKnob' :: SetRpmKnob - ! use CSimulationVariables, only: IsPortable - use CDrillingConsoleVariables - use SimulationVariables - use SimulationVariables!, only: data%EquipmentControl%DrillingConsole%RTSwitch, data%EquipmentControl%DrillingConsole%RTThrottle - use CWarnings, only: Activate_TopdriveRotaryTableConfilict - use CScaleRange - implicit none - real, intent(in) :: v - if (IsPortable) then - if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) call Activate_TopdriveRotaryTableConfilict() - if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch == 0) then - data%EquipmentControl%DrillingConsole%RTThrottle = 0 - data%EquipmentControl%TopDrivePanel%RpmKnob = v -#ifdef deb - call Log_3( 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle ) - call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob ) -#endif - endif - if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) then - data%EquipmentControl%TopDrivePanel%RpmKnob = 0 - data%EquipmentControl%DrillingConsole%RTThrottle = real(ScaleRange(v, 0.0, 965.0, 0.0, 250.0), 8) -#ifdef deb - call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob ) - call Log_3( 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle ) -#endif - endif - else - data%EquipmentControl%TopDrivePanel%RpmKnob = v - endif - - - - if (IsPortable) then - ! - else - data%EquipmentControl%TopDrivePanel%RpmKnob = v -#ifdef deb - call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob ) -#endif - endif - - end subroutine - - - ! Output routines - integer function GetTopDriveOperationFaultLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveOperationFaultLed - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveOperationFaultLed' :: GetTopDriveOperationFaultLed - implicit none - GetTopDriveOperationFaultLed = data%EquipmentControl%TopDrivePanel%TopDriveOperationFaultLed - !GetTopDriveOperationFaultLed = 1 - end function - - integer function GetTopDriveTdsPowerLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTdsPowerLed - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTdsPowerLed' :: GetTopDriveTdsPowerLed - implicit none - GetTopDriveTdsPowerLed = data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerLed - !GetTopDriveTdsPowerLed = 1 - end function - - integer function GetTopDriveTorqueWrenchLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueWrenchLed - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueWrenchLed' :: GetTopDriveTorqueWrenchLed - implicit none - GetTopDriveTorqueWrenchLed = data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrenchLed - !GetTopDriveTorqueWrenchLed = 1 - end function - - integer function GetTopDriveLinkTiltLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveLinkTiltLed - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveLinkTiltLed' :: GetTopDriveLinkTiltLed - implicit none - GetTopDriveLinkTiltLed = data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltLed - !GetTopDriveLinkTiltLed = 1 - end function - - integer function GetTopDriveIbopLed() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveIbopLed - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveIbopLed' :: GetTopDriveIbopLed - implicit none - GetTopDriveIbopLed = data%EquipmentControl%TopDrivePanel%TopDriveIbopLed - !GetTopDriveIbopLed = 1 - end function - - real function GetTopDriveTorqueGauge() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueGauge - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueGauge' :: GetTopDriveTorqueGauge - implicit none - GetTopDriveTorqueGauge = data%EquipmentControl%TopDrivePanel%TopDriveTorqueGauge - !GetTopDriveTorqueGauge = 340 - end function - - real function GetTopDriveTorqueLimitGauge() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueLimitGauge - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueLimitGauge' :: GetTopDriveTorqueLimitGauge - implicit none - GetTopDriveTorqueLimitGauge = data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitGauge - !GetTopDriveTorqueLimitGauge = 442 - end function - - real function GetTopDriveRpmGauge() - !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveRpmGauge - !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveRpmGauge' :: GetTopDriveRpmGauge - implicit none - GetTopDriveRpmGauge = data%EquipmentControl%TopDrivePanel%TopDriveRpmGauge - !GetTopDriveRpmGauge = 67 - end function - - - end module CTopDrivePanel +module CTopDrivePanel + use CTopDrivePanelVariables + use SimulationVariables + use CLog3 + implicit none + public + contains + + subroutine CDrivePanelToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p,pform + integer :: i + + + ! 1. create new node + call json%create_object(p,'CDrivePanel') + + call json%add(p,"TdsPower_REV",data%Equipments%ControlPanel%CTopDrive%TdsPower_REV) + call json%add(p,"TdsPower_OFF",data%Equipments%ControlPanel%CTopDrive%TdsPower_OFF) + call json%add(p,"TdsPower_FWD",data%Equipments%ControlPanel%CTopDrive%TdsPower_FWD) + call json%add(p,"TdsMu_TORQ",data%Equipments%ControlPanel%CTopDrive%TdsMu_TORQ) + call json%add(p,"TdsMu_SPINE",data%Equipments%ControlPanel%CTopDrive%TdsMu_SPINE) + call json%add(p,"TdsMu_DRILL",data%Equipments%ControlPanel%CTopDrive%TdsMu_DRILL) + call json%add(p,"TdsLinkTilt_TILT",data%Equipments%ControlPanel%CTopDrive%TdsLinkTilt_TILT) + call json%add(p,"TdsLinkTilt_OFF",data%Equipments%ControlPanel%CTopDrive%TdsLinkTilt_OFF) + call json%add(p,"TdsLinkTilt_DRILL",data%Equipments%ControlPanel%CTopDrive%TdsLinkTilt_DRILL) + call json%add(p,"LED_OFF",data%Equipments%ControlPanel%CTopDrive%LED_OFF) + call json%add(p,"LED_ON",data%Equipments%ControlPanel%CTopDrive%LED_ON) + call json%add(p,"LED_BLINK",data%Equipments%ControlPanel%CTopDrive%LED_BLINK) + + + do i=1,data%Equipments%ControlPanel%CTopDrive%Count + call json%create_object(pform,'') + + call json%add(pform,"TopDriveTdsPowerState",data%Equipments%ControlPanel%CTopDrive%TopDriveTdsPowerState) + call json%add(pform,"TopDriveTorqueWrench",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueWrench) + call json%add(pform,"TopDriveDrillTorqueState",data%Equipments%ControlPanel%CTopDrive%TopDriveDrillTorqueState) + call json%add(pform,"TopDriveLinkTiltState",data%Equipments%ControlPanel%CTopDrive%TopDriveLinkTiltState) + call json%add(pform,"TopDriveIbop",data%Equipments%ControlPanel%CTopDrive%TopDriveIbop) + call json%add(pform,"TopDriveTorqueLimitKnob",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueLimitKnob) + call json%add(pform,"RpmKnob",data%Equipments%ControlPanel%CTopDrive%RpmKnob) + call json%add(pform,"TopDriveOperationFaultLed",data%Equipments%ControlPanel%CTopDrive%TopDriveOperationFaultLed) + call json%add(pform,"TopDriveTdsPowerLed",data%Equipments%ControlPanel%CTopDrive%TopDriveTdsPowerLed) + call json%add(pform,"TopDriveTorqueWrenchLed",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueWrenchLed) + call json%add(pform,"TopDriveLinkTiltLed",data%Equipments%ControlPanel%CTopDrive%TopDriveLinkTiltLed) + call json%add(pform,"TopDriveIbopLed",data%Equipments%ControlPanel%CTopDrive%TopDriveIbopLed) + call json%add(pform,"TopDriveTorqueLimitGauge",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueLimitGauge) + call json%add(pform,"TopDriveTorqueGauge",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueGauge) + call json%add(pform,"TopDriveRpmGauge",data%Equipments%ControlPanel%CTopDrive%TopDriveRpmGauge) + + call json%add(p,pform) + end do + + call json%add(parent,p) + end subroutine + + + ! Input routines + subroutine SetTopDriveTdsPowerState(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTdsPowerState + !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTdsPowerState' :: SetTopDriveTdsPowerState + implicit none + integer, intent(in) :: v + data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState = v +#ifdef deb + call Log_3( 'TopDriveTdsPowerState=', data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState) +#endif + end subroutine + + subroutine SetTopDriveTorqueWrench(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTorqueWrench + !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTorqueWrench' :: SetTopDriveTorqueWrench + implicit none + logical, intent(in) :: v + data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrench = v +#ifdef deb + call Log_3( 'TopDriveTorqueWrench=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrench) +#endif + end subroutine + + subroutine SetTopDriveDrillTorqueState(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveDrillTorqueState + !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveDrillTorqueState' :: SetTopDriveDrillTorqueState + implicit none + integer, intent(in) :: v + data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState = v +#ifdef deb + call Log_3( 'TopDriveDrillTorqueState=', data%EquipmentControl%TopDrivePanel%TopDriveDrillTorqueState) +#endif + end subroutine + + subroutine SetTopDriveLinkTiltState(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveLinkTiltState + !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveLinkTiltState' :: SetTopDriveLinkTiltState + implicit none + integer, intent(in) :: v + data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltState = v +#ifdef deb + call Log_3( 'TopDriveLinkTiltState=', data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltState) +#endif + end subroutine + + subroutine SetTopDriveIbop(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveIbop + !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveIbop' :: SetTopDriveIbop + implicit none + logical, intent(in) :: v + data%EquipmentControl%TopDrivePanel%TopDriveIbop = v +#ifdef deb + call Log_3( 'TopDriveIbop=', data%EquipmentControl%TopDrivePanel%TopDriveIbop) +#endif + end subroutine + + subroutine SetTopDriveTorqueLimitKnob(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetTopDriveTorqueLimitKnob + !DEC$ ATTRIBUTES ALIAS: 'SetTopDriveTorqueLimitKnob' :: SetTopDriveTorqueLimitKnob + ! use CSimulationVariables, only: IsPortable + use CDrillingConsoleVariables + use SimulationVariables + use SimulationVariables!, only: data%EquipmentControl%DrillingConsole%RTSwitch, data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob + use CWarnings, only: Activate_TopdriveRotaryTableConfilict + use CScaleRange + implicit none + real, intent(in) :: v + if (IsPortable) then + if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) call Activate_TopdriveRotaryTableConfilict() + if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch == 0) then + data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = 0 + data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = v +#ifdef deb + call Log_3( 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob ) + call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob ) +#endif + endif + if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) then + data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = 0 + data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob = real(ScaleRange(v, 0.0, 10.0, 0.0, 6000.0), 8) +#ifdef deb + call Log_3( 'RTTorqueLimitKnob=', data%EquipmentControl%DrillingConsole%RTTorqueLimitKnob ) + call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob ) +#endif + endif + else + data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob = v +#ifdef deb + call Log_3( 'TopDriveTorqueLimitKnob=', data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitKnob) +#endif + endif + + end subroutine + + subroutine SetRpmKnob(v) + !DEC$ ATTRIBUTES DLLEXPORT :: SetRpmKnob + !DEC$ ATTRIBUTES ALIAS: 'SetRpmKnob' :: SetRpmKnob + ! use CSimulationVariables, only: IsPortable + use CDrillingConsoleVariables + use SimulationVariables + use SimulationVariables!, only: data%EquipmentControl%DrillingConsole%RTSwitch, data%EquipmentControl%DrillingConsole%RTThrottle + use CWarnings, only: Activate_TopdriveRotaryTableConfilict + use CScaleRange + implicit none + real, intent(in) :: v + if (IsPortable) then + if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) call Activate_TopdriveRotaryTableConfilict() + if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState /= 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch == 0) then + data%EquipmentControl%DrillingConsole%RTThrottle = 0 + data%EquipmentControl%TopDrivePanel%RpmKnob = v +#ifdef deb + call Log_3( 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle ) + call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob ) +#endif + endif + if(data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == 0 .and. data%EquipmentControl%DrillingConsole%RTSwitch /= 0) then + data%EquipmentControl%TopDrivePanel%RpmKnob = 0 + data%EquipmentControl%DrillingConsole%RTThrottle = real(ScaleRange(v, 0.0, 965.0, 0.0, 250.0), 8) +#ifdef deb + call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob ) + call Log_3( 'RTThrottle=', data%EquipmentControl%DrillingConsole%RTThrottle ) +#endif + endif + else + data%EquipmentControl%TopDrivePanel%RpmKnob = v + endif + + + + if (IsPortable) then + ! + else + data%EquipmentControl%TopDrivePanel%RpmKnob = v +#ifdef deb + call Log_3( 'RpmKnob=', data%EquipmentControl%TopDrivePanel%RpmKnob ) +#endif + endif + + end subroutine + + + ! Output routines + integer function GetTopDriveOperationFaultLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveOperationFaultLed + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveOperationFaultLed' :: GetTopDriveOperationFaultLed + implicit none + GetTopDriveOperationFaultLed = data%EquipmentControl%TopDrivePanel%TopDriveOperationFaultLed + !GetTopDriveOperationFaultLed = 1 + end function + + integer function GetTopDriveTdsPowerLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTdsPowerLed + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTdsPowerLed' :: GetTopDriveTdsPowerLed + implicit none + GetTopDriveTdsPowerLed = data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerLed + !GetTopDriveTdsPowerLed = 1 + end function + + integer function GetTopDriveTorqueWrenchLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueWrenchLed + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueWrenchLed' :: GetTopDriveTorqueWrenchLed + implicit none + GetTopDriveTorqueWrenchLed = data%EquipmentControl%TopDrivePanel%TopDriveTorqueWrenchLed + !GetTopDriveTorqueWrenchLed = 1 + end function + + integer function GetTopDriveLinkTiltLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveLinkTiltLed + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveLinkTiltLed' :: GetTopDriveLinkTiltLed + implicit none + GetTopDriveLinkTiltLed = data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltLed + !GetTopDriveLinkTiltLed = 1 + end function + + integer function GetTopDriveIbopLed() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveIbopLed + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveIbopLed' :: GetTopDriveIbopLed + implicit none + GetTopDriveIbopLed = data%EquipmentControl%TopDrivePanel%TopDriveIbopLed + !GetTopDriveIbopLed = 1 + end function + + real function GetTopDriveTorqueGauge() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueGauge + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueGauge' :: GetTopDriveTorqueGauge + implicit none + GetTopDriveTorqueGauge = data%EquipmentControl%TopDrivePanel%TopDriveTorqueGauge + !GetTopDriveTorqueGauge = 340 + end function + + real function GetTopDriveTorqueLimitGauge() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveTorqueLimitGauge + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveTorqueLimitGauge' :: GetTopDriveTorqueLimitGauge + implicit none + GetTopDriveTorqueLimitGauge = data%EquipmentControl%TopDrivePanel%TopDriveTorqueLimitGauge + !GetTopDriveTorqueLimitGauge = 442 + end function + + real function GetTopDriveRpmGauge() + !DEC$ ATTRIBUTES DLLEXPORT :: GetTopDriveRpmGauge + !DEC$ ATTRIBUTES ALIAS: 'GetTopDriveRpmGauge' :: GetTopDriveRpmGauge + implicit none + GetTopDriveRpmGauge = data%EquipmentControl%TopDrivePanel%TopDriveRpmGauge + !GetTopDriveRpmGauge = 67 + end function + + + end module CTopDrivePanel diff --git a/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.f90 b/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.f90 index 3431e49..46cfb10 100644 --- a/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.f90 +++ b/CSharp/Equipments/ControlPanels/CTopDrivePanelVariables.f90 @@ -1,44 +1,42 @@ -module CTopDrivePanelVariables - implicit none - public - - ! const - integer :: TdsPower_REV = 1 - integer :: TdsPower_OFF = 0 - integer :: TdsPower_FWD = -1 - - integer :: TdsMu_TORQ = 1 - integer :: TdsMu_SPINE = 0 - integer :: TdsMu_DRILL = -1 - - integer :: TdsLinkTilt_TILT = 1 - integer :: TdsLinkTilt_OFF = 0 - integer :: TdsLinkTilt_DRILL = -1 - - integer :: LED_OFF = 0 - integer :: LED_ON = 1 - integer :: LED_BLINK = 2 - - ! Input vars - Type::TopDrivePanelType - integer :: TopDriveTdsPowerState - logical :: TopDriveTorqueWrench - integer :: TopDriveDrillTorqueState - integer :: TopDriveLinkTiltState - logical :: TopDriveIbop - real :: TopDriveTorqueLimitKnob - real :: RpmKnob - - - ! Output vars - integer :: TopDriveOperationFaultLed - integer :: TopDriveTdsPowerLed - integer :: TopDriveTorqueWrenchLed - integer :: TopDriveLinkTiltLed - integer :: TopDriveIbopLed - real :: TopDriveTorqueLimitGauge - real :: TopDriveTorqueGauge - real :: TopDriveRpmGauge - end type TopDrivePanelType - contains +module CTopDrivePanelVariables + implicit none + public + + ! const + integer :: TdsPower_REV = 1 + integer :: TdsPower_OFF = 0 + integer :: TdsPower_FWD = -1 + + integer :: TdsMu_TORQ = 1 + integer :: TdsMu_SPINE = 0 + integer :: TdsMu_DRILL = -1 + + integer :: TdsLinkTilt_TILT = 1 + integer :: TdsLinkTilt_OFF = 0 + integer :: TdsLinkTilt_DRILL = -1 + + integer :: LED_OFF = 0 + integer :: LED_ON = 1 + integer :: LED_BLINK = 2 + + ! Input vars + Type::TopDrivePanelType + integer :: TopDriveTdsPowerState + logical :: TopDriveTorqueWrench + integer :: TopDriveDrillTorqueState + integer :: TopDriveLinkTiltState + logical :: TopDriveIbop + real :: TopDriveTorqueLimitKnob + real :: RpmKnob + ! Output vars + integer :: TopDriveOperationFaultLed + integer :: TopDriveTdsPowerLed + integer :: TopDriveTorqueWrenchLed + integer :: TopDriveLinkTiltLed + integer :: TopDriveIbopLed + real :: TopDriveTorqueLimitGauge + real :: TopDriveTorqueGauge + real :: TopDriveRpmGauge + end type TopDrivePanelType + contains end module CTopDrivePanelVariables \ No newline at end of file diff --git a/CSharp/Equipments/Tanks/CTanks.f90 b/CSharp/Equipments/Tanks/CTanks.f90 index 633eff4..31309a9 100644 --- a/CSharp/Equipments/Tanks/CTanks.f90 +++ b/CSharp/Equipments/Tanks/CTanks.f90 @@ -1,3 +1,4 @@ +<<<<<<< HEAD module CTanks use SimulationVariables @@ -17,4 +18,64 @@ end subroutine +======= + + module CTanks + use SimulationVariables + use CManifolds + implicit none + public + contains + + + subroutine CTankToJson(parent) + + type(json_value),pointer :: parent + type(json_core) :: json + type(json_value),pointer :: p,pform + integer :: i + + call json%create_array(p,'CTank') + + do i=1,data%Equipments%Tanks%CTank%Count + call json%create_object(pform,'') + call json%add(pform,"WaterRate",data%Equipments%Tanks%CTanks%WaterRate) + call json%add(pform,"CementTankVolume",data%Equipments%Tanks%CTanks%CementTankVolume) + call json%add(pform,"CementTankDensity",data%Equipments%Tanks%CTanks%CementTankDensity) + call json%add(pform,"TripTankVolume",data%Equipments%Tanks%CTanks%TripTankVolume) + call json%add(pform,"TripTankDensity",data%Equipments%Tanks%CTanks%TripTankDensity) + call json%add(pform,"ManualPumpPower",data%Equipments%Tanks%CTanks%ManualPumpPower) + call json%add(pform,"Valve1",data%Equipments%Tanks%CTanks%Valve1) + call json%add(pform,"Valve2",data%Equipments%Tanks%CTanks%Valve2) + call json%add(pform,"Valve3",data%Equipments%Tanks%CTanks%Valve3) + call json%add(pform,"Valve4",data%Equipments%Tanks%CTanks%Valve4) + call json%add(pform,"Valve5",data%Equipments%Tanks%CTanks%Valve5) + call json%add(pform,"Valve6",data%Equipments%Tanks%CTanks%Valve6) + call json%add(pform,"Valve7",data%Equipments%Tanks%CTanks%Valve7) + call json%add(pform,"Valve8",data%Equipments%Tanks%CTanks%Valve8) + call json%add(pform,"Valve9",data%Equipments%Tanks%CTanks%Valve9) + call json%add(pform,"Valve10",data%Equipments%Tanks%CTanks%Valve10) + call json%add(pform,"Valve11",data%Equipments%Tanks%CTanks%Valve11) + + call json%add(p,pform) + end do + + + call json%add(parent,p) + end subroutine + + + subroutine Set_ManualPumpPower(v) + use CManifolds, only:ChangeValve + implicit none + logical, intent(in) :: v + data%EquipmentControl%Tank%ManualPumpPower = v + call ChangeValve(43, v) + #ifdef deb + print*, 'ManualPumpPower=', data%EquipmentControl%Tank%ManualPumpPower + #endif + end subroutine + + +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 end module CTanks \ No newline at end of file diff --git a/Simulator.f90 b/Simulator.f90 index b5cf2ac..07187ad 100644 --- a/Simulator.f90 +++ b/Simulator.f90 @@ -200,9 +200,17 @@ module Simulator call ProblemsToJson(jsonvalue) print *,"write starts" +<<<<<<< HEAD call jsoncore%serialize(jsonvalue,redisContent) ! s = "Test redis write!" call setData(redisContent) +======= + call json%create_object(p,'') !create the root + call ConfigurationToJson(p) + + call json%print(p,'test.json') !write it to a file + call json%destroy(p) !cleanup print *,"written" +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 print *,"write ends" end subroutine diff --git a/Text1.txt b/Text1.txt index c1aa096..e137903 100644 --- a/Text1.txt +++ b/Text1.txt @@ -1,3 +1,21 @@ +<<<<<<< HEAD integer :: ElevatorConnection integer :: StringUpdate - integer :: KellyConnection \ No newline at end of file + integer :: KellyConnection +======= + integer :: TopDriveTdsPowerState + logical :: TopDriveTorqueWrench + integer :: TopDriveDrillTorqueState + integer :: TopDriveLinkTiltState + logical :: TopDriveIbop + real :: TopDriveTorqueLimitKnob + real :: RpmKnob + integer :: TopDriveOperationFaultLed + integer :: TopDriveTdsPowerLed + integer :: TopDriveTorqueWrenchLed + integer :: TopDriveLinkTiltLed + integer :: TopDriveIbopLed + real :: TopDriveTorqueLimitGauge + real :: TopDriveTorqueGauge + real :: TopDriveRpmGauge +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 0000000..142b170 --- /dev/null +++ b/UpgradeLog.htm @@ -0,0 +1,273 @@ + + + + Migration Report +

+ Migration Report -

Overview

ProjectPathErrorsWarningsMessages
SimulationCore2SimulationCore2.vfproj100
SolutionSimulationCore2.sln001

Solution and projects

\ No newline at end of file diff --git a/helper.ipynb b/helper.ipynb index 90aa7e8..cbf6117 100644 --- a/helper.ipynb +++ b/helper.ipynb @@ -1,22 +1,73 @@ { "cells": [ { +<<<<<<< HEAD "attachments": {}, "cell_type": "markdown", "metadata": {}, +======= + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[' real(8) :: AnnularRegulatorSetControl\\n',\n", + " ' real(8) :: AirMasterValve\\n',\n", + " ' real(8) :: ByePassValve\\n',\n", + " ' real(8) :: AnnularValve\\n',\n", + " ' real(8) :: UpperRamsValve\\n',\n", + " ' real(8) :: MiddleRamsValve\\n',\n", + " ' real(8) :: KillLineValve\\n',\n", + " ' real(8) :: ChokeLineValve\\n',\n", + " ' real(8) :: LowerRamsValve\\n',\n", + " ' real(8) :: ManifoldPressureGauge\\n',\n", + " ' real(8) :: AirSupplyPressureGauge\\n',\n", + " ' real(8) :: AccumulatorPressureGauge\\n',\n", + " ' real(8) :: AnnularPressureGauge\\n',\n", + " ' integer :: AnnularOpenLED\\n',\n", + " ' integer :: AnnularCloseLED\\n',\n", + " ' integer :: UpperRamsOpenLED\\n',\n", + " ' integer :: UpperRamsCloseLED\\n',\n", + " ' integer :: MiddleRamsOpenLED\\n',\n", + " ' integer :: MiddleRamsCloseLED\\n',\n", + " ' integer :: KillLineOpenLED\\n',\n", + " ' integer :: KillLineCloseLED\\n',\n", + " ' integer :: ChokeLineOpenLED\\n',\n", + " ' integer :: ChokeLineCloseLED\\n',\n", + " ' integer :: LowerRamsOpenLED\\n',\n", + " ' integer :: LowerRamsCloseLED\\n',\n", + " ' real(8) :: AnnularStatus\\n',\n", + " ' real(8) :: UpperRamsStatus\\n',\n", + " ' real(8) :: MiddleRamsStatus\\n',\n", + " ' real(8) :: LowerRamsStatus']" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 "source": [ "# Make makefile" ] }, { "cell_type": "code", +<<<<<<< HEAD "execution_count": 72, +======= + "execution_count": 5, +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ +<<<<<<< HEAD "\tCSharp/OperationScenarios/Common/COperationScenariosVariables.f90 /\n", "\tTorqueDrag/TD_Modules/TD_WellGeometry.f90 /\n", "\tTorqueDrag/TD_Modules/TD_WellElements.f90 /\n", @@ -322,10 +373,28 @@ "\tSimulationCore2.f90 /\n", "\tEquipments/MudSystem/Plot_Final_Mud_Elements.f90 /\n", "\tFluidFlow/Fluid_Flow_Solver.f90 /\n" +======= + "call json%add(p,\"TopDriveTdsPowerState\",data%Equipments%ControlPanel%CTopDrive%TopDriveTdsPowerState)\n", + "call json%add(p,\"TopDriveTorqueWrench\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueWrench)\n", + "call json%add(p,\"TopDriveDrillTorqueState\",data%Equipments%ControlPanel%CTopDrive%TopDriveDrillTorqueState)\n", + "call json%add(p,\"TopDriveLinkTiltState\",data%Equipments%ControlPanel%CTopDrive%TopDriveLinkTiltState)\n", + "call json%add(p,\"TopDriveIbop\",data%Equipments%ControlPanel%CTopDrive%TopDriveIbop)\n", + "call json%add(p,\"TopDriveTorqueLimitKnob\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueLimitKnob)\n", + "call json%add(p,\"RpmKnob\",data%Equipments%ControlPanel%CTopDrive%RpmKnob)\n", + "call json%add(p,\"TopDriveOperationFaultLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveOperationFaultLed)\n", + "call json%add(p,\"TopDriveTdsPowerLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveTdsPowerLed)\n", + "call json%add(p,\"TopDriveTorqueWrenchLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueWrenchLed)\n", + "call json%add(p,\"TopDriveLinkTiltLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveLinkTiltLed)\n", + "call json%add(p,\"TopDriveIbopLed\",data%Equipments%ControlPanel%CTopDrive%TopDriveIbopLed)\n", + "call json%add(p,\"TopDriveTorqueLimitGauge\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueLimitGauge)\n", + "call json%add(p,\"TopDriveTorqueGauge\",data%Equipments%ControlPanel%CTopDrive%TopDriveTorqueGauge)\n", + "call json%add(p,\"TopDriveRpmGauge\",data%Equipments%ControlPanel%CTopDrive%TopDriveRpmGauge)\n" +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 ] } ], "source": [ +<<<<<<< HEAD "import re\n", "current_dir = 'C:\\\\Projects\\\\VSIM\\\\SimulationCore2\\\\'\n", "target_dir = 'x64\\\\Debug\\\\'\n", @@ -952,6 +1021,9 @@ ], "source": [ "precode = \"\"\"call ProblemToJson(p,\"\",data%State%OperationScenarios%\"\"\"\n", +======= + "precode = \"\"\"call json%add(pform,\"\",data%Equipments%ControlPanel%CTopDrive%\"\"\"\n", +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 "input = open(\"Text1.txt\")\n", "lines = input.readlines()\n", "for line in lines:\n", @@ -965,6 +1037,7 @@ }, { "cell_type": "code", +<<<<<<< HEAD "execution_count": 20, "metadata": {}, "outputs": [ @@ -1050,6 +1123,9 @@ { "cell_type": "code", "execution_count": 3, +======= + "execution_count": 2, +>>>>>>> 12c8e5ea51ec0ab746d971224588f794381f80d2 "metadata": {}, "outputs": [ { @@ -1080,7 +1156,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1490,7 +1565,7 @@ ], "metadata": { "kernelspec": { - "display_name": "base", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1504,9 +1579,8 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.11.4" }, - "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "1ef4a26de7183d96d6da1045a38581e0a15b2215d0c1b98c7b273c6e514c6c7e"