public GroundPollution(SpreadPoint spreadpoint, float concentration = 0.0f, float watertime = 0.0f) : base(spreadpoint) { this.pointtype = POINTTYPE.RISK; this.comment = string.Format(comment_format, RiskObject.PREFIX, (spreadpoint.isriskobject? spreadpoint.riskobject.id: 0)); this.watertime = watertime; this.concentration = concentration; this.petrochemicatype = spreadpoint.petrochemicaltype; this.cadastretype = spreadpoint.cadastretype; this.distance = 0.0f; this.angle = 0.0f; this.name = spreadpoint.isriskobject? spreadpoint.riskobject.name: this.comment; }
public GroundBlur(SpreadPoint spreadpoint) { this.spreadpoint = spreadpoint; RGEContext db = new RGEContext(); // заглушка, выставить правильный контекст //blinova this.bordercoordinateslist = new CoordinatesList(); if (this.spreadpoint.groundtype.watercapacity >= this.spreadpoint.groundtype.porosity) { throw new EGHDBException(string.Format(errormssageformat, "Влагоемкость грунта не может быть больше или равна пористости")); } if (this.spreadpoint.groundtype.watercapacity >= this.spreadpoint.groundtype.soilmoisture) { throw new EGHDBException(string.Format(errormssageformat, "Влагоемкость грунта не может быть больше или равна влажности грунта")); } if (this.spreadpoint.petrochemicaltype.tension <= 0) { throw new EGHDBException(string.Format(errormssageformat, "Коэффициент поверностного натяжение нефтеродукта не может быть меньше или равным нулю ")); } { // коэф. разлива float k = SpreadingCoefficient.GetByData(db, this.spreadpoint.groundtype, this.spreadpoint.petrochemicaltype, this.spreadpoint.volume, 0.0f); this.spreadingcoefficient = new SpreadingCoefficient(0, this.spreadpoint.groundtype, this.spreadpoint.petrochemicaltype, 0.0f, this.spreadpoint.volume, 0.0f, 0.02f, k); } if (this.spreadingcoefficient.koef <= 0.0f) { //this.spreadingcoefficient = new SpreadingCoefficient(0, this.spreadpoint.groundtype, this.spreadpoint.petrochemicaltype, 0.0f, this.spreadpoint.volume, 0.0f, 0.02f, 5.0f); // заглушка throw new EGHDBException(string.Format(errormssageformat, "Коэффициент разлива не может быть меньше или равен нулю")); } { // свойства воды WaterProperties x = new WaterProperties(); // RGEContext db = new RGEContext();// заглушка, выставить правильный контекст //blinova float delta = 0.0f; if (WaterProperties.Get(db, 20.0f, out x, out delta)) { this.waterproperties = x; } } if (this.waterproperties.viscocity <= 0) { throw new EGHDBException(string.Format(errormssageformat, "Вязкость воды не может быть меньше или равным нулю ")); } this.square = this.spreadpoint.volume * this.spreadingcoefficient.koef; // площадь пятна this.radius = (float)Math.Sqrt(square / Math.PI); // радиус пятна this.petrochemicalheight = this.spreadpoint.volume / this.square; // высота слоя разлитого нефтепродукта (м) this.totalmass = this.spreadpoint.volume * this.spreadpoint.petrochemicaltype.density; // масса пролива this.anchorpointlist = AnchorPointList.CreateNear(this.spreadpoint.coordinates, this.radius); this.ecoobjectsearchradius = this.radius; this.ecoobjecstlist = EcoObjectsList.CreateEcoObjectsList(db, this.spreadpoint, this.ecoobjectsearchradius); this.groundpolutionlist = new GroundPollutionList(this.spreadpoint); this.groundpolutionlist.AddRange(this.spreadpoint, this.anchorpointlist, this.spreadpoint.petrochemicaltype); this.groundpolutionlist.AddRange(this.spreadpoint, this.ecoobjecstlist, this.spreadpoint.petrochemicaltype); // переделать как метод this.groundpolutionlist this.avgdeep = // средняя глубина грунтовых вод по опорным точкам и техногенному объекту ( anchorpointlist.sumwaterdeep + (this.spreadpoint.riskobject != null ? this.spreadpoint.waterdeep : 0.0f) ) / (anchorpointlist.Count + 1); this.limitadsorbedmass = // максиальная маса нефтепродукта, кот. может быть адсорбирована грунтом (кг) this.avgdeep * // средняя глубина грутовы вод this.square * // площадь пролива this.waterproperties.density * // плотность воды this.spreadpoint.groundtype.porosity * (0.01f) * // пористость грунта * 0.01 (smw 2017.06.18) this.spreadpoint.groundtype.watercapacity * // капилярная влагоемкость грунта // максиальная маса нефтепродукта, кот. может быть адсорбирована грунтом (кг) (float)Math.Pow(this.spreadpoint.petrochemicaltype.dynamicviscosity, 2) * // динамическая вязкость this.waterproperties.tension / // коэфициент поверхностного натяжения воды ( this.spreadpoint.petrochemicaltype.tension * // коэфициент поверхностного натяжения нефтепродукта (float)Math.Pow(this.waterproperties.viscocity, 2) // вязкость воды ); this.adsorbedmass = (limitadsorbedmass >= this.totalmass ? this.totalmass : limitadsorbedmass); // адсорбированная масса нефтепродукта в грунте т - М1 this.restmass = (this.adsorbedmass >= this.totalmass ? 0 : this.totalmass - this.adsorbedmass); // масса нефтепродукта достигшая грунтовых вод this.depth = (this.restmass > 0 ? this.avgdeep : (float)Math.Round(this.avgdeep * (this.totalmass / this.limitadsorbedmass), 3)); // глубина проникновения нефтепродукта в грунт if (this.depth > 0) // если глубина проникновения > 0 { this.concentrationinsoil = // средняя концентрация нефтепродуктов в грунте this.adsorbedmass / // адсорбированная масса нефтепродукта в грунте ( this.square * // площадь пятна this.depth * // глубина проникновения нефтепродукта в грунт this.spreadpoint.groundtype.density // средняя плотность грунта ); } else { this.concentrationinsoil = 0.0f; } { // вертикальная скорость проникновения нефтепродукта в грунт (м/с) float ka = // формула аверьянова this.spreadpoint.groundtype.waterfilter * // коэф. фильтрации воды ( this.spreadpoint.groundtype.soilmoisture - // влажность грунта this.spreadpoint.groundtype.watercapacity // капилярная влагоемкость грунта ) / ( this.spreadpoint.groundtype.porosity - // пористость грунта this.spreadpoint.groundtype.watercapacity // капилярная влагоемкость грунта ); float r = // коэффициент задержки ( this.spreadpoint.petrochemicaltype.dynamicviscosity * // вязкость нефтепродукта this.waterproperties.density // плотность воды ) / ( this.waterproperties.viscocity * // вязкость воды this.spreadpoint.petrochemicaltype.density // плотность нефтепродукта ); this.speedvertical = this.petrochemicalheight * // А.Авхимович: высота слоя разлитого нефтепродукта (м) // вы (ka / r); // вертикальная скорость проникновения нефтепродукта в грунт (м/с) } this.timeconcentrationinsoil = // время достижения усреднееной концентации в грунте this.depth / // глубина проникновения нефтепродукта в грунт this.speedvertical; // вертикальная скорость проникновения нефтепродукта в грунт (м/с) if (this.restmass > 0) { this.timewatercomletion = // время продвижения нефтепродукта до грунтовых вод this.avgdeep / // средняя глубина грунтовых вод по опорным точкам (м) this.speedvertical; // вертикальная скорость проникновения нефтепродукта в грунт (м/с) this.dtimemaxwaterconc = // время (с) достижения максимальной концентрации нефтепродуктом грунтовых вод после достиженич границы грунтовых вод this.petrochemicalheight / // высота слоя разлитого нефтепродукта (м) ( this.speedvertical * // вертикальная скорость проникновения нефтепродукта в грунт (м/с) this.spreadpoint.groundtype.porosity // пористость грунта ); this.timemaxwaterconc = this.timewatercomletion + this.dtimemaxwaterconc; // время (с) достижения максимальной концентрации на уровне грунтовых вод } else { this.timewatercomletion = Const.TIME_INFINITY; // никогда this.dtimemaxwaterconc = Const.TIME_INFINITY; // никогда this.timemaxwaterconc = Const.TIME_INFINITY; // никогда } { if (restmass > 0) // если не все адсорбировалось в грунте { this.ozcorrection = // OZ-поправка this.petrochemicalheight * // высота слоя разлитого нефтепродукта (м) this.restmass / // масса нефтепродукта достигшая грунтовых вод (кг) this.totalmass; // масса пролива (кг) this.maxconcentrationwater = (float) // максимальной концентрация на уровне грунтовых вод кг/м3 ( this.restmass / // масса нефтепродукта достигшая грунтовых вод (кг) (Math.PI * this.radius * this.radius) * 1.0f // объем воды / (this.ozcorrection * Math.Sqrt(2 * Math.PI)) // поправка 0Z ); } else // если все адсорбировалось в грунте { this.ozcorrection = 0.0f; this.maxconcentrationwater = 0.0f; } } }
public bool Add(SpreadPoint center, float concentration = 0.0f, float watertime = 0.0f) { this.Add(new GroundPollution(center, concentration, watertime)); return(true); }
public GroundPollutionList(SpreadPoint center, float concentration = 0.0f, float watertime = 0.0f) { this.Add(new GroundPollution(center, concentration, watertime)); }
public ActionResult Forecast( ) { ActionResult view = View("Index"); ViewBag.EGHLayout = "RGE.Forecast"; try { RGEContext db = new RGEContext(this); view = View(db); ChoiceRiskObjectViewContext coc = ChoiceRiskObjectViewContext.Handler(db, this.HttpContext.Request.Params); ForecastViewConext fvc = ForecastViewConext.Handler(db, this.HttpContext.Request.Params); string menuitem = this.HttpContext.Request.Params["menuitem"]; if (menuitem != null && menuitem.Equals("Forecast.Point")) { if (fvc.menuitempoint == fvc.menuitemgeop) { fvc.menuitempoint = fvc.menuitemrobj; } else { fvc.menuitempoint = fvc.menuitemgeop; } coc.Regim = ChoiceRiskObjectViewContext.REGIM.INIT; } else if (coc.Regim == ChoiceRiskObjectViewContext.REGIM.SET && fvc.Regim == ForecastViewConext.REGIM.SET) { if (menuitem != null && menuitem.Equals("Forecast.Forecast")) { SpreadPoint spreadpoint = new SpreadPoint(coc.riskobject, fvc.petrochemicaltype, (float)fvc.Volume, (float)fvc.Temperature); Incident incident = new Incident((DateTime)fvc.Incident_date, (DateTime)fvc.Incident_date_message, fvc.incidenttype, spreadpoint); // fvc.ecoforecast = new RGEContext.ECOForecast(incident); fvc.ecoforecastx = new RGEContext.ECOForecastX(db, incident); fvc.Regim = ForecastViewConext.REGIM.REPORT; } else if (menuitem != null && menuitem.Equals("Forecast.Cancel")) { view = View("Index", db); } else if (menuitem != null && menuitem.Equals("Forecast.Save")) { if (fvc.ecoforecastx != null) { XmlNode xn = fvc.ecoforecastx.CreateReport().toXmlNode(); EGH01DB.Primitives.Report report = new EGH01DB.Primitives.Report(1000, "П", DateTime.Now, xn); EGH01DB.Primitives.Report.Create(db, report); // RGEContext.Report rrr = new RGEContext.Report(xn); // public Report(int id, string stage, DateTime date, XmlNode xmlcontetnt, string comment = "") // report.Save(); } } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult Forecast( ) { RGEContext context = null; ActionResult view = View("Index"); ViewBag.EGHLayout = "RGE.Forecast"; try { context = new RGEContext(this); view = View(context); if (!ForecastViewConext.Handler(context, this.HttpContext.Request.Params)) { if (ChoiceRiskObjectContext.Handler(context, this.HttpContext.Request.Params)) { } } else { string menuitem = this.HttpContext.Request.Params["menuitem"]; if (menuitem.Equals("Forecast.Forecast")) { ForecastViewConext viewcontext = context.GetViewContext("Forecast") as ForecastViewConext; if (viewcontext != null) { RiskObject riskobject = new RiskObject(); if (RiskObject.GetById(context, (int)viewcontext.RiskObjectId, ref riskobject)) { PetrochemicalType petrochemicaltype = new PetrochemicalType(); if (PetrochemicalType.GetByCode(context, (int)viewcontext.Petrochemical_type_code, ref petrochemicaltype)) { SpreadPoint spreadpoint = new SpreadPoint(riskobject, petrochemicaltype, (float)viewcontext.Volume); EGH01DB.Types.IncidentType incidenttype = new EGH01DB.Types.IncidentType(); if (EGH01DB.Types.IncidentType.GetByCode(context, (int)viewcontext.Incident_type_code, out incidenttype)) { Incident incident = new Incident( (DateTime)viewcontext.Incident_date, (DateTime)viewcontext.Incident_date_message, incidenttype, spreadpoint ); viewcontext.ecoforecast = new RGEContext.ECOForecast(incident); viewcontext.Regim = ForecastViewConext.REGIM.REPORT; } else { viewcontext.Regim = ForecastViewConext.REGIM.RUNERROR; } } else { viewcontext.Regim = ForecastViewConext.REGIM.RUNERROR; } } else { viewcontext.Regim = ForecastViewConext.REGIM.RUNERROR; } } else { viewcontext.Regim = ForecastViewConext.REGIM.RUNERROR; } } else if (menuitem.Equals("Forecast.Cancel")) { view = View("Index", context); //view = Redirect("Index"); } else if (menuitem.Equals("Forecast.Save")) { ForecastViewConext viewcontext = context.GetViewContext("Forecast") as ForecastViewConext; EGH01DB.RGEContext.ECOForecast forecast = viewcontext.ecoforecast; //XmlNode node = forecast.toXmlNode("Отладка"); //XmlDocument doc = new XmlDocument(); //doc.AppendChild(doc.ImportNode(node, true)); //doc.Save(@"C:\Report.xml"); if (RGEContext.ECOForecast.Create(context, forecast, "отладка")) { } } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }