Menu

GRAMPC in MATLAB/Simulink R2012b - Crash

Ingo Walch
2019-07-24
2019-07-26
  • Ingo Walch

    Ingo Walch - 2019-07-24

    Hi everyone,

    i'm testing your toolbox in MATLAB R2012b at the moment because i'm planning to design an MPC for some simulations in an old Simulink project environment. Therefore I try to run your PMSM example.

    Basically the whole thing works out with your "grampc_R2010a_TEMPLATE.mdl" and I can simulate it. However about every second time I run "initData.m" MATLAB crashes completely.

    Moreover it happened twice that after the crash MATLAB would not start again and I had to reinstall it completely. In this case the following error log shows up in the MATLAB path when trying to launch MATLAB:

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff843ce36f2, pid=15868, tid=492
    #
    # JRE version: 6.0_17-b04
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (14.3-b01 mixed mode windows-amd64 )
    # Problematic frame:
    # C  [ntdll.dll+0xa36f2]
    #
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #
    

    Does someone have an idea what the problem could be? I also attached the whole error log file. With MATLAB 2018b everything works fine.

    Any help on this would be awesome! Thank you!

    best regards
    Ingo

    UPDATE:
    The problem occurs while executing the line

    grampc = CmexFiles.grampc_estim_penmin_Cmex(grampc,1);
    

    in "initData.m". When I comment out that line everything works just fine without a crash.
    It seems MATLAB R2012b has some problem with the "grampc_estim_penmin_Cmex.mexw64" Mex file. So for the moment my solution is to just manually estimate/set c_min.

     

    Last edit: Ingo Walch 2019-07-26
  • Ingo Walch

    Ingo Walch - 2019-07-26

    Another Problem I noticed with GRAMPC in MATLAB R2012b regards the problem function build using "grampc_make_probfct.m".
    In lines 131 & 132 one have to use "regexp" instead of "strsplit" because R2012b doesn't recognize the function "strsplit".

    So I replaced

    probfctfilename = strsplit(probfct,'/');
    probfctfilename = strsplit(probfctfilename{end},'\');
    

    by

    probfctfilename = regexp(probfct,'/','split');
    probfctfilename = regexp(probfctfilename{end},'\','split');
    

    Maybe this info is useful for someone who also sticks to old MATLAB versions like me..

    BR

     
  • Andreas Völz

    Andreas Völz - 2019-07-26

    Hello Ingo,

    thanks for tracking the error down to the call
    grampc = CmexFiles.grampc_estim_penmin_Cmex(grampc,1);
    in initData.m. I suspect that the error stems from having only one output argument here (grampc), but setting two output arguments (grampc and status) in the Cmex-function. Could you please verify this by changing the call to
    [grampc, cmin] = CmexFiles.grampc_estim_penmin_Cmex(grampc,1);
    and report your results?

    Regards,
    Andreas

     
    👍
    1
  • Ingo Walch

    Ingo Walch - 2019-07-26

    Hi Andreas,

    you're right that was the problem!
    I changed the call to two output arguments now and it works out. No crashes anymore.

    Thank you very much,
    Ingo

     

    Last edit: Ingo Walch 2019-07-26
  • Andreas Völz

    Andreas Völz - 2019-07-26

    Hello Ingo,

    thanks for testing and the quick feedback. We will add a corresponding bugfix in the next version of GRAMPC.

    Regards,
    Andreas

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.