|
- {
- "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%EquipmentControl%ControlPanel%CTopDrive%TopDriveTdsPowerState)\n",
- "call json%add(p,\"TopDriveTorqueWrench\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveTorqueWrench)\n",
- "call json%add(p,\"TopDriveDrillTorqueState\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveDrillTorqueState)\n",
- "call json%add(p,\"TopDriveLinkTiltState\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveLinkTiltState)\n",
- "call json%add(p,\"TopDriveIbop\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveIbop)\n",
- "call json%add(p,\"TopDriveTorqueLimitKnob\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveTorqueLimitKnob)\n",
- "call json%add(p,\"RpmKnob\",data%EquipmentControl%ControlPanel%CTopDrive%RpmKnob)\n",
- "call json%add(p,\"TopDriveOperationFaultLed\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveOperationFaultLed)\n",
- "call json%add(p,\"TopDriveTdsPowerLed\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveTdsPowerLed)\n",
- "call json%add(p,\"TopDriveTorqueWrenchLed\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveTorqueWrenchLed)\n",
- "call json%add(p,\"TopDriveLinkTiltLed\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveLinkTiltLed)\n",
- "call json%add(p,\"TopDriveIbopLed\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveIbopLed)\n",
- "call json%add(p,\"TopDriveTorqueLimitGauge\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveTorqueLimitGauge)\n",
- "call json%add(p,\"TopDriveTorqueGauge\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveTorqueGauge)\n",
- "call json%add(p,\"TopDriveRpmGauge\",data%EquipmentControl%ControlPanel%CTopDrive%TopDriveRpmGauge)\n"
- ]
- }
- ],
- "source": [
- "precode = \"\"\"call json%add(pform,\"\",data%EquipmentControl%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<cell line: 3>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Projects/VSIM/SimulationCore2/helper.ipynb#W5sZmlsZQ%3D%3D?line=5'>6</a>\u001b[0m nsp\u001b[39m+\u001b[39m\u001b[39m=\u001b[39m\u001b[39m1\u001b[39m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Projects/VSIM/SimulationCore2/helper.ipynb#W5sZmlsZQ%3D%3D?line=6'>7</a>\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----> <a href='vscode-notebook-cell:/c%3A/Projects/VSIM/SimulationCore2/helper.ipynb#W5sZmlsZQ%3D%3D?line=7'>8</a>\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
- }
|