Menu

[ACADO] Error: A user-defined option has an invalid value

Pandar
2018-08-13
2018-08-15
  • Pandar

    Pandar - 2018-08-13

    Hello ACADO users,

    I am having some troubles with a the hybridization of an engine.
    I have found a code used in Dynamic Programming which I unseccesfully tried to implement in ACADO tool for Matlab.

    The source code used 2D and 1D maps and equations of this form:
    A = 5;
    B = (A>=0)x1+(A<0)x2;
    For maps I used the curve fitting tool offered by Matlab and approximated them through polynoms and exponentials.
    For the equations of the above form I used a properly parametrized atan function like: ((atan(A1000)2/pi) * ...

    Now the error I have is the following:

    "Writing c++ files...
    Compiling c++ files...
    Building with 'Microsoft Visual C++ 2017'.
    MEX completed successfully.

    ACADO Toolkit for Matlab - Developed by David Ariens and Rien Quirynen, 2009-2013
    Support available at http://www.acadotoolkit.org/matlab

    [ACADO] Error: A user-defined option has an invalid value
    Code: (RET_INVALID_OPTION) "

    Would it be possible that ACADO "does not like" so many atan functions? Is there a better way to define different equations beong used depending on the value of some parameters?

    Thank you in advance for your help.

     

    Last edit: Pandar 2018-08-13
  • Rien Quirynen

    Rien Quirynen - 2018-08-13

    Hi,

    You should look more carefully at your problem definition:
    you have 17 equations in total in your DAE even though you
    have 1 differential state and 15 algebraic variables, i.e., 16
    variables in total. This DAE cannot be of index 1 which is a
    requirement for the ACADO code generation tool.

    Best,
    Rien

     
  • Pandar

    Pandar - 2018-08-13

    Hi Rien,

    Thank you for your answer. You are obviously right: there was a problem of redundancy of an algebraic state. However, I just created a new one and corrected that error but still encounter the same error message.
    Could you please help me once again?

     
  • Rien Quirynen

    Rien Quirynen - 2018-08-13

    You should probably define your implicit system of differential-alglebraic equations as follows, similar to the other Matlab examples:

    f = [   0 == Te0 - (dwg*engI + p00_Te0 + p10_Te0*wg + p01_Te0*Tg + p20_Te0*wg^2 + p11_Te0*wg*Tg + p02_Te0*Tg^2 + p30_Te0*wg^3 + p21_Te0*wg^2*Tg + p12_Te0*wg*Tg^2 + p03_Te0*Tg^3); ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            0 == Tm0 - dwg*motI; ...
            0 == Ttot - (Te0.*(-atan((u-1)*100000)*2/pi) + Tm0 + Tg); ...
            0 == Te - ((atan(wg*1000)*2/pi) .* (+atan(Ttot*1000)/pi+0.5)  .* (1-u).*Ttot); ...
            0 == Tb - ((atan(wg*1000)*2/pi) .* (-atan(Ttot*1000)/pi+0.5) .* (1-u).*Ttot); ...
            0 == Tm - ((atan(wg*1000)*2/pi) .* u .* Ttot); ...
            0 == muFuel - (coeffs_muFuel(1)+ ((Te-mid(1))*gain(1))*(coeffs_muFuel(2) + ((Te-mid(1))*gain(1))*(coeffs_muFuel(3) + ((Te-mid(1))*gain(1))*coeffs_muFuel(4) + ((wg-mid(2))*gain(2))*coeffs_muFuel(5) + ((concNoxE-mid(3))*gain(3))*coeffs_muFuel(6) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(7)) + ((wg-mid(2))*gain(2))*(coeffs_muFuel(8) + ((wg-mid(2))*gain(2))*coeffs_muFuel(9) + ((concNoxE-mid(3))*gain(3))*coeffs_muFuel(10) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(11)) + ((concNoxE-mid(3))*gain(3))*(coeffs_muFuel(12) + ((concNoxE-mid(3))*gain(3))*coeffs_muFuel(13) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(14)) + ((pBoost-mid(4))*gain(4))*(coeffs_muFuel(15) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(16)))+ ((wg-mid(2))*gain(2))*(coeffs_muFuel(17) + ((wg-mid(2))*gain(2))*(coeffs_muFuel(18) + ((wg-mid(2))*gain(2))*coeffs_muFuel(19) + ((concNoxE-mid(3))*gain(3))*coeffs_muFuel(20) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(21)) + ((concNoxE-mid(3))*gain(3))*(coeffs_muFuel(22) + ((concNoxE-mid(3))*gain(3))*coeffs_muFuel(23) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(24)) + ((pBoost-mid(4))*gain(4))*(coeffs_muFuel(25) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(26)))+ ((concNoxE-mid(3))*gain(3))*(coeffs_muFuel(27) + ((concNoxE-mid(3))*gain(3))*(coeffs_muFuel(28) + ((concNoxE-mid(3))*gain(3))*coeffs_muFuel(29) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(30)) + ((pBoost-mid(4))*gain(4))*(coeffs_muFuel(31) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(32))) + ((pBoost-mid(4))*gain(4))*(coeffs_muFuel(33) + ((pBoost-mid(4))*gain(4))*(coeffs_muFuel(34) + ((pBoost-mid(4))*gain(4))*coeffs_muFuel(35)))); ...
            0 == Te_max - (a_Te_max*exp(b_Te_max*wg) + c_Te_max*exp(d_Te_max*wg)); ...
            0 == Tm_max - (a_Tm_max*exp(b_Tm_max*wg) + c_Tm_max*exp(d_Tm_max*wg)); ...
            0 == etaMotor - (p00_etaMotor + p10_etaMotor*wg + p01_etaMotor*Tm + p20_etaMotor*wg^2 + p11_etaMotor*wg*Tm + p02_etaMotor*Tm^2 + p30_etaMotor*wg^3 + p21_etaMotor*wg^2*Tm + p12_etaMotor*wg*Tm^2 + p03_etaMotor*Tm^3 + p40_etaMotor*wg^4 + p31_etaMotor*wg^3*Tm + p22_etaMotor*wg^2*Tm^2 + p13_etaMotor*wg*Tm^3 + p04_etaMotor*Tm^4 + p50_etaMotor*wg^5 + p41_etaMotor*wg^4*Tm + p32_etaMotor*wg^3*Tm^2 + p23_etaMotor*wg^2*Tm^3 + p14_etaMotor*wg*Tm^4 + p05_etaMotor*Tm^5); ... 
            0 == Pm - ((-atan((Tm)*1000)/pi+0.5) .* wg.*Tm.*etaMotor + (atan((Tm)*1000)/pi+0.5) .* wg.*Tm./etaMotor); ... 
            0 == etaCol - ((atan((Pm)*1000)/pi+0.5) + (-atan((Pm-0.01)*10000)/pi+0.5) .* 0.9); ... 
            0 == rBatt - ((atan((Pm)*1000)/pi+0.5)  .* (a_Dis*exp(b_Dis*SOC) + c_Dis*exp(d_Dis*SOC))+(-atan((Pm-0.01)*10000)/pi+0.5) .* (a_Chg*exp(b_Chg*SOC) + c_Chg*exp(d_Chg*SOC))); ... 
            0 == iBattLim - ((atan((Pm)*1000)/pi+0.5) .* maxDisch + (-atan((Pm-0.01)*10000)/pi+0.5) .* maxCharg); ...
            0 == vBatt - (p1_V*SOC^2 + p2_V*SOC + p3_V); ... 
            0 == iBatt - (etaMotor .* (vBatt-sqrt(vBatt.^2 - 4.*rBatt.*Pm))./(2.*rBatt)); ...
            0 == dot(SOC) - (iBatt/ (battCap * 3600))];
    
     
  • Pandar

    Pandar - 2018-08-15

    Hi Rien,

    It seems to work know. I was using the same equation's layout of the pendulum example applied to simulink. Strange it doesn't work. Anywhere, thank you once again.
    Best,

     
  • Pandar

    Pandar - 2018-08-15

    Hi Rien,

    Sorry for disturbing you again, but after having compiled everything, once the simulation starts in simulink, Matlab just crashes down reporting a "critical issue". I have tried ti on different computers with different matlab versions but is always giving the same result. Do you know what could this possibily be?

    Thank you,

     

    Last edit: Pandar 2018-08-15

Log in to post a comment.

MongoDB Logo MongoDB