public Simulator() { modbusServer = new ModbusTCPServer(); modbusServer.Subscribe(this); stopSignal = new ManualResetEvent(false); analogs = new Dictionary <long, Analog>(); discretes = new Dictionary <long, Discrete>(); readWriteMeasurementAddresses = new HashSet <int>(); commands = new ConcurrentQueue <CommandParams>(); modelLock = new ReaderWriterLockSlim(); client = new DuplexClient <ISubscribing, IPubSubClient>("callbackEndpoint", this); reclosers = new List <Tuple <Recloser, long, long, int> >(); loadProfiles = DailyLoadProfile.LoadFromXML("Daily_load_profiles.xml"); energyConsumers = new Dictionary <long, EnergyConsumer>(); }
static void Main(string[] args) { Console.WriteLine("Waiting for NMS, press [Enter] to quit."); TopologyModelDownload download = new TopologyModelDownload(); while (!download.Download()) { while (Console.KeyAvailable) { if (Console.ReadKey().Key == ConsoleKey.Enter) { return; } } Thread.Sleep(1000); } Console.WriteLine("Downloaded network model from NMS."); TopologyModel model = new TopologyModel(DailyLoadProfile.LoadFromXML("Daily_load_profiles.xml")); if (!model.ApplyUpdate(download)) { return; } TopologyModel.Instance = model; ServiceHost host = new ServiceHost(typeof(CalculationEngineService)); host.Open(); foreach (ServiceEndpoint endpoint in host.Description.Endpoints) { Console.WriteLine(endpoint.ListenUri); } model.DownloadMeasurements(null); Console.WriteLine("[Press Enter to stop]"); Console.ReadLine(); host.Close(); }