Building Controls Virtual Test Bed
adInterfaceMCC.util.ADInterfaceMCC Class Referenceabstract

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

Inheritance diagram for adInterfaceMCC.util.ADInterfaceMCC:
Collaboration diagram for adInterfaceMCC.util.ADInterfaceMCC:

Public Member Functions

 ADInterfaceMCC (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 variables 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
< ADInterfaceMCCObjectType
readXMLConfigurationFile () throws IllegalActionException
 Read the xml configuration file, store the elements to ADInterfaceMCCObjectType ArrayList. 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[] transformArrayListString (ArrayList< String > data_str)
 Transform String Arraylist to Token Arrays. More...
 
Token[] transformArrayListDouble (ArrayList< String > data_str)
 
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 validateAttributes () throws IllegalActionException
 Validate application tag. 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 continue 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 continue if there was an error message. More...
 
String configurationFilePath
 String of configuration file path. More...
 
String schemaFileName
 Schema file path. More...
 
ArrayList
< ADInterfaceMCCObjectType
prop_arr
 Arraylist containing ADInterfaceMCCObjectType 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 ad 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...
 
ADInterfaceMCCDeviceManager adDevMan
 The ADInterfaceMCC 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
< ADInterfaceMCCObjectType
ad_arr
 ArrayList containing elements read from configuration file. More...
 
ArrayList< Integer > devins_arr
 ArrayList containing device instance number read from configuration file. More...
 
ArrayList< String > propval_arr
 ArrayList containing strings of property values read from device. More...
 
ArrayList< String > propval_arr_temp
 ArrayList temporarily holding property values read from previous time step. More...
 
int _firecount
 parameter indicate how many times executeProcess function has been run More...
 
int nDev
 Number of ADInterfaceMCC devices specified in the configuration file. More...
 
int nPro
 Number of ADInterfaceMCC 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 ADInterfaceMCCReader and ADInterfaceMCCWriter

Author
Thierry Nouidui based on Bacnet Implementation

Definition at line 118 of file ADInterfaceMCC.java.

Constructor & Destructor Documentation

adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC ( 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 129 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.configurationFile, adInterfaceMCC.util.ADInterfaceMCC.consoleArr, adInterfaceMCC.util.ADInterfaceMCC.continueWhenError, adInterfaceMCC.util.ADInterfaceMCC.errorMessage, and adInterfaceMCC.util.ADInterfaceMCC.errorSignal.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.clone().

Member Function Documentation

void adInterfaceMCC.util.ADInterfaceMCC.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 184 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC._continueWhenError, and adInterfaceMCC.util.ADInterfaceMCC.continueWhenError.

void adInterfaceMCC.util.ADInterfaceMCC.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 277 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.LS.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

void adInterfaceMCC.util.ADInterfaceMCC.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 313 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.schemaFileName.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

Object adInterfaceMCC.util.ADInterfaceMCC.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 165 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().

void adInterfaceMCC.util.ADInterfaceMCC.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 adInterfaceMCC.actor.ADInterfaceMCCReader and adInterfaceMCC.actor.ADInterfaceMCCWriter).

Exceptions
IllegalActionExceptionif error occurs and continueWhenError is false.

Definition at line 423 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC._errmsg, adInterfaceMCC.util.ADInterfaceMCC._errsig, adInterfaceMCC.util.ADInterfaceMCC._firecount, i, adInterfaceMCC.util.ADInterfaceMCC.LS, and adInterfaceMCC.util.ADInterfaceMCC.throwExceptions().

Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend().

ArrayList<ADInterfaceMCCObjectType> adInterfaceMCC.util.ADInterfaceMCC.readXMLConfigurationFile ( ) throws IllegalActionException
inline

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

This function is called by initialize(). (see adInterfaceMCC.actor.ADInterfaceMCCReader and adInterfaceMCC.actor.ADInterfaceMCCWriter).

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

Definition at line 363 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.configurationFilePath.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

void adInterfaceMCC.util.ADInterfaceMCC.removeToken ( ) throws IllegalActionException
inline

Remove tokens in previous time step.

This function is called by the fire() method of the ADInterfaceMCCReader and ADInterfaceMCCWriter.

Definition at line 645 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.actor.ADInterfaceMCCReader.fire(), and adInterfaceMCC.actor.ADInterfaceMCCWriter.fire().

void adInterfaceMCC.util.ADInterfaceMCC.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 588 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC._errmsg, adInterfaceMCC.util.ADInterfaceMCC._errsig, and adInterfaceMCC.util.ADInterfaceMCC.consout_tok.

Referenced by adInterfaceMCC.actor.ADInterfaceMCCWriter.fire().

void adInterfaceMCC.util.ADInterfaceMCC.setConfigurationFilePath ( ) throws IllegalActionException
inline

Set configuration file path.

This function is called by initialize().

Definition at line 303 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.configurationFilePath.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

abstract void adInterfaceMCC.util.ADInterfaceMCC.setSchemaFileName ( )
abstractprotected

Abstract class that sets the schema file name.

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

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

void adInterfaceMCC.util.ADInterfaceMCC.storeDataInLastTimeStep ( )
inline
boolean adInterfaceMCC.util.ADInterfaceMCC.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 410 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC._continueWhenError, and adInterfaceMCC.util.ADInterfaceMCC._firecount.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.executeProcess().

Token [] adInterfaceMCC.util.ADInterfaceMCC.transformArrayListDouble ( ArrayList< String >  data_str)
inline

Definition at line 553 of file ADInterfaceMCC.java.

References i.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend().

Token [] adInterfaceMCC.util.ADInterfaceMCC.transformArrayListString ( ArrayList< String >  data_str)
inline

Transform String Arraylist to Token Arrays.

This function is called in prepareTokensToSend().

Definition at line 546 of file ADInterfaceMCC.java.

References i.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend().

void adInterfaceMCC.util.ADInterfaceMCC.validateAttributes ( ) throws IllegalActionException
inline

Validate application tag.

This function is called by initialize(). (See adInterfaceMCC and adInterfaceMCC.actor.ADInterfaceMCCWriter and adInterfaceMCC.actor.ADInterfaceMCCReader).

Exceptions
IllegalActionExceptionif the application tag is not part of the ADInterfaceMCC Devices.

Definition at line 606 of file ADInterfaceMCC.java.

References i.

Referenced by adInterfaceMCC.actor.ADInterfaceMCCReader.initialize(), and adInterfaceMCC.actor.ADInterfaceMCCWriter.initialize().

void adInterfaceMCC.util.ADInterfaceMCC.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 620 of file ADInterfaceMCC.java.

References adInterfaceMCC.util.ADInterfaceMCC.configurationFilePath, and adInterfaceMCC.util.ADInterfaceMCC.schemaFileName.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

Member Data Documentation

boolean adInterfaceMCC.util.ADInterfaceMCC._continueWhenError
protected

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

Definition at line 689 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.attributeChanged(), and adInterfaceMCC.util.ADInterfaceMCC.throwExceptions().

String adInterfaceMCC.util.ADInterfaceMCC._errmsg
private
int adInterfaceMCC.util.ADInterfaceMCC._errsig
private

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

Definition at line 679 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.executeProcess(), adInterfaceMCC.util.ADInterfaceMCC.initialize(), and adInterfaceMCC.util.ADInterfaceMCC.sendToken().

int adInterfaceMCC.util.ADInterfaceMCC._firecount
private

parameter indicate how many times executeProcess function has been run

Definition at line 746 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.executeProcess(), adInterfaceMCC.util.ADInterfaceMCC.initialize(), and adInterfaceMCC.util.ADInterfaceMCC.throwExceptions().

ArrayList<ADInterfaceMCCObjectType> adInterfaceMCC.util.ADInterfaceMCC.ad_arr
private

ArrayList containing elements read from configuration file.

Definition at line 705 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

ADInterfaceMCCDeviceManager adInterfaceMCC.util.ADInterfaceMCC.adDevMan
protected

The ADInterfaceMCC device manager.

Definition at line 761 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

final String adInterfaceMCC.util.ADInterfaceMCC.bcvtbhome = System.getenv("BCVTB_HOME")
static
FileParameter adInterfaceMCC.util.ADInterfaceMCC.configurationFile

Parameter to specify the path for configuraton file.

Definition at line 693 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().

String adInterfaceMCC.util.ADInterfaceMCC.configurationFilePath
protected
TypedIOPort adInterfaceMCC.util.ADInterfaceMCC.consoleArr
protected

The port that send response from console.

Definition at line 666 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().

ArrayList<String> adInterfaceMCC.util.ADInterfaceMCC.consout_arr
protected

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

Definition at line 737 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize(), adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend(), and adInterfaceMCC.util.ADInterfaceMCC.storeDataInLastTimeStep().

Token [] adInterfaceMCC.util.ADInterfaceMCC.consout_tok
protected

Token array of console outputs.

Definition at line 740 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend(), and adInterfaceMCC.util.ADInterfaceMCC.sendToken().

Parameter adInterfaceMCC.util.ADInterfaceMCC.continueWhenError

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

Definition at line 686 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC(), and adInterfaceMCC.util.ADInterfaceMCC.attributeChanged().

ArrayList<Integer> adInterfaceMCC.util.ADInterfaceMCC.devins_arr
private

ArrayList containing device instance number read from configuration file.

Definition at line 710 of file ADInterfaceMCC.java.

TypedIOPort adInterfaceMCC.util.ADInterfaceMCC.errorMessage

The errorMessage port.

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

Definition at line 658 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().

Parameter adInterfaceMCC.util.ADInterfaceMCC.errorMessage_tokenInitProduction
protected

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

Definition at line 675 of file ADInterfaceMCC.java.

Parameter adInterfaceMCC.util.ADInterfaceMCC.errorMessage_tokenProductionRate
protected

The rate parameter for the errorMessage port.

Definition at line 670 of file ADInterfaceMCC.java.

TypedIOPort adInterfaceMCC.util.ADInterfaceMCC.errorSignal

The port that outputs the error signal.

Definition at line 662 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().

ArrayList<Integer> adInterfaceMCC.util.ADInterfaceMCC.exitval_arr
protected

ArrayList containing strings process exit values for each process.

Definition at line 743 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().

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

Number of ADInterfaceMCC devices specified in the configuration file.

Definition at line 764 of file ADInterfaceMCC.java.

int adInterfaceMCC.util.ADInterfaceMCC.nPro
private

Number of ADInterfaceMCC properties specified in the configuration file.

Definition at line 766 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize(), and adInterfaceMCC.util.ADInterfaceMCC.storeDataInLastTimeStep().

final String adInterfaceMCC.util.ADInterfaceMCC.osName = System.getProperty("os.name")
static

Name of the operating system.

Definition at line 758 of file ADInterfaceMCC.java.

ArrayList<ProcessBuilder> adInterfaceMCC.util.ADInterfaceMCC.proc_arr
protected
ArrayList<String> adInterfaceMCC.util.ADInterfaceMCC.propval_arr
private
ArrayList<String> adInterfaceMCC.util.ADInterfaceMCC.propval_arr_temp
private

ArrayList temporarily holding property values read from previous time step.

Definition at line 728 of file ADInterfaceMCC.java.

Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize(), and adInterfaceMCC.util.ADInterfaceMCC.storeDataInLastTimeStep().

Token [] adInterfaceMCC.util.ADInterfaceMCC.propval_tok
protected

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