Explainer
Why FB41 has no ramp function for an analog output command
Short answer
FB41 contains PID control only — there is no ramp-function generator in the block. Ramp the drive reference yourself: run a rate limiter at a fixed interval, move a stored value toward the target by rate times interval, clamp each increment at the target, then scale to analog output counts. On a SINAMICS speed reference, set the drive's ramp-up and ramp-down times instead.

On this page
- FB41 is a controller, and a ramp is a different function
- Where the ramp belongs in the signal chain
- The arithmetic: rate, interval, clamp
- Scheduling and state on a CPU 312
- Scale after the ramp, in one place
- Consider the drive's ramp-function generator first
- Test the ramp end to end
- The decision
- Questions asked
FB41 has no ramp function. It is a PID controller, and nothing in it limits how fast its setpoint or output may move, so a ramp drawn as a slope at the analog output never comes from FB41 alone. On an S7-300 CPU 312 the answer is to write the ramp yourself: a rate limiter that runs at a fixed interval, moves a stored value toward the target by rate times interval, clamps each increment at the target, and hands the result to the analog output scaling. The one exception is a SINAMICS drive, whose own ramp-function generator already does the job. This article shows where the ramp belongs in the signal chain, works the arithmetic with real numbers, and ends with the decision for each case.
FB41 is a controller, and a ramp is a different function #
FB41 is the continuous controller in the STEP 7 standard library. It takes a setpoint and a process value, applies proportional, integral and derivative action with anti-windup, and produces a manipulated value from the error. Its interface carries no ramp-up or ramp-down time input; there is no setting that limits the rate of change of anything. A ramp-function generator is a different function: it limits how quickly a command moves toward a target, independent of any feedback loop.
Siemens ships that function in three other places: a standalone Ramp function block published for STEP 7 in TIA Portal, the ramp-function generator built into SINAMICS converter firmware, and the Modular PID Control package. On classic STEP 7 V5.4 with a CPU 312, none of those is loaded in a default project, which is why the practical answer on that hardware is a limiter you write. Where FB41 itself is scheduled, the ramp block belongs in the same kind of call — one instance, one fixed interrupt — as described in calling FB41 and FB42 PID loops in OB35 with one DB per bank.
Where the ramp belongs in the signal chain #
Name the three signals before you write anything: the target command that the operator or the program requests, the ramped command that moves toward it, and the scaled counts that the analog output module receives. They are different signals with different jobs, and conflating them is the usual reason a ramp behaves oddly.
For an open-loop speed reference, ramp the reference first and scale afterward; the drive then follows the slope. For a closed loop, ramp the setpoint before FB41, and understand what that buys you: the controller output still responds to process error and will not follow a straight ramp. The ramp softens the demand presented to the controller; it does not shape the output.
Do not put the limiter after the controller instead. A limit on the PID output that the actuator cannot follow makes integral action accumulate while the value is held back — integral windup — unless you coordinate the limit with the block's tracking input. Ramp the demand, not the controller output.
When the profile needs dwell intervals, holds, or fixed intermediate targets, that is a sequence rather than a single slope, and the ramp soak profile built from ladder logic covers that shape.
The arithmetic: rate, interval, clamp #
The permitted increment for each call is rate multiplied by interval. If a ramp duration is specified instead of a rate, compute rate as the absolute command change divided by the required duration. Each call compares the stored ramped value with the target: below it, add the upward increment; above it, subtract the downward increment; then clamp at the target. Keep both rates as positive magnitudes so acceleration and deceleration can differ.
Worked example. A motor drive reference spans 0 to 50 Hz, with an up rate of 5 Hz per second, a down rate of 10 Hz per second, and the block called every 100 ms. The upward increment is 5 Hz/s × 0.1 s = 0.5 Hz per call; the downward increment is 10 Hz/s × 0.1 s = 1.0 Hz per call. Stepping the target from 10 Hz to 40 Hz takes 30 Hz ÷ 5 Hz/s = 6.0 s, and the return trip from 40 Hz to 10 Hz takes 30 ÷ 10 = 3.0 s. On the last call before arrival the ramped value sits at 39.7 Hz; adding the increment gives 40.2 Hz, and the clamp holds it at 40.0 Hz. Clamping the final increment at the target is what keeps the discrete calculation from overshooting and hunting around the setpoint.
The same three elements — stored value, interval-based increment, target clamp — are all a rate limiter needs on any platform; implementing a soft-start ramp in ladder logic on a PLC-5 shows the same pattern on a different controller family.
Scheduling and state on a CPU 312 #
Run the limiter in a cyclic interrupt with a known interval — OB35 at 100 ms is a workable choice — and compute each increment from exactly that interval, because a mismatch between the assumed and actual interval changes the slope by the same proportion. Store the ramped value in a data block real, not temporary local memory, so the value persists between calls. On a controller restart, or on a transfer from manual to automatic, initialize the stored value to the reference actually in use at the drive, so the handover contains no step.
A dozen reals and a handful of compare and limit operations are small even for a CPU 312, but the model name alone does not establish spare capacity: check the project's actual memory and scan load before adding blocks, yours or anyone else's.
Scale after the ramp, in one place #
Keep the ramp in engineering units and convert to output counts at a single point in the program, in the network that owns the final write, so no other code overwrites the module. Example: the output module is configured for 0 to 10 V and the reference span is 0 to 50 Hz; S7 analog outputs use 0 to 27648 counts across the nominal range. A 40 Hz command scales as 40 ÷ 50 × 27648 = 22118.4, written as 22118 counts, which corresponds to 8.0 V. If the scaling arithmetic is unfamiliar, scaling a PID real output to analog output counts works through it step by step. Mixing the ramp and the scale into one formula makes the ramp rate depend on the module range — keep the two operations separate.
Consider the drive's ramp-function generator first #
If the analog channel feeds a speed reference into a SINAMICS converter, the drive already contains the function: a ramp-function generator in its setpoint channel, configured with ramp-up time p1120 and ramp-down time p1121, exists to limit acceleration on abrupt setpoint changes and prevent load surges through the drivetrain. Setting those two times gives you the slope with no PLC code, and the profile survives a PLC program change. Prefer the PLC limiter when the same output card serves more than one device, when the program logic must see the ramped value itself, or when the drive offers no ramp function. If you would rather use a ready-made PLC block, configuring a STEP 7 S7 setpoint ramp with the FB67 rate limiter walks through a packaged limiter on classic STEP 7.
Test the ramp end to end #
Trend four signals together — target, ramped engineering value, output counts, drive speed — so command generation stays distinguishable from mechanical response. Then check, with the machine under the site's commissioning procedure:
- Constant target: the ramped value reaches the target and holds, with no alternation above and below it.
- Slope: the measured slope of the ramped value matches the configured rate, within the update and conversion resolution.
- Duration: the time from leaving the initial value to reaching the target equals the command change divided by the applicable rate — 6.0 s for the 30 Hz upward step in the example.
- Mid-ramp target change: the ramp redirects from the value it holds at that moment, with no reset and no output step.
- Counts: the written counts and the resulting voltage agree with the scaling arithmetic above.
One safety note: a ramp rate chosen to protect a mechanism is a process function, not a safety function — validate it against the machine's risk assessment rather than treating the limiter as protective equipment.
The decision #
- FB41 cannot ramp anything: it has no ramp inputs, so do not use it for the slope.
- If the analog output is a speed reference into a SINAMICS converter, set the drive's ramp-up and ramp-down times in p1120 and p1121 and send the raw target from the PLC.
- For anything else on STEP 7 V5.4 with a CPU 312, write the limiter: a data-block-stored real, a fixed cyclic interrupt, each increment computed as rate times interval and clamped at the target, then scaled in one place before the output write.
- If you want a packaged block — the Ramp block in TIA Portal, the Modular PID package, or the FB67 route — verify CPU compatibility and the project's memory and scan load before you install it.
Twenty networks of logic or fewer covers the PLC-side case, and the checks above prove it does what the profile drawing asks.
Questions asked
Does FB41 have ramp-up and ramp-down inputs?
No. FB41 is a continuous PID controller: it computes a manipulated value from setpoint error with proportional, integral and derivative action and anti-windup, and its interface carries no ramp time parameters. The ramp-function generator in the Siemens portfolio lives in a separate Ramp block, in SINAMICS drive firmware, or in the Modular PID Control package, so on a CPU 312 you write a small rate limiter or configure the drive.
Can I run the ramp block in the same cyclic interrupt as FB41?
Yes. The ramp needs the same thing the controller needs: a fixed, known interval, because each increment equals rate times interval. Running both blocks in the same cyclic interrupt keeps the ramp and the PID update locked together, so the command moves exactly one increment per controller update and the slopes you measure match the rates you configured.
What happens if I limit the output after FB41 instead?
The controller then demands an output the actuator cannot follow, and integral action keeps accumulating while the limiter holds the value back, which is integral windup. The overshoot once the limiter releases can be worse than the step you were trying to soften. Ramp the setpoint before the controller, or use the block's tracking input if you must constrain its output.
Where in the drive is the ramp configured?
On SINAMICS converters the ramp-function generator sits in the setpoint channel, with ramp-up time in p1120 and ramp-down time in p1121. The PLC then writes the raw target to the analog output and the drive shapes the slope, so the profile survives a PLC program change and stays independent of scan load.


