Aggregation of object properties


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 aggregate_mkgroupthe 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)


Defines

#define AF_ABS   0x01
 absolute value aggregation flag

Typedefs

typedef struct s_aggregate AGGREGATION
 the aggregation type

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.


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,skew,kur,count,gamma)
group_expression  grouping rule; see find_mkpgm(char *)

Definition at line 41 of file aggregate.c.

References AF_ABS, CF_CLASS, class_find_property(), find_first(), output_error(), PT_complex, PT_double, stricmp, unit_convert_ex(), and unit_find().

double aggregate_value ( AGGREGATION aggr  ) 

This function performs an aggregate calculation given by the aggregation.

Parameters:
aggr  the aggregation to perform

Definition at line 325 of file aggregate.c.

References AF_ABS, CF_CONSTANT, find_first(), find_next(), PT_complex, PT_double, and throw_exception().


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