Example PGM to create a Unit Tag List
Jump to navigation
Jump to search
Navigation: PGMs ➔ Example PGM Files ➔ Example PGM to create a Unit Tag List
Related Links:StrArray Class, TagSelect Class
This example shows how to generate and save a list of unit operation tags (Feeders as inputs and outputs) by using StrArray and Tagselect classes.
TagSelect Inputs, Outputs
integer InCount@, OutCount@, i
StrArray InputList, OutputList
bit InOK@, OutOK@
Sub GetConnectTags()
; find all true feeders (not connected) and makeup sources
InOK = Inputs.Exec("([UnitType]=='FeederSink' AND ([State]==1 AND [Operation]!=11)) OR ([UnitType] == 'MakeupSource')", false, false)
InCount = Inputs.GetLen()
InputList.SetLen(InCount)
i=0
while (i<InCount)
InputList.SetAt(i, Inputs.Tag(i))
i = i + 1
endwhile
; find all true sinks (not connected)
OutOK = Outputs.Exec("(([UnitType]=='FeederSink' AND [State]==2) OR ([UnitType] == 'DiscardSink') )", false, false)
OutCount = Outputs.GetLen()
OutputList.SetLen(OutCount)
i=0
while (i<OutCount)
OutputList.SetAt(i, Outputs.Tag(i))
i = i + 1
endwhile
EndSub
Sub InitialisePreStart()
GetConnectTags()
InputList.save("$Prj\Controls\Feeders_In_TagList.csv")
OutputList.save("$Prj\Controls\Feeders_Out_TagList.csv")
EndSub
$ ; --- end of file ---