hexagon logo

Remote control ADAMS session from external program (like Optimus)

As I'm in charge for monitoring the ADAMS usage in our installation, I noticed a group of users having started ADAMS massively more often than normal. (we're talking about 6 digit start numbers)

It turned out that they use Optimus to run some suspension optimization with ADAMS which involved a lot of closing/restarting ADAMS sessions.

Haven't looked in the details, but I assume it's stuff like opening A/Car, opening the base assembly, modifying parameter or hardpoint, run the analysis, close the session.

I'd be eager to save some "obsolete" time in that process.

The most basic solution I have would be to create an acar.bin in the working dir that already has all plugins loaded and the model open. 

But the most elegant solution would be a possibility to have Otimus "remote control" one single ADAMS session like

opem ADAMS

open model

modify parameter/hardpoint

loop  

    run iteration n

    update subsystem/assembly (aka reset to initial state)

    run analysis

    If target not fulfilled 

       Optimus reading the analysis results and making up a new parameter set

       goto loop start

   else

      break

close ADAMS

Would that be possible, for example via the Python threading (aka import threading)

If yes: are there examples to learn from ?

Parents
  • Hi Martin!

    Have a look at 'Command Server' in the Adams docs. It lets you put a session of View/Car into a 'listening' mode where you can send commands. It was created for external tools to do what you've outlined above. 

    Basically you start your Car session and load a model (using standard cmd scripting), then you can issue this cmd: 

       command_server start

    Then, in an external process (such as Python..) you can connect to Adams over tcp/ip and issue commands. Here is an example from the docs: 

    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect(("localhost", 5002))
    cmd = "cmd marker modify marker_name = mar_13333 vx = 0"
    client_socket.send(cmd.encode())
    response = client_socket.recv(1024).decode()
    The Command Server understands two main commands: 
    - cmd: run a cmd string
    - query: evaluate an expression and return the result. 
    So it is possible to run any cmd command to simulate the model, change something, return a result, run again, etc. 
    Hopefully that works as expected? 
    Good luck, 
    Kent
  • Hi Kent,

    that was the answer I was hoping for.
    I'll test that in the next weeks and hopefully it'll save a lot of overhead in the optimization process.

    Press thumbs that the communication won't be blocked by some stupid internal security measures (as far as I remember we have special firewall rules for each software, i.e. ADAMS may only be allowed to contact the license server and nothing else ...)

  • Well, it wouldn't be a Hexagon product, if it'd work out of the box, would it?

    Our ADAMS 2024.1.1 on RH8 Linux is missing the command

    command_server start



    The error message is:
    ERROR: 'command_server' is not a valid keyword.

    And now as I type that, I remember having tested this before with the same result and also having reported this to Hexagon ...
    Dated from August 2'nd I reported this to Karsten Thielecke and he confirmed that a case was created - unfortunately I don't have a case number.

    The feedback was, that it works on Windoze.

Reply
  • Well, it wouldn't be a Hexagon product, if it'd work out of the box, would it?

    Our ADAMS 2024.1.1 on RH8 Linux is missing the command

    command_server start



    The error message is:
    ERROR: 'command_server' is not a valid keyword.

    And now as I type that, I remember having tested this before with the same result and also having reported this to Hexagon ...
    Dated from August 2'nd I reported this to Karsten Thielecke and he confirmed that a case was created - unfortunately I don't have a case number.

    The feedback was, that it works on Windoze.

Children