Menu

AdvisorProxy

Olov Stahl
Attachments
AdvisorProxy-small.png (41206 bytes)

The ME3Gas Advisor Proxy

The Advisor Proxy is a standalone runtime component that subscribes to energy consumption data from the ME3Gas middleware, and continuously feeds this data to the Advisor energy management cost control system from Resourcekraft Ltd (see figure below). This allows for the use of Advisor's advanced data analysis and presentation capabilities, enabling for instance organizations to understand how and where energy is being consumed at any given time, potentially across many sites. Note that the use of Advisor requires collaboration with Resourcekraft.

Compiling the Advisor Proxy code

The Advisor Proxy is written in Java, and the code resides in the AdvisorProxy sub-directory of the ME3Gas svn root directory. After checking out the code, follow the steps below to compile the Advisor proxy. Note that the instructions assume that you are using Eclipse.

  1. Download and install Eclipse if you haven't done so already
  2. In the File menu, choose Import... and then Existing Projects into Workspace under General.
  3. In the window that appears, select the AdvisorProxy/trunk sub-directory as the project root directory and press Finish'. You should now see a AdvisorProxy project in the Eclipse's Package Explorer* (normally on the left in the Eclipse UI). You may notice that the project has some errors.
  4. In order to compile the source, you need to install a "webservice package". We have used CXF. To install a CFX plugin in Eclipse, select the Help menu, and then Install new software.... In the Work with: * entry at the top of the appearing window, type http://download.eclipse.org/webtools/milestones/, then select CFX Web Services under Web Tools Platform ... and press Finish* at the bottom.
  5. Right click the AdvisorProxy project in the Package Explorer and select Build Path -> Configure Build Path... in the menu that appears.
  6. Select the Libraries tab in the Properties for AdvisorProxy window, and if there is no CFX library in the list, press the Add Library... button. Select CFX runtime and the Apache CFX 2.7.3 (or whatever version is installed). Press Finish.
  7. Back at the Properties for AdvisorProxy window, press the Order and Export tab, make sure that the CFX library appears above the JRE System Library. If not, move it upwards.
  8. Close the properties window. The errors of the AdvisorProxy project should now have disappeared and you are ready to run the code.

Configuring Advisor Proxy

The proxy uses a configuration file named proxy.properties to read values of settings parameters. The file should be located in the same directory from where the proxy is started. In the AdvisorProxy/trunk directory there is a sample properties file. The file is structured as a flat list of param=value lines, where param is a proxy settings parameter name, and value is the value to use when running the proxy. Comments are indicated using the # symbol. For instance:

# This is a comment
someParam=someValue


The most important settings parameters that must be given for the proxy to be able to run are:

AdvisorUrl - The URL the proxy should use to send data to Advisor. This address is typically provided by Resourcekraft. The URL should include the protocol (e.g., http). For instance:

 AdvisorUrl=http://a.b.c/d/e


AdvisorDadId - The Data Acquisition Device (DAD) identifier to use when sending reports to Advisor. The value of this parameter needs to be agreed with Resourcekraft.

HydraEventManagerUrl - The web service endpoint on which the middleware Event Manager can be reached. This is used by the proxy to set up subscriptions to energy consumption events generated by the middleware. The default value is http://127.0.0.1:8124/Service/Meta?wsdl, assuming that the proxy and event manager are running on the same host.

 HydraEventManagerUrl = http://127.0.0.1:8124/Service/Meta?wsdl


The properties file also need to specify a list of datasource parameters. A datasource in Advisor is an entity which reports consumption data, and each source is identified by a name. When the proxy sends reports to Advisor is thus needs to provide the appropriate datasource names in order for Advisor to know which sources the report concerns. However, in the middleware, sources of energy consumption will typically not have the same name as in Advisor. That is, a source will (for practical reasons) typically have one name in the middleware, and another name in Advisor. The config file must thus provide information allowing the proxy to map from the middleware name to the Advisor name. This is done by adding settings parameters of the form below, one for each datasource:

 datasource0.AdvisorId = 
 datasource0.HydraId = 
 datasource1.AdvisorId = 
 datasource1.HydraId = 
 ...


The numbering should start on 0 and increase by 1 for each datasource. It doesn't matter in which order datasources are specified, the only thing that matters is the values of AdvisorId and HydraId, specifying the datasource name in Advisor and the middleware respectively.

Running Advisor Proxy

From within Eclipse the proxy can be run simply by pressing the Run button while the project is selected in the Package Explorer. It is also possible to create a runnable jar, which can then be used to start the proxy from the command line. In Eclipse, select Export... in the File menu and then Runnable JAR file under Java.

When the proxy is started it creates a log file called (by default) AdvisorProxy_DATE.txt, where DATE is in the format YYYY-MM-DD_HH-MM-SS, for instance AdvisorProxy_2013-09-28_14-23-18.txt. Log files are created in a directory called logs (by default). Note that this directory needs to be created by hand, if it doesn't exists no logs will be generated.


Related

Wiki: Home

MongoDB Logo MongoDB