00001 // Drivetrain.h - manages the engine, clutch, transmission and differential. 00002 // 00003 // Copyright (C) 2001--2002 Sam Varner 00004 // 00005 // This file is part of Vamos Automotive Simulator. 00006 // 00007 // This program is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 #ifndef _DRIVETRAIN_H_ 00022 #define _DRIVETRAIN_H_ 00023 00024 #include <vamos/body/Engine.h> 00025 #include <vamos/body/Clutch.h> 00026 #include <vamos/body/Transmission.h> 00027 #include <vamos/body/Differential.h> 00028 #include <vamos/geometry/Constants.h> 00029 00030 namespace Vamos_Body 00031 { 00032 //* The drivetrain manages the engine, clutch, transmission and 00033 // differential. 00034 class Drivetrain 00035 { 00036 //** The components that make up the drivetrain. 00037 00038 Engine* mp_engine; 00039 00040 Clutch* mp_clutch; 00041 00042 Transmission* mp_transmission; 00043 00044 Differential* mp_differential; 00045 00046 // The throttle position. 00047 double m_gas; 00048 00049 // bool m_auto_neutral; 00050 00051 public: 00052 //** Constructor 00053 Drivetrain (Engine* engine, 00054 Clutch* clutch, 00055 Transmission* transmission, 00056 Differential* differential); 00057 00058 //** Destructor 00059 ~Drivetrain (); 00060 00061 // Process the input parameters. 00062 void input (double gas, double clutch, 00063 double left_wheel_speed, double right_wheel_speed); 00064 00065 void find_forces (); 00066 00067 // Advance the drivetrain in time by TIME. 00068 void propagate (double time); 00069 void rewind (); 00070 void reset (); 00071 00072 // Allow access to the components. 00073 Engine* engine () { return mp_engine; } 00074 Transmission* transmission () { return mp_transmission; } 00075 Clutch* clutch () { return mp_clutch; } 00076 00077 // Return the torque for a driven wheel. 00078 double torque (Vamos_Geometry::Side side) const; 00079 00080 //void set_auto_neutral (bool an) {m_auto_neutral = an;} 00081 }; 00082 } 00083 00084 #endif // not _DRIVETRAIN_H_
1.4.6