tc_task
Manage TwinCAT RT tasks and their settings: list, create, configure cycle time and priority, bind CPU affinity, and set linked tasks for PLC projects.
Instructions
RT tasks under TIRT (+ RT-core settings under TIRS, + a PLC project's LinkedTask under TIPC). CONFIG-ONLY — no confirm token needed; runtime needs a later activate/restart; TISC (safety) untouched. Tree paths use ^ separators (e.g. TIRT^PlcTask). Actions: list (tasks under TIRT); get (path; summary:true -> identity + parsed TaskDef tags instead of full XML); create (name; withImage default true = SubType 0 / false = SubType 1 no image; before?; cycleTimeUs?/priority? applied after create via ConsumeXml; save?); set_params (path; cycleTimeUs [us, converted to 100ns ticks = us*10] / priority [0-255] / autoStart; OR xml = raw .. escape hatch [mutually exclusive with the typed fields]; returnXml?; save?). CAVEAT: the TaskDef tag names for cycle/priority/autostart are UNCONFIRMED against the AI docs — prefer the xml escape hatch and verify with get(summary) before trusting the typed fields; add_image_var (path = a with-image task's Inputs/Outputs node; varName; dataType e.g. BOOL/INT/DINT; startAddress? default -1 = append; save?); get_rt_settings (TIRS; summary:true -> parsed MaxCPUs/Affinity/per-CPU LoadLimit/BaseTime/LatencyWarning); set_rt_settings (maxCPUs / affinity [TwinCAT hex token e.g. #x0000000000000007] / cpus [{id,loadLimit?,baseTimeNs?,latencyWarningUs?}]; OR xml escape hatch; returnXml?; save?); bind_cpu (path; affinity = a name [CPU1..CPU8, MaskSingle/Dual/Quad/Hexa/Oct/All, None] OR a raw #x.. token; returnXml?; save?); get_linked_task (path? = PLC root under TIPC, default first child of TIPC); set_linked_task (path? = PLC root; linkedTask = XAE tree path of the RT task, e.g. TIRT^PlcTask; save?).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | ||
| cpus | No | ||
| name | No | ||
| path | No | ||
| save | No | ||
| action | Yes | ||
| before | No | insert before this sibling task | |
| maxCPUs | No | ||
| summary | No | ||
| varName | No | ||
| affinity | No | ||
| dataType | No | ||
| priority | No | ||
| autoStart | No | ||
| returnXml | No | ||
| withImage | No | ||
| linkedTask | No | ||
| cycleTimeUs | No | ||
| startAddress | No |