Building Controls Virtual Test Bed
bacnet.util.BACnet Class Referenceabstract

This is an abstract base class for actors that generates an output stream. More...

Inheritance diagram for bacnet.util.BACnet:
Collaboration diagram for bacnet.util.BACnet:

Public Member Functions

 BACnet (CompositeEntity container, String name) throws NameDuplicationException, IllegalActionException
 Construct an actor with the given container and name. More...
 
Object clone (Workspace workspace) throws CloneNotSupportedException
 Clone the actor into the specified workspace. More...
 
void attributeChanged (Attribute attribute) throws IllegalActionException
 Override the base class to determine which argument is being used. More...
 
void initialize () throws IllegalActionException
 Initialization section, initialize variiables and check possible errors. More...
 
void checkConfFileExists () throws IllegalActionException
 Check if configuration file exists. More...
 
void setConfigurationFilePath () throws IllegalActionException
 Set configuration file path. More...
 
void checkSchemaFileExists () throws IllegalActionException
 Check if schema file exists. More...
 
ArrayList< BACnetObjectTypereadXMLConfigurationFile () throws IllegalActionException
 Read the xml configuration file, store the elements to BACnetObjectType ArrayList. More...
 
ArrayList< Integer > readDeviceArray () throws IllegalActionException
 Read the device array from the configuration file. More...
 
void checkConnection () throws IllegalActionException
 Check if the connection is lost. More...
 
void validateDevice () throws IllegalActionException
 validate device specified in configuration file. More...
 
void validateObjectType () throws IllegalActionException
 Validate Object Type. More...
 
void validatePropertyName () throws IllegalActionException
 Validate property name. More...
 
void validateAttributes () throws IllegalActionException
 Validate application tag, priority and index. More...
 
ArrayList< BACnetCompletePropertyreadDevicePropertyArray () throws IllegalActionException
 Read all properties listed in the configuration file. More...
 
void storeDataInLastTimeStep ()
 Store response from last time step. More...
 
void executeProcess (ArrayList< ProcessBuilder > process_arr) throws IllegalActionException
 Execute Processes, store results to consoleoutput_arr and exitvalue-arr. More...
 
Token[] transformArrayList (ArrayList< String > data_str)
 Transform String Arraylist to Token Arrays. More...
 
void prepareTokensToSend () throws IllegalActionException
 Get tokens to send for the next timestep. More...
 
void sendToken () throws IllegalActionException
 Sends the error signal to the errorSignal port, the error message to the errorMessage port, and the console output to the consoleArr. More...
 
void validateSyntax () throws IllegalActionException
 Validate xml configuration file syntax. More...
 
void removeToken () throws IllegalActionException
 Remove tokens in previous time step. More...
 

Public Attributes

TypedIOPort errorMessage
 The errorMessage port. More...
 
TypedIOPort errorSignal
 The port that outputs the error signal. More...
 
Parameter continueWhenError
 Parameter to control whether to contine if there was an error message. More...
 
FileParameter configurationFile
 Parameter to specify the path for configuraton file. More...
 

Static Public Attributes

static final String FS = System.getProperty("file.separator")
 File seperator. More...
 
static final String LS = System.getProperty("line.separator")
 Line Seperator. More...
 
static final String bcvtbhome = System.getenv("BCVTB_HOME")
 String that points to root directory of the BCVTB. More...
 
static final String osName = System.getProperty("os.name")
 Name of the operating system. More...
 

Protected Member Functions

abstract void setSchemaFileName ()
 Abstract class that sets the schema file name. More...
 

Protected Attributes

TypedIOPort consoleArr
 The port that send response from console. More...
 
Parameter errorMessage_tokenProductionRate
 The rate parameter for the errorMessage port. More...
 
Parameter errorMessage_tokenInitProduction
 The rate parameter for the errorMessage port that declares the initial production. More...
 
boolean _continueWhenError
 Parameter to control whether to contine if there was an error message. More...
 
String configurationFilePath
 String of configuration file path. More...
 
String schemaFileName
 Schema file path. More...
 
ArrayList< BACnetCompletePropertyprop_arr
 Arraylist containing BACnetCompleteProperty read from configuration file. More...
 
ArrayList< ProcessBuilder > proc_arr
 Arraylist containing processes to be executed in console. More...
 
Token[] propval_tok
 Token array of property values. More...
 
ArrayList< String > consout_arr
 ArrayList containing strings of response from device for both reading and writing process. More...
 
Token[] consout_tok
 Token array of console outputs. More...
 
ArrayList< Integer > exitval_arr
 ArrayList containing strings process exit values for each process. More...
 
BACnetDeviceManager bacDevMan
 The BACnet device manager. More...
 

Private Member Functions

boolean throwExceptions ()
 Returns true if an exception should be thrown, or false if only an error message should be sent to the output port. More...
 

Private Attributes

int _errsig
 signal to indicate whether there is an error, 0 means right, 1 means wrong More...
 
String _errmsg
 detailed error message More...
 
ArrayList< BACnetObjectTypebot_arr
 ArrayList containing elements read from configuration file. More...
 
ArrayList< Integer > devins_arr
 ArrayList containing device instance number read from configuration file. More...
 
ArrayList< Integer > devcon_arr
 ArrayList containing device instance number that are found in the network. More...
 
ArrayList< String > propval_arr
 ArrayList containing strings of prperty values read from device. More...
 
ArrayList< String > propval_arr_temp
 ArrayList temporarily holding property values read from previous time step. More...
 
ArrayList< String > consout_arr_temp
 ArrayList temporarily holding console outputs read from previous time step. More...
 
int _firecount
 parameter indicate how many times executeProcess function has been run More...
 
int nDev
 Number of BACnet devices specified in the configuration file. More...
 
int nPro
 Number of BACnet properties specified in the configuration file. More...
 

Detailed Description

This is an abstract base class for actors that generates an output stream.

It is used by BACnetReader and BACnetWriter

Author
Edward A. Lee, Steve Neuendorffer, modified by Zhengwei Li

Definition at line 117 of file BACnet.java.

Constructor & Destructor Documentation

bacnet.util.BACnet.BACnet ( CompositeEntity  container,
String  name 
) throws NameDuplicationException, IllegalActionException
inline

Construct an actor with the given container and name.

Parameters
containerThe container.
nameThe name of this actor.
Exceptions
IllegalActionExceptionIf the actor cannot be contained by the proposed container.
NameDuplicationExceptionIf the container already has an actor with this name.

Definition at line 128 of file BACnet.java.

References bacnet.util.BACnet.configurationFile, bacnet.util.BACnet.consoleArr, bacnet.util.BACnet.continueWhenError, bacnet.util.BACnet.errorMessage, and bacnet.util.BACnet.errorSignal.

Referenced by bacnet.util.BACnet.clone().

Member Function Documentation

void bacnet.util.BACnet.attributeChanged ( Attribute  attribute) throws IllegalActionException
inline

Override the base class to determine which argument is being used.

Parameters
attributeThe attribute that changed.
Exceptions
IllegalActionExceptionIf the function is not recognized.

Definition at line 183 of file BACnet.java.

References bacnet.util.BACnet._continueWhenError, and bacnet.util.BACnet.continueWhenError.

void bacnet.util.BACnet.checkConfFileExists ( ) throws IllegalActionException
inline

Check if configuration file exists.

This function is called by initialize().

Exceptions
IllegalActionExceptionif file path is null or configuration file could not be found.

Definition at line 288 of file BACnet.java.

References bacnet.util.BACnet.LS.

Referenced by bacnet.util.BACnet.initialize().

void bacnet.util.BACnet.checkConnection ( ) throws IllegalActionException
inline

Check if the connection is lost.

This function is called by validateDevice()

Exceptions
IllegalActionExceptionif connection with BACnetDevice is lost.

Definition at line 427 of file BACnet.java.

References bacnet.util.BACnet.devcon_arr.

Referenced by bacnet.util.BACnet.validateDevice().

void bacnet.util.BACnet.checkSchemaFileExists ( ) throws IllegalActionException
inline

Check if schema file exists.

This function is called in initialize().

Exceptions
IllegalActionExceptionif schema file couldn't be found.

Definition at line 324 of file BACnet.java.

References bacnet.util.BACnet.schemaFileName.

Referenced by bacnet.util.BACnet.initialize().

Object bacnet.util.BACnet.clone ( Workspace  workspace) throws CloneNotSupportedException
inline

Clone the actor into the specified workspace.

This calls the base class and then resets the type constraints.

Parameters
workspaceThe workspace for the new object.
Returns
A new actor.
Exceptions
CloneNotSupportedExceptionIf a derived class contains an attribute that cannot be cloned.

Definition at line 164 of file BACnet.java.

References bacnet.util.BACnet.BACnet().

void bacnet.util.BACnet.executeProcess ( ArrayList< ProcessBuilder >  process_arr) throws IllegalActionException
inline

Execute Processes, store results to consoleoutput_arr and exitvalue-arr.

This function is called in fire(), (see bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter).

Exceptions
IllegalActionExceptionif error occurs and continueWhenError is false.

Definition at line 639 of file BACnet.java.

References bacnet.util.BACnet._errmsg, bacnet.util.BACnet._errsig, bacnet.util.BACnet._firecount, i, bacnet.util.BACnet.LS, and bacnet.util.BACnet.throwExceptions().

Referenced by bacnet.util.BACnet.prepareTokensToSend().

void bacnet.util.BACnet.prepareTokensToSend ( ) throws IllegalActionException
inline
ArrayList<Integer> bacnet.util.BACnet.readDeviceArray ( ) throws IllegalActionException
inline

Read the device array from the configuration file.

This function is called by initialize(). (see bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter)

Returns
ArrayList containing device instance integers
Exceptions
IllegalActionExceptionif error occurs while reading configuration file.

Definition at line 405 of file BACnet.java.

References bacnet.util.BACnet.bot_arr.

Referenced by bacnet.util.BACnet.initialize().

ArrayList<BACnetCompleteProperty> bacnet.util.BACnet.readDevicePropertyArray ( ) throws IllegalActionException
inline

Read all properties listed in the configuration file.

This file is called by initialize() (see bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter).

Returns
ArrayList of BACnetCompleteProperty of all the properties in the configuration file.
Exceptions
IllegalActionExceptionif the device or object instance number is not integer.

Definition at line 572 of file BACnet.java.

References bacnet.util.BACnet.bot_arr, and i.

Referenced by bacnet.util.BACnet.initialize().

ArrayList<BACnetObjectType> bacnet.util.BACnet.readXMLConfigurationFile ( ) throws IllegalActionException
inline

Read the xml configuration file, store the elements to BACnetObjectType ArrayList.

This function is called by initialize(). (see bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter)

Returns
ArrayList of BACnetObjectType
Exceptions
IllegalActionExceptionif either SAXException or ParserConfiguration Exception has been caught.

Definition at line 375 of file BACnet.java.

References bacnet.util.BACnet.configurationFilePath.

Referenced by bacnet.util.BACnet.initialize().

void bacnet.util.BACnet.removeToken ( ) throws IllegalActionException
inline

Remove tokens in previous time step.

This function is called by the fire() method of the BACnetReader and BACnetWriter.

Definition at line 841 of file BACnet.java.

Referenced by bacnet.actor.BACnetReader.fire(), and bacnet.actor.BACnetWriter.fire().

void bacnet.util.BACnet.sendToken ( ) throws IllegalActionException
inline

Sends the error signal to the errorSignal port, the error message to the errorMessage port, and the console output to the consoleArr.

This function is called by fire().

Definition at line 804 of file BACnet.java.

References bacnet.util.BACnet._errmsg, bacnet.util.BACnet._errsig, and bacnet.util.BACnet.consout_tok.

Referenced by bacnet.actor.BACnetWriter.fire().

void bacnet.util.BACnet.setConfigurationFilePath ( ) throws IllegalActionException
inline

Set configuration file path.

This function is called by initialize().

Definition at line 314 of file BACnet.java.

References bacnet.util.BACnet.configurationFilePath.

Referenced by bacnet.util.BACnet.initialize().

abstract void bacnet.util.BACnet.setSchemaFileName ( )
abstractprotected

Abstract class that sets the schema file name.

The class that implements this function needs to assign the variable schemaFileName

Referenced by bacnet.util.BACnet.initialize().

void bacnet.util.BACnet.storeDataInLastTimeStep ( )
inline
boolean bacnet.util.BACnet.throwExceptions ( )
inlineprivate

Returns true if an exception should be thrown, or false if only an error message should be sent to the output port.

Returns
true if an exception should be thrown, or false if only an error message should be sent to the output port

Definition at line 626 of file BACnet.java.

References bacnet.util.BACnet._continueWhenError, and bacnet.util.BACnet._firecount.

Referenced by bacnet.util.BACnet.executeProcess().

Token [] bacnet.util.BACnet.transformArrayList ( ArrayList< String >  data_str)
inline

Transform String Arraylist to Token Arrays.

This function is called in prepareTokensToSend().

Definition at line 768 of file BACnet.java.

References i.

Referenced by bacnet.util.BACnet.prepareTokensToSend().

void bacnet.util.BACnet.validateAttributes ( ) throws IllegalActionException
inline

Validate application tag, priority and index.

This function is called by initialize(). (See bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter).

Exceptions
IllegalActionExceptionif the application tag is not part of the BACnet standard, or the priority or the index is not an integer.

Definition at line 542 of file BACnet.java.

References i.

Referenced by bacnet.actor.BACnetWriter.initialize().

void bacnet.util.BACnet.validateDevice ( ) throws IllegalActionException
inline

validate device specified in configuration file.

This function is called in initialize(). (see bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter).

Exceptions
IllegalActionExceptionif device instance is not an integer or cannot be found in the network.

Definition at line 443 of file BACnet.java.

References bacnet.util.BACnet.checkConnection(), bacnet.util.BACnet.devcon_arr, i, and bacnet.util.BACnet.LS.

Referenced by bacnet.util.BACnet.initialize().

void bacnet.util.BACnet.validateObjectType ( ) throws IllegalActionException
inline

Validate Object Type.

This function is called by initialize(). (See bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter).

Exceptions
IllegalActionExceptionif one object type in configuration file is not part of the standard or if the object instance number is not integer.

Definition at line 475 of file BACnet.java.

References bacnet.util.BACnet.bot_arr, and i.

Referenced by bacnet.util.BACnet.initialize().

void bacnet.util.BACnet.validatePropertyName ( ) throws IllegalActionException
inline

Validate property name.

This function is called by initialize(). (See bacnet.actor.BACnetReader and bacnet.actor.BACnetWriter).

Exceptions
IllegalActionExceptionif property name is not part of the standard.

Definition at line 515 of file BACnet.java.

References i.

Referenced by bacnet.util.BACnet.initialize().

void bacnet.util.BACnet.validateSyntax ( ) throws IllegalActionException
inline

Validate xml configuration file syntax.

This function is called in initialze().

Exceptions
IllegalActionExceptionif configuration file couldn't be found or syntax is against the schema file.

Definition at line 816 of file BACnet.java.

References bacnet.util.BACnet.configurationFilePath, and bacnet.util.BACnet.schemaFileName.

Referenced by bacnet.util.BACnet.initialize().

Member Data Documentation

boolean bacnet.util.BACnet._continueWhenError
protected

Parameter to control whether to contine if there was an error message.

Definition at line 885 of file BACnet.java.

Referenced by bacnet.util.BACnet.attributeChanged(), and bacnet.util.BACnet.throwExceptions().

String bacnet.util.BACnet._errmsg
private

detailed error message

Definition at line 879 of file BACnet.java.

Referenced by bacnet.util.BACnet.executeProcess(), bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.sendToken().

int bacnet.util.BACnet._errsig
private

signal to indicate whether there is an error, 0 means right, 1 means wrong

Definition at line 875 of file BACnet.java.

Referenced by bacnet.util.BACnet.executeProcess(), bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.sendToken().

int bacnet.util.BACnet._firecount
private

parameter indicate how many times executeProcess function has been run

Definition at line 954 of file BACnet.java.

Referenced by bacnet.util.BACnet.executeProcess(), bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.throwExceptions().

BACnetDeviceManager bacnet.util.BACnet.bacDevMan
protected

The BACnet device manager.

Definition at line 969 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize().

final String bacnet.util.BACnet.bcvtbhome = System.getenv("BCVTB_HOME")
static

String that points to root directory of the BCVTB.

Definition at line 963 of file BACnet.java.

Referenced by bacnet.actor.BACnetReader.setSchemaFileName(), and bacnet.actor.BACnetWriter.setSchemaFileName().

ArrayList<BACnetObjectType> bacnet.util.BACnet.bot_arr
private

ArrayList containing elements read from configuration file.

Definition at line 901 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize(), bacnet.util.BACnet.readDeviceArray(), bacnet.util.BACnet.readDevicePropertyArray(), and bacnet.util.BACnet.validateObjectType().

FileParameter bacnet.util.BACnet.configurationFile

Parameter to specify the path for configuraton file.

Definition at line 889 of file BACnet.java.

Referenced by bacnet.util.BACnet.BACnet().

String bacnet.util.BACnet.configurationFilePath
protected
TypedIOPort bacnet.util.BACnet.consoleArr
protected

The port that send response from console.

Definition at line 862 of file BACnet.java.

Referenced by bacnet.util.BACnet.BACnet().

ArrayList<String> bacnet.util.BACnet.consout_arr
protected

ArrayList containing strings of response from device for both reading and writing process.

Definition at line 938 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize(), bacnet.util.BACnet.prepareTokensToSend(), and bacnet.util.BACnet.storeDataInLastTimeStep().

ArrayList<String> bacnet.util.BACnet.consout_arr_temp
private

ArrayList temporarily holding console outputs read from previous time step.

Definition at line 943 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.storeDataInLastTimeStep().

Token [] bacnet.util.BACnet.consout_tok
protected

Token array of console outputs.

Definition at line 947 of file BACnet.java.

Referenced by bacnet.util.BACnet.prepareTokensToSend(), and bacnet.util.BACnet.sendToken().

Parameter bacnet.util.BACnet.continueWhenError

Parameter to control whether to contine if there was an error message.

Definition at line 882 of file BACnet.java.

Referenced by bacnet.util.BACnet.attributeChanged(), and bacnet.util.BACnet.BACnet().

ArrayList<Integer> bacnet.util.BACnet.devcon_arr
private

ArrayList containing device instance number that are found in the network.

Definition at line 911 of file BACnet.java.

Referenced by bacnet.util.BACnet.checkConnection(), bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.validateDevice().

ArrayList<Integer> bacnet.util.BACnet.devins_arr
private

ArrayList containing device instance number read from configuration file.

Definition at line 906 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize().

TypedIOPort bacnet.util.BACnet.errorMessage

The errorMessage port.

By default, the type of this errorMessage is constrained to be at least that of the input.

Definition at line 854 of file BACnet.java.

Referenced by bacnet.util.BACnet.BACnet().

Parameter bacnet.util.BACnet.errorMessage_tokenInitProduction
protected

The rate parameter for the errorMessage port that declares the initial production.

Definition at line 871 of file BACnet.java.

Parameter bacnet.util.BACnet.errorMessage_tokenProductionRate
protected

The rate parameter for the errorMessage port.

Definition at line 866 of file BACnet.java.

TypedIOPort bacnet.util.BACnet.errorSignal

The port that outputs the error signal.

Definition at line 858 of file BACnet.java.

Referenced by bacnet.util.BACnet.BACnet().

ArrayList<Integer> bacnet.util.BACnet.exitval_arr
protected

ArrayList containing strings process exit values for each process.

Definition at line 951 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize().

final String bacnet.util.BACnet.FS = System.getProperty("file.separator")
static
final String bacnet.util.BACnet.LS = System.getProperty("line.separator")
static
int bacnet.util.BACnet.nDev
private

Number of BACnet devices specified in the configuration file.

Definition at line 972 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize().

int bacnet.util.BACnet.nPro
private

Number of BACnet properties specified in the configuration file.

Definition at line 974 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.storeDataInLastTimeStep().

final String bacnet.util.BACnet.osName = System.getProperty("os.name")
static

Name of the operating system.

Definition at line 966 of file BACnet.java.

ArrayList<ProcessBuilder> bacnet.util.BACnet.proc_arr
protected

Arraylist containing processes to be executed in console.

Definition at line 920 of file BACnet.java.

Referenced by bacnet.actor.BACnetWriter.fire(), bacnet.actor.BACnetReader.initialize(), and bacnet.util.BACnet.prepareTokensToSend().

ArrayList<BACnetCompleteProperty> bacnet.util.BACnet.prop_arr
protected

Arraylist containing BACnetCompleteProperty read from configuration file.

Definition at line 916 of file BACnet.java.

Referenced by bacnet.actor.BACnetReader.initialize(), and bacnet.util.BACnet.initialize().

ArrayList<String> bacnet.util.BACnet.propval_arr
private

ArrayList containing strings of prperty values read from device.

Definition at line 924 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize(), bacnet.util.BACnet.prepareTokensToSend(), and bacnet.util.BACnet.storeDataInLastTimeStep().

ArrayList<String> bacnet.util.BACnet.propval_arr_temp
private

ArrayList temporarily holding property values read from previous time step.

Definition at line 929 of file BACnet.java.

Referenced by bacnet.util.BACnet.initialize(), and bacnet.util.BACnet.storeDataInLastTimeStep().

Token [] bacnet.util.BACnet.propval_tok
protected

Token array of property values.

Definition at line 933 of file BACnet.java.

Referenced by bacnet.util.BACnet.prepareTokensToSend(), and bacnet.actor.BACnetReader.sendToken().

String bacnet.util.BACnet.schemaFileName
protected

The documentation for this class was generated from the following file: