[go: up one dir, main page]

Menu

[aa1728]: / NodeIed.cs  Maximize  Restore  History

Download this file

110 lines (92 with data), 3.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright (C) 2013 Pavel Charvat
*
* This file is part of IEDExplorer.
*
* IEDExplorer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* IEDExplorer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with IEDExplorer. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IEDExplorer
{
public class NodeIed : NodeBase
{
public NodeIed(string Name, Iec61850Model _model)
: base(Name)
{
model = _model;
}
Iec61850Model model;
public string VendorName { get; set; }
public string ModelName { get; set; }
public string Revision { get; set; }
public bool DefineNVL { get; set; }
public bool Identify { get; set; }
public SCLServer SCLServerRunning { get; set; }
public NodeBase FindNodeByAddress(string Domain, string IecAddress, bool FindList = false)
{
if (Domain == null || IecAddress == null)
return null;
NodeBase b = this.FindChildNode(Domain);
if (b != null)
{
if (FindList)
{
if ((b = b.FindChildNode(IecAddress)) == null)
{
return null;
}
}
else
{
string[] parts = IecAddress.Split(new char[] { '$' });
for (int i = 0; i < parts.Length; i++)
{
if ((b = b.FindChildNode(parts[i])) == null)
{
return null;
}
}
}
return b;
}
return null;
}
public NodeBase FindNodeByAddress(string CompleteIecAddress, bool FindList = false)
{
if (CompleteIecAddress == null)
return null;
string[] parts = CompleteIecAddress.Split(new char[] { '/' }, 2);
if (parts.Length == 2)
return FindNodeByAddress(parts[0], parts[1], FindList);
return null;
}
public Iec61850State iecs { get; set; }
public override void SaveModel(List<String> lines, bool fromSCL)
{
// Syntax: MODEL(<model name>){…}
lines.Add("MODEL(" + IedModelName + "){");
foreach (NodeBase b in _childNodes)
{
b.SaveModel(lines, fromSCL);
}
lines.Add("}");
}
public string IedModelName { get; set; }
public Iec61850Model Model { get { return model; } }
public bool isIecTree() { return model.iec == this; }
}
}