From 4d09ba71a42295bcde1e942e471de3f7583a3578 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 27 May 2003 19:25:27 +0000 Subject: [PATCH] - Added a redundant (left/right) vacuum pump. - Modified the rpm vs. suction formula to hit much more realistic numbers. We should be seeing just over 4 inhg at idle and approaching 5 inhg at full throttle. --- src/Systems/system_mgr.cxx | 9 +++++---- src/Systems/vacuum.cxx | 23 ++++++++++++++--------- src/Systems/vacuum.hxx | 5 +++-- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/Systems/system_mgr.cxx b/src/Systems/system_mgr.cxx index cb7406f98..bdf525f14 100644 --- a/src/Systems/system_mgr.cxx +++ b/src/Systems/system_mgr.cxx @@ -13,10 +13,11 @@ FGSystemMgr::FGSystemMgr () { - set_subsystem("electrical", new FGElectricalSystem); - set_subsystem("pitot", new PitotSystem); - set_subsystem("static", new StaticSystem); - set_subsystem("vacuum", new VacuumSystem); + set_subsystem( "electrical", new FGElectricalSystem ); + set_subsystem( "pitot", new PitotSystem ); + set_subsystem( "static", new StaticSystem ); + set_subsystem( "vacuum-l", new VacuumSystem(0) ); + set_subsystem( "vacuum-r", new VacuumSystem(1) ); } FGSystemMgr::~FGSystemMgr () diff --git a/src/Systems/vacuum.cxx b/src/Systems/vacuum.cxx index 19bde5777..5b07b77f5 100644 --- a/src/Systems/vacuum.cxx +++ b/src/Systems/vacuum.cxx @@ -7,8 +7,9 @@ #include
-VacuumSystem::VacuumSystem () +VacuumSystem::VacuumSystem( int i ) { + num = i; } VacuumSystem::~VacuumSystem () @@ -16,14 +17,15 @@ VacuumSystem::~VacuumSystem () } void -VacuumSystem::init () +VacuumSystem::init() { - // TODO: allow index of pump and engine - // to be configured. - _serviceable_node = fgGetNode("/systems/vacuum[0]/serviceable", true); + // TODO: allow index of engine to be + // configured. + SGPropertyNode *node = fgGetNode("/systems/vacuum", num, true ); + _serviceable_node = node->getChild("serviceable", 0, true); _rpm_node = fgGetNode("/engines/engine[0]/rpm", true); _pressure_node = fgGetNode("/environment/pressure-inhg", true); - _suction_node = fgGetNode("/systems/vacuum[0]/suction-inhg", true); + _suction_node = node->getChild("suction-inhg", 0, true); } void @@ -48,9 +50,12 @@ VacuumSystem::update (double dt) } else { double rpm = _rpm_node->getDoubleValue(); double pressure = _pressure_node->getDoubleValue(); - suction = pressure * rpm / (rpm + 10000.0); - if (suction > 5.0) - suction = 5.0; + // suction = pressure * rpm / (rpm + 5000.0); + // This magic formula yields about 4.1 inhg at 700 rpm and + // about 6.0 inhg at 2200 rpm (numbers by observation) + suction = 5.39 - 1.0 / ( rpm * 0.00111 ); + if ( suction < 0.0 ) suction = 0.0; + if ( suction > 5.0 ) suction = 5.0; } _suction_node->setDoubleValue(suction); } diff --git a/src/Systems/vacuum.hxx b/src/Systems/vacuum.hxx index 2572c73f9..3087c4633 100644 --- a/src/Systems/vacuum.hxx +++ b/src/Systems/vacuum.hxx @@ -29,14 +29,14 @@ * * Output properties: * - * /systems/vacuum[0]/suction-inhg + * /systems/vacuum[n]/suction-inhg */ class VacuumSystem : public FGSubsystem { public: - VacuumSystem (); + VacuumSystem( int i ); virtual ~VacuumSystem (); virtual void init (); @@ -46,6 +46,7 @@ public: private: + int num; SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _rpm_node; SGPropertyNode_ptr _pressure_node; -- 2.39.5