{"id":20960557,"url":"https://github.com/natronics/jsbsim-manager","last_synced_at":"2025-11-03T14:03:41.528Z","repository":{"id":136468204,"uuid":"60107461","full_name":"natronics/JSBSim-Manager","owner":"natronics","description":"Rough first attempt at putting together elements from Open Aerospace to automate rocket simulation.","archived":false,"fork":false,"pushed_at":"2016-06-06T01:07:09.000Z","size":2122,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T07:34:51.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natronics.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-31T16:54:29.000Z","updated_at":"2024-07-08T11:15:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"435ac884-8b5d-4f85-af43-74743bc101a6","html_url":"https://github.com/natronics/JSBSim-Manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/natronics/JSBSim-Manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natronics%2FJSBSim-Manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natronics%2FJSBSim-Manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natronics%2FJSBSim-Manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natronics%2FJSBSim-Manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natronics","download_url":"https://codeload.github.com/natronics/JSBSim-Manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natronics%2FJSBSim-Manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021361,"owners_count":26087019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T01:59:31.276Z","updated_at":"2025-10-14T21:08:38.224Z","avatar_url":"https://github.com/natronics.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Build A Rocket And Launch It\n\nProcedurally build and simulate a flight. This is my attempt to use the [open aerospace rocket documentation tool](https://open-aerospace.github.io/openrocketdoc/) to describe a rocket and generate JSBSim configuration to simulate its flight.\n\nView the raw jupyter notebook: [rocket.ipynb](https://github.com/natronics/JSBSim-Manager/blob/master/rocket.ipynb)\n\nYou can run it yourself by cloning this repo and install requirements:\n\n    $ pip install -r requirements.txt\n\nThen run jupyter to edit/run the document in your browser:\n\n    $ jupyter notebook\n\nThe idea is that you can make up some numbers (\"what if I built a rocket with _this_ much thrust?\") and this script will parametrically design an entire rocket. Then using openrocketdoc, generate a valid JSBSim case and run JSBSim for you, generating flight simulation output.\n\nJust put in numbers for the engine design and then run the notebook!\n\n\n## Step 1. Design The Engine\n\nPick an engine design. Well define it based on a desired Isp, thrust, and burn time.\n\n\n\nEngine Design parameters:\n\n      Input     |   Number  | Units \n -------------- | --------: | :---- \n            Isp |     214.0 | s\n         Thrust |   1,555.0 | N\n      Burn Time |      10.0 | s\n\n\nAll we need to do is create an openrocketdoc Engine with those basic numbers:\n\n```python\nfrom openrocketdoc import document\n\nengine = document.Engine('My Rocket Motor')\nengine.Isp = 214.0\nengine.thrust_avg = 1555.0\nengine.t_burn = 10.0\n```\n\nEverything else can be computed from that engine class:\n\n\n\n\nOur computed engine will need 7.4 kg of propellent.\nIt has a total impulse of 15,550 Ns. That would make it a 'N'(52%) class motor.\n\nGenerated JSBSim engine document:\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\u003crocket_engine name=\"Python Motor\"\u003e\n  \u003cisp\u003e214.0\u003c/isp\u003e\n  \u003cbuilduptime\u003e0.1\u003c/builduptime\u003e\n  \u003cthrust_table name=\"propulsion/thrust_prop_remain\" type=\"internal\"\u003e\n    \u003ctableData\u003e\n      0.000 349.578\n      5.445 349.578\n      10.890 349.578\n    \u003c/tableData\u003e\n  \u003c/thrust_table\u003e\n\u003c/rocket_engine\u003e\n\n```\n\n\n## Step 2. Build The Rocket\n\nNow we know how much propellent, guess the density and come up with some parametric rocket design. If we compute some numbers based on a guess of the density of our propellent, we can build up a full rocket desgin from our `engine`. The only hardcoded magic is a prefered lenght-to-diameter ratio.\n\n\n\nRocket Design parameters:\n\n          Input         |   Number  | Units \n ---------------------- | --------: | :---- \n     Propellent Density |   1,555.0 | kg/m3\n        Motor L/D ratio |      10.0 | \n     Nosecone L/D ratio |       5.0 | \n\n\n\n\nComputed rocket length: 1.6 meters, diameter: 81.39 mm\n\nGenerated diagram of the rocket, with a nosecone, fixed length dummy payload section, and motor:\n\n\n\n![](https://rawgit.com/natronics/JSBSim-Manager/master/rocket_files/rocket_6_1.svg)\n\n\n\n\nGenerated JSBSim 'Aircraft' document:\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\u003cfdm_config name=\"Rocket\" release=\"ALPHA\" version=\"2.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://jsbsim.sourceforge.net/JSBSim.xsd\"\u003e\n  \u003cfileheader/\u003e\n  \u003c!--\n\n  Primary Metrics (Ovearall size of vehicle)\n\n  --\u003e\n  \u003cmetrics\u003e\n    \u003cwingarea unit=\"M2\"\u003e0.0052\u003c/wingarea\u003e\n    \u003cwingspan unit=\"M\"\u003e0.0814\u003c/wingspan\u003e\n    \u003cchord unit=\"M\"\u003e0.0\u003c/chord\u003e\n    \u003chtailarea unit=\"M2\"\u003e0.0\u003c/htailarea\u003e\n    \u003chtailarm unit=\"M\"\u003e0.0\u003c/htailarm\u003e\n    \u003cvtailarea unit=\"M2\"\u003e0.0\u003c/vtailarea\u003e\n    \u003cvtailarm unit=\"M\"\u003e0.0\u003c/vtailarm\u003e\n    \u003clocation name=\"AERORP\" unit=\"M\"\u003e\n      \u003cx\u003e1.5508\u003c/x\u003e\n      \u003cy\u003e0.0\u003c/y\u003e\n      \u003cz\u003e0.0\u003c/z\u003e\n    \u003c/location\u003e\n  \u003c/metrics\u003e\n  \u003c!--\n\n  Mass Elements: describe dry mass of vehicle\n\n  --\u003e\n  \u003cmass_balance\u003e\n    \u003cpointmass name=\"Payload\"\u003e\n      \u003cform shape=\"tube\"\u003e\n        \u003cradius unit=\"M\"\u003e0.0407\u003c/radius\u003e\n        \u003clength unit=\"M\"\u003e0.3300\u003c/length\u003e\n      \u003c/form\u003e\n      \u003cweight unit=\"KG\"\u003e2.5000\u003c/weight\u003e\n      \u003clocation unit=\"M\"\u003e\n        \u003cx\u003e0.5719\u003c/x\u003e\n        \u003cy\u003e0.0\u003c/y\u003e\n        \u003cz\u003e0.0\u003c/z\u003e\n      \u003c/location\u003e\n    \u003c/pointmass\u003e\n    \u003cpointmass name=\"Body\"\u003e\n      \u003cform shape=\"tube\"\u003e\n        \u003cradius unit=\"M\"\u003e0.0407\u003c/radius\u003e\n        \u003clength unit=\"M\"\u003e0.8139\u003c/length\u003e\n      \u003c/form\u003e\n      \u003cweight unit=\"KG\"\u003e1.5000\u003c/weight\u003e\n      \u003clocation unit=\"M\"\u003e\n        \u003cx\u003e1.1439\u003c/x\u003e\n        \u003cy\u003e0.0\u003c/y\u003e\n        \u003cz\u003e0.0\u003c/z\u003e\n      \u003c/location\u003e\n    \u003c/pointmass\u003e\n  \u003c/mass_balance\u003e\n  \u003c!--\n\n  Propulsion: describe tanks, fuel and link to engine def files\n\n  --\u003e\n  \u003cpropulsion\u003e\n    \u003ctank type=\"FUEL\"\u003e\n      \u003clocation unit=\"M\"\u003e\n        \u003cx\u003e1.1439\u003c/x\u003e\n        \u003cy\u003e0.0\u003c/y\u003e\n        \u003cz\u003e0.0\u003c/z\u003e\n      \u003c/location\u003e\n      \u003cradius unit=\"M\"\u003e0.0407\u003c/radius\u003e\n      \u003cgrain_config type=\"CYLINDRICAL\"\u003e\n        \u003clength unit=\"M\"\u003e0.8139\u003c/length\u003e\n        \u003cbore_diameter unit=\"M\"\u003e0\u003c/bore_diameter\u003e\n      \u003c/grain_config\u003e\n      \u003ccapacity unit=\"KG\"\u003e7.4096\u003c/capacity\u003e\n      \u003ccontents unit=\"KG\"\u003e7.4096\u003c/contents\u003e\n    \u003c/tank\u003e\n    \u003cengine file=\"python-motor\"\u003e\n      \u003cfeed\u003e0\u003c/feed\u003e\n      \u003clocation unit=\"M\"\u003e\n        \u003cx\u003e0.7369\u003c/x\u003e\n        \u003cy\u003e0.0\u003c/y\u003e\n        \u003cz\u003e0.0\u003c/z\u003e\n      \u003c/location\u003e\n      \u003cthruster file=\"python-motor_nozzle\"\u003e\n        \u003clocation unit=\"M\"\u003e\n          \u003cx\u003e1.5508\u003c/x\u003e\n          \u003cy\u003e0.0\u003c/y\u003e\n          \u003cz\u003e0.0\u003c/z\u003e\n        \u003c/location\u003e\n      \u003c/thruster\u003e\n    \u003c/engine\u003e\n  \u003c/propulsion\u003e\n  \u003c!--\n\n  Aerodynamics\n\n  --\u003e\n  \u003caerodynamics\u003e\n    \u003caxis name=\"DRAG\"\u003e\n      \u003cfunction name=\"aero/force/drag\"\u003e\n        \u003cdescription\u003eCoefficient of Drag\u003c/description\u003e\n        \u003cproduct\u003e\n          \u003cproperty\u003eaero/qbar-psf\u003c/property\u003e\n          \u003cproperty\u003emetrics/Sw-sqft\u003c/property\u003e\n          \u003cvalue\u003e0.600000\u003c/value\u003e\n        \u003c/product\u003e\n      \u003c/function\u003e\n    \u003c/axis\u003e\n  \u003c/aerodynamics\u003e\n  \u003c!--\n  Ground reactions and systems are not auto-generated.\n  --\u003e\n  \u003cground_reactions/\u003e\n  \u003csystem/\u003e\n\u003c/fdm_config\u003e\n\n```\n\n\n## Build JSBSim Case\n\nJSBSim needs several files in directories with a particular file structure. We simply write the files above to the filesystem appropriate places. A generic `run.xml` and `init.xml` files are already here. They're almost completely independent from the rocket definitions, the only thing \"hard coded\" is the name of the rocket (which has to match the filename).\n\n\n\n## Run JSBSim\n\nNow we can simulate the flight by invoking JSBSim (assuming you have it installed and in your path). It's as easy as this:\n\n```python\nimport subprocess\n# Run JSBSim using Popen\np = subprocess.Popen([\"JSBSim\", \"--logdirectivefile=output_file.xml\", \"--script=run.xml\"])\n```\n\n\n\n## Analyze The Simulation Results\n\nNow we should have a datafile from the simulation!\n\n\n\nThe apogee (maximum altitude) of this flight was 17.8 km above sea level\n\n\n\n\n\n![](rocket_files/rocket_14_0.png)\n\n\n\n\n\n![](rocket_files/rocket_15_0.png)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatronics%2Fjsbsim-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatronics%2Fjsbsim-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatronics%2Fjsbsim-manager/lists"}