Skip to content

Commit 529f589

Browse files
ts: refs feature #11794 - Add restricted area option to reduce errors in check and generate code -> Distributor doesn't work
1 parent d0fa46e commit 529f589

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

TiaCodeGen.Tests/SampleTests.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,33 @@ public void TestCallWithOr()
188188
var xml = block.GetCode();
189189
}
190190

191+
[Test]
192+
public void TestDistributor()
193+
{
194+
var codeblock = new CodeBlock();
195+
196+
var nw = new Network("Test2", "Test2en");
197+
nw.Add(
198+
new And(
199+
new Not(new Signal("Tag_9")),
200+
new Distributor(
201+
new And(
202+
new Coil(new Signal("#monitoringSignal"))
203+
),
204+
new And(
205+
new TONCall("OnDelaySafetyDoorSDA11N13", pt: new Signal("T#60s", SignalType.ConstantTime), q: null)
206+
)
207+
)
208+
)
209+
);
210+
211+
codeblock.Add(nw);
212+
213+
var block = new Block("Test", "blabla", codeblock);
214+
block.Interface = TestInterface;
215+
var xml = block.GetCode();
216+
}
217+
191218
[Test]
192219
public void TestCallWithInRange()
193220
{

TiaCodegen/CodeGen/KopCodeHelper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,11 @@ private void AddWires(IOperationOrSignal op)
733733
{
734734
_sb.AppendLine("<NameCon UId=\"" + s.OperationId + "\" Name=\"pre\" />" + " <!-- " + s.GetType().Name + " -->");
735735
}
736-
else if (s is FunctionCall || s is IFunctionOperation)
736+
else if (s is FunctionCall)
737+
{
738+
_sb.AppendLine("<NameCon UId=\"" + s.OperationId + "\" Name=\"" + (((FunctionCall)s).HasNoEn ? "in" : "en") + "\" />" + " <!-- " + s.GetType().Name + " -->");
739+
}
740+
else if (s is IFunctionOperation)
737741
{
738742
_sb.AppendLine("<NameCon UId=\"" + s.OperationId + "\" Name=\"en\" />" + " <!-- " + s.GetType().Name + " -->");
739743
}

0 commit comments

Comments
 (0)