Functions

<< Click to Display Table of Contents >>

Navigation:  Model Definition > Ventity Language >

Functions

Previous pageReturn to chapter overviewNext page

 

 

 

Time Functions

 

CurrentTimeSlice()

Dimensionless <- ()

The sequential index number of the current time slice. The first time slice in the simulation is 0, and the number increments each Time Step.

 

SimulationDay(), 

SimulationMonth(), 

SimulationYear()

Dimensionless <- ()

Extract date components from the simulation time when using calendar time.

 

Logic Functions

 

FPEquals(value1, value2, tolerance)

 

Tests for equality with a tolerance; useful for preventing tiny differences in double-precision numbers from defeating an equality test.

 

IsValid(value)

 

Tests whether a number is valid (invalid numbers are NaN or infinity). Returns a boolean true/false value, and therefore is usable only in conditions like an "if" statement. Another way to test for NaN is to check if (x == x), which can only fail if x is NaN. See also: ValidOrX, ValidOrZero.

 

 

 

Rounding

Ceiling(x), 

Floor(x), 

Round(x), 

Truncate(x)

Floor rounds x down to the next integer, Ceiling rounds up, Truncate rounds toward zero, Round rounds to the nearest integer (choosing the even one if x is midway between). Result is in units of x.

 

 

Test Inputs

 

Step(height,time)

Returns 0 until time, then height thereafter. Step function returns units of height, but requires time to be in units of time.

 

Ramp(slope,start,stop)

Returns 0 until time start, then increases at rate slope until time stop, then constant thereafter. Ramp function requires slope to be in units, and the both start and stop in the same units of time. It will return slope * time units.

 

Pulse(start,duration)

Returns 0 until time start, then returns 1 for duration time units, then 0 thereafter. start and duration must both be in units of time with the result being dimensionless.

 

PulseTrain(start,duration,interval,stop)

Returns 0 until time start, then an alternating pattern of 1 for duration time units followed by 0 for interval-duration time units, until time stop, then 0 thereafter. Pulse Train function requires units of time for start, duration, interval and stop, with the result being dimensionless.

 

 

 

 

 

 

Individual table functions for individual entities

 

The table function you provide in the entity type definition is the default, but an individual entity can have its own values for the table function. Individual overrides for table function values are provided during initialization.

 

 

String functions for attribute initialization

 

These functions may be used to construct attribute string values.

 

RoundToString(value) 

Rounds a value to an integer and converts to a string; useful for initializing an attribute with a sequence number.

 

Concatenate(value1,value2)

Concatenate two strings without a space. The string may be "quoted text," another attribute, or RoundToString. The value list may contain up to four arguments.

 

Combine(value1,value2)

Combine two strings with a separating space.

 

CombineWithDelimiter("delimiter",value1,value2)

Combine two strings with a delimiting character or string.

 

 

Reference functions

 

These functions may be used to construct attribute string values.

 

EntityExists(collection,entitykey)

Tests whether an entity with the given key exists in a collection. Useful for determining whether a relationship entity linking two other entities already exists, for example.

 

IsActive(entity reference)

Tests whether a reference points to an entity that is "alive" (not deleted).

 

IsNull(entity reference)

Tests whether an entity reference is defined (points to a valid entity).