public TopologyModel(TopologyModel tm)
        {
            tm.rwLock.EnterReadLock();

            try
            {
                containers = new Dictionary <DMSType, Dictionary <long, IdentifiedObject> >(tm.containers.Count);

                foreach (KeyValuePair <DMSType, Dictionary <long, IdentifiedObject> > container in tm.containers)
                {
                    containers.Add(container.Key, new Dictionary <long, IdentifiedObject>(container.Value));
                }

                analogInputs           = new ConcurrentDictionary <long, float>();
                discreteInputs         = new ConcurrentDictionary <long, int>();
                measurementsOfInterest = new HashSet <long>(tm.measurementsOfInterest);
                markedSwitchStates     = new ConcurrentDictionary <long, bool>(tm.markedSwitchStates);
                typeToModelCode        = ModelResourcesDesc.GetTypeToModelCodeMap();
                loadProfiles           = new List <DailyLoadProfile>(tm.loadProfiles);
                graph = tm.graph;
            }
            finally
            {
                tm.rwLock.ExitReadLock();
            }

            rwLock = new ReaderWriterLockSlim();
        }
 public MaybeElementView(long gid, PubSubClient pubSub) : base(gid, pubSub)
 {
     dmsTypeToModelCodeMap = ModelResourcesDesc.GetTypeToModelCodeMap();
     elementView           = InitView();
     nullView = new NullView();
     panel    = new StackPanel();
 }
 public NetworkModelDrawing()
 {
     networkModelChanged = true;
     topologyChanged     = true;
     loadFlowChanged     = true;
     elements            = new List <GraphicsElement>(0);
     lines                 = new List <GraphicsLine>(0);
     loadFlows             = new List <GraphicsText>();
     dmsTypeToModelCodeMap = ModelResourcesDesc.GetTypeToModelCodeMap();
 }
Beispiel #4
0
        public TopologyGraph(Dictionary <DMSType, Dictionary <long, IdentifiedObject> > containers, IReadOnlyDictionary <long, float> analogs, IReadOnlyDictionary <long, int> discretes, IReadOnlyDictionary <long, bool> markedSwitchStates, List <DailyLoadProfile> loadProfiles)
        {
            subGraphs               = new List <Node>();
            adjacency               = new List <Node>();
            this.containers         = containers;
            this.analogs            = analogs;
            this.discretes          = discretes;
            this.markedSwitchStates = markedSwitchStates;
            this.loadProfiles       = loadProfiles;
            dmsTypeToModelCodeMap   = ModelResourcesDesc.GetTypeToModelCodeMap();

            BuildGraph();
        }
        public TopologyModel(List <DailyLoadProfile> loadProfiles)
        {
            DMSType[] types = ModelResourcesDesc.TypeIdsInInsertOrder;
            containers = new Dictionary <DMSType, Dictionary <long, IdentifiedObject> >(types.Length);

            foreach (DMSType t in types)
            {
                containers.Add(t, new Dictionary <long, IdentifiedObject>());
            }

            rwLock                 = new ReaderWriterLockSlim();
            analogInputs           = new ConcurrentDictionary <long, float>();
            discreteInputs         = new ConcurrentDictionary <long, int>();
            measurementsOfInterest = new HashSet <long>();
            markedSwitchStates     = new ConcurrentDictionary <long, bool>();
            typeToModelCode        = ModelResourcesDesc.GetTypeToModelCodeMap();
            this.loadProfiles      = loadProfiles;
            graph = new TopologyGraph(containers, analogInputs, discreteInputs, markedSwitchStates, loadProfiles);
        }