Create: Runtime¶
Runtime tools execute during the simulation to read and write global variables, apply control logic, condition signals, detect events, and expose reusable functions and tables to UDFs. They are evaluated at each runtime step (or on their configured cadence) and can be combined in a chain—for example, a filtered sensor signal can drive a PID controller, or an event detector can trigger a scripted response.
Runtime Tools
Global Script: A Global Script is a self-contained C-style routine that reads and writes global variables to encode arbitrary update logic. Global scripts behave like small embedded programs, using the same math library as system UDFs and producing side effects only through global variables.
Control Loop: The Control Loop block implements standard PID controller families that adjust a control variable in response to a process variable’s deviation from its set point. Users can configure limits and control parameters and other common features so that the controller behaves like a conventional industrial loop. In practice, this allows the simulation to model real-world closed-loop operations, such as holding impeller speed to achieve a target power draw, adjusting gas flow to maintain dissolved-oxygen levels, or modulating jacket duty to control temperature. It is best thought of as a built-in feedback controller acting directly on the simulated plant.
Statistic Filter: The Statistic Filter block consumes one or more global variables and writes filtered or derived statistics to another variable. This provides smoothing or summarizing of data in real time—running or rolling averages, variance, RMS values, min/max tracking, and similar metrics. Its purpose is analogous to a signal-conditioning stage in instrumentation, like an RC filter or a true-RMS meter that cleans up or summarizes a raw sensor signal before it is passed to a controller or logged for analysis. For example, you might use a filter to smooth torque data before a PID loop, calculate rolling variance of dissolved oxygen as a mixing-time proxy, or track RMS pressure oscillations.
Event Detector: An Event Detector monitors a chosen input global variable and asserts an event whenever a specified threshold is crossed. It can record the time of the first occurrence, count repeated crossings, and distinguish between upward or downward crossings. One-shot mode latches on the first crossing, while multi-shot mode functions like a running counter. The concept is similar to a comparator with an edge detector in electronics or to a limit switch with a counter in mechanical systems. Within a simulation, it is useful for actions such as identifying when a setpoint is first reached, counting oscillations in pH, or recording the time at which a stress threshold is exceeded.
Lookup Table: A Lookup Table provides sampled data that other components can query at runtime. Users define tabulated data, and the solver performs interpolation when the table is called from a UDF or other logic. This allows empirical correlations or vendor-supplied curves—such as viscosity versus temperature, pump head versus flow, or heat-transfer coefficients versus Reynolds number—to be used directly in the model without writing long conditional statements.
Function Library: The Function Library is where users can define new reusable functions that behave like built-in functions. These functions accept inputs, perform arbitrary calculations, and return outputs. Once defined, they can be invoked anywhere an expression is permitted within local or global UDFs. This is the preferred route for packaging a bespoke correlation or transformation which will be in multiple places across a model.