Machinery TwinDocs

Function reference

Every variable function, formula, parameters, and what it's for.

Functions compute a variable's value each tick. All except MasterTime read an input variable x. The result additionally passes through the common modifiers.

MasterTime

The free-running master clock, the heartbeat of most simulations.

Value: ramps from min to max at speed, then wraps around.

ParameterMeaning
Minimum / maximumThe cycle range (e.g. 0–360 for an angle)
SpeedUnits per second

Use it as the master for cams, the movement variable of paths, or the crank angle of mechanisms.

Sine

Value: amplitude · sin(2π · x / period + phase)

ParameterMeaning
AmplitudePeak value
PeriodLength of one cycle, in input units
PhasePhase offset

Feed it a MasterTime input for smooth oscillation, vibratory feeders, shakers, bobbing indicators.

TwoValuesFloat

A threshold switch.

Value: x ≥ threshold ? onValue : offValue

ParameterMeaning
ThresholdSwitch point on the input
Off / on valueOutput below / at-and-above the threshold

Turns an analog input into a two-state output: position → clamp closed flag, PLC bool (0/1) → offset applied to some axis.

TwoValuesColor

Like TwoValuesFloat, but the outputs are colors, so the variable becomes bindable as an object's color source.

ParameterMeaning
ThresholdSwitch point on the input
Off / on colorHex colors output below / above

The one-liner status lamp: bind an object's color to this variable, feed the alarm bit in. See Appearance.

Copy

Value: scaleFactor · (x + inputOffset) + outputOffset

A scaled, offset copy of another variable. The Swiss-army knife: unit conversion, inverting a direction (scale −1), staggering copies of a master, deriving a follower that lags a leader by a fixed amount.

Chain functions across variables

Functions take one input, but variables chain: MasterTime → Sine → TwoValuesFloat is three variables, each reading the previous one. The dependency order resolves the whole chain every tick, and Signal trace visualizes it.

On this page