Aggregation of object properties
[GridLAB-D Core]


Detailed Description

Aggregation functions support calculations over properties of multiple objects.

This is used primarily by the collector object in the tape module to define groups (see the group property in the collector object). The group can be defined by specifying a boolean series are relationship of object properties, e.g.,

class=node and parent=root 
.

Aggregations also must specify the property that is to be aggregated. Most common aggregations and some uncommon ones are supported. In addition, if the aggregation is over a complex quantity, the aggregation must specific how a double is to be obtained from it, e.g., magnitude, angle, real, imaginary. Some examples aggregate property definitions are

	sum(cost)
	max(power.angle)
	mean(energy.mag)
	std(price)
	

Bug:
Right now, not all allowed aggregations are invariant (meaning that the members of the group do not change over time). However, the collector object requires invariant aggregations. Using an aggregation that isn't invariant will cause the simulation to fail. (ticket #112)


Classes

struct  s_aggregate

Defines

#define AF_ABS   0x01
 absolute value aggregation flag

Typedefs

typedef s_aggregate AGGREGATION
 the aggregation type

Enumerations

enum  AGGREGATOR {
  AGGR_NOP, AGGR_MIN, AGGR_MAX, AGGR_AVG,
  AGGR_STD, AGGR_MBE, AGGR_MEAN, AGGR_VAR,
  AGGR_KUR, AGGR_GAMMA, AGGR_COUNT, AGGR_SUM,
  AGGR_PROD
}
enum  AGGRPART {
  AP_NONE, AP_REAL, AP_IMAG, AP_MAG,
  AP_ANG, AP_ARG
}

Functions

AGGREGATIONaggregate_mkgroup (char *aggregator, char *group_expression)
 This function builds an collection of objects into an aggregation.
double aggregate_value (AGGREGATION *aggr)
 This function performs an aggregate calculation given by the aggregation.
double arg (complex *x)
double mag (complex *x)


Enumeration Type Documentation

enum AGGREGATOR

Enumerator:
AGGR_NOP 
AGGR_MIN 
AGGR_MAX 
AGGR_AVG 
AGGR_STD 
AGGR_MBE 
AGGR_MEAN 
AGGR_VAR 
AGGR_KUR 
AGGR_GAMMA 
AGGR_COUNT 
AGGR_SUM 
AGGR_PROD 

Definition at line 13 of file aggregate.h.

enum AGGRPART

Enumerator:
AP_NONE 
AP_REAL 
AP_IMAG 
AP_MAG 
AP_ANG 
AP_ARG 

Definition at line 14 of file aggregate.h.


Function Documentation

AGGREGATION * aggregate_mkgroup ( char *  aggregator,
char *  group_expression 
)

This function builds an collection of objects into an aggregation.

The aggregation can be run using aggregate_value(AGGREGATION*)

Parameters:
aggregator  aggregator (min,max,avg,std,sum,prod,mbe,mean,var,kur,count,gamma)
group_expression  grouping rule; see find_mkpgm(char *)

Definition at line 40 of file aggregate.c.

References AF_ABS, AGGR_AVG, AGGR_COUNT, AGGR_GAMMA, AGGR_KUR, AGGR_MAX, AGGR_MBE, AGGR_MEAN, AGGR_MIN, AGGR_NOP, AGGR_STD, AGGR_SUM, AGGR_VAR, AP_ANG, AP_ARG, AP_IMAG, AP_MAG, AP_NONE, AP_REAL, CF_CLASS, class_find_property(), find_first(), find_mkpgm(), find_pgmconstants(), find_runpgm(), s_aggregate::flags, s_aggregate::group, s_aggregate::last, s_aggregate::next, s_object_list::oclass, s_aggregate::op, output_error(), s_aggregate::part, s_aggregate::pinfo, PT_complex, PT_double, and stricmp.

double aggregate_value ( AGGREGATION aggr  ) 

This function performs an aggregate calculation given by the aggregation.

Todo:
use constant part instead of NULL (ticket #14)

Todo:
implement kurtosis aggregate (no ticket)
Parameters:
aggr  the aggregation to perform

Definition at line 212 of file aggregate.c.

References AF_ABS, AGGR_AVG, AGGR_COUNT, AGGR_GAMMA, AGGR_KUR, AGGR_MAX, AGGR_MBE, AGGR_MEAN, AGGR_MIN, AGGR_PROD, AGGR_STD, AGGR_SUM, AGGR_VAR, AP_ANG, AP_ARG, AP_IMAG, AP_MAG, AP_REAL, arg(), CF_CONSTANT, s_findpgm::constflags, find_first(), find_next(), find_runpgm(), s_aggregate::flags, s_aggregate::group, complex::i, s_aggregate::last, mag(), object_get_complex(), object_get_double(), s_aggregate::op, s_aggregate::part, PI, s_aggregate::pinfo, PT_complex, PT_double, complex::r, and throw_exception().


GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy