AGX Dynamics  2.35.0.1
CombustionEngine.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agxModel/export.h>
20 
22 
23 
24 namespace agxDriveTrain
25 {
27  {
28  public:
36  CombustionEngine(agx::Real displacementVolume);
37 
41  agx::Real getRPM() const;
42 
49 
53  void setDisplacementVolume(agx::Real displacementVolume);
54 
59 
65  bool setThrottle(agx::Real throttle);
66 
71 
77  bool setThrottleAngle(agx::Real throttleAngle);
78 
83 
90  bool setIdleThrottleAngle(agx::Real throttleAngle);
91 
96 
102  bool setMaxThrottleAngle(agx::Real throttleAngle);
103 
108 
117 
123  bool setThrottleBore(agx::Real throttleBore);
124 
129 
135  bool setNrRevolutionsPerCycle(agx::Real nrRevolutionsPerCycle);
136 
141 
146 
152  bool setVolumetricEfficiency(agx::Real volumetricEfficiency);
153 
158 
165  bool setDischargeCoefficient(agx::Real dischargeCoefficient);
166 
171 
177  bool setInletVolume(agx::Real inletVolume);
178 
183 
188  void setEnable(bool enable);
189 
193  bool getEnable() const;
194 
198  virtual void setInertia(agx::Real inertia) override;
199 
203  virtual agx::Real getInertia() const override;
204 
205  public:
208  virtual bool preUpdate(agx::Real timeStep) override;
209 
211  virtual bool store(agxStream::StorageStream& str) const override;
212 
214  virtual bool restore(agxStream::StorageStream& str) override;
215 
217 
219 
220  protected:
221  CombustionEngine() = default;
222 
223  virtual ~CombustionEngine();
224 
225  private:
230  agx::Real computeThrottleMassFlow();
231 
236  agx::Real computeThrottleMassFlowDer();
237 
244  void stepPressure(agx::Real timeStep, agx::Real angularVel);
245 
251  void startEngine(agx::Real timeStep);
252 
253 
254  private:
255  agx::Real m_inletPressure;
256  agx::Real m_torque;
257 
258  agx::Real m_idleThrottle;
259  agx::Real m_maxThrottleAngle;
260  agx::Real m_throttleAngle;
261  agx::Real m_throttleBore;
262  agx::Real m_displacementVolume;
263  agx::Real m_loadConstant;
264  agx::Real m_nrRevolutionsPerCycle;
265 
266  agx::Real m_inletVolume;
267  agx::Real m_inletTemp;
268  agx::Real m_ambientPressure;
269  agx::Real m_volumetricEfficiency;
270  agx::Real m_airGasConstant;
271  agx::Real m_dischargeCoefficient;
272 
273  bool m_enable;
274  bool m_started;
275 
276  agx::Real m_c1;
277  agx::Real m_c2;
278  agx::Real m_startingTime;
279  agx::Real m_restInertia;
280  };
281 
283 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXMODEL_EXPORT
agx::Real getThrottleBore() const
bool setThrottleBore(agx::Real throttleBore)
Set the diameter of the throttle plate, which is assumed to be circular.
virtual void setInertia(agx::Real inertia) override
Set the inertia for the engine.
agx::Real getMaxThrottleAngle() const
bool setThrottleAngleRange(agx::Real min, agx::Real max)
Set the smallest and largest angle the throttle plate is allowed to have, i.e.
bool setThrottle(agx::Real throttle)
Set the percentage that the throttle is open.
agx::Real getInletVolume() const
void setEnable(bool enable)
Must be called to start the engine.
bool setMaxThrottleAngle(agx::Real throttleAngle)
Set the largest angle the throttle plate is allowed to have, i.e.
agx::Real getDischargeCoefficient() const
agx::Real getVolumetricEfficiency() const
agx::Real getInletPressure() const
Get the current pressure in the inlet manifold, i.e.the pressure right before the cylinders.
bool setInletVolume(agx::Real inletVolume)
Set the inlet manifold volume of the engine.
CombustionEngine(agx::Real displacementVolume)
Create an combustion engine.
bool setThrottleAngle(agx::Real throttleAngle)
Set the throttle plate angle directly, instead of percentage of throttle opening.
virtual agx::Real getInertia() const override
Get the engine inertia.
agx::Real getRPM() const
Get revolutions per minute.
bool setNrRevolutionsPerCycle(agx::Real nrRevolutionsPerCycle)
Set how many revolutions per cycle the engine cylinders have.
agx::Real getThrottleAngle() const
void setDisplacementVolume(agx::Real displacementVolume)
Set the total Displacement volume of engine cylinders in m^3.
bool setDischargeCoefficient(agx::Real dischargeCoefficient)
Set the discharge coefficient of the flow past the throttle.
bool setVolumetricEfficiency(agx::Real volumetricEfficiency)
Set the volumetric efficiency.
agx::Real getDisplacementVolume() const
agx::Real getIdleThrottleAngle() const
bool setIdleThrottleAngle(agx::Real throttleAngle)
Set the idle throttle angle for the engine, i.e.
agx::Real getNrRevolutionsPerCycle() const
A rotational unit has one degree of freedom.
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
A library of agxPowerLine components designed to model the various parts of a vehicle drive train.
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:880
double Real
Definition: Real.h:42
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:874