# Nasal API

# Followme EV Nasal Documentation
Flightgear version: 2018.3 or later
This file is generated automatically by scripts/python/nasal_api_doc.py

## SmartScreen
auto_crash
bug_engine
electrical
electrical_old
engine
light-manager
systems
DualControl

## SmartScreen

#### SmartScreen.showOnlineMap ( )

#### SmartScreen.showOfflineMap ( )

#### SmartScreen.r ( name,vis=1,zindex=nil )

#### SmartScreen.changeZoom ( d )

#### SmartScreen.updateTiles ( )

## auto_crash

#### auto_crash.position_change ( position_val,value )

Road check and auto pilot(??) by ValKmjolnir

#### auto_crash.road_check_func ( )

#### auto_crash.toggle_auto_pilot ( )

## bug_engine

#### bug_engine.update_engine ( )

#### bug_engine.rpm_calculate ( rpm_rate )

#### bug_engine.startEngine ( )

#### bug_engine.stopEngine ( )

## electrical

#### electrical.kWh2kWs ( kWh )

#### electrical.kWs2kWh ( kWs )

#### electrical.Series

#### electrical.Series.new ( )

//Class for any series connection

#### electrical.Series.addUnit ( unit )

#### electrical.Series.isSwitch ( )

#### electrical.Series.totalResistance ( )

#### electrical.Series.totalActivePower ( )

#### electrical.Series.totalPower ( )

#### electrical.Series.current ( )

#### electrical.Series.calculateSeriesVoltage ( )

#### electrical.Series.calculateSeriesCurrent ( )

#### electrical.Circuit

#### electrical.Circuit.new ( cSource )

//Class for any circuit
//Currently must be initalized with a source
//Currently only support one current source in a circuit

#### electrical.Circuit.newSeriesWithUnits ( addedUnits... )

#### electrical.Circuit.addUnitToSeries ( seriesNum, unit )

#### electrical.Circuit.addParallel ( units )

#### electrical.Circuit.addNewSeriesWithUnitToParallel ( units )

#### electrical.Circuit.voltage ( )

#### electrical.Circuit.calculateParallelVoltage ( )

#### electrical.Circuit.calculateSeriesVoltage ( )

#### electrical.Circuit.calculateTotalParalleCurrent ( )

#### electrical.Circuit.calculateTotalPower ( )

#### electrical.Circuit.update ( )

#### electrical.Appliance

#### electrical.Appliance.new ( )

//Class for any electrical appliance

#### electrical.Appliance.isCurrentSource ( )

#### electrical.Appliance.isSwitch ( )

#### electrical.Appliance.heatingPower ( )

#### electrical.Appliance.power ( )

#### electrical.Appliance.setName ( text )

#### electrical.Appliance.setDescription ( text )

#### electrical.Appliance.setResistance ( r )

#### electrical.CurrentSource

#### electrical.CurrentSource.new ( eR, eF, eC, name = )

//Class for any current source
//eR: Internal resistance of the source, eF: Electromotive force of the source, eC: Electrical capacity of the source, name: Name of the source.

#### electrical.CurrentSource.isCurrentSource ( )

#### electrical.CurrentSource.currentSourceUpdate ( power, interval )

#### electrical.CurrentSource.resetRemainingToFull ( )

#### electrical.CurrentSource.resetRemainingToZero ( )

#### electrical.CurrentSource.getRemainingPercentage ( )

#### electrical.CurrentSource.getRemainingPercentageFloat ( )

#### electrical.CurrentSource.getRemainingInkWh ( )

#### electrical.CurrentSource.addToBattery ( num )

#### electrical.Switch

#### electrical.Switch.new ( type, name = )

//Class for any switches
//Type 0 for appliance switch. type 1 for series switch
//switchToggle: Return 1 if connected, return 0 if disconnected

#### electrical.Switch.isSwitch ( )

#### electrical.Switch.isConnected ( )

#### electrical.Switch.switchConnect ( )

#### electrical.Switch.switchDisconnect ( )

#### electrical.Switch.switchToggle ( )

#### electrical.Cable

#### electrical.Cable.new ( l = 0, s = 0.008 )

//Class for any copper electrical cable

#### electrical.Cable.setResistance ( )

## electrical_old

#### electrical_old.electric_init ( )

#### electrical_old.electric_update ( )

#### electrical_old.startElectricalSystemUpdate ( )

#### electrical_old.stopElectricalSystemUpdate ( )

#### electrical_old.resetElectricalSystemUpdate ( )

## engine

#### engine.Engine

#### engine.Engine.new ( mTorque, mPower, rpmAtMPower )

#### engine.Engine.isRunning ( )

#### engine.Engine.setDirection ( dir )

#### engine.Engine.toggleDirection ( )

#### engine.Engine.getDirection ( )

#### engine.Engine.setGear ( g )

#### engine.Engine.getGear ( )

#### engine.Engine.rpm_calculate ( angularAcceleration )

#### engine.Engine.update_engine ( )

#### engine.Engine.createTimer ( )

#### engine.Engine.startEngine ( )

#### engine.Engine.stopEngine ( )

#### engine.Engine.debugPrint ( )

#### engine.outputForce ( force )

#### engine.startEngine ( )

#### engine.stopEngine ( )

## light-manager

#### light-manager.light_manager

#### light-manager.light_manager.init ( )

#### light-manager.light_manager.start ( )

#### light-manager.light_manager.stop ( )

#### light-manager.light_manager.update ( )

#### light-manager.light_manager.light1_on ( )

#### light-manager.light_manager.light1_off ( )

#### light-manager.light_manager.light1_setSize ( size )

#### light-manager.light_manager.light2_on ( )

#### light-manager.light_manager.light2_off ( )

#### light-manager.light_manager.light2_setSize ( size )

#### light-manager.light_manager.light3_on ( )

#### light-manager.light_manager.light3_off ( )

#### light-manager.light_manager.light4_on ( )

#### light-manager.light_manager.light4_off ( )

#### light-manager.light_manager.light5_on ( )

#### light-manager.light_manager.light5_off ( )

## systems

#### systems.liveryFuse

Follow Me
Gijs de Rooy (Original)
Sidi Liang

#### systems.liveryFuse.init ( dir, nameprop = )

#### systems.liveryFuse_update

#### systems.liveryFuse_update.new ( liveriesdir, interval = 10.01, callback = nil )

#### systems.liveryFuse_update.stop ( )

#### systems.Indicator

var Led = {
new: func() { return { parents:[Led] },
node: props.getNode("/sim/model/livery/texture",1),
blankTexture: "Messages/blanco.png",
currentMessage: "",
messageHistory : [],
display: func(content){
me.node.setValue(content);
},
};

#### systems.Indicator.new ( type )

#### systems.Indicator.switchOn ( )

#### systems.Indicator.switchOff ( )

#### systems.Indicator.isOn ( )

#### systems.Indicator.isOff ( )

#### systems.IndicatorController

#### systems.IndicatorController.new ( )

#### systems.IndicatorController.saveLedMessage ( )

#### systems.IndicatorController.getSavedMessage ( )

#### systems.IndicatorController.clearSavedMessage ( )

#### systems.IndicatorController.setLedMessage ( content )

#### systems.IndicatorController.resumeLedMessage ( )

#### systems.IndicatorController.getMode ( )

#### systems.IndicatorController.setMode ( targetMode )

#### systems.IndicatorController.right_indicator_toggle ( )

#### systems.IndicatorController.left_indicator_toggle ( )

#### systems.IndicatorController.falseLightOn ( )

#### systems.IndicatorController.falseLightOff ( )

#### systems.IndicatorController.false_light_toggle ( )

#### systems.chargeBatterySec ( )

#### systems.chargeBatteryStart ( )

#### systems.chargeBatteryStop ( bef )

#### systems.calculateSpeed ( )

#### systems.brakesABS ( )

#### systems.brakeWithABS ( )

## DualControl

#### DualControl.Translator

Utility classes
Translate a property into another.
Factor and offsets are only used for numeric values.
src - source : property node
dest - destination : property node
factor - : double
offset - : double

#### DualControl.Translator.new ( src = nil, dest = nil, factor = 1, offset = 0 )

#### DualControl.Translator.update ( )

#### DualControl.EdgeTrigger

Detects flanks on two insignals encoded in a property.
- positive signal up/down flank
- negative signal up/down flank
n - source : property node
on_positive_flank - action : func (v)
on_negative_flank - action : func (v)

#### DualControl.EdgeTrigger.new ( n, on_positive_flank, on_negative_flank )

#### DualControl.EdgeTrigger.update ( )

#### DualControl.StableTrigger

StableTrigger: Triggers an action when a MPP property
becomes stable (i.e. doesn't change for
MIN_STABLE seconds).
src - MP prop : property node
action - action to take when the value becomes stable : [func(v)]
An action is triggered when value has stabilized.

#### DualControl.StableTrigger.new ( src, action )

#### DualControl.StableTrigger.update ( )

#### DualControl.MostRecentSelector

Selects the most recent value of two properties.
src1 - : property node
src2 - : property node
dest - : property node
threshold - : double

#### DualControl.MostRecentSelector.new ( src1, src2, dest, threshold )

#### DualControl.MostRecentSelector.update ( )

#### DualControl.Adder

Adds two input properties.
src1 - : property node
src2 - : property node
dest - : property node

#### DualControl.Adder.new ( src1, src2, dest )

#### DualControl.Adder.update ( )

#### DualControl.DeltaAdder

Adds the delta of src to dest.
src - : property node
dest - : property node

#### DualControl.DeltaAdder.new ( src, dest )

#### DualControl.DeltaAdder.update ( )

#### DualControl.SwitchEncoder

Switch encoder: Encodes upto 32 boolean properties in one
int property.
inputs - list of property nodes
dest - where the bitmask is stored : property node

#### DualControl.SwitchEncoder.new ( inputs, dest )

#### DualControl.SwitchEncoder.update ( )

#### DualControl.SwitchDecoder

Switch decoder: Decodes a bitmask in an int property.
src - : property node
actions - list of actions : [func(b)]
Actions are triggered when their input bit change.
Due to interpolation the decoder needs to wait for a
stable input value.

#### DualControl.SwitchDecoder.new ( src, actions )

#### DualControl.SwitchDecoder.update ( )

#### DualControl.TDMEncoder

Time division multiplexing encoder: Transmits a list of
properties over a MP enabled string property.
inputs - input properties : [property node]
dest - MP string prop : property node
Note: TDM can have high latency so it is best used for
non-time critical properties.

#### DualControl.TDMEncoder.new ( inputs, dest )

#### DualControl.TDMEncoder.update ( )

#### DualControl.TDMDecoder

Time division multiplexing decoder: Receives a list of
properties over a MP enabled string property.
src - MP string prop : property node
actions - list of actions : [func(v)]
An action is triggered when its value is received.
Note: TDM can have high latency so it is best used for
non-time critical properties.

#### DualControl.TDMDecoder.new ( src, actions )

#### DualControl.TDMDecoder.process ( msg )

#### DualControl.TDMDecoder.update ( )

#### DualControl.is_num ( v )

Internal utility functions

#### DualControl.fail ( )

fail causes a Nasal runtime error so we get a backtrace.

#### DualControl.copilot_dialog

#### DualControl.copilot_dialog.init ( copilot_type, x = nil, y = nil )

#### DualControl.copilot_dialog.create ( )

#### DualControl.copilot_dialog.close ( )

#### DualControl.copilot_dialog.destroy ( )

#### DualControl.copilot_dialog.show ( copilot_type )

#### DualControl.copilot_dialog._redraw_ ( )

#### DualControl.copilot_dialog._update_ ( id )

#### DualControl.copilot_dialog.select_action ( n )

#### DualControl.copilot_dialog.find_copilot_players ( )

Return a list containing all nearby copilot players of the right type.

#### DualControl.pilot_connect_copilot ( copilot )

Used by dual_control to set up the mappings for the pilot
PILOT TO COPILOT

#### DualControl.pilot_disconnect_copilot ( )

#### DualControl.copilot_connect_pilot ( pilot )

Used by dual_control to set up the mappings for the copilot
COPILOT TO PILOT

#### DualControl.copilot_disconnect_pilot ( )

#### DualControl.connect ( copilot )

#### DualControl.main

Main loop singleton class.

#### DualControl.main.init ( )

#### DualControl.main.reset ( )

#### DualControl.main.activate ( )

#### DualControl.main.update ( )

#### DualControl.main._loop_ ( id )

#### DualControl.views

Default external views to slave to the MP pilot.

#### DualControl.connect ( pilot )

#### DualControl.disconnect ( )

#### DualControl.main

Main loop singleton class.

#### DualControl.main.init ( )

#### DualControl.main.reset ( )

#### DualControl.main.activate ( )

#### DualControl.main.update ( )

#### DualControl.main._loop_ ( id )