Building Controls Virtual Test Bed
|
This is an abstract base class for actors that generates an output stream. More...
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... | |
This is an abstract base class for actors that generates an output stream.
It is used by ADInterfaceMCCReader
and ADInterfaceMCCWriter
Definition at line 118 of file ADInterfaceMCC.java.
|
inline |
Construct an actor with the given container and name.
container | The container. |
name | The name of this actor. |
IllegalActionException | If the actor cannot be contained by the proposed container. |
NameDuplicationException | If 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().
|
inline |
Override the base class to determine which argument is being used.
attribute | The attribute that changed. |
IllegalActionException | If the function is not recognized. |
Definition at line 184 of file ADInterfaceMCC.java.
References adInterfaceMCC.util.ADInterfaceMCC._continueWhenError, and adInterfaceMCC.util.ADInterfaceMCC.continueWhenError.
|
inline |
Check if configuration file exists.
This function is called by initialize().
IllegalActionException | if 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().
|
inline |
Check if schema file exists.
This function is called in initialize().
IllegalActionException | if 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().
|
inline |
Clone the actor into the specified workspace.
This calls the base class and then resets the type constraints.
workspace | The workspace for the new object. |
CloneNotSupportedException | If a derived class contains an attribute that cannot be cloned. |
Definition at line 165 of file ADInterfaceMCC.java.
References adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().
|
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).
IllegalActionException | if 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().
|
inline |
Initialization section, initialize variables and check possible errors.
IllegalActionException | if configuration file couldn't be found or if schema file could not be found or if operation system is Mac OS X or Linux or if ADInterfaceMCC-stack library has not been compiled. |
Definition at line 208 of file ADInterfaceMCC.java.
References adInterfaceMCC.util.ADInterfaceMCC._errmsg, adInterfaceMCC.util.ADInterfaceMCC._errsig, adInterfaceMCC.util.ADInterfaceMCC._firecount, adInterfaceMCC.util.ADInterfaceMCC.ad_arr, adInterfaceMCC.util.ADInterfaceMCC.adDevMan, adInterfaceMCC.util.ADInterfaceMCC.checkConfFileExists(), adInterfaceMCC.util.ADInterfaceMCC.checkSchemaFileExists(), adInterfaceMCC.util.ADInterfaceMCC.consout_arr, adInterfaceMCC.util.ADInterfaceMCC.exitval_arr, adInterfaceMCC.util.ADInterfaceMCC.nPro, adInterfaceMCC.util.ADInterfaceMCC.prop_arr, adInterfaceMCC.util.ADInterfaceMCC.propval_arr, adInterfaceMCC.util.ADInterfaceMCC.propval_arr_temp, adInterfaceMCC.util.ADInterfaceMCC.readXMLConfigurationFile(), adInterfaceMCC.util.ADInterfaceMCC.setConfigurationFilePath(), adInterfaceMCC.util.ADInterfaceMCC.setSchemaFileName(), and adInterfaceMCC.util.ADInterfaceMCC.validateSyntax().
|
inline |
Get tokens to send for the next timestep.
This function is called in fire(), (see adInterfaceMCC.actor.ADInterfaceMCCReader and adInterfaceMCC.actor.ADInterfaceMCCWriter).
IllegalActionException | if errors occur in executeProcess. |
Definition at line 568 of file ADInterfaceMCC.java.
References adInterfaceMCC.util.ADInterfaceMCC.consout_arr, adInterfaceMCC.util.ADInterfaceMCC.consout_tok, adInterfaceMCC.util.ADInterfaceMCC.executeProcess(), adInterfaceMCC.util.ADInterfaceMCC.proc_arr, adInterfaceMCC.util.ADInterfaceMCC.propval_arr, adInterfaceMCC.util.ADInterfaceMCC.propval_tok, adInterfaceMCC.util.ADInterfaceMCC.storeDataInLastTimeStep(), adInterfaceMCC.util.ADInterfaceMCC.transformArrayListDouble(), and adInterfaceMCC.util.ADInterfaceMCC.transformArrayListString().
Referenced by adInterfaceMCC.actor.ADInterfaceMCCReader.fire(), and adInterfaceMCC.actor.ADInterfaceMCCWriter.fire().
|
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).
IllegalActionException | if 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().
|
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().
|
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().
|
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().
|
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().
|
inline |
Store response from last time step.
This function is called in prepareTokensToSend().
Definition at line 387 of file ADInterfaceMCC.java.
References adInterfaceMCC.util.ADInterfaceMCC.consout_arr, adInterfaceMCC.util.ADInterfaceMCC.nPro, adInterfaceMCC.util.ADInterfaceMCC.propval_arr, and adInterfaceMCC.util.ADInterfaceMCC.propval_arr_temp.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend().
|
inlineprivate |
Returns true
if an exception should be thrown, or false
if only an error message should be sent to the output port.
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().
|
inline |
Definition at line 553 of file ADInterfaceMCC.java.
References i.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend().
|
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().
|
inline |
Validate application tag.
This function is called by initialize(). (See adInterfaceMCC and adInterfaceMCC.actor.ADInterfaceMCCWriter and adInterfaceMCC.actor.ADInterfaceMCCReader).
IllegalActionException | if 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().
|
inline |
Validate xml configuration file syntax.
This function is called in initialze().
IllegalActionException | if 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().
|
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().
|
private |
detailed error message
Definition at line 683 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.executeProcess(), adInterfaceMCC.util.ADInterfaceMCC.initialize(), and adInterfaceMCC.util.ADInterfaceMCC.sendToken().
|
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().
|
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().
|
private |
ArrayList containing elements read from configuration file.
Definition at line 705 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().
|
protected |
The ADInterfaceMCC device manager.
Definition at line 761 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().
|
static |
String that points to root directory of the BCVTB.
Definition at line 755 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.actor.ADInterfaceMCCReader.setSchemaFileName(), and adInterfaceMCC.actor.ADInterfaceMCCWriter.setSchemaFileName().
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().
|
protected |
String of configuration file path.
Definition at line 697 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.readXMLConfigurationFile(), adInterfaceMCC.util.ADInterfaceMCC.setConfigurationFilePath(), and adInterfaceMCC.util.ADInterfaceMCC.validateSyntax().
|
protected |
The port that send response from console.
Definition at line 666 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.ADInterfaceMCC().
|
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().
|
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().
|
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().
|
protected |
The rate parameter for the errorMessage port that declares the initial production.
Definition at line 675 of file ADInterfaceMCC.java.
|
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().
|
protected |
ArrayList containing strings process exit values for each process.
Definition at line 743 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize().
|
static |
File seperator.
Definition at line 749 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.actor.ADInterfaceMCCReader.setSchemaFileName(), and adInterfaceMCC.actor.ADInterfaceMCCWriter.setSchemaFileName().
|
static |
Line Seperator.
Definition at line 752 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.checkConfFileExists(), adInterfaceMCC.actor.ADInterfaceMCCWriter.checkNumberOfInput(), and adInterfaceMCC.util.ADInterfaceMCC.executeProcess().
|
private |
Number of ADInterfaceMCC devices specified in the configuration file.
Definition at line 764 of file ADInterfaceMCC.java.
|
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().
|
static |
Name of the operating system.
Definition at line 758 of file ADInterfaceMCC.java.
|
protected |
Arraylist containing processes to be executed in console.
Definition at line 719 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.actor.ADInterfaceMCCReader.fire(), adInterfaceMCC.actor.ADInterfaceMCCWriter.fire(), and adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend().
|
protected |
Arraylist containing ADInterfaceMCCObjectType read from configuration file.
Definition at line 715 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.actor.ADInterfaceMCCWriter.addPropertyValue(), adInterfaceMCC.actor.ADInterfaceMCCWriter.checkNumberOfInput(), adInterfaceMCC.actor.ADInterfaceMCCReader.fire(), and adInterfaceMCC.util.ADInterfaceMCC.initialize().
|
private |
ArrayList containing strings of property values read from device.
Definition at line 723 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.initialize(), adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend(), and adInterfaceMCC.util.ADInterfaceMCC.storeDataInLastTimeStep().
|
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().
|
protected |
Token array of property values.
Definition at line 732 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.prepareTokensToSend(), and adInterfaceMCC.actor.ADInterfaceMCCReader.sendToken().
|
protected |
Schema file path.
Definition at line 701 of file ADInterfaceMCC.java.
Referenced by adInterfaceMCC.util.ADInterfaceMCC.checkSchemaFileExists(), adInterfaceMCC.actor.ADInterfaceMCCReader.setSchemaFileName(), adInterfaceMCC.actor.ADInterfaceMCCWriter.setSchemaFileName(), and adInterfaceMCC.util.ADInterfaceMCC.validateSyntax().