public SimulationLogic(ISimulator simulator) { this.simulator = simulator; FullTank = float.Parse(ConfigurationManager.AppSettings["FullTank"]); EmptyTank = float.Parse(ConfigurationManager.AppSettings["EmptyTank"]); MaxTemp = float.Parse(ConfigurationManager.AppSettings["MaxTemp"]); MinTemp = float.Parse(ConfigurationManager.AppSettings["MinTemp"]); HeatingConst = float.Parse(ConfigurationManager.AppSettings["HeatingConst"]); VoltageFactor = float.Parse(ConfigurationManager.AppSettings["VoltageFactor"]); ColdingConst = float.Parse(ConfigurationManager.AppSettings["ColdingConst"]); ConstPumpFlow = float.Parse(ConfigurationManager.AppSettings["ConstPumpFlow"]); TankSurface = float.Parse(ConfigurationManager.AppSettings["TankSurface"]); WA = new WeatherAPI(); hours = WA.GetResultsForNext6Hours(); db = new dnp3_protocol.dnp3types.sDNPServerDatabase(); debug = bool.Parse(ConfigurationManager.AppSettings["Debug"]); secondsCount = debug ? 1 : 60; constant = debug ? 1 : 60; }
public SimulationLogic(ISimulator simulator) { this.simulator = simulator; FullTank = float.Parse(ConfigurationManager.AppSettings["FullTank"]); EmptyTank = float.Parse(ConfigurationManager.AppSettings["EmptyTank"]); MaxTemp = float.Parse(ConfigurationManager.AppSettings["MaxTemp"]); MinTemp = float.Parse(ConfigurationManager.AppSettings["MinTemp"]); HeatingConst = float.Parse(ConfigurationManager.AppSettings["HeatingConst"]); VoltageFactor = float.Parse(ConfigurationManager.AppSettings["VoltageFactor"]); ColdingConst = float.Parse(ConfigurationManager.AppSettings["ColdingConst"]); ConstPumpFlow = float.Parse(ConfigurationManager.AppSettings["ConstPumpFlow"]); TankSurface = float.Parse(ConfigurationManager.AppSettings["TankSurface"]); string weatherApi = ConfigurationManager.AppSettings["WeatherApi"] ?? "net.tcp://localhost:27011/WeatherForecast"; WA = new SF.Common.Proxies.WeatherServiceProxy(weatherApi); db = new dnp3_protocol.dnp3types.sDNPServerDatabase(); debug = bool.Parse(ConfigurationManager.AppSettings["Debug"]); secondsCount = debug ? 1 : 60; constant = debug ? 1 : 60; }
public void Simulate(dnp3types.sDNPServerDatabase db, Dictionary <string, ushort> pairs) { this.db = db; this.pairs = pairs; if (db.u32TotalPoints != 15 && db.u32TotalPoints != 24 && db.u32TotalPoints != 33) { return; } if (secondsCount == constant) { if (Simulator.enabled) { OnEveryMinute(); } secondsCount = 0; minutesCount++; } else { OnEveryMinute(); if (db.u32TotalPoints == 15) { Configuration1(); } else if (db.u32TotalPoints == 24) { Configuration2(); } else if (db.u32TotalPoints == 33) { Configuration3(); } secondsCount++; } }