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.
 
 
 
 
 
 

560 rivejä
22 KiB

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