Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub CriarComando( obj, col )
- Dim commands
- On Error Resume Next
- Set commands = obj.Item("Commands")
- If ( Err ) Then
- ' Cria pasta de comandos caso esta ainda nao exista.
- Set commands = obj.AddObject("PowerCommandGroup", False)
- Err.Clear
- End If
- If ( InStr(col(2), "COMANDO_DE_ABERTURA") > 0 ) Then
- ComandoAbreFecha obj, col
- ElseIf ( InStr(col(2), "_ATIVAR_") > 0 ) Then
- ' ComandoAtivaDesativa obj, col
- End If
- End Sub
- Sub ComandoAbreFecha( obj, col )
- Set commands = obj.Item("Commands")
- On Error Resume Next
- ' Deleta comando caso exista p/ entao recria-lo.
- commands.DeleteObject("AbrirFechar")
- On Error GoTo 0
- Set command = commands.AddObject("PowerDiscreteCommand", False)
- command.DeleteObject("UnidadeComando1")
- With command
- .CommandType = "*" & Replace(TypeName( obj ), "Power", "") & "Position"
- .Conversion = "(default)" ' TODO: Adicionar coluna conversao (csv).
- ' .DocString = ""
- .Name = "AbrirFechar"
- End With
- ' Unidade de comando abre.
- Set unit = command.AddObject("PowerCommandUnit", False)
- With unit
- .CommandName = "Open"
- .OperateWriteTag = "IEC61850.[" & col(0) & "].CMD." & col(2)
- .Name = "Abre"
- End With
- Set interlocks = unit.AddObject("PowerInterlockGroup", False)
- Set interlock = interlocks.AddObject("PowerInterlockUnit", False)
- With interlock
- ' .ComparisonOperator = 0
- .ComparisonValue = 0
- ' .Measurement =
- .Name = "Aberto"
- End With
- ' Unidade de comando fecha.
- Set unit = command.AddObject("PowerCommandUnit", False)
- If ( Err ) Then Set unit = command.AddObject("PowerCommandUnit", False) : Err.Clear
- With unit
- .CommandName = "Close"
- ' TODO: Formatar PathName do ponto.
- .OperateWriteTag = "IEC61850.[" & col(0) & "].CMD." & col(2)
- .Name = "Fecha"
- End With
- Set interlocks = unit.AddObject("PowerInterlockGroup", False)
- Set interlock = interlocks.AddObject("PowerInterlockUnit", False)
- With interlock
- ' .ComparisonOperator = 0
- .ComparisonValue = 1
- ' .Measurement =
- .Name = "Fechado"
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement