Error in Cosimulation Matlab- Adams in the S-function

103 views (last 30 days)
Good day all,
I am currently trying to realize a cosimulation using Matlab 2014b and Adams 2014. I generate the S-function / block using Adams, and then create the whole Simulink scheme. When I run the Simulink scheme, I receive the following error message :
Error reported by S-function 'adams_plant' in 'Test/adams_sub/ADAMS Plant/S-Function':
Error in Adams(server) simulation startup. AEI_Initialize: Error in initialization.
All the concerned files (Control_Plant.m , simulink scheme, original cmd) are in the same file, as well as adams_sys.m , adams_sys_.slx, adams_sys_template.mdl and io_template.mdl .
Do you have any idea of the issue and how to correct it ?
Thanks,
Gabriel.

Answers (3)

Wan Ding
Wan Ding on 31 May 2017
You need to check the following addresses to be sure that “ADAMS” built the "adams_plant.mexw32" or "adams_plant.mexw64"file:
Addresses in your computer: If you use “ADAMS 32-bit”: C:\MSC.Software\MD_Adams\2011\controls\win32 If you use “ADAMS 64-bit”: C:\MSC.Software\MD_Adams_x64\2011\controls\win64
If it's missing, you need to download from ADAMS.
Please note that, if you use “MATLAB 64-bit”, you have to compile your model in “ADAMS 64-bit”. Because, “Matlab 64-bit” does not support the “.mexw32” files. And in this case you have the same error.
  4 Comments
Daniele Nanni
Daniele Nanni on 15 Feb 2021
Hi, did you find the solution to the problem?
I have the same problem, at the beginning of the simulation. I'm sure that there are no errors in the model, becouse in Adams Simulation everything works fine.
Can it be that, there are some errors in the communications between Adams View and Matlab? Becouse I have the following error message which is at the beginning of the communications between the two softwares.
An error occurred while running the simulation and the simulation was terminated
Caused by:
Damian Harty
Damian Harty on 12 Mar 2021
Well, that isn't it.
The issue is that it is model-specific. I've successfully run many cosimulations in the past and I've set up cosimulations recently with the world-famous antenna example and with a motion-controlled tyre test rig model I build eons ago.
They both work fine.
Now I have a full vehicle model I want to use as a plant model. Works just fine - inside A/View. Hook up a dummy variable to the model - doesn't initialise. No output.
It's not the mex file.

Sign in to comment.


mohammad ebrahimy
mohammad ebrahimy on 18 Dec 2021
Hi
I've been trying to connect adams with simulink using adams controll plugin
and i dealt with different errors from simulink, and sometimes simulnk crashed without any error displayed.
finally i solved it by observing these notes:
1. pick a good "working directory" in your adams model. so you better not to set your working directory inside adams software or adams instalation file directory. also no extera files should be in that folder, just your adams model simulink files and those files created by adams controll should be there. you can change working directory in your model choose: files - select directory.
2. in adams controll plant setting, do not write anything for "user define library name" just keep it blank. also the "adams Host name" must be the name of your computer in case your model created on another computer, you should change it.
3. if you have this error in adams: "There are (number of) objects named "character" in the database", you just need to run a simple simulation to renew it.
4. if you built connection files using adams controll plant in the past you cannot built it again since adams dosen't remove previous files, you should remove all the previous files and/or other adams control project files then press ok.
5. DO NOT PRESS SAVE IN adams_sys.slx I did that once and it corrupt my adams instalation files (if you have same problem, go to 8) . you better not run it, just copy the orange block in your simulink model.
6. before runing simulink model make sure matlab current folder is your working directory. if not, you should run the m file built by adams and then press "change folder".
7. sometimes adams version and matlab version are not Compatible. (I tried to connect adams 2020 with matlab 2014 and failed but adams 2020 with matlab 2016 worked properly.)
8. if you think you might damaged your adams files. you can repair it with adams CD or Installation file.
9. some of my notes are not needed so if you run the simulink without error you don't need to change anything else so good luck.

Johannes Korsawe
Johannes Korsawe on 23 Nov 2022
I ran into the same error. My problem had been deprecated ADAMS model/maneuvre files. I used ADAMS model/maneuvre files from BEFORE i exported the controls plant.
My fix:
Use Controls plugin to export Plant for Matlab first. Export model/maneuvre again with "files only" option.
Start Matlab again. Use adams_sys to build new (!) adams_sys_ model. Take cosim block from there and build up new control system model.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!