Skip to content
Data_structure.py 2.65 KiB
Newer Older
machemak's avatar
machemak committed
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 19:51:18 2019

@author: MAC
"""

import Engineering_tools as et

class Rocket():
    """
    """
    
    def __init__(self,stage1,stage2,payload,launch_coordinates):
        """
        stage1 and stage2 are instances of the class Stage,
        payload is an instance of the class Payload,
        launch_coordiantes = {latitude(deg),logitude(deg)}
        """
        
        self.stage1 = stage1
        self.stage2 = stage2
        self.payload = payload
        self.injection_velocity = et.final_target_vel(self.payload.perigee_altitude,
                                                      self.payload.target_orbit['a'])
        self.launch_coordinates = launch_coordinates
        if self.payload.target_orbit['i'] > 90: # retrograade orbit
            self.initial_velocity = et.initial_vel(self.launch_coordinates['latitude'],retrograde=True)
        else:
            self.initial_velocity = et.initial_vel(self.launch_coordinates['latitude'])
        
    def target_Vc(self,losses):
        """
        Compute the target critical velocity
        losses : velocity losses approximation (m.s-1)
        """
        
        self.target_Vc = self.injection_velocity-self.initial_velocity+losses
        
    
class Stage():
    """
    """
    
    def __init__(self,stage_number,number_of_engines):
        """
        stage_number : 1 or 2
        
        """
        self.stage_number = stage_number
                
    
    avionics_mass = 0
    
    number_of_engines = 9
    
    def tank_mass(self,)
        
class Payload():
    """
    """
    
    def __init__(self,mass,target_orbit):
        """
        mass in kg
        target_orbit = {'a','e','i','capital_omega','small_omega','nu'}
        where:
            a : semi_major axis (m)
            e : eccentricity (adimentional)
            i : inclination (deg)                                
            capital_omega : argument of the ascending node (deg) 
            small_omega   : argument of the perigee (deg)
            nu : true anomaly (deg)
        """
        
        self.mass = mass
        self.target_orbit = target_orbit
        self.perigee_altitude = target_orbit['a']*(1-target_orbit['e'])
        
#    def propagate_orbit():
#        """
#        """
    
class Engine():
    """
    """
    
    cycle_type=''
    
    def __init__(self,oxidiser,fuel,thermo_cycle,exit_section_area):
        """
        """
        self.oxidiser = oxidiser
        self.fuel = fuel
        self.thermo_cycle = thermo_cycle
        self.exit_section_area = exit_section_area