Skip to content

Commit

Permalink
Merge pull request #232 from RocketPy-Team/enh/class_dispersion
Browse files Browse the repository at this point in the history
ENH: Introducing the Monte Carlo class
  • Loading branch information
Gui-FernandesBR authored May 21, 2024
2 parents 1e17549 + 209434f commit e7b730a
Show file tree
Hide file tree
Showing 78 changed files with 8,197 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
"We hope you enjoy the flight(s) in this notebook just like everyone in LASC19 did it in real-time!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**NOTE:** There is a new `MonteCarlo` class in RocketPy v1.2.0. This notebook is still here just for reference, but it is recommended to use the new class. See the `Monte Carlo class usage` page in the documentation for more information."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -384,7 +391,7 @@
],
"source": [
"# Basic analysis info\n",
"filename = \"dispersion_analysis_outputs/valetudo_rocket_v0\"\n",
"filename = \"monte_carlo_analysis_outputs/valetudo_rocket_v0\"\n",
"number_of_simulations = 100\n",
"\n",
"# Create data files for inputs, outputs and error logging\n",
Expand All @@ -404,7 +411,7 @@
"Env.max_expected_height = 1500\n",
"Env.set_atmospheric_model(\n",
" type=\"Ensemble\",\n",
" file=\"dispersion_analysis_inputs/LASC2019_reanalysis.nc\",\n",
" file=\"monte_carlo_analysis_inputs/LASC2019_reanalysis.nc\",\n",
" dictionary=\"ECMWF\",\n",
")\n",
"\n",
Expand All @@ -428,7 +435,7 @@
"\n",
" # Create motor\n",
" Keron = SolidMotor(\n",
" thrust_source=\"dispersion_analysis_inputs/thrustCurve.csv\",\n",
" thrust_source=\"monte_carlo_analysis_inputs/thrustCurve.csv\",\n",
" burn_time=5.274,\n",
" reshape_thrust_curve=(setting[\"burn_time\"], setting[\"impulse\"]),\n",
" nozzle_radius=setting[\"nozzle_radius\"],\n",
Expand Down Expand Up @@ -460,8 +467,8 @@
" setting[\"rocket_inertia_11\"],\n",
" setting[\"rocket_inertia_33\"],\n",
" ),\n",
" power_off_drag=\"dispersion_analysis_inputs/Cd_PowerOff.csv\",\n",
" power_on_drag=\"dispersion_analysis_inputs/Cd_PowerOn.csv\",\n",
" power_off_drag=\"monte_carlo_analysis_inputs/Cd_PowerOff.csv\",\n",
" power_on_drag=\"monte_carlo_analysis_inputs/Cd_PowerOn.csv\",\n",
" center_of_mass_without_motor=0,\n",
" coordinate_system_orientation=\"tail_to_nose\",\n",
" )\n",
Expand Down Expand Up @@ -574,7 +581,7 @@
}
],
"source": [
"filename = \"dispersion_analysis_outputs/valetudo_rocket_v0\"\n",
"filename = \"monte_carlo_analysis_outputs/valetudo_rocket_v0\"\n",
"\n",
"# Initialize variable to store all results\n",
"dispersion_general_results = []\n",
Expand Down Expand Up @@ -20354,7 +20361,7 @@
"from matplotlib.patches import Ellipse\n",
"\n",
"# Import background map\n",
"img = imread(\"dispersion_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
"img = imread(\"monte_carlo_analysis_inputs/Valetudo_basemap_final.jpg\")\n",
"\n",
"# Retrieve dispersion data por apogee and impact XY position\n",
"apogee_x = np.array(dispersion_results[\"apogee_x\"])\n",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document id="1">
<Style id="8">
<LineStyle id="9">
<color>ff0000ff</color>
<colorMode>normal</colorMode>
<width>3</width>
</LineStyle>
<PolyStyle id="10">
<color>64ff0000</color>
<colorMode>normal</colorMode>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<Style id="17">
<LineStyle id="18">
<color>ff0000ff</color>
<colorMode>normal</colorMode>
<width>3</width>
</LineStyle>
<PolyStyle id="19">
<color>64ff0000</color>
<colorMode>normal</colorMode>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<Style id="26">
<LineStyle id="27">
<color>ff0000ff</color>
<colorMode>normal</colorMode>
<width>3</width>
</LineStyle>
<PolyStyle id="28">
<color>64ff0000</color>
<colorMode>normal</colorMode>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<Placemark id="3">
<name>Impact σ1</name>
<visibility>1</visibility>
<styleUrl>#8</styleUrl>
<MultiGeometry id="2">
<Polygon id="4">
<outerBoundaryIs>
<LinearRing id="6">
<coordinates>1103.1172286537246,1837.8024088917573,0.0 1094.9984810133226,1842.5556499782087,0.0 1087.949600575892,1849.883623456037,0.0 1081.998406052192,1859.7574091617566,0.0 1077.168384088166,1872.1380397740918,0.0 1073.4785965738781,1886.9766546001874,0.0 1070.9436054149444,1904.214692406443,0.0 1069.5734150633416,1923.7841225329475,0.0 1069.3734330344068,1945.6077133794142,0.0 1070.3444485658454,1969.599337203022,0.0 1072.4826295029695,1995.6643100252697,0.0 1075.7795374224625,2023.699765306381,0.0 1080.2221609349797,2053.5950599125426,0.0 1085.792967035159,2085.2322107738055,0.0 1092.4699702963821,2118.486360509359,0.0 1100.22681963721,2153.226270182573,0.0 1109.0329023170614,2189.3148372411224,0.0 1118.8534647507154,2226.609636598125,0.0 1129.6497496648349,2264.9634827188916,0.0 1141.3791490552169,2304.2250104949894,0.0 1153.9953723411206,2344.239272613172,0.0 1167.4486290530408,2384.8483510616365,0.0 1181.6858253329438,2425.89198036027,0.0 1196.650773471469,2467.2081800552805,0.0 1212.2844136551482,2508.6338939820494,0.0 1228.5250470485075,2550.005633773316,0.0 1245.3085792911825,2591.1601240730724,0.0 1262.5687734490782,2631.9349469098056,0.0 1280.237511421286,2672.1691826860233,0.0 1298.2450627711078,2711.70404525439,0.0 1316.5203599202337,2750.383508574109,0.0 1334.9912786200055,2788.054922474424,0.0 1353.5849225928748,2824.569615095102,0.0 1372.2279112207088,2859.783479626345,0.0 1390.8466691445649,2893.5575430325334,0.0 1409.3677166330187,2925.7585145153043,0.0 1427.7179595730954,2956.2593115514396,0.0 1445.8249779393389,2984.939561429527,0.0 1463.617311602567,3011.6860763060567,0.0 1481.0247423503558,3036.393299906132,0.0 1497.9785710062422,3058.96372410586,0.0 1514.411888553988,3079.3082737523705,0.0 1530.2598401969026,3097.3466582027486,0.0 1545.4598813100906,3113.007688194524,0.0 1559.9520242755168,3126.2295567971614,0.0 1573.6790752257268,3136.9600833357854,0.0 1586.5868597619135,3145.156919324457,0.0 1598.6244367555187,3150.787715596309,0.0 1609.7442993895934,3153.830249970922,0.0 1619.9025626465038,3154.2725149551206,0.0 1629.0591365020434,3152.1127651310644,0.0 1637.1778841424455,3147.359524044613,0.0 1644.226764579876,3140.0315505667845,0.0 1650.1779591035759,3130.157764861065,0.0 1655.007981067602,3117.77713424873,0.0 1658.6977685818897,3102.9385194226343,0.0 1661.2327597408237,3085.700481616379,0.0 1662.6029500924267,3066.1310514898746,0.0 1662.8029321213612,3044.3074606434075,0.0 1661.8319165899227,3020.3158368197996,0.0 1659.6937356527985,2994.250863997552,0.0 1656.3968277333056,2966.2154087164404,0.0 1651.9542042207884,2936.320114110279,0.0 1646.383398120609,2904.682963249016,0.0 1639.7063948593857,2871.4288135134625,0.0 1631.9495455185581,2836.6889038402487,0.0 1623.143462838707,2800.6003367816993,0.0 1613.3229004050527,2763.305537424697,0.0 1602.5266154909332,2724.9516913039297,0.0 1590.7972161005512,2685.6901635278323,0.0 1578.1809928146474,2645.6759014096497,0.0 1564.727736102727,2605.0668229611847,0.0 1550.4905398228243,2564.0231936625514,0.0 1535.5255916842991,2522.706993967541,0.0 1519.8919515006196,2481.281280040772,0.0 1503.6513181072605,2439.909540249506,0.0 1486.8677858645856,2398.7550499497493,0.0 1469.6075917066898,2357.980227113016,0.0 1451.9388537344823,2317.7459913367984,0.0 1433.9313023846603,2278.2111287684315,0.0 1415.6560052355344,2239.531665448713,0.0 1397.1850865357628,2201.860251548398,0.0 1378.5914425628937,2165.34555892772,0.0 1359.9484539350592,2130.131694396476,0.0 1341.3296960112032,2096.3576309902883,0.0 1322.8086485227493,2064.1566595075174,0.0 1304.4584055826729,2033.655862471382,0.0 1286.3513872164294,2004.9756125932952,0.0 1268.5590535532012,1978.229097716765,0.0 1251.151622805412,1953.5218741166893,0.0 1234.1977941495259,1930.9514499169616,0.0 1217.76447660178,1910.6069002704514,0.0 1201.9165249588657,1892.568515820073,0.0 1186.7164838456777,1876.9074858282981,0.0 1172.2243408802512,1863.68561722566,0.0 1158.4972899300412,1852.9550906870368,0.0 1145.5895053938546,1844.7582546983645,0.0 1133.5519284002494,1839.1274584265125,0.0 1122.4320657661747,1836.0849240518999,0.0 -8.267624328036598,39.399689834676806,0.0</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</MultiGeometry>
</Placemark>
<Placemark id="12">
<name>Impact σ2</name>
<visibility>1</visibility>
<styleUrl>#17</styleUrl>
<MultiGeometry id="11">
<Polygon id="13">
<outerBoundaryIs>
<LinearRing id="15">
<coordinates>1103.1172286537246,1837.8024088917573,0.0 1094.9984810133226,1842.5556499782087,0.0 1087.949600575892,1849.883623456037,0.0 1081.998406052192,1859.7574091617566,0.0 1077.168384088166,1872.1380397740918,0.0 1073.4785965738781,1886.9766546001874,0.0 1070.9436054149444,1904.214692406443,0.0 1069.5734150633416,1923.7841225329475,0.0 1069.3734330344068,1945.6077133794142,0.0 1070.3444485658454,1969.599337203022,0.0 1072.4826295029695,1995.6643100252697,0.0 1075.7795374224625,2023.699765306381,0.0 1080.2221609349797,2053.5950599125426,0.0 1085.792967035159,2085.2322107738055,0.0 1092.4699702963821,2118.486360509359,0.0 1100.22681963721,2153.226270182573,0.0 1109.0329023170614,2189.3148372411224,0.0 1118.8534647507154,2226.609636598125,0.0 1129.6497496648349,2264.9634827188916,0.0 1141.3791490552169,2304.2250104949894,0.0 1153.9953723411206,2344.239272613172,0.0 1167.4486290530408,2384.8483510616365,0.0 1181.6858253329438,2425.89198036027,0.0 1196.650773471469,2467.2081800552805,0.0 1212.2844136551482,2508.6338939820494,0.0 1228.5250470485075,2550.005633773316,0.0 1245.3085792911825,2591.1601240730724,0.0 1262.5687734490782,2631.9349469098056,0.0 1280.237511421286,2672.1691826860233,0.0 1298.2450627711078,2711.70404525439,0.0 1316.5203599202337,2750.383508574109,0.0 1334.9912786200055,2788.054922474424,0.0 1353.5849225928748,2824.569615095102,0.0 1372.2279112207088,2859.783479626345,0.0 1390.8466691445649,2893.5575430325334,0.0 1409.3677166330187,2925.7585145153043,0.0 1427.7179595730954,2956.2593115514396,0.0 1445.8249779393389,2984.939561429527,0.0 1463.617311602567,3011.6860763060567,0.0 1481.0247423503558,3036.393299906132,0.0 1497.9785710062422,3058.96372410586,0.0 1514.411888553988,3079.3082737523705,0.0 1530.2598401969026,3097.3466582027486,0.0 1545.4598813100906,3113.007688194524,0.0 1559.9520242755168,3126.2295567971614,0.0 1573.6790752257268,3136.9600833357854,0.0 1586.5868597619135,3145.156919324457,0.0 1598.6244367555187,3150.787715596309,0.0 1609.7442993895934,3153.830249970922,0.0 1619.9025626465038,3154.2725149551206,0.0 1629.0591365020434,3152.1127651310644,0.0 1637.1778841424455,3147.359524044613,0.0 1644.226764579876,3140.0315505667845,0.0 1650.1779591035759,3130.157764861065,0.0 1655.007981067602,3117.77713424873,0.0 1658.6977685818897,3102.9385194226343,0.0 1661.2327597408237,3085.700481616379,0.0 1662.6029500924267,3066.1310514898746,0.0 1662.8029321213612,3044.3074606434075,0.0 1661.8319165899227,3020.3158368197996,0.0 1659.6937356527985,2994.250863997552,0.0 1656.3968277333056,2966.2154087164404,0.0 1651.9542042207884,2936.320114110279,0.0 1646.383398120609,2904.682963249016,0.0 1639.7063948593857,2871.4288135134625,0.0 1631.9495455185581,2836.6889038402487,0.0 1623.143462838707,2800.6003367816993,0.0 1613.3229004050527,2763.305537424697,0.0 1602.5266154909332,2724.9516913039297,0.0 1590.7972161005512,2685.6901635278323,0.0 1578.1809928146474,2645.6759014096497,0.0 1564.727736102727,2605.0668229611847,0.0 1550.4905398228243,2564.0231936625514,0.0 1535.5255916842991,2522.706993967541,0.0 1519.8919515006196,2481.281280040772,0.0 1503.6513181072605,2439.909540249506,0.0 1486.8677858645856,2398.7550499497493,0.0 1469.6075917066898,2357.980227113016,0.0 1451.9388537344823,2317.7459913367984,0.0 1433.9313023846603,2278.2111287684315,0.0 1415.6560052355344,2239.531665448713,0.0 1397.1850865357628,2201.860251548398,0.0 1378.5914425628937,2165.34555892772,0.0 1359.9484539350592,2130.131694396476,0.0 1341.3296960112032,2096.3576309902883,0.0 1322.8086485227493,2064.1566595075174,0.0 1304.4584055826729,2033.655862471382,0.0 1286.3513872164294,2004.9756125932952,0.0 1268.5590535532012,1978.229097716765,0.0 1251.151622805412,1953.5218741166893,0.0 1234.1977941495259,1930.9514499169616,0.0 1217.76447660178,1910.6069002704514,0.0 1201.9165249588657,1892.568515820073,0.0 1186.7164838456777,1876.9074858282981,0.0 1172.2243408802512,1863.68561722566,0.0 1158.4972899300412,1852.9550906870368,0.0 1145.5895053938546,1844.7582546983645,0.0 1133.5519284002494,1839.1274584265125,0.0 1122.4320657661747,1836.0849240518999,0.0 -8.267624328036598,39.399689834676806,0.0</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</MultiGeometry>
</Placemark>
<Placemark id="21">
<name>Impact σ3</name>
<visibility>1</visibility>
<styleUrl>#26</styleUrl>
<MultiGeometry id="20">
<Polygon id="22">
<outerBoundaryIs>
<LinearRing id="24">
<coordinates>1103.1172286537246,1837.8024088917573,0.0 1094.9984810133226,1842.5556499782087,0.0 1087.949600575892,1849.883623456037,0.0 1081.998406052192,1859.7574091617566,0.0 1077.168384088166,1872.1380397740918,0.0 1073.4785965738781,1886.9766546001874,0.0 1070.9436054149444,1904.214692406443,0.0 1069.5734150633416,1923.7841225329475,0.0 1069.3734330344068,1945.6077133794142,0.0 1070.3444485658454,1969.599337203022,0.0 1072.4826295029695,1995.6643100252697,0.0 1075.7795374224625,2023.699765306381,0.0 1080.2221609349797,2053.5950599125426,0.0 1085.792967035159,2085.2322107738055,0.0 1092.4699702963821,2118.486360509359,0.0 1100.22681963721,2153.226270182573,0.0 1109.0329023170614,2189.3148372411224,0.0 1118.8534647507154,2226.609636598125,0.0 1129.6497496648349,2264.9634827188916,0.0 1141.3791490552169,2304.2250104949894,0.0 1153.9953723411206,2344.239272613172,0.0 1167.4486290530408,2384.8483510616365,0.0 1181.6858253329438,2425.89198036027,0.0 1196.650773471469,2467.2081800552805,0.0 1212.2844136551482,2508.6338939820494,0.0 1228.5250470485075,2550.005633773316,0.0 1245.3085792911825,2591.1601240730724,0.0 1262.5687734490782,2631.9349469098056,0.0 1280.237511421286,2672.1691826860233,0.0 1298.2450627711078,2711.70404525439,0.0 1316.5203599202337,2750.383508574109,0.0 1334.9912786200055,2788.054922474424,0.0 1353.5849225928748,2824.569615095102,0.0 1372.2279112207088,2859.783479626345,0.0 1390.8466691445649,2893.5575430325334,0.0 1409.3677166330187,2925.7585145153043,0.0 1427.7179595730954,2956.2593115514396,0.0 1445.8249779393389,2984.939561429527,0.0 1463.617311602567,3011.6860763060567,0.0 1481.0247423503558,3036.393299906132,0.0 1497.9785710062422,3058.96372410586,0.0 1514.411888553988,3079.3082737523705,0.0 1530.2598401969026,3097.3466582027486,0.0 1545.4598813100906,3113.007688194524,0.0 1559.9520242755168,3126.2295567971614,0.0 1573.6790752257268,3136.9600833357854,0.0 1586.5868597619135,3145.156919324457,0.0 1598.6244367555187,3150.787715596309,0.0 1609.7442993895934,3153.830249970922,0.0 1619.9025626465038,3154.2725149551206,0.0 1629.0591365020434,3152.1127651310644,0.0 1637.1778841424455,3147.359524044613,0.0 1644.226764579876,3140.0315505667845,0.0 1650.1779591035759,3130.157764861065,0.0 1655.007981067602,3117.77713424873,0.0 1658.6977685818897,3102.9385194226343,0.0 1661.2327597408237,3085.700481616379,0.0 1662.6029500924267,3066.1310514898746,0.0 1662.8029321213612,3044.3074606434075,0.0 1661.8319165899227,3020.3158368197996,0.0 1659.6937356527985,2994.250863997552,0.0 1656.3968277333056,2966.2154087164404,0.0 1651.9542042207884,2936.320114110279,0.0 1646.383398120609,2904.682963249016,0.0 1639.7063948593857,2871.4288135134625,0.0 1631.9495455185581,2836.6889038402487,0.0 1623.143462838707,2800.6003367816993,0.0 1613.3229004050527,2763.305537424697,0.0 1602.5266154909332,2724.9516913039297,0.0 1590.7972161005512,2685.6901635278323,0.0 1578.1809928146474,2645.6759014096497,0.0 1564.727736102727,2605.0668229611847,0.0 1550.4905398228243,2564.0231936625514,0.0 1535.5255916842991,2522.706993967541,0.0 1519.8919515006196,2481.281280040772,0.0 1503.6513181072605,2439.909540249506,0.0 1486.8677858645856,2398.7550499497493,0.0 1469.6075917066898,2357.980227113016,0.0 1451.9388537344823,2317.7459913367984,0.0 1433.9313023846603,2278.2111287684315,0.0 1415.6560052355344,2239.531665448713,0.0 1397.1850865357628,2201.860251548398,0.0 1378.5914425628937,2165.34555892772,0.0 1359.9484539350592,2130.131694396476,0.0 1341.3296960112032,2096.3576309902883,0.0 1322.8086485227493,2064.1566595075174,0.0 1304.4584055826729,2033.655862471382,0.0 1286.3513872164294,2004.9756125932952,0.0 1268.5590535532012,1978.229097716765,0.0 1251.151622805412,1953.5218741166893,0.0 1234.1977941495259,1930.9514499169616,0.0 1217.76447660178,1910.6069002704514,0.0 1201.9165249588657,1892.568515820073,0.0 1186.7164838456777,1876.9074858282981,0.0 1172.2243408802512,1863.68561722566,0.0 1158.4972899300412,1852.9550906870368,0.0 1145.5895053938546,1844.7582546983645,0.0 1133.5519284002494,1839.1274584265125,0.0 1122.4320657661747,1836.0849240518999,0.0 -8.267624328036598,39.399689834676806,0.0</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</MultiGeometry>
</Placemark>
</Document>
</kml>
Loading

0 comments on commit e7b730a

Please sign in to comment.