Error in Cosimulation Matlab- Adams in the S-function
56 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(3 个)
Wan Ding
2017-5-31
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.
5 个评论
Damian Harty
2021-3-12
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.
ADITYA RAJ SETH
2024-7-2
Hey,
I am having the same initialisation error even for the "Antenna" model. I am using ADAMS 2022 and MATLAB 2024a. Can I check whether these versions are compatible or not?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1726166/image.png)
Thanks
Aditya
mohammad ebrahimy
2021-12-18
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.
0 个评论
Johannes Korsawe
2022-11-23
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!