IntegratedSystems

From FlightGear wiki
Jump to navigation Jump to search
IntegratedSystems
Started in 2019
Contributor(s) Octal450

IntegratedSystems (IS) is a design framework for developing aircraft systems in a clean and integrated way. It also facilitates easy maintenance of various different aircraft.

Examples of a complete IS setup can be seen in the MD-11 and MD-80.

THIS ARTICLE IS A WORK IN PROGRESS

Documentation of IntegratedSystems is a work in progress.

Common Aircraft Interfaces

All IS compliant aircraft implement the following interfaces:

  • Autopilot disconnect: cockpit.ApPanel.apDisc()
  • Autothrottle disconnect: cockpit.ApPanel.atDisc()
  • Takeoff/Go Around button: cockpit.ApPanel.toga()

In addition, custom overrides are provided for the following default binding options:

  • All Reverser Toggle
  • All flight control bindings as required
  • Autopilot disconnect

IS Components

Aircraft Config Center

The Aircraft Config Center (ACConfig) is the suggested front-end GUI of an IS aircraft. Many features of IS have been designed with ACConfig in mind. Version 2 integrates completely with IS and can control aircraft equipment and options, as well as leveraging IS to implement a robust panel state and failure system. Further information will be provided soon.

Failure System

Info coming soon.

Panel States

Info coming soon.

IS Base

Info coming soon.

IS Modules

IS Modules are the heart of IS. Each system should have one module which interfaces it with other IS components.

Module Guidelines

  • Each module must be configured so that the sim starts in the "Cold and Dark" state.
  • Each module must be designed to integrate with Panel States.
  • Each module should handle its own failures if applicable.
  • Each module should not initialize its own properties, they should be initialized in the -set file and then imported into nodes by the module.
  • Use the Switch node for any controls of a system
  • Use the Fail node for any failure triggers
  • Keep other system nodes organized in a clean way, using vectors as needed
  • Use properties in nodes unless you are sure you will only need to interact with other Nasal code, or have some other way of exporting
  • Prefer to keep the actual code in a JSBSim System file, unless specifically needed.
  • If you NEED to use a loop, use the Loop Guidlines below.

Standard Functions


init() (Required):
  • Used by Panel States to quickly reset the entire system.
  • This function must completely reset a system to the state it was in when the sim launches (usually cold and dark).
  • This requires that any JSBSim System Files are designed in a way that allows the init function to reset the state.

resetFailures (Optional):
  • Used by the Aircraft Config Center Failure System to reset the failures.
  • This function resets any failures in the system and also resets any consequences of a failure being activated.
  • This function must be called before anything else in the init() function.

Loop Guidlines

Info coming soon.

Example Module

The following example is for a very basic electrical system implemented in a JSBSim System.

<PropertyList>
	<!-- Other -set nodes -->
	
	<!-- Controls section -->
	<controls n="0">
		<electrical n="0">
			<switches n="0"> <!-- Initialize switch properties -->
				<battery type="bool">0</battery>
				<gen type="bool">0</gen>
			</switches>
		</electrical>
	</controls>
	
	<!-- Systems section -->
	<systems n="0">
		<failures n="0">
			<electrical n="0"> <!-- Initialize failure properties -->
				<battery type="bool">0</battery>
				<gen type="bool">0</gen>
			</electrical>
		</failures>
	</systems>
	
	<!-- Nasal section -->
	<nasal n="0">
		<pts> <!-- Don't forget PTS! -->
			<file>Aircraft/MyPlane/Nasal/property-tree-setup.nas</file>
		</pts>
		<systems> <!-- Include the system itself -->
			<file>Aircraft/MyPlane/Nasal/Systems/electrical.nas</file>
		</systems>
		<!-- Other nasal files -->
	</nasal>
</PropertyList>
  • electrical.nas
var ELEC = { # Define the module class
	Bus: { # Just a node used in this system
		ac: props.globals.getNode("/systems/electrical/bus/ac"),
		dc: props.globals.getNode("/systems/electrical/bus/dc"),
		emerAc: props.globals.getNode("/systems/electrical/bus/emer-ac"),
		emerDc: props.globals.getNode("/systems/electrical/bus/emer-dc"),
	},
	Fail: { # Failure properties
		battery: props.globals.getNode("/systems/failures/electrical/battery"),
		gen: props.globals.getNode("/systems/failures/electrical/gen"),
	},
	Switch: { # The switches
		battery: props.globals.getNode("/controls/electrical/switches/battery"),
		gen: props.globals.getNode("/controls/electrical/switches/gen"),
	},
	init: func() {
		me.resetFailures();
		me.Switch.battery.setBoolValue(0);
		me.Switch.gen.setBoolValue(0);
	},
	resetFailures: func() {
		me.Fail.battery.setBoolValue(0);
		me.Fail.gen.setBoolValue(0);
	},
};

Property Tree Setup

The property tree is used to communicate between 3D XML files, JSBSim files, and Nasal files. However the default getprop() and setprop are messy and very inefficient on resources.

The Property Tree Setup (PTS) solves this by creating an efficient connection from IS to the items to properties that are NOT part of other modules. It organizes the nodes following the structure of the property tree itself, except when lots of identical (example: Gear wow), where vectors are used to make it easier. PTS must live in a node called pts, and must be declared before any other nasal files. It is strongly recommended to alphabetize the PTS file.

Each system you create should handle its own nodes via an IS Module. PTS should only be used to tie the REST of the property tree in, or in situations when creating a whole module is not justified - such as when there are only a few nodes.

In the below example, a basic PTS implementation to set up the node pts.Consumables.Fuel.totalFuelLbs to the property /consumables/fuel/total-fuel-lbs is shown. You can then use getValue() and setValue()or any other props.nas operations.

<PropertyList>
	<!-- Other -set nodes -->
	
	<!-- Nasal section -->
	<nasal>
		<pts>
			<file>Aircraft/MyPlane/Nasal/property-tree-setup.nas</file>
		</pts>
		<!-- Other nasal files -->
	</nasal>
</PropertyList>
  • property-tree-setup.nas
var Consumables = {
	Fuel: {
		totalFuelLbs: props.globals.getNode("/consumables/fuel/total-fuel-lbs"),
	},
};