FB_Ramp (Function Block)

Generates a ramp signal that rises or falls at a fixed rate indefinitely.

The output starts at StartValue and advances at Rate units per second. A positive rate produces a rising ramp, a negative rate a falling ramp. Changing Rate mid-run takes effect immediately.

Calling Reset() returns the output to StartValue.

Note

The block is FINAL and must be instantiated, not extended. Use FB_init to set fStartValue and fRate at declaration time.

Extends: FB_SoComponent

Properties

Rate

Type: LREAL

Gets or sets the rate of change in units per second.

A positive value produces a rising ramp, a negative value a falling ramp. Changes take effect immediately.

StartValue

Type: LREAL

Gets or sets the start value.

This is the output value the ramp returns to after a Reset().

Methods

FB_init

Inputs

Name

Type

Description

bInitRetains

BOOL

if TRUE, the retain variables are initialized (warm start / cold start)

bInCopyCode

BOOL

if TRUE, the instance afterwards gets moved into the copy code (online change)

fStartValue

LREAL

Initial output value.

fRate

LREAL

Rate of change in units per second. Negative values produce a falling ramp.

Reset

Resets the output to the start value set in FB_init. The rate is unaffected.

Run

Advances the ramp by one time step.

Note

Must be called once per cycle on a single PLC task. If the measured cycle time is zero the method returns early without updating the output.