Building Controls Virtual Test Bed
dummy/utilSocket.h File Reference
This graph shows which files directly or indirectly include this file:

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 main 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 sendclienterror (const int *sockfd, const int *flaWri)
 Writes an error 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...
 

Function Documentation

int closeipc ( int *  sockfd)

Closes the inter process communication socket.

Parameters
sockfdSocket file descripter.
Returns
Zero.
Parameters
sockfdSocket file descripter.
Returns
The return value of the close function.

Definition at line 1193 of file util/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.

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 468 of file util/utilSocket.c.

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 1119 of file util/utilSocket.c.

int getmainversionnumber ( )

Returns the main version number.

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.

Returns the main version number.

Returns the main version number of the client.

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

Returns
The main version number, or a negative value if an error occured.

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 443 of file util/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.

This method parses the xml file for the socket number.

Parameters
docnameName of xml file.
Returns
the socket port number if successful, or -1 if an error occured.

Definition at line 413 of file util/utilSocket.c.

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

Referenced by establishclientsocket().

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

Writes an error flag to the socket stream.

This method should be used by clients if they experience an error and need to terminate the socket connection.

Deprecated:
Use sendclientmessage instead
Parameters
sockfdSocket file descripter
flaWrishould be set to a negative value.

Definition at line 155 of file dummy/utilSocket.h.

References sendclientmessage().

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.

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.

Deprecated:
Use sendclientmessage instead
Parameters
sockfdSocket file descripter
flaWriFlag to be sent to the BCVTB

Definition at line 785 of file util/utilSocket.c.

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

Referenced by closeModelicaClient(), main(), and sendclienterror().