Skip to content

Commit 93c23f8

Browse files
author
sripp
committed
suport SystemFunction CTUD
1 parent 529f589 commit 93c23f8

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

TiaCodegen/CodeGen/KopCodeHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ private void AddWires(IOperationOrSignal op)
694694
{
695695
_sb.AppendLine("<NameCon UId=\"" + next.OperationId + "\" Name=\"pre\" />" + " <!-- " + dstName + " -->");
696696
}
697-
else if (next is CTUCall)
697+
else if (next is CTUCall || next is CTUDCall)
698698
{
699699
_sb.AppendLine("<NameCon UId=\"" + next.OperationId + "\" Name=\"CU\" />" + " <!-- " + dstName + " -->");
700700
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Linq;
2+
using TiaCodegen.Commands.Functions.Base;
3+
using TiaCodegen.Enums;
4+
using TiaCodegen.Interfaces;
5+
6+
namespace TiaCodegen.Commands.Functions
7+
{
8+
public class CTUDCall : SystemFunctionBlockCall
9+
{
10+
public CTUDCall(string instanceName,
11+
IOperationOrSignal cd = null,
12+
IOperationOrSignal r = null,
13+
IOperationOrSignal ld = null,
14+
IOperationOrSignal pv = null,
15+
IOperationOrSignal qu = null,
16+
IOperationOrSignal qd = null,
17+
IOperationOrSignal cv = null) : base("CTUD", instanceName, null)
18+
{
19+
Interface["CD"] = new IOperationOrSignalDirectionWrapper(cd, Direction.Input);
20+
Interface["R"] = new IOperationOrSignalDirectionWrapper(r, Direction.Input);
21+
Interface["LD"] = new IOperationOrSignalDirectionWrapper(ld, Direction.Input);
22+
Interface["PV"] = new IOperationOrSignalDirectionWrapper(pv, Direction.Input);
23+
Interface["QU"] = new IOperationOrSignalDirectionWrapper(qu, Direction.Output);
24+
Interface["QD"] = new IOperationOrSignalDirectionWrapper(qd, Direction.Output);
25+
Interface["CV"] = new IOperationOrSignalDirectionWrapper(cv, Direction.Output);
26+
27+
TemplateValueName = "value_type";
28+
TemplateValueType = "Type";
29+
TemplateValue = "Int";
30+
HasNoEn = true;
31+
32+
Children.AddRange(Interface.Values.Where(x => x.OperationOrSignal != null).Select(x => x.OperationOrSignal));
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)