/
Logic Builder Blocks

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 they can search through Categories.

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

Category

Block

Description

Category

Block

Description

Commands

condDelay

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

Commands

email

Send an email using the configured SMTP connector.

Commands

setExternal

Variable set from an external program

Commands

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.

Control Flow

return

Return exits the routine and returns given expression value

Expression

count

Count number of the items which match a condition

Expression

gridSelectCol

Selects the column of a grid

Expression

gridSize

Number of rows in a grid.

Expression

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

Expression

leadLagStageSelect

LeadLagStageSelect

Expression

limit

Limit val between an inclusive min and max

Expression

pid

Proportional integral derivative loop

Expression

random

Generate a random number between min and max inclusive on every cycle

Language

alarmBlock

Generate an alarm based on a boolean variable. Further info about alarms can be found here. Alarm program example.

Language

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.

Language

callRoutine

Call a routine within the same program by name

Language

comment

Comment

Language

exprStmt

Statement wrapper for expression with side-effects

Language

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.

Language

return

Return exits the routine and returns given expression value

Language

staging

Compute number of stages which should be one. Delays are in seconds.

Language

tag

Name/value pair added to a `Tags` block

Language

tags

Builds a dict of name/value tag pairs

Language

delayedOutput

DelayedOutput - duration is in seconds.

Language

dictGet

Bundles variables in a dict

Language

jobRun

Checks if a value is an instance of a given type

Language

varCapture

Capture current variables as a dict

Logical

all

Returns if all items in a collection matches a condition

Logical

and

Logical-and of boolean values

Logical

any

Returns if any item in a collection matches a condition

Logical

cmpEq

Equality comparison

Logical

cmpGt

Greater than comparison

Logical

cmpGtEq

Greater than or equal comparison

Logical

cmpLt

Less than comparison

Logical

cmpLtEq

Less than or equal comparison

Logical

cmpNotEq

Not equal comparison

Logical

inRange

Return if val is between an inclusive min and max

Logical

not

Logical not of boolean value

Logical

or

Logical-or of boolean values

Logical

xor

Logical exclusive-or of two boolean values

Logical

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.

Math

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.

Math

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.

Math

isEven

Check if a number is even whole integer

Math

isOdd

Check if a number is odd whole integer

Math

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.

Math

min

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

Math

modulo

Modulo/remainder: 'a % b'. Return null if a or b doesn't evaluate to number.

Math

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.

Math

neg

Negate: '-val'. Return null if val doesn't evaluate to number.

Math

sineWave

Generate a sine wave

Others

cosineWave

Generate a cosine wave

Math

sub

Subtract: 'a - b'. Return null if a or b doesn't evaluate to number.

Math

threshold

Threshold returns true when input is above or below a setpoint with configurable deadband.

Math

aboveBy

Check if the base number is above the input number by a threshold

Math

abs

Return the absolute value of the number

Math

belowBy

Check if the base number is below the input number by a threshold

Math

limit

Limit val between an inclusive min and max

Math

pow

 Power a^b. Returns null if a or b does not evaluate to a number

Math

random

Generate a random number between min and max inclusive on every cycle

Math

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.

Math

within

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

Math

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.

Others

ternary

Check if condition is true and evaluates the true block, otherwise evaluates the false block

Others

analogToDigital

Converts an Analog value (number) to a Digital value (boolean). Output FALSE only if output is 0, otherwise the output will be 1.

Others

digitalToAnalog

Converts a Digital value (boolean) to an Analog value (number). A value of TRUE returns 1 and a value of FALSE returns 0.

Others

dewPoint

Receives in input a dry bulb temperature value (°C) and a relative humidity value (%) and it calculates the Dew Point (°C).

Others

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.

Others

recordMaxValue

Holds the max value received in input.

Others

recordMinValue

Holds the min value received in input.

Others

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.

Others

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.

Others

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.

Others

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.

Others

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.

Others

runtimeCounter

If input is TRUE, the output turns to TRUE only when time expires.

Others

enthalpy

Calculates the Enthalpy when given in input a temperature (°C) and a humidity (%). Output will be in kJ/kg measure.

Others

mode

 

Others

note

 

Others

state

 

Others

analogToDigitalByValue

Converts an Analog value (number) to a Digital value (boolean).
Output FALSE only if input number is less than the provided comparison number, otherwise the output will be TRUE.

Others

digitalToAnalogByValue

Converts a Digital value (boolean) to an Analog value (number).
If the value is TRUE return the specified TRUE value, if the value if FALSE, return the specified FALSE value

Others

dateAdd

Add a duration from a DateTime.
If no units are supplied, then day will be assumed.

Others

dateSub

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

Others

dateToDateAdd

Add one date to another -- returns duration (always day).

Others

dateToDateSub

Subtract one date from another -- returns duration (always day).

Strings

strCapitalize

Changes first letter of a string to upper case character.

Strings

strConcat

String concatenation

Strings

strContains

Compares if a val string contains substring

Strings

strDecapitalize

Changes first letter of a string to lower case character.

Strings

strEndsWith

Compares if a val string ends with substring

Strings

strFormat

String format - see `format()`

Strings

strLower

Changes all ASCII letters to lower case

Strings

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.

Strings

strReplace

String replace

Strings

strSize

Number of characters in a string

Strings

strStartsWith

Compares if a val string starts with substring

Strings

strUpper

 Changes all ASCI letters to upper case

Time

date

Get the Date part of  a DateTime

Time

dateTimeAdd

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

Time

dateTimeSub

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

Time

dateToNumber

Convert a date to a number

Time

dateToString

Convert a portion of a date to a string

Time

dtToDtAdd

Add one dateTime to another -- returns duration (always minutes or seconds).

Time

dtToDtSub

Subtract one dateTime from another -- returns duration (always minutes or seconds).

Time

now

Get the current DateTime for this server

Time

siteDateTime

Get the current dateTime for the site associated with the target

Time

time

Get the Time part of a DateTime

Time

timeToMinutes

Convert a Time to minutes

Time

timeToTimeAdd

Add one time to another -- returns duration (always minutes).

Time

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.

Weather

weatherInfo

Get the temperature information from a forecast

Weather

weatherSunrise

Get the sunrise from a forecast

Weather

weatherSunset

Get the sunset from a forecast

Macros

 

This entry  contains the user created macro blocks, including Expressions

Related content

Logic Builder App
Logic Builder App
Read with this
General
More like this
Logic Builder Examples
Logic Builder Examples
Read with this
Macro and Expression Blocks
Macro and Expression Blocks
More like this
Math Blocks
Math Blocks
Read with this
If Block
More like this