Writes a recipe's setpoints to the PLC | Runtime Script | WinCC Unified

Kostenlos

Erstellt mit dem HMIx KI-Generator

Diese Ressource wurde mit KI auf ai.hmix.tech erstellt. Beschreibe, was du brauchst, und generiere eigene HMI-Controls in Minuten — kostenlos.

WinCC Unified Runtime Script

When the button is pressed, it checks four setpoints against their allowed limits. If all are inside the limits, it writes them to the PLC in one go and reports the result in Recipe_Status.

Minimum version: WinCC Unified V16 and later.

What starts it and where it goes

When the operator taps the button Btn_ApplyRecipe.

In the event OnTapped of the object Btn_ApplyRecipe.

How it works

  • Lists the recipe values and limits. Each row holds a setpoint tag, the value to send, and its lowest and highest allowed value. A constant makes the write wait for the PLC's answer.
  • Stops if any value is out of range. If any value is outside its limits, nothing is written. The names of the bad tags go to the trace and to Recipe_Status.
  • Puts all four values in one group. It collects the four setpoint tags into one group and gives each tag its recipe value.
  • Sends the group and waits for the PLC. It writes the whole group in one call and waits for the PLC's answer without blocking the screen.
  • Reports success when every tag was written. It collects the tags that report an error. If there are none, it traces the result and writes 'Recipe applied' to Recipe_Status.
  • Reports the tags that failed. It traces each tag that failed with its error text. It then writes to Recipe_Status how many setpoints were not written.
  • Reports a write that failed completely. If the whole write is rejected, it traces the error and writes 'Recipe not written' to Recipe_Status.

Values you adapt

  • Speed setpoint tag: The HMI tag that receives the speed value. (in the script: Line1_SpeedSetpoint)
  • Temperature setpoint tag: The HMI tag that receives the temperature value. (in the script: Line1_TempSetpoint)
  • Pressure setpoint tag: The HMI tag that receives the pressure value. (in the script: Line1_PressureSetpoint)
  • Batch size tag: The HMI tag that receives the batch size. (in the script: Line1_BatchSize)
  • Status tag: The HMI tag that shows the result of the write to the operator. (in the script: Recipe_Status)

Minimum version

Minimum version: WinCC Unified V16. It runs on WinCC Unified V16 and every later version.

  • Trace: From V16 (Siemens' V16 system manual)
  • Tag.Write: From V16 (Siemens' V16 system manual)
  • Tags.CreateTagSet: From V16 (Siemens' V16 system manual)
  • TagSet.Item: From V16 (Siemens' V16 system manual)
  • TagSet.WriteAsync: From V16 (Siemens' V16 system manual)

In the package

  • The script, with a header that says where it goes and which values to adapt.
  • Its documentation as PDF and as an editable ODT: purpose, example, the TIA Portal steps, the script part by part.
  • A README with the same in one page.

⚠️ AI-Generated: This script was written with AI and checked against Siemens' documentation, not on a device. Test it on your own HMI before using it in production.

Diese Ressource teilen:
Version:v2
Letzte Aktualisierung:4. Dez. 2026
Veröffentlicht:4. Dez. 2026
Layout:SIEMENS - SIMATIC
Schlagwörter:

Produktbewertungen (0)

Fragen und Antworten (0)

Das könnte dir auch gefallen

Kostenlos