Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to fix error in Simulink / ADAMS co-simulation: "Could not connect to ADAMS server"?

Asked by Chris Zirker on 2 Feb 2011

I am running co-simulations with Matlab/Simulink and ADAMS and am having problems. For some reason, I have started getting the following error about 90% of the time when running simulations:

Error reported by S-function 'adams_plant' in 'climber_main_model/adams_sub/ADAMS Plant/S-Function': Could not connect to ADAMS server

I can't figure out what the problem is, as I can open up ADAMS by itself with no trouble. I am able to connect to the licencing server too, because our license expires soon and a command window pop up and informs me of such (I wouldn't get this if it wasn't connecting at all, or else how would it know anything about the expiration date of the license?) Does anyone know how I can fix this? It's very frustrating!

4 Comments

Chris Zirker on 4 Feb 2011

Thanks for your response!

Yes, it is definitely that block since it contains the plant which is attempting to communicate with ADAMS via ADAMS/Controls. I don't think I have the source code, as it is generated by ADAMS, but I'll see if I can figure out a way to get it.

Arnaud Miege on 4 Feb 2011

This would probably be more appropriate on an ADAMS forum, since the S-function interface between Simulink and ADAMS is not provided by MathWorks. They should be able to help.

Mark Biesiada on 4 Feb 2011

I'm not sure how the block actually connects to the ADAMS server, but if it uses something like TCP/IP, you could probably use a packet sniffer like WireShark to compare what kind of network traffic patterns are present when you successfully connect and what kind of patters are present when you can't. It might be a network issue, as opposed to something specifically in Simulink or ADAMS, and this that would be a good next step to iron it out.

Chris Zirker

Products

1 Answer

Answer by Chris Zirker on 8 Feb 2011
Accepted answer

Solved. The problem is that there is insufficient time for Simulink to connect to the ADAMS server, so obviously what needs to happen to fix this is to somehow increase that time. The way to do this is to create a new Windows environment variable to override the default value (which is 5 seconds) to a bigger value, like 10 or 20 seconds. To be more specific, here's a step by step on a Windows XP machine:

1.) Go "My Computer", right click and open "Properties" 2.) Go to the "Advanced" tab and click "Environment Variables" 3.) Create a new system variable, and call it ADAMS_CONTROLS_WTIME 4.) Set the value to something greater than the default, which is 5 (unit of time is seconds). The greater the value, the more likely it is that you will get a connection and not get an error, but the longer of a time you will have to wait for each and every simulation to run. 10 seconds seems to work best for me. 5.) Click "OK" a bunch of times, then restart MATLAB. You may need to reboot your whole machine, I'm not sure.

Hopefully that does it! It seems to have fixed it for me.

1 Comment

pouya jamali on 14 Jul 2011

thank you very much,your answer was helpfull,now I have a problem with autotuning pid parameters in an adams & simulink co-simulation model !when i click on tune in pid controller block ,see this message :
linearization failed: The plant model in the PID loop linearizes to zero, and therefore cannot be used in PID controller design. This problem occurs when one or more blocks in the PID loop have zero gain or the feedback loop is not physically closed. Click "Continue" to launch the PID Tuner and obtain a new plant model in the "Obtain plant model" dialog. Click "Cancel" to return to the PID Controller block dialog. how can i solve it?

Chris Zirker

Contact us