Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

533 lines
21 KiB

  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 19,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "data": {
  10. "text/plain": [
  11. "[' integer :: RigType\\n',\n",
  12. " ' real(8) :: CrownHeight\\n',\n",
  13. " ' real(8) :: MonkeyBoandHeight\\n',\n",
  14. " ' real(8) :: RigFloorHeight\\n']"
  15. ]
  16. },
  17. "execution_count": 19,
  18. "metadata": {},
  19. "output_type": "execute_result"
  20. }
  21. ],
  22. "source": [
  23. "lines"
  24. ]
  25. },
  26. {
  27. "cell_type": "code",
  28. "execution_count": 1,
  29. "metadata": {},
  30. "outputs": [
  31. {
  32. "name": "stdout",
  33. "output_type": "stream",
  34. "text": [
  35. "call json%add(p,\"CasingDepth\",data%Configuration%CasingLinerChoke%CasingDepth)\n",
  36. "call json%add(p,\"CasingId\",data%Configuration%CasingLinerChoke%CasingId)\n",
  37. "call json%add(p,\"CasingOd\",data%Configuration%CasingLinerChoke%CasingOd)\n",
  38. "call json%add(p,\"CasingWeight\",data%Configuration%CasingLinerChoke%CasingWeight)\n",
  39. "call json%add(p,\"CasingCollapsePressure\",data%Configuration%CasingLinerChoke%CasingCollapsePressure)\n",
  40. "call json%add(p,\"CasingTensileStrength\",data%Configuration%CasingLinerChoke%CasingTensileStrength)\n",
  41. "call json%add(p,\"LinerTopDepth\",data%Configuration%CasingLinerChoke%LinerTopDepth)\n",
  42. "call json%add(p,\"LinerLength\",data%Configuration%CasingLinerChoke%LinerLength)\n",
  43. "call json%add(p,\"LinerId\",data%Configuration%CasingLinerChoke%LinerId)\n",
  44. "call json%add(p,\"LinerOd\",data%Configuration%CasingLinerChoke%LinerOd)\n",
  45. "call json%add(p,\"LinerWeight\",data%Configuration%CasingLinerChoke%LinerWeight)\n",
  46. "call json%add(p,\"LinerCollapsePressure\",data%Configuration%CasingLinerChoke%LinerCollapsePressure)\n",
  47. "call json%add(p,\"LinerTensileStrength\",data%Configuration%CasingLinerChoke%LinerTensileStrength)\n",
  48. "call json%add(p,\"OpenHoleId\",data%Configuration%CasingLinerChoke%OpenHoleId)\n",
  49. "call json%add(p,\"OpenHoleLength\",data%Configuration%CasingLinerChoke%OpenHoleLength)\n"
  50. ]
  51. }
  52. ],
  53. "source": [
  54. "precode = \"\"\"call json%add(p,\"\",data%Configuration%CasingLinerChoke%\"\"\"\n",
  55. "input = open(\"Text1.txt\")\n",
  56. "lines = input.readlines()\n",
  57. "for line in lines:\n",
  58. " name = line.split(\"::\")[-1].strip()\n",
  59. " icoute = precode.index(\"\\\"\")+1\n",
  60. " # name = line.split(\"%\")[-1][:-1]\n",
  61. " # print(name)\n",
  62. " newline = precode[:icoute]+name+precode[icoute:]+name+\")\"\n",
  63. " print(newline)\n"
  64. ]
  65. },
  66. {
  67. "cell_type": "code",
  68. "execution_count": 3,
  69. "metadata": {},
  70. "outputs": [
  71. {
  72. "name": "stdout",
  73. "output_type": "stream",
  74. "text": [
  75. "\tGeo/GeoMain.f90 \\\n",
  76. "\n"
  77. ]
  78. }
  79. ],
  80. "source": [
  81. "##Replace space with _ in filenames and list them for put them in makefile\n",
  82. "import os\n",
  83. "dir = 'Geo'\n",
  84. "files = os.listdir(dir)\n",
  85. "fstring = ''\n",
  86. "for f in files:\n",
  87. " if f.endswith('90'):\n",
  88. " newf = f.replace(' ','_')\n",
  89. " os.rename(os.path.join(dir,f),os.path.join(dir,newf))\n",
  90. " if newf.lower().endswith('variables.f90'):\n",
  91. " fstring = '\\t'+os.path.join(dir,newf).replace('\\\\','/') +' \\\\\\n' + fstring\n",
  92. " else:\n",
  93. " fstring = fstring + '\\t'+os.path.join(dir,newf).replace('\\\\','/') +' \\\\\\n'\n",
  94. "\n",
  95. "print(fstring)"
  96. ]
  97. },
  98. {
  99. "cell_type": "markdown",
  100. "metadata": {},
  101. "source": [
  102. "## Extract variable names from definition lines"
  103. ]
  104. },
  105. {
  106. "cell_type": "code",
  107. "execution_count": 1,
  108. "metadata": {},
  109. "outputs": [],
  110. "source": [
  111. "# %pwd\n",
  112. "lines = input(\"Enter lines:\").split(\" \")\n",
  113. "lines = [l.strip() for l in lines if len(l.strip())>0]\n",
  114. "vars = []\n",
  115. "for l in lines:\n",
  116. " if '::' in l:\n",
  117. " vars.append(l.split('::')[1].strip())"
  118. ]
  119. },
  120. {
  121. "cell_type": "code",
  122. "execution_count": 8,
  123. "metadata": {},
  124. "outputs": [
  125. {
  126. "data": {
  127. "text/plain": [
  128. "'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"
  129. ]
  130. },
  131. "execution_count": 8,
  132. "metadata": {},
  133. "output_type": "execute_result"
  134. }
  135. ],
  136. "source": [
  137. "import string\n",
  138. "string.ascii_letters"
  139. ]
  140. },
  141. {
  142. "cell_type": "code",
  143. "execution_count": 9,
  144. "metadata": {},
  145. "outputs": [
  146. {
  147. "name": "stdout",
  148. "output_type": "stream",
  149. "text": [
  150. "var: AnnularRegulatorSetControl\n",
  151. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  152. "Char before: \n",
  153. "Char after: \n",
  154. "\n",
  155. "var: AirMasterValve\n",
  156. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  157. "Char before: \n",
  158. "Char after: \n",
  159. "\n",
  160. "var: ByePassValve\n",
  161. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  162. "Char before: \n",
  163. "Char after: \n",
  164. "\n",
  165. "var: AnnularValve\n",
  166. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  167. "Char before: \n",
  168. "Char after: \n",
  169. "\n",
  170. "var: UpperRamsValve\n",
  171. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  172. "Char before: \n",
  173. "Char after: \n",
  174. "\n",
  175. "var: MiddleRamsValve\n",
  176. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  177. "Char before: \n",
  178. "Char after: \n",
  179. "\n",
  180. "var: KillLineValve\n",
  181. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  182. "Char before: \n",
  183. "Char after: \n",
  184. "\n",
  185. "var: ChokeLineValve\n",
  186. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  187. "Char before: \n",
  188. "Char after: \n",
  189. "\n",
  190. "var: LowerRamsValve\n",
  191. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  192. "Char before: \n",
  193. "Char after: \n",
  194. "\n",
  195. "var: ManifoldPressureGauge\n",
  196. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  197. "Char before: \n",
  198. "Char after: \n",
  199. "\n",
  200. "var: AirSupplyPressureGauge\n",
  201. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  202. "Char before: \n",
  203. "Char after: \n",
  204. "\n",
  205. "var: AccumulatorPressureGauge\n",
  206. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  207. "Char before: \n",
  208. "Char after: \n",
  209. "\n",
  210. "var: AnnularPressureGauge\n",
  211. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  212. "Char before: \n",
  213. "Char after: \n",
  214. "\n",
  215. "var: AnnularOpenLED\n",
  216. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  217. "Char before: \n",
  218. "Char after: \n",
  219. "\n",
  220. "var: AnnularCloseLED\n",
  221. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  222. "Char before: \n",
  223. "Char after: \n",
  224. "\n",
  225. "var: UpperRamsOpenLED\n",
  226. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  227. "Char before: \n",
  228. "Char after: \n",
  229. "\n",
  230. "var: UpperRamsCloseLED\n",
  231. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  232. "Char before: \n",
  233. "Char after: \n",
  234. "\n",
  235. "var: MiddleRamsOpenLED\n",
  236. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  237. "Char before: \n",
  238. "Char after: \n",
  239. "\n",
  240. "var: MiddleRamsCloseLED\n",
  241. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  242. "Char before: \n",
  243. "Char after: \n",
  244. "\n",
  245. "var: KillLineOpenLED\n",
  246. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  247. "Char before: \n",
  248. "Char after: \n",
  249. "\n",
  250. "var: KillLineCloseLED\n",
  251. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  252. "Char before: \n",
  253. "Char after: \n",
  254. "\n",
  255. "var: ChokeLineOpenLED\n",
  256. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  257. "Char before: \n",
  258. "Char after: \n",
  259. "\n",
  260. "var: ChokeLineCloseLED\n",
  261. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  262. "Char before: \n",
  263. "Char after: \n",
  264. "\n",
  265. "var: LowerRamsOpenLED\n",
  266. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  267. "Char before: \n",
  268. "Char after: \n",
  269. "\n",
  270. "var: LowerRamsCloseLED\n",
  271. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  272. "Char before: \n",
  273. "Char after: \n",
  274. "\n",
  275. "var: AnnularStatus\n",
  276. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  277. "Char before: \n",
  278. "Char after: \n",
  279. "\n",
  280. "var: UpperRamsStatus\n",
  281. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  282. "Char before: \n",
  283. "Char after: \n",
  284. "\n",
  285. "var: MiddleRamsStatus\n",
  286. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  287. "Char before: \n",
  288. "Char after: \n",
  289. "\n",
  290. "var: LowerRamsStatus\n",
  291. "file = .\\CSharp\\Equipments\\ControlPanels\\CBopControlPanelVariables.f90\n",
  292. "Char before: \n",
  293. "Char after: \n",
  294. "\n"
  295. ]
  296. }
  297. ],
  298. "source": [
  299. "import os\n",
  300. "import sys\n",
  301. "import re\n",
  302. "dir = '.'\n",
  303. "varNameChars = string.ascii_letters + '_'\n",
  304. "log = open(os.path.join(dir,'ReplaceVars.log',),'a')\n",
  305. "end=False\n",
  306. "for dir,subdirs,files in os.walk(dir):\n",
  307. " for filename in files:\n",
  308. " if filename.lower().endswith('.f90'):\n",
  309. " # print(filename)\n",
  310. " file = open(os.path.join(dir,filename))\n",
  311. " code = file.read()\n",
  312. " for var in vars:\n",
  313. " if var not in code:\n",
  314. " continue\n",
  315. " occurs = [m.start() for m in re.finditer(var, code)]\n",
  316. " for occurance in occurs:\n",
  317. " if code[occurs[0]-1] in varNameChars or code[occurs[0]+len(var)] in varNameChars:\n",
  318. " continue\n",
  319. " print(f\"var: {var}\")\n",
  320. " print(f\"file = {os.path.join(dir,filename)}\")\n",
  321. " print(f\"Char before: {code[occurs[0]-1]}\")\n",
  322. " print(f\"Char after: {code[occurs[0]+len(var)]}\")\n",
  323. " end = True\n",
  324. " if end:\n",
  325. " break"
  326. ]
  327. },
  328. {
  329. "cell_type": "code",
  330. "execution_count": 9,
  331. "metadata": {},
  332. "outputs": [
  333. {
  334. "name": "stdout",
  335. "output_type": "stream",
  336. "text": [
  337. "State\n",
  338. "Hoisting\n",
  339. "OperationScenario\n",
  340. "notifications\n",
  341. "permissions\n",
  342. "unitySignals\n",
  343. "StudentStation\n",
  344. "BopStackInput\n",
  345. "BopStackAcc\n",
  346. "RamLine\n",
  347. "AnnularComputational\n",
  348. "Annular\n",
  349. "PipeRam1\n",
  350. "ShearRam\n",
  351. "PipeRam2\n",
  352. "ChokeLine\n",
  353. "KillLine\n",
  354. "Pumps\n",
  355. "RAM\n",
  356. "RAMS\n",
  357. "Choke\n",
  358. "AirDrivenPump\n",
  359. "AirPumpLine\n",
  360. "CHOOKE\n",
  361. "Drawworks\n",
  362. "MudSystem\n",
  363. "MUD\n",
  364. "PUMP\n",
  365. "RTable\n",
  366. "TDS\n",
  367. "GasType(3)\n",
  368. "PressureDisplay\n",
  369. "ObservationPoint(:)\n",
  370. "FricPressDrop\n",
  371. "ROP_Spec\n",
  372. "ROP_Bit\n",
  373. "TDGeo\n",
  374. "F_String(:)\n",
  375. "F_Counts\n",
  376. "F_Interval(:)\n",
  377. "OD_Annulus(4)\n",
  378. "TD_DrillStem\n",
  379. "TD_DrillStems\n",
  380. "TD_String\n",
  381. "TD_Count\n",
  382. "G_StringElement\n",
  383. "TD_Vol\n",
  384. "TD_General\n",
  385. "TD_BOP\n",
  386. "TD_BOPElement(4)\n",
  387. "TD_StConn\n",
  388. "TD_Load\n",
  389. "TD_WellEl\n",
  390. "TD_Casing\n",
  391. "data%State%TD_Liner\n",
  392. "TD_OpenHole\n",
  393. "TD_ROPHole\n",
  394. "TD_WellGeneral\n",
  395. "TD_WellGeo(:)\n",
  396. "EquipmentControl\n",
  397. "BopControlPanel\n",
  398. "ChokeControlPanel\n",
  399. "ChokeManifold\n",
  400. "DataDisplayConsole\n",
  401. "DrillingConsole\n",
  402. "Hook\n",
  403. "StandPipeManifold\n",
  404. "TopDrivePanel\n",
  405. "DrillingWatch\n",
  406. "Tank\n",
  407. "Configuration\n",
  408. "StringConfiguration\n",
  409. "Formation\n",
  410. "Reservoir\n",
  411. "Shoe\n",
  412. "Accumulator\n",
  413. "BopStackSpecification\n",
  414. "Hoisting\n",
  415. "Power\n",
  416. "PumpsSpecification\n",
  417. "RigSize\n",
  418. "CasingLinerChoke\n",
  419. "PathGeneration\n",
  420. "WellSurveyData\n",
  421. "MudProperties\n",
  422. "problems\n",
  423. "BitProblems\n",
  424. "BopProblems\n",
  425. "ChokeProblems\n",
  426. "DrillStemProblems\n",
  427. "GaugesProblems\n",
  428. "HoistingProblems\n",
  429. "KickProblems\n",
  430. "LostProblems\n",
  431. "MudTreatmentProblems\n",
  432. "OtherProblems\n",
  433. "PumpProblems\n",
  434. "RotaryProblems\n"
  435. ]
  436. },
  437. {
  438. "ename": "IndexError",
  439. "evalue": "list index out of range",
  440. "output_type": "error",
  441. "traceback": [
  442. "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
  443. "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)",
  444. "\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",
  445. "\u001b[1;31mIndexError\u001b[0m: list index out of range"
  446. ]
  447. }
  448. ],
  449. "source": [
  450. "f = open(\"hier.txt\")\n",
  451. "lines = f.readlines()\n",
  452. "for line in lines[1:]:\n",
  453. " nsp=0\n",
  454. " while line[nsp]==' ':\n",
  455. " nsp+=1\n",
  456. " splits = line.split(\"::\")\n",
  457. " print(splits[1].strip())"
  458. ]
  459. },
  460. {
  461. "cell_type": "code",
  462. "execution_count": 4,
  463. "metadata": {},
  464. "outputs": [
  465. {
  466. "data": {
  467. "text/plain": [
  468. "'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'"
  469. ]
  470. },
  471. "execution_count": 4,
  472. "metadata": {},
  473. "output_type": "execute_result"
  474. }
  475. ],
  476. "source": [
  477. "line"
  478. ]
  479. },
  480. {
  481. "cell_type": "code",
  482. "execution_count": null,
  483. "metadata": {},
  484. "outputs": [],
  485. "source": [
  486. "for fn in modules:\n",
  487. " f = open(fn)\n",
  488. " lines = f.readlines()\n",
  489. " module_filenames = {}\n",
  490. " used_modules = []\n",
  491. " mod_count = 0\n",
  492. " for l in lines:\n",
  493. " l = l.strip().lower()\n",
  494. " if l.startswith('module ') and not l.startswith('module procedure '):\n",
  495. " mod_name = l.split(' ')[1]\n",
  496. " module_filenames[mod_name] = fn\n",
  497. " mod_count +=1\n",
  498. " if l.startswith('use'):\n",
  499. " used_modules.append(l.split(' ')[1])\n",
  500. " if mod_count !=1:\n",
  501. " print(f\"{fn} has {mod_count} modules\")\n",
  502. " module_filenames,used_modules"
  503. ]
  504. }
  505. ],
  506. "metadata": {
  507. "kernelspec": {
  508. "display_name": "Python 3 (ipykernel)",
  509. "language": "python",
  510. "name": "python3"
  511. },
  512. "language_info": {
  513. "codemirror_mode": {
  514. "name": "ipython",
  515. "version": 3
  516. },
  517. "file_extension": ".py",
  518. "mimetype": "text/x-python",
  519. "name": "python",
  520. "nbconvert_exporter": "python",
  521. "pygments_lexer": "ipython3",
  522. "version": "3.11.4"
  523. },
  524. "vscode": {
  525. "interpreter": {
  526. "hash": "1ef4a26de7183d96d6da1045a38581e0a15b2215d0c1b98c7b273c6e514c6c7e"
  527. }
  528. }
  529. },
  530. "nbformat": 4,
  531. "nbformat_minor": 2
  532. }