Property calculations

-- Calculating values in property definitions.

Synopsis
object class { property (expression); }

Expressions
Conventional math equations are supported for any expression placed inside parentheses in a property definition. Expression are evaluated at load time and therefore take place after creation of the object but before initialization.

Math functions
The following math functions are supported

sin(expression) cos(expression) tan(expression) abs(expression) sqrt(expression) acos(expression) asin(expression) atan(expression) log(expression) floor(expression) ceil(expression)

Note that the code tries to support log10 but due to a parser limitation it does not actually work.

Variables
Variable references take the form

$variable-name

or

this.variable-name

Only references local properties or global variables are supported and they must already be defined to be used. If the variable is not defined, its creation default value is used. If the calculation ends up setting the property to the creation default value, it most likely will end up assuming the initialization default value.

Example
clock { timezone GMT0GMT; starttime '2015-05-20 00:00:00'; stoptime '2015-05-21 00:00:00'; } module residential; module tape; object house:..5 { floor_area random.uniform(1500,2500); air_volume (10*ceil($floor_area+10)); object recorder { property floor_area,air_volume; file `data_{id}.csv`; }; }