1 /***************************************************************************
2                           carengine.h  -  Engine + drivetrain of a car
3                              -------------------
4     begin                : di mrt 8 2005
5     copyright            : (C) 2005 by CJP
6     email                : cornware-cjp@users.sourceforge.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef CARENGINE_H
19 #define CARENGINE_H
20 
21 #include <vector> //STL vector template
22 namespace std {}
23 using namespace std;
24 
25 /**
26   *@author CJP
27   */
28 
29 class CCarEngine {
30 public:
31 	CCarEngine();
32 	~CCarEngine();
33 
34 	//Drivetrain settings:
35 	vector<float> m_GearRatios;
36 	float m_DifferentialRatio;
37 	float m_FrontTraction, m_RearTraction;
38 
39 	//Torque curve settings:
40 	float m_M0;             //Torque @ 0 RPM
41 	float m_Mmax, m_w_Mmax; //Max torque point
42 	float m_Pmax, m_w_Pmax; //Max power point
43 	float m_w_Zero;         //zero-torque point
44 
45 
46 	//input:
47 	float m_Gas;
48 	unsigned int m_Gear;
49 
50 	//from wheels:
51 	float m_MainAxisW;
52 	void update(float dt, float w1, float w2, float w3, float w4);
53 
54 	//to wheels:
55 	float m_MainAxisM;
56 	float getWheelM(unsigned int wheelnr);
57 
58 	float getGearRatio(int gear = -1);
59 	float getEngineM(float wengine);
60 };
61 
62 #endif
63