├── .gitignore ├── LICENSE ├── README.md ├── main.py ├── openburn ├── __init__.py ├── application │ ├── __init__.py │ ├── application.py │ ├── propellant_db.py │ └── settings.py ├── core │ ├── __init__.py │ ├── grain.py │ ├── internalballistics.py │ ├── motor.py │ ├── nozzle.py │ └── propellant.py ├── object.py ├── ui │ ├── __init__.py │ ├── designtab.py │ ├── dialogs │ │ ├── __init__.py │ │ ├── about.py │ │ └── grain_dialog.py │ ├── mainwindow.py │ └── models │ │ └── __init__.py └── util │ ├── __init__.py │ ├── motorclass.py │ └── units.py ├── requirements.txt ├── res └── icons │ └── nakka-finocyl.gif ├── run_tests.py ├── setup.py ├── tests ├── __init__.py ├── test_json.py ├── test_motor_class.py ├── test_propellant_db.py ├── test_settings_db.py └── test_sim.py └── user ├── propellants.json └── settings.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | bin/ 10 | build/ 11 | develop-eggs/ 12 | dist/ 13 | eggs/ 14 | lib/ 15 | lib64/ 16 | parts/ 17 | sdist/ 18 | var/ 19 | venv/ 20 | build-*/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | *.pdy 25 | main.spec 26 | 27 | # Installer logs 28 | pip-log.txt 29 | pip-delete-this-directory.txt 30 | 31 | # Unit test / coverage reports 32 | .tox/ 33 | .coverage 34 | .cache 35 | nosetests.xml 36 | coverage.xml 37 | 38 | # IDEs 39 | .project 40 | .pydevproject 41 | .idea 42 | .vscode 43 | 44 | # Sphinx documentation 45 | docs/_build/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenBurn 2 | 3 | OpenBurn is an open-source solid rocket engine simulation and design platform designed from the ground up for 4 | the amateur rocketry community. 5 | OpenBurn is based on Qt5 and Python 3, and has support across all major platforms (Windows, OSX, Linux). 6 | 7 | ## Building 8 | 9 | OpenBurn requires: 10 | - Qt 5.6 or newer, preferably the newest version (currently 5.11). 11 | - Python 3.6+ 12 | - PyQt5 or PySide2[1] 13 | 14 | [1]OpenBurn uses the [QtPy](https://pypi.org/project/QtPy/) abstraction layer for Python Qt bindings, 15 | so you can use either PySide2 or PyQt5 16 | 17 | To check out the ongoing development: 18 | 19 | ```bash 20 | git clone https://github.com/tuxxi/OpenBurn 21 | sudo pip install -r requirements.txt 22 | python3 main.py 23 | ``` -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from qtpy.QtWidgets import QApplication 3 | 4 | from openburn.ui.mainwindow import MainWindow 5 | 6 | 7 | if __name__ == "__main__": 8 | app = QApplication(sys.argv) 9 | w = MainWindow() 10 | w.show() 11 | sys.exit(app.exec_()) -------------------------------------------------------------------------------- /openburn/__init__.py: -------------------------------------------------------------------------------- 1 | from os import path, pardir 2 | 3 | # Create path references for resource files and such 4 | ROOT_PATH = path.dirname(path.realpath(path.join(__file__, pardir))) 5 | RESOURCE_PATH = path.join(ROOT_PATH, 'res/') 6 | 7 | __version__ = '0.2.0' 8 | __author__ = 'tuxxi' 9 | __author_email__ = 'aidan@sojourner.me' 10 | 11 | __special_thanks__ = ['John Wickman', 12 | 'Peter Hackett'] 13 | -------------------------------------------------------------------------------- /openburn/application/__init__.py: -------------------------------------------------------------------------------- 1 | from openburn.application.application import OpenBurnApplication 2 | 3 | # the singleton application context 4 | app_context = OpenBurnApplication() 5 | -------------------------------------------------------------------------------- /openburn/application/application.py: -------------------------------------------------------------------------------- 1 | from qtpy.QtCore import QObject 2 | from qtpy.QtWidgets import QUndoStack 3 | 4 | from openburn.core.motor import OpenBurnMotor 5 | from openburn.application.settings import SettingsDatabase 6 | from openburn.application.propellant_db import PropellantDatabase 7 | 8 | 9 | class OpenBurnApplication(QObject): 10 | """ 11 | Encapsulates application context that is shared across many UI 12 | elements and modules: 13 | propellant database, 14 | settings, 15 | undo stack, 16 | and current design info 17 | """ 18 | def __init__(self): 19 | super(OpenBurnApplication, self).__init__() 20 | self.motor = OpenBurnMotor() 21 | self.current_design_filename: str = None 22 | 23 | self.undo_stack = QUndoStack(self) 24 | self.propellant_db = PropellantDatabase('user/propellants.json') 25 | self.settings = SettingsDatabase('user/settings.json') 26 | 27 | def reset_design(self): 28 | self.motor = OpenBurnMotor() 29 | 30 | def save_current_design(self): 31 | self.save_design(self.current_design_filename) 32 | 33 | def save_design(self, filename: str): 34 | with open(filename, 'w+') as f: 35 | data = self.motor.to_json() 36 | f.write(data) 37 | self.current_design_filename = filename 38 | 39 | def load_design(self, filename: str): 40 | with open(filename, 'r') as f: 41 | data = f.read() 42 | self.motor = OpenBurnMotor.from_json(data) 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /openburn/application/propellant_db.py: -------------------------------------------------------------------------------- 1 | from typing import Dict 2 | import jsonpickle 3 | 4 | from qtpy.QtCore import QObject, Signal 5 | 6 | from openburn.core.propellant import OpenBurnPropellant 7 | 8 | 9 | class PropellantDatabase(QObject): 10 | database_ready = Signal() 11 | propellant_added = Signal(str) 12 | propellant_edited = Signal(str) 13 | propellant_removed = Signal(str) 14 | 15 | def __init__(self, filename: str = None): 16 | super(PropellantDatabase, self).__init__() 17 | 18 | # Dict ordered by propellant name : propellant 19 | self.propellants: Dict[str: OpenBurnPropellant] = {} 20 | if filename is not None: 21 | self.load_database(filename) 22 | 23 | def propellant_names(self): 24 | return [prop.name for prop in self.propellants] 25 | 26 | def load_database(self, filename: str): 27 | self.clear_database() 28 | with open(filename, 'r') as f: 29 | data = f.read() 30 | if len(data) > 0: 31 | self.propellants = jsonpickle.decode(data) 32 | self.database_filename: str = filename 33 | self.database_ready.emit() 34 | 35 | def save_database(self): 36 | with open(self.database_filename, 'w+') as f: 37 | if len(self.propellants) > 0: 38 | jsonpickle.set_encoder_options('json', sort_keys=True, indent=4) 39 | f.write(jsonpickle.encode(self.propellants)) 40 | 41 | def clear_database(self) -> None: 42 | self.propellants.clear() 43 | 44 | def add_propellant(self, propellant: OpenBurnPropellant) -> None: 45 | self.propellants[propellant.name] = propellant 46 | self.propellant_added.emit(propellant.name) # emit signal 47 | 48 | def remove_propellant(self, key: str) -> None: 49 | """ 50 | Removes a propellant from the database 51 | :param key: the propellant name to be removed 52 | """ 53 | self.propellants.pop(key) 54 | self.propellant_removed.emit(key) # emit signal 55 | 56 | def update_propellant(self, key: str, new_prop: OpenBurnPropellant) -> None: 57 | """Updates the propellant database 58 | :param key: the old propellant's name 59 | :param new_prop: the new propellant, to replace old_prop 60 | """ 61 | self.propellants[key] = new_prop 62 | self.propellant_edited.emit(key) 63 | 64 | 65 | -------------------------------------------------------------------------------- /openburn/application/settings.py: -------------------------------------------------------------------------------- 1 | import jsonpickle 2 | 3 | from qtpy.QtCore import QObject, Signal 4 | 5 | 6 | class OpenBurnSettings: 7 | DEFAULT_UNITS = { 8 | 'length_units': 'inch', 9 | 'mass_units': 'lbs', 10 | 'temperature_units' : 'degF', 11 | 'pressure_units': 'psi', 12 | 'force_units': 'newton', # why are amateur rocketry units in the USA so inconsistent..? 13 | 'velocity_units': 'feet_per_second', 14 | 'density_units': 'lb_per_cubic_inch', 15 | 'burn_rate_units': 'inch_per_second', 16 | 'mass_flux_units': 'lb_per_sec_per_sq_in' 17 | } 18 | 19 | def __init__(self): 20 | # base settings: 21 | self.redraw_on_changes = True 22 | self.unit_settings = self.DEFAULT_UNITS 23 | 24 | 25 | class SettingsDatabase(QObject): 26 | settings_changed = Signal() 27 | 28 | def __init__(self, filename: str = None): 29 | super(SettingsDatabase, self).__init__() 30 | self.settings = OpenBurnSettings() # default settings 31 | self.settings_filename = filename 32 | if self.settings_filename is not None: 33 | self.load_settings(filename) 34 | 35 | def load_settings(self, filename: str): 36 | with open(filename, 'r') as f: 37 | data = f.read() 38 | if len(data) > 0: 39 | self.settings = jsonpickle.decode(data) 40 | self.settings_changed.emit() 41 | self.settings_filename = filename 42 | 43 | def save_settings(self): 44 | with open(self.settings_filename, 'w+') as f: 45 | jsonpickle.set_encoder_options('json', sort_keys=True, indent=4) 46 | f.write(jsonpickle.encode(self.settings)) 47 | 48 | def default_settings(self): 49 | self.settings = OpenBurnSettings() 50 | self.settings_changed.emit() 51 | -------------------------------------------------------------------------------- /openburn/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuxxi/OpenBurn/9c08574c333df026cf0a7217d37a990b1d11f841/openburn/core/__init__.py -------------------------------------------------------------------------------- /openburn/core/grain.py: -------------------------------------------------------------------------------- 1 | from abc import abstractmethod 2 | from math import pi 3 | 4 | from openburn.core.propellant import OpenBurnPropellant 5 | from openburn.object import OpenBurnObject 6 | 7 | 8 | class OpenBurnGrain(OpenBurnObject): 9 | """Base class of all propellant segments. 10 | The segment is cylindrical with a 2D port shape extruded through the entire length. 11 | """ 12 | def __init__(self, diameter: float, length: float, burning_faces: float, 13 | propellant: OpenBurnPropellant = None): 14 | 15 | super(OpenBurnGrain, self).__init__() 16 | # all lengths in inches 17 | self.diameter: float = diameter 18 | self.length: float = length 19 | self.burning_faces: float = burning_faces 20 | self.propellant: OpenBurnPropellant = propellant 21 | 22 | self.burn_rate = 0 # state variable. ew. 23 | 24 | def get_volume(self) -> float: 25 | """ 26 | Calculates the volume of the grain 27 | :return: volume of the grain in in^3 28 | """ 29 | grain_volume = (self.diameter / 2) ** 2 * pi * self.length 30 | port_volume = self.get_port_area() * self.length 31 | return grain_volume - port_volume 32 | 33 | @abstractmethod 34 | def get_burning_area(self) -> float: 35 | """ 36 | get the uninhibited burning area 37 | :return: burning surface area in in^2 38 | """ 39 | 40 | @abstractmethod 41 | def get_upstream_burning_area(self, x_val:float) -> float: 42 | """ 43 | get the uninhibited burning area upstream of x_val 44 | :param x_val: 45 | :return: burning surface area in in^2 46 | """ 47 | 48 | @abstractmethod 49 | def burn(self, burnrate: float, time_step: float) -> bool: 50 | """Regress the grain by the given amount 51 | :param burnrate: the burn rate in inches / second 52 | :param time_step: how much time will pass 53 | :returns True if burn was successful and False if grain is burned out. 54 | """ 55 | 56 | @abstractmethod 57 | def get_port_area(self) -> float: 58 | """ 59 | returns the area of the grain port 60 | :returns port area in in^2 61 | """ 62 | 63 | @abstractmethod 64 | def is_burned_out(self) -> bool: 65 | """ 66 | Is the grain burned out? 67 | :return: true if it is burned out, false if not 68 | """ 69 | 70 | 71 | class CylindricalCoreGrain(OpenBurnGrain): 72 | """A cylindrical core BATES grain""" 73 | def __init__(self, diameter: float, length: float, burning_faces: float, 74 | core_diameter: float, propellant: OpenBurnPropellant = None): 75 | """ 76 | :param diameter: the grain's diameter, in inches 77 | :param length: the grain's length, in inches 78 | :param burning_faces: # of faces burning. two is typical, if both are inhibited, this number is 0 79 | :param core_diameter: diameter of the grain's cylindrical core, in inches 80 | :param propellant: an OpenBurnPropellant object 81 | """ 82 | super(CylindricalCoreGrain, self).__init__(diameter, length, burning_faces, propellant) 83 | self.core_diameter: float = core_diameter 84 | 85 | def burn(self, burnrate: float, time_step: float) -> bool: 86 | if self.is_burned_out(): 87 | return False 88 | self.burn_rate = burnrate 89 | 90 | burn_dist = burnrate * time_step 91 | self.core_diameter += 2 * burn_dist 92 | self.length -= self.burning_faces * burn_dist 93 | return True 94 | 95 | def get_port_area(self) -> float: 96 | return (self.core_diameter / 2) ** 2 * pi 97 | 98 | def get_burning_area(self): 99 | core_area = pi * self.core_diameter * self.length 100 | face_area = 1/4*pi * (self.diameter**2 - self.core_diameter**2) 101 | return core_area + self.burning_faces * face_area 102 | 103 | def get_upstream_burning_area(self, x_val:float): 104 | if x_val > self.length: 105 | return 0 106 | else: 107 | faces = self.burning_faces > 1 108 | core_area = pi * self.core_diameter * (self.length - x_val) 109 | face_area = 1/4 * pi * (self.diameter ** 2 - self.core_diameter ** 2) 110 | return core_area + face_area * int(faces) 111 | 112 | def is_burned_out(self): 113 | return self.core_diameter >= self.diameter 114 | -------------------------------------------------------------------------------- /openburn/core/internalballistics.py: -------------------------------------------------------------------------------- 1 | from copy import deepcopy 2 | from math import sqrt 3 | from statistics import mean 4 | 5 | # from qtpy.QtCore import QObject, Signal, Slot 6 | 7 | from openburn.core.motor import OpenBurnMotor 8 | from openburn.core.grain import OpenBurnGrain 9 | 10 | from openburn.util.units import convert_magnitude 11 | 12 | MAX_SIM_TIME = 50 # maximum simulation time in seconds before failing sim 13 | 14 | 15 | class SimSettings: 16 | """Params that control how the InternalBallisticsSim runs""" 17 | def __init__(self, pres: float = 14.7, temp: float = 70.0, 18 | twophase: float = 0.85, skinfric: float = 0.98, timestep: float = 0.01): 19 | """ 20 | :param pres: ambient pressure, in psi 21 | :param temp: ambient temperature, in deg F. 22 | :param twophase: fraction of combustion that is gaseous. 23 | BurnSim assumes 85% (0.85) by default. 24 | :param skinfric: total efficiency of the nozzle expansion, when accounting for losses to skin friction 25 | 0.97 to 0.98 is typical for this value 26 | :param timestep: discrete time step for simulation. defaults to 0.01 seconds 27 | """ 28 | self.ambient_pressure: float = pres 29 | self.ambient_temp: float = temp 30 | self.two_phase_flow_eff: float = twophase 31 | self.skin_friction_eff: float = skinfric 32 | self.time_step: float = timestep 33 | 34 | 35 | class SimDataPoint: 36 | """Simulation data at a given discrete time step""" 37 | def __init__(self): 38 | self.motor: OpenBurnMotor = None 39 | self.pressure: float = 0 40 | self.mass_flux: float = 0 41 | self.thrust: float = 0 42 | self.isp: float = 0 43 | self.kn: float = 0 44 | 45 | self.burn_rate: float = 0 46 | self.time_stamp: float = 0 47 | 48 | 49 | class SimResults: 50 | """The results of running an InternalBallisticsSim""" 51 | def __init__(self, data_points, burn_time, total_impulse): 52 | self.data = data_points 53 | self.burn_time = burn_time 54 | self.total_impulse = total_impulse 55 | 56 | def get_burn_time(self): 57 | return self.burn_time 58 | 59 | def get_total_impulse(self): 60 | return self.total_impulse 61 | 62 | def get_max_presure(self): 63 | return max(x.pressure for x in self.data) 64 | 65 | def get_max_thrust(self): 66 | return max(x.thrust for x in self.data) 67 | 68 | def get_max_isp(self): 69 | return max(x.isp for x in self.data) 70 | 71 | def get_max_mass_flux(self): 72 | return max(x.mass_flux for x in self.data) 73 | 74 | def get_avg_thrust(self): 75 | return mean(x.thrust for x in self.data) 76 | 77 | def get_avg_isp(self): 78 | return mean(x.isp for x in self.data) 79 | 80 | def get_kn_range(self): 81 | """Returns a tuple of the kn range (min, max)""" 82 | min_ = min(x.kn for x in self.data) 83 | max_ = max(x.kn for x in self.data) 84 | return min_, max_ 85 | 86 | 87 | class SimulationException(Exception): 88 | """Exception raised when the simulation encounters an error""" 89 | def __init__(self, message): 90 | super(SimulationException, self).__init__(message) 91 | 92 | 93 | class InternalBallisticsSim: 94 | """The internal ballistics simulator 95 | Calculates internal ballistics params""" 96 | 97 | def __init__(self): 98 | super(InternalBallisticsSim, self).__init__() 99 | 100 | @classmethod 101 | def run_sim(cls, motor: OpenBurnMotor, settings: SimSettings) -> "SimResults": 102 | """ 103 | Regression simulation 104 | Calculates internal ballistics regression and info 105 | :param motor: the initial motor, regressing at discrete time steps, with settings controlled by 106 | :param settings: 107 | :returns SimResults: an object that encapsulates the results of the simulation run""" 108 | 109 | iterations = 0 110 | total_burn_time = 0 111 | total_impulse = 0 112 | num_burnout = 0 113 | 114 | data = [] 115 | prev_data = None 116 | 117 | while num_burnout < motor.get_num_grains(): 118 | current_data = SimDataPoint() 119 | 120 | # clone motor data for initial condition 121 | if iterations == 0: 122 | current_data.motor = deepcopy(motor) 123 | else: 124 | current_data.motor = deepcopy(prev_data.motor) 125 | 126 | current_motor = current_data.motor 127 | 128 | # regression simulation for each grain 129 | for grain in current_motor.grains: 130 | burnrate = cls.calc_steady_state_burn_rate(current_motor, grain, settings) 131 | current_data.burn_rate = burnrate 132 | 133 | grain.burn(burnrate, settings.time_step) 134 | 135 | if grain.is_burned_out(): 136 | num_burnout += 1 137 | 138 | # set simulation data for this time step after regression 139 | current_data.pressure = cls.calc_chamber_pressure(current_motor, settings) 140 | current_data.time = total_burn_time 141 | current_data.thrust = cls.calc_thrust(current_motor, settings) 142 | current_data.mass_flux = cls.calc_mass_flux(current_motor, current_motor.get_length()) 143 | current_data.isp = cls.calc_isp(current_motor, settings) 144 | current_data.kn = current_motor.get_kn() 145 | 146 | # add data to results 147 | data.append(current_data) 148 | 149 | # update motor info 150 | total_impulse += current_data.thrust * settings.time_step 151 | total_burn_time += settings.time_step 152 | 153 | # set up for next iteration 154 | iterations += 1 155 | prev_data = current_data 156 | 157 | # fallback failure state: MAX_SIM_TIME second burn time 158 | if total_burn_time > MAX_SIM_TIME: 159 | raise SimulationException(f"Error! Simulation exceeded {MAX_SIM_TIME} seconds.") 160 | 161 | results = SimResults(data_points=data, total_impulse=total_impulse, burn_time=total_burn_time) 162 | return results 163 | 164 | @classmethod 165 | def calc_thrust(cls, motor: OpenBurnMotor, settings: SimSettings) -> float: 166 | """ 167 | Calculates the actual thrust using empirical inefficiency factors, 168 | then applys that Cf to the throat area and pressure to give the real thrust value 169 | :param motor: the motor to calculate thrust for 170 | :param settings: inefficiency fudge factors 171 | :return: thrust in lbs 172 | 173 | http://www.dtic.mil/dtic/tr/fulltext/u2/a099791.pdf 174 | Cf_real = Nd * Nt * (Nf * Cf_v + (1 - nf)) 175 | where: 176 | Nd is divergence loss ratio 177 | Nt is two phase flow loss ratio 178 | Nf is skin friction loss ratio 179 | Cv_f is ideal thrust coeff. 180 | """ 181 | nozzle = motor.nozzle 182 | 183 | Pc = cls.calc_chamber_pressure(motor, settings) 184 | Cf_v = cls.calc_ideal_thrust_coeff(motor, settings, Pc) 185 | 186 | Nd = nozzle.get_divergence_loss() 187 | 188 | Nt = settings.two_phase_flow_eff 189 | # Nt = 1 # two phase flow losses already accounted for in the chamber pressure 190 | Nf = settings.skin_friction_eff 191 | 192 | Cf_real = Nd * Nt * (Nf * Cf_v + (1 - Nf)) 193 | 194 | # thrust = Cf * At * Pc 195 | return Cf_real * nozzle.get_throat_area() * Pc 196 | 197 | @classmethod 198 | def calc_ideal_thrust_coeff(cls, motor: OpenBurnMotor, settings: SimSettings, chamber_pressure: float) -> float: 199 | """ 200 | Calculates the ideal thrust coefficient at a given chamber pressure using 201 | the isentropic flow equations 202 | :param motor: 203 | :param settings: 204 | :param chamber_pressure: 205 | :return: Cf_v, the ideal thrust coefficient 206 | 207 | Cf = sqrt [ (2k^2 / k-1) (2/k+1 )^k+1k-1 * 1- (P2/P1)^(k-1/k) )] + (p2-p3)A2 / Pc 208 | See Rocket Propulsion Elements, Eq. 3-29 209 | """ 210 | # simplify terms involving k (gamma) 211 | k = motor.avg_propellant.gamma 212 | k_square = (2 * k**2) / (k - 1) 213 | two_over_k = 2 / (k + 1) 214 | k_over_k = (k + 1) / (k - 1) 215 | k_minus_1 = (k - 1) / k 216 | 217 | # set up other variables 218 | exp_ratio = motor.nozzle.get_expansion_ratio() 219 | exit_pressure = cls.calc_exit_pressure(motor, chamber_pressure) 220 | pressure_ratio = exit_pressure / chamber_pressure 221 | 222 | momentum_thrust = sqrt(k_square * two_over_k ** k_over_k * (1 - (pressure_ratio ** k_minus_1))) 223 | pressure_thrust = ((exit_pressure - settings.ambient_pressure) * exp_ratio) / chamber_pressure 224 | return momentum_thrust + pressure_thrust 225 | 226 | @classmethod 227 | def calc_exit_pressure(cls, motor: OpenBurnMotor, chamber_pressure: float) -> float: 228 | """ 229 | Calculates nozzle exit pressure using the exit mach number 230 | :param motor: the motor 231 | :param chamber_pressure: current chamber pressure 232 | :return: nozzle exit pressure, in lbs/in^3 233 | """ 234 | gamma = motor.avg_propellant.gamma 235 | 236 | # find exit mach number 237 | exit_mach = cls.calc_exit_mach(motor) 238 | 239 | # calculate the ratio of pressures Pc/Pe 240 | pressure_ratio = (1 + 0.5*(gamma - 1) * exit_mach**2) ** (-gamma / (gamma - 1)) 241 | # multiply by Pc to get Pe alone 242 | return chamber_pressure * pressure_ratio 243 | 244 | @classmethod 245 | def calc_exit_mach(cls, motor: OpenBurnMotor) -> float: 246 | """ 247 | Calculates the exit mach number from the nozzle area ratio and gamma. 248 | Numerically solves the isentropic flow equation for exit mach number 249 | :param motor: the motor 250 | :return: the exit mach number 251 | see https://www.grc.nasa.gov/www/k-12/airplane/rktthsum.html 252 | """ 253 | if motor.nozzle.exit_dia <= motor.nozzle.throat_dia: 254 | return 1.0 # sonic nozzle has a mach number of 1 by definition 255 | 256 | mach_number = 2.2 # init with some arbitrary supersonic mach number 257 | gamma = motor.avg_propellant.gamma 258 | area_ratio = motor.nozzle.get_expansion_ratio() 259 | gp1 = gamma + 1 260 | gm1 = gamma - 1 261 | exponent = gp1 / (2 * gm1) 262 | 263 | # initial guesses 264 | guess_area_ratio = area_ratio / 2 265 | # init guess as a tiny bit different so we don't divide by zero when finding the change 266 | guess_mach = mach_number + 0.05 267 | 268 | # newton's method 269 | while abs(area_ratio - guess_area_ratio) > 0.0001: 270 | # find area ratio using our guesses 271 | base = 1 + 0.5 * gm1 * guess_mach**2 272 | new_area_ratio = 1 / (guess_mach * base ** -exponent * (gp1 / 2) ** exponent) 273 | 274 | # find change (derivative) 275 | deriv = (new_area_ratio - guess_area_ratio) / (guess_mach - mach_number) 276 | 277 | # update guesses 278 | guess_area_ratio = new_area_ratio 279 | mach_number = guess_mach 280 | 281 | # update mach 282 | guess_mach = mach_number + (area_ratio - guess_area_ratio) / deriv 283 | 284 | return mach_number 285 | 286 | @classmethod 287 | def calc_chamber_pressure(cls, motor: OpenBurnMotor, settings: SimSettings) -> float: 288 | """ 289 | Calculates chamber pressure assuming a steady-state chamber 290 | p = (Kn * a * rho * C* )^(1/(1-n)) 291 | see Rocket Propulsion Elements, Eq. ?? 292 | 293 | :param motor: 294 | :param settings: controls two phase flow efficacy which affects C* 295 | :return: steady-state chamber pressure, in lbs/in^3 296 | """ 297 | rho_slugs = convert_magnitude(motor.avg_propellant.rho, 'lb_per_in3', 'slug_per_in3') 298 | 299 | cstar = motor.avg_propellant.cstar # * settings.two_phase_flow_eff 300 | exp = 1 / (1 - motor.avg_propellant.n) 301 | 302 | base = motor.get_kn() * motor.avg_propellant.a * rho_slugs * cstar 303 | return base ** exp 304 | 305 | @classmethod 306 | def calc_steady_state_burn_rate(cls, motor: OpenBurnMotor, grain: OpenBurnGrain, settings: SimSettings) -> float: 307 | """ 308 | Calculates the steady-state burn rate for a given grain 309 | 310 | :param motor: 311 | :param grain: 312 | :param settings: controls two phase flow eff 313 | :return: steady state burn rate (R_0) in inches/second 314 | """ 315 | prop = grain.propellant 316 | Pc = cls.calc_chamber_pressure(motor, settings) 317 | return prop.a * Pc ** prop.n 318 | 319 | @classmethod 320 | def calc_isp(cls, motor: OpenBurnMotor, settings: SimSettings) -> float: 321 | """ 322 | Calculates Isp given a motor 323 | Isp = F / mdot * g 324 | :param settings: 325 | :param motor: 326 | :return: Isp in seconds 327 | """ 328 | return cls.calc_thrust(motor, settings) / motor.get_mass_flow() 329 | 330 | @classmethod 331 | def calc_mass_flux(cls, motor: OpenBurnMotor, x_val: float) -> float: 332 | """ 333 | Calculates the mass flux at the given x coordinate 334 | :param x_val: x value of the point to find mass flux, 335 | where x = 0 is at the head end and x = len is the end of the propellant surface. 336 | 337 | :param motor: 338 | :return: Mass flux in lbs/sec/in^2 339 | """ 340 | grain = motor.get_grain_at_x(x_val) 341 | if grain: 342 | return motor.get_upstream_mass_flow(x_val) / grain.get_port_area() 343 | 344 | raise Exception(f"Grain not found at x value: {x_val}") 345 | -------------------------------------------------------------------------------- /openburn/core/motor.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | from statistics import mean 3 | from math import ceil 4 | 5 | from openburn.core.grain import OpenBurnGrain 6 | from openburn.core.nozzle import OpenBurnNozzle 7 | from openburn.core.propellant import SimplePropellant 8 | 9 | from openburn.object import OpenBurnObject 10 | 11 | 12 | class OpenBurnMotor(OpenBurnObject): 13 | def __init__(self) -> None: 14 | super(OpenBurnMotor, self).__init__() 15 | self.grains: List[OpenBurnGrain] = [] 16 | self.nozzle: OpenBurnNozzle = None 17 | self.avg_propellant = None 18 | 19 | def add_grain(self, grain: OpenBurnGrain) -> None: 20 | self.grains.append(grain) 21 | 22 | def set_grains(self, grains: List[OpenBurnGrain]) -> None: 23 | self.grains = grains 24 | self.avg_propellant = self.calc_avg_propellant() 25 | 26 | def set_nozzle(self, nozzle: OpenBurnNozzle) -> None: 27 | self.nozzle = nozzle 28 | 29 | def calc_avg_propellant(self) -> "SimplePropellant": 30 | """ 31 | approximation time!! The average propellant is just the aesthetic mean of all the 32 | individual propellant params 33 | :return: 34 | """ 35 | a = mean(grain.propellant.a for grain in self.grains) 36 | n = mean(grain.propellant.n for grain in self.grains) 37 | cstar = mean(grain.propellant.cstar for grain in self.grains) 38 | rho = mean(grain.propellant.rho for grain in self.grains) 39 | gamma = mean(grain.propellant.gamma for grain in self.grains) 40 | return SimplePropellant("AVG:" + str(self.uuid), a, n, cstar, rho, gamma) 41 | 42 | def get_num_grains(self) -> float: 43 | return len(self.grains) 44 | 45 | def get_length(self) -> float: 46 | """ 47 | :return: propellant length, in inches 48 | """ 49 | return sum(x.length for x in self.grains) 50 | 51 | def get_diameter(self): 52 | """ 53 | :return: maximum grain diameter of the motor, in inches 54 | """ 55 | return max(x.diameter for x in self.grains) 56 | 57 | def get_propellant_mass(self) -> float: 58 | """ 59 | :return Propellant mass, in lbs 60 | """ 61 | return sum(x.get_volume() * x.propellant.rho for x in self.grains) 62 | 63 | def get_port_throat_ratio(self) -> float: 64 | """ 65 | :return: Ratio of bottom grain port area to nozzle throat area, dimensionless 66 | """ 67 | return self.grains[-1].get_port_area() / self.nozzle.get_throat_area() 68 | 69 | def get_volume_loading(self) -> float: 70 | """ 71 | :return: Ratio of propellant volume to chamber volume, dimensionless 72 | """ 73 | propellant_volume = sum(x.get_volume() for x in self.grains) 74 | chamber_volume = (self.get_diameter() / 2) ** 2 * self.get_length() 75 | return propellant_volume / chamber_volume 76 | 77 | def get_upstream_mass_flow(self, x_val: float) -> float: 78 | """ 79 | Calculate how much mass flow is occurring upstream of this given x coordinate 80 | :param x_val: x value of the point to find mass flux, 81 | where x = 0 is at the head end and x = len is the end of the propellant surface. 82 | :returns mass flow, in lb/sec 83 | """ 84 | x = 0 85 | mass_flow = 0 86 | for grain in self.grains: 87 | len_ = grain.length 88 | if x <= x_val: 89 | pass 90 | if ceil(x) < ceil(x_val - len_): 91 | burning_surface = grain.get_burning_area() 92 | else: 93 | burning_surface = grain.get_upstream_burning_area(x + len_ - x_val) 94 | mass_flow += burning_surface * grain.propellant.rho * grain.burn_rate 95 | 96 | x += len_ 97 | 98 | return mass_flow 99 | 100 | def get_mass_flow(self) -> float: 101 | """ 102 | Calculate total mass flow out of the nozzle 103 | :return: mass flow in lb/sec 104 | """ 105 | return sum( 106 | grain.get_burning_area() * 107 | grain.propellant.rho * 108 | grain.burn_rate 109 | for grain in self.grains) 110 | 111 | def get_grain_at_x(self, x_val: float) -> "OpenBurnGrain" or None: 112 | """ 113 | Returns the grain found at the given x -val in the motor 114 | :param x_val: x value of the point to find mass flux, 115 | where x = 0 is at the head end and x = len is the end of the propellant surface. 116 | :return: the grain if found, otherwise None 117 | """ 118 | x = 0 119 | for grain in self.grains: 120 | x += grain.length 121 | if x >= x_val: 122 | return grain 123 | 124 | return None 125 | 126 | def get_burning_area(self) -> float: 127 | """ 128 | Sum of all burning surface area in the motor 129 | :return: burning area, in in^2 130 | """ 131 | return sum(x.get_burning_area() for x in self.grains) 132 | 133 | def get_kn(self) -> float: 134 | """ 135 | Kn (ratio of burning surface area to nozzle area) 136 | :return: 137 | """ 138 | return self.get_burning_area() / self.nozzle.get_throat_area() 139 | -------------------------------------------------------------------------------- /openburn/core/nozzle.py: -------------------------------------------------------------------------------- 1 | from math import pi, cos, radians 2 | 3 | from abc import abstractmethod 4 | from openburn.object import OpenBurnObject 5 | 6 | 7 | class OpenBurnNozzle(OpenBurnObject): 8 | """Base class of all nozzles""" 9 | def __init__(self, throat: float, exit: float): 10 | super(OpenBurnNozzle, self).__init__() 11 | self.throat_dia: float = throat 12 | self.exit_dia: float = exit 13 | 14 | def get_expansion_ratio(self) -> float: 15 | return self.get_exit_area() / self.get_throat_area() 16 | 17 | def get_throat_area(self) -> float: 18 | return 1/4 * pi * self.throat_dia ** 2 19 | 20 | def get_exit_area(self) -> float: 21 | return 1/4 * pi * self.exit_dia ** 2 22 | 23 | @abstractmethod 24 | def get_divergence_loss(self) -> float: 25 | """Get the ratio of efficiency losses due to the shape of the the nozzle divergent section 26 | :returns float between 0 and 1""" 27 | 28 | 29 | class ConicalNozzle(OpenBurnNozzle): 30 | """A conical nozzle with a straight cut throat""" 31 | def __init__(self, throat: float, exit: float, half_angle: float, throat_len: float): 32 | """ 33 | :param throat: the diameter of the nozzle throat, in inches 34 | :param exit: diameter of the nozzle expansion exit, in inches 35 | :param half_angle: half angle of the conical expansion section. 15 degrees is typical 36 | :param throat_len: length of the straight-cut throat. 37 | NOTE: this parameter does not do anything currently. 38 | """ 39 | super(ConicalNozzle, self).__init__(throat, exit) 40 | self.half_angle = half_angle 41 | self.throat_len = throat_len 42 | 43 | def get_divergence_loss(self) -> float: 44 | """ 45 | Get the ratio of efficiency losses due to the shape of the the nozzle divergent section 46 | //http://rasaero.com/dloads/Departures%20from%20Ideal%20Performance.pdf 47 | :return: float between 0 and 1 48 | """ 49 | return (1 + cos(radians(self.half_angle))) / 2 50 | -------------------------------------------------------------------------------- /openburn/core/propellant.py: -------------------------------------------------------------------------------- 1 | from openburn.object import OpenBurnObject 2 | 3 | 4 | class OpenBurnPropellant(OpenBurnObject): 5 | """Base class of all propellants""" 6 | def __init__(self, name: str) -> None: 7 | super(OpenBurnPropellant, self).__init__() 8 | self.name = name 9 | 10 | 11 | class SimplePropellant(OpenBurnPropellant): 12 | """Simple propellant using Saint Robert's law (r = aP^n)""" 13 | def __init__(self, name: str, a: float, n: float, cstar: float, rho: float, gamma: float = 1.25) -> None: 14 | """ 15 | :param name: The propellant's name 16 | :param a: ballistic burn rate coefficient 'a' in r=aP^n, measured in inches / second 17 | :param n: ballistic burn rate exponent 'n' in r=aP^n, dimensionless 18 | :param cstar: characteristic velocity, (C*), measured in feet/second 19 | :param rho: density of propellant, measured in lbs/in^3 20 | :param gamma: Ratio of specific heats Cp/Cv, dimensionless 21 | """ 22 | super(SimplePropellant, self).__init__(name) 23 | self.a: float = a 24 | self.n: float = n 25 | self.cstar: float = cstar 26 | self.rho: float = rho 27 | self.gamma: float = gamma 28 | 29 | 30 | class AdvancedPropellant(SimplePropellant): 31 | NotImplemented 32 | -------------------------------------------------------------------------------- /openburn/object.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | import jsonpickle 3 | from copy import deepcopy 4 | 5 | from qtpy.QtCore import QObject 6 | 7 | 8 | class OpenBurnObject(QObject): 9 | """Base class of all OpenBurn motor objects. 10 | Handles json serialization and deserialization as well as uuid creation""" 11 | def __init__(self): 12 | super(OpenBurnObject, self).__init__() 13 | self.uuid = uuid.uuid4() 14 | 15 | def __deepcopy__(self, memo): 16 | cls = self.__class__ 17 | result = cls.__new__(cls) 18 | memo[id(self)] = result 19 | for key, value in self.__dict__.items(): 20 | setattr(result, key, deepcopy(value, memo)) 21 | return result 22 | 23 | # we don't want UUID to be saved across sessions, so we implement pickle's __getstate__ and __setstate__ 24 | # and remove 'uuid' from the dict 25 | def __getstate__(self): 26 | state = self.__dict__.copy() 27 | del state['uuid'] # ignore uuid 28 | return state 29 | 30 | def __setstate__(self, state): 31 | self.__dict__.update(state) 32 | 33 | @classmethod 34 | def from_json(cls, data: str) -> 'cls': 35 | """ 36 | factory method to create an object from json data 37 | :param data: JSON string, encoded with jsonpickle 38 | :returns: cls() 39 | """ 40 | obj = jsonpickle.decode(data) 41 | obj.uuid = uuid.uuid4() # generate a new uuid 42 | return obj 43 | 44 | def to_json(self) -> str: 45 | """ 46 | recursively dumps the entire class structure into json 47 | :returns JSON string, encoded with jsonpickle 48 | """ 49 | jsonpickle.set_encoder_options('json', sort_keys=True, indent=4) 50 | return jsonpickle.encode(self) 51 | -------------------------------------------------------------------------------- /openburn/ui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuxxi/OpenBurn/9c08574c333df026cf0a7217d37a990b1d11f841/openburn/ui/__init__.py -------------------------------------------------------------------------------- /openburn/ui/designtab.py: -------------------------------------------------------------------------------- 1 | from qtpy.QtWidgets import (QVBoxLayout, QHBoxLayout, QFormLayout, 2 | QWidget, QFrame, QGroupBox, QLabel, QSizePolicy, 3 | QSplitter, QTableView, QPushButton, QToolButton, 4 | QGraphicsView, QGraphicsScene) 5 | 6 | from qtpy.QtCore import Qt, Signal, Slot 7 | 8 | from openburn.ui.dialogs.grain_dialog import NewGrainDialog 9 | 10 | 11 | class DesignTab(QWidget): 12 | def __init__(self): 13 | super(DesignTab, self).__init__() 14 | self.setup_ui() 15 | self.grain_dialog = None 16 | 17 | self.btn_new_grain.clicked.connect(self.create_grain_dialog) 18 | 19 | def create_grain_dialog(self): 20 | self.grain_dialog = NewGrainDialog() 21 | self.grain_dialog.show() 22 | self.grain_dialog.activateWindow() 23 | self.grain_dialog.raise_() 24 | 25 | def setup_ui(self): 26 | sp = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) 27 | self.setSizePolicy(sp) 28 | 29 | def setup_grain_design(): 30 | # grain table view 31 | master = QHBoxLayout(self) 32 | master.addWidget(QTableView()) 33 | 34 | # grain design controls 35 | controls = QVBoxLayout(self) 36 | # add a push button 37 | self.btn_new_grain = QPushButton(self.tr("New Grain")) 38 | self.btn_new_grain.setMinimumHeight(50) 39 | controls.addWidget(self.btn_new_grain) 40 | 41 | # add a dividing line 42 | line = QFrame() 43 | line.setFrameShape(QFrame.HLine) 44 | line.setFrameShadow(QFrame.Sunken) 45 | controls.addSpacing(5) 46 | controls.addWidget(line) 47 | 48 | # rest of the controls buttons 49 | self.btn_edit_grain = QPushButton(self.tr("Edit")) 50 | self.btn_edit_grain.setMinimumHeight(30) 51 | controls.addWidget(self.btn_edit_grain) 52 | self.btn_delete_Grain = QPushButton(self.tr("Delete")) 53 | self.btn_delete_Grain.setMinimumHeight(30) 54 | controls.addWidget(self.btn_delete_Grain) 55 | 56 | # move grain up and down 57 | moveup = QHBoxLayout() 58 | self.btn_move_up = QToolButton() 59 | self.btn_move_up.setArrowType(Qt.UpArrow) 60 | moveup.addWidget(self.btn_move_up) 61 | moveup.addWidget(QLabel(self.tr("Move Up"))) 62 | controls.addLayout(moveup) 63 | 64 | movedown = QHBoxLayout() 65 | self.btn_move_down = QToolButton() 66 | self.btn_move_down.setArrowType(Qt.DownArrow) 67 | movedown.addWidget(self.btn_move_down) 68 | movedown.addWidget(QLabel(self.tr("Move Down"))) 69 | controls.addLayout(movedown) 70 | controls.addStretch() 71 | 72 | # add info for motor design 73 | fl_propellant_info = QFormLayout() 74 | gb_motor_info = QGroupBox(self.tr("Propellant Info")) 75 | gb_motor_info.setLayout(fl_propellant_info) 76 | 77 | self.lbl_num_grains = QLabel() 78 | fl_propellant_info.addRow(QLabel(self.tr("Number of Segments:")), self.lbl_num_grains) 79 | self.lbl_motor_dia = QLabel() 80 | fl_propellant_info.addRow(QLabel(self.tr("Motor Diameter:")), self.lbl_motor_dia) 81 | self.lbl_motor_len = QLabel() 82 | fl_propellant_info.addRow(QLabel(self.tr("Propellant Length:")), self.lbl_motor_len) 83 | self.lbl_prop_mass = QLabel() 84 | fl_propellant_info.addRow(QLabel(self.tr("Propellant Mass:")), self.lbl_prop_mass) 85 | self.lbl_volume_loading = QLabel() 86 | fl_propellant_info.addRow(QLabel(self.tr("Volume Loading:")), self.lbl_volume_loading) 87 | 88 | # set group box's layout 89 | controls.addWidget(gb_motor_info) 90 | 91 | # setup master layout 92 | master.addLayout(controls) 93 | self.gb_design = QGroupBox(self.tr("Grain Design")) 94 | self.gb_design.setLayout(master) 95 | 96 | def setup_chamber_design(): 97 | # master layout 98 | master = QVBoxLayout() 99 | # master group box 100 | self.gb_chamber = QGroupBox(self.tr("Chamber Design")) 101 | 102 | # nozzle settings button 103 | self.btn_nozzle_settings = QPushButton(self.tr("Edit Nozzle")) 104 | self.btn_nozzle_settings.setMinimumHeight(50) 105 | master.addWidget(self.btn_nozzle_settings) 106 | 107 | # nozzle info pane 108 | fl_nozzle_info = QFormLayout() 109 | gb_nozzle = QGroupBox(self.tr("Nozzle Info")) 110 | gb_nozzle.setLayout(fl_nozzle_info) 111 | 112 | self.lbl_nozzle_throat = QLabel() 113 | fl_nozzle_info.addRow(QLabel(self.tr("Throat Diameter:")), self.lbl_nozzle_throat) 114 | self.lbl_nozzle_exit = QLabel() 115 | fl_nozzle_info.addRow(QLabel(self.tr("Exit Diameter:")), self.lbl_nozzle_exit) 116 | self.lbl_nozzle_expansion_ratio = QLabel() 117 | fl_nozzle_info.addRow(QLabel(self.tr("Expansion Ratio:")), self.lbl_nozzle_expansion_ratio) 118 | # add group box to master 119 | master.addWidget(gb_nozzle) 120 | master.addStretch() 121 | 122 | # overall motor info pane 123 | fl_motor_info = QFormLayout() 124 | gb_motor = QGroupBox(self.tr("Motor Info")) 125 | gb_motor.setLayout(fl_motor_info) 126 | 127 | self.lbl_kn = QLabel() 128 | fl_motor_info.addRow(QLabel(self.tr("Kn:")), self.lbl_kn) 129 | self.lbl_port_throat = QLabel() 130 | fl_motor_info.addRow(QLabel(self.tr("Port/Throat Ratio:")), self.lbl_port_throat) 131 | 132 | master.addWidget(gb_motor) 133 | self.gb_chamber.setLayout(master) 134 | 135 | def setup_gfx_ui(): 136 | # design overview 137 | self.motor_display_view = QGraphicsView() 138 | self.motor_display_scene = QGraphicsScene() 139 | self.motor_display_view.setScene(self.motor_display_scene) 140 | self.motor_display_view.show() 141 | 142 | # sliced cross section 143 | self.grain_slice_view = QGraphicsView() 144 | self.grain_slice_scene = QGraphicsScene() 145 | self.grain_slice_view.setScene(self.grain_slice_scene) 146 | self.grain_slice_view.show() 147 | 148 | # splitter 149 | self.splt_gfx = QSplitter(Qt.Horizontal) 150 | self.splt_gfx.addWidget(self.motor_display_view) 151 | self.splt_gfx.addWidget(self.grain_slice_view) 152 | self.splt_gfx.setStretchFactor(0, 10) 153 | self.splt_gfx.setStretchFactor(1, 3) 154 | self.splt_gfx.setMinimumHeight(50) 155 | 156 | setup_grain_design() 157 | setup_chamber_design() 158 | setup_gfx_ui() 159 | 160 | self.splt_grain_design = QSplitter(Qt.Horizontal) 161 | self.splt_grain_design.addWidget(self.gb_design) 162 | self.splt_grain_design.addWidget(self.gb_chamber) 163 | self.splt_grain_design.setStretchFactor(0, 10) 164 | self.splt_grain_design.setStretchFactor(1, 3) 165 | 166 | self.splt_main = QSplitter(Qt.Vertical) 167 | self.splt_main.addWidget(self.splt_grain_design) 168 | self.splt_main.addWidget(self.splt_gfx) 169 | self.splt_main.setSizes([300, 150]) 170 | 171 | layout = QVBoxLayout() 172 | layout.addWidget(self.splt_main) 173 | self.setLayout(layout) -------------------------------------------------------------------------------- /openburn/ui/dialogs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuxxi/OpenBurn/9c08574c333df026cf0a7217d37a990b1d11f841/openburn/ui/dialogs/__init__.py -------------------------------------------------------------------------------- /openburn/ui/dialogs/about.py: -------------------------------------------------------------------------------- 1 | from qtpy.QtCore import Qt 2 | from qtpy.QtWidgets import QDialog, QLabel, QVBoxLayout, QSpacerItem 3 | 4 | import openburn as ob 5 | 6 | 7 | class AboutDialog(QDialog): 8 | """Create the necessary elements to show helpful text in a dialog.""" 9 | 10 | def __init__(self, parent=None): 11 | """Display a dialog that shows application information.""" 12 | super(AboutDialog, self).__init__(parent) 13 | 14 | self.setWindowTitle('About') 15 | self.resize(175, 100) 16 | self.layout = QVBoxLayout() 17 | 18 | title = QLabel('OpenBurn') 19 | title.setStyleSheet("font-weight: bold;") 20 | title.setAlignment(Qt.AlignCenter) 21 | self.layout.addWidget(title) 22 | 23 | version = QLabel('Version ' + ob.__version__) 24 | self.layout.addWidget(version) 25 | 26 | github = QLabel('GitHub') 27 | github.setTextFormat(Qt.RichText) 28 | github.setTextInteractionFlags(Qt.TextBrowserInteraction) 29 | github.setOpenExternalLinks(True) 30 | self.layout.addWidget(github) 31 | 32 | # author 33 | self.layout.addSpacerItem(QSpacerItem(10, 10)) 34 | auth = QLabel(self.tr("Author:")) 35 | auth.setStyleSheet("font-weight: bold;") 36 | auth.setAlignment(Qt.AlignCenter) 37 | self.layout.addWidget(auth) 38 | 39 | author = f"{ob.__author__}: {ob.__author_email__}" 40 | self.layout.addWidget(QLabel(author)) 41 | 42 | # special thanks 43 | self.layout.addSpacerItem(QSpacerItem(10, 10)) 44 | thx = QLabel("Special Thanks:") 45 | thx.setStyleSheet("font-weight: bold;") 46 | thx.setAlignment(Qt.AlignCenter) 47 | self.layout.addWidget(thx) 48 | for thanks in ob.__special_thanks__: 49 | self.layout.addWidget(QLabel(thanks)) 50 | 51 | self.setLayout(self.layout) 52 | -------------------------------------------------------------------------------- /openburn/ui/dialogs/grain_dialog.py: -------------------------------------------------------------------------------- 1 | from qtpy.QtWidgets import (QDialog, QGroupBox, QGridLayout, QHBoxLayout, QVBoxLayout, QFrame, 2 | QComboBox, QLabel, QPushButton) 3 | from qtpy.QtGui import QIcon 4 | 5 | from openburn.application import app_context 6 | from openburn import RESOURCE_PATH 7 | 8 | 9 | class NewGrainDialog(QDialog): 10 | def __init__(self): 11 | super(NewGrainDialog, self).__init__() 12 | self.setup_ui() 13 | 14 | def setup_ui(self): 15 | self.setWindowTitle("Add New Grain") 16 | self.setWindowIcon(QIcon(RESOURCE_PATH + "icons/nakka-finocyl.gif")) 17 | 18 | self.resize(400, 400) 19 | 20 | controls = QGridLayout() 21 | gb_frame = QGroupBox(self.tr("Grain Design")) 22 | gb_frame.setLayout(controls) 23 | 24 | self.cb_grain_type = QComboBox() 25 | 26 | # TODO: make grain types auto propagate combobox 27 | self.cb_grain_type.addItems([self.tr("Cylindrical (BATES)")]) 28 | controls.addWidget(QLabel(self.tr("Core Shape")), 0, 0) 29 | controls.addWidget(self.cb_grain_type, 0, 1) 30 | 31 | self.cb_propellant_type = QComboBox() 32 | self.cb_propellant_type.addItems(app_context.propellant_db.propellant_names()) 33 | controls.addWidget(QLabel(self.tr("Propellant Type")), 1, 0) 34 | controls.addWidget(self.cb_propellant_type, 1, 1) 35 | 36 | # ok and cancel buttons 37 | btn_ok = QPushButton(self.tr("Apply")) 38 | btn_ok.clicked.connect(self.confirm_grain) 39 | btn_cancel = QPushButton(self.tr("Close")) 40 | btn_cancel.clicked.connect(self.close) 41 | 42 | lay_btns = QHBoxLayout() 43 | lay_btns.addWidget(btn_ok) 44 | lay_btns.addWidget(btn_cancel) 45 | frame_btns = QFrame() 46 | frame_btns.setLayout(lay_btns) 47 | 48 | # master layout 49 | master = QVBoxLayout() 50 | master.addWidget(gb_frame) 51 | master.addSpacing(10) 52 | master.addWidget(frame_btns) 53 | self.setLayout(master) 54 | 55 | def confirm_grain(self): 56 | # grain = OpenBurnGrain.from_widget_factory(...) 57 | pass 58 | -------------------------------------------------------------------------------- /openburn/ui/mainwindow.py: -------------------------------------------------------------------------------- 1 | from qtpy.QtWidgets import (QWidget, QFrame, QMainWindow, QMenuBar, QStatusBar, QAction, QApplication, 2 | QTabWidget, QVBoxLayout) 3 | 4 | from qtpy.QtGui import QIcon 5 | 6 | from openburn import RESOURCE_PATH 7 | from openburn.ui.dialogs.about import AboutDialog 8 | from openburn.ui.designtab import DesignTab 9 | 10 | 11 | class MainWindow(QMainWindow): 12 | """OpenBurn's main window""" 13 | title = "OpenBurn" 14 | 15 | def __init__(self): 16 | super(MainWindow, self).__init__() 17 | self.setWindowTitle(self.title) 18 | self.setGeometry(100, 100, 800, 600) 19 | self.setWindowIcon(QIcon(RESOURCE_PATH + "icons/nakka-finocyl.gif")) 20 | 21 | self.create_default_widgets() 22 | self.setup_ui() 23 | 24 | def create_default_widgets(self): 25 | """Creates static widgets such as menubar and statusbar""" 26 | 27 | def create_menubar(): 28 | """Create menu bar and populate it with sub menu actions""" 29 | 30 | def file_menu(): 31 | 32 | """Create a file submenu""" 33 | self.file_sub_menu = self.menubar.addMenu('File') 34 | 35 | self.open_action = QAction('Open File', self) 36 | self.open_action.setStatusTip('Open a new design') 37 | self.open_action.setShortcut('CTRL+O') 38 | # self.open_action.triggered.connect(self.open_file) 39 | 40 | self.exit_action = QAction('Exit', self) 41 | self.exit_action.setStatusTip('Exit the application.') 42 | self.exit_action.setShortcut('CTRL+Q') 43 | self.exit_action.triggered.connect(QApplication.quit) 44 | 45 | self.file_sub_menu.addAction(self.open_action) 46 | self.file_sub_menu.addAction(self.exit_action) 47 | 48 | def edit_menu(): 49 | self.edit_dub_menu = self.menubar.addMenu('Edit') 50 | 51 | def tools_menu(): 52 | self.edit_dub_menu = self.menubar.addMenu('Tools') 53 | 54 | def help_menu(): 55 | """Create help submenu""" 56 | self.help_sub_menu = self.menubar.addMenu('Help') 57 | self.about_action = QAction('About', self) 58 | self.about_action.setStatusTip('About the application.') 59 | self.about_action.setShortcut('CTRL+H') 60 | self.about_action.triggered.connect(self.about_dialog.exec_) 61 | self.help_sub_menu.addAction(self.about_action) 62 | 63 | self.menubar = QMenuBar(self) 64 | file_menu() 65 | edit_menu() 66 | tools_menu() 67 | help_menu() 68 | 69 | def create_statusbar(): 70 | self.statusbar = QStatusBar(self) 71 | self.statusbar.showMessage("Ready", 0) 72 | 73 | self.about_dialog = AboutDialog(self) 74 | 75 | create_menubar() 76 | self.setMenuBar(self.menubar) 77 | 78 | create_statusbar() 79 | self.setStatusBar(self.statusbar) 80 | 81 | def setup_ui(self): 82 | """setup the tab widget UI""" 83 | self.tab_widget = QTabWidget() 84 | self.tab_widget.addTab(DesignTab(), "Design") 85 | self.tab_widget.addTab(QWidget(), "Simulation") 86 | self.tab_widget.addTab(QWidget(), "Propellants") 87 | 88 | self.layout = QVBoxLayout() 89 | self.layout.addWidget(self.tab_widget) 90 | self.frame = QFrame() 91 | self.frame.setLayout(self.layout) 92 | 93 | self.setCentralWidget(self.frame) 94 | -------------------------------------------------------------------------------- /openburn/ui/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuxxi/OpenBurn/9c08574c333df026cf0a7217d37a990b1d11f841/openburn/ui/models/__init__.py -------------------------------------------------------------------------------- /openburn/util/__init__.py: -------------------------------------------------------------------------------- 1 | from openburn.util.units import ureg 2 | from pint import set_application_registry 3 | 4 | set_application_registry(ureg) -------------------------------------------------------------------------------- /openburn/util/motorclass.py: -------------------------------------------------------------------------------- 1 | from math import log2 2 | 3 | 4 | def get_motor_class(nsec: float): 5 | """Calculates info about a motor given the total newton-seconds 6 | Returns a tuple of motor class letter and percent""" 7 | # motors below 'D' are special cases 8 | if nsec < 10: 9 | if nsec > 5: 10 | des = 'C' 11 | percent = 100 * (nsec / 10) 12 | elif nsec > 2.5: 13 | des = 'B' 14 | percent = 100 * (nsec / 5) 15 | elif nsec > 1.25: 16 | des = 'A' 17 | percent = 100 * (nsec / 2.5) 18 | else: 19 | des = 'N/A' 20 | percent = 0 21 | 22 | # all motors above 'D' follow powers of 2 23 | else: 24 | 25 | # Calculate the power of two associated with this ns class 26 | offset = int(log2(nsec / 10)) # truncate using int() 27 | des = chr(ord('D') + offset) 28 | 29 | # calculate the percent 30 | min_ns = 10 * 2 ** offset # minimum ns in the class range, e.g 'K' has range 1280, 2560 31 | percent = 100 * (nsec - min_ns) / min_ns 32 | 33 | return des, percent 34 | -------------------------------------------------------------------------------- /openburn/util/units.py: -------------------------------------------------------------------------------- 1 | from pint import UnitRegistry 2 | 3 | # Pint's unit registry has many units, but we need to define a few ourselves. 4 | ureg = UnitRegistry() 5 | 6 | # for some reason slugs are not a default unit (probably because slugs are ridicules and awful ) 7 | ureg.define('slug = lbf * s**2 / foot = slug') 8 | 9 | # density units 10 | ureg.define('lb_per_cubic_inch = pounds / (inch**3) = lb_per_in3') 11 | ureg.define('slug_per_cubic_inch = slug / (inch**3) = slug_per_in3') 12 | ureg.define('kg_per_cubic_meter = kilogram / (meter**3) = kg_per_m3') 13 | 14 | # velocity units 15 | ureg.define('feet_per_second = feet / second = fps') 16 | ureg.define('meters_per_second = meters / second = mps') 17 | 18 | # burn rate units 19 | ureg.define('inch_per_second = inch / second = ips') 20 | ureg.define('mm_per_second = mm / second = mmps') 21 | 22 | # mass flux units 23 | ureg.define('lb_per_sec_per_sq_in = lb / second / inch**2') 24 | ureg.define('kg_per_sec_per_sq_m = kg / second / meter**2') 25 | 26 | 27 | def convert_magnitude(val: float, from_: str, to_: str) -> float: 28 | """ 29 | Convert a magnitude to a new unit 30 | :param val: the magnitude to convert 31 | :param from_: the unit to convert from, a str defined in the pint unit registry @ureg 32 | :param to_:the unit to convert to, a str defined in the pint unit registry @ureg 33 | :return: the new magnitude, in terms of unit @to_ 34 | """ 35 | old = ureg.Quantity(val, from_) 36 | new = old.to(to_) 37 | return new.magnitude 38 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | QtPy 2 | Pint 3 | jsonpickle -------------------------------------------------------------------------------- /res/icons/nakka-finocyl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuxxi/OpenBurn/9c08574c333df026cf0a7217d37a990b1d11f841/res/icons/nakka-finocyl.gif -------------------------------------------------------------------------------- /run_tests.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | 4 | loader = unittest.TestLoader() 5 | suite = loader.discover('tests') 6 | 7 | runner = unittest.TextTestRunner() 8 | runner.run(suite) 9 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from openburn import __version__, __author__, __author_email__ 3 | 4 | with open("README.md", 'r') as f: 5 | long_description = f.read() 6 | 7 | setup( 8 | name='OpenBurn', 9 | version=__version__, 10 | description='Open source solid rocket motor internal ballistics simulation', 11 | author=__author__, 12 | author_email=__author_email__, 13 | licence='GPL3', 14 | long_description=long_description, 15 | packages=['OpenBurn'], 16 | package_dir={'OpenBurn': 'openburn'}, 17 | package_data={'OpenBurn': ['res/*']}, 18 | ) -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuxxi/OpenBurn/9c08574c333df026cf0a7217d37a990b1d11f841/tests/__init__.py -------------------------------------------------------------------------------- /tests/test_json.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from openburn.core.propellant import SimplePropellant 4 | from openburn.core.grain import CylindricalCoreGrain 5 | from openburn.core.nozzle import ConicalNozzle 6 | from openburn.core.motor import OpenBurnMotor 7 | 8 | 9 | class InternalBallisticsTest(unittest.TestCase): 10 | def setUp(self): 11 | """Set up the test data""" 12 | self.propellant = SimplePropellant("68/10", 0.0341, 0.2249, 4706, 0.058, 1.226) 13 | # using a list comprehension to create four unique grain objects 14 | self.grains = [CylindricalCoreGrain(diameter=2, length=4, core_diameter=1, burning_faces=2, 15 | propellant=self.propellant) 16 | for _ in range(0, 4)] 17 | self.nozzle = ConicalNozzle(throat=0.5, exit=2, half_angle=15, throat_len=0.25) 18 | self.motor = OpenBurnMotor() 19 | self.motor.set_grains(self.grains) 20 | self.motor.set_nozzle(self.nozzle) 21 | 22 | def test_json_in(self): 23 | out = self.motor.to_json() 24 | uuid_out = self.motor.uuid 25 | 26 | in_ = self.motor.from_json(out) 27 | uuid_in = in_.uuid 28 | self.assertIsInstance(in_, OpenBurnMotor) 29 | self.assertNotEqual(uuid_out, uuid_in) 30 | -------------------------------------------------------------------------------- /tests/test_motor_class.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from openburn.util.motorclass import get_motor_class 4 | 5 | 6 | class MotorClassTest(unittest.TestCase): 7 | def test_class(self): 8 | des, _ = get_motor_class(2500) 9 | self.assertEqual(des, 'K') 10 | 11 | des, _ = get_motor_class(1281) 12 | self.assertEqual(des, 'K') 13 | 14 | des, _ = get_motor_class(1279) 15 | self.assertEqual(des, 'J') 16 | 17 | des, _ = get_motor_class(350) 18 | self.assertEqual(des, 'I') 19 | 20 | def test_percent(self): 21 | _, percent = get_motor_class(2500) 22 | self.assertAlmostEqual(percent, 95.3125) 23 | 24 | _, percent = get_motor_class(1281) 25 | self.assertAlmostEqual(percent, 0.078125) 26 | 27 | _, percent = get_motor_class(1279) 28 | self.assertAlmostEqual(percent, 99.84375) 29 | 30 | _, percent = get_motor_class(350) 31 | self.assertAlmostEqual(percent, 9.375) 32 | 33 | def test_special(self): 34 | des, percent = get_motor_class(2) 35 | self.assertEqual(des, 'A') 36 | self.assertAlmostEqual(percent, 80) 37 | 38 | des, percent = get_motor_class(9.23) 39 | self.assertEqual(des, 'C') 40 | self.assertAlmostEqual(percent, 92.3) 41 | 42 | des, percent = get_motor_class(3.55) 43 | self.assertEqual(des, 'B') 44 | self.assertAlmostEqual(percent, 71) 45 | 46 | -------------------------------------------------------------------------------- /tests/test_propellant_db.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from openburn.core.propellant import SimplePropellant 4 | from openburn.application.propellant_db import PropellantDatabase 5 | 6 | 7 | class PropellantDatabaseTest(unittest.TestCase): 8 | def setUp(self): 9 | self.db = PropellantDatabase() 10 | self.db.add_propellant(SimplePropellant("72/10", 0.03, 0.3, 4800, 0.06, 1.25)) 11 | self.db.add_propellant(SimplePropellant("68/10", 0.03, 0.31, 4900, 0.061, 1.244)) 12 | 13 | def test_remove(self): 14 | self.db.remove_propellant("72/10") 15 | self.assertNotIn("72/10", self.db.propellants) 16 | 17 | def test_add(self): 18 | to_add = SimplePropellant("68/10", 0.0341, 0.2249, 4706, 0.058, 1.226) 19 | self.db.add_propellant(to_add) 20 | self.assertIn(to_add, self.db.propellants.values()) 21 | 22 | def test_edit(self): 23 | to_edit = SimplePropellant("70/10", 0.0341, 0.2249, 4706, 0.058, 1.226) 24 | self.db.update_propellant("68/10", to_edit) 25 | self.assertIn(to_edit, self.db.propellants.values()) 26 | -------------------------------------------------------------------------------- /tests/test_settings_db.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import jsonpickle 3 | 4 | from openburn.application.settings import SettingsDatabase 5 | 6 | 7 | class SettingsDatabaseTest(unittest.TestCase): 8 | def setUp(self): 9 | """Set up the test data""" 10 | self.db = SettingsDatabase() 11 | 12 | def test_default(self): 13 | self.db.settings.redraw_on_changes = False 14 | self.assertEqual(self.db.settings.redraw_on_changes, False) 15 | self.db.default_settings() 16 | self.assertEqual(self.db.settings.redraw_on_changes, True) 17 | -------------------------------------------------------------------------------- /tests/test_sim.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from openburn.core.internalballistics import SimSettings, InternalBallisticsSim as sim 4 | from openburn.core.propellant import SimplePropellant 5 | from openburn.core.grain import CylindricalCoreGrain 6 | from openburn.core.nozzle import ConicalNozzle 7 | from openburn.core.motor import OpenBurnMotor 8 | 9 | from openburn.util.units import convert_magnitude 10 | 11 | 12 | class InternalBallisticsTest(unittest.TestCase): 13 | def setUp(self): 14 | """Set up the test data""" 15 | self.settings = SimSettings(twophase=0.85, timestep=0.01) 16 | self.propellant = SimplePropellant("68/10", 0.0341, 0.2249, 4706, 0.058, 1.226) 17 | # using a list comprehension to create four unique grain objects 18 | self.grains = [CylindricalCoreGrain(diameter=2, length=4, core_diameter=1, burning_faces=2, 19 | propellant=self.propellant) 20 | for _ in range(0, 4)] 21 | self.nozzle = ConicalNozzle(throat=0.5, exit=2, half_angle=15, throat_len=0.25) 22 | self.motor = OpenBurnMotor() 23 | self.motor.set_grains(self.grains) 24 | self.motor.set_nozzle(self.nozzle) 25 | 26 | self.results = sim.run_sim(self.motor, self.settings) 27 | 28 | # def test_basic_sim(self): 29 | # """Outputs basic sim info""" 30 | # print("\nResults:") 31 | # print("Kn Range: ", self.results.get_kn_range()) 32 | # print("Burn Time: (s)", self.results.get_burn_time()) 33 | # print("Max Pressure: (psi)", self.results.get_max_presure()) 34 | # print("Average Isp: (s)", self.results.get_avg_isp()) 35 | # print("Max Isp: (s)", self.results.get_max_isp()) 36 | # print("Max Mass flux: (lb/sec/in^2)", self.results.get_max_mass_flux()) 37 | # 38 | # avg_thrust_lb = self.results.get_avg_thrust() 39 | # avg_thrust_n = convert_magnitude(avg_thrust_lb, 'lbf', 'newton') 40 | # print("Avg Thrust: (lbs)", avg_thrust_lb) 41 | # print("Avg Thrust: (newtons)", avg_thrust_n) 42 | # 43 | # impulse_lb = self.results.get_total_impulse() 44 | # impulse_n = convert_magnitude(impulse_lb, 'lbf', 'newton') 45 | # print("Total Impulse (lb-sec)", impulse_lb) 46 | # print("Total Impulse (newton-sec)", impulse_n) 47 | 48 | def test_kn(self): 49 | kn_low, kn_high = self.results.get_kn_range() 50 | self.assertAlmostEqual(kn_low, 350, places=-1) 51 | self.assertAlmostEqual(kn_high, 390, places=-1) 52 | -------------------------------------------------------------------------------- /user/propellants.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "py/object": "openburn.core.propellant.SimplePropellant", 4 | "py/state": { 5 | "a": 0.0341, 6 | "cstar": 4706, 7 | "gamma": 1.226, 8 | "n": 0.2249, 9 | "name": "68/10", 10 | "rho": 0.058 11 | } 12 | }, 13 | { 14 | "py/object": "openburn.core.propellant.SimplePropellant", 15 | "py/state": { 16 | "a": 0.06233, 17 | "cstar": 5050, 18 | "gamma": 1.25, 19 | "n": 0.1167, 20 | "name": "Orange Sunset", 21 | "rho": 0.059 22 | } 23 | } 24 | ] -------------------------------------------------------------------------------- /user/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "py/object": "openburn.application.settings.OpenBurnSettings", 3 | "redraw_on_changes": true, 4 | "unit_settings": { 5 | "burn_rate_units": "inch_per_second", 6 | "density_units": "lb_per_cubic_inch", 7 | "force_units": "newton", 8 | "length_units": "inch", 9 | "mass_flux_units": "lb_per_sec_per_sq_in", 10 | "mass_units": "lbs", 11 | "pressure_units": "psi", 12 | "temperature_units": "degF", 13 | "velocity_units": "feet_per_second" 14 | } 15 | } --------------------------------------------------------------------------------