Logic Builder Blocks

The blocks are elements used in Logic Builder that, interconnected, build routines and programs.

The blocks are divided in the following categories.

Start routine

Program Variables

Macros

Operation blocks/ Built in blocks

Start Routine

This is a block found on all routines and programs. Its purpose is to mark the start of a routine, 

If the routine is set to run On Event, the block will also include a Condition port. This is useful when the routine  needs to run if some conditions are met. The condition can be  a Get block, a macro or an operator block 

 

Program Variable Blocks

These are blocks that provide data (for example a temperature sensor).The variables present 2 blocks, a Get and a Set block.  

The Get block can be used as a condition on a runtime. An example is this Alarm Routine where roomTemp get is used as a trigger for the alarm.

The Set block is used to write  a value following meeting a condition, which can be a block or an entire routine. It can also be used as a condition on itself

Like variables, variable blocks are color-coded by type as follows:

Number - Purple

Boolean - Green

String - Gold

Time/Date -Teal

Number Blocks 

These blocks are representations of number type variables. The Set Block can be completed with a numerical value, either manually or via a routine.

Boolean Blocks

These blocks are representations of boolean type variables. The Set Block can be completed with a true or false value, either manually or via a routine.

String Blocks

These blocks are representations of string or enum type variables. The Set Block can be completed with string values, either manually or via a routine.

Time/Date Blocks 

These blocks are representations of date or time type variables. The Set Block can be set to a point in time or on a calendar date.

 

Macro Blocks

These are  special blocks that can contain entire routines or expressions (double-clicking on a macro in the Variable/Routines will open a new workspace). These  blocks are coloured dark blue 

Built in blocks

These are  presented in the Block Library. These are used to channel conditions and commands between other types of blocks. These are coloured grey.

To  lookup a block  in the library,  users can either look them up using the search bar or  can 

The complete list of built-in blocks is presented below.

Commands

condDelay- Add delay to condition after a transition from false to true before evaluating to true. Units to use are: sec, min, hr

email - Send an email using the configured SMTP connector. More details about this block here.
setDelay - Variable set with a delay. It only delays if there is a change of value on the set block. Setting same value will not make it delay. Recommend to use wait block instead for static set value.
setExternal - Variable set from an external program
wait - Pause the routine for a specific amount of time. Units to use are: sec, min, hr, and day?

Control Flow

if - If block performs boolean condition flow control between then and else. If Block example.
return - Return exits the routine and returns given expression value

Expression

count - Count number of the items which match a condition
dateTimeAdd - Add a duration from a DateTime. If no units are supplied, then minutes will be assumed.

dateTimeSub - Substract a duration from a DateTime. If no units are supplied, then minutes will be assumed.

gridSelectCol - Selects the column of a grid
gridSize - Number of rows in a grid.
leadLag - LeadLag is used to schedule a number of units on/off. The 'units' property should be set to a bundle variable that imports the list units the command from the *unit program*. The unit program must have three variables for each unit:

  • unit stage number used to determine start order

  • unit alarm status as true/false (anything not true is considered false)

  • variable used to command the unit; this variable must be set via 'setExternal' block in the unit program

This block's 'numOn' property is used to command all the units on or off.

Each unit in alarm is commanded to off. Any remaining units are commanded on until we reach the desired number on (using unit num ordering).

leadLagStageSelect - LeadLagStageSelect
limit - Limit val between an inclusive min and max
pid - Proportional integral derivative loop
random - Generate a random number between min and max inclusive on every cycle

Language

alarmBlock - Generate an alarm based on a boolean variable.  More details about this block here. Further info about alarms can be found here. Alarm program example.
boolLatch - Latch a boolean input when it transitions to true after a configurable delay period. Once latched the output remains true until the reset is triggered to true.

callRoutine - Call a routine within the same program by name
comment - Comment
exprStmt - Statement wrapper for expression with side-effects
reset - Reset block computes output based on two linear equations. The input is clipped to inLo and inHi, the percentage of input along the linear segment between inLo and inHi is computed, and then that percentage is output as a Number between outLo and outHi.

return - Return exits the routine and returns given expression value
staging - Compute number of stages which should be one. Delays are in seconds.
tag - Name/value pair added to a `Tags` block
tags - Builds a dict of name/value tag pairs
delayedOutput  - DelayedOutput - duration is in seconds.
dictGet - Bundles variables in a dict
jobRun - Checks if a value is an instance of a given type
varCapture - Capture current variables as a dict

Logical

all - returns if all items in a collection matches a condition
and - Logical-and of boolean values
any - Returns if any item in a collection matches a condition
cmpEq - Equality comparison
cmpGt -Greater than comparison
cmpGtEq - Greater than or equal comparison
cmpLt - Less than comparison
cmpLtEq - Less than or equal comparison
cmpNotEq - Not equal comparison

More details about the comparison blocks here.

inRange - Return if val is between an inclusive min and max
not - Logical not of boolean value
or - Logical-or of boolean values
xor - Logical exclusive-or of two boolean values
isType - Checks if a value is an instance of a given type

Math

add - Addition: '∑ vals'. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.

avg - Fold vals their standard average or arithmetic mean. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.

div- Multiply: 'vals₀ × vals₁ × vals₂ ...'. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.

isEven - Check if a number is even whole integer
isOdd - Check if a number is odd whole integer
max - Maximum of vals. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.

min - Minimum of vals. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to null

modulo - Modulo/remainder: 'a % b'. Return null if a or b doesn't evaluate to number.
mult - Multiply: 'vals₀ × vals₁ × vals₂ ...'. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.

neg - Negate: '-val'. Return null if val doesn't evaluate to number.
sineWave - Generate a sine wave
sub - Subtract: 'a - b'. Return null if a or b doesn't evaluate to number.
threshold - Threshold returns true when input is above or below a setpoint with configurable deadband.

aboveBy - Check if the base number is above the input number by a threshold
abs - Return the absolute value of the number
belowBy - Check if the base number is below the input number by a threshold
limit - Limit val between an inclusive min and max

pow -  Power a^b. Returns null if a or b does not evaluate to a number
random - Generate a random number between min and max inclusive on every cycle
reset - Reset block computes output based on two linear equations. The input is clipped to inLo and inHi, the percentage of input along the linear segment between inLo and inHi is computed, and then that percentage is output as a Number between outLo and outHi.

within - Verifies if the provided numbers are within an offset from the base

sqrt -  Sqrt: '√val'. Return null if val does not evaluate to a number.

Others

invoke - Invokes an arbitrary Fantom or Axon function.The invoke block will apply certain execution time restrictions on the function invoked.
ternary - Check if condition is true and evaluates the true block, otherwise evaluates the false block
analogToDigital - Converts an Analog value (number) to a Digital value (boolean). Output FALSE only if output is 0, otherwise the output will be 1.
digitalToAnalog - Converts a Digital value (boolean) to an Analog value (number). A value of TRUE returns 1 and a value of FALSE returns 0.
dewPoint - Receives in input a dry bulb temperature value (°C) and a relative humidity value (%) and it calculates the Dew Point (°C).
onHolder - If input is TRUE, holds the TRUE output for a defined amount of time. If both durations are set, onDuration (seconds) wins over onStatusDuration.
recordMaxValue - Holds the max value received in input.
recordMinValue - Holds the min value received in input.
amountOfHeat - Start from pulse input and defined both scaling and scalingMultiplier, the pulse input is used to define a pulsesPerMinute variable. Output value is calculated and updated every minute. If the reset input is set to TRUE, the output value goes back to 0.
deltaAmountOfHeat - Starting from pulse input and defined both scaling and scalingMultiplier, the pulse input is used to define a pulsesPerMinute variable. Output value is added to the previous value and it's updated every minute. If the reset input is set to TRUE, the output value goes back to 0.
thermalOutput - Starting from pulse input and defined both scaling and scalingMultiplier, the pulse input is used to define a pulsesPerInterval variable. Output value (kWh) is updated every thermalOutputCalculationInterval.
historyValue - Calculates operations on History Values (Max, Min, Average). This block concats the hisRead function with the hisRollUp function and then applies Max, Min, or Avg.
upAndDownCounter - The output is a numeric value that increases or deceases based on rising edge of the given inputs. The output won't go below zero.
runtimeCounter - If input is TRUE, the output turns to TRUE only when time expires.
enthalpy - Calculates the Enthalpy when given in input a temperature (°C) and a humidity (%). Output will be in kJ/kg measure.

Strings

strCapitalize - Changes first letter of a string to upper case character.
strConcat - String concatenation
strContains - Compares if a val string contains substring
strDecapitalize - Changes first letter of a string to lower case character.
strEndsWith - Compares if a val string ends with substring
strFormat - String format - see `format()`
strLower - Changes all ASCII letters to lower case
strMacro - Str macro pattern which uses the same syntax as `disMacro` and `haystack::Etc.macro`. The macro variables are resolves against the task's variables.

strReplace - String replace
strSize - Number of characters in a string
strStartsWith - Compares if a val string starts with substring
strUpper - Changes all ASCI letters to upper case

Time

date - Get the Date part of  a DateTime
dateTimeAdd - Add a duration from a DateTime. If no units are supplied, then minutes will be assumed.

dateTimeSub - Substract a duration from a DateTime. If no units are supplied, then minutes will be assumed.

dateToNumber - Convert a date to a number
dateToString - Convert a portion of a date to a string
dtToDtAdd - Add one dateTime to another -- returns duration (always minutes or seconds).
dtToDtSub - Subtract one dateTime from another -- returns duration (always minutes or seconds).
now - Get the current DateTime for this server
siteDateTime - Get the current dateTime for the site associated with the target
time - Get the Time part of a DateTime
timeToMinutes - Convert a Time to minutes
timeToTimeAdd - Add one time to another -- returns duration (always minutes).
timeToTimeSub - Sub one time to another -- returns duration (always minutes).

Weather

weatherConditions - Get the conditions from a forecast. Weather Conditions are: unknown, clear, partlyCloudy, cloudy, showers, rain, thunderstorms, ice, flurries, snow.
weatherInfo - Get the temperature information from a forecast
weatherSunrise - Get the sunrise from a forecast
weatherSunset - Get the sunset from a forecast

Macros

This entry  contains the user created macro blocks (including Expressions)