File tree Expand file tree Collapse file tree 2 files changed +52
-5
lines changed
Expand file tree Collapse file tree 2 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -219,5 +219,33 @@ public void TestCallWithTOn()
219219 block . Interface = TestInterface ;
220220 var xml = block . GetCode ( ) ;
221221 }
222+
223+ [ Test ]
224+ public void TestCallWithTPAndDistributor ( )
225+ {
226+ var codeblock = new CodeBlock ( ) { Safety = false } ;
227+
228+ var nw = new Network ( "Test2" , "Test2en" ) ;
229+ var and =
230+ new And (
231+ new Signal ( "#aaa" ) ,
232+ new TPCall ( "PulseStartPrint" ,
233+ pt : new Signal ( "T#100ms" , SignalType . ConstantTime ) ,
234+ q : new Distributor (
235+ new Coil ( new Signal ( "#bbbb" ) ) ,
236+ new RCoil ( new Signal ( "#cccc" ) ) ,
237+ new SCoil ( new Signal ( "#dddd" ) )
238+ )
239+ )
240+ ) ;
241+
242+ nw . Add ( and ) ;
243+
244+ codeblock . Add ( nw ) ;
245+
246+ var block = new Block ( "Test" , "blabla" , codeblock ) ;
247+ block . Interface = TestInterface ;
248+ var xml = block . GetCode ( ) ;
249+ }
222250 }
223251}
Original file line number Diff line number Diff line change @@ -508,14 +508,33 @@ private void AddWires(IOperationOrSignal op)
508508 {
509509 _sb . AppendLine ( "<Wire UId=\" " + _currentId + "\" >" + ( debug ?? ( "<!-- Wire 4 FunctionCall -->" ) ) ) ;
510510 _sb . AppendLine ( "<NameCon UId=\" " + op . OperationId + "\" Name=\" " + intf . Key + "\" />" ) ;
511- if ( sng is Signal )
511+ if ( sng is Distributor db )
512512 {
513- _sb . AppendLine ( "<IdentCon UId=\" " + ( ( Signal ) sng ) . SignalId + "\" />" + " <!-- " + ( ( Signal ) sng ) . Name + " -->" ) ;
513+ _sb . AppendLine ( "<!-- Distributor -->" ) ;
514+ foreach ( var c in db . Children )
515+ {
516+ if ( c is Signal )
517+ {
518+ _sb . AppendLine ( "<IdentCon UId=\" " + ( ( Signal ) c ) . SignalId + "\" />" + " <!-- " + ( ( Signal ) c ) . Name + " -->" ) ;
519+ }
520+ else
521+ {
522+ var inName = c is FunctionCall ? ( ( c is InRangeCall || c is OutRangeCall ) ? "pre" : "en" ) : "in" ;
523+ _sb . AppendLine ( "<NameCon UId=\" " + c . OperationId + "\" Name=\" " + inName + "\" />" ) ;
524+ }
525+ }
514526 }
515527 else
516- {
517- var inName = sng is FunctionCall ? ( ( sng is InRangeCall || sng is OutRangeCall ) ? "pre" : "en" ) : "in" ;
518- _sb . AppendLine ( "<NameCon UId=\" " + sng . OperationId + "\" Name=\" " + inName + "\" />" ) ;
528+ {
529+ if ( sng is Signal )
530+ {
531+ _sb . AppendLine ( "<IdentCon UId=\" " + ( ( Signal ) sng ) . SignalId + "\" />" + " <!-- " + ( ( Signal ) sng ) . Name + " -->" ) ;
532+ }
533+ else
534+ {
535+ var inName = sng is FunctionCall ? ( ( sng is InRangeCall || sng is OutRangeCall ) ? "pre" : "en" ) : "in" ;
536+ _sb . AppendLine ( "<NameCon UId=\" " + sng . OperationId + "\" Name=\" " + inName + "\" />" ) ;
537+ }
519538 }
520539 _sb . AppendLine ( "</Wire>" ) ;
521540 _currentId ++ ;
You can’t perform that action at this time.
0 commit comments