| 1 | /* |
| 2 | * SPDX-License-Identifier: GPL-2.0+ |
| 3 | * |
| 4 | * inst_vertical_speed_indicator.hxx -- Instantaneous VSI (emulation calibrated to standard atmosphere). |
| 5 | * Started September 2004. |
| 6 | * |
| 7 | * Copyright (C) 2004 |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of the |
| 12 | * License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 22 | */ |
| 23 | |
| 24 | #pragma once |
| 25 | |
| 26 | #ifndef __cplusplus |
| 27 | # error This library requires C++ |
| 28 | #endif |
| 29 | |
| 30 | #include <simgear/props/props.hxx> |
| 31 | #include <simgear/structure/subsystem_mgr.hxx> |
| 32 | |
| 33 | |
| 34 | class SGInterpTable; |
| 35 | |
| 36 | |
| 37 | /** |
| 38 | * Model an instantaneous VSI tied to the external pressure. |
| 39 | * |
| 40 | * Input properties: |
| 41 | * |
| 42 | * /instrumentation/inst-vertical-speed-indicator/serviceable |
| 43 | * /environment/pressure-inhg |
| 44 | * /environment/pressure-sea-level-inhg |
| 45 | * /sim/freeze/master |
| 46 | * |
| 47 | * Output properties: |
| 48 | * |
| 49 | * /instrumentation/inst-vertical-speed-indicator/indicated-speed-fps |
| 50 | * /instrumentation/inst-vertical-speed-indicator/indicated-speed-fpm |
| 51 | */ |
| 52 | class InstVerticalSpeedIndicator : public SGSubsystem |
| 53 | { |
| 54 | public: |
| 55 | InstVerticalSpeedIndicator ( SGPropertyNode *node ); |
| 56 | virtual ~InstVerticalSpeedIndicator (); |
| 57 | |
| 58 | // Subsystem API. |
| 59 | void init() override; |
| 60 | void reinit() override; |
| 61 | void update(double dt) override; |
| 62 | |
| 63 | // Subsystem identification. |
| 64 | static const char* staticSubsystemClassId() { return "inst-vertical-speed-indicator"; } |
| 65 | |
| 66 | private: |
| 67 | std::string _name; |
| 68 | int _num; |
| 69 | |
| 70 | double _internal_pressure_inhg; |
| 71 | double _internal_sea_inhg; |
| 72 | |
| 73 | double _speed_ft_per_s; |
| 74 | |
| 75 | SGPropertyNode_ptr _serviceable_node; |
| 76 | SGPropertyNode_ptr _freeze_node; |
| 77 | SGPropertyNode_ptr _pressure_node; |
| 78 | SGPropertyNode_ptr _sea_node; |
| 79 | SGPropertyNode_ptr _speed_up_node; |
| 80 | SGPropertyNode_ptr _speed_node; |
| 81 | SGPropertyNode_ptr _speed_min_node; |
| 82 | |
| 83 | SGInterpTable * _pressure_table; |
| 84 | SGInterpTable * _altitude_table; |
| 85 | }; |