Building Controls Virtual Test Bed
bcvtb.h File Reference

Methods for interfacing Modelica as a client to the BCVTB using BSD sockets. More...

#include <stddef.h>
Include dependency graph for bcvtb.h:
This graph shows which files directly or indirectly include this file:

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...
 

Detailed Description

Methods for interfacing Modelica as a client to the BCVTB using BSD sockets.

Author
Michael Wetter, Simulation Research Group, LBNL, MWett.nosp@m.er@l.nosp@m.bl.go.nosp@m.v
Date
2009-05-04

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.

See Also
establishModelicaClient
exchangeModelicaClient
closeModelicaClient

Definition in file bcvtb.h.

Function Documentation

int closeModelicaClient ( int  sockfd)

Closes the inter process communication socket.

Parameters
sockfdSocket file descripter.
Returns
The return value of the 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.

Parameters
docnameName of xml file that contains the socket information.
Returns
The socket file descripter, or a negative value if an error occured.

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.

Parameters
sockfdSocket file descripter
flaWriCommunication flag to write to the socket stream.
flaReaCommunication flag read from the socket stream.
simTimWriCurrent simulation time in seconds to write.
dblValWriDouble values to write.
nDblWriNumber of double values to write.
intValWriInteger values to write.
nIntWriNumber of integer values to write.
boolValWriBoolean values to write.
nBooWriNumber of boolean values to write.
simTimReaCurrent simulation time in seconds read from socket.
dblValReaDouble values read from socket.
nDblReaNumber of double values to read.
intValReaInteger values read from socket.
nIntReaNumber of integer values to read.
booValReaBoolean values read from socket.
nBooReaNumber of boolean values to read.
See Also
int establishclientsocket(uint16_t *portNo)
Returns
The exit value of send or read, or a negative value if an error occured.

Definition at line 8 of file bcvtb.c.

References exchangedoubleswithsocket().