Output Variable Tracking

Launch Netbeans and open the BasicPlugin project (created in Simple Plug-in Instructions)
This example will add an output variable to the BasicPlugin Project.
Output variables are used to track single values for each event in an FRA compute. Output Variables are stored in the Simulation DSS file for a WAT FRA simulation as Paired Data Records. The paired data storage limits the output variables to double values.
For this implementation, we will store the maximum value computed by the basic plug-in for each event it computes in an FRA compute sequence.
The first step is adding an implements to the class definition on the BasicPlugin class. The interface we wish to implement is the OutputPlugin Interface.

Code Example 55 Implementing OutputPlugin
This will require three new methods to be added:
List<OutputVariable> getAvailOutputVariables(ModelAlternative ma)
This provides a list of all output variables trackable by this specific model alternative. In our case, it is just one value because there is only one DataLocation for this plug-in.
boolean computeOutputVariables(list<OutputVariable>, ModelAlternative ma)
This is where the output variable is set. If a user selects output variables, the list will have the selected output variables. In our case, our list will only ever be one variable, although there are situations could be no variables. The model alternative will be the instance of the model alternative used to compute the event.
boolean hasOutputVariables(ModelAlternative ma)
This is to determine if the specific model alternative has any output variables. In this case we are going to hard code this method to always return true.

Code Example 56 Implementing hasOutputVariables()
Since the BasicPlugin delegated most tasks about the DataLocations to the BasicPluginAlternative, it would be best for that plug-in to define the output variables based on the model alternative's data locations. Since it is known with this application that there will only ever be one input data location, this product can be hard coded to provide only one output variable.

Code Example 57 Implementing getAvailOutputVariables()
Finally, a value needs to be provided for each event computed. The call sequence is as follows:
WAT will call compute on the Plugin.compute(ModelAlternative ma) which will be delegated to the basic plug-in alternative compute method. BasicPluginAlternative was modified to track the max value as a double. After the BasicPlugin returns true to the WAT on the compute method, the WAT will request the output variable for the list of OutputVariables tracked by this model alternative.
To accommodate this, the basicPluginAlternative needs to track the double after a compute, but only for immediately after the compute. The following three steps provide that functionality, and then the final step provide the access to the value in the BasicPlugin class.

Code Example 58 Output Variable variables
A getter for that value was provided:

Code Example 59 Implementing getOutputValue()
The value as a part of the compute sequence was computed:

Code Example 60 Implementing UpdateTimeSeries()
Back at the BasicPlugin class, the following code was written to take advantage of that.

Code Example 61 Implementing computeOutputVariables()
Although out output variables should only ever be a list of length 1, if the list changes due to changes in the code, this method would keep working.