chrono::cosimul::ChCosimulation Class Reference

Description

Class for cosimulation interface.

Typically, a C::E program can instance an object from this class and use it to communicate with a 3rd party simulation tool at each time step. The communication is based on TCP sockets, where vectors of scalar values are exchanged back and forth. In this case, C::E will work as a server, waiting for a client to talk with.

#include <ChCosimulation.h>

Public Member Functions

 ChCosimulation (ChSocketFramework &mframework, int n_in_values, int n_out_values)
 Create a co-simulation interface. More...
 
bool WaitConnection (int aport)
 Wait for a client to connect to the interface, on a given port, and wait until not connected. More...
 
bool SendData (double mtime, ChVectorConstRef mdata)
 Exchange data with the client, by sending a vector of floating point values over TCP socket connection (values are double precision, little endian, 4 bytes each) Simulator actual time is also passed as first value.
 
bool ReceiveData (double &mtime, ChVectorRef mdata)
 Exchange data with the client, by receiving a vector of floating point values over TCP socket connection (values are double precision, little endian, 4 bytes each) External time is also received as first value.
 

Constructor & Destructor Documentation

◆ ChCosimulation()

chrono::cosimul::ChCosimulation::ChCosimulation ( ChSocketFramework mframework,
int  n_in_values,
int  n_out_values 
)

Create a co-simulation interface.

Parameters
mframeworksocket framework
n_in_valuesnumber of scalar variables to receive each timestep
n_out_valuesnumber of scalar variables to send each timestep

Member Function Documentation

◆ WaitConnection()

bool chrono::cosimul::ChCosimulation::WaitConnection ( int  aport)

Wait for a client to connect to the interface, on a given port, and wait until not connected.

aport is a free port number, for example 50009.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_cosimulation/ChCosimulation.h
  • /builds/uwsbel/chrono/src/chrono_cosimulation/ChCosimulation.cpp