Building Controls Virtual Test Bed
dummy/utilSocket.c File Reference
#include "utilSocket.h"
Include dependency graph for dummy/utilSocket.c:

Go to the source code of this file.

Functions

int getsocketportnumber (const char *const docname)
 Gets the port number for the BSD socket communication. More...
 
int getmainversionnumber ()
 Returns the version number. More...
 
int establishclientsocket (const char *const docname)
 Establishes a connection to the socket. More...
 
int sendclientmessage (const int *sockfd, const int *flaWri)
 Writes a message flag to the socket stream. More...
 
int exchangedoubleswithsocket (const int *sockfd, const int *flaWri, int *flaRea, const int *nDblWri, int *nDblRea, double *simTimWri, double dblValWri[], double *simTimRea, double dblValRea[])
 Exchanges data with the socket. More...
 
int closeipc (int *sockfd)
 Closes the inter process communication socket. More...
 
int main (int argc, const char *argv[])
 

Function Documentation

int closeipc ( int *  sockfd)

Closes the inter process communication socket.

Parameters
sockfdSocket file descripter.
Returns
Zero.

Definition at line 186 of file dummy/utilSocket.c.

int establishclientsocket ( 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
Negative one.

Definition at line 130 of file dummy/utilSocket.c.

References BUFFER_LENGTH, f1, fprintf(), getsockethost(), getsocketportnumber(), REQUIRED_READ_LENGTH, REQUIRED_WRITE_LENGTH, retVal, and sockfd.

int exchangedoubleswithsocket ( const int *  sockfd,
const int *  flaWri,
int *  flaRea,
const int *  nDblWri,
int *  nDblRea,
double *  simTimWri,
double  dblValWri[],
double *  simTimRea,
double  dblValRea[] 
)

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.
nDblWriNumber of double values to write.
nDblReaNumber of double values to read.
simTimWriCurrent simulation time in seconds to write.
dblValWriDouble values to write.
simTimReaCurrent simulation time in seconds read from socket.
dblValReaDouble values read from socket.
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 169 of file dummy/utilSocket.c.

References exchangewithsocket().

int getmainversionnumber ( )

Returns the version number.

Returns the main version number.

Returns the main version number of the client.

This method returns the version number. A negative return value is used in a dummy dll to check in EnergyPlus whether the BCVTB has been installed.

Returns
Negative one.

Definition at line 119 of file dummy/utilSocket.c.

References MAINVERSION.

int getsocketportnumber ( const char *const  docname)

Gets the port number for the BSD socket communication.

This method parses the xml file for the socket number.

Parameters
docnameName of xml file.
Returns
Negative one.

Definition at line 107 of file dummy/utilSocket.c.

References BUFFER_LENGTH, f1, fprintf(), getxmlvalue(), i, and retVal.

int main ( int  argc,
const char *  argv[] 
)

Definition at line 191 of file dummy/utilSocket.c.

int sendclientmessage ( const int *  sockfd,
const int *  flaWri 
)

Writes a message flag to the socket stream.

This method should be used by clients if they need to send a flag to the BCVTB.

The flag flaWri is defined as follows: +1: simulation reached end time. -1: simulation terminates due to an (unspecified) error. -10: simulation terminates due to error during initialization. -20: simulation terminates due to error during time integration.

Parameters
sockfdSocket file descripter
flaWriFlag to be sent to the BCVTB
Returns
Negative one.

Definition at line 150 of file dummy/utilSocket.c.

References f1, fprintf(), readbufferfromsocket(), REQUIRED_READ_LENGTH, retVal, and writetosocket().

Referenced by sendclienterror().