外观
controlExt 扩展参考
原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793422891/FIN+5.3.1+controlExt 中文整理基于 FIN 5.3.1
导读: 控制引擎扩展
以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。
目录(导读)
- mixins
- classes
- enums
- facets
- errs
- docs
- Overview
- Programs
- Props
- Prop Types
- Block Props
- Bool Props
- Number Props
- Str Props
- Duration Props
- Vars
- Shared Vars
- Bound Vars
- Bundle Vars
- Unlink Mode
- Monitoring
- XML
- bLine Custom Blocks
- Slot Details
- base
- eval
- in
- threshold
- color
- program
- tags
- target
- tracker
- varName
- iterator
- amountOfHeat
- counterEnabled
- lastDate
- pulse
- pulseCount
- scaling
- scalingMultiplier
- stop
- val
- comparisonVal
- vals
- continuation
- evalAsync
- pool
- timeout
- a
- b
- setA
- setB
- def
- evalEachBool
- evalEachNumber
- evalEachStr
- evalToBool
- evalToDate
- evalToDateTime
- evalToDict
- evalToDuration
- evalToGrid
- evalToNumber
- evalToStr
- evalToTime
- get
- set
- blockErr
- blockStatus
- blockType
- dis
- doc
- instantiate
- markers
- name
- prop
- props
- toStr
- block
- make
- readBlock
- writeBlock
- delay
- delayStart
- input
- latched
- reset
- stmtType
- text
- deadline
- lastCond
- DEFAULT_TIMEOUT
- isComplete
- blocks
- cur
- onStop
- max
- min
- period
- date
- timeSpan
- delayOff
- delayOn
- delayOut
- delayTime
- isDelay
- lastInput
- deltaAmountOfHeat
- dryBulbTemp
- relativeHumidity
- tagName
- falseVal
- trueVal
- body
- subject
- to
- iterate
- colName
- …(其余标题见英文正文)
API 正文(英文)
| DateAdd | Add a duration from a DateTime. | | DateSub | Substract a duration from a Date. | | DateTimeAdd | Add a duration from a DateTime. | | DateTimeSub | Substract a duration from a DateTime. | | DateToDateAdd | Add one date to another -- returns duration (always day). | | DateToDateSub | Subtract one date from another -- returns duration (always day). | | DateToNumber | Convert a date to a number | | DateToString | Convert a portion of a date to a string | | DelayedOutput | DelayedOutput | | DeltaAmountOfHeat | Starting from pulse input and defined both scaling and scalingMultiplier, the pulse input is used to define a pulsesPerMinute variable. | | DewPoint | Receives in input a dry bulb temperature value (°C) and a relative humidity value (%) and it calculates the Dew Point (°C). | | DictGet | | | DigitalToAnalog | Converts a Digital value (boolean) to an Analog value (number). | | DigitalToAnalogByValue | Converts a Digital value (boolean) to an Analog value (number). | | Div | Division: a ÷ b. | | Do | Do block evaluates a list of blocks in linear sequence. | | DtToDtAdd | Add one dateTime to another -- returns duration (always minutes or seconds). | | DtToDtSub | Subtract one dateTime from another -- returns duration (always minutes or seconds). | | Email | Send an email using the configured SMTP connector | | Enthalpy | Calculates the Enthalpy when given in input a temperature (°C) and a humidity (%). | | Expr | Base class for expression blocks implemented in Fantom | | ExprStmt | Statement wrapper for expression with side-effects | | FanStmt | Statement which is implemented in Fantom rather than in the interpreter. | | FantomBlock | Fantom block definition | | Get | Variable get | | GridIterator | Base class for blocks which operate on a collection | | GridSelectCol | Selects the column of a grid | | GridSize | Number of rows in a grid. | | HistoryValue | Calculates operations on History Values (Max, Min, Average). | | If | If block performs boolean condition flow control between then and else | | InRange | Return if val is between an inclusive min and max | | Invoke | Invokes an arbitrary Fantom or Axon function | | IsEven | Check if a number is even whole integer | | IsOdd | Check if a number is odd whole integer | | IsType | Checks if a value is an instance of a given type | | JobRun | Runs Axon code in a Job. | | LeadLag | LeadLag is used to schedule a number of units on/off. | | LeadLagStageSelect | LeadLagStageSelect | | Limit | Limit val between an inclusive min and max | | MathExpr | Base class for binary math blocks | | Max | Maximum of vals. | | Min | Minimum of vals. | | Modulo | Modulo/remainder: a % b. | | Mult | Multiply: vals₀ × vals₁ × vals₂ .... | | NaryMath | Base class for math folding function blocks | | Neg | Negate: -val. | | Not | Logical not of boolean value. | | Now | Get the current DateTime for this server | | OnHolder | If input is TRUE, holds the TRUE output for a defined amount of time. | | Or | Logical-or of boolean values | | Pid | Proportional integral derivative loop | | Pow | Pow: a raised to the b-th power a ^ b. | | Program | Program block is the root of the block tree | | ProgramNavTree | ProgramNavTree | | PropDef | Block property definition | | Random | Generate a random number between min and max inclusive on every cycle | | RecordMaxValue | Holds the max value received in input | | RecordMinValue | Holds the min value received in input | | Reset | Reset block computes output based on two linear equations. | | Return | Return exits the routine and returns given expression value | | Routine | Base class for routine blocks | | RunCycle | Run on a periodic cycle | | RunManual | Run only when manually initiated by a user | | RunWhen | Run when a condition triggers | | RuntimeCounter | If input is TRUE, the output turns to TRUE only when time expires. | | Set | Variable set | | SetDelay | Variable set with a delay. | | SetExternal | Variable set from an external program | | SineWave | Generate a sine wave | | SiteDateTime | Get the current dateTime for the site associated with the target | | SiteExpr | SiteExpr is an expression whose task target can be used to look up a site | | Sqrt | Square root: √a. | | Staging | Compute number of stages which should be one | | Stmt | Base class for statement blocks | | 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 ASCI letters to lower case | | StrMacro | Str macro pattern which uses the same syntax as disMacro and Etc.macro. | | 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 | | Sub | Subtract: a - b. | | Tag | Name/value pair added to a Tags block | | Tags | Builds a dict of name/value tag pairs | | Task | Interpreter and variable scope for block evaluation. | | TaskId | Tuple of program and target identifiers | | Ternary | Check if condition is true and evaluates the true block, otherwise evaluates the false block | | ThermalOutput | Starting from pulse input and defined both scaling and scalingMultiplier, the pulse input is used to define a pulsesPerInterval variable. | | Threshold | Threshold returns true when input is above or below a setpoint with configurable deadband. | | 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 | Add one time to another -- returns duration (always minutes). | | UnaryMath | Base class for binary math blocks | | UnaryStrConvert | Changes first letter of a string to upper case character. | | UpAndDownCounter | The output is a numeric value that increases or decreases based on rising edge of the given inputs. | | Var | Variable - Base It defines two base constructors which can be extended on need | | VarCapture | Capture current variables as a dict | | Wait | Pause the routine for a specific amount of time | | WeatherConditions | Get the conditions from a forecast | | WeatherExpr | WeatherExpr is an expression whose task target can be used to look up a forecast | | WeatherInfo | Get the temperature information from a forecast | | WeatherSunrise | Get the sunrise from a forecast | | WeatherSunset | Get the sunset from a forecast | | Within | Verifies if the provided numbers are within an offset from the base | | Xor | Logical exclusive-or of two boolean values |
enums
| StmtType |
facets
| Prop | Annotates a FantomBlock field as a property |
errs
| Continuation | A continuation can be thrown by a block to highlight that it can only continue after the associated future has completed. |
| PropSetErr | PropSetErr |
docs
Overview
The controlExt implements a control engine based upon the following principles:
- programs implement control logic using a tree of blocks
- programs are organized into one or more routines
- routines are scheduled to run cyclically, on conditions, or manually
- programs are registered on targets using the
programOntag - tasks are created for for each unique program and target combition
- tasks maintain their state via variables
- local variables maintain state on a per task basis
- shared variables allow state to be shared between tasks
- bound variables allow state to be shared through folio and point writes
- bundle variables allow variable tables to be shared between programs
Programs
Programs have the following tags:
name: required programatic name of the program. The name must unique in project (shared with Axonfuncnamespace)dis: optional display name for the programprogram: required Str which defines the XML definition of the programprogramOn: required Str which defines the filter used to register the program on targetsprogramVars: optional tag which defines the program variables as a Zinc string
Props
Blocks are defined by a set of named properties or props. Properties have the following attributes:
name: programatic name of the propertytype: type of the property value (see below for types)- additional type specific tags
doc: fandoc encoded description of the property
Prop Types
Standard prop types:
Block: child blockBlock[]: list of child blocks (only supported by n-ary blocks)Bool: boolean value of true/falseNumber: numeric valueStr: string valueDuration: as number with duration unit ("ms", "sec", "min", etc)
Block Props
Standard tags for Block and and Block[] properites:
takes: filter for what kind of block is expected (described below)
Many properties define a takes tag which is a string filter describing what is expected for the properties which take a child block. Standard takes tags:
stmt: child block type must be stmtobj: child block expression that returns any object typebool: child block must be boolean expressionnumber: child block must be numeric expressionstr: child block must be string expression
Bool Props
Standard tags for Bool props:
defVal: default value for propertyenum: comma separated list of "false,true" strings
Number Props
Standard tags for Number props:
defVal: default value for property
Str Props
Standard tags for Str props:
defVal: default value for propertyroutineName: routine name expectedvarName: variable name expectedenum: comma separated list enumerated string values
Duration Props
Standard tags for Duration props:
defVal: default value for property
Vars
The programVars tag stores a docSkySpark::Zinc encoded table of the variable definitions and bindings. Columns of the table:
name: programmatic name of the variable which matches the name used in the block treekind: type of variable as kind name, if omitted variable may be any kinddefVal: default value used to initial variable, or null if omittedro: the variable is readonly inside the program; attempts to set the variable inside the program logic will raise a ReadonlyErrshared: creates shared variable with scope of "<proj>" or ref tag namebinding: filter string to bind the variable to a rec Folio databasereadTag: binding rec tag to use for reads before execution (typically curVal)writeTag: binding rec tag to write after executionwriteLevel: number between 1 - 16 to use forpointWrite()after executionunlinkMode: marker to init the variable in unlink modebundle: Str formatted as "programName@refTag" - see bundles
Variable exist one of the following states:
- local: this is a variable local to the task during execution, they are maintained in memory between execution cycles
- shared: variables shared between multiple tasks using a configured scope
- bound: these are variables bound to recs in the Folio database
Shared Vars
Tasks can share a variable's value via the shared tag in the variable table. Shared variables of the same name have visibility based on a configured scope. Typically the scope is defined by a Ref tag on the target bound by the program's programOn tag. Using the "id" tag defines scope based on the target itself. You can also use the special string "<proj>" to define project wide scope.
Let's consider an example:
programOn: ahu
programVars:
ver:"2.0"
name,kind,shared
"projVar","Number","<proj>"
"siteVar","Number","siteRef"
"equipVar","Number","id"The program above is registered on all AHU equip recs. The projVar will be shared across all tasks in the project that declare a shared variable with the same name. The siteVar is shared across all tasks which declare a shared variable name identifying the AHU's site as the scope. The equipVar will be shared across all tasks identifying the AHU equip rec as the shared scope (since the AHU is the target itself).
Bound Vars
Bound variables allow programs to read/write to the Folio database. A variable is bound to a record in Folio using the binding tag. This is a string filter which uses the macro syntax. When a program is loaded for a given a target, the filter macro is evaluated with the macro keys of all the target's Ref tags. Here is an example of a program registered on AHUs which declares three variables for the fan, discharge temp, and return temp:
programOn: ahu
programVars:
ver:"2.0"
name,kind,binding,readTag
"fan","Bool","equipRef==\$id and fan and cmd","curVal"
"dat","Number","equipRef==\$id and discharge and temp and sensor","curVal"
"rat","Number","equipRef==\$id and \"return\" and temp and sensor","curVal"
"siteArea","Number","id==\$siteRef","area"
"ahuVendor","Str","id==\$id","vendor"Bound vars work as follows:
- bound variables are added to a watch per program
- all bound variables are read before task execution
- the task is executed
- any bound variables which are set during execution are written back to folio/point array
By default, a bound variable is read-only. If you wish to write the variable's value back out to Folio after execution, then use the writeTag to specify which tag to write on the bound rec. This value is always written to Folio using a transient diff. Alternatively you can write the value to a writable point priority array using writeLevel.
Bundle Vars
Bundle variables allow a program to access the variable table of multiple tasks as a grid. A bundle variable is declared with the bundle tag in the variable table using the syntax "programName@refTag". For example consider this scenerio:
// database of AHU and VAV recs
id: @ahu-1, ahu
id: @vav-1A, vav, ahuRef: @ahu-1
id: @vav-1B, vav, ahuRef: @ahu-1
id: @ahu-2, ahu
id: @vav-2A, vav, ahuRef: @ahu-2
id: @vav-2B, vav, ahuRef: @ahu-2
// program on VAVs
name: "vavProgram"
programOn: "vav"
programVars:
ver:"2.0"
name
"roomTemp"
"damper"
// program on AHUs
name: "ahuProgram"
programOn: "ahu"
programVars:
ver:"2.0"
name,bundle
"vavs","vavProgram@ahuRef"In the example above the ahuProgram imports all the variables of its associated VAVs into a variable named vavs. This variable will be a grid where the columns are the variables and the rows are the tasks associated to the AHU program target by the ahuRef tag. For example the vavs variable of ahu-1 will be a grid which looks like this:
targetRef,roomTemp,damper
@vav-1A,73°F,34%
@vav-2A,75°F,90%Notice that the first column identifies the target of the vavProgram task. The rest of the columns represent the variables declared in the vavProgram programVars table (local undefined variables are not included). The rows match the tasks where the vav target has a ahuRef tag that matches the id of the ahu target rec.
Unlink Mode
Individual variables of a task can be set into a special unlink mode. In this mode, neither bound vars or shared vars are read or written outside of the task. This allows the program to be tested without any side effects. Variable unlink mode is controlled via the taskSetUnlinkMode() function.
Monitoring
Variables of a task may be set into monitor mode. During monitor mode, the control engine maintains an internal trend history of the variables for debugging. Each variable in monitor mode has its state captured at the end of a control engine cycle if one or more routines of the task execute. The trend includes the value of the variable and the line number of the last block to set the variable (or null if the variable was not set during the cycle).
The taskSetMonitorMode() function is used to put variables into and out of monitor mode. The taskMonitorPoll() is used to poll the monitored trend. Clients should optimize their polling by passing lastCycle to only read newer trend rows. Monitoring works on a lease model, if a client fails to poll after 1min then the task's monitoring is disabled and cleared.
XML
The program tag stores the XML encoding of the block tree. Each XML element maps to one block. The following rules are used:
- non-const blocks are encoded with element
<b> - const blocks are encoded with element
<c> - prop name is encoded with
pattribute if the block is a named child - block definition type is encoded with
tattribute - all other attributes map to scalar (non-block) prop values
Const blocks are encoded using the special representation of <c>val</c> where the value is encoded according to the scalar's docSkySpark::Zinc representation. If the const block is a named child prop, then it may also support the p attribute.
Children blocks may be named or unnamed. If the block supports an arity of "unary", "binary", or "n" then its children blocks may be left unnamed (no p attribute). All other compound blocks must identify the child prop name using the p attribute.
Examples:
<c>T</c> // const Bool
<c>74°F</c> // const Number
<c>"string"</c> // const Str
// unary negate 7
<b t='neg'>
<c>7</c>
</b>
// binary 4 - 3
<b t='sub'>
<c>4</c>
<c>3</c>
</b>
// n-ary block
<b t='add'>
<c>5</c>
<c>6</c>
<c>7</c>
</b>
// compound block with named children
<b t='if'>
<c p='cond'>T</c>
<b p='then' t='set' name='result'><c>"is true!"</c></b>
<b p='then' t='set' name='result'><c>"is false!"</c></b>
</b>bLine Custom Blocks
Custom blocks can be created with a JavaScript-style language.
Examples:
//bLine Custom Blocks
//Setting a value:
a = 2;
a = b;
//Adding two values:
a = b + 2;
//More aritmetical operations:
a = c * ( a - 3) + a / 10;
//Logical "and":
a = b && c;
//Logical "or":
a = b || c;
//Logical "not":
a = !b;
//capture all variables inside a variables
foo = varCapture();
//access a property
a = foo.mad;
//calling a builtin routine/block
a = now();
//use double quotes to declare a string value
a = "Some text here";
//sending an email
email("email@example.com", "My Subject", "Email Text");
//to add units to a numberic value, enclose them both into single quotes:
wait('10sec');
//If the single quoted value contains a space, then it's considered a string:
//This is a string:
a = 'has space';
//If the single quoted value does not starts with a digit, then it's cosidered a string:
//This is a string:
a = 'text10';
//Back quotes work just like double quotes, but they can be multiline strings:
a = `This is
my multiline string`;
//This could have been done with double quotes or single quotes using \n:
a = "This is\nmy multiline string";
a = 'This is\nmy multiline string';
//Using an if/else:
if (temp > 10) {
foo = 10;
}
else {
foo = 20;
}
//adding an alarm block
alarmBlock(variableName,
{alarmText:"alarm text",
instructions:"alarm instruction",
priority:2,
cost:1,
tag10: true,
foo20: 21,
marker1});
//call axon function by writing an underscore before there namespace
_myAdd(2, 3) //calls an axon function named myAddAboveBy
class AboveBy : Expr
Check if the base number is above the input number by a threshold
Fields
| base | The base number to compare against |
| in | A number that is compared against the base if within the threshold |
| threshold | The threshold used to compare, can be expressed in % |
Methods
| eval |
Slot Details
base
@Prop { takes="number" } Block? base
The base number to compare against
eval
virtual override Obj? eval(Task task)
in
@Prop { takes="number" } Block? in
A number that is compared against the base if within the threshold
threshold
@Prop { takes="number" } Block? threshold
The threshold used to compare, can be expressed in %
Abs
class Abs : UnaryMath
Abs: Return the absolute value of the number
Slot Details
Add
class Add : NaryMath
Addition: ∑ vals. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
Alarm
class Alarm : FanStmt
Generate an alarm based on a bool variable
Fields
| program | |
| tags | Tags add to the alarm on toAlarm/toNormal transitions |
| target | |
| tracker | |
| varName | Bool variable name which tracks the alarm condition. |
Methods
| color | |
| eval |
Slot Details
color
virtual override Color? color()
eval
virtual override Obj? eval(Task task)
program
Dict? program
tags
@Prop { takes="dict" } Block? tags
Tags add to the alarm on toAlarm/toNormal transitions
target
Dict? target
tracker
AlarmTracker? tracker
varName
@Prop { tags=["varName":Marker.<ctor>("")] } Str varName := "alarm"
Bool variable name which tracks the alarm condition. True indicates the in-alarm state and false the normal state.
All
class All : GridIterator
Returns if all items in a collection matches a condition
Fields
| iterator | Expression used to iterate each item. |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
iterator
@Prop { takes="bool" } virtual override Block? iterator := null
Expression used to iterate each item. This block is called with each item using a variable named "it". The block should evaluate to true if the item matches the search condition.
AmountOfHeat
class AmountOfHeat : Expr
Starting 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.
Fields
| amountOfHeat | |
| counterEnabled | |
| lastDate | |
| pulse | Boolean input |
| pulseCount | |
| scaling | Numeric input |
| scalingMultiplier | Numeric input |
| stop | Boolean input |
Methods
| eval |
Slot Details
amountOfHeat
Float amountOfHeat := 0.0f
counterEnabled
Bool counterEnabled := false
eval
virtual override Obj? eval(Task task)
lastDate
DateTime? lastDate
pulse
@Prop { takes="bool" } Block? pulse
Boolean input
pulseCount
Int pulseCount := 0
scaling
@Prop { takes="number" } Block? scaling
Numeric input
scalingMultiplier
@Prop { takes="number" } Block? scalingMultiplier
Numeric input
stop
@Prop { takes="bool" } Block? stop
Boolean input
AnalogToDigital
class AnalogToDigital : Expr
Converts an Analog value (number) to a Digital value (boolean). Output FALSE only if input number is 0, otherwise the output will be 1.
Fields
| val | Analog input value (number) |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="number" } Block? val
Analog input value (number)
AnalogToDigitalByValue
class AnalogToDigitalByValue : Expr
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.
Fields
| comparisonVal | Analog threshold value (number) |
| val | Analog input value (number) |
Methods
| eval |
Slot Details
comparisonVal
@Prop { takes="number" } Block? comparisonVal
Analog threshold value (number)
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="number" } Block? val
Analog input value (number)
And
class And : BoolLogicExpr, NaryBlock
Logical-and of boolean values
Fields
| vals |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
vals
@Prop { takes="bool" } virtual override Block[] vals := Block[,]
Any
class Any : GridIterator
Returns if any item in a collection matches a condition
Fields
| iterator | Expression used to iterate each item. |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
iterator
@Prop { takes="bool" } virtual override Block? iterator := null
Expression used to iterate each item. This block is called with each item using a variable named "it". The block should evaluate to true if the item matches the search condition.
AsyncBlock
mixin AsyncBlock
Base class for an asynchronously executing block.
See the Continuation class for more information.
Fields
| continuation | A reference to the current continuation block being used. |
| pool | The thread pool all asynchronous tasks will run in. |
| timeout | The asynchronous timeout in seconds. |
Methods
| evalAsync | Evaluate a block asynchronously. |
Slot Details
continuation
protected abstract Continuation? continuation
A reference to the current continuation block being used.
evalAsync
Obj? evalAsync(Task task, |->Obj?| invoke)
Evaluate a block asynchronously.
The function passed in should return a future if it needs to be asynchronous.
pool
protected const static ActorPool pool := ActorPool.<ctor>()
The thread pool all asynchronous tasks will run in.
timeout
@Prop { takes="number" } abstract Block? timeout
The asynchronous timeout in seconds.
Avg
class Avg : NaryMath
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.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
BelowBy
class BelowBy : AboveBy
Check if the base number is bellow the input number by a threshold
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
BinaryBlock
mixin BinaryBlock
Base class for two implicitly named child blocks
Fields
| a | |
| b |
Methods
| setA | |
| setB |
Slot Details
a
abstract Block? a
b
abstract Block? b
setA
Void setA(Block val)
setB
Void setB(Block val)
BinaryMath
abstract class BinaryMath : MathExpr, BinaryBlock
Base class for binary math blocks
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="number" } virtual override Block? a
b
@Prop { takes="number" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
Block
abstract class Block : Obj
Base class for control block
Methods
| def | Get the definition of this block |
| eval | Evalute the block |
| evalEachBool | Evaluate n-ary list of blocks or a gridSelectCol |
| evalEachNumber | Evaluate n-ary list of blocks or a gridSelectCol |
| evalEachStr | Evaluate n-ary list of blocks or a gridSelectCol |
| evalToBool | Evalute the block to a boolean instance |
| evalToDate | Evalute the block to a Date instance |
| evalToDateTime | Evalute the block to a DateTime instance |
| evalToDict | |
| evalToDuration | Evalute the block to a Duration instance. |
| evalToGrid | Evalute the block to a Grid instance |
| evalToNumber | Evalute the block to a Number instance |
| evalToStr | Evalute the block to a Str value |
| evalToTime | Evalute the block to a Time instance |
| get | Get the current value of the given prop |
| set | Set the current value of the given prop |
Slot Details
def
abstract BlockDef def()
Get the definition of this block
eval
abstract Obj? eval(Task task)
Evalute the block
evalEachBool
Void evalEachBool(Task task, Block[] blocks, |Bool| f)
Evaluate n-ary list of blocks or a gridSelectCol
evalEachNumber
Void evalEachNumber(Task task, Block[] blocks, |Number| f)
Evaluate n-ary list of blocks or a gridSelectCol
evalEachStr
Void evalEachStr(Task task, Block[] blocks, |Str| f)
Evaluate n-ary list of blocks or a gridSelectCol
evalToBool
Bool evalToBool(Task task)
Evalute the block to a boolean instance
evalToDate
Date? evalToDate(Task task)
Evalute the block to a Date instance
evalToDateTime
DateTime? evalToDateTime(Task task)
Evalute the block to a DateTime instance
evalToDict
Dict? evalToDict(Task task)
evalToDuration
Duration? evalToDuration(Task task)
Evalute the block to a Duration instance. If the number is unitless then we assume 1sec
evalToGrid
Grid? evalToGrid(Task task)
Evalute the block to a Grid instance
evalToNumber
Number? evalToNumber(Task task)
Evalute the block to a Number instance
evalToStr
Str? evalToStr(Task task)
Evalute the block to a Str value
evalToTime
Time? evalToTime(Task task)
Evalute the block to a Time instance
get
abstract Obj? get(PropDef prop)
Get the current value of the given prop
set
abstract Void set(PropDef prop, Obj? val)
Set the current value of the given prop
BlockDef
abstract const class BlockDef : Obj
Block definition
Methods
| blockErr | If blockStatus is fault, return error message (or messages on each line) |
| blockStatus | Return "ok" or "fault" |
| blockType | Return implementation type: "fantom" |
| color | Block color to use |
| dis | Display text which might be mathematical symbol or localized name |
| doc | Documentation string formatted in fandoc |
| instantiate | Create an instance of this block for use in a task or composite |
| markers | Marker tags used to match the block for "takes" filters |
| name | Name identifier |
| prop | Lookup property definition by name |
| props | Property definitions |
| toStr |
Slot Details
blockErr
abstract Str? blockErr()
If blockStatus is fault, return error message (or messages on each line)
blockStatus
abstract Str blockStatus()
Return "ok" or "fault"
blockType
abstract Str blockType()
Return implementation type: "fantom"
color
abstract Color color()
Block color to use
dis
abstract Str dis()
Display text which might be mathematical symbol or localized name
doc
abstract Str? doc()
Documentation string formatted in fandoc
instantiate
abstract Block instantiate()
Create an instance of this block for use in a task or composite
markers
abstract Dict markers()
Marker tags used to match the block for "takes" filters
name
abstract Str name()
Name identifier
prop
PropDef? prop(Str name, Bool checked := true)
Lookup property definition by name
props
abstract PropDef[] props()
Property definitions
toStr
virtual override Str toStr()
BlockLib
const mixin BlockLib
Library of block definitions
Methods
| block | Lookup block definition |
Slot Details
block
abstract BlockDef? block(Str name, Bool checked := true)
Lookup block definition
BlockXmlReader
class BlockXmlReader : Obj
Deserialize block tree from XML
Constructors
| make |
Methods
| readBlock |
Slot Details
make
new make(InStream in, BlockLib lib := FantomLib.cur)
readBlock
Block readBlock()
BlockXmlWriter
class BlockXmlWriter : Obj
Serialize block tree to XML
Constructors
| make |
Methods
| writeBlock |
Slot Details
make
new make(OutStream out)
writeBlock
This writeBlock(Block b)
BoolLatch
class BoolLatch : Expr
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.
Fields
| delay | Duration number for how long input must be true before triggering output true |
| delayStart | |
| input | Input condition to monitor |
| latched | |
| reset | Reset output back to false |
Methods
| eval |
Slot Details
delay
@Prop { takes="number" } Block? delay
Duration number for how long input must be true before triggering output true
delayStart
Duration delayStart := 0ns
eval
virtual override Obj? eval(Task task)
input
@Prop { takes="bool" } Block? input
Input condition to monitor
latched
Bool latched
reset
@Prop { takes="bool" } Block? reset
Reset output back to false
BoolLogicExpr
abstract class BoolLogicExpr : Expr
Slot Details
CallRoutine
class CallRoutine : Expr
Call a routine within the same program by name
Fields
| name | Routine name to call |
Methods
| eval | |
| toStr |
Slot Details
eval
virtual override Obj? eval(Task task)
name
@Prop { tags=["routineName":Marker.<ctor>("")] } Str name := "x"
Routine name to call
toStr
virtual override Str toStr()
Cmp
abstract class Cmp : Expr, BinaryBlock
Comparision base class
Fields
| a | |
| b |
Methods
| eval | |
| toStr |
Slot Details
a
@Prop { takes="obj" } virtual override Block? a
b
@Prop { takes="obj" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
toStr
virtual override Str toStr()
CmpEq
class CmpEq : Cmp
Equality comparision
Slot Details
CmpGt
class CmpGt : Cmp
Greater than comparision
Slot Details
CmpGtEq
class CmpGtEq : Cmp
Greater than or equal comparision
Slot Details
CmpLt
class CmpLt : Cmp
Less than comparision
Slot Details
CmpLtEq
class CmpLtEq : Cmp
Less than or equal comparision
Slot Details
CmpNotEq
class CmpNotEq : CmpEq
Not equal comparision
Slot Details
Comment
class Comment : Stmt
Comment
Fields
| text | Comment text |
Methods
| color | |
| stmtType |
Slot Details
color
virtual override Color? color()
stmtType
virtual override StmtType stmtType()
text
@Prop Str text := ""
Comment text
CondDelay
class CondDelay : BoolLogicExpr, UnaryBlock
Add delay to condition after a transition from false to true before evaluating to true
Fields
| deadline | |
| delay | Delay to wait after val transitions to true before whole block evaluates to true |
| lastCond | |
| val |
Methods
| color | |
| eval |
Slot Details
color
virtual override Color? color()
deadline
Int deadline := -1
delay
@Prop Duration delay := 1min
Delay to wait after val transitions to true before whole block evaluates to true
eval
virtual override Obj? eval(Task task)
lastCond
Bool lastCond
val
@Prop { takes="bool" } virtual override Block? val
Const
class Const : Expr
Constant block wraps a scalar value
Constructors
| make | Construct with value |
Fields
| val | Constant value |
Methods
| eval | |
| toStr |
Slot Details
eval
virtual override Obj? eval(Task task)
make
new make(Obj? val := null)
Construct with value
toStr
virtual override Str toStr()
val
const Obj? val := null
Constant value
Continuation
const class Continuation : Err
A continuation can be thrown by a block to highlight that it can only continue after the associated future has completed. Throwing an instance of an object does not mean there is an error.
This asynchronous continuation design follows the same pattern as React's asynchronous loading suspense framework; whereby child components throw a promise that needs to be resolved before the child components can render.
This design is required for blocks that need to suspend and only continue after something else has finished in a separate thread.
Please see AsyncBlock for more information in regards to how to use a Continuation with a Block.
Constructors
| make |
Fields
| DEFAULT_TIMEOUT |
Methods
| get | Return the resolved object from the future or null if it's not completed ok or resolves to null. |
| isComplete | Return true if the continuation is complete. |
Slot Details
DEFAULT_TIMEOUT
const static Duration DEFAULT_TIMEOUT := 1min
get
Obj? get()
Return the resolved object from the future or null if it's not completed ok or resolves to null.
isComplete
Bool isComplete()
Return true if the continuation is complete.
make
new make(Future future, Duration? timeout)
ControlExt
@ExtMeta { name="control"; depends=["point"] } @FinExtMeta { licFeature="finstack"; pngIcon=`fan://controlExt/res/img/icon24.png` } const class ControlExt : FinExt, BlockLib
Control Engine Extension
Methods
| block | Lookup block definition for current project |
| blocks | Get all blocks from current project and installed extensions |
| cur | |
| onStop |
Slot Details
block
virtual override BlockDef? block(Str name, Bool checked := true)
Lookup block definition for current project
blocks
BlockDef[] blocks()
Get all blocks from current project and installed extensions
cur
static ControlExt? cur(Bool checked := true)
onStop
virtual override Void onStop()
CosineWave
class CosineWave : Expr
Generate a cosine wave
Fields
| max | Max value of the range |
| min | Min value of the range |
| period | Period for a full cycle |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
max
@Prop { takes="number" } Block? max := Const.<ctor>(Number.<ctor>(100))
Max value of the range
min
@Prop { takes="number" } Block? min := Const.<ctor>(Number.zero)
Min value of the range
period
@Prop { takes="number" } Block? period := ...
Period for a full cycle
Count
class Count : GridIterator
Count number of the items which match a condition
Fields
| iterator | Expression used to iterate each item. |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
iterator
@Prop { takes="bool" } virtual override Block? iterator := null
Expression used to iterate each item. This block is called with each item using a variable named "it". The block should evaluate to true if the item matches the search condition.
Date
class Date : Expr, UnaryBlock
Get the Date part of a DateTime
Fields
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="dateTime" } virtual override Block? val
DateAdd
class DateAdd : DateTimeAdd
Add a duration from a DateTime. If no units are supplied, then day will be assumed.
Fields
| a |
Methods
| eval |
Slot Details
a
@Prop { takes="date" } virtual override Block? a
eval
virtual override Obj? eval(Task task)
DateSub
class DateSub : DateTimeSub
Substract a duration from a Date. If no units are supplied, then day will be assumed.
Fields
| a |
Methods
| eval |
Slot Details
a
@Prop { takes="date" } virtual override Block? a
eval
virtual override Obj? eval(Task task)
DateTimeAdd
class DateTimeAdd : Expr, BinaryBlock
Add a duration from a DateTime. If no units are supplied, then minutes will be assumed.
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="dateTime" } virtual override Block? a
b
@Prop { takes="number" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
DateTimeSub
class DateTimeSub : Expr, BinaryBlock
Substract a duration from a DateTime. If no units are supplied, then minutes will be assumed.
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="dateTime" } virtual override Block? a
b
@Prop { takes="number" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
DateToDateAdd
class DateToDateAdd : Expr, BinaryBlock
Add one date to another -- returns duration (always day).
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="date" } virtual override Block? a
b
@Prop { takes="date" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
DateToDateSub
class DateToDateSub : Expr, BinaryBlock
Subtract one date from another -- returns duration (always day).
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="date" } virtual override Block? a
b
@Prop { takes="date" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
DateToNumber
class DateToNumber : Expr
Convert a date to a number
Fields
| date | |
| timeSpan |
Methods
| eval |
Slot Details
date
@Prop { takes="dateTime or date or obj" } Block? date
eval
virtual override Obj? eval(Task task)
timeSpan
@Prop { tags=... } Str timeSpan := "year"
DateToString
class DateToString : Expr
Convert a portion of a date to a string
Fields
| date | |
| timeSpan |
Methods
| eval |
Slot Details
date
@Prop { takes="dateTime or date or obj" } Block? date
eval
virtual override Obj? eval(Task task)
timeSpan
@Prop { tags=["enum":"month,weekDay"] } Str timeSpan := "month"
DelayedOutput
class DelayedOutput : Expr
DelayedOutput
Fields
| delayOff | Duration number for how long input must be false before triggering output false |
| delayOn | Duration number for how long input must be true before triggering output true |
| delayOut | |
| delayStart | |
| delayTime | |
| input | Input condition to monitor |
| isDelay | |
| lastInput |
Methods
| eval |
Slot Details
delayOff
@Prop { takes="number" } Block? delayOff
Duration number for how long input must be false before triggering output false
delayOn
@Prop { takes="number" } Block? delayOn
Duration number for how long input must be true before triggering output true
delayOut
Bool? delayOut
delayStart
Duration delayStart := 0ns
delayTime
Duration? delayTime
eval
virtual override Obj? eval(Task task)
input
@Prop { takes="bool" } Block? input
Input condition to monitor
isDelay
Bool isDelay := false
lastInput
Bool? lastInput
DeltaAmountOfHeat
class DeltaAmountOfHeat : Expr
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.
Fields
| counterEnabled | |
| deltaAmountOfHeat | |
| lastDate | |
| pulse | Boolean input |
| pulseCount | |
| reset | Boolean input |
| scaling | Numeric input |
| scalingMultiplier | Numeric input |
Methods
| eval |
Slot Details
counterEnabled
Bool counterEnabled := false
deltaAmountOfHeat
Float deltaAmountOfHeat := 0.0f
eval
virtual override Obj? eval(Task task)
lastDate
DateTime? lastDate
pulse
@Prop { takes="bool" } Block? pulse
Boolean input
pulseCount
Int pulseCount := 0
reset
@Prop { takes="bool" } Block? reset
Boolean input
scaling
@Prop { takes="number" } Block? scaling
Numeric input
scalingMultiplier
@Prop { takes="number" } Block? scalingMultiplier
Numeric input
DewPoint
class DewPoint : Expr
Receives in input a dry bulb temperature value (°C) and a relative humidity value (%) and it calculates the Dew Point (°C).
Fields
| dryBulbTemp | Dry Bulb Temperature (°C) |
| relativeHumidity | Relative Humidity (%) |
Methods
| eval |
Slot Details
dryBulbTemp
@Prop { takes="number" } Block? dryBulbTemp
Dry Bulb Temperature (°C)
eval
virtual override Obj? eval(Task task)
relativeHumidity
@Prop { takes="number" } Block? relativeHumidity
Relative Humidity (%)
DictGet
class DictGet : Expr
Fields
| tagName | |
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
tagName
@Prop { takes="str" } Block? tagName
val
@Prop { takes="obj" } Block? val
DigitalToAnalog
class DigitalToAnalog : Expr
Converts a Digital value (boolean) to an Analog value (number). A value of TRUE returns 1 and a value of FALSE returns 0
Fields
| val | Digital input value (boolean) |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="bool" } Block? val
Digital input value (boolean)
DigitalToAnalogByValue
class DigitalToAnalogByValue : Expr
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
Fields
| falseVal | |
| trueVal | |
| val | Digital input value (boolean) |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
falseVal
@Prop { takes="number" } Block? falseVal
trueVal
@Prop { takes="number" } Block? trueVal
val
@Prop { takes="bool" } Block? val
Digital input value (boolean)
Div
class Div : BinaryMath
Division: a ÷ b. Return null if a or b doesn't evaluate to number.
Slot Details
Do
class Do : Stmt, NaryBlock
Do block evaluates a list of blocks in linear sequence. The entire block evaluates to the result of the last child block.
Fields
| vals | List of statement blocks to run |
Methods
| stmtType |
Slot Details
stmtType
virtual override StmtType stmtType()
vals
@Prop { takes="stmt" } virtual override Block[] vals := Block[,]
List of statement blocks to run
DtToDtAdd
class DtToDtAdd : Expr, BinaryBlock
Add one dateTime to another -- returns duration (always minutes or seconds).
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="dateTime" } virtual override Block? a
b
@Prop { takes="dateTime" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
DtToDtSub
class DtToDtSub : Expr, BinaryBlock
Subtract one dateTime from another -- returns duration (always minutes or seconds).
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="dateTime" } virtual override Block? a
b
@Prop { takes="dateTime" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
Email
class Email : FanStmt, AsyncBlock
Send an email using the configured SMTP connector
Fields
| body | Email content as either plain text or HTML string |
| continuation | |
| subject | Subject line |
| timeout | The asynchronous timeout in seconds. |
| to | List of to email addresses separated by comma |
Methods
| color | |
| eval |
Slot Details
body
@Prop { takes="str" } Block? body
Email content as either plain text or HTML string
color
virtual override Color? color()
continuation
protected virtual override Continuation? continuation
eval
virtual override Obj? eval(Task task)
subject
@Prop { takes="str" } Block? subject
Subject line
timeout
@Prop { takes="number" } virtual override Block? timeout
The asynchronous timeout in seconds.
to
@Prop { takes="str" } Block? to
List of to email addresses separated by comma
Enthalpy
class Enthalpy : Expr
Calculates the Enthalpy when given in input a temperature (°C) and a humidity (%). Output will be in kJ/kg measure.
Fields
| dryBulbTemp | Dry Bulb Temperature |
| relativeHumidity | Relative Humidity |
Methods
| eval |
Slot Details
dryBulbTemp
@Prop { takes="number" } Block? dryBulbTemp
Dry Bulb Temperature
eval
virtual override Obj? eval(Task task)
relativeHumidity
@Prop { takes="number" } Block? relativeHumidity
Relative Humidity
Expr
abstract class Expr : FantomBlock
Base class for expression blocks implemented in Fantom
Slot Details
ExprStmt
class ExprStmt : Stmt, UnaryBlock
Statement wrapper for expression with side-effects
Fields
| val | Expression value |
Methods
| stmtType |
Slot Details
stmtType
virtual override StmtType stmtType()
val
@Prop { takes="obj" } virtual override Block? val
Expression value
FanStmt
abstract class FanStmt : Stmt
Statement which is implemented in Fantom rather than in the interpreter.
Methods
| eval | |
| stmtType |
Slot Details
eval
abstract override Obj? eval(Task task)
stmtType
virtual override StmtType stmtType()
FantomBlock
abstract class FantomBlock : Block
Fantom block definition:
- must subclass
FantomBlock(typicallyExpr) - classname "FooBar" maps to block name "fooBar"
- class must be defined in a pod that declares an extension
- block names must be unique across all installed extensions
- public instance fields become props
- must override
Block.eval
Methods
| def | |
| get | |
| set |
Slot Details
def
virtual override FantomDef def()
get
virtual override Obj? get(PropDef prop)
set
virtual override Void set(PropDef prop, Obj? val)
Get
class Get : Expr
Variable get
Fields
| name | Variable name |
Methods
| eval | |
| toStr |
Slot Details
eval
virtual override Obj? eval(Task task)
name
@Prop { tags=["varName":Marker.<ctor>("")] } Str name := "x"
Variable name
toStr
virtual override Str toStr()
GridIterator
abstract class GridIterator : Expr
Base class for blocks which operate on a collection
Fields
| iterator | Expression used to iterator |
| val | Grid value to iterate |
Methods
| iterate |
Slot Details
iterate
Bool iterate(Task task, |Block->Obj?| onItem)
iterator
abstract Block? iterator
Expression used to iterator
val
@Prop { takes="gridCol" } Block? val
Grid value to iterate
GridSelectCol
class GridSelectCol : Expr, UnaryBlock
Selects the column of a grid
Fields
| colName | Column name of the grid to select |
| val | Grid value |
Methods
| eval |
Slot Details
colName
@Prop Str colName := "colName"
Column name of the grid to select
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="grid" } virtual override Block? val
Grid value
GridSize
class GridSize : Expr, UnaryBlock
Number of rows in a grid.
Fields
| val | Grid value |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="grid" } virtual override Block? val
Grid value
HistoryValue
class HistoryValue : Expr, AsyncBlock
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.
Fields
| continuation | |
| dates | |
| foldOperation | |
| interval | |
| operation | |
| pointId | Point id |
| proj | |
| span | |
| timeout | The asynchronous timeout in seconds. |
Methods
| eval |
Slot Details
continuation
protected virtual override Continuation? continuation
dates
@Prop { takes="str" } Block? dates
eval
virtual override Obj? eval(Task task)
foldOperation
@Prop { tags=... } Str? foldOperation := "count"
interval
@Prop { tags=... } Str? interval := "daily"
operation
@Prop { tags=["enum":"avg,max,min"] } Str? operation := "avg"
pointId
@Prop { takes="str" } Block? pointId
Point id
proj
const static |Task->Proj| proj := Task#.method("proj").func
span
@Prop { tags=... } Str span := "today"
timeout
@Prop { takes="number" } virtual override Block? timeout
The asynchronous timeout in seconds.
If
class If : Stmt
If block performs boolean condition flow control between then and else
Fields
| _else | Statement to run when cond is false |
| cond | Condition used to determine branch |
| then | Statement to run when cond is true |
Methods
| stmtType |
Slot Details
_else
@Prop { takes="stmt" } Block? _else
Statement to run when cond is false
cond
@Prop { takes="bool" } Block? cond
Condition used to determine branch
stmtType
virtual override StmtType stmtType()
then
@Prop { takes="stmt" } Block? then
Statement to run when cond is true
InRange
class InRange : BoolLogicExpr
Return if val is between an inclusive min and max
Fields
| max | Inclusive max for range check |
| min | Inclusive min for range check |
| val | Value for range check, if null then always return false |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
max
@Prop { takes="number" } Block? max
Inclusive max for range check
min
@Prop { takes="number" } Block? min
Inclusive min for range check
val
@Prop { takes="number" } Block? val
Value for range check, if null then always return false
Invoke
class Invoke : Expr, AsyncBlock
Invokes an arbitrary Fantom or Axon function
The invoke block will apply certain execution time restrictions on the function invoked.
Fields
| continuation | |
| funcName | The function name being invoked |
| param1 | The 1st function parameter |
| param2 | The 2nd function parameter |
| param3 | The 3rd function parameter |
| param4 | The 4th function parameter |
| param5 | The 5th function parameter |
| param6 | The 6th function parameter |
| param7 | The 7th function parameter |
| timeout | The asynchronous timeout in seconds. |
Methods
| eval |
Slot Details
continuation
protected virtual override Continuation? continuation
eval
virtual override Obj? eval(Task task)
funcName
@Prop { takes="str" } Block? funcName
The function name being invoked
param1
@Prop { takes="obj" } Block? param1
The 1st function parameter
param2
@Prop { takes="obj" } Block? param2
The 2nd function parameter
param3
@Prop { takes="obj" } Block? param3
The 3rd function parameter
param4
@Prop { takes="obj" } Block? param4
The 4th function parameter
param5
@Prop { takes="obj" } Block? param5
The 5th function parameter
param6
@Prop { takes="obj" } Block? param6
The 6th function parameter
param7
@Prop { takes="obj" } Block? param7
The 7th function parameter
timeout
@Prop { takes="number" } virtual override Block? timeout
The asynchronous timeout in seconds.
IsEven
class IsEven : Expr, UnaryBlock
Check if a number is even whole integer
Fields
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="number" } virtual override Block? val
IsOdd
class IsOdd : Expr, UnaryBlock
Check if a number is odd whole integer
Fields
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="number" } virtual override Block? val
IsType
class IsType : Expr
Checks if a value is an instance of a given type
Fields
| type | |
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
type
@Prop { tags=... } Str type := "Number"
val
@Prop { takes="obj" } Block? val
JobRun
class JobRun : FanStmt, AsyncBlock
Runs Axon code in a Job.
Fields
| axon | The Axon code to execute. |
| continuation | |
| timeout | The asynchronous timeout in seconds. |
Methods
| eval |
Slot Details
axon
@Prop { takes="str"; tags=["axon":Marker.<ctor>("")] } Block? axon
The Axon code to execute.
continuation
protected virtual override Continuation? continuation
eval
virtual override Obj? eval(Task task)
timeout
@Prop { takes="number" } virtual override Block? timeout
The asynchronous timeout in seconds.
LeadLag
class LeadLag : FanStmt
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
setExternalblock 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).
Fields
| numOn | Number of units to command on right now |
| unitsInAlarm | Units program bundle column which specifies if unit is in alarm |
| unitsStageNum | Units program bundle column which specifies stage number |
| unitsWriteVal | Units program bundle column which specifies variable to command true/false |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
numOn
@Prop { takes="number" } Block? numOn
Number of units to command on right now
unitsInAlarm
@Prop { takes="gridCol"; tags=["colType":"Bool"] } Block? unitsInAlarm
Units program bundle column which specifies if unit is in alarm
unitsStageNum
@Prop { takes="gridCol"; tags=["colType":"Number"] } Block? unitsStageNum
Units program bundle column which specifies stage number
unitsWriteVal
@Prop { takes="gridCol"; tags=["colType":"Bool"] } Block? unitsWriteVal
Units program bundle column which specifies variable to command true/false
LeadLagStageSelect
class LeadLagStageSelect : FanStmt
LeadLagStageSelect
Fields
| unitsEnabled | Units program bundle column which specifies whether unit is enabled |
| unitsStageSet | Units program bundle column which specifies variable to set stage number |
| unitsWeight | Units program bundle column which specifies weighting number to order units |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
unitsEnabled
@Prop { takes="gridCol"; tags=["colType":"Number"] } Block? unitsEnabled
Units program bundle column which specifies whether unit is enabled
unitsStageSet
@Prop { takes="gridCol"; tags=["colType":"Bool"] } Block? unitsStageSet
Units program bundle column which specifies variable to set stage number
unitsWeight
@Prop { takes="gridCol"; tags=["colType":"Bool"] } Block? unitsWeight
Units program bundle column which specifies weighting number to order units
Limit
class Limit : MathExpr
Limit val between an inclusive min and max
Fields
| max | |
| min | |
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
max
@Prop { takes="number" } Block? max
min
@Prop { takes="number" } Block? min
val
@Prop { takes="number" } Block? val
MathExpr
abstract class MathExpr : Expr
Base class for binary math blocks
Slot Details
Max
class Max : NaryMath
Maximum of vals. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
Min
class Min : NaryMath
Minimum of vals. Any val which doesn't evaluate to a number is ignored. If no vals evaluate to a number then return null.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
Modulo
class Modulo : BinaryMath
Modulo/remainder: a % b. Return null if a or b doesn't evaluate to number.
Slot Details
Mult
class Mult : NaryMath
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.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
NaryBlock
mixin NaryBlock
Base class for n-ary sequence of children blocks
Fields
| vals |
Methods
| add |
Slot Details
add
Void add(Block val)
vals
abstract Block[] vals
NaryMath
abstract class NaryMath : MathExpr, NaryBlock
Base class for math folding function blocks
Fields
| vals |
Slot Details
vals
@Prop { takes="number or gridCol or obj" } virtual override Block[] vals := Block[,]
Neg
class Neg : UnaryMath
Negate: -val. Return null if val doesn't evaluate to number.
Slot Details
Not
class Not : BoolLogicExpr, UnaryBlock
Logical not of boolean value.
Fields
| val |
Methods
| color | |
| eval |
Slot Details
color
virtual override Color? color()
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="bool" } virtual override Block? val
Now
class Now : Expr
Get the current DateTime for this server
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
OnHolder
class OnHolder : Expr
If input is TRUE, holds the TRUE output for a defined amount of time. If both durations are set, onDuration (seconds) wins over onStatusDuration.
Fields
| deadline | |
| onDuration | Output TRUE status duration (seconds) |
| onStatusDuration | Output TRUE status duration |
| status | |
| val | Boolean input |
Methods
| eval |
Slot Details
deadline
Int deadline := -1
eval
virtual override Obj? eval(Task task)
onDuration
@Prop { takes="number" } Block? onDuration
Output TRUE status duration (seconds)
onStatusDuration
@Prop Duration onStatusDuration := 30sec
Output TRUE status duration
status
Bool status := false
val
@Prop { takes="bool" } Block? val
Boolean input
Or
class Or : BoolLogicExpr, NaryBlock
Logical-or of boolean values
Fields
| vals |
Methods
| color | |
| eval |
Slot Details
color
virtual override Color? color()
eval
virtual override Obj? eval(Task task)
vals
@Prop { takes="bool" } virtual override Block[] vals := Block[,]
Pid
class Pid : Expr
Proportional integral derivative loop
Fields
| direction | Direction of loop |
| kd | Derivative term - gain/rate |
| ki | Integral term - gain/reset |
| kp | Proportional term - band/gain |
| max | Max value to clip output |
| min | Min value to clip output |
| pv | Process variable measuring process |
| sp | Setpoint to compare process variable |
Methods
| eval |
Slot Details
direction
@Prop { takes="bool"; tags=["enum":"reverseAction,directAction"] } Block? direction := Const.<ctor>(((Obj?)true))
Direction of loop
eval
virtual override Obj? eval(Task task)
kd
@Prop { takes="number" } Block? kd
Derivative term - gain/rate
ki
@Prop { takes="number" } Block? ki
Integral term - gain/reset
kp
@Prop { takes="number" } Block? kp
Proportional term - band/gain
max
@Prop { takes="number" } Block? max
Max value to clip output
min
@Prop { takes="number" } Block? min
Min value to clip output
pv
@Prop { takes="number" } Block? pv
Process variable measuring process
sp
@Prop { takes="number" } Block? sp
Setpoint to compare process variable
Pow
class Pow : BinaryMath
Pow: a raised to the b-th power a ^ b. Return null if a or b don't evaluate to number.
Slot Details
Program
class Program : FantomBlock, NaryBlock
Program block is the root of the block tree
Fields
| rec | |
| vals | Routine blocks in program scope |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
rec
Dict? rec
vals
@Prop { takes="routine" } virtual override Block[] vals := Block[,]
Routine blocks in program scope
ProgramNavTree
const class ProgramNavTree : NavTree
ProgramNavTree
Constructors
| make |
Slot Details
make
new make()
Prop
@Serializable facet class Prop : Obj, Facet
Annotates a FantomBlock field as a property
Fields
| tags | Tags map for a block property. |
| takes | Filter pattern to restrict the values accepted by the prop. |
Slot Details
tags
const Str:Obj? tags := Etc.emptyTags
Tags map for a block property. Marker tags are serialized as:
Marker("")takes
const Str? takes
Filter pattern to restrict the values accepted by the prop. See <doc#props>.
PropDef
abstract const class PropDef : Obj
Block property definition
Methods
| doc | Documentation string formatted as fandoc |
| name | Name of the property |
| tags | Tags for prop (includes core tags like name, type) |
| takes | Takes filter if this property def has restricted block types |
| toStr | Return name |
| type | Fantom type of the property |
Slot Details
doc
abstract Str? doc()
Documentation string formatted as fandoc
name
abstract Str name()
Name of the property
tags
abstract Dict tags()
Tags for prop (includes core tags like name, type)
takes
abstract Filter? takes()
Takes filter if this property def has restricted block types
toStr
virtual override Str toStr()
Return name
type
abstract Type type()
Fantom type of the property
PropSetErr
const class PropSetErr : Err
PropSetErr
Constructors
| make |
Fields
| prop |
Slot Details
make
new make(PropDef prop, Str msg, Err? cause := null)
prop
const PropDef prop
Random
class Random : Expr
Generate a random number between min and max inclusive on every cycle
Fields
| max | Max value of the random range |
| min | Min value of the random range |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
max
@Prop { takes="number" } Block? max := Const.<ctor>(Number.<ctor>(100))
Max value of the random range
min
@Prop { takes="number" } Block? min := Const.<ctor>(Number.zero)
Min value of the random range
RecordMaxValue
class RecordMaxValue : Expr
Holds the max value received in input
Fields
| max | |
| reset | Reset input |
| val | Numeric input |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
max
Int? max := null
reset
@Prop { takes="bool" } Block? reset
Reset input
val
@Prop { takes="number" } Block? val
Numeric input
RecordMinValue
class RecordMinValue : Expr
Holds the min value received in input
Fields
| min | |
| reset | Reset input |
| val | Numeric input |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
min
Int? min := null
reset
@Prop { takes="bool" } Block? reset
Reset input
val
@Prop { takes="number" } Block? val
Numeric input
Reset
class Reset : Expr
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.
Fields
| in | Input variable used to compute output |
| inHi | High value of the input used to compute inputs linear equation This value must be greater than inLo. |
| inLo | Low value of the input used to compute inputs linear equation. |
| outHi | High value of the output used to compute output linear equation If this value is less than outLo, the reset is reversed. |
| outLo | Low value of the output used to compute output linear equation If this value is greater than outHi, the reset is reversed. |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
in
@Prop { takes="number" } Block? in
Input variable used to compute output
inHi
@Prop { takes="number" } Block? inHi
High value of the input used to compute inputs linear equation This value must be greater than inLo.
inLo
@Prop { takes="number" } Block? inLo
Low value of the input used to compute inputs linear equation. This value must be less than inHi.
outHi
@Prop { takes="number" } Block? outHi
High value of the output used to compute output linear equation If this value is less than outLo, the reset is reversed.
outLo
@Prop { takes="number" } Block? outLo
Low value of the output used to compute output linear equation If this value is greater than outHi, the reset is reversed.
Return
class Return : Stmt, UnaryBlock
Return exits the routine and returns given expression value
Fields
| val | Expression value to return |
Methods
| color | |
| stmtType |
Slot Details
color
virtual override Color? color()
stmtType
virtual override StmtType stmtType()
val
@Prop { takes="obj" } virtual override Block? val
Expression value to return
Routine
abstract class Routine : FantomBlock
Base class for routine blocks
Fields
| _do | Statement to execute when routine runs |
| didNotRun | |
| dis | Display name of the routine |
| name | Name of the routine, must be valid tag/variable name |
Methods
| eval |
Slot Details
_do
@Prop { takes="stmt" } Block? _do
Statement to execute when routine runs
didNotRun
const static Str didNotRun := "__didNotRun__"
dis
@Prop Str dis := ""
Display name of the routine
eval
override Obj? eval(Task task)
name
@Prop { tags=["routineName":Marker.<ctor>("")] } Str name := "main"
Name of the routine, must be valid tag/variable name
RunCycle
class RunCycle : Routine
Run on a periodic cycle
Fields
| period | Determines which period/speed to run. |
Slot Details
period
@Prop { tags=["enum":"slow,normal,fast"] } Str period := "normal"
Determines which period/speed to run. These speeds may be configured as tags on the ControlExt rec as Numbers tags:
fastPeriodor defaults to 100msnormalPeriodor defaults to 1secslowPeriodor defaults to 10sec
RunManual
class RunManual : Routine
Run only when manually initiated by a user
Slot Details
RunWhen
class RunWhen : Routine
Run when a condition triggers
Fields
| cond | Boolean condition which triggers this routine to run |
| last |
Slot Details
cond
@Prop { takes="bool" } Block? cond
Boolean condition which triggers this routine to run
last
Bool last := true
RuntimeCounter
class RuntimeCounter : Expr
If input is TRUE, the output turns to TRUE only when time expires.
Fields
| deadline | |
| maxOnTime | TRUE expire duration (in seconds) |
| maxOnTimeDuration | TRUE expire duration |
| routine | |
| routineCalc | |
| val | Boolean input |
Methods
| eval |
Slot Details
deadline
Int deadline := -1
eval
virtual override Obj? eval(Task task)
maxOnTime
@Prop { takes="number" } Block? maxOnTime := null
TRUE expire duration (in seconds)
maxOnTimeDuration
@Prop Duration maxOnTimeDuration := 30sec
TRUE expire duration
routine
Int? routine := null
routineCalc
Int? routineCalc := null
val
@Prop { takes="bool" } Block? val
Boolean input
Set
class Set : Stmt, UnaryBlock
Variable set
Fields
| name | Variable name to set |
| val | Expression value to set |
Methods
| color | |
| stmtType |
Slot Details
color
virtual override Color? color()
name
@Prop { tags=["varName":Marker.<ctor>("")] } Str name := "x"
Variable name to set
stmtType
virtual override StmtType stmtType()
val
@Prop { takes="obj" } virtual override Block? val
Expression value to set
SetDelay
class SetDelay : Set
Variable set with a delay.
Fields
| delay | Time delay to wait before setting variable after statement is run |
Methods
| stmtType |
Slot Details
delay
@Prop Duration delay := 1min
Time delay to wait before setting variable after statement is run
stmtType
virtual override StmtType stmtType()
SetExternal
class SetExternal : Stmt
Variable set from an external program
Fields
| name | Variable name to set |
Methods
| color | |
| stmtType |
Slot Details
color
virtual override Color? color()
name
@Prop { tags=["varName":Marker.<ctor>("")] } Str name := "x"
Variable name to set
stmtType
virtual override StmtType stmtType()
SineWave
class SineWave : Expr
Generate a sine wave
Fields
| max | Max value of the range |
| min | Min value of the range |
| period | Period for a full cycle |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
max
@Prop { takes="number" } Block? max := Const.<ctor>(Number.<ctor>(100))
Max value of the range
min
@Prop { takes="number" } Block? min := Const.<ctor>(Number.zero)
Min value of the range
period
@Prop { takes="number" } Block? period := ...
Period for a full cycle
SiteDateTime
class SiteDateTime : SiteExpr
Get the current dateTime for the site associated with the target
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
SiteExpr
abstract class SiteExpr : Expr
SiteExpr is an expression whose task target can be used to look up a site
Slot Details
Sqrt
class Sqrt : UnaryMath
Square root: √a. Return null if a doesn't evaluate to number.
Slot Details
Staging
class Staging : Expr
Compute number of stages which should be one
Fields
| curStages | |
| holdStage | Hold current number of stages |
| lastStageDn | |
| lastStageUp | |
| maxStages | Max number of stages |
| minStages | Min number of stages |
| stageDn | Stage down |
| stageDnDelay | Duration number for stage down time delay |
| stageUp | Stage up |
| stageUpDelay | Duration number for stage up time delay |
Methods
| doStageDn | |
| doStageUp | |
| eval |
Slot Details
curStages
Number curStages := Number.zero
doStageDn
Number doStageDn(Number min, Duration delay)
doStageUp
Number doStageUp(Number max, Duration delay)
eval
virtual override Obj? eval(Task task)
holdStage
@Prop { takes="bool" } Block? holdStage
Hold current number of stages
lastStageDn
Duration lastStageDn := 0ns
lastStageUp
Duration lastStageUp := 0ns
maxStages
@Prop { takes="number" } Block? maxStages
Max number of stages
minStages
@Prop { takes="number" } Block? minStages
Min number of stages
stageDn
@Prop { takes="bool" } Block? stageDn
Stage down
stageDnDelay
@Prop { takes="number" } Block? stageDnDelay
Duration number for stage down time delay
stageUp
@Prop { takes="bool" } Block? stageUp
Stage up
stageUpDelay
@Prop { takes="number" } Block? stageUpDelay
Duration number for stage up time delay
Stmt
abstract class Stmt : FantomBlock
Base class for statement blocks
Methods
| eval | |
| setExternalBundleVar | Perform an external set using a bundle variable |
| stmtType |
Slot Details
eval
virtual override Obj? eval(Task task)
setExternalBundleVar
Void setExternalBundleVar(Task task, Grid bundle, Dict bundleRow, Str varName, Obj? val)
Perform an external set using a bundle variable
stmtType
abstract StmtType stmtType()
StmtType
@Serializable { simple=true } enum class StmtType : Enum
Enum
| doStmt | |
| setStmt | |
| setDelayStmt | |
| setExternalStmt | |
| ifStmt | |
| returnStmt | |
| exprStmt | |
| waitStmt | |
| commentStmt | |
| fanStmt |
Constructors
| fromStr | Return the StmtType instance for the specified name. |
Fields
| vals | List of StmtType values indexed by ordinal |
Slot Details
commentStmt
const static StmtType commentStmt := ...
doStmt
const static StmtType doStmt := ...
exprStmt
const static StmtType exprStmt := ...
fanStmt
const static StmtType fanStmt := ...
fromStr
static new fromStr(Str name, Bool checked := true)
Return the StmtType instance for the specified name. If not a valid name and checked is false return null, otherwise throw ParseErr.
ifStmt
const static StmtType ifStmt := ...
returnStmt
const static StmtType returnStmt := ...
setDelayStmt
const static StmtType setDelayStmt := ...
setExternalStmt
const static StmtType setExternalStmt := ...
setStmt
const static StmtType setStmt := ...
vals
const static StmtType[] vals := ...
List of StmtType values indexed by ordinal
waitStmt
const static StmtType waitStmt := ...
StrCapitalize
class StrCapitalize : UnaryStrConvert
Changes first letter of a string to upper case character.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
StrConcat
class StrConcat : Expr, NaryBlock
String concatenation
Fields
| sep | Separator to use between values |
| vals | Expressions to concatenation |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
sep
@Prop Str sep := ""
Separator to use between values
vals
@Prop { takes="str or gridCol or obj" } virtual override Block[] vals := Block[,]
Expressions to concatenation
StrContains
class StrContains : Expr
Compares if a val string contains substring
Fields
| sub | Substring string to check |
| val | Source string |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
sub
@Prop { takes="str" } Block? sub
Substring string to check
val
@Prop { takes="str" } Block? val
Source string
StrDecapitalize
class StrDecapitalize : UnaryStrConvert
Changes first letter of a string to lower case character.
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
StrEndsWith
class StrEndsWith : Expr
Compares if a val string ends with substring
Fields
| sub | Substring string to check |
| val | Source string |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
sub
@Prop { takes="str" } Block? sub
Substring string to check
val
@Prop { takes="str" } Block? val
Source string
StrFormat
class StrFormat : Expr
String format - see format()
Fields
| pattern | Pattern to use for formatting using Fantom toLocale conventions |
| val | Value to format |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
pattern
@Prop { takes="str" } Block? pattern
Pattern to use for formatting using Fantom toLocale conventions:
Bool.toLocaleInt.toLocaleFloat.toLocaleDuration.toLocaleDate.toLocaleTime.toLocaleDateTime.toLocale
val
@Prop { takes="obj" } Block? val
Value to format
StrLower
class StrLower : UnaryStrConvert
Changes all ASCI letters to lower case
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
StrMacro
class StrMacro : Expr, UnaryBlock
Str macro pattern which uses the same syntax as disMacro and Etc.macro. The macro variables are resolves against the task's variables.
Fields
| val | Macro pattern - see Etc.macro for syntax details |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="str" } virtual override Block? val
Macro pattern - see Etc.macro for syntax details
StrReplace
class StrReplace : Expr
String replace
Fields
| from | Substring to find and replace |
| to | Replacement substring |
| val | Source string |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
from
@Prop { takes="str" } Block? from
Substring to find and replace
to
@Prop { takes="str" } Block? to
Replacement substring
val
@Prop { takes="str" } Block? val
Source string
StrSize
class StrSize : Expr, UnaryBlock
Number of characters in a string
Fields
| val | Source string |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="str" } virtual override Block? val
Source string
StrStartsWith
class StrStartsWith : Expr
Compares if a val string starts with substring
Fields
| sub | Substring string to check |
| val | Source string |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
sub
@Prop { takes="str" } Block? sub
Substring string to check
val
@Prop { takes="str" } Block? val
Source string
StrUpper
class StrUpper : UnaryStrConvert
Changes all ASCI letters to upper case
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
Sub
class Sub : BinaryMath
Subtract: a - b. Return null if a or b doesn't evaluate to number.
Slot Details
Tag
class Tag : Expr
Name/value pair added to a Tags block
Fields
| name | Tag name |
| val | Tag value |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
name
@Prop Str name := "x"
Tag name
val
@Prop { takes="obj" } Block? val
Tag value
Tags
class Tags : Expr, NaryBlock
Builds a dict of name/value tag pairs
Fields
| vals | Tags to add to the dict |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
vals
@Prop { takes="tag" } virtual override Block[] vals := Block[,]
Tags to add to the dict
Task
class Task : Obj
Interpreter and variable scope for block evaluation.
Fields
| AlarmVariableName | |
| id | Tuple program/target ids |
Methods
| clearMonitorMode | |
| monitorMode | |
| monitorPoll | |
| numRoutineErrs | |
| numVarErrs | |
| numVarWarnings | |
| routine | |
| updateMonitorMode |
Slot Details
AlarmVariableName
const static Str AlarmVariableName := "__pendingAlarms"
clearMonitorMode
Void clearMonitorMode()
id
const TaskId id
Tuple program/target ids
monitorMode
Bool monitorMode()
monitorPoll
Grid monitorPoll(Int lastCycle)
numRoutineErrs
Int numRoutineErrs()
numVarErrs
Int numVarErrs()
numVarWarnings
Int numVarWarnings()
routine
Routine? routine(Str routineName, Bool checked := true)
updateMonitorMode
Void updateMonitorMode()
TaskId
@Js const class TaskId : Obj
Tuple of program and target identifiers
Constructors
| make |
Fields
| defVal | Null id |
| programRef | |
| targetRef |
Methods
| dis | |
| equals | |
| fromStr | |
| hash | |
| toStr |
Slot Details
defVal
const static TaskId defVal := TaskId.make(Ref.nullRef, Ref.nullRef)
Null id
dis
Str dis()
equals
virtual override Bool equals(Obj? that)
fromStr
static TaskId fromStr(Str s)
hash
virtual override Int hash()
make
new make(Ref p, Ref t)
programRef
const Ref programRef
targetRef
const Ref targetRef
toStr
virtual override Str toStr()
Ternary
class Ternary : Expr
Check if condition is true and evaluates the true block, otherwise evaluates the false block
Fields
| condition | The condition that is checked for true/false |
| falseValue | The value if condition is evaluated to false |
| trueValue | The value if condition is evaluated to true |
Methods
| eval |
Slot Details
condition
@Prop { takes="obj" } Block? condition
The condition that is checked for true/false
eval
virtual override Obj? eval(Task task)
falseValue
@Prop { takes="obj" } Block? falseValue
The value if condition is evaluated to false
trueValue
@Prop { takes="obj" } Block? trueValue
The value if condition is evaluated to true
ThermalOutput
class ThermalOutput : Expr
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.
Fields
| counterEnabled | |
| lastDateTime | |
| pulse | Boolean input |
| pulseCount | |
| scaling | Numeric input |
| scalingMultiplier | Numeric input |
| thermalOutput | |
| thermalOutputCalculationInterval | Duration input |
Methods
| eval |
Slot Details
counterEnabled
Bool counterEnabled := false
eval
virtual override Obj? eval(Task task)
lastDateTime
DateTime? lastDateTime := null
pulse
@Prop { takes="bool" } Block? pulse
Boolean input
pulseCount
Int pulseCount := 0
scaling
@Prop { takes="number" } Block? scaling
Numeric input
scalingMultiplier
@Prop { takes="number" } Block? scalingMultiplier
Numeric input
thermalOutput
Float thermalOutput := 0.0f
thermalOutputCalculationInterval
@Prop Duration? thermalOutputCalculationInterval := 30sec
Duration input
Threshold
class Threshold : Expr
Threshold returns true when input is above or below a setpoint with configurable deadband.
Fields
| actAbove | Check if input is above setpoint or if false then below setpoint |
| db | Deadband value or if null then defaults to zero |
| in | Input variable |
| sp | Setpoint |
Methods
| eval |
Slot Details
actAbove
@Prop { takes="bool" } Block? actAbove
Check if input is above setpoint or if false then below setpoint
db
@Prop { takes="number" } Block? db
Deadband value or if null then defaults to zero
eval
virtual override Obj? eval(Task task)
in
@Prop { takes="number" } Block? in
Input variable
sp
@Prop { takes="number" } Block? sp
Setpoint
Time
class Time : Expr, UnaryBlock
Get the Time part of a DateTime
Fields
| val | Grid value |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="dateTime" } virtual override Block? val
Grid value
TimeToMinutes
class TimeToMinutes : Expr
Convert a Time to minutes
Fields
| time |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
time
@Prop { takes="time or obj" } Block? time
TimeToTimeAdd
class TimeToTimeAdd : Expr, BinaryBlock
Add one time to another -- returns duration (always minutes).
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="time" } virtual override Block? a
b
@Prop { takes="time" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
TimeToTimeSub
class TimeToTimeSub : Expr, BinaryBlock
Add one time to another -- returns duration (always minutes).
Fields
| a | |
| b |
Methods
| eval |
Slot Details
a
@Prop { takes="time" } virtual override Block? a
b
@Prop { takes="time" } virtual override Block? b
eval
virtual override Obj? eval(Task task)
UnaryBlock
mixin UnaryBlock
Base class for one implicitly named child block
Fields
| val |
Methods
| setVal |
Slot Details
setVal
Void setVal(Block val)
val
abstract Block? val
UnaryMath
abstract class UnaryMath : MathExpr, UnaryBlock
Base class for binary math blocks
Fields
| val |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
val
@Prop { takes="number" } virtual override Block? val
UnaryStrConvert
abstract class UnaryStrConvert : Expr, UnaryBlock
Changes first letter of a string to upper case character.
Fields
| val | Source string |
Slot Details
val
@Prop { takes="str" } virtual override Block? val
Source string
UpAndDownCounter
class UpAndDownCounter : Expr
The output is a numeric value that increases or decreases based on rising edge of the given inputs. The output won't go below zero.
Fields
| counter | |
| decrease | Boolean input |
| decreaseEnabled | |
| increase | Boolean input |
| increaseEnabled | |
| reset | Boolean input |
Methods
| eval |
Slot Details
counter
Int counter := 0
decrease
@Prop { takes="bool" } Block? decrease
Boolean input
decreaseEnabled
Bool decreaseEnabled := false
eval
virtual override Obj? eval(Task task)
increase
@Prop { takes="bool" } Block? increase
Boolean input
increaseEnabled
Bool increaseEnabled := false
reset
@Prop { takes="bool" } Block? reset
Boolean input
Var
abstract class Var : Obj
Variable - Base It defines two base constructors which can be extended on need
Fields
| bindingRef | Filter this variable has binding to a record |
| def | Variable definition tags |
| defVal | Default value read by var definition during construction |
| display | Variable display name |
| kind | Restricted kind of value for variable or null if any kind |
| monitorMode | If variable is trending for debug |
| name | Variable name |
| precision | The variable numeric precision |
| readErr | Temp errors occur during cycle processing and might clear up |
| readTag | If a bound point, tag to read |
| readVal | The value being read |
| ro | Is the variable readonly |
| setLine | Line number of last set in a execution cycle or zero if not written |
| sharedRef | Shared scope identifier if this variable is shared |
| unit | Unit associated with the variable |
| unlinkMode | If in unlink mode, then we don't read/write from bindings/sharing |
| writeErr | |
| writeLevel | If a bound point, pointWrite level |
| writeTag | If a bound point, tag to write |
| writeVal | The value being written |
Methods
| alignReadVal | Can be overridden to calculate whether the set block should assume the readVal is equals to writeVal, by default, if canDoSet can be perfomed, readVal will be aligned |
| canDoSet | Can be overridden to calculate whether the set block can be performed or not (by default it's true) |
| compare | Sort by name |
| curVal | Current value of the variable |
| curValToCell | Get current value as a grid cell safe value |
| doRead | Custom implementation of the read method for a Var Needs to be implemented whenever Var gets extended. |
| doWrite | Custom implementation of the write method for a Var Needs to be implemented whenever Var gets extended. |
| err | If variable is currently in an error condition |
| isComplex | |
| isLinkedTo | Return if this variable is shared with the given variable either thru binding or sharing |
| isShared | Determine whether the Var is a shared var |
| set | Wrapper method for set. |
Slot Details
alignReadVal
protected virtual Bool alignReadVal(Bool canDoSet)
Can be overridden to calculate whether the set block should assume the readVal is equals to writeVal, by default, if canDoSet can be perfomed, readVal will be aligned
bindingRef
const Ref? bindingRef
Filter this variable has binding to a record
canDoSet
protected virtual Bool canDoSet(ReadCache? cache)
Can be overridden to calculate whether the set block can be performed or not (by default it's true)
compare
virtual override Int compare(Obj that)
Sort by name
curVal
protected Obj? curVal()
Current value of the variable
curValToCell
Obj? curValToCell()
Get current value as a grid cell safe value
def
const Dict def
Variable definition tags
defVal
const Obj? defVal
Default value read by var definition during construction
display
const Str? display
Variable display name
doRead
protected abstract Void doRead(Task task, ReadCache cache)
Custom implementation of the read method for a Var Needs to be implemented whenever Var gets extended. If extended Var doesn't support reading, just return or throw a relative exception
doWrite
protected abstract Void doWrite(Task task, ReadCache cache)
Custom implementation of the write method for a Var Needs to be implemented whenever Var gets extended. If extended Var doesn't support writing, just return or throw a relative exception
err
Err? err()
If variable is currently in an error condition
isComplex
Bool isComplex()
isLinkedTo
Bool isLinkedTo(Var x)
Return if this variable is shared with the given variable either thru binding or sharing
isShared
protected Bool isShared()
Determine whether the Var is a shared var
kind
const Kind? kind
Restricted kind of value for variable or null if any kind
monitorMode
Bool monitorMode
If variable is trending for debug
name
const Str name
Variable name
precision
const Int? precision
The variable numeric precision
readErr
protected Err? readErr
Temp errors occur during cycle processing and might clear up
readTag
const Str? readTag
If a bound point, tag to read
readVal
protected Obj? readVal
The value being read
ro
const Bool ro
Is the variable readonly
set
Void set(Obj? val, Int line, ReadCache? cache)
Wrapper method for set. This gets called whenever a variable gets set By default, after executing it, it sets the writeVal equals to readVal. These behavior can be handled by overriding the two methods involved canDoSet, alignReadVal
setLine
Int setLine
Line number of last set in a execution cycle or zero if not written
sharedRef
const Ref? sharedRef
Shared scope identifier if this variable is shared
unit
const Str? unit
Unit associated with the variable
unlinkMode
Bool unlinkMode
If in unlink mode, then we don't read/write from bindings/sharing
writeErr
protected Err? writeErr
writeLevel
const Int writeLevel
If a bound point, pointWrite level
writeTag
const Str? writeTag
If a bound point, tag to write
writeVal
protected Obj? writeVal
The value being written
VarCapture
class VarCapture : Expr
Capture current variables as a dict
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
Wait
class Wait : Stmt
Pause the routine for a specific amount of time
Fields
| time | Amount of time to sleep |
Methods
| color | |
| stmtType |
Slot Details
color
virtual override Color? color()
stmtType
virtual override StmtType stmtType()
time
@Prop Duration time := 1min
Amount of time to sleep
WeatherConditions
class WeatherConditions : WeatherExpr
Get the conditions from a forecast
Fields
| day |
Methods
| eval |
Slot Details
day
@Prop { tags=... } Str day := "today"
eval
virtual override Obj? eval(Task task)
WeatherExpr
abstract class WeatherExpr : SiteExpr
WeatherExpr is an expression whose task target can be used to look up a forecast
Slot Details
WeatherInfo
class WeatherInfo : WeatherExpr
Get the temperature information from a forecast
Fields
| which |
Methods
| eval |
Slot Details
eval
virtual override Obj? eval(Task task)
which
@Prop { tags=... } Str which := "currentTemp"
WeatherSunrise
class WeatherSunrise : WeatherExpr
Get the sunrise from a forecast
Fields
| day |
Methods
| eval |
Slot Details
day
@Prop { tags=... } Str day := "today"
eval
virtual override Obj? eval(Task task)
WeatherSunset
class WeatherSunset : WeatherExpr
Get the sunset from a forecast
Fields
| day |
Methods
| eval |
Slot Details
day
@Prop { tags=... } Str day := "today"
eval
virtual override Obj? eval(Task task)
Within
class Within : Expr
Verifies if the provided numbers are within an offset from the base
Fields
| base | The base number to compare against |
| offset | The offset used to compare, can be expressed in % |
| val1 | A number that is compared against the base if within the offset |
| val2 | A number that is compared against the base if within the offset |
| val3 | A number that is compared against the base if within the offset |
| val4 | A number that is compared against the base if within the offset |
| val5 | A number that is compared against the base if within the offset |
Methods
| eval |
Slot Details
base
@Prop { takes="number" } Block? base
The base number to compare against
eval
virtual override Obj? eval(Task task)
offset
@Prop { takes="number" } Block? offset
The offset used to compare, can be expressed in %
val1
@Prop { takes="number" } Block? val1
A number that is compared against the base if within the offset
val2
@Prop { takes="number" } Block? val2
A number that is compared against the base if within the offset
val3
@Prop { takes="number" } Block? val3
A number that is compared against the base if within the offset
val4
@Prop { takes="number" } Block? val4
A number that is compared against the base if within the offset
val5
@Prop { takes="number" } Block? val5
A number that is compared against the base if within the offset
Xor
class Xor : BoolLogicExpr, BinaryBlock
Logical exclusive-or of two boolean values
Fields
| a | |
| b |
Methods
| color | |
| eval |
Slot Details
a
@Prop { takes="bool" } virtual override Block? a
b
@Prop { takes="bool" } virtual override Block? b
color
virtual override Color? color()
eval
virtual override Obj? eval(Task task)