{"id":19982668,"url":"https://github.com/zabuzard/phantom-aoa","last_synced_at":"2026-02-15T16:04:11.878Z","repository":{"id":63764719,"uuid":"561745445","full_name":"Zabuzard/Phantom-AOA","owner":"Zabuzard","description":"Simulates the Angle Of Attack (AOA) system of the Phantom F-4E fighter jet.","archived":false,"fork":false,"pushed_at":"2022-11-07T13:28:18.000Z","size":5147,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T06:58:22.450Z","etag":null,"topics":["angle-of-attack","aoa","console-application","demo","f-4e","phantom","physics","physics-simulation","simulation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zabuzard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-04T11:53:29.000Z","updated_at":"2022-12-19T08:28:33.000Z","dependencies_parsed_at":"2022-11-25T15:04:53.956Z","dependency_job_id":null,"html_url":"https://github.com/Zabuzard/Phantom-AOA","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Zabuzard/Phantom-AOA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zabuzard%2FPhantom-AOA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zabuzard%2FPhantom-AOA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zabuzard%2FPhantom-AOA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zabuzard%2FPhantom-AOA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zabuzard","download_url":"https://codeload.github.com/Zabuzard/Phantom-AOA/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zabuzard%2FPhantom-AOA/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29483326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T15:33:17.885Z","status":"ssl_error","status_checked_at":"2026-02-15T15:32:53.698Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angle-of-attack","aoa","console-application","demo","f-4e","phantom","physics","physics-simulation","simulation"],"created_at":"2024-11-13T04:12:31.024Z","updated_at":"2026-02-15T16:04:11.845Z","avatar_url":"https://github.com/Zabuzard.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phantom-AOA\n\nThis project simulates the **Angle Of Attack** (AOA) system of\nthe **Phantom F-4E** fighter jet.\n\n\u003cimg alt=\"demo\" src=\"/demo.gif?raw=true\"/\u003e\n\nIt comes as an interactive console application with a simple text-based GUI.\nFor the best experience, it should be viewed on an ANSI-compatible console.\nAs of now, only Windows is supported.\n\n## Controls\n\nThe simulation can be interacted with, by using keys. The controls are as follows:\n\n### Aircraft\n\nThe aircraft's position in relation to the flight path (which is kept stationary in the simulation),\ncan be changed by holding down the following keys\n\n* \u003ckbd\u003e↑\u003c/kbd\u003e pitch down (drop nose)\n* \u003ckbd\u003e↓\u003c/kbd\u003e pitch up (lift nose)\n* \u003ckbd\u003e→\u003c/kbd\u003e rudder right (changes yaw, not roll)\n* \u003ckbd\u003e←\u003c/kbd\u003e rudder left (changes yaw, not roll)\n\n### Power\n\n#### Bus\n\nAll buses are powered by default already, their state can be toggled with\n\n* \u003ckbd\u003eQ\u003c/kbd\u003e Essential 28V DC\n* \u003ckbd\u003eW\u003c/kbd\u003e Right Main 115/200V AC\n* \u003ckbd\u003eE\u003c/kbd\u003e Instrument 115/200V AC\n* \u003ckbd\u003eR\u003c/kbd\u003e Left Main 115/200V AC\n\n#### Circuit Breaker\n\nCircuit breakers are, by default, pushed in. Their state can be toggled with\n\n* \u003ckbd\u003eA\u003c/kbd\u003e AOA PROBE HTR PWR (power to the AOA sensor)\n* \u003ckbd\u003eS\u003c/kbd\u003e AOA PROBE HTR CONT (power to the other components of the AOA system)\n* \u003ckbd\u003eD\u003c/kbd\u003e ESS DC CADC (whether the central computer receives power through the essential bus)\n* \u003ckbd\u003eF\u003c/kbd\u003e INSTR AC CADC (whether the central computer receives power through the instrument bus)\n* \u003ckbd\u003eG\u003c/kbd\u003e RM VAC AC CADC PWR 1 (whether the central computer receives power through the right main bus)\n* \u003ckbd\u003eH\u003c/kbd\u003e RM VAC AC CADC PWR 2 (whether the central computer receives power through the right main bus)\n* \u003ckbd\u003eJ\u003c/kbd\u003e RM VAC AC CADC PWR 3 (whether the central computer receives power through the right main bus)\n\n### Knobs\n\nThe aircraft has a few knobs that can be rotated to decrease or increase their value respectively\n\n* \u003ckbd\u003eT\u003c/kbd\u003e\u003ckbd\u003eZ\u003c/kbd\u003e Instrument Panel light intensity\n* \u003ckbd\u003eU\u003c/kbd\u003e\u003ckbd\u003eI\u003c/kbd\u003e Emergency Floodlight (technically a 3-way switch, increase beyond 0.3 and 0.6 respectively)\n* \u003ckbd\u003eO\u003c/kbd\u003e\u003ckbd\u003eP\u003c/kbd\u003e AOA indexer light intensity\n* \u003ckbd\u003eK\u003c/kbd\u003e\u003ckbd\u003eL\u003c/kbd\u003e Aural Stall Warning Tone volume\n\n### Flag\n\nFurther, there are certain states, provided as simple boolean flags, which can be toggled.\n\n* \u003ckbd\u003eY\u003c/kbd\u003e Nose-Wheel (extend/retract)\n* \u003ckbd\u003eX\u003c/kbd\u003e Weight On Wheel (on-ground/in-flight)\n* \u003ckbd\u003eC\u003c/kbd\u003e Gear (extend/retract)\n* \u003ckbd\u003eV\u003c/kbd\u003e Slats (in/out)\n* \u003ckbd\u003eB\u003c/kbd\u003e AGM-45 mode (select/unselect)\n* \u003ckbd\u003eN\u003c/kbd\u003e AOA sensor icing (freeze/not frozen)\n\nFor simplicity, the gear flags all act independently of each other.\nFor example, applying the gear flag will not apply the nose-wheel flag as well.\n\n## Features\n\nThe aircraft's AOA system consists of the following components:\n\n* sensor\n* indicator\n* indexer\n* stall warning vibrator\n* aural tone system\n\nFor which, the simulated features are:\n\n### Sensor\n\n* measure AOA based on aircraft's 3 axis (pitch, roll, yaw) and the flight path vector\n* (also measure side-slip angle in a similar way)\n* power based on bus and circuit breakers\n* warmup-time based on outside temperature\n* error induced by an extended nose-wheel\n* error induced by side-slip\n* error induced by a frozen sensor\n\n### Indicator\n\n* display the AOA received by sensor\n* power based on bus and circuit breakers\n    * needle is stuck if no power\n    * shows OFF-flag if no power\n* shows AOA within limits of 0-30°\n* needle dampening to prevent jitter\n* needle lag (does not catch up to the sensor reading immediately)\n* has 3 lamps\n    * illuminate based on AOA reading\n    * either red or white, depending on knobs\n    * power based on bus and circuit breakers\n        * white, red BRT and red DIM are energized differently\n    * light intensity based on knob\n\n### Indexer\n\n* illuminate 3 lamps based on AOA received by sensor\n* power based on bus and circuit breakers\n* lamp status based on AOA ranges\n* light intensity based on knob\n    * power based on bus and circuit breakers\n    * knob can not turn them off, only dim them\n* special AGM-45 mode\n    * lamps then indicate AGM-45 cues instead of AOA\n\n### Stall Warning Vibrator\n\n* vibrates based on AOA received by sensor (vibration is just visualized)\n* power based on bus and circuit breakers\n* only active if no weight on wheels (in-air)\n\n### Aural Tone System\n\n* emits tones based on AOA received by sensor (tones are just visualized)\n* power based on bus and circuit breakers\n* different tone profiles based on slats and gear status\n    * tones have a frequency, volume and can be either\n      steady or interrupted (pulse per second)\n* volume based on knob\n    * tone profile can prevent muting in certain situations\n\n### Illustrations\n\n#### Sensor\n\nSensor measurements:\n![sensor](https://i.imgur.com/2QfuBRp.png)\n\nWarmup:\n![warmup](https://i.imgur.com/pRYiWs3.png)\n\nNose-wheel error:\n![nose-wheel](https://i.imgur.com/lpVEByU.png)\n\nSide-slip error:\n![side-slip](https://i.imgur.com/4kZu0KW.png)\n\nFrozen sensor error:\n![frozen](https://i.imgur.com/EknxikY.png)\n\n#### Indicator\n\nIndicator:\n![indicator](https://i.imgur.com/YKVA9Ag.png)\n\nPower off, needle stuck:\n![power off](https://i.imgur.com/YV5B7Ow.png)\n\nIndicator is limited:\n![limit](https://i.imgur.com/t5Vp0K4.png)\n\nNeedle lags:\n![lag](https://i.imgur.com/2UCMK70.png)\n\nMedium-AOA white lamp with intensity\n![white lamp](https://i.imgur.com/aqJGqW0.png)\n\nHigh-AOA red lamp with intensity\n![red lamp](https://i.imgur.com/QPNMIBd.png)\n\n#### Indexer\n\nIndexer lamps:\n![indexer](https://i.imgur.com/V4gQrfv.png)\n\nNo power:\n![no power](https://i.imgur.com/uHSdpEG.png)\n\nLight intensity:\n![light intensity](https://i.imgur.com/fT2wLbf.png)\n\nAGM-45 mode:\n![agm mode](https://i.imgur.com/DgWxn5B.png)\n\n#### Stall Warning Vibrator\n\nStall-warning:\n![stall warning](https://i.imgur.com/ePKpHRH.png)\n\nInactive on ground:\n![on ground](https://i.imgur.com/021tJl7.png)\n\n#### Aural Tone System\n\nEmits tones:\n![tones](https://i.imgur.com/EVM7ZkA.png)\n\nNo power:\n![no power](https://i.imgur.com/SxtF8tn.png)\n\nMuted with knob:\n![muted](https://i.imgur.com/FnBgnsi.png)\n\nPrevents muting in critical situation:\n![prevented muting](https://i.imgur.com/wj4laNg.png)\n\n## Code Base\n\nAt the moment, only Windows is supported. This is due to how the system reads keyboard input.\n\nThe flow starts with `main.cpp`, which simply starts `Simulation`.\n\n### Simulation\n\n`Simulation` consists of a simple _game loop_ that controls logical updates and rendering using `TPS` and `FPS`\nrespectively.\nIt maintains a list of `Entity`, for which it will call `update(double deltaTime)` during a logical update (tick)\nand `render()` when rendering the next frame.\n\nAs of now, `update` and `render` can not be called in-parallel, since state changes in `update`\nare not all synchronized/guarded yet.\n\nThe list of entities consists of `Engine` and `Phantom` (the aircraft and all its components).\n\n### Engine\n\nThe `Engine` class represents all external inputs which are out of the scope for this simulation.\nFor example measuring the outside temperature or maintaining the aircraft's position.\n\nIt also handles all user inputs and maintains the states of all corresponding knobs and similar.\n\nOther classes will use it as main source for external input.\n\n#### Input\n\nThe way the engine handles input, right now, is a bit over the place and grew organically. It consists of a few enums:\n\n* `Bus`\n* `CircuitBreaker`\n* `Flag`\n* `Knob`\n\nand `Controls`. Since enums can not hold other state or properties, they are represented with multiple maps.\nEach of them has a map to represent:\n\n* `entry` to `name` for visual display (`render`)\n* `key` to `entry` (to map controls to the corresponding system)\n\nand further possible extra state, such as `activatedFlags`, `poweredBuses`, `knobToValue`, `pushedCircuitBreakers`.\n\n### Phantom\n\n`Phantom` represents the aircraft itself. It maintains a list of all its own entities,\nsuch as the `AOASensor`, `AOAIndicator` and more.\n\nIt essentially just forwards all calls, like `update` or `render` to all its components.\n\n### Math\n\nAll relevant logic for math and physics can be found in `Math` and `Vector3`.\n\n## Q\u0026A\n\n### How to simulate\n\n\u003e Given that the atmosphere is already fully simulated, how would you simulate the AOA system?\n\n#### Pressure\n\nIn reality, the sensor measures the AOA with a slotted probe. The probe has two holes that allow air to stream in.\nDifference in air pressure between the areas behind those two holes, created by a change of AOA, physically move a\nsurface within the probe.\nThis movement then induces changes in electrical resistance, which is translated into the sensors signal.\n\nSimulating it that way requires that the engine is capable of providing precise atmospheric pressure readings\nfor a given 3D position. The advantage of that would be that the system behaves as close to reality as possible,\nand would naturally support edge cases that can occur when, for example flying through clouds or other\nenvironments with rapidly changing air pressure.\n\nIn practice, however, such a deep simulation is often not applicable and for most engines likely also not feasible.\n\n#### Position\n\nAnother option is to just measure the AOA based on the aircraft's position and attitude in space,\ntogether with its flight path vector. This information can typically be provided by engines more easily.\n\nThe AOA can then be computed by basic means of 3D geometry:\n\n![geometry](https://i.imgur.com/skUvnqd.png)\n\nThis approach will provide an accurate AOA reading in all situations, attitudes and motions. While this sounds great,\nit is also a disadvantage at the same time. It implies that more effects have to be simulated manually,\nsuch as errors induced by side-slip, or by an extended gear that changes the air-flow in front of the probe.\n\nOnce the sensor is simulated, it can simply forward its readings to all other components that rely on it.\n\n#### Components\n\nCode-wise, it is likely meaningful to employ OOP here and represent each component in the system as its own\nindividual class, which possibly has dependencies on other classes. For example, the AOA system consists of components,\nlike:\n\n* sensor\n* heaters\n* circuit breakers\n* indicator\n* indexer\n* stall warning vibrator\n* aural tone system\n\nThat way, each component can simulate its own quirks individually. It also allows us to create multiple, individual\ninstances per component. For example, the aircraft has 2 indicators and 4 indexers. Each of them could then exist\nindividually,\nallowing individual interaction.\n\nSome things likely do not need to be represented as individual components in the simulation, such as the heaters. The\nheaters\ncan not be interacted with individually and only influence the sensors capability to measure accurately.\nIt may or may not be feasible to just represent this effect within the sensor itself, depending on outside conditions,\nsuch as the temperature. This could change if the environment allows for more detailed simulation,\nsuch as combat-damage of the heater unit itself.\n\n### Who depends on it?\n\n\u003e What simulation outputs are necessary and for which systems are they critical?\n\n#### Systems\n\nThe AOA system is a core component of the aircraft system. Its data is not only relevant for its own components, such\nas:\n\n* indicator\n* indexer\n* stall warning vibrator\n* aural tone system\n\nBut is also fed directly into the Central Aircraft Data Computer (CADC), from which it is forwarded to all other systems\nthat need it.\n\nSome systems that rely on it are:\n\n* HUD\n* navigation system (INS, ...)\n* flight control system (slats, engine inlets, ...)\n* weapon system (lead computation, CCIP, AGM-45, ...)\n* tests (BITs and test switches might spin the needles around and light all lamps)\n\nFurther, there are also systems that should be given access to the true physical AOA, without any simulation effects\napplied by the sensor.\nThe simulation of the flight model or engine performance needs access to the real AOA in order to simulate changes\nduring extreme conditions.\nAs an example, the aircraft starts rolling to the side under very high AOAs, or the engines may flame-out.\n\n#### Exposed data\n\nThe core data that has to be exposed to other systems is essentially the AOA reading of the sensor itself.\n\nFurther, some systems, such as the AGM-45, requires control of the AOA indexer. It can override the lamp states to\nindicate cues.\n\nApart from that, the AOA system mostly just has to expose its data for display/rendering in the cockpit.\nFor example, the AOA indicator has to move the needle to the indicated position.\n\nThe components also need to be able to read certain data from the system, such as the state of relevant buses or circuit\nbreakers, as well as all knobs and switches that can be used to control them.\nFor example the light intensity knobs for the AOA indexers.\n\n### Which failures?\n\n\u003e What kind of basic failures in the AOA system would you simulate?\n\nThe most obvious _failures_ are related to the system not having power. Some reasons could be:\n\n* engines out, battery out, no external power\n* circuit breaker pulled\n* generator out\n* combat damage\n\nFurther, the sensor can become iced if flying in cold conditions and the heaters are turned off or damaged.\n\nBut there are also failures that are just unrealistic to happen within the context of the simulation.\nIt is not necessary to simulate those. For example:\n\n* mean operating time between failures (1500 hours)\n* minimum operating life (6000 hours)\n* error induced by voltage spikes\n* errors when applying very high or low temperatures\n* applying force to the probe until it bends\n\nRelevant failures that could potentially be simulated are combat damage in the corresponding areas on the aircraft\nwhere the systems are located at. For example, when receiving gun fire near the probe, it could get damaged,\ndisabling the sensor and everything that relies on it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzabuzard%2Fphantom-aoa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzabuzard%2Fphantom-aoa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzabuzard%2Fphantom-aoa/lists"}