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.

helper-checkpoint.ipynb 23 KiB

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