From 90e64f94303b7f85c1078d1a4d418b356a5c5c56 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 24 Sep 2002 15:24:04 +0000 Subject: [PATCH] Stub in a place holder for the electrical system model. --- src/Main/Makefile.am | 4 +-- src/Systems/Makefile.am | 6 ++-- src/Systems/electrical.cxx | 73 ++++++++++++++++++++++++++++++++++++++ src/Systems/electrical.hxx | 68 +++++++++++++++++++++++++++++++++++ src/Systems/system_mgr.cxx | 2 ++ 5 files changed, 149 insertions(+), 4 deletions(-) create mode 100644 src/Systems/electrical.cxx create mode 100644 src/Systems/electrical.hxx diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index 90b1d5d96..27a68b1c1 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -59,6 +59,8 @@ fgfs_LDADD = \ $(top_builddir)/src/FDM/LaRCsim/libLaRCsim.a \ $(top_builddir)/src/FDM/UIUCModel/libUIUCModel.a \ $(top_builddir)/src/GUI/libGUI.a \ + $(top_builddir)/src/Input/libInput.a \ + $(top_builddir)/src/Instrumentation/libInstrumentation.a \ $(top_builddir)/src/Model/libModel.a \ $(top_builddir)/src/Navaids/libNavaids.a \ $(top_builddir)/src/Scenery/libScenery.a \ @@ -69,8 +71,6 @@ fgfs_LDADD = \ $(top_builddir)/src/Systems/libSystems.a \ $(top_builddir)/src/Time/libTime.a \ $(WEATHER_LIBS) \ - $(top_builddir)/src/Input/libInput.a \ - $(top_builddir)/src/Instrumentation/libInstrumentation.a \ -lsgroute -lsgsky -lsgclouds3d -lsgephem -lsgtiming -lsgio -lsgscreen \ -lsgmath -lsgbucket -lsgdebug -lsgmagvar -lsgmisc -lsgxml \ -lsgserial \ diff --git a/src/Systems/Makefile.am b/src/Systems/Makefile.am index 15d9b863e..d254cde85 100644 --- a/src/Systems/Makefile.am +++ b/src/Systems/Makefile.am @@ -1,6 +1,8 @@ noinst_LIBRARIES = libSystems.a -libSystems_a_SOURCES = system_mgr.cxx system_mgr.hxx \ - vacuum.cxx vacuum.hxx +libSystems_a_SOURCES = \ + system_mgr.cxx system_mgr.hxx \ + electrical.cxx electrical.hxx \ + vacuum.cxx vacuum.hxx INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src diff --git a/src/Systems/electrical.cxx b/src/Systems/electrical.cxx new file mode 100644 index 000000000..283d94f30 --- /dev/null +++ b/src/Systems/electrical.cxx @@ -0,0 +1,73 @@ +// electrical.cxx - a flexible, generic electrical system model. +// +// Written by Curtis Olson, started September 2002. +// +// Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#include +#include + +#include
+#include
+ +#include "electrical.hxx" + +ElectricalSystem::ElectricalSystem () +{ +} + +ElectricalSystem::~ElectricalSystem () +{ +} + +void +ElectricalSystem::init () +{ + config_props = new SGPropertyNode; + + SGPath config( globals->get_fg_root() ); + config.append( fgGetString("/systems/electrical/path") ); + + SG_LOG( SG_ALL, SG_ALERT, "Reading electrical system model from " + << config.str() ); + try { + readProperties( config.str(), config_props ); + } catch (const sg_exception& exc) { + SG_LOG( SG_ALL, SG_ALERT, "Failed to load electrical system model: " + << config.str() ); + } + + delete config_props; +} + +void +ElectricalSystem::bind () +{ +} + +void +ElectricalSystem::unbind () +{ +} + +void +ElectricalSystem::update (double dt) +{ +} diff --git a/src/Systems/electrical.hxx b/src/Systems/electrical.hxx new file mode 100644 index 000000000..adf46aeca --- /dev/null +++ b/src/Systems/electrical.hxx @@ -0,0 +1,68 @@ +// electrical.hxx - a flexible, generic electrical system model. +// +// Written by Curtis Olson, started September 2002. +// +// Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#ifndef _SYSTEMS_ELECTRICAL_HXX +#define _SYSTEMS_ELECTRICAL_HXX 1 + +#ifndef __cplusplus +# error This library requires C++ +#endif + +#include +#include
+ + +/** + * Model an electrical system. This is a simple system with the + * alternator hardwired to engine[0]/rpm + * + * Input properties: + * + * /engines/engine[0]/rpm + * + * Output properties: + * + * + */ + +class ElectricalSystem : public FGSubsystem +{ + +public: + + ElectricalSystem (); + virtual ~ElectricalSystem (); + + virtual void init (); + virtual void bind (); + virtual void unbind (); + virtual void update (double dt); + +private: + + SGPropertyNode *config_props; + // SGPropertyNode_ptr _serviceable_node; + +}; + +#endif // _SYSTEMS_ELECTRICAL_HXX diff --git a/src/Systems/system_mgr.cxx b/src/Systems/system_mgr.cxx index 0feedc134..562231b68 100644 --- a/src/Systems/system_mgr.cxx +++ b/src/Systems/system_mgr.cxx @@ -5,6 +5,7 @@ #include "system_mgr.hxx" +#include "electrical.hxx" #include "vacuum.hxx" @@ -25,6 +26,7 @@ void FGSystemMgr::init () { // TODO: replace with XML configuration + _systems.push_back(new ElectricalSystem); _systems.push_back(new VacuumSystem); // Initialize the individual systems -- 2.39.5