Building Controls Virtual Test Bed
|
Methods for interfacing Modelica as a client to the BCVTB using BSD sockets. More...
#include <stddef.h>
Go to the source code of this file.
Functions | |
int | establishModelicaClient (const char *const docname) |
Establishes a connection to the socket. More... | |
int | exchangeModelicaClient (int sockfd, int flaWri, int *flaRea, double simTimWri, double *dblValWri, size_t nDblWri, double *simTimRea, double *dblValRea, size_t nDblRea) |
Exchanges data with the socket. More... | |
int | closeModelicaClient (int sockfd) |
Closes the inter process communication socket. More... | |
Methods for interfacing Modelica as a client to the BCVTB using BSD sockets.
This file provides methods that allow a Modelica simulation environment to establish a socket connection. The methods that need to be called are establishModelicaClient()
at the start of the simulation, and then exchangeModelicaClient
in each time step. After the simulation, closeModelicaClient
should be called to close the socket.
Definition in file bcvtb.h.
int closeModelicaClient | ( | int | sockfd | ) |
Closes the inter process communication socket.
sockfd | Socket file descripter. |
close
function. Definition at line 24 of file bcvtb.c.
References closeipc(), and sendclientmessage().
int establishModelicaClient | ( | const char *const | docname | ) |
Establishes a connection to the socket.
This method establishes the client socket.
docname | Name of xml file that contains the socket information. |
Definition at line 3 of file bcvtb.c.
References establishclientsocket().
int exchangeModelicaClient | ( | int | sockfd, |
int | flaWri, | ||
int * | flaRea, | ||
double | simTimWri, | ||
double * | dblValWri, | ||
size_t | nDblWri, | ||
double * | simTimRea, | ||
double * | dblValRea, | ||
size_t | nDblRea | ||
) |
Exchanges data with the socket.
Clients can call this method to exchange data through the socket.
sockfd | Socket file descripter |
flaWri | Communication flag to write to the socket stream. |
flaRea | Communication flag read from the socket stream. |
simTimWri | Current simulation time in seconds to write. |
dblValWri | Double values to write. |
nDblWri | Number of double values to write. |
intValWri | Integer values to write. |
nIntWri | Number of integer values to write. |
boolValWri | Boolean values to write. |
nBooWri | Number of boolean values to write. |
simTimRea | Current simulation time in seconds read from socket. |
dblValRea | Double values read from socket. |
nDblRea | Number of double values to read. |
intValRea | Integer values read from socket. |
nIntRea | Number of integer values to read. |
booValRea | Boolean values read from socket. |
nBooRea | Number of boolean values to read. |
send
or read
, or a negative value if an error occured. Definition at line 8 of file bcvtb.c.
References exchangedoubleswithsocket().