XML Import with make_explicit

2012-07-13
2013-04-11
  • Ruge, Vitalij

    Ruge, Vitalij - 2012-07-13

    Hi all,
    the option = {"make_explicit": True} see not work correct for Mayer objective terms. The atTime terms don't see dealt correct?
    Example:

    optimization test(objective =  y(finalTime),
                       startTime = 0,
                       finalTime = 1)
        Real y(start = 1);
        Real x1(start = 1, fixed =true, min = 0, max = 1);
        input Real u(free = true, min = 0, max = 5);
    equation
        der(x1) = u*x1;
        y = x1^2;
    end test;
    
    Mayer objective terms
    y.atTime( 1 )
    

    Best,
    Vitalij

     
  • Joel Andersson

    Joel Andersson - 2012-07-13

    Hello!

    This part of the code has been rewritten. In the new version, this should work. I have yet to commit the changes and merge them with the trunk, though. I will inform you when this happens. Please be aware that the SymbolicOCP class is still not mature, so expect some upcoming changes in the API.

    Joel

     
  • Joel Andersson

    Joel Andersson - 2012-07-13

    Hello again Vitalij!

    The implementation of make_explicit has now been updated in CasADi's trunk. JModelica's trunk is still looked to the old CasADi revision, but the syntax has been updated in a branch of JModelica: https://svn.jmodelica.org/branches/CasADiRedesign. We'll reintegrate it with JModelica's trunk shortly. The changes does not influence the generated XML-files, just JModelica's implementation of collocation, so updating only CasADi should work fine for you I guess.

    I am not sure this solved your problem, but maybe you could check? If it doesn't work, please provide a bit longer printout from CasADi.

    Instead of passing option = {"make_explicit": True}, try calling ocp.makeExplicit(). The former will be removed shortly. And also note that the new implementation of makeExplicit only applies to the differential states. If you want to make algebraic states explicit (i.e. eliminate them), you should call ocp.eliminateAlgebraic().

    Hope this helped, otherwise please ask again. As I've already said, this part of the code is not yet stable, although we are using it, but I am very happy for people like you trying it out.

    Kinds regards,
    Joel

     
  • Ruge, Vitalij

    Ruge, Vitalij - 2012-07-16

    Hello Joel :)
    thanks you! It's a big fun to use casADi. It's very powerful tool.

    Sorry for my late answer.
    ocp.eliminateAlgebraic() see not work for the function ocp.mterm?
    My not very nice solution for my problem is:

    # xtime = x.atTime(tf,True) ….
    ztime = veccat()
    ztime_ = veccat()

    M = SXFunction(, )
    M.init()

    W = SXFunction(,)
    w = W.eval()

    z = veccat()
    M = M.eval()

    If y is Algebraic and have a min or max, it's willl not be add to the path-constrains?

    Best Vitalij and a nice start in the week

     
  • Joel Andersson

    Joel Andersson - 2012-07-16

    Hello Vitalij,

    Ah, ok, now I understand what you mean. You are right, it's a bug. I have created a ticket for this. It might take a few weeks before I'll be able to look at it, since I'm going on vacation soon.

    Joel

     
  • Ruge, Vitalij

    Ruge, Vitalij - 2012-07-16

    Thanks you, Joel.
    I wish you a nice vacation :).

    Best,
    Vitalij

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks