IMS2
Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
|
Handles the proliferation of propellant mixtures to thrusters. More...
Public Member Functions | |
IMS_PropellantInjector (vector< int > &propellant_ids, vector< float > &ratio, double efficiency, VESSEL *vessel) | |
bool | ConnectTank (IMS_Storable *tank) |
Connects a tank to this injector. More... | |
bool | DisconnectTank (IMS_Storable *tank) |
Disconnects a tank from this injector. More... | |
void | ConnectThruster (THRUSTER_HANDLE thruster, double maxmassflow) |
Connects a thruster to this injector. More... | |
bool | DisconnectThruster (THRUSTER_HANDLE thruster, double maxmassflow) |
Removes a thruster from this injector. More... | |
bool | EnableThruster (THRUSTER_HANDLE thruster) |
Marks a thruster as ready for operation. More... | |
bool | DisableThruster (THRUSTER_HANDLE thruster) |
Marks a thruster as not currently operational. More... | |
int | GetNumberOfThrusters () |
double | GetMass () |
bool | PreStep () |
Calculates propellant consumption since last call. More... | |
bool | CompareMixture (vector< int > &propellant_ids, vector< float > &ratio, double efficiency) |
double | GetAvailablePropellantMass () |
Private Member Functions | |
void | checkValidity () |
Checks whether the injector can work with the currently connected tanks and sets the isViable flag accordingly. | |
void | disableInjector () |
Disables all thrusters in the injector, but without actually changing their enabled status. This is used when the injector doesn't have enough propellant anymore to work. The operational state of. | |
void | enableInjector () |
Enables all thrusters that are enabled. This is used to re-enable an injector when new propellant becomes available. The operational status of individual thrusters is not affected. | |
void | scaleInjectorResource () |
double | getAvailablePropellantMassByType (int consumable_id) |
Private Attributes | |
map< int, vector< IMS_Storable * > > | tanks |
contains all currently connected tanks | |
map< int, double > | ratio |
maps ratioes to their respective propellant types | |
map< THRUSTER_HANDLE, bool > | thrusters |
Stores all handles to thrusters proliferated by this injector, and whether they are enabled or not. | |
PROPELLANT_HANDLE | injector = NULL |
The orbiter propellant resource the injector uses to satisfy orbiter. It also serves as a kind of feedback event to know how much propellant is actually consumed. | |
double | currenttimewarp |
the time acceleration the sim is currently in. Needed for scaling the propellant resource. | |
double | totalmaxmassflow = 0 |
the maximum total massflow that can pass through this injector, in kg/s | |
VESSEL * | v |
double | injectormass = 0 |
bool | injectormasschanged = false |
True if the mass of the virtual resource has changed during this frame. | |
bool | isViable = false |
Shows whether the injector has all necessary propellants to actually work. | |
Handles the proliferation of propellant mixtures to thrusters.
You should not think of this as a physical piece of machinery running in the ship. This is a purely virtual construct for the benefit of easier code, it does not have any physical equivalent. It is named PropellantInjector because the job-description comes close to what it does (proliferation of correct mixtures from tanks to thrusters), but it really only exists because orbiter insists that a thruster take its propellant from a single propellant resource.
IMS_PropellantInjector::IMS_PropellantInjector | ( | vector< int > & | propellant_ids, |
vector< float > & | ratio, | ||
double | efficiency, | ||
VESSEL * | vessel | ||
) |
propellant_ids | A list of all propellant ids contained in this injectors mixture |
ratio | a list of ratioes at which the corresponding ids have to be mixed. |
prop_efficiency | The efficiency at which this mixture is converted into thrust by the thruster |
vessel | The vessel this PropellantInjector is located on |
bool IMS_PropellantInjector::CompareMixture | ( | vector< int > & | propellant_ids, |
vector< float > & | ratio, | ||
double | efficiency | ||
) |
bool IMS_PropellantInjector::ConnectTank | ( | IMS_Storable * | tank | ) |
Connects a tank to this injector.
tank | The IMS_Storable to be added as a tank |
void IMS_PropellantInjector::ConnectThruster | ( | THRUSTER_HANDLE | thruster, |
double | maxmassflow | ||
) |
Connects a thruster to this injector.
thruster | The handle to a orbiter thruster |
maxmassflow | The maximum massflow of the thruster, in kg/s |
bool IMS_PropellantInjector::DisableThruster | ( | THRUSTER_HANDLE | thruster | ) |
Marks a thruster as not currently operational.
thruster | An orbiter THRUSTER_HANDLE to the thruster to be disabled |
bool IMS_PropellantInjector::DisconnectTank | ( | IMS_Storable * | tank | ) |
Disconnects a tank from this injector.
tank | The IMS_Storable to be removed from the injector |
bool IMS_PropellantInjector::DisconnectThruster | ( | THRUSTER_HANDLE | thruster, |
double | maxmassflow | ||
) |
Removes a thruster from this injector.
thruster | the handle to an orbiter thruster |
maxmassflow | the maximum massflow of the thruster, in kg/s |
bool IMS_PropellantInjector::EnableThruster | ( | THRUSTER_HANDLE | thruster | ) |
Marks a thruster as ready for operation.
thruster | An orbiter THRUSTER_HANDLE to the thruster to be enabled |
double IMS_PropellantInjector::GetAvailablePropellantMass | ( | ) |
|
private |
consumable_id | Id of the consumable you want to know the mass for. Must be present in the injector! |
|
inline |
bool IMS_PropellantInjector::PreStep | ( | ) |
Calculates propellant consumption since last call.
Resizes virtual propellant resource if necessary, draws consumed propellant from connected tanks
|
private |
Scales the virtual propellant resource depending on time acceleration and mximum massflow of the engine