Electrical Systems
==================
.. warning:: This section is a work in progress.
Aircraft electrical systems are vital for powering a range of systems, from essential flight
instruments and navigation equipment to lighting and engine starters. In FlightGear, these systems
can be simulated in a way that mirrors the real-world flow of electrical power, allowing pilots to
practice realistic troubleshooting, manage failures, and understand how different components—like
batteries, alternators, buses, and switches—work together.
Implementing an electrical system for an aircraft
*************************************************
Aircraft Developers have two options to choose from when it comes to how to simulate electrical
systems:
- Built-in
- Custom
Built-in Electrical Model
=========================
.. tip::
The main advantages of the built-in XML-based electrical model are its simplicity and ease of
use, as well as the fact that it has essentially zero performance overhead. Very complex or
intricate electrical simulations are best implemented in Nasal at this time.
asdf
------------
The FlightGear electrical system model is an approximation. It does not simulate down to the level
of individual electrons but instead models a sufficiently rich subset of components to allow the
implementation of a realistic electrical system from the pilot's perspective. The model is designed
to capture the general flow of electricity, enabling the simulation of typical electrical system
failures, providing opportunities to practice realistic troubleshooting techniques, and
understanding the basic structure and relationships of an actual aircraft electrical system.
An electrical system is constructed from four major components: suppliers, buses, outputs, and
connectors. Suppliers include elements such as batteries and generators. Buses collect input from
multiple suppliers and distribute power to multiple outputs. Outputs are optional but are included
to allow generic output types to be named and provide a consistent naming scheme for other
FlightGear subsystems. Connectors link suppliers to buses or buses to outputs and can optionally
specify a switch property, representing either a physical switch or a circuit breaker.
At runtime, the structure defined in the electrical system configuration file is parsed, and a
directional graph (in the computer science sense) is created. During each frame, current is
propagated through the system, starting from the suppliers, flowing through the buses, and
ultimately reaching the outputs. The system adheres to the path defined by the connectors in the
configuration file and respects the state of any connector switches.
Suppliers
---------
A supplier entry could look like the following:
.. code-block:: XML
Battery 1/systems/electrical/suppliers/battery[0]battery2460 can be anything you choose to call this entry.
is the name of a property that will be updated with the state of this supplier.
can be "battery", "alternator", or "external".
specifies the volts of the source
specifies the amps of the source
Currently and are not really modeled in detail. This
is more of a place holder for the future.
For alternators, you must additionally specify:
.. code-block:: XML
/engines/engine[0]/rpm
The value of the rpm source determines if the generator is able to
produce power or not.
Buses
-----
A bus entry could look like the following:
.. code-block:: XML
Essential/Cross Feed Bus/systems/electrical/outputs/bus-essential/systems/electrical/outputs/annunciators/systems/electrical/outputs/master-switch is whatever you choose to call this bus
You can have an arbitrary number of entries. Each entry is the
name of a property that will be updated with the value of the current
at that bus. This allows you to wire devices directly to the bus but
does not allow you to insert a switch or circuit breaker in between.
See "Outputs" and "Connectors" if you want to do that.
Outputs
-------
An output entry could look like the following:
.. code-block:: XML
An output isn't entirely unlike a bus, but it's nice conceptually to
have a separate entity type. This enables us to specify a common set
of output property names so that other subsystems can automatically
work with any electrical system that follows the same conventions. An
output lives on the other side of a switch, so this is how you can
wire in cockpit switches to model things like fuel pump power,
avionics master switch, or any other switch on the panel.
is whatever you choose to call this bus
You can have an arbitrary number of entries. Each entry is the
name of a property that will be updated with the value of the current
at that bus. This allows you to wire devices directly to the bus but
does not allow you to insert a switch or circuit breaker in between.
See "Outputs" and "Connectors" if you want to do that.
Other FlightGear subsystems can monitor the property name associated
with the various outputs to decide how to render an instrument,
whether to run the fuel pump, whether to spin a gyro, or any other
subsystem that cares about electrical power.
Connectors
----------
An connector entry could look like the following
.. code-block:: XML
Alternator 1
/controls/switches/master-altoff
A connector specifies and input, and output, and any number of
switches that are wired in series. In other words, all switches need
to be true/on in order for current to get from the input to the output
of the connector.
specifies the of the input. Typically you would
specify a "supplier" or a "bus".