| 1 | // static.hxx - the static air system. |
| 2 | // Written by David Megginson, started 2002. |
| 3 | // |
| 4 | // Last modified by Eric van den Berg, 09 November 2013 |
| 5 | // This file is in the Public Domain and comes with no warranty. |
| 6 | |
| 7 | |
| 8 | #ifndef __SYSTEMS_STATIC_HXX |
| 9 | #define __SYSTEMS_STATIC_HXX 1 |
| 10 | |
| 11 | #ifndef __cplusplus |
| 12 | # error This library requires C++ |
| 13 | #endif |
| 14 | |
| 15 | #include <simgear/props/props.hxx> |
| 16 | #include <simgear/structure/subsystem_mgr.hxx> |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Model a static air system. |
| 21 | * |
| 22 | * Input properties: |
| 23 | * |
| 24 | * /environment/pressure-inhg |
| 25 | * /systems/"name"/serviceable |
| 26 | * /orientation/alpha-deg |
| 27 | * /orientation/side-slip-rad |
| 28 | * /velocities/mach |
| 29 | * |
| 30 | * Output properties: |
| 31 | * |
| 32 | * /systems/"name"/pressure-inhg |
| 33 | * |
| 34 | * TODO: support alternate air with errors |
| 35 | */ |
| 36 | class StaticSystem : public SGSubsystem |
| 37 | { |
| 38 | public: |
| 39 | StaticSystem ( SGPropertyNode *node ); |
| 40 | StaticSystem ( int i ); |
| 41 | virtual ~StaticSystem (); |
| 42 | |
| 43 | // Subsystem API. |
| 44 | void bind() override; |
| 45 | void init() override; |
| 46 | void reinit() override; |
| 47 | void unbind() override; |
| 48 | void update(double dt) override; |
| 49 | |
| 50 | // Subsystem identification. |
| 51 | static const char* staticSubsystemClassId() { return "static"; } |
| 52 | |
| 53 | private: |
| 54 | std::string _name; |
| 55 | int _num; |
| 56 | double _tau; |
| 57 | double _error_factor; |
| 58 | int _type; |
| 59 | SGPropertyNode_ptr _serviceable_node; |
| 60 | SGPropertyNode_ptr _pressure_in_node; |
| 61 | SGPropertyNode_ptr _pressure_out_node; |
| 62 | SGPropertyNode_ptr _beta_node; |
| 63 | SGPropertyNode_ptr _alpha_node; |
| 64 | SGPropertyNode_ptr _mach_node; |
| 65 | }; |
| 66 | |
| 67 | #endif // __SYSTEMS_STATIC_HXX |