Skip to content

Declarative Rocket Simulation Software ๐Ÿš€

License

Notifications You must be signed in to change notification settings

SitanHuang/DRSS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

51 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

DRSS Logo

Declarative Rocket Simulation Software

DRSS is a MATLAB Domain-Specific Language (DSL) for simulating low-altitude, subsonic rocketry.

Comparing to OpenRocket, DRSS offers much greater extensibility and ergonomics for implementing custom event handling and special components, and takes full advantages of MATLAB's mature tooling and environment. Unlike the former, users are not limited to the behaviors and capabilities of a GUI. DRSS allows users to perform optimization of not just rocket design but also flight plan parameters against any arbitrary cost function. Stage separation, parachutes, and parallel simulation of jettisioned payloads are also more ergonomic. Results generally align between DRSS and other GUI-based softwares, though aerodynamic calculations and atmospheric wind modeling may have nuanced differences.

Features

  • Declarative: An intuitive and expressive syntax to define rocket components, dynamics and scripted events.
  • Accurate Physics: Research-backed and field-tested models for rocket aerodynamics, motor thrust, and parachute dynamics.
  • Event Handling: Complex event-driven behaviors like stage separation and parachute deployment.
  • Solver-agnostic: Choose from any MATLAB's built-in ODE solvers and customize their parameters to suit your needs.
  • Modularity: Easily extend and customize simulations with object-oriented programming.

Table of Contents

Getting Started

  1. Clone the Repository

    git clone https://github.com/SitanHuang/DRSS.git
  2. Add to MATLAB Path

    addpath(genpath('path_to_DRSS'));

Note: The +VADL folder contains modules specific to the Vanderbilt Aerospace Design Laboratory and initially developed for VADL's participation in NASA's USLI competitions and can serve as examples or be extended for your own projects.

Architecture

DRSS is object-oriented and provides plug-and-play abstraction over the physical components, events and dynamics of a rocket system.

Guidance for Advanced Usage

It is ergonomical to implement custom behaviors in DRSS. Consult in-line documentation below:

Additionally, the built-in dynamics objects serve as good examples.

Core Components

  • A System is a special MassGroup that represents a 3 Degree-of-Freedom point mass that is subject to certain dynamics and holds states data in the time domain. It serves as the root container for all other components, including masses, dynamics, and events. It can be the actual rocket, a rocket stage, or a jettisioned payload.

  • The Mass class represent a one-dimensional mass span with properties such as moment of inertia, mass, length, center of gravity, and relative location measured from the tip of the parent. Masses should be sequentially appended to a MassGroup.

Events

Events are special Dynamics objects that trigger based on certain conditions, such as reaching apogee or a specific altitude. They can enable or disable other Dynamics objects and trigger other events. Custom events must implement the IEventTriggerDynamics interface. Examples:

apogeeListener = DRSS.core.dynamics.events.Apogee() ...
    .setEnabledOnInit(false);

disableAscentDynamics = DRSS.core.dynamics.events.TriggerOnEnable() ...
    .setDisableBoundDynamicsOnTrigger(true) ...
    .trigger(rocketDynamics) ...
    .trigger(apogeeListener);

apogeeListener ...
    .trigger(disableAscentDynamics) ...
    .trigger(rocketDescentDrag) ...
    .trigger(drogue);

Dynamics

A Dynamics object abstracts the various physical forces, torques and behaviors acting upon a System. Examples:

  • Parachute: Simulates the deployment and drag of parachutes during descent. Usually triggered by an altitude detection event.
drogue = DRSS.core.dynamics.Parachute() ...
    .setDiameter(15 * uc.in_to_m) ...
    .setCD(1.5) ...
    .setN(8) ...
    .setEnabledOnInit(false) ... % usually triggered by an event listener
    .setDeploymentTimeDelay(0.5) ...
    ...
  • LaunchRail: Models the launch rail mechanics and applies initial conditions to System.
launchRailDynamics = DRSS.core.dynamics.LaunchRail() ...
    .setLaunchRailAngleDeg(5) ...
    .setLaunchRailLength(12 * 12 * uc.in_to_m) ...
    .setLaunchRailButtonLoc(61 * uc.in_to_m) ...
    .setLaunchRailExitVelocityMethod( ...
        DRSS.core.dynamics.LaunchExitVelocityMethods.RAIL_BUTTON_CROSSES_RAIL_TIP) ...
    .bindToGravityDynamics(gravityDynamics) ...
    ...
  • Gravity: Models the gravitational force acting on the rocket.
gravityDynamics = DRSS.core.dynamics.Gravity() ...
    .setTerminateOnGrounding(true) ...
    .setGroundingTimeThreshold(1) ...
    ...
  • Motor: Models a rocket motor and its thrust profile.
motorDynamics = DRSS.core.dynamics.Motor( ...
    "L1400.csv", "L1400", @VADL.vadl_motor_database);
  • RocketAerodynamics: Calculates aerodynamic forces during ascent based on the rocket's geometry and atmospheric conditions.
rocketDynamics = DRSS.core.dynamics.RocketAerodynamics( ...
    'D', rocket_diameter, ...
    'L_nose', 7.5 * uc.in_to_m, ...
    ... % other parameters
).recalcTransientParameters(sys);

Full Usage Examples

Rocket Ascent to Apogee Simulation

The following script demonstrates how to simulate a rocket's ascent from launch rail to apogee, including the definition of rocket sections, dynamics, and events.

usage_example.m

Jettisoned Parachute Lander Simulation

The following script simulates the descent of a payload after jettisoning from the main rocket body.

payload_example.m

Contributing

All contributions are welcome. Simply initiate pull requests here on Github.

Note: This project is intended for educational and simulation purposes only. Always follow safety regulations and guidelines when conducting rocketry activities.

About

Declarative Rocket Simulation Software ๐Ÿš€

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published