From 3fbd8f363990ed68ccaf7d4461e6acdfd2ca4d44 Mon Sep 17 00:00:00 2001 From: sripp Date: Mon, 15 Apr 2024 13:28:34 +0200 Subject: [PATCH] suport SystemFunction CTU --- TiaCodegen/Commands/Functions/CTUCall.cs | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 TiaCodegen/Commands/Functions/CTUCall.cs diff --git a/TiaCodegen/Commands/Functions/CTUCall.cs b/TiaCodegen/Commands/Functions/CTUCall.cs new file mode 100644 index 0000000..6330078 --- /dev/null +++ b/TiaCodegen/Commands/Functions/CTUCall.cs @@ -0,0 +1,31 @@ +using System.Linq; +using TiaCodegen.Commands.Functions.Base; +using TiaCodegen.Enums; +using TiaCodegen.Interfaces; + +namespace TiaCodegen.Commands.Functions +{ + public class CTUCall : SystemFunctionBlockCall + { + public CTUCall(string instanceName, + IOperationOrSignal cu = null, + IOperationOrSignal r = null, + IOperationOrSignal pv = null, + IOperationOrSignal q = null, + IOperationOrSignal cv = null) : base("CTU", instanceName, null) + { + Interface["CU"] = new IOperationOrSignalDirectionWrapper(cu, Direction.Input); + Interface["R"] = new IOperationOrSignalDirectionWrapper(r, Direction.Input); + Interface["PV"] = new IOperationOrSignalDirectionWrapper(pv, Direction.Input); + Interface["Q"] = new IOperationOrSignalDirectionWrapper(q, Direction.Output); + Interface["CV"] = new IOperationOrSignalDirectionWrapper(cv, Direction.Output); + + TemplateValueName = "value_type"; + TemplateValueType = "Type"; + TemplateValue = "Int"; + HasNoEn = true; + + Children.AddRange(Interface.Values.Where(x => x.OperationOrSignal != null).Select(x => x.OperationOrSignal)); + } + } +}