QSS Lap Time simulator Bicycle model with pitch using CasADi and Ipopt. Having problems that it's not converging. #3659
Unanswered
TimAlbertsson
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
We are having problems that CasADi and the Ipopt solver is not converging. We also have a model that does not include pitch and only has the Longitudinal acceleration as opti.variable. For the Bicycle model with pitch, we are using the CasADi interpolant to interpolate values from our aero simulations. These values are directly affected by pitch, and these also affect pitch and therefore we set this to a opti.variable. We also have the weight transfer that is also affecting pitch and the loads on the front and rear wheels (this is also a opti.variable). Based on the initial guess we can get different many iterations but after a few it's not converging. Are we doing anything wrong or what could be wrong?
You can see the matlab code:
`%% Pitch Interp variables
CoPSplit_interp = interpolant('CoPSplit_interp', 'linear', {PitchAngle}, CoPSplitPitch);
CL_interp = interpolant('CL_interp', 'linear', {PitchAngle}, CLPitch);
CD_interp = interpolant('CD_interp', 'linear', {PitchAngle}, CDPitch);
FrontalArea_interp = interpolant('FrontalArea_interp', 'linear', {PitchAngle}, FrontalAreaPitch);
LonAcc = opti.variable();
PitchAcc = opti.variable();
opti.set_initial(LonAcc, InitialLonAcc)
opti.set_initial(PitchAcc, InitialPitchAcc)
% Determine the pitch angle based on the value of PitchAcc
CoPSplitAcc = CoPSplit_interp(PitchAcc);
CLAcc = CL_interp(PitchAcc);
CDAcc = CD_interp(PitchAcc);
FrontalAreaAcc = FrontalArea_interp(PitchAcc);
DfAcc = 1/2.CLAcc.rho.v(i).^2.FrontalAreaAcc; % Downforce [N]
DrAcc = 1/2.CDAcc.rho.v(i).^2.FrontalAreaAcc; % Drag force [N]
DfFrontAcc = DfAcc.(1 - CoPSplitAcc);
DfRearAcc = DfAcc.CoPSplitAcc;
WeightTransferAcc = TotalMass * LonAcc * CoGHeight/WheelBase;
zFAcc = z0 - (DfFrontAcc - WeightTransferAcc(1 - AntiLiftF))/(2kF) - (DfFrontAcc - WeightTransferAcc)/(2ktF);
zRAcc = z0 - (DfRearAcc + WeightTransferAcc(1 - AntiSquatR))/(2kR) - (DfRearAcc + WeightTransferAcc)/(2ktR);
PitchAcc = asin((zRAcc - zFAcc)/WheelBase);
NormalFrontAcc = MassFrontg + DfFrontAcc - WeightTransferAcc;
NormalRearAcc = MassRearg + DfRearAcc + WeightTransferAcc;
ForceFrontAcc = NormalFrontAcc * (muLon0 - muLonDropNormalFrontAcc/2);
ForceRearAcc = NormalRearAcc * (muLon0 - muLonDropNormalRearAcc/2);
RollResistanceAcc = RollingResistance * NormalFrontAcc + RollingResistance * NormalRearAcc;
TotalForceAcc = (ForceFrontAcc + ForceRearAcc - DrAcc - RollResistanceAcc);
% Casadi Ipopt Solve Lon Acc
opti.subject_to(LonAcc * TotalMass == TotalForceAcc)
opti.minimize(-TotalForceAcc)
opti.solver('ipopt', opts);`
This is the error:
Solver failed: Error in Opti::solve [OptiNode] at .../casadi/core/optistack.cpp:157:
.../casadi/core/optistack_internal.cpp:996: Assertion "return_success(accept_limit)" failed:
Solver failed. You may use opti.debug.value to investigate the latest values of variables. return_status is 'Maximum_Iterations_Exceeded
Beta Was this translation helpful? Give feedback.
All reactions