mbsim  4.0.0
MBSim Kernel
magic_formula_62.h
1 /* Copyright (C) 2004-2023 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _MAGIC_FORMULA_62_H_
21 #define _MAGIC_FORMULA_62_H_
22 
23 #include <mbsim/constitutive_laws/tyre_model.h>
24 
25 namespace MBSim {
26 
27  class ContourFrame;
28 
29  class MagicFormula62 : public TyreModel {
30  public:
31  enum TyreSide {
32  file=0,
33  left,
34  right,
35  unknown
36  };
37 
38  MagicFormula62() : slipPoint(2) { }
39  ~MagicFormula62() override;
40 
41  void setInputDataFile(const std::string& inputDataFile_) { inputDataFile = inputDataFile_; }
42  void setTyreSide(TyreSide tyreSide_) { tyreSide = tyreSide_; }
43  void setVerticalStiffness(double cz_) { cz = cz_; }
44  void setVerticalDamping(double dz_) { dz = dz_; }
45  void setNominalLoad(double Fz0_) { Fz0 = Fz0_; }
46  void setInflationPressure(double p_) { p = p_; }
47  void setRelaxationLengthForLongitudinalSlip(double six_) { six = six_; }
48  void setRelaxationLengthForSideslip(double siy_) { siy = siy_; }
49  void setScaleFactorForLongitudinalForce(double LFX_) { LFX = LFX_; }
50  void setScaleFactorForLateralForce(double LFY_) { LFY = LFY_; }
51  void setScaleFactorForOverturningMoment(double LMX_) { LMX = LMX_; }
52  void setScaleFactorForRollingResistanceMoment(double LMY_) { LMY = LMY_; }
53  void setScaleFactorForAligningMoment(double LMZ_) { LMZ = LMZ_; }
54  void setScaleFactorForMomentArmOfLongitudinalForce(double LS_) { LS = LS_; }
55  void setScaleFactorForLongitudinalFricitionCoefficient(double LMUX_) { LMUX = LMUX_; }
56  void setScaleFactorForLateralFricitionCoefficient(double LMUY_) { LMUY = LMUY_; }
57  void setScaleFactorForLongitudinalSlipStiffness(double LKX_) { LKX = LKX_; }
58  void setScaleFactorForCorneringStiffness(double LKY_) { LKY = LKY_; }
59  void setScaleFactorForCamberStiffness(double LKYC_) { LKYC = LKYC_; }
60  void setScaleFactorForResidualTorque(double LKZC_) { LKZC = LKZC_; }
61  void setMotorcycleKinematics(bool mck_) { mck = mck_; }
62  void setContactPointTransformation(bool contactPointTransformation_) { contactPointTransformation = contactPointTransformation_; }
63  void setTurnSlip(bool ts_) { ts = ts_; }
64  void setReferenceTreadWidth(double rtw_) { rtw = rtw_; }
65 
66  void init(InitStage stage, const InitConfigSet &config) override;
67  void initPlot(std::vector<std::string> &plotColumns) override;
68  void plot(std::vector<double> &plotVector) override;
69  void initializeUsingXML(xercesc::DOMElement *element) override;
70 
71  int getxSize() const override;
72  int getDMSize() const override { return 3; }
73 
74  fmatvec::VecV getContourParameters() const override;
75  double evalFreeRadius() override;
76 
77  void updateGeneralizedForces() override;
78  void updatexd() override;
79 
80  int getDataSize() const override { return 8; }
81  fmatvec::VecV getData() const override;
82 
83  bool motorcycleKinematics() const override { return mck; }
84 
85  void resetUpToDate() override;
86 
87  private:
88  void importData();
89  std::string inputDataFile;
90  TyreSide tyreSide{file};
91  int FITTYP;
92  std::string TYRESIDE;
93  bool mirroring{false};
94  double v0, R0{0}, w{0}, rRim{0}, p{-1}, p0, Fz0{-1}, cz{-1}, dz{-1}, MC_CONTOUR_A, MC_CONTOUR_B, BREFF, DREFF, FREFF, Q_RE0, Q_V1, Q_V2, Q_FZ2, Q_FCX, Q_FCY, Q_CAM, PFZ1, Q_FCY2, Q_CAM1, Q_CAM2, Q_CAM3, Q_FYS1, Q_FYS2, Q_FYS3, rhobtm, czbtm, PCX1, PDX1, PDX2, PDX3, PEX1, PEX2, PEX3, PEX4, PKX1, PKX2, PKX3, PHX1, PHX2, PVX1, PVX2, PPX1, PPX2, PPX3, PPX4, RBX1, RBX2, RBX3, RCX1, REX1, REX2, RHX1, QSX1, QSX2, QSX3, QSX4, QSX5, QSX6, QSX7, QSX8, QSX9, QSX10, QSX11, QSX12, QSX13, QSX14, PPMX1, PCY1, PDY1, PDY2, PDY3, PEY1, PEY2, PEY3, PEY4, PEY5, PKY1, PKY2, PKY3, PKY4, PKY5, PKY6, PKY7, PHY1, PHY2, PVY1, PVY2, PVY3, PVY4, PPY1, PPY2, PPY3, PPY4, PPY5, RBY1, RBY2, RBY3, RBY4, RCY1, REY1, REY2, RHY1, RHY2, RVY1, RVY2, RVY3, RVY4, RVY5, RVY6, QSY1, QSY2, QSY3, QSY4, QSY5, QSY6, QSY7, QSY8, QBZ1, QBZ2, QBZ3, QBZ4, QBZ5, QBZ9, QBZ10, QCZ1, QDZ1, QDZ2, QDZ3, QDZ4, QDZ6, QDZ7, QDZ8, QDZ9, QDZ10, QDZ11, QEZ1, QEZ2, QEZ3, QEZ4, QEZ5, QHZ1, QHZ2, QHZ3, QHZ4, PPZ1, PPZ2, SSZ1, SSZ2, SSZ3, SSZ4, PDXP1, PDXP2, PDXP3, PKYP1, PDYP1, PDYP2, PDYP3, PDYP4, PHYP1, PHYP2, PHYP3, PHYP4, PECP1, PECP2, QDTP1, QCRP1, QCRP2, QBRP1, QDRP1, PRESMIN, PRESMAX, FZMIN, FZMAX, KPUMIN, KPUMAX, ALPMIN, ALPMAX, CAMMIN, CAMMAX, LFZ0, LCX, LMUX{-1}, LEX, LKX{-1}, LHX, LVX, LCY, LMUY{-1}, LEY, LKY{-1}, LKYC{-1}, LKZC{-1}, LHY, LVY, LTR, LRES, LXAL, LYKA, LVYKA, LS{-1}, LMX{-1}, LVMX, LMY{-1}, LMP, Cx0, Cy0, PCFX1, PCFX2, PCFX3, PCFY1, PCFY2, PCFY3, PCMZ1, Q_RB1, Q_RB2;
95  double zeta0{1}, zeta1{1}, zeta2{1}, zeta3{1}, zeta4{1}, zeta5{1}, zeta6{1}, zeta7{1}, zeta8{1};
96  double six{-1}, siy{-1};
97  double rtw{-1};
98  double LFX{1}, LFY{1}, LMZ{1};
99  double LFM{1};
100  int side{1};
101  bool constsix{false}, constsiy{false};
102 
103  double vx, vsx, vcx, vcy, vc, ka, ga, Kyal, alF, rhoz, dpi, phit{0}, phiF{0}, epsga{0};
104 
105  bool mck{false}, ts{false}, contactPointTransformation{true};
106 
107  std::vector<ContourFrame*> slipPoint;
108  };
109 
110 }
111 
112 #endif
virtual void plot()
plots time dependent data
Definition: element.cc:71
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: magic_formula_62.cc:429
std::vector< std::string > plotColumns
columns of time series
Definition: element.h:294
Definition: magic_formula_62.h:29
InitStage
The stages of the initialization.
Definition: element.h:64
std::vector< double > plotVector
one entry of time series
Definition: element.h:289
Definition: tyre_model.h:27
namespace MBSim
Definition: bilateral_constraint.cc:29