AGX Dynamics  2.38.0.2
CombustionEngine.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 #include <agxDriveTrain/Shaft.h>
22 
23 
24 namespace agxDriveTrain
25 {
26 
37  {
38  public:
39 
46 
54 
59  void setCombustionEngineParameters(const CombustionEngineParameters& parameters);
60 
68  CombustionEngineParameters& getCombustionEngineParameters();
69 
74  agx::Real getInletPressure() const;
75 
81  bool setThrottle(agx::Real throttle);
82 
86  agx::Real getThrottle() const;
87 
93  bool setThrottleAngle(agx::Real throttleAngle);
94 
98  agx::Real getThrottleAngle() const;
99 
106  bool setIdleThrottleAngle(agx::Real throttleAngle);
107 
111  agx::Real getIdleThrottleAngle() const;
112 
118  bool setMaxThrottleAngle(agx::Real throttleAngle);
119 
123  agx::Real getMaxThrottleAngle() const;
124 
132  bool setThrottleAngleRange(agx::Real min, agx::Real max);
133 
140  bool setThrottlePinBoreRatio(agx::Real throttlePinBoreRatio);
141 
145  agx::Real getThrottlePinBoreRatio() const;
146 
147 
153  void setNrRevolutionsPerCycle(CombustionEngineParameters::RevolutionsPerCycle nrRevolutionsPerCycle);
154 
158  CombustionEngineParameters::RevolutionsPerCycle getNrRevolutionsPerCycle() const;
159 
165  bool setMaxVolumetricEfficiency(agx::Real maxVolumetricEfficiency);
166 
170  agx::Real getMaxVolumetricEfficiency() const;
171 
177  agx::Real getVolumetricEfficiency(agx::Real N, agx::Real p) const;
178 
184  agx::Real computeCylinderAirMassFlowRate(agx::Real N, agx::Real p);
185 
189  agx::Real getThermalEfficiency() const;
190 
197  bool setAirFuelRatio(agx::Real ratio);
198 
202  agx::Real getAirFuelRatio() const;
203 
211  bool setHeatValue(agx::Real heatValue);
212 
216  agx::Real getHeatValue() const;
217 
223  agx::Real computeIndicatedTorque(agx::Real N, agx::Real p);
224 
229  agx::Real computeFrictionTorque(agx::Real N);
230 
235  agx::Real computePumpTorque(agx::Real p);
236 
240  agx::Real getIndicatedTorque() const;
241 
245  agx::Real getFrictionTorque() const;
246 
250  agx::Real getPumpTorque() const;
251 
255  agx::Real getOutputTorque() const;
256 
262  bool setInletVolume(agx::Real inletVolume);
263 
267  agx::Real getInletVolume() const;
268 
273  void setEnable(bool enable);
274 
278  bool getEnable() const;
279 
285  void setInletTemperature(agx::Real inletTemperature);
286 
290  agx::Real getInletTemperature() const;
291 
295  agx::Real getCylinderAirMassFlow();
296 
300  agx::Real getThrottleAirMassFlow();
301 
305  agx::Real getFuelConsumptionRate();
306 
307 
314  static bool readLibraryProperties(const agx::String& name, CombustionEngineParameters& parameters);
315 
320  bool loadLibraryProperties(const agx::String& name);
321 
326  static agx::StringVector getAvailableLibraryProperties();
327 
328 
330 
331  public:
333  virtual bool preUpdate(agx::Real timeStep) override;
334 
336  virtual bool store(agxStream::StorageStream& str) const override;
337 
339  virtual bool restore(agxStream::StorageStream& str) override;
340 
342 
344 
345  protected:
346  virtual ~CombustionEngine();
347 
348  void initParameters();
349 
354  void computeMaxThrottleArea();
355 
359  void computeVolumetricEfficiencyCoefficients();
360 
366  agx::Real computeFlowGain(agx::Real r);
367 
372  agx::Real computeFlowGainDerivative(agx::Real r);
373 
379  agx::Real computeThrottleAreaGain(agx::Real alpha);
380 
382 
383  private:
384 
390  void stepPressure(agx::Real timeStep);
391 
396  void startEngine();
397 
398  private:
399 
400  agx::Real m_inletVolume;
401  agx::Real m_inletPressure;
402 
403  agx::Real m_idleThrottleAngle;
404 
405  agx::Real m_maxThrottleAngle;
406  agx::Real m_throttleAngle;
407 
408  agx::Real m_maxThrottleArea;
409 
410  agx::Real m_inletTemperature;
411  agx::Real m_ambientPressure;
412 
413  agx::Real m_airGasConstant;
414 
415  bool m_enable;
416  bool m_started;
417 
418  agx::Real m_idleInletPressure;
419 
420  agx::Real m_c0;
421  agx::Real m_c1;
422  agx::Real m_c2;
423  agx::Real m_c3;
424 
425  agx::Real m_thermalEfficiency;
426 
427  agx::Real m_indicatedTorque;
428  agx::Real m_frictionTorque;
429  agx::Real m_pumpTorque;
430 
431  agx::Real m_outputTorque;
432 
433  CombustionEngineParameters m_combustionEngineParameters;
434  };
435 
437 }
agx::Real
double Real
Definition: Real.h:42
agx::Vector< AgXString< std::string > >
export.h
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxDriveTrain
A library of agxPowerLine components designed to model the various parts of a vehicle drive train.
agxDriveTrain::CombustionEngineParameters::RevolutionsPerCycle
RevolutionsPerCycle
Definition: CombustionEngineParameters.h:50
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxStream::StorageStream
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agxDriveTrain::Shaft
A Shaft is the most basic PowerLine Unit.
Definition: Shaft.h:34
agxDriveTrain::CombustionEngine
The model of the combustion engine consists of two subsystems: namely, the intake manifold dynamics a...
Definition: CombustionEngine.h:36
agx::min
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:861
CombustionEngineParameters.h
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Shaft.h
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agx::AgXString< std::string >
agx::max
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:855
agxDriveTrain::CombustionEngineParameters
Parameters that specifies the performance of a combustion engine.
Definition: CombustionEngineParameters.h:48