A recipe name that mixes letters and digits cannot ride into the PLC as a numeric ingredient. Give each of the 120 recipes a fixed ID, have the panel write that ID on selection, and let the PLC resolve it through a 120-entry string lookup table with a range check before indexing.
An alphanumeric recipe name cannot ride into the PLC as a numeric recipe ingredient. The handoff that works is a number: give every recipe a fixed ID from 1 to 120, have the panel write that ID to a PLC tag when the operator selects a recipe, and let the PLC resolve the ID to the name through a string lookup table. The name then lives where every consumer can read it: the panel's message line, a batch record, a second screen on the line. This walkthrough builds the ID map, sizes the string field, wires the selection and checks the whole path.
Why the ID replaces the name
Recipe names that mix letters and digits will not fit a numeric ingredient field. Packing the letters into integer words with a home-made encoding means defining a character set, a length rule and decode logic on both ends, and everyone who edits that program afterwards inherits the decoder. Treat the on-screen recipe label as a display property of the panel until its documentation shows a readable tag for it.
Squeezing text through numeric words also has a known failure mode, the same one behind the HMI that cannot map the PLC string file: the bytes arrive, the meaning does not. Skip the packing step.
What you need
- The controlled recipe list: all 120 entries with their final names, and the longest name measured in characters.
- A string tag type in the PLC. String capacity differs by platform: one documents a default STRING type storing up to 82 characters, another documents a string type of up to 254 characters with one byte for the declared maximum and one for the current length. Check your controller's data-type documentation for the figure that applies.
- One integer tag in the panel-to-PLC mapping to carry the selected ID.
- One fault tag for rejected IDs.
Size the name field from your own list with margin: an 8-character name such as ALLOY-7B sits comfortably in a 16-character field. If the controller itself is still on the table, choosing a PLC for recipe storage and one PID loop walks the same storage sizing from the selection side.
Build the ID-to-name table
Give each recipe a fixed ID from 1 to 120 and keep the pairs in one controlled list that travels with the recipe file.
| ID | Name | Note |
|---|---|---|
| 1 | BASE-01 | first entry |
| 47 | ALLOY-7B | 8 characters |
| 120 | PASTE-04A9X | longest name, 11 characters |
In the PLC, declare an array of 120 strings and populate it from that list. A one-based array, indexed 1 to 120, matches the IDs with no arithmetic. If the platform forces zero-based arrays, index the table with the ID minus 1 and comment the offset at the declaration.
Wire the selection to the ID
- Assign the fixed IDs and publish the list. One ID per recipe, one recipe per ID, all 120 entries.
- In the panel project, make the selection action write the selected recipe's ID to the PLC tag. Check the project's tag list for the selected index of the recipe or list object; if there is none, add a parallel selector that writes the same IDs.
- Make the ID follow the recipe actually loaded, so the number cannot lag behind what the screen shows.
- Validate the ID on every change in the PLC: a value below 1 or above 120 sets the fault tag, and the table is not indexed.
- On a valid change, copy the table entry into the working name variable with a one-shot, so the copy runs once per selection.
- Index the recipe data array with the same ID, so the name and the ingredients can never disagree.
For step 4, reject the value instead of pulling it to the nearest valid entry. A silently corrected ID loads the wrong recipe into a running machine, and that is the one real hazard in this scheme. Clamping suits operator-entered setpoints elsewhere; clamping HMI numeric entry limits in PLC ladder logic shows those rungs. Keep rejection for the selection key.
Use the resolved name
With the ID in the PLC and the name resolved, the text goes where it is needed. On the panel, embedding a PLC variable in an HMI message string puts the live recipe name into prompts and alarms. Downstream, treat the name as data for batch records, printers or a line display, and keep the ID as the key so edits to the wording never break a consumer.
Example: 120 recipes, 16-character names
The list holds 120 entries, the longest name is 11 characters and the field is sized at 16 characters.
Table budget: each string carries 16 characters of name plus 2 length bytes, so 120 × (16 + 2) = 2160 bytes of table.
The operator picks recipe 47, ALLOY-7B. The panel writes 47 to the ID tag. The PLC checks 1 ≤ 47 ≤ 120, passes, and copies entry 47 of the table, the 8-character string ALLOY-7B, into the working name variable. The data array on this platform is zero-based, so the ingredients load from index 47 - 1 = 46.
The failure test: force the ID tag to 121. The range check fails, the fault tag sets, the name variable holds its last valid value and the ingredients are not loaded. Clear the fault, then select recipe 1 and recipe 120 to see both ends of the table resolve.
How to check it worked
- Select entries 1, 60 and 120 with a live view of the ID tag and the resolved name. Three points confirm both ends and the middle of the table.
- Power-cycle the panel and the PLC. Treat whatever the ID tag holds at startup as unconfirmed until the operator makes a fresh selection.
- Add one recipe and delete one, then re-verify every ID against the controlled list. Fixed IDs survive edits; list positions do not.
- If the recipe file itself will not save after an edit, fix that before touching the mapping; recipe files that will not save covers that failure on its own.
Recommendation: Pass the ID and keep the name table in the PLC whenever anything besides the panel needs the name, such as batch records, a printer or a second screen. Keep the text on the panel only when the panel is the sole consumer, and transfer the ID anyway so the PLC still holds the selection for interlocks and alarms.
Questions
Can a digits-only recipe name go in as a numeric ingredient?
Only when leading zeros do not matter. A name like 0047 becomes 47 in a numeric field, and one letter anywhere breaks the mapping. Pass the ID even for digits-only names: the lookup works for them too, with no decode logic to maintain.
Should the ID be the recipe's position in the panel list?
Prefer fixed assigned IDs. Position indexing breaks the day someone inserts or deletes a recipe: every entry after the edit shifts by one and old IDs resolve to the wrong names. If the panel exposes only the list index, freeze the list order or rebuild and re-verify the table after every edit.
How do I size the PLC string field?
Measure the longest name in the controlled list, add the platform overhead and round up with margin. A 16-character field carries names such as ALLOY-7B with room to spare, and 120 of those entries occupy about 2160 bytes with the two length bytes counted.
What if the PLC has no usable string type?
Keep the ID as the only value that crosses to the PLC and let the panel hold the text. Interlocks and alarms key off the number, and any screen needing the name resolves it on the panel side from the same controlled list.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.