MASIEngine - MOARdV/AvionicsSystems GitHub Wiki

MASIEngine.cs

Contents

The MASIEngine class provides an interface between Avionics Systems and aircraft engine related features.

Interaction with Advanced Jet Engine jet and propeller engines is done through this modules.


AJE Jet Category

The AJE Jet category provides an interface to engines using ModuleEnginesAJEJet from the Advanced Jet Engines mod.

In order to control the engines, those engines must have a properly-configured MASIdEngine module installed. In particular, each engine must have a MAS Part ID other than zero, and each engine must have a unique MAS Part ID.

Note: There is a limited amount of information that the AJE mod exposes for jets in an accessible manner.

engine.GetAfterburnerThrottle(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Afterburner throttle, between 0 and 1; if the selected engine is invalid, not a jet, or does not have an afterburner, returns 0.

Returns the afterburner throttle position for the selected jet engine.

engine.GetCurrentJetTemperature(double engineId, bool useKelvin)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()
  • useKelvin: If true, returns units are in Kelvin. If false, units are in Celsius.

Returns: Current temperature in Kelvin or Celsius, or 0.

Returns the current temperature of the selected jet. If the selected engine is not a jet, returns 0.

engine.GetMaxJetTemperature(double engineId, bool useKelvin)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()
  • useKelvin: If true, returns units are in Kelvin. If false, units are in Celsius.

Returns: Maximum temperature in Kelvin or Celsius, or 0.

Returns the maximum temperature of the selected jet. If the selected engine is not a jet, returns 0.

engine.GetCoreThrottle(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Core throttle, between 0 and 1; if the selected engine is invalid or not a jet, returns 0.

Returns the core (non-afterburning) throttle position for the selected jet engine.


AJE Propellers Category

The AJE Propellers category provides an interface with engines using ModuleEnginesAJEPropeller from the Advanced Jet Engines mod.

In order to control the engines, those engines must have a properly-configured MASIdEngine module installed. In particular, each engine must have a MAS Part ID other than zero, and each engine must have a unique MAS Part ID.

The "Set" functions may use an engineId of 0 to set all controlled engines simultaneously.

Note 1: AJE Propellers are complex devices, and not all engines support all of the features listed here. MAS does not screen the engine for suitability, so some of these values may be meaningless for some engines. Likewise, some functions will have no effect, such as adjusting the propeller RPM setting on a fixed-pitch properller. For IVA makers who plan on including AJE propeller support in their IVAs, it is important to make sure your players understand which engines are intended for use with the IVA. Alternatively, provide craft files using the supported engines.

Note 2: Currently, the manifold pressure and brake shaft power values may be in either Imperial or SI values, depending on a config setting in ModuleEnginesAJEPropeller. A future MAS update may make these values agnostic of that config setting (either always Imperial, or always SI) - just let MOARdV know which system should be used for the values.

engine.GetEngineCount()

Returns: The number of configured AJE engines.

Returns the number of correctly configured AJE engines (both jet and propeller).

engine.GetPropellerBoost(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Engine boost, between 0 and 1, or 0 for an invalid engineId.

Get the current supercharger/turbocharger boost setting.

engine.GetPropellerBrakeShaftPower(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Brake shaft power or 0 for an invalid engineId.

Get the current brake shaft power. NOTE: units may be in HP or PS, depending on the engine's "useHP" field (which defaults to true).

engine.GetPropellerChargeAirTemp(double engineId, bool useKelvin)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()
  • useKelvin: If true, returns units are in Kelvin. If false, units are in Celsius.

Returns: Charge air temperature, or 0 for an invalid engineId.

Get the charge air temperature.

engine.GetPropellerManifoldPressure(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Manifold pressure, or 0 for an invalid engineId.

Get the current manifold pressure. NOTE: units may be in InHg or ata, depending on the engine's "useInHg" field (which defaults to true).

engine.GetPropellerMixture(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Mixture, between 0 and 1, or 0 for an invalid engineId.

Get the current mixture setting for the engine, between 0 (full lean) and 1 (full rich)

engine.GetPropellerNetExhaustThrust(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Exhaust thrust in kN, or 0 for an invalid engineId.

Get the net exhaust thrust of the engine, in kN.

engine.GetPropellerNetMeredithEffect(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Net Meredith effect, or 0 for an invalid engineId.

Get the net Meredith effect of the engine in kN.

engine.GetPropellerPitch(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Pitch in degrees, or 0 for an invalid engineId.

Get the current pitch of the propeller in degrees.

engine.GetPropellerRPM(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Current propeller speed in RPM, or 0.

Returns the current RPM of the selected engine. If an invalid engineId is provided, or the selected engine is not an AJE propeller engine, returns 0.

engine.GetPropellerRPMLever(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns the current RPM lever position for the selected engine. The lever position ranges between 0 and 1. Returns 0 for invalid engineIDs or engines that are not AJE propeller engines.

engine.GetPropellerThrust(double engineId)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount()

Returns: Engine thrust in kN, or 0 for an invalid engineId.

Get the thrust of the engine, in kN.

engine.SetPropellerBoost(double engineId, double newBoost)

  • engineId: The id of the engine to change, between 1 and engine.GetEngineCount(), or 0 to set all engines at the same time.
  • newBoost: The new boost setting , between 0 and 1 (inclusive).

Returns: 1 if the setting was changed, 0 otherwise.

Sets the turbo/super charger boost for the selected engine to the value in newBoost. Returns 1 if the position was updated, 0 otherwise.

To set engines individually, set engineId to any number between 1 and engine.GetEngineCount() (inclusive). To set all engines at once, set engineId to 0.

engine.SetPropellerMixture(double engineId, double newMixture)

  • engineId: The id of the engine to change, between 1 and engine.GetEngineCount(), or 0 to set all engines at the same time.
  • newMixture: The new mixture setting, between 0 (full lean) and 1 (full rich).

Returns: 1 if the setting was changed, 0 otherwise.

Sets the engine mixture for the selected engine to the value in newMixture. Returns 1 if the position was updated, 0 otherwise.

To set engines individually, set engineId to any number between 1 and engine.GetEngineCount() (inclusive). To set all engines at once, set engineId to 0.

engine.SetPropellerRPM(double engineId, double newPosition)

  • engineId: The id of the engine to check, between 1 and engine.GetEngineCount(), or 0 to set all engines at the same time.
  • newPosition: The new lever position, between 0 and 1 (inclusive).

Returns: 1 if the setting was changed, 0 otherwise.

Sets the RPM lever position for the selected engine to the value in newPosition. Returns 1 if the position was updated, 0 otherwise.

To set engines individually, set engineId to any number between 1 and engine.GetEngineCount() (inclusive). To set all engines at once, set engineId to 0.


Engine Group Management Category

The Engine Group Management category allows engines grouped together using MASIdEngineGroup to be toggled on or off separately from the main engine control interface, or be queried if they are on or off.

The functions that accept a 'groupId' parameter may be provided an integer in the range of 1-31 to affect only the engines in that group. The parameter may also be 0, which will affect all engines that have a MASIdEngineGroup part module.

engine.CurrentFuelFlow(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: Current fuel flow in g/s.

Returns the current fuel flow in grams/second for the selected group.

engine.CurrentThrustkN(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: Current thrust in kN.

Returns the current thrust in kiloNewtons for the selected group.

engine.EngineGroupValid(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: 0 if there are no engines belonging to the group, 1 if there is.

Returns 1 if the selected groupId has at least one member.

engine.GetEngineGroupActive(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: 1 if any selected engine is active, 0 otherwise.

Returns 1 if any engine in the specified groupId is active. If no engine is active, or if there are no engines in the specified groupId, returns 0.

engine.GetEngineGroupCount()

Returns the number of unique engine group IDs found on the vessel.

engine.GetThrottleLimit(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: A number from 0 (no thrust or no engines) to 1 (maximum thrust).

Returns the average of the throttle limit for the selected engine group, ranging from 0 (no thrust) to 1 (maximum thrust).

engine.MaxThrustkN(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: Max thrust in kN.

Returns the maximum thrust in kiloNewtons for the selected group.

engine.SetEnginesEnabled(double groupId, bool newState)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.
  • newState: When true, activates engines in the group. When false, deactivates them.

Returns: 1 if any engines were toggled, 0 otherwise.

Toggles all of the engines in the selected group that can be toggled (activates them if they're deactivated, shuts them off if they're active).

Note that, unlike the core fc version of this method, it is possible to activate engines that are not in the current stage using this method.

engine.SetThrottleLimit(double groupId, double newLimit)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.
  • newLimit: The new throttle limit, between 0 and 1 (inclusive).

Returns: 1 if the throttle limit was updated, 0 otherwise.

Set the throttle limit for all of the engines in the selected group. May be set to any value between 0 and 1. Values outside that range are clamped to [0, 1].

engine.ToggleEnginesEnabled(double groupId)

  • groupId: A number from 1 to 31 (inclusive) to select a specific group, or 0 to select all groups.

Returns: 1 if any engines were toggled, 0 otherwise.

Toggles all of the engines in the selected group that can be toggled (activates them if they're deactivated, shuts them off if they're active).

Note that, unlike the core fc version of this method, it is possible to activate engines that are not in the current stage using this method.


Intakes Category

The Intakes region allows management of resource intakes aboard the vessel (such as air intakes, water scoops, etc).

engine.GetIntakesCount()

Returns: The number of intakes.

Returns the number of intakes on the vessel.

engine.GetIntakesOpen()

Returns: 1 if an intake is open.

Returns 1 if any intake is open. Returns 0 otherwise.

engine.SetIntakesOpen(bool open)

  • open: If true, intakes will be opened. If false, intakes will be closed.

Returns: 1 if any intakes changed, 0 if all intakes were already set to the requested position.

Sets the state of all intakes aboard the vessel per the open parameter.

engine.ToggleIntakes()

Returns: 1 if any intakes were toggled, 0 if none were.

Toggles intakes (opens them if they are closed, closes them if they are open).


Thrust Reverser Category

The Thrust Reverser section controls thrust reversers attached to engines.

engine.ThrustReverserCount()

Returns: Number of thrust reverser modules.

The number of thrust reverser modules found on the vessel.

engine.ThrustReverserPosition()

Returns: Thrust reverser position in the range [0, 1], or 0.

Returns the normalized thrust reverser position, or 0 if there are none.

engine.SetThrustReverser(bool active)

  • active: If true, deploy the thrust reversers. If false, stow the thrust reversers.

Returns: 1 if any thrust reversers changed; 0 otherwise.

Sets the state of thrust reversers. Only affects thrust reversers that are not actively moving.

engine.ToggleThrustReverser()

Returns: 1 if reversers were toggled, 0 if there are no thrust reversers.

Toggles installed thrust reversers (deploys them if they are not deployed, retracts them if they are deployed).


This documentation was automatically generated from source code at 17:46 UTC on 15/Jan/2019.