MAKS_Enjoyer

Das ist der Klassengegensatz

Dec 7th, 2022
89
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 73.62 KB | None | 1 0
  1. import os
  2. import sys
  3. import math
  4. import shutil
  5. import random
  6. import string
  7. import psutil
  8. import numpy as np
  9. from time import time
  10. from time import sleep
  11. import aspose.words as aw
  12. from matplotlib import pylab
  13. import matplotlib.pyplot as plt
  14. from os.path import exists as file_exists
  15.  
  16. start = time()
  17. def MS(strings, tbc):
  18.     IsThere = False
  19.     for s in strings:
  20.         if strings[strings.index(s)] == tbc:
  21.             IsThere = True
  22.             break
  23.     return IsThere
  24. def rN(add, maxV):
  25.     return add + random.randint(0, maxV)
  26. def rando(array):
  27.     random.shuffle(array)
  28.     return random.choice(array)
  29. def split(txt, sep):
  30.     return txt.split(sep)
  31. def findex(array, search):
  32.     return array.index(search)
  33. def NumFormat(num):
  34.     return format(int(num), ',')
  35. def nameGen():
  36.     engine_Name1 = ["\"Argosy\"", "\"Galileo\"", "\"Callisto\"", "\"Nauka\"", "\"Insider\"", "\"Granis\"", "\"Cercozoa\"",
  37.             "\"Rassvet\"", "\"Zvezda\"", "\"Zarya\"", "\"Orion\"", "\"Ares\"", "\"Delta\"", "\"Atlas\"", "\"Dreadnought\"",
  38.             "\"Daedalus\"", "\"Baltia\"", "\"Dizhou\"", "\"Hermes\"", "\"Icarus\"", "\"Connestoga\"", "\"Yupiter\"",
  39.             "\"Emphasis\"", "\"Olympus\"", "\"Kronos\"", "\"Helios\"", "\"Alabaster\"", "\"Falcon\"", "\"Saturn\"",
  40.             "\"Eagle\"", "\"Endeavour\"", "\"Atlantis\"", "\"Cygnus\"", "\"Apollo\"", "\"Horizon\"", "\"Bulava\"",
  41.             "\"Pioneer\"", "\"Voyager\"", "\"Exploration\"", "\"Expedition\"", "\"Vulcan\"", "\"Vysota\"", "\"Aspin\"",
  42.             "\"Federation\"", "\"Sojourner\"", "\"Nautilus\"", "\"Jubilance\"", "\"Lagrange\"",  "\"Volna\"",
  43.             "\"Prometheus\"", "\"Tellus\"", "\"Alpha\"", "\"Delta\"", "\"Proton\"", "\"Neutron\"", "\"Topol\"",
  44.             "\"Electron\"", "\"Pluton\"", "\"Poodle\"", "\"Skipper\"", "\"Convair\"", "\"Nexus\"", "\"Oko\"",
  45.             "\"Vector\"", "\"Terrier\"", "\"Rhino\"", "\"Panther\"", "\"Goliath\"", "\"Juno\"", "\"Shrimp\"",
  46.             "\"Thumper\"", "\"Mainsail\"", "\"Dart\"", "\"Twitch\"", "\"Stratus\"", "\"Oscar\"", "\"Kosmos\"",
  47.             "\"Sentinel\"", "\"Pegasus\"", "\"Kelus\"", "\"Starshot\"", "\"Vernor\"", "\"Mammoth\"", "\"Liberty\"",
  48.             "\"Douglas\"", "\"Heimdall\"", "\"Dynetics\"", "\"Pathfinder\"", "\"Horizon\"", "\"Poisk\"", "\"Cryptomonada",
  49.             "\"Pirs\"", "\"Philae\"", "\"Mariner\"", "\"Centaur\"", "\"Orel\"", "\"Pratt\"", "\"Hyperion\"",
  50.             "\"Sagittarius\"", "\"Apollo\"", "\"Bryton\"", "\"Volga\"", "\"Harmony\"", "\"Cassini\"", "\"Contour\"",
  51.             "\"Altair\"", "\"Dream\"", "\"Baikal\"", "\"Zenith\"", "\"Urpinod\"", "\"Bernal\"", "\"Condor\"",
  52.             "\"Athena\"", "\"Astra\"", "\"Aerolus\"", "\"Rombus\"", "\"Lunokhod\"", "\"Fregat\"", "\"Glonass\"",
  53.             "\"Dragon\"", "\"Salyut\"", "\"Starliner\"", "\"Skylab\"", "\"Briz\"", "\"Colombus\"", "\"Rosetta\"",
  54.             "\"Redstone\"", "\"Antares\"", "\"Philae\"", "\"Prospero\"", "\"Leonardo\"", "\"Parker\"", "\"Dyson\"",
  55.             "\"Oberon\"", "\"DragonFly\"", "\"Energia\"", "\"Buran\"", "\"Urgan\"", "\"Angara\"", "\"Vostok\"",
  56.             "\"Voskhod\"", "\"Shenzhou\"", "\"Ingenuity\"", "\"Oberon\"", "\"Discovery\"", "\"Horizon\"", "\"Visionalis\"",
  57.             "\"Cerasus\"", "\"Progress\"", "\"Unity\"", "\"Surveyor\"", "\"Prospector\"", "\"Ikar\"", "\"Redstone\"",
  58.             "\"Lapis\"", "\"Caesius\"", "\"Iridium\"", "\"Daedlus\"", "\"Aelita\"", "\"Beta\"", "\"Gamma\"", "\"Filosa\"",
  59.             "\"Alpha\"", "\"Epsilon\"", "\"Omega\"", "\"Discoverer\"", "\"Explorer\"", "\"Hornet\"", "\"Serenity\"",
  60.             "\"Ariane\"", "\"Hornet\"", "\"Asimov\"", "\"Pegasus\"", "\"Venture\"", "\"Antares\"", "\"Star\"",
  61.             "\"Archimedes\"", "\"Hera\"", "\"Iris\"", "\"Titan\"", "\"Artemis\"", "\"Phoenix\"", "\"Ross\"", "\"Heliozoa\""
  62.             "\"Sarychev\"", "\"Nemesis\"", "\"Heimdall\"", "\"Sturt\"", "\"Odin\"", "\"Aethelred\"", "\"Vesper\"",
  63.             "\"Aces\"", "\"Argon\"", "\"Olympia\"", "\"Perseus\"", "\"Chyron\"", "\"Proxima\"", "\"Arminus\"",
  64.             "\"Destiny\"", "\"Valient\"", "\"FireFly\"", "\"Obsidian\"", "\"Leviathan\"", "\"Magellan\"", "\"Voyager\"",
  65.             "\"Mariner\"", "\"Joist\"", "\"Crimson\"", "\"Fortune\"", "\"Vanguard\"", "\"Aurora\"", "\"Ulysses\"",
  66.             "\"Crusader\"", "\"Python\"", "\"Kuiper\"", "\"Insurgent\"", "\"Pathfinder\"", "\"Kvant\"", "\"Spektr\"",
  67.             "\"Cassini\"", "\"Zemlya\"", "\"Dawn\"", "\"Kepler\"", "\"Parom\"", "\"Elektron\"", "\"Aeonian\"",
  68.             "\"Node\"", "\"Burya\"", "\"Voyager\"", "\"Ceres\"", "\"Bayern\"", "\"Chasovoy\"", "\"Copernicus\"",
  69.             "\"Quaoar\"", "\"Minotaur\"", "\"Agena\"", "\"Thor\"", "\"Vega\"", "\"Scout\"", "\"Coeus\"", "\"Minerva\"",
  70.             "\"Kratos\"", "\"Neith\"", "\"Omoikane\"", "\"Gayamun\"", "\"Odin\"", "\"Kronos\"", "\"Hope\"", "\"Poles\"",
  71.             "\"Polyot\"", "\"Sputnik\"", "\"Clementine\"", "\"Sojourner\"", "\"Ingenuity\"", "\"Perseverence\"",
  72.             "\"Onatchesko\"", "\"Atlantis\"", "\"Tsyklon\"", "\"Zenit\"", "\"Almaz\"", "\"Soyuz\"", "\"Molniya\"",
  73.             "\"Oreo\"", "\"Yantar\"", "\"Foton\"", "\"Meteor\"", "\"Ekran\"", "\"Strela\"", "\"Bion\"", "\"Piroda\"",
  74.             "\"Salyut\"", "\"Strela\"", "\"Luch\"", "\"Potok\"", "\"Prognoz\"", "\"Orlets\"", "\"Etalon\"", "\"Astron\"",
  75.             "\"Efir\"", "\"Kometa\"", "\"Fram\"", "\"Zemlya\"", "\"Gorizont\"", "\"Arkon\"", "\"Gamma\"", "\"Ekspress\"",
  76.             "\"Gonets\"", "\"Taifun\"", "\"Okean\"", "\"Reflektor\"", "\"Kolibr\"", "\"Sever\"", "\"Comet\"", "\"Peewee\""
  77.             "\"Roton\"", "\"Solaris\"", "\"Altaris\"", "\"Ithacus\"", "\"Dekto\"", "\"Dream\"", "\"Impuls\"", "\"Aves\""
  78.             "\"Vremya\"", "\"Portal\"", "\"Zodiak\"", "\"Slava\"", "\"Inertsiya\"", "\"Stimuls\"", "\"Ambross\"",
  79.             "\"Amal\"", "\"Thea\"", "\"Orphelia\"", "\"Polyot\"", "\"Mudrost\"", "\"Carrack\"", "\"Artak\"", "\"Anapsida\""
  80.             "\"Questar\"", "\"Artyom\"", "\"Tsyclon\"", "\"Ascension\"", "\"Tenacity\"", "\"Contour\"", "\"Zephyr\"",
  81.             "\"Atlanta\"", "\"Polaris\"", "\"Aeolus\"", "\"Mayak\"", "\"Pamir\"", "\"Taimyr\"", "\"Cheget\"", "\"Sirius\"",
  82.             "\"Uragan\"", "\"Agat\"", "\"Skiph\"", "\"Kristall\"", "\"Altair\"", "\"Uran\"", "\"Ingul\"", "\"Carat\"",
  83.             "\"Pulsar\"", "\"Titan\"", "\"Eridanus\"", "\"Parus\"", "\"Cepheus\"", "\"Varagian\"", "\"Olympus\"",
  84.             "\"Tarkhaniy\"", "\"Astraeus\"", "\"Antares\"", "\"Kazbek\"", "\"Burlak\"", "\"Borei\"", "\"Favor\"",
  85.             "\"Rubin\"", "\"Almaz\"", "\"Granit\"", "\"Ruby\"", "\"Sokol\"", "\"Argon\"", "\"Kavkaz\"", "\"Ural\"",
  86.             "\"Berkut\"", "\"Dunay\"", "\"Yastreb\"", "\"Terek\"", "\"Radon\"", "\"Taymyr\"", "\"Pamir\"", "\"Photon\"",
  87.             "\"Elbrus\"", "\"Isayiev\"", "\"Shmel\"", "\"Kobra\"", "\"Shturn\"", "\"Metis\"", "\"Malyutka\"", "\"Fleyta\"",
  88.             "\"Konkurs\"", "\"Bastion\"", "\"Svir\"", "\"Ataka\"", "\"Vodopad\"", "\"Veter\"", "\"Vyuga\"", "\"Vulga\"",
  89.             "\"Tochka\"", "\"Oka\"", "\"Dvina\"", "\"Almaz\"", "\"Araks\"", "\"Kanopus\"", "\"Kliper\"", "\"Kobalt\"",
  90.             "\"Siluet\"", "\"Kondor\"", "\"Lotos\"", "\"Luch\"", "\"Mir\"", "\"Neman\"", "\"Obzor\"", "\"Okean\"",
  91.             "\"Oktan\"", "\"Orlets\"", "\"Poisk\"", "\"Potok\"", "\"Pirs\"", "\"Prognoz\"", "\"Resurs\"", "\"Rodna\"",
  92.             "\"Romb\"", "\"Kapustin\"", "\"Oplot\"", "\"Tsygan\"", "\"Teplokhod\"", "\"Sokosha\"", "\"Rubezh\"",
  93.             "\"Zircon\"", "\"Moskovitz\"", "\"Tryol\"", "\"Ustinov\"", "\"Belyayev\"", "\"Novgorod\"", "\"Argos\"",
  94.             "\"Nerthus\"", "\"Janus\"", "\"Hephaestus\"", "\"Themis\"", "\"Chronos\"", "\"Tethys\"", "\"Minos\"",
  95.             "\"Autumn\"", "\"Resilience\"", "\"Aelita\"", "\"Rheus\"", "\"Solntspek\"", "\"Spitzer\"", "\"Cartago\"",
  96.             "\"Melibea\"", "\"Spartacus\"", "\"Pulsar\"", "\"Fusion\"", "\"Reliant\"", "\"Thunder\"", "\"Novo\"",
  97.             "\"Panthera\"", "\"Nematoda\"", "\"Anelida\"", "\"Chordata\"", "\"Tetrapoda\"", "\"Cyclero\"", "\"Carrier\"",
  98.             "\"Gaia\"", "\"Irtysh\"", "\"Wyvern\"", "\"Tarsier\"", "\"Alpina\"", "\"Espadon\"", "\"Parlos\"", "\"Nebula\"",
  99.             "\"Lazarus\"", "\"Rufus\"", "\"Dornier\"", "\"Argus\"", "\"Kybau\"", "\"Kalau\"", "\"Chasvoy\"", "\"Zephyr\"",
  100.             "\"Temny\"", "\"Gorizont\"", "\"Yars\"", "\"Krugazor\"", "\"Soprotivlenye\"", "\"Shtil\"", "\"Layner\"",
  101.             "\"Arthropoda\"", "\"Hexapoda\"", "\"Crustacea\"", "\"Tardigrada\"", "\"Mollusca\"", "\"Annelida\"",
  102.             "\"Bryozoa\"", "\"Rotifera", "\"Brachiopoda\"", "\"Echinodermata\"", "\"Hemichordata\"", "\"Cnidaria\"",
  103.             "\"Staurozoa\"", "\"Hydrozoa\"", "\"Porifera", "\"Placozoa\"", "\"Craniata\"", "\"Tunicata\"", "\"Conodonta\"",
  104.             "\"Tetrapoda\"", "\"Amniota\"", "\"Synapsida\"", "\"Sauropsida", "\"Mammalia\"", "\"Sarcodina\"", "\"Sporozoa\"",
  105.             "\"Ciliata\"", "\"Toxoplasma\"", "\"Plasmodium\"", "\"Heterokonta\"", "\"Haptophyta\""]
  106.     firstPart = ["RD", "RS", "AJ", "XLR", "NK", "RL", "KDTU", "AR", "BE", "MV", "YF", "PKA", "J", "RSA", "MJ", "XS", "LM10",
  107.             "HM", "LE", "LRE", "CE", "DST", "DOK", "KDU", "KRD", "RO", "LMS", "LMP", "RT", "F", "E", "A", "B", "S.10", "JDK",
  108.             "SPP", "TYS", "SOK", "RES", "FWR", "NAA75", "LR", "MA", "GE", "OSA", "OBA", "NA", "RM02", "RM", "H", "MBB", "MB",
  109.             "DF", "DE", "BF", "X", "BW", "BADR", "HS", "DC", "UA", "FG", "P", "KMV", "M", "SRMU", "V", "KVD", "JD", "PS", "CE"]
  110.     engNameFinalf = " " + rando(engine_Name1)
  111.     firstPart_f = rando(firstPart) + "-"
  112.     finalNumber = rN(12, 1098)
  113.     if finalNumber % 8 == 0:
  114.         engine_Namee = str(firstPart_f) + str(finalNumber) + str(engNameFinalf)
  115.     else:
  116.         uio93 = rN(1, 1000)
  117.         uio94 = rN(1, 12)
  118.         if uio93 % uio94 == 0:
  119.             randomizedCharacter = random.choice(string.ascii_lowercase)
  120.             while (randomizedCharacter == "l") or (randomizedCharacter == "o") or (randomizedCharacter == "i") or \
  121.                     (randomizedCharacter == "q") or (randomizedCharacter == "e") or (randomizedCharacter == "h") or \
  122.                     (randomizedCharacter == "g") or (randomizedCharacter == "c") or (randomizedCharacter == "j"):
  123.                 randomizedCharacter = random.choice(string.ascii_lowercase)
  124.                 if (randomizedCharacter != "l") and (randomizedCharacter != "o") and (randomizedCharacter != "i") and \
  125.                         (randomizedCharacter != "q") and (randomizedCharacter != "e") and (randomizedCharacter != "h") \
  126.                         and (randomizedCharacter != "g") and (randomizedCharacter != "c") and (
  127.                         randomizedCharacter != "j"):
  128.                     break
  129.         else:
  130.             randomizedCharacter = random.choice(string.ascii_uppercase)
  131.             while (randomizedCharacter == "O") or (randomizedCharacter == "I") or (randomizedCharacter == "Q"):
  132.                 randomizedCharacter = random.choice(string.ascii_uppercase)
  133.                 if (randomizedCharacter != "O") and (randomizedCharacter != "I") and (randomizedCharacter != "Q"):
  134.                     break
  135.         engine_Namee = str(firstPart_f) + str(finalNumber) + str(randomizedCharacter) + str(engNameFinalf)
  136.     return engine_Namee
  137. def isHypergolic (OCC, FCC):
  138.     isHyper = False
  139.     match OCC:
  140.         case "N2O4 (Nitrogen Tetroxide)":
  141.             match FCC:
  142.                 case "50% CH6N2 + 50% N2H4 (Aerosine-50)" | "75% CH6N2 + 25% N2H4 (UH-25)" | "C6H5NH2 (Aniline)" |\
  143.                      "C2H8N2 (UnsymmetricalDimethylHydrazine)" | "CH6N2 (MonomethylHydrazine)" | "N2H4 (Hydrazine)":
  144.                     isHyper = True
  145.                 case _:
  146.                     isHyper = False
  147.         case "H2O2 (Hydrogen Peroxide) 95%" | "H2O2 (Hydrogen Peroxide) 85%", "O2 (Oxygen)":
  148.             isHyper = False
  149.         case "O3 (Ozone)" | "F2 (Fluorine)" | "F2 (Fluorine) + O2 (Oxygen)":
  150.             isHyper = True
  151.         case "AK20F: 80% HNO3 + 20% N2O4 (Nitric Acid)" | "AK20I: 80% HNO3 + 20% N2O4 (Nitric Acid)"|\
  152.               "AK20K: 80% HNO3 + 20% N2O4 (Nitric Acid)" | "AK27I: 73% HNO3 + 27% N2O4 (Nitric Acid)"|\
  153.               "AK27P: 73% HNO3 + 27% N2O4 (Nitric Acid)":
  154.             match FCC:
  155.                 case "CH6N2 (MonomethylHydrazine)" | "N2H4 (Hydrazine)":
  156.                     isHyper = True
  157.                 case _:
  158.                     isHyper = False
  159.     return isHyper
  160. def propDataFind (fuel, oxid):
  161.     match oxid:
  162.         case "O2 (Oxygen)":
  163.             fuel_ListSample = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  164.                     "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  165.                     "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  166.             combustionTemps = [3304, 3379, 3314, 3167, 3657, 3020, 3399, 3275, 3214, 3526]
  167.             mixRatios = [5.00, 2.77, 1.49, 1.29, 1.72, 1.28, 1.15, 0.74, 1.19, 2.29]
  168.             exhaustVels = [3738, 2932, 2713, 2635, 2708, 2815, 2938, 2973, 2687, 2834]
  169.         case "F2 (Fluorine)":
  170.             fuel_ListSample = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  171.                     "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "C2H8N2 (UnsymmetricalDimethylHydrazine)",
  172.                     "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  173.             combustionTemps = [3689, -1, -1, 4344, -1, 4469, -1, -1, 4544, 4402, -1]
  174.             mixRatios = [6.00, -1.00, -1.00, 2.26, -1.00, 2.81, -1.00, -1.00, 1.82, 2.20, -1.00]
  175.             exhaustVels = [3925, -1, -1, 3106, -1, 3278, -1, -1, 3315, 3146, -1]
  176.         case "F2 (Fluorine) + O2 (Oxygen)":
  177.             fuel_ListSample = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  178.                     "C6H5NH2 (Aniline)", "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)",
  179.                     "CH6N2 (MonomethylHydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)", "N2H4 (Hydrazine)"]
  180.             combustionTemps = [-1, 4530, 4437, -1, 4517, 4584, 4575, 4583, -1, 4571, -1]
  181.             mixRatios = [-1.00, 4.82, 2.56, -1.00, 2.41, 2.41, 2.22, 2.33, -1.00, 3.67, -1.00]
  182.             exhaustVels = [-1, 3281, 3134, -1, 3006, 3255, 3273, 3264, -1, 3166, -1]
  183.         case "O3 (Ozone)":
  184.             fuel_ListSample = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  185.                     "C6H5NH2 (Aniline)", "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)",
  186.                     "CH6N2 (MonomethylHydrazine)", "C12H26 (n-Dodecane)", "CH3OH (Methanol)", "N2H4 (Hydrazine)",
  187.                     "NH3 (Ammonia)"]
  188.             combustionTemps = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  189.             mixRatios = [-1.00, -1.00, -1.00, -1.00, -1.00, -1.00, -1.00, -1.00, -1.00, -1.00, -1.00, -1.00]
  190.             exhaustVels = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
  191.         case "AK20F: 80% HNO3 + 20% N2O4 (Nitric Acid)" | "AK20I: 80% HNO3 + 20% N2O4 (Nitric Acid)"|\
  192.              "AK20K: 80% HNO3 + 20% N2O4 (Nitric Acid)" | "AK27I: 73% HNO3 + 27% N2O4 (Nitric Acid)"|\
  193.              "AK27P: 73% HNO3 + 27% N2O4 (Nitric Acid)":
  194.             fuel_ListSample = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  195.                     "CH3OH (Methanol)"]
  196.             combustionTemps = [2795, 2905, 3033, 2932, 2824]
  197.             mixRatios = [8.00, 2.75, 2.13, 1.28, 2.13]
  198.             exhaustVels = [3112, 2449, 2635, 2702, 2441]
  199.         case "N2O4 (Nitrogen Tetroxide)":
  200.             fuel_ListSample = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%", "C6H5NH2 (Aniline)",
  201.                     "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)", "C2H8N2 (UnsymmetricalDimethylHydrazine)",
  202.                     "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  203.             combustionTemps = [2973, 3151, 3006, 3468, 3268, 3229, 3296, 3252, 3137, 3058, 3342]
  204.             mixRatios = [6.50, 2.26, 1.93, 2.64, 1.85, 1.59, 2.10, 1.73, 1.08, 1.78, 3.53]
  205.             exhaustVels = [3334, 2540, 2479, 2538, 2730, 2750, 2713, 2742, 2803, 2528, 2619]
  206.         case "H2O2 (Hydrogen Peroxide) 85%":
  207.             fuel_ListSample = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%", "C6H5NH2 (Aniline)",
  208.                     "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)", "C2H8N2 (UnsymmetricalDimethylHydrazine)",
  209.                     "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  210.             combustionTemps = [2544, 2552, 2447, 2719, 2681, 2668, 2690, 2681, 2630, 2511, 2666]
  211.             mixRatios = [14.00, 4.62, 3.77, 5.95, 4.02, 3.39, 4.63, 3.76, 2.15, 3.55, 7.84]
  212.             exhaustVels = [2882, 2476, 2425, 2495, 2592, 2604, 2582, 2600, 2642, 2464, 2530]
  213.         case "H2O2 (Hydrogen Peroxide) 95%":
  214.             fuel_ListSample = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%", "C6H5NH2 (Aniline)",
  215.                     "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)", "C2H8N2 (UnsymmetricalDimethylHydrazine)",
  216.                     "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  217.             combustionTemps = [2666, 2762, 2653, 2934, 2870, 2852, 2884, 2871, 2801, 2709, 2878]
  218.             mixRatios = [11.00, 3.97, 3.27, 4.94, 3.32, 2.82, 3.82, 3.13, 1.82, 3.06, 6.50]
  219.             exhaustVels = [1918, 1599, 1566, 1610, 1683, 1692, 1676, 1688, 1718, 1590, 1639]
  220.     x = fuel_ListSample.index(fuel)
  221.     combust_temp = str(combustionTemps[x])
  222.     mixRatio = str(mixRatios[x])
  223.     exhaustVelF = str(exhaustVels[x])
  224.     return combust_temp + ", " + mixRatio + ", " + exhaustVelF
  225. def NzlParameters (alt_Of_Operation):
  226.     nozzle_Type_Chosen, OExpansionRatio = "", ""
  227.     match alt_Of_Operation:
  228.         case "0-20 km (Sea Level)":
  229.             nozzle_Type_List_SL = ["Contour Bell Nozzle", "Parabolic Bell Nozzle", "Conical Nozzle", "Stepped Dual Bell Nozzle"]
  230.             nozzle_Type_Chosen = rando(nozzle_Type_List_SL)
  231.             if nozzle_Type_Chosen == "Conical Nozzle":
  232.                 OExpansionRatio = str(rN(10, 9)) + ":1"
  233.             else:
  234.                 OExpansionRatio = str(rN(10, 12)) + ":1"
  235.         case "20-30 km (Medium Atmosphere)":
  236.             nozzle_Type_List_HA = ["Contour Bell Nozzle", "Parabolic Bell Nozzle", "Stepped Dual Bell Nozzle"]
  237.             nozzle_Type_Chosen = rando(nozzle_Type_List_HA)
  238.             OExpansionRatio = str(rN(32, 14)) + ":1"
  239.         case "30-80 km (High Atmosphere)":
  240.             nozzle_Type_List_HAi = ["Contour Bell Nozzle", "Parabolic Bell Nozzle", "Stepped Dual Bell Nozzle"]
  241.             nozzle_Type_Chosen = rando(nozzle_Type_List_HAi)
  242.             OExpansionRatio = str(rN(47, 43)) + ":1"
  243.         case "80 km+ (Vacuum)":
  244.             nozzle_Type_List_VA = ["Contour Bell Nozzle", "Parabolic Bell Nozzle", "Expanding Nozzle"]
  245.             nozzle_Type_Chosen = rando(nozzle_Type_List_VA)
  246.             OExpansionRatio = str(rN(90, 110)) + ":1"
  247.         case "Any Altitude (0-80 km+)":
  248.             nozzle_Type_List_Aero = ["Linear Aerospike Nozzle", "Toroidal Aerospike Nozzle", "Stepped Dual Bell Nozzle"]
  249.             nozzle_Type_Chosen = rando(nozzle_Type_List_Aero)
  250.             if nozzle_Type_Chosen == "Stepped Dual Bell Nozzle":
  251.                 OExpansionRatio = str(rN(10, 9)) + ":1"
  252.             else:
  253.                 OExpansionRatio = "None (Nozzle doesnt have a throat)"
  254.     return nozzle_Type_Chosen + ", " + OExpansionRatio
  255. def StndrdDet(eng_Name, eng_Cycle, oxid_C, fuel_C, tank_RepressA, alt_Operation):
  256.     Eng_Data = split(propDataFind(fuel_C, oxid_C), ", ")
  257.     f_regen, propProperties, F_gimbalangle, chamberN = "", "", "", ""
  258.     combust_temp, mixRatio, exhaustVelFinal = Eng_Data[0], Eng_Data[1], Eng_Data[2]
  259.     tank_Repress = rando(tank_RepressA)
  260.  
  261.     Operational_Alt = rando(alt_Operation)
  262.     NzlData = split(NzlParameters(Operational_Alt), ", ")
  263.     nozzle_Type_Chosen, AR_exit = NzlData[0], NzlData[1]
  264.     isHyp = isHypergolic(oxid_C, fuel_C)
  265.     isCryo = isCryogenic(oxid_C, fuel_C)
  266.     purp = uses(isHypergolic, isCryogenic, Operational_Alt, eng_Cycle)
  267.     search_for = ["Upper", "Payload", "Space"]
  268.  
  269.     if isCryo and isHyp:
  270.         propProperties = "Hypergolic and cryogenic"
  271.     elif isCryo and not isHyp:
  272.         propProperties = "Not Hypergolic but cryogenic"
  273.     elif not isCryo and isHyp:
  274.         propProperties = "Hypergolic but not cryogenic"
  275.     else:
  276.         propProperties = "Neither Hypergolic nor cryogenic"
  277.  
  278.     uio96, uio97 = rN(1, 999), rN(1, 11)
  279.     if uio96 % uio97 == 0:
  280.         Throttle_MinV, Throttle_MaxV = rN(1, 90), rN(100, 5)
  281.         ThrottleRange = str(Throttle_MinV) + "-" + str(Throttle_MaxV) + "%"
  282.     else:
  283.         ThrottleRange = "Not Throttleable"
  284.  
  285.     longDur = MS(search_for, purp)
  286.     if longDur:
  287.         cooling_mechanismA = ["Radiative Cooling", "Dump Cooling", "Film Cooling", "Regenerative Cooling", "Transpiration Cooling"]
  288.     else:
  289.         cooling_mechanismA = ["Ablative Cooling", "Radiative Cooling", "Dump Cooling", "Film Cooling", "Regenerative Cooling", "Transpiration Cooling"]
  290.     cooling_Mechanism_Chosen = rando(cooling_mechanismA)
  291.     if cooling_Mechanism_Chosen == "Regenerative Cooling":
  292.         f_regen = "Oxidizer "
  293.  
  294.     if purp in "Vernier":
  295.         gimbalangle = rN(0, 30)
  296.         if not gimbalangle >= 1 or alt_Operation == "80 km+ (Vacuum)":
  297.             F_gimbalangle = "None"
  298.         else:
  299.             F_gimbalangle = "±" + gimbalangle + "°"
  300.     elif purp in "Course Correction" and not purp in "Lower Stage":
  301.         F_gimbalangle = "None"
  302.     else:
  303.         gimbalangle = rN(0, 10)
  304.         if not gimbalangle >= 1 or alt_Operation == "80 km+ (Vacuum)":
  305.             F_gimbalangle = "None"
  306.         else:
  307.             F_gimbalangle = "±" + str(gimbalangle) + "°"
  308.  
  309.     chambers = rN(1, 2)
  310.     if chambers == 1 or nozzle_Type_Chosen in "Aerospike":
  311.         chamberN = "Single Chamber"
  312.     elif chambers == 2:
  313.         chamberN = "Dual Chamber"
  314.     elif chambers == 3:
  315.         chamberN = "Quadruple Chamber"
  316.            
  317.     cooling_Mechanism_C = f_regen + cooling_Mechanism_Chosen
  318.     injector = Injector(cooling_Mechanism_C, eng_Cycle)
  319.     output_def(eng_Name, eng_Cycle, oxid_C, fuel_C, Operational_Alt, nozzle_Type_Chosen, tank_Repress, cooling_Mechanism_C,
  320.                propProperties, purp, injector, AR_exit, combust_temp, mixRatio, exhaustVelFinal, ThrottleRange, chamberN,
  321.                F_gimbalangle)
  322. def isCryogenic(oxidizer_chosen, fuel_chosen):
  323.     isCryo = False
  324.     match oxidizer_chosen:
  325.         case "O3 (Ozone)"| "F2 (Fluorine)"| "F2 (Fluorine) + O2 (Oxygen)"| "O2 (Oxygen)": isCryo = True
  326.     match fuel_chosen:
  327.         case "CH3OH (Methanol)"| "C12H26 (n-Dodecane)"| "H2 (Hydrogen)"| "C2H5OH(Ethanol) 95%"| "C2H5OH(Ethanol) 75%"|\
  328.              "NH3 (Ammonia)"| "CH4 (Methane)": isCryo = True
  329.     return isCryo
  330. def uses(isHypergol, isCryogen, alt, En_Cycle):
  331.     compleX = False
  332.     if En_Cycle.upper == "Combustion Tap" or En_Cycle.upper == "Staged" or En_Cycle.upper == "Full Flow":
  333.         compleX = True
  334.     if alt == "0-20 km (Sea Level)" or alt == "20-30 km (Medium Atmosphere)":
  335.         if compleX:
  336.             pot_usesA = ["Lower Stage (Main Propulsion)"]
  337.         else:
  338.             pot_usesA = ["Lower Stage (Main Propulsion)", "Lower Stage (Course Correction)", "Lower Stage (Vernier)"]
  339.         useA = rando(pot_usesA)
  340.     elif alt == "30-80 km (High Atmosphere)" or alt == "80 km+ (Vacuum)":
  341.         if isHypergol and isCryogen:
  342.             if compleX:
  343.                 pot_usesA = ["Upper Stage (Main Propulsion)"]
  344.             else:
  345.                 pot_usesA = ["Upper Stage(Main Propulsion)", "Upper Stage(Course Correction)", "Upper Stage(Vernier)",
  346.                             "Upper Stage (Ullage)", "Payload (Main Propulsion)", "Payload (ACS)"]
  347.             useA = rando(pot_usesA)
  348.         elif not isHypergol and isCryogen:
  349.             if compleX:
  350.                 pot_usesA = ["Upper Stage (Main Propulsion)"]
  351.             else:
  352.                 pot_usesA = ["Upper Stage (Main Propulsion)", "Upper Stage (Vernier)"]
  353.             useA = rando(pot_usesA)
  354.         elif isHypergol and not isCryogen:
  355.             if compleX:
  356.                 pot_usesA = ["Upper Stage(Main Propulsion)", "Payload (Main Propulsion)", "Space Tug (Main Propulsion)"]
  357.             else:
  358.                 pot_usesA = ["Upper Stage(Main Propulsion)", "Upper Stage(Course Correction)", "Upper Stage(Vernier)",
  359.                             "Upper Stage (Ullage)", "Payload (Main Propulsion)", "Payload (ACS)", "Payload (Course Correction)",
  360.                             "Payload (Vernier)", "Space Tug (Main Propulsion)", "Space Tug (Course Correction)",
  361.                             "Space Tug (Vernier)", "Space Tug (Ullage)"]
  362.             useA = rando(pot_usesA)
  363.     else:
  364.         pot_usesA = ["Lower Stage (Main Propulsion)", "Upper Stage(Main Propulsion)", "Payload (Main Propulsion)"]
  365.         useA = rando(pot_usesA)
  366.     return useA
  367. def Injector(cooling_Mechanism, engine_Cycle_Chose):
  368.     fuel_state = "Liquid"
  369.     if cooling_Mechanism in "Regenerative Cooling" or engine_Cycle_Chose in "Expander":
  370.         fuel_state = "Gas"
  371.     injector = ["Showerhead Injector", "Self-impinging Injector", "Cross-impinging Injector", "Swirl Injector", "Pintle Injector"]
  372.     return fuel_state + " " + rando(injector)
  373. def output_monod(ENN, ECC, AOOC, PLC, NTLC, CMC, CCC, purposeB):
  374.     lbrk = "======================================================================================================================"
  375.     print(f"{lbrk}\nEngine Designation: {ENN}\n")
  376.     print(f"Fuel Flow Cycle: {ECC}")
  377.     print(f"Propellant: {PLC}")
  378.     print(f"Altitude Of Operation: {AOOC}")
  379.     print(f"Exhaust Nozzle Geometry: {NTLC}")
  380.     print(f"Engine Use Case: {purposeB}")
  381.     print(f"Nozzle Cooling Mechanism: {CMC}")
  382.     print(f"Propellant catalyst: {CCC}\n")
  383.  
  384.     file = open("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt", "at")
  385.     file.write(f"\n\nEngine Designation: {ENN}\n")
  386.     file.write(f"Fuel Flow Cycle: {ECC}\n")
  387.     file.write(f"Propellant: {PLC}\n")
  388.     file.write(f"Altitude Of Operation: {AOOC}\n")
  389.     file.write(f"Exhaust Nozzle Geometry: {NTLC}\n")
  390.     file.write(f"Engine Use Case: {purposeB}\n")
  391.     file.write(f"Nozzle Cooling Mechanism: {CMC}\n")
  392.     file.write(f"Propellant catalyst: {CCC}")
  393.     file.close()
  394. def output_mono(ENN, ECC, AOOC, PLC, NTLC, CMC, purposeE):
  395.     lbrk = "======================================================================================================================"
  396.     print(f"{lbrk}\nEngine Designation: {ENN}\n")
  397.     print(f"Fuel Flow Cycle: {ECC}")
  398.     print(f"Propellant: {PLC}")
  399.     print(f"Altitude Of Operation: {AOOC}")
  400.     print(f"Exhaust Nozzle Geometry: {NTLC}")
  401.     print(f"Engine Use Case: {purposeE}")
  402.     print(f"Nozzle Cooling Mechanism: {CMC}\n")
  403.  
  404.     file = open("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt", "at")
  405.     file.write(f"\n\nEngine Designation: {ENN}\n")
  406.     file.write(f"Fuel Flow Cycle: {ECC}\n")
  407.     file.write(f"Propellant: {PLC}\n")
  408.     file.write(f"Altitude Of Operation: {AOOC}\n")
  409.     file.write(f"Exhaust Nozzle Geometry: {NTLC}\n")
  410.     file.write(f"Engine Use Case: {purposeE}\n")
  411.     file.write(f"Nozzle Cooling Mechanism: {CMC}")
  412.     file.close()
  413. def output_et(ENN, ECC, AOOC, PLC, NTLC, PGLC, purposeE, pwr):
  414.     lbrk = "======================================================================================================================"
  415.     print(f"{lbrk}\nEngine Designation: {ENN}\n")
  416.     print(f"Fuel Flow Cycle: {ECC}")
  417.     print(f"Propellant(Remass): {PLC}")
  418.     print(f"Altitude Of Operation: {AOOC}")
  419.     print(f"Exhaust Nozzle Geometry: {NTLC}")
  420.     print(f"Engine Use Case: {purposeE}")
  421.     print(f"Engine Power Source: {PGLC}")
  422.     print(f"Rated Power Level: {pwr}\n")
  423.  
  424.     file = open("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt", "at")
  425.     file.write(f"\n\nEngine Designation: {ENN}\n")
  426.     file.write(f"Fuel Flow Cycle: {ECC}\n")
  427.     file.write(f"Propellant(Remass): {PLC}\n")
  428.     file.write(f"Altitude Of Operation: {AOOC}\n")
  429.     file.write(f"Exhaust Nozzle Geometry: {NTLC}\n")
  430.     file.write(f"Engine Use Case: {purposeE}\n")
  431.     file.write(f"Engine Power Source: {PGLC}\n")
  432.     file.write(f"Rated Power Level: {pwr}")
  433.     file.close()
  434. def output_nt(ENN, ECC, AOOC, NCC, PLC, RFC, NTLC, EEV, TRC, CMC, purposeF, react_gen, bimodal, ERC, PRS, ARR, ECT):
  435.     lbrk = "======================================================================================================================"
  436.     MaxElecP = NumFormat((ECT / 100) * 18)
  437.     MaxP = NumFormat(((ECT / 90) * 100) / 1000)
  438.     print(f"{lbrk}\nEngine Designation: {ENN}\n")
  439.     if not ECC == "Radioisotope Engine" and not NCC == "":
  440.         print(f"Fuel Flow Cycle: {NCC} {ECC}")
  441.     else:
  442.         print(f"Fuel Flow Cycle: {ECC}")
  443.     print(f"Propellant (Remass): {PLC}")
  444.     print(f"Propellant State: {PRS}")
  445.     print(f"Reactor Generation: {react_gen}")
  446.     print(f"Reactor Maximum Power: {MaxP} GW")
  447.     print(f"Reactor Fuel Material: {RFC}")
  448.     if NCC == "LANTR":
  449.         print(f"Engine Exhaust Velocity: ({NumFormat(EEV)}/~3850) m/s")
  450.     else:
  451.         print(f"Engine Exhaust Velocity: {NumFormat(EEV)} m/s")
  452.     print(f"Reactor Core Temperature: {NumFormat(ECT)}°K")
  453.     print(f"Reactor Coolant: {ERC}")
  454.     if not bimodal or ECC == "Nuclear SaltWater":
  455.         print(f"Engine Bimodality: Engine isn't bimodal")
  456.         print(f"Engine Electrical Output: None")
  457.     else:
  458.         print(f"Engine Bimodality: Engine is bimodal")
  459.         print(f"Engine Electrical Output: {MaxElecP} MW")
  460.     print(f"Altitude Of Operation: {AOOC}")
  461.     print(f"Exhaust Nozzle Geometry: {NTLC}")
  462.     print(f"Exhaust Nozzle Area Ratio: {ARR}")
  463.     print(f"Exhaust Nozzle Cooling Mechanism: {CMC}")
  464.     print(f"Engine Use Case: {purposeF}")
  465.     print(f"Tank repressurisation Method: {TRC}\n")
  466.  
  467.     file = open("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt", "at")
  468.     file.write(f"\n\nEngine Designation: {ENN}\n")
  469.     if not ECC == "Nuclear SaltWater" and not ECC == "Radioisotope Engine" and not NCC == "":
  470.         file.write(f"Fuel Flow Cycle: {NCC} {ECC}\n")
  471.     else:
  472.         file.write(f"Fuel Flow Cycle: {ECC}\n")
  473.     file.write(f"Propellant (Remass): {PLC}\n")
  474.     file.write(f"Propellant State: {PRS}\n")
  475.     file.write(f"Reactor Generation: {react_gen}\n")
  476.     file.write(f"Reactor Maximum Power: {MaxP} GW\n")
  477.     file.write(f"Reactor Fuel Material: {RFC}\n")
  478.     if NCC == "LANTR":
  479.         file.write(f"Engine Exhaust Velocity: ({NumFormat(EEV)}/~3850) m/s\n")
  480.     else:
  481.         file.write(f"Engine Exhaust Velocity: {NumFormat(EEV)} m/s\n")
  482.     file.write(f"Reactor Core Temperature: {NumFormat(ECT)}°K\n")
  483.     file.write(f"Reactor Coolant: {ERC}\n")
  484.     if not bimodal or ECC == "Nuclear SaltWater":
  485.         file.write(f"Engine Bimodality: Engine isn't bimodal\n")
  486.         file.write(f"Engine Electrical Output: None\n")
  487.     else:
  488.         file.write(f"Engine Bimodality: Engine is bimodal\n")
  489.         file.write(f"Engine Electrical Output: {MaxElecP} MW\n")
  490.     file.write(f"Altitude Of Operation: {AOOC}\n")
  491.     file.write(f"Exhaust Nozzle Geometry: {NTLC}\n")
  492.     file.write(f"Exhaust Nozzle Area Ratio: {ARR}\n")
  493.     file.write(f"Exhaust Nozzle Cooling Mechanism: {CMC}\n")
  494.     file.write(f"Engine Use Case: {purposeF}\n")
  495.     file.write(f"Tank repressurisation Method: {TRC}")
  496.     file.close()
  497. def output_def(ENN, ECC, OCC, FCC, AOOC, NTC, TRC, CMC, propProp, purp, injector, FinalAreaRatio, combust_temp, mixRatio,
  498.                exhaustVel, ThrottleRange, chamberN, F_gimbalangle):
  499.     lbrk = "======================================================================================================================"
  500.     print(f"{lbrk}\nEngine Designation: {ENN}\n")
  501.     print(f"Fuel Flow Cycle: {ECC}")
  502.     print(f"Engine Oxidizer: {OCC}")
  503.     print(f"Engine Fuel: {FCC}")
  504.     print(f"Average Mixture Ratio: {mixRatio}")
  505.     print(f"Propellant properties: {propProp}")
  506.     print(f"Altitude Of Operation: {AOOC}")
  507.     print(f"Exhaust Nozzle Geometry: {NTC}")
  508.     print(f"Exhaust Nozzle Area Ratio: {FinalAreaRatio}")
  509.     print(f"Characteristic Exhaust Velocity: {exhaustVel} m/s")
  510.     print(f"Adiabatic Combustion Temperature: {combust_temp}°K")
  511.     print(f"Engine Gimbal Range: {F_gimbalangle}")
  512.     print(f"Engine Injector Design: {injector}")
  513.     print(f"Engine chamber configuration: {chamberN}")
  514.     print(f"Engine Use Case: {purp}")
  515.     print(f"Tank repressurisation Method: {TRC}")
  516.     print(f"Nozzle Cooling Mechanism: {CMC}")
  517.     print(f"Engine Throttle Range: {ThrottleRange}\n")
  518.  
  519.     file = open("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt", "at")
  520.     file.write(f"\n\nEngine Designation: {ENN}\n")
  521.     file.write(f"Fuel Flow Cycle: {ECC}\n")
  522.     file.write(f"Engine Oxidizer: {OCC}\n")
  523.     file.write(f"Engine Fuel: {FCC}\n")
  524.     file.write(f"Average Mixture Ratio: {mixRatio}\n")
  525.     file.write(f"Propellant properties: {propProp}\n")
  526.     file.write(f"Altitude Of Operation: {AOOC}\n")
  527.     file.write(f"Exhaust Nozzle Geometry: {NTC}\n")
  528.     file.write(f"Exhaust Nozzle Area Ratio: {FinalAreaRatio}\n")
  529.     file.write(f"Characteristic Exhaust Velocity: {exhaustVel} m/s\n")
  530.     file.write(f"Adiabatic Combustion Temperature: {combust_temp}°K\n")
  531.     file.write(f"Engine Gimbal Range: {F_gimbalangle}\n")
  532.     file.write(f"Engine Injector Design: {injector}\n")
  533.     file.write(f"Engine chamber configuration: {chamberN}\n")
  534.     file.write(f"Engine Use Case: {purp}\n")
  535.     file.write(f"Tank repressurisation Method: {TRC}\n")
  536.     file.write(f"Nozzle Cooling Mechanism: {CMC}\n")
  537.     file.write(f"Engine Throttle Range: {ThrottleRange}")
  538.     file.close()
  539.  
  540. tic, tac = time(), time()
  541. mpl_xs, mpl_ysa, mpl_ysb = [], [], []
  542. repeatCommand, y, fNum, maxN = "YES", 0, 2, 50
  543. #print(f"Welcome to the Advanced Rocket Engine Generator!")
  544. org = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles"
  545. org1 = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/DevData"
  546. org2 = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData"
  547. pathe = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt"
  548. logPF = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/FullFolders/obf_rex[Full]1.txt"
  549. engine_Cycle = ["Gas Generator", "Staged Combustion (Oxidizer Rich)", "Staged Combustion (Fuel Rich)", "Expander (Open/Bleed)",
  550.        "Expander (Closed)", "Dual Expander (Open/Bleed)", "Dual Expander (Closed)", "Pressure-Fed", "Full Flow Staged",
  551.        "Electric Pump Fed", "Combustion Tap Off", "Monopropellant (Cold Gas)", "Monopropellant (Decomposition)", "Gas Core",
  552.        "Droplet Core", "Liquid Core", "Solid Core", "Vapor Core", "Nuclear SaltWater", "Radioisotope Engine", "MagnetoPlasmaDynamic Thruster",
  553.        "Hall Effect Thruster", "Gridded Ion Thruster", "Colloid Thruster", "Variable Specific Impulse Magnetoplasma Rocket (VASIMR)"]
  554. altitude_Of_Operation = ["0-20 km (Sea Level)", "20-30 km (Medium Atmosphere)", "30-80 km (High Atmosphere)", "80 km+ (Vacuum)", "Any Altitude (0-80 km+)"]
  555. tank_Repressurisation = ["Autogenous", "Inert Gas"]
  556. if not file_exists(org):
  557.     os.mkdir(org)
  558. if not file_exists(org1):
  559.     os.mkdir(org1)
  560. if not file_exists(org2):
  561.     os.mkdir(org2)
  562.  
  563. while repeatCommand != "N":
  564.     """
  565.    print(f"Do you want to generate a new engine? [Y/N]")
  566.    repeatCommand = str(input(">>>>> ")).upper()
  567.    if repeatCommand == "N" or repeatCommand == "NO":
  568.        end = time()
  569.        timen = (end - start) / 1000
  570.        print(f"Engines Created: {y}")
  571.        if timen < 60:
  572.            print(f"Total run time: {timen} secs")
  573.        elif timen / 60 < 2:
  574.            print(f"Total run time: " + math.floor(timen / 60) + " min " + timen % 60 + " secs")
  575.        else:
  576.            print(f"Total run time: " + math.floor(timen / 60) + " mins " + timen % 60 + " secs")
  577.        exit(0)  
  578.    elif repeatCommand == "Y" or repeatCommand == "YES":
  579.    """
  580.     if maxN >= fNum:
  581.         if time() >= tac + 0.9975:
  582.             tac = time()
  583.             mpl_xs.append(tac-start)
  584.             mpl_ysa.append(y)
  585.             mpl_ysb.append(psutil.virtual_memory()[2])
  586.         if not file_exists(pathe):
  587.             init = open(pathe, "x")
  588.             init.close()
  589.         sizeInbytes = os.path.getsize(pathe)
  590.         sizeInKilobytes = (sizeInbytes / 1024)
  591.         if sizeInKilobytes >= 50:
  592.             if file_exists(logPF):
  593.                 if file_exists("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/FullFolders/obf_rex[Full]" + str(fNum) + ".txt"):
  594.                     fNum = fNum+1
  595.                 else:
  596.                     shutil.copy2(pathe,
  597.                         "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/FullFolders/obf_rex[Full]" + str(fNum) + ".txt")
  598.                     rset = open(pathe, 'wt')
  599.                     rset.write("")
  600.                     rset.close()
  601.             else:
  602.                 org3 = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/FullFolders"
  603.                 os.mkdir(org3)
  604.                 shutil.copy2("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/GenData/obf_rex.txt", logPF)
  605.         engine_Name = nameGen()
  606.         engine_Cycle_Chosen = rando(engine_Cycle)
  607.         match engine_Cycle_Chosen:
  608.             case "Gas Core" | "Droplet Core" | "Liquid Core" | "Solid Core" | "Vapor Core" | "Nuclear SaltWater" |\
  609.                     "Radioisotope Engine":
  610.                  match engine_Cycle_Chosen:
  611.                      case "Radioisotope Engine":
  612.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  613.                                 "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  614.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  615.                          remass_List_Chosen = rando(remass_List)
  616.                          propellant_List_Chosen = remass_List_Chosen
  617.                          nuclear_Cycle_Chosen = ""
  618.                          reactor_fuel = ["Polonium-210", "Fermium-252", "Uranium-233", "Plutonium-238"]
  619.                          reactor_Fuel_Chosen = rando(reactor_fuel)
  620.                          propellantState = "Cryogenic Liquid"
  621.                          coreTemp = rN(2000, 200)
  622.                          molmassi = findex(remass_List, remass_List_Chosen)
  623.                          molmass = remass_EVD[molmassi]
  624.                          exhaustVel = (12400 / math.pow(molmass, 0.531))
  625.                      case "Solid Core":
  626.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  627.                                         "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  628.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  629.                          remass_List_Chosen = rando(remass_List)
  630.                          propellant_List_Chosen = remass_List_Chosen
  631.                          nuclear_cycle = ["LANTR", "LEUNTR", "LPNTR", "CERMET", "Pebble-Bed", ""]
  632.                          nuclear_Cycle_Chosen = rando(nuclear_cycle)
  633.                          reactor_fuel = ["Uranium-235", "Plutonium-238"]
  634.                          propellantState = "Cryogenic Liquid"
  635.                          if nuclear_Cycle_Chosen.upper == "LANTR":
  636.                              remass_List_Chosen = "Hydrogen (H2)"
  637.                              enr_level = rN(8, 87)
  638.                              reactor_Fuel_Chosen = str(enr_level) + "% " + rando(reactor_fuel)
  639.                              coreTemp = rN(1900 + (enr_level * 5), 1000)
  640.                              molmassi = findex(remass_List, remass_List_Chosen)
  641.                              molmass = remass_EVD[molmassi]
  642.                              exhaustVel = (17600 / math.pow(molmass, 0.531))
  643.                          elif nuclear_Cycle_Chosen.upper == "LEUNTR":
  644.                              remass_List_Chosen = rando(remass_List)
  645.                              enr_level = rN(5, 10)
  646.                              reactor_Fuel_Chosen = str(enr_level) + "% " + rando(reactor_fuel)
  647.                              coreTemp = rN(1900 + (enr_level * 5), 1000)
  648.                              molmassi = findex(remass_List, remass_List_Chosen)
  649.                              molmass = remass_EVD[molmassi]
  650.                              exhaustVel = (17600 / math.pow(molmass, 0.531))
  651.                          elif nuclear_Cycle_Chosen.upper == "LPNTR":
  652.                              remass_List_Chosen = rando(remass_List)
  653.                              enr_level = rN(8, 87)
  654.                              reactor_Fuel_Chosen = str(enr_level) + "% " + rando(reactor_fuel)
  655.                              coreTemp = rN(1900 + (enr_level * 5), 1000)
  656.                              molmassi = findex(remass_List, remass_List_Chosen)
  657.                              molmass = remass_EVD[molmassi]
  658.                              exhaustVel = (17600 / math.pow(molmass, 0.531))
  659.                          elif nuclear_Cycle_Chosen.upper == "CERMET":
  660.                              remass_List_Chosen = rando(remass_List)
  661.                              enr_level = rN(8, 87)
  662.                              reactor_Fuel_Chosen = str(enr_level) + "% " + rando(reactor_fuel)
  663.                              coreTemp = rN(1900 + (enr_level * 5), 1000)
  664.                              molmassi = findex(remass_List, remass_List_Chosen)
  665.                              molmass = remass_EVD[molmassi]
  666.                              exhaustVel = (17600 / math.pow(molmass, 0.531))
  667.                          elif nuclear_Cycle_Chosen.upper == "Pebble-Bed":
  668.                              remass_List_Chosen = rando(remass_List)
  669.                              propellantState = "Cryogenic Liquid"
  670.                              propellant_List_Chosen = "Uranium(VI) Fluoride (UF6) and " + remass_List_Chosen
  671.                              nuclear_Cycle_Chosen = rando(nuclear_cycle)
  672.                              enr_level = rN(8, 87)
  673.                              reactor_Fuel_Chosen = str(enr_level) + "% " + "Uranium-235"
  674.                              coreTemp = rN(1400 + (enr_level * 5), 1000)
  675.                              molmassi = findex(remass_List, remass_List_Chosen)
  676.                              molmass = remass_EVD[molmassi]
  677.                              exhaustVel = ((9530 * 2) / math.pow(molmass, 0.531))
  678.                          else:
  679.                              remass_List_Chosen = rando(remass_List)
  680.                              enr_level = rN(8, 87)
  681.                              reactor_Fuel_Chosen = str(enr_level) + "% " + rando(reactor_fuel)
  682.                              coreTemp = rN(1900 + (enr_level * 5), 1000)
  683.                              molmassi = findex(remass_List, remass_List_Chosen)
  684.                              molmass = remass_EVD[molmassi]
  685.                              exhaustVel = (11000 / math.pow(molmass, 0.531))
  686.                      case "Colloid Core":
  687.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  688.                             "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  689.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  690.                          remass_List_Chosen = rando(remass_List)
  691.                          propellant_List_Chosen = "Uranium Zirconium Carbide(UC2 + ZrC) Colloid and " + remass_List_Chosen
  692.                          nuclear_Cycle_Chosen = ""
  693.                          propellantState = "Cryogenic Liquid"
  694.                          enr_level = rN(8, 87)
  695.                          reactor_Fuel_Chosen = enr_level + "% " + "Uranium-235"
  696.                          coreTemp = rN(2500 + (enr_level * 5), 1000)
  697.                          molmassi = findex(remass_List, remass_List_Chosen)
  698.                          molmass = remass_EVD[molmassi]
  699.                          exhaustVel = (11800 / math.pow(molmass, 0.531))
  700.                      case "Liquid Core":
  701.                          nuclear_cycle = ["\"Expander Bleed\"", "\"Expander Closed\"", "\"Vortex Confined\"", "LARS"]
  702.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  703.                                  "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  704.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  705.                          materials = ["Tungsten", "Osmium", "Rhenium", "Tantalum"]
  706.                          remass_List_Chosen = rando(remass_List)
  707.                          material = rando(materials)
  708.                          propellantState = "Cryogenic Liquid"
  709.                          propellant_List_Chosen = "Uranium impregnated " + material + " and " + remass_List_Chosen
  710.                          nuclear_Cycle_Chosen = rando(nuclear_cycle)
  711.                          enr_level = rN(8, 87)
  712.                          reactor_Fuel_Chosen = str(enr_level) + "% " + "Uranium-235"
  713.                          coreTemp = rN(3500 + (enr_level * 5), 1000)
  714.                          molmassi = findex(remass_List, remass_List_Chosen)
  715.                          molmass = remass_EVD[molmassi]
  716.                          exhaustVel = (19620 / math.pow(molmass, 0.531))
  717.                      case "Droplet Core":
  718.                          nuclear_cycle = ["\"Expander Bleed\"", "\"Expander Closed\"", "\"Vortex Confined\""]
  719.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  720.                                 "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  721.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  722.                          remass_List_Chosen = rando(remass_List)
  723.                          propellantState = "Cryogenic Liquid"
  724.                          propellant_List_Chosen = "Uranium(VI) Fluoride (UF6) and " + remass_List_Chosen
  725.                          nuclear_Cycle_Chosen = rando(nuclear_cycle)
  726.                          enr_level = rN(8, 87)
  727.                          reactor_Fuel_Chosen = str(enr_level) + "% " + "Uranium-235"
  728.                          coreTemp = rN(5400 + (enr_level * 5), 1000)
  729.                          molmassi = findex(remass_List, remass_List_Chosen)
  730.                          molmass = remass_EVD[molmassi]
  731.                          exhaustVel = (19600 / math.pow(molmass, 0.531))
  732.                      case "Vapor Core":
  733.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  734.                                 "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  735.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  736.                          remass_List_Chosen = rando(remass_List)
  737.                          propellant_List_Chosen = "Uranium(VI) Fluoride (UF6) and " + remass_List_Chosen
  738.                          nuclear_Cycle_Chosen = ""
  739.                          reactor_Fuel_Chosen = "93% Uranium-235"
  740.                          propellantState = "Cryogenic Liquid"
  741.                          coreTemp = rN(5500, 1000)
  742.                          molmassi = findex(remass_List, remass_List_Chosen)
  743.                          molmass = remass_EVD[molmassi]
  744.                          exhaustVel = (11800 / math.pow(molmass, 0.531))
  745.                      case "Gas Core":
  746.                          remass_List = ["Hydrogen (H2)", "Nitrogen (N2)", "Ammonia (NH3)", "Water (H2O)",
  747.                                 "Oxygen (O2)", "Carbon Dioxide (CO2)", "Carbon Monoxide (CO)"]
  748.                          nuclear_cycle = ["\"Nuclear Lightbulb\"", "\"Vortex Confined\"", "\"Wheel Flow\"",
  749.                                 "\"Magnetohydrodynamic(MHD) vortex\"", "\"Open Cycle\""]
  750.                          remass_EVD = [1.782, 14.6, 4.25, 6.587, 16, 14.6, 28]
  751.                          remass_List_Chosen = rando(remass_List)
  752.                          propellant_List_Chosen = "Uranium(VI) Fluoride (UF6) and " + remass_List_Chosen
  753.                          nuclear_Cycle_Chosen = rando(nuclear_cycle)
  754.                          reactor_Fuel_Chosen = "93% Uranium-235"
  755.                          propellantState = "Cryogenic Liquid"
  756.                          coreTemp = rN(13650, 1000)
  757.                          molmassi = findex(remass_List, remass_List_Chosen)
  758.                          molmass = remass_EVD[findex(remass_List, remass_List_Chosen)]
  759.                          exhaustVel = (20405 / math.pow(molmass, 0.531))
  760.                      case "Nuclear SaltWater":
  761.                          nuclear_cycle = ["\"Nuclear Lightbulb\"", "\"Vortex Confined\"", "\"Wheel Flow\"",
  762.                                 "\"Magnetohydrodynamic(MHD) vortex\"", "\"Open Cycle\""]
  763.                          fissile_salts = ["Uranium", "Plutonium"]
  764.                          fissile_salt = rando(fissile_salts)
  765.                          nuclear_Cycle_Chosen = rando(nuclear_cycle)
  766.                          if not fissile_salt == "Plutonium":
  767.                              propellant_List_Chosen = fissile_salt + "(IV) TetraBromide (UBr4) + Water (H2O)"
  768.                          else:
  769.                              propellant_List_Chosen = fissile_salt + "(III) TriBromide (PuBr3) + Water (H2O)"
  770.                          remass_List_Chosen = "Water (H2O)"
  771.                          nuclear_Cycle_Chosen = ""
  772.                          propellantState = "Aqueous"
  773.                          enri_level = rN(1, 2)
  774.                          if enri_level == 1:
  775.                              coreTemp = rN(25000, 1000)
  776.                              exhaustVel = rN(65500, 1000)
  777.                              reactor_Fuel_Chosen = "3% " + fissile_salt
  778.                          else:
  779.                              coreTemp = rN(126800, 1000)
  780.                              exhaustVel = rN(4725000, 1000)
  781.                              reactor_Fuel_Chosen = "98% " + fissile_salt
  782.                  #============================================================================================
  783.                  if engine_Cycle_Chosen == "Solid Core" or engine_Cycle_Chosen == "Radioisotope Engine":
  784.                      nzll = ["Contour Bell Nozzle", "Parabolic Bell Nozzle"]
  785.                  else:
  786.                      nzll = ["Contour Bell Nozzle", "Parabolic Bell Nozzle", "Magnetic Virtual Nozzle"]
  787.                  nozzle_Type_List_Chosen = rando(nzll)
  788.                  #============================================================================================
  789.                  cooling_mechanism = ["Radiative Cooling", "Dump Cooling", "Film Cooling", "Regenerative Cooling",
  790.                         "Transpiration Cooling"]
  791.                  pot_uses = ["Upper Stage(Main Propulsion)", "Payload (Main Propulsion)", "Space Tug (Main Propulsion)"]
  792.                  #============================================================================================
  793.                  use = rando(pot_uses)
  794.                  altitude_Of_Operation_Chosen = "80 km+ (Vacuum)"
  795.                  tank_Repressurisation_Chosen = rando(tank_Repressurisation)
  796.                  cooling_Mechanism_Chosen = rando(cooling_mechanism)
  797.                  #============================================================================================
  798.                  if engine_Cycle_Chosen == "Liquid Core" or engine_Cycle_Chosen == "Solid Core" or engine_Cycle_Chosen == "Pulsed Nuclear":
  799.                      reactor_gen = ["Generation III+", "Generation IV", "Generation V", "Generation V+"]
  800.                  elif engine_Cycle_Chosen == "Nuclear SaltWater":
  801.                      reactor_gen = ["Engine has no reactor"]
  802.                  elif engine_Cycle_Chosen == "Radioisotope Engine":
  803.                      reactor_gen = ["Generation I"]
  804.                  else:
  805.                      reactor_gen = ["Generation II", "Generation III", "Generation III+",
  806.                             "Generation IV", "Generation V", "Generation V+"]
  807.                  #============================================================================================
  808.                  reactor_gen_Chosen = rando(reactor_gen)
  809.                  uio97 = rN(1, 456)
  810.                  uio98 = rN(1, 77)
  811.                  if uio97%uio98 != 0:
  812.                     isBimodal = True
  813.                  else:
  814.                     isBimodal = False
  815.                  NzlReturnP = NzlParameters(altitude_Of_Operation_Chosen)
  816.                  parts = NzlReturnP.split(", ")
  817.                  AreaRatio = parts[1]
  818.                  output_nt(engine_Name, engine_Cycle_Chosen, altitude_Of_Operation_Chosen, nuclear_Cycle_Chosen,
  819.                         propellant_List_Chosen, reactor_Fuel_Chosen, nozzle_Type_List_Chosen, exhaustVel,
  820.                         tank_Repressurisation_Chosen, cooling_Mechanism_Chosen, use, reactor_gen_Chosen,
  821.                         isBimodal, remass_List_Chosen, propellantState, AreaRatio, coreTemp)
  822.                  y = y+1
  823.             #============================================================================================
  824.             case "MagnetoPlasmaDynamic Thruster" | "Hall Effect Thruster" | "Gridded Ion Thruster" | "Colloid Thruster"|\
  825.                 "Variable Specific Impulse Magnetoplasma Rocket (VASIMR)":
  826.                 match engine_Cycle_Chosen:
  827.                     case "Hall Effect Thruster":
  828.                         propellant_List = ["Xe (Xenon)", "Kr (Krypton)", "Ar (Argon)", "Bi (Bismuth)",
  829.                                 "I2 (Iodine)", "Mg (Magnesium)", "Zn (Zinc)", "C10H16 (Adamantane)"]
  830.                         propellant_List_Chosen = rando(propellant_List)
  831.                         nozzle_Type_List_Chosen = "Hall Effect Thruster Nozzle"
  832.                     case "Gridded Ion Thruster":
  833.                         propellant_List = ["Xe (Xenon)", "Hg (Mercury)", "Cs (Caesium)"]
  834.                         propellant_List_Chosen = rando(propellant_List)
  835.                         nozzle_Type_List_Chosen = "Electrostatic Ion Nozzle"
  836.                     case "Colloid Thruster":
  837.                         propellant_List_Chosen = "NH2OH+NO3 (Hydroxylammonium nitrate)"
  838.                         nozzle_Type_List_Chosen = "Capillary Emitter-Electrode Cone"
  839.                     case "Variable Specific Impulse Magnetoplasma Rocket (VASIMR)":
  840.                         propellant_List = ["Xe (Xenon)", "Kr (Krypton)", "Ar (Argon)"]
  841.                         propellant_List_Chosen = rando(propellant_List)
  842.                         nozzle_Type_List_Chosen = "VASIMR Magnetic Confinement Nozzle"
  843.                     case "MagnetoPlasmaDynamic Thruster":
  844.                         propellant_List = ["Xe (Xenon)", "Ne (Neon)", "Ar (Argon)", "H2 (Hydrogen)", "N2H4 (Hydrazine)", "Li (Lithium)"]
  845.                         propellant_List_Chosen = rando(propellant_List)
  846.                         nozzle_Type_List_Chosen = "Cathode Plug Magnetic Confinement Nozzle"
  847.                 pot_uses = ["Payload (Main Propulsion)", "Space Tug (Main Propulsion)"]
  848.                 use = rando(pot_uses)
  849.                 powerGen_List = ["Hydrogen Fuel cell", "Nuclear Fission Reactor", "Nuclear Fusion Reactor",
  850.                                  "Photovoltaic Panel", "Solar Thermal Panel", "Radioisotope Thermoelectric Generator (RTG)"]
  851.                 powerGen_List_Chosen = rando(powerGen_List)
  852.                 altitude_Of_Operation_Chosen = "80 km+ (Vacuum)"
  853.                 pwr = str((round(rN(20, 980) / 10)) * 10) + " kW"
  854.                 output_et(engine_Name, engine_Cycle_Chosen, altitude_Of_Operation_Chosen, propellant_List_Chosen,
  855.                         nozzle_Type_List_Chosen, powerGen_List_Chosen, use, pwr)
  856.                 y = y+1
  857.             #============================================================================================
  858.             case "Monopropellant (Decomposition)":
  859.                 propellant_List1 = ["H2O2 (Hydrogen Peroxide)", "N2H4 (Hydrazine)", "NH2OH+NO3 (Hydroxylammonium nitrate)",
  860.                         "65% NH4N(NO2)2 (Ammonium Dinitramide) + 35% CH3OH(Methanol)"]
  861.                 nozzle_Type_List1 = ["Conical Nozzle", "Contour Bell Nozzle", "Parabolic Bell Nozzle"]
  862.                 propellant_List_Chosen = rando(propellant_List1)
  863.                 altitude_Of_Operation_Chosen = "80 km+ (Vacuum)"
  864.                 nozzle_Type_List_Chosen = rando(nozzle_Type_List1)
  865.                 cooling_mechanism = ["Ablative Cooling", "Radiative Cooling"]
  866.                 cooling_Mechanism_Chosen = rando(cooling_mechanism)
  867.                 catalyst_Chosen = ""
  868.                 match propellant_List_Chosen:
  869.                     case "N2H4 (Hydrazine)" | "65% NH4N(NO2)2 (Ammonium Dinitramide) + 35% CH3OH(Methanol)":
  870.                         catalyst_Chosen = "Iridium coated Alumina Pellets"
  871.                     case "H2O2 (Hydrogen Peroxide)":
  872.                         catalyst = ["KMnO4 (Potassium Permanganate) Honeycomb", "Ag (Silver) Honeycomb",
  873.                         "MnO2 (Manganese Dioxide) Honeycomb", "K2Cr2O7 (Potassium dichromate) Honeycomb",
  874.                         "FeO (Iron (II) oxide)"]
  875.                         catalyst_Chosen = rando(catalyst)
  876.                     case "NH2OH+NO3 (Hydroxylammonium nitrate)":
  877.                         catalyst_Chosen = "Iridium coated Copper Pellets"
  878.                 pot_uses = ["Upper Stage(Ullage)", "Upper Stage(Vernier)", "Payload (Main Propulsion)",
  879.                         "Payload (Vernier)", "Space Tug (Ullage)", "Space Tug (Vernier)"]
  880.                 use = rando(pot_uses)
  881.                 output_monod(engine_Name, engine_Cycle_Chosen, altitude_Of_Operation_Chosen, propellant_List_Chosen,
  882.                         nozzle_Type_List_Chosen, cooling_Mechanism_Chosen, catalyst_Chosen, use)
  883.                 y = y+1
  884.             #============================================================================================
  885.             case "Monopropellant (Cold Gas)":
  886.                 propellant_List2 = ["Nitrogen (N2)", "Helium (He)", "Carbon Dioxide (CO2)", "Ammonia (NH3)", "Hydrogen (H2)",
  887.                         "Methane (CH4)"]
  888.                 nozzle_Type_List1 = ["Conical Nozzle", "Contour Bell Nozzle", "Parabolic Bell Nozzle"]
  889.                 propellant_List_Chosen = rando(propellant_List2)
  890.                 altitude_Of_Operation_Chosen = "80 km+ (Vacuum)"
  891.                 nozzle_Type_List_Chosen = rando(nozzle_Type_List1)
  892.                 cooling_Mechanism_Chosen = "Ablative Cooling"
  893.                 pot_uses = ["Upper Stage(Ullage)", "Upper Stage(Vernier)", "Payload (Main Propulsion)",
  894.                                      "Payload (Vernier)", "Space Tug (Ullage)", "Space Tug (Vernier)"]
  895.                 purpose = rando(pot_uses)
  896.                 output_mono(engine_Name, engine_Cycle_Chosen, altitude_Of_Operation_Chosen,
  897.                         propellant_List_Chosen, nozzle_Type_List_Chosen, cooling_Mechanism_Chosen, purpose)
  898.                 y = y+1
  899.             #============================================================================================
  900.             case "Expander (Closed)" | "Expander (Open/Bleed)":
  901.                 oxidizer_List = ["O2 (Oxygen)", "F2 (Fluorine)", "F2 (Fluorine) + O2 (Oxygen)", "O3 (Ozone)"]
  902.                 oxidizer_Chosen = rando(oxidizer_List)
  903.                 fuel_Chosen = ""
  904.                 match oxidizer_Chosen:
  905.                     case "O2 (Oxygen)":
  906.                         fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  907.                                 "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  908.                                 "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  909.                         random.shuffle(fuel_List)
  910.                         fuel_Chosen = random.choice(fuel_List)
  911.                     case "F2 (Fluorine)":
  912.                         fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  913.                                 "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "C2H8N2 (UnsymmetricalDimethylHydrazine)",
  914.                                 "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  915.                         random.shuffle(fuel_List)
  916.                         fuel_Chosen = random.choice(fuel_List)
  917.                     case "F2 (Fluorine) + O2 (Oxygen)" | "O3 (Ozone)":
  918.                         fuel_List = ["H2 (Hydrogen)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  919.                         random.shuffle(fuel_List)
  920.                         fuel_Chosen = random.choice(fuel_List)
  921.                 StndrdDet(engine_Name, engine_Cycle_Chosen, oxidizer_Chosen, fuel_Chosen,
  922.                         tank_Repressurisation, altitude_Of_Operation)
  923.                 y = y+1
  924.             #============================================================================================
  925.             case "Dual Expander (Closed)" | "Dual Expander (Open/Bleed)":
  926.                 oxidizer_List = ["O2 (Oxygen)", "F2 (Fluorine)", "F2 (Fluorine) + O2 (Oxygen)"]
  927.                 oxidizer_Chosen = rando(oxidizer_List)
  928.                 fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)"]
  929.                 fuel_Chosen = ""
  930.                 match oxidizer_Chosen:
  931.                     case "O2 (Oxygen)" | "F2 (Fluorine)":
  932.                         random.shuffle(fuel_List)
  933.                         fuel_Chosen = random.choice(fuel_List)
  934.                     case "F2 (Fluorine) + O2 (Oxygen)": fuel_Chosen = "H2 (Hydrogen)"
  935.                 StndrdDet(engine_Name, engine_Cycle_Chosen, oxidizer_Chosen, fuel_Chosen,
  936.                         tank_Repressurisation, altitude_Of_Operation)
  937.                 y = y+1
  938.             #============================================================================================
  939.             case "Staged Combustion (Fuel Rich)":
  940.                 oxidizer_List = ["O2 (Oxygen)", "F2 (Fluorine)", "F2 (Fluorine) + O2 (Oxygen)", "O3 (Ozone)"]
  941.                 oxidizer_Chosen = rando(oxidizer_List)
  942.                 fuel_Chosen = ""
  943.                 match oxidizer_Chosen:
  944.                     case "O2 (Oxygen)" | "F2 (Fluorine)":
  945.                         fuel_List = ["H2 (Hydrogen)", "NH3 (Ammonia)", "N2H4 (Hydrazine)"]
  946.                         random.shuffle(fuel_List)
  947.                         fuel_Chosen = random.choice(fuel_List)
  948.                     case "F2 (Fluorine) + O2 (Oxygen)" | "O3 (Ozone)": fuel_Chosen = "H2 (Hydrogen)"
  949.                 StndrdDet(engine_Name, engine_Cycle_Chosen, oxidizer_Chosen, fuel_Chosen,
  950.                         tank_Repressurisation, altitude_Of_Operation)
  951.                 y = y+1
  952.             #============================================================================================
  953.             case "Staged Combustion (Oxidizer Rich)":
  954.                 oxidizer_List = ["O2 (Oxygen)", "O3 (Ozone)", "N2O4 (Nitrogen Tetroxide)"]
  955.                 oxidizer_Chosen = rando(oxidizer_List)
  956.                 fuel_Chosen = ""
  957.                 match oxidizer_Chosen:
  958.                     case "O2 (Oxygen)" | "O3 (Ozone)":
  959.                         fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  960.                                 "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  961.                                 "CH3OH (Methanol)"]
  962.                         random.shuffle(fuel_List)
  963.                         fuel_Chosen = random.choice(fuel_List)
  964.                     case "N2O4 (Nitrogen Tetroxide)":
  965.                         fuel_List = ["C6H5NH2 (Aniline)", "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)",
  966.                                 "C2H8N2 (UnsymmetricalDimethylHydrazine)"]
  967.                         random.shuffle(fuel_List)
  968.                         fuel_Chosen = random.choice(fuel_List)
  969.                 StndrdDet(engine_Name, engine_Cycle_Chosen, oxidizer_Chosen, fuel_Chosen,
  970.                         tank_Repressurisation, altitude_Of_Operation)
  971.                 y = y+1
  972.             #============================================================================================
  973.             case "Full Flow Staged Combustion" | "Combustion Tap Off":
  974.                 oxidizer_List = ["O2 (Oxygen)", "F2 (Fluorine)", "F2 (Fluorine) + O2 (Oxygen)", "O3 (Ozone)",
  975.                                  "N2O4 (Nitrogen Tetroxide)"]
  976.                 oxidizer_Chosen = rando(oxidizer_List)
  977.                 fuel_Chosen = ""
  978.                 match oxidizer_Chosen:
  979.                     case "O2 (Oxygen)":
  980.                         fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  981.                                 "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  982.                                 "CH3OH (Methanol)"]
  983.                         random.shuffle(fuel_List)
  984.                         fuel_Chosen = random.choice(fuel_List)
  985.                     case "F2 (Fluorine)":
  986.                         fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  987.                                 "NH3 (Ammonia)", "C2H8N2 (UnsymmetricalDimethylHydrazine)", "CH6N2 (MonomethylHydrazine)",
  988.                                 "N2H4 (Hydrazine)", "CH3OH (Methanol)"]
  989.                         random.shuffle(fuel_List)
  990.                         fuel_Chosen = random.choice(fuel_List)
  991.                     case "F2 (Fluorine) + O2 (Oxygen)" | "O3 (Ozone)":
  992.                         fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  993.                                 "C6H5NH2 (Aniline)", "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)",
  994.                                 "CH6N2 (MonomethylHydrazine)"]
  995.                         random.shuffle(fuel_List)
  996.                         fuel_Chosen = random.choice(fuel_List)
  997.                     case "N2O4 (Nitrogen Tetroxide)":
  998.                         fuel_List = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  999.                                 "C6H5NH2 (Aniline)", "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)",
  1000.                                 "C2H8N2 (UnsymmetricalDimethylHydrazine)", "CH3OH (Methanol)"]
  1001.                         random.shuffle(fuel_List)
  1002.                         fuel_Chosen = random.choice(fuel_List)
  1003.                 StndrdDet(engine_Name, engine_Cycle_Chosen, oxidizer_Chosen, fuel_Chosen, tank_Repressurisation, altitude_Of_Operation)
  1004.                 y = y+1
  1005.             #============================================================================================
  1006.             case _:
  1007.                 oxidizer_List = ["O2 (Oxygen)", "F2 (Fluorine)", "F2 (Fluorine) + O2 (Oxygen)", "N2O4 (Nitrogen Tetroxide)",
  1008.                                  "H2O2 (Hydrogen Peroxide) 95%", "H2O2 (Hydrogen Peroxide) 85%", "O3 (Ozone)",
  1009.                                  "AK20F: 80% HNO3 + 20% N2O4 (Nitric Acid)", "AK20I: 80% HNO3 + 20% N2O4 (Nitric Acid)",
  1010.                                  "AK20K: 80% HNO3 + 20% N2O4 (Nitric Acid)", "AK27I: 73% HNO3 + 27% N2O4 (Nitric Acid)",
  1011.                                  "AK27P: 73% HNO3 + 27% N2O4 (Nitric Acid)"]
  1012.                 oxidizer_Chosen = rando(oxidizer_List)
  1013.                 if oxidizer_Chosen == "O2 (Oxygen)":
  1014.                     fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  1015.                             "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  1016.                             "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  1017.                     random.shuffle(fuel_List)
  1018.                     fuel_Chosen = random.choice(fuel_List)
  1019.                 elif oxidizer_Chosen == "F2 (Fluorine)":
  1020.                     fuel_List = ["H2 (Hydrogen)", "CH4 (Methane)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  1021.                             "C6H5NH2 (Aniline)", "NH3 (Ammonia)", "C2H8N2 (UnsymmetricalDimethylHydrazine)",
  1022.                             "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  1023.                     random.shuffle(fuel_List)
  1024.                     fuel_Chosen = random.choice(fuel_List)
  1025.                 elif oxidizer_Chosen == "F2 (Fluorine) + O2 (Oxygen)" or oxidizer_Chosen == "O3 (Ozone)":
  1026.                     fuel_List = ["H2 (Hydrogen)", "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  1027.                     random.shuffle(fuel_List)
  1028.                     fuel_Chosen = random.choice(fuel_List)
  1029.                 elif oxidizer_Chosen == "AK20F: 80% HNO3 + 20% N2O4 (Nitric Acid)" or oxidizer_Chosen == "AK20I: 80% HNO3 + 20% N2O4 (Nitric Acid)" or\
  1030.                     oxidizer_Chosen == "AK20K: 80% HNO3 + 20% N2O4 (Nitric Acid)" or oxidizer_Chosen == "AK27I: 73% HNO3 + 27% N2O4 (Nitric Acid)" or\
  1031.                     oxidizer_Chosen == "AK27P: 73% HNO3 + 27% N2O4 (Nitric Acid)":
  1032.                     fuel_List = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  1033.                             "CH3OH (Methanol)"]
  1034.                     random.shuffle(fuel_List)
  1035.                     fuel_Chosen = random.choice(fuel_List)
  1036.                 elif oxidizer_Chosen == "N2O4 (Nitrogen Tetroxide)" or oxidizer_Chosen == "H2O2 (Hydrogen Peroxide) 95%" or\
  1037.                     oxidizer_Chosen == "H2O2 (Hydrogen Peroxide) 85%":
  1038.                     fuel_List = ["H2 (Hydrogen)", "C2H5OH(Ethanol) 95%", "C2H5OH(Ethanol) 75%",
  1039.                             "C6H5NH2 (Aniline)", "75% CH6N2 + 25% N2H4 (UH-25)", "50% CH6N2 + 50% N2H4 (Aerosine-50)",
  1040.                             "C2H8N2 (UnsymmetricalDimethylHydrazine)", "CH6N2 (MonomethylHydrazine)", "N2H4 (Hydrazine)",
  1041.                             "CH3OH (Methanol)", "C12H26 (n-Dodecane)"]
  1042.                     random.shuffle(fuel_List)
  1043.                     fuel_Chosen = random.choice(fuel_List)
  1044.                 StndrdDet(engine_Name, engine_Cycle_Chosen, oxidizer_Chosen, fuel_Chosen, tank_Repressurisation, altitude_Of_Operation)
  1045.                 y = y+1
  1046.     elif fNum >= maxN:
  1047.         loc_num = 1
  1048.         destination = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/DevData/DataDump"
  1049.         if os.path.exists("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/DevData/DataDump"):
  1050.             while not os.path.exists("C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/DevData/DataDump" + str(loc_num)):
  1051.                 loc_num = loc_num + 1
  1052.             destination = "C:/Users/Public/Operational_Functional_Block/Python_Projects/GenFiles/DevData/DataDump" + str(loc_num)
  1053.         os.mkdir(destination)
  1054.  
  1055.         end = time()
  1056.         timen = (end - start)
  1057.         print(f"Amount of engines created: {y}")
  1058.         print(f"Amount of engine files created: {fNum}")
  1059.         print(f"Amount of engine files created (Kb): {fNum*50}")
  1060.         print(f"Average amount of engines per file: {y/fNum}")
  1061.         print(f"Average size of one engine (Kb): {(50 * fNum)/y}")
  1062.         print(f"Average time taken to generate one engine: {(timen/y)}")
  1063.         if timen < 60:
  1064.             print(f"Total run time: {timen} secs")
  1065.         elif timen / 60 < 2:
  1066.             print(f"Total run time: {math.floor(timen/60)} min {timen%60} secs")
  1067.         else:
  1068.             print(f"Total run time: {math.floor(timen/60)} mins {timen%60} secs")
  1069.  
  1070.         fin = open(destination + "/dev.txt", "at")
  1071.         fin.write(f"Amount of engines created: {y}")
  1072.         fin.write(f"Amount of engine files created: {fNum}")
  1073.         fin.write(f"Amount of engine files created (Kb): {fNum * 50}")
  1074.         fin.write(f"Average amount of engines per file: {y/fNum}")
  1075.         fin.write(f"Average size of one engine (Kb): {(50 * fNum)/y}")
  1076.         fin.write(f"Average time taken to generate one engine: {(timen/y)}")
  1077.         if timen < 60:
  1078.             fin.write(f"Total run time: {timen} secs")
  1079.         elif timen / 60 < 2:
  1080.             fin.write(f"Total run time: {math.floor(timen / 60)} min {timen % 60} secs")
  1081.         else:
  1082.             fin.write(f"Total run time: {math.floor(timen / 60)} mins {timen % 60} secs")
  1083.         fin.close()
  1084.  
  1085.         xsa, ysa, fig = np.array(mpl_xs), np.array(mpl_ysa), pylab.gcf()
  1086.         fig.canvas.manager.set_window_title('Graph of testing')
  1087.         plt.subplot(1, 2, 1)
  1088.         plt.title(EngineType, fontsize=16)
  1089.         plt.xlabel('Time (s)')
  1090.         plt.ylabel('Number of files')
  1091.         plt.xticks(np.arange(0, max(xsa) + max(xsa)/20, round(max(xsa)/10)))
  1092.         plt.yticks(np.arange(0, max(ysa) + max(ysa)/20, max(ysa)/20))
  1093.         plt.plot(xsa, ysa, linestyle="-", color="red", linewidth=1.1)
  1094.         plt.grid(linestyle="--")
  1095.         plt.savefig(destination + "/dev_dataA.png")
  1096.         plt.suptitle("Graph of data", fontsize=32)
  1097.  
  1098.         xsb, ysa, fig = np.array(mpl_xs), np.array(mpl_ysa), pylab.gcf()
  1099.         fig.canvas.manager.set_window_title('Graph of testing')
  1100.         plt.title(EngineType, fontsize=16)
  1101.         ysb = np.array(mpl_ysb)
  1102.         plt.xlabel('Time (s)')
  1103.         plt.ylabel('Percentage of RAM used')
  1104.         plt.xticks(np.arange(0, max(xsb) + max(xsb)/20, round(max(xsb)/20)))
  1105.         plt.yticks(np.arange(0, 100, 5))
  1106.         plt.plot(xs, ysb, linestyle="-", color="red", linewidth=1.1)
  1107.         plt.grid(linestyle="--")
  1108.         plt.savefig(destination + "/dev_dataB.png")
  1109.         plt.suptitle("Graph of data", fontsize=32)
  1110.  
  1111.         exit(0)
  1112. """    
  1113. else:
  1114. while not repeatCommand.upper == "Y" and not repeatCommand.upper == "N" and not repeatCommand.upper == "YES" and not repeatCommand.upper == "NO":
  1115.    print(f"'" + repeatCommand + "'" + " is not a registered command, please input one of the appropriate commands [Y/N] or [Yes/No]")
  1116.    repeatCommand = str(input(">>>>> ")).upper()
  1117.    if repeatCommand == "Y" or repeatCommand == "N" or repeatCommand == "YES" or repeatCommand == "NO":
  1118.        break
  1119. """
Advertisement
Add Comment
Please, Sign In to add comment