Archive

Archive for February, 2009

Flex Custom Column Chart ItemRenderer

February 22nd, 2009

I’ve spend a lot of time lately trying to figure out how to draw on chart components and how to use Degrafa (graphics framework for Flex). I thought it’d be cool to have a column chart change colors programmatically based on its value.

This example demonstrates how to:
  • Createa custom ItemRenderer and apply it to a series
  • Use Degrafa to convert numbers to a color in the spectrum
  • Convert pixel to chart coordinates to smoothly change column colors

See the example below, more code and comments after the break (right click to view source):

Read more…

  • Share/Save/Bookmark

Tucker Flex , , ,

AX Program Object: Trend Analyzer

February 12th, 2009

I’ll be posting various AX program objects and modules all fully commented and free to use how you wish.  This program object calculates the min, max, average, sum, and number of records for a selected history and time range.  The code shows how to run a BQL query programmatically and demonstrates a history rollup.

Property sheet of Trend Analyzer

Property sheet of Trend Analyzer

Read more…

  • Share/Save/Bookmark

Tucker Niagara , , , ,

BQL Query to array of BObjects

February 10th, 2009

Sometimes the batch editor doesn’t cut it and I’m required to write a program to interact with a certain type of component. I could write a robot to traverse through the nav tree but I usually use a BQL query to do the work. The following is a method I often use to grab an Array of BObjects for a given BQL query.

public BObject[] getObjectsFromBql(String bqlString)
{   
   BOrd curOrd;
 
   // Grab reference to local station
   BStation station = (BStation) BOrd.make("station:|slot:/").get();
 
   // Run the BQL query and get the resulting table
   BITable result = (BITable) BOrd.make(bqlString).get(station);
 
   ColumnList columns = result.getColumns();
 
   // Note we're assuming column 0 is "slotPath"     
   Column slotPathColumn = columns.get(0);
   TableCursor c = (TableCursor) result.cursor();
 
   // Create the Array of BObjects to return
   BObject[] objs = new BObject[result.size()];
 
   int i = 0;
   while (c.next())
   {      
      curOrd = BOrd.make(c.get(slotPathColumn).toString());
 
      // Resolve each ord to a BObject, store in our Array
      objs[i++] = (BObject)curOrd.resolve(station).get();
   }
 
   return objs;   
}

Example to get an Array of all BStatusNumerics in ‘fault’:


getObjectsFromBql("select slotPath from baja:StatusNumeric where status.isFault")

Note: You must specify ’slotPath’ as the first column in the query

  • Share/Save/Bookmark

Tucker Niagara ,

BQL Demystified - Part II

February 7th, 2009

One of the most powerful but underutilized features of Niagara AX is BQL queries. John Sublett wrote an excellent post on Niagara-Central called BQL Demystified - Part I that covers basic syntax and meaning. This post will extend John’s post by demonstrating the Query Builder, running custom queries, and other examples.

The example we’re going to try is how to view the name of all Numeric Points whose name starts with “SpaceTemp”. Open the Query Builder (File>Open>Query Builder) and configure it as shown below.

Example of input data for a Niagara AX BQL Query

Example of input data for a Niagara AX BQL Query

After pressing OK you’ll get a table wtih the resulting query.  To view the generated query, hold CTRL and press L (this shows your current ORD).  You should see somethign similar to this:

station:|slot:/|bql:select navOrd from control:NumericPoint where name = 'SpaceTemp'

The cool part is that you can write and run your own query by copying it into the Open Ord dialog (CTRL+L).

More Examples:

View all Numeric Points whose name contains the word “Outside”:

station:|slot:/|bql:select * from control:NumericPoint where name like '*Outside*'

View the ord of all Numeric Points that are > 85:

station:|slot:/|bql:select slotPath from control:NumericPoint where out.value > 85.0

View the name and ord of all Control Points whose status is not OK:

station:|slot:/|bql:select navName,ord from control:ControlPoint where !status.isOk

  • Share/Save/Bookmark

Tucker Niagara , ,

Introducing Periscope

February 1st, 2009

After many months and some long days, we’re pleased to announce the release of Periscope on 02/06/09. For those who don’t know,

The Activelogix Periscope™ is a powerful, web-based dashboard application that provides rapid identification of real-time and historical trends in key attributes of multi-facility operation, including energy use, operational efficiencies and critical metrics.

Capable of reducing volumes of data from disparate systems into visual knowledge, the Activelogix Periscope™ gives the user the ability to quickly identify issues, assess relationships and take action in rapidly changing environments in order to optimize resource efficiencies and sustainability.

In non-marketing speak, Periscope is a web-based dashboard that extends Niagara AX. Many of the Viewlets can be replicated using Niagara’s default presentation medium, PX, but Periscope enables the end-user to fully configure what historical or real-time data to visualize. It further builds on the charting abilities by bundling some energy specific trends (Demand Duration, Ranking, KPI) and allows real-time normalizations and conversions to stuff like CO2 or Dollars.

For more information, check out the product page here.

Screenshot of a typical dashboard

Screenshot of a typical dashboard

  • Share/Save/Bookmark

Tucker Periscope ,