Menu

grampc_run_Sfct.obj

2021-12-15
2021-12-16
  • Hoomaan Moradi

    Hoomaan Moradi - 2021-12-15

    Hello,
    First of all, I would like to thank you for providing GRAMPC.
    My hardware can only send and receive data by Simulink. Therefore, I am trying to run GRAMPC in the Hardware mode of Simulink. I have to write my code in C and use S-function to call it in Simulink. I wrote the MPC code based on the BallOnPlate example. Everything is OK on the Simulation mode in Simulink and GRAMPC can be run and control the model. However, when it comes to running on the Hardware mode of Simulink, in the compiling process, Simulink returns this error:

    q_tanks_1.obj
    rt_matrx.obj
    rt_printf.obj
    q_tanks_1_data.obj
    q_tanks_1_main.obj
    rtGetInf.obj
    rtGetNaN.obj
    rt_nonfinite.obj
    rt_sim.obj
    grampc_run_Sfct.obj
    LINK : fatal error LNK1181: cannot open input file 'grampc_run_Sfct.obj'
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.EXE"' : return code '0x49d'
    Stop.

    I would be grateful if someone lets me know how I can genrate the 'grampc_run_Sfct.obj', and/or whether it is possible to generate a .C code and give it to the S-function instead of the .mexw64. Many thanks.

    Best regards,
    Hoomaan

     
  • Andreas Völz

    Andreas Völz - 2021-12-15

    Dear Hoomann,

    I am not sure what you mean with the hardware mode of Simulink. However, your error message indicates that the S-function is not found by the linker. The solution could be to perform the same steps that are required for using the S-Function with DSpace real-time systems. This is described at the end of Section 5.2.2 of the GRAMPC documentation:

    "Furthermore, the S-function grampc run Sfct.c satisfies the additional restrictions of the Matlab
    code generator. Therefore, the block can be used in models implemented for running on various hardware platforms, such as dSpace real-time systems. Please note that especially in case of dSpace applications, the include folders grampc root/include and grampc root/matlab/include as well as all C source files in grampc root/src, the source file of the S-function grampc root/matlab/src/grampc run Sfct.c and the problem function must be listed as additional build information in the Model Configuration Parameters of the Simulink model under Code Generation / Custom Code. It is recommended to use absolute paths at least for the S-function file."

    So, please try to add the source files and the include folders in the Code Generation settings and report if this solves your problem.

    Regards,
    Andreas Völz

     
  • Hoomaan Moradi

    Hoomaan Moradi - 2021-12-16

    Dear Andreas,

    Thank you so much for your quick reply. Thanks to your guidance, after adding the include folders and source files in Code Generation / Custom Code, the MPC block could be run. The include folders and source files which have been listed in Custom Code section, are shown in the attached pics. Thank you once again.

    Best regards,
    Hoomaan

     

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.