| 1 | /* |
| 2 | * SPDX-License-Identifier: CC0-1.0 |
| 3 | * |
| 4 | * vertical_speed_indicator.hxx - a regular VSI tied to the static port. |
| 5 | * Written by David Megginson, started 2002. |
| 6 | * |
| 7 | * Last change by E. van den Berg, 17.02.1013 |
| 8 | * |
| 9 | * This file is in the Public Domain and comes with no warranty. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | #pragma once |
| 15 | |
| 16 | #ifndef __cplusplus |
| 17 | # error This library requires C++ |
| 18 | #endif |
| 19 | |
| 20 | #include <simgear/props/props.hxx> |
| 21 | #include <simgear/structure/subsystem_mgr.hxx> |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * Model a non-instantaneous VSI tied to the static port. |
| 26 | * |
| 27 | * Input properties: |
| 28 | * |
| 29 | * /instrumentation/"name"/serviceable |
| 30 | * "static_port"/pressure-inhg |
| 31 | * |
| 32 | * Output properties: |
| 33 | * |
| 34 | * /instrumentation/"name"/indicated-speed-fpm |
| 35 | * /instrumentation/"name"/indicated-speed-mps |
| 36 | * /instrumentation/"name"/indicated-speed-kts |
| 37 | */ |
| 38 | class VerticalSpeedIndicator : public SGSubsystem |
| 39 | { |
| 40 | public: |
| 41 | VerticalSpeedIndicator ( SGPropertyNode *node ); |
| 42 | virtual ~VerticalSpeedIndicator (); |
| 43 | |
| 44 | // Subsystem API. |
| 45 | void init() override; |
| 46 | void reinit() override; |
| 47 | void update(double dt) override; |
| 48 | |
| 49 | // Subsystem identification. |
| 50 | static const char* staticSubsystemClassId() { return "vertical-speed-indicator"; } |
| 51 | |
| 52 | private: |
| 53 | double _casing_pressure_Pa = 0.0; |
| 54 | double _casing_airmass_kg = 0.0; |
| 55 | double _casing_density_kgpm3 = 0.0; |
| 56 | double _orifice_massflow_kgps = 0.0; |
| 57 | |
| 58 | const std::string _name; |
| 59 | const int _num; |
| 60 | std::string _static_pressure; |
| 61 | std::string _static_temperature; |
| 62 | |
| 63 | SGPropertyNode_ptr _serviceable_node; |
| 64 | SGPropertyNode_ptr _pressure_node; |
| 65 | SGPropertyNode_ptr _temperature_node; |
| 66 | SGPropertyNode_ptr _speed_fpm_node; |
| 67 | SGPropertyNode_ptr _speed_mps_node; |
| 68 | SGPropertyNode_ptr _speed_kts_node; |
| 69 | }; |