Building Controls Virtual Test Bed
processError.m
Go to the documentation of this file.
1 function retVal = processError(mException, sockfd, signal)
2 % PROCESSERROR - Processes a MATLAB exception
3 %
4 % retVal = processError(mException, sockfd, signal) processes
5 % a MATLAB exception.
6 % The function writes an error message to the console.
7 % Next, if the BCVTB library can be loaded
8 % and if sockfd is not a negative number, then
9 % this function sends 'signal' to the socket.
10 %
11 % If sending a message to the socket was successful, then
12 % 'retVal' will be zero.
13 %
14 % This function will also load the library libbcvtb unless it is
15 % already loaded.
16 
17 % Revision history
18 % ----------------
19 % 2011-10-20 MWetter@lbl.gov: First version.
20 
21 % Print error message to console
22 fprintf(['*** Error: ', getReport(mException)]);
23 fprintf([' ', 'Trying to send client error from MATLAB to the BCVTB.']);
24 
25 % Load library if it is not already loaded
26 BCVTBLIB=getBCVTBLibName();
29 end
30 
31 if ~libisloaded(BCVTBLIB)
32  msg='Error. Failed to load BCVTB library.';
33  ME = MException('BCVTB:ConnectError', ...
34  msg);
35  throw(ME);
36  retVal = -1;
37 else
38  retVal = sendClientError(sockfd, signal);
39 end
function sockfd
loadlibrary(LIBBCVTB,... 'matlabSocket.h',... 'includepath', './..',... 'mfilename', 'bcvtb.m')%-------------------------------------------------------------------%Check if Simulink is installed on this system.If Simulink is%is not installed
function sockfd will be a positive integer for the socket file descriptor In case of error
if ~libisloaded(BCVTBLIB) loadlibrary(BCVTBLIB
function if the BCVTB library can be loaded and if sockfd is not a negative then this function sends signal to the socket If sending a message to the socket was successful
Definition: processError.m:1
throw(ME)
fprintf([' ', 'Trying to send client error from MATLAB to the BCVTB.'])
ME
Definition: processError.m:33
if bcvtb
Definition: processError.m:28
end Establish the socket connection if and(libisloaded(BCVTBLIB),(status==1)) sockfd
static void XMLCALL end(void *data, const char *el)
Call back functions that will be used by the expat xml parser.
Definition: util/utilXml.c:707
if(strcmp(os,'windows'))%have Windows LIBBCVTB
Load library if it is not already loaded BCVTBLIB
Definition: processError.m:26
function[retVal, flaRea, simTimRea, dblValRea]
function retVal
Definition: processError.m:1
function if the BCVTB library can be loaded and if sockfd is not a negative number
Definition: processError.m:1