Simulation Core
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

560 lines
23 KiB

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