IMDHMIControls LibraryShop main store

How-to

How to program FX2N PID tension control with the built-in instruction

PLC programming Published 5 min read By IMDHMI controls team

Short answer

The FX2N has the PID built in: its operands and parameter table are in section 5.9.8 of the FX2N programming manual. Write the parameter block on the first scan, keep the sampling time longer than the scan time, move the output through an analog block rather than the FX2N-80MR relay outputs, and tune at the empty-core roll.

On this page
  1. The instruction computes a number, not a signal
  2. Route feedback and reference through analog blocks
  3. Program the loop in this order
  4. Worked example: setting the sampling time from a 7 ms scan
  5. Prove the loop before you hand it over
  6. Questions asked

The FX2N-80MR in your panel already contains the function you need: a built-in PID instruction whose operands and parameter table are defined in section 5.9.8 of the FX2N programming manual, page 248 of 468. No add-on function block is required. What the instruction will not do is produce a physical signal. Your ladder scales the tension feedback into it and carries its output register out to an analog block, because the MR suffix means relay outputs, and a relay cannot deliver a continuous drive reference. Write the parameter block on the first scan, keep the sampling time longer than the scan time, and tune at the empty-core roll, where process gain is highest. The rest of this article is that loop in order.

The instruction computes a number, not a signal #

The PID instruction takes a setpoint, a process value, a block of parameter registers and an output register, and it recalculates the output at the sampling interval you configure. It generates no voltage and no current: between the instruction and the drive sit your analog special function blocks.

The parameter block holds the sampling time, the action direction, the input filter and the proportional, integral and derivative settings. The register offsets and the valid range for each entry are printed in the section 5.9.8 table, so read them there and never guess: a block written with the wrong offsets runs with plausible-looking but wrong tuning.

The instruction is also not portable across ranges. The FX2N, FX3U and System Q each define their own PID. The Q, L and QnA programming manual describes its PID control instructions as the velocity type, with limits (0 to 2000), while the FX2N works from the parameter table above. A program copied from another range compiles and then misbehaves, so confirming the CPU model is the cheapest check you will make all day.

Route feedback and reference through analog blocks #

Read the tension transducer, load cell or dancer, through an analog input special function block such as the FX2N-4AD, which brings four input channels. One tension loop consumes one channel and leaves three for a diameter or line-speed trim, or a second zone. Send the PID output register to an analog output special function block that feeds the drive speed or torque reference. Choose both from the FX2N special function block list in the manual.

Do not map the output to the relay outputs. A relay can neither resolve a continuous reference nor survive fast cycling as an actuator.

Scale the transducer signal into the same engineering range as the setpoint, raw counts or percent but one unit for both, the same discipline shown in how the S7-200 PID wizard scales its inputs to 0.0 to 1.0. Verify that scaling with the loop open: gain changes achieve nothing while the feedback is reversed or clipped.

Program the loop in this order #

  1. Confirm the CPU is an FX2N and open the PID section of its own manual; do not work from an FX3U or System Q listing.
  2. With the loop open, scale the transducer into the setpoint range and check in the device monitor that the process value tracks tension.
  3. Decide actuator polarity: does more output raise tension or lower it? Set the action direction to match, and prove it by stroking the output a few percent.
  4. Write the parameter block from the first-scan contact so the sampling time and gains exist before the instruction executes, then confirm the registers are nonzero.
  5. Set the sampling time longer than the measured scan time, read from the CPU scan-time special register listed in the manual. The worked example below sets this value.
  6. Tune proportional action first: integral at its slowest setting, derivative zero. Raise the gain until the loop rings slightly on a step, then back off to roughly half.
  7. Add integral action to remove steady-state error, and hold the integrator at the output limits so a saturated output cannot wind up and overshoot on release.
  8. Add derivative last, and only if the transducer signal is clean; otherwise leave it at zero and use the input filter instead.
  9. Clamp the output to the range the drive accepts, and preload the output register when switching from manual to auto so the changeover does not bump the drive.

Worked example: setting the sampling time from a 7 ms scan #

Inputs:

  • Scan time: an example reading of 7 ms from the CPU scan-time special register; take your own in the device monitor with the program running.
  • Rule: the sampling time must be longer than the scan time, or the output updates in irregular steps.
  • Margin: at least twice the scan time, rounded up to a value the section 5.9.8 table allows.

Arithmetic:

  • Minimum with margin: 2 x 7 ms = 14 ms.
  • Round up to an allowed value: 20 ms.
  • Headroom: 20 ms - 7 ms = 13 ms, the amount the scan may grow before the PID interval is caught.

Result: write 20 ms into the sampling-time parameter of the block.

Decision: run there while the measured scan stays below that interval. The moment the scan reaches 20 ms, typically after adding communication instructions or more analog blocks, move the sampling time up one allowed step and repeat the setpoint step test; once the scan passes the sampling time the loop updates irregularly and no gain change will fix it.

Prove the loop before you hand it over #

Apply a small setpoint step and record process value and output together: accept limited overshoot and a settling time the process tolerates. Change roll diameter or line speed while running and watch the process value return to setpoint without sustained oscillation. Run both extremes, empty core and full roll, because the empty core is the highest-gain condition and the full roll the most sluggish. The same step-and-halve discipline transfers directly to tuning a PID tension loop on another PLC.

With the drive in a safe state, disconnect the feedback signal: the output must fall to a defined state, not run away. Finally, confirm in the device monitor that the output register never exceeds the clamp limits set in step 9.

Questions asked

The PID output sits at zero or pins at full scale. Where do I look first?

Watch setpoint, process value and output in the device monitor for one minute. A frozen zero usually means the enable contact is off or the parameter block was never loaded, so the sampling time and gains are still zero. A pinned output points to a reversed action direction, feedback scaling that runs out of range, or integral windup. Confirm that raising the output moves tension the way the action direction assumes before you touch any gain.

Why does the tension loop oscillate only near the empty core?

Process gain changes with roll diameter: the same output correction moves tension more on a small roll than on a full one, so gains that look calm on a full roll ring at the core. The empty core is the highest-gain condition, so tune there and accept that full roll will feel sluggish; that asymmetry is normal for fixed gains. If it becomes a production problem, the next step is a diameter-based gain schedule, not retuning the whole loop.

Can I copy an FX3U or System Q PID program into the FX2N?

Not as-is. Each range defines its own instruction: the Q, L and QnA manual describes velocity-type PID control instructions with limits (0 to 2000), and the FX3U differs from the FX2N parameter table. Port the intent instead - setpoint, feedback range, action direction and gains - into the FX2N block, then retune, and expect the output scale and register map to change on the way.

When should I stop and escalate to the manufacturer?

Stop once the parameter block, the sampling time and the I/O scaling all verify correct and the output still stays frozen or the instruction faults. Contact Mitsubishi Electric support with the CPU model, the firmware version and a dump of the parameter registers; that set lets support reproduce the parameter side of the problem without your machine running.

Keep reading

  • How-to

    How to program belt feeder ratio blending control on a PLC

    Program continuous ratio blending by gating the recipe on a 100% ratio sum, computing every feeder setpoint as total rate times its ratio, measuring each belt's flow as belt load times belt speed, and closing one PID loop per feeder onto its VFD speed reference. Verify the blend with accumulated mass per feeder over the same window before releasing product.

    PLC programming

  • How-to

    Scaling a PLC-5 FLEX analog output from PID 0-4095 to 0-30840

    A PLC-5 PID drives its control variable from 0 to 4095, while a FLEX analog output channel configured for the current loop expects output data from 0 to 30840, so a raw CV gives 6.125 mA at 100 percent. Leave the PID limits at 0 and 100 percent, scale the control variable times 30840 divided by 4095 into a separate integer word, and point the BTW at that word. The CV word and the BTW data word must be different addresses.

    PLC programming

  • How-to

    Motorized valve ratio control: choosing FB41 or FB42

    Drive the valve with FB41 CONT_C when it takes a 4-20 mA positioner and FB42 CONT_S when open and close motor contacts run it. Scale all five flow words with FC105, compute the setpoint as Y times the sum of the four measured flows in m³/h, clamp it to the line capacity, and call the loop from a cyclic interrupt.

    PLC programming