Appearance
Y305 PLC I/O Modules Analog and PID Guide
Convert a local voltage or remote instrument reading into valid process feedback, calculate a bounded control command, and test the loop before enabling its actuator. Y305-4421 and Y305-8821 provide the 0–10 V channels used here; Y305-4400 and Y305-8800 have no analog I/O.
The calculations, register allocations, and control sequence are design examples, not executable PLC code or a tuned loop. Test the implementation on the intended hardware and firmware before use. Keep controlled equipment disconnected during signal and program tests.
Contents
- Check the analog hardware
- Scale measurements and commands
- Establish measurement validity
- Allocate the manufacturer PID block
- Separate calculation from physical output
- Commission the loop in stages
- Record tests and recovery behavior
1. Check the analog hardware
Y305-4421 and Y305-8821 provide 2 AI + 1 AO, each a 0–10 V voltage channel. Remote feedback also requires the separately selected RS485 option. RTC is a separate option and does not set the control execution period.
| Terminal | Function | PLC device | Nominal relationship |
|---|---|---|---|
| AD0 | Analog input 0 | D8030 | 0–10 V corresponds to 0–4095 |
| AD1 | Analog input 1 | D8031 | 0–10 V corresponds to 0–4095 |
| DA0 | Analog output 0 | D8050 | 0–4095 corresponds to 0–10 V |
| GND | Signal reference | Not a data register | Wire according to the unit’s reference and isolation arrangement |
Follow the unit's drawing. Do not drive DA0 from an external source. A 4–20 mA loop needs a separately designed and tested interface.
Match the sensor output, references, and receiver load to the unit's electrical limits before applying signals. Complete the analog wiring checks before measuring or commanding a channel.
2. Scale measurements and commands
2.1 Nominal conversion
For raw input R, nominal voltage is R × 10 / 4095. If a transducer has a linear 0–10 V transfer function, its engineering value is Eminimum + R × (Emaximum − Eminimum) / 4095.
For an example 0–100% level range, level = R × 100 / 4095; raw 1638 gives a nominal 40%. A 60% output command maps to 2457 only when the receiver maps 0–10 V to a 0–100% command.
| Applied voltage | Ideal raw input | Test point |
|---|---|---|
| 0 V | 0 | Zero |
| 2.5 V | 1023.75 | Lower range |
| 5 V | 2047.5 | Midpoint and rounding |
| 7.5 V | 3071.25 | Upper range |
| 10 V | 4095 | Full scale |
Register readings are integers. These ideal values are calculations, not acceptance tolerances. The manufacturer's 5 V output example uses 2047. Specify whether the application truncates or rounds commands.
2.2 Resolution and arithmetic
The range 0–4095 contains 4096 codes, or 12-bit resolution. The nominal voltage increment, 10/4095 V, is about 2.442 mV. Neither value specifies accuracy, noise, linearity, drift, or update time.
Multiplying a raw value by an engineering range can overflow a 16-bit intermediate even if the final result fits. Use 32-bit or floating-point arithmetic supported by the target, and specify the integer conversion. Test the chosen instructions on the delivered firmware.
Preserve raw readings for diagnostics. Clamping a suspect measurement into the process range does not make it healthy feedback. Apply output limits separately where the program commands the actuator.
3. Establish measurement validity
Zero on a 0–10 V channel can mean a genuine process minimum or an electrical fault. Do not treat zero as a live-zero fault code or use raw range checks alone to prove sensor health. Use sensor diagnostics and a limited-energy simulator to check fault detection for open wiring, sensor faults, and out-of-range signals. Do not short terminals or exceed input ratings.
A steady process can produce a constant reading; an unchanged-value timer alone cannot distinguish that from a frozen signal. Compare the reading with plausible process limits, expected response, and independent observations.
Keep raw measurement, scaled measurement, validity, and alarm cause separate. Measure the lag introduced by filtering and handle protective conditions through the independent protection design. Nominal 12-bit resolution does not determine the sampling or filter time.
PID feedback must track the process; a fixed value can cause integral saturation and abnormal operation. Do not commission a real loop with a constant substituted feedback value. Use a controlled, changing signal for simulation and keep the physical actuator isolated.
4. Allocate the manufacturer PID block
Reserve ten consecutive registers using the PID parameter reference. Choose the setpoint, feedback, block base, and result destination before entering gains.
- Check that the complete block and each operand are free in the project's device allocation. Reserve both words of each floating-point gain.
- Assign a PID calculation channel from 0–4, distinct from concurrent calculations. These are calculation channels; the analog-equipped models have one physical AO.
- Put setpoint and feedback in the same units and numeric representation. Establish the gains' encoding, units, and time basis before loading them.
- Set PMIN and PMAX for the chosen result scale, with PMIN at or below PMAX. Define how that range maps to the actuator command.
- Set KE only after testing its behavior on both sides of the setpoint.
Calculation occurs only when error exceeds KE. Before using this threshold, establish whether the firmware compares signed or absolute error and how the result behaves inside the threshold. Test both sides of the setpoint; do not assume a complete deadband algorithm.
This custom layout is not a drop-in Mitsubishi FX3U PID parameter block. Parameter memory, gain conventions, initialization, and execution behavior are not interchangeable merely because instruction names are familiar.
4.1 Remote instrument feedback to local analog output
With RS485 and analog output fitted, the PLC can read a process value from an external Modbus instrument, calculate a control command, and send a 0–10 V signal to a compatible actuator or drive. Use the instrument's units and scaling for both setpoint and feedback. Its sensor interface belongs to the instrument; this arrangement does not connect a thermocouple, PT100, or current loop directly to the PLC voltage inputs.
The remote-feedback instruction example uses port 1 as Modbus master. It reads one holding register from slave 1 with FC03, raw address 0, into D10. The PID then uses setpoint D0, feedback D10, and parameter-block base D20, with D8050 as its result destination.
That destination writes the physical analog output. Do not use the source fragment as an isolated calculation test. Keep the actuator disconnected and redirect the calculation to ordinary D scratch storage as described in Separate calculation from physical output.
The example setpoint and gains have no defined process units and are not tuning defaults. Initialize the complete block with the numeric format supported by the firmware, reserving both registers of each floating-point value. Do not load floating-point gains with an assumed single-word integer move.
A read request and a PID call triggered by the same timer can leave the PID using the previous reading. Wait for the transaction result and validate freshness before treating D10 as a new measurement. A timer's nominal period does not establish the PID algorithm's internal time basis.
5. Separate calculation from physical output
Calculate the PID result in ordinary D scratch storage, such as D120 if it is free and wide enough for the result. Do not use D8050 as the calculation destination during initial commissioning. Use one output-control path:
- Check operating mode, feedback, parameters, and required permissives.
- Calculate into the scratch destination using the target's numeric format.
- Detect invalid results and overflow where that format supports them.
- Limit the result to the process's permitted command range.
- Map the command explicitly to a 0–4095 integer AO value.
- Clamp that raw value to 0–4095 and write it to D8050 when output-enable conditions are satisfied.
For a 0–100% result scale and a receiver with the same command range, raw AO = command percentage × 4095 / 100, rounded as specified. A different result scale needs a different mapping. PID output is not inherently an AO raw value.
Skipping the PID instruction or a D8050 write does not disable the output. When control is disabled or faults, the final output-control path must execute the chosen output action explicitly. Do not assume that omitting a write clears the last analog command.
Choose disabled and fault actions from the process risk assessment. Zero volts, holding the previous command, and continuing calculation can each be wrong for a particular actuator. Test the receiver's response to signal loss and measure the PLC output during STOP and power loss. Provide independent protection where those transitions could create a hazard; program logic cannot enforce an output action while it is not executing.
Output clamping does not establish integrator anti-windup. Test saturation, re-enable, and manual/automatic transfer before connecting the loop. Obtain a firmware-specific integrator-reset procedure if the application needs one; do not assign a reset register or assume that skipping the instruction resets its internal state.
5.1 Sequence a loop with remote feedback
Run a remote-feedback loop through these application states:
- Acquire: schedule the instrument read with the Modbus transaction sequence. Preserve the last accepted measurement separately from the transaction buffer.
- Validate: accept new feedback only after a successful transaction and value checks. Track its update time and any instrument diagnostic bits defined by the instrument's map. A completion flag alone is insufficient.
- Scale: convert the accepted value into the same units and numeric representation as the setpoint. Test negative values, decimal scaling, and word order where applicable.
- Calculate: while enabled and feedback is valid, run the control calculation into ordinary D scratch storage at the tested execution cadence. Define a maximum feedback age; do not let a missed poll silently extend it.
- Apply: reject invalid results, limit the command, map it to 0–4095, and write D8050 through the single final output-control section.
- Handle faults: on timeout, invalid feedback, or expiry, execute the selected fault-output action and recovery rules. This branch must not depend on receiving another successful measurement.
Keep communication timing, measurement age, and control execution period distinct. If control runs between polls, define how long it may use the last valid reading and test that sample-and-hold behavior. If it runs only after a new reading, test the variable interval caused by bus delays. Neither approach supplies an undocumented PID sampling-time setting.
A fresh reading after a fault need not restart the loop automatically. Apply the process's acknowledgment, output-enable, and transfer rules, then test recovery from a lost reply, a stale value, and an instrument restart.
6. Commission the loop in stages
| Stage | Test | Continue when |
|---|---|---|
| Convert | Apply known low, middle, and high voltages within the AI limits, or inject known remote values | Raw reading, engineering units, and validity agree with the source |
| Calculate | Use changing simulated feedback with the physical output disabled | Error direction, KE behavior on both sides, parameter initialization, and PMAX/PMIN match the expected calculation |
| Bound | Introduce invalid feedback, expiry, invalid parameters, and commands beyond the permitted range | The final output path applies limits and the selected disabled/fault action |
| Measure AO | Keep the receiver disconnected; use a suitable measurement load | Zero, midpoint, and full-scale commands meet the agreed voltage tolerances |
| Run the process | Enable a limited-energy plant test with a defined means to stop it | Control direction and conservative tuning produce the required response without exceeding process limits |
Record the control execution period and jitter. Do not infer a sampling period from the parameter block or transfer another controller's gains without checking the algorithm and time basis. Pause tuning if the raw measurement, control direction, or final output mapping is wrong.
7. Record tests and recovery behavior
Record hardware, firmware, software, sensor range, AO scaling and load, calibration equipment, tolerances, register allocation, execution period, gains, and measured response.
Include saturation, sensor loss, disabled control, manual/automatic transfer, restart, and output re-enable tests. Specify how feedback becomes valid again and whether recovery requires operator acknowledgment. Keep raw readings and command trends to distinguish scaling errors from tuning problems. The Wiring and Applications Guide gives an example interlock and restart sequence.
