public void ExampleTest3_CalculateSnowLoad_Success() { var buildingSite = new BuildingSite(Zones.FirstZone, Topographies.Normal, 127); buildingSite.CalculateExposureCoefficient(); var snowLoad = new SnowLoad(buildingSite, DesignSituation.B2, true); snowLoad.CalculateSnowLoad(); var building = new Building(snowLoad); building.CalculateThermalCoefficient(); var roofAbuttingToTallerConstruction5Degrees = new ExceptionalRoofAbuttingToTallerConstruction(building, 12, 14.6, 4.5, 5); roofAbuttingToTallerConstruction5Degrees.CalculateDriftLength(); roofAbuttingToTallerConstruction5Degrees.CalculateSnowLoad(); var roofAbuttingToTallerConstruction35Degrees = new ExceptionalRoofAbuttingToTallerConstruction(building, 12, 14.6, 4.5, 35); roofAbuttingToTallerConstruction35Degrees.CalculateDriftLength(); roofAbuttingToTallerConstruction35Degrees.CalculateSnowLoad(); Assert.AreEqual(14.6, Math.Round(roofAbuttingToTallerConstruction5Degrees.DriftLength, 3), "Drift length is not calculated properly."); Assert.AreEqual(1.4, Math.Round(roofAbuttingToTallerConstruction5Degrees.SnowLoadNearTheTop, 3), "Snow load for roof is not calculated properly."); Assert.AreEqual(1.4, Math.Round(roofAbuttingToTallerConstruction5Degrees.SnowLoadNearTheEdge, 3), "Snow load for roof is not calculated properly."); Assert.AreEqual(0, Math.Round(roofAbuttingToTallerConstruction35Degrees.SnowLoadNearTheTop, 3), "Snow load for roof is not calculated properly."); Assert.AreEqual(1.167, Math.Round(roofAbuttingToTallerConstruction35Degrees.SnowLoadNearTheEdge, 3), "Snow load for roof is not calculated properly."); }
public void ExternalWindPressureCalculationsTest_Roof2_MaxValues_Success() { //Arrange: var windZone = WindZone.III; var building = new FlatRoof(20, 10, 15); var terrainOrography = new CliffEscarpmentOrography( actualLengthUpwindSlope: 15, effectiveFeatureHeight: 5, horizontalDistanceFromCrestTop: 2); var terrain = new TerrainCategoryIII(terrainOrography); var directionalFactor = new DirectionalFactor(windZone, windDirection: 40); var buildingSite = new BuildingSite( 325, windZone, terrain, directionalFactor: directionalFactor); var windLoadData = new WindLoadData(buildingSite, building); var flatRoofWindLoads = new FlatRoofWindLoads(building, windLoadData); //Act: var result = flatRoofWindLoads.GetExternalWindPressureMaxAt(building.Height); //Assert: Assert.Multiple(() => { Assert.That(result[Field.F], Is.EqualTo(-0.818).Within(0.001)); Assert.That(result[Field.G], Is.EqualTo(-0.530).Within(0.001)); Assert.That(result[Field.H], Is.EqualTo(-0.258).Within(0.001)); Assert.That(result[Field.I], Is.EqualTo(0.073).Within(0.001)); }); }
public static bool OpenProjectFromFile() { try { win32.OpenFileDialog openFileDialog = new win32.OpenFileDialog(); openFileDialog.Filter = "XML file (*.xml)|*.xml"; if (openFileDialog.ShowDialog() == true) { FilePath = openFileDialog.FileName; } else { return(false); } ClearAll(); InicializeNew(); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(FilePath); XmlElement xmlRoot = xmlDocument.DocumentElement; foreach (XmlNode childNode in xmlRoot.ChildNodes) { if (childNode.Name == "BuildingSite") { BuildingSite = new BuildingSite(childNode); } } IsDataChanged = false; return(true); } catch (Exception ex) { MessageBox.Show("Ошибка загрузки: " + ex.Message); return(false); } }
public IResult Calculate() { BuildingSite buildingSite = GetBuildingSite(); SnowLoad snowLoad = GetSnowLoad(buildingSite); Building building = GetBuilding(snowLoad); DriftingAtProjectionsObstructions driftingAtProjectionsObstructions = GetDriftingAtProjectionsObstructions(building); if (!ExposureCoefficient.HasValue) { buildingSite.CalculateExposureCoefficient(); } snowLoad.CalculateSnowLoad(); building.CalculateThermalCoefficient(); driftingAtProjectionsObstructions.CalculateSnowLoad(); var result = new Result(); result.Properties.Add("C_e_", buildingSite.ExposureCoefficient); result.Properties.Add("s_k_", snowLoad.DefaultCharacteristicSnowLoad); result.Properties.Add("V", snowLoad.VariationCoefficient); result.Properties.Add("C_esl_", snowLoad.ExceptionalSnowLoadCoefficient); result.Properties.Add("s_n_", snowLoad.SnowLoadForSpecificReturnPeriod); result.Properties.Add("s_Ad_", snowLoad.DesignExceptionalSnowLoadForSpecificReturnPeriod); result.Properties.Add("t_i_", building.InternalTemperature); result.Properties.Add("∆_t_", building.TempreatureDifference); result.Properties.Add("U", building.OverallHeatTransferCoefficient); result.Properties.Add("C_t_", building.ThermalCoefficient); result.Properties.Add("μ_1_", driftingAtProjectionsObstructions.FirstShapeCoefficient); result.Properties.Add("μ_2_", driftingAtProjectionsObstructions.SecondShapeCoefficient); result.Properties.Add("l_s_", driftingAtProjectionsObstructions.DriftLength); result.Properties.Add("s_2_", driftingAtProjectionsObstructions.SnowLoadOnRoofValue); result.Properties.Add("s_1_", driftingAtProjectionsObstructions.SnowLoadOnRoofValueAtTheEnd); return(result); }
public IResult Calculate() { BuildingSite buildingSite = GetBuildingSite(); SnowLoad snowLoad = GetSnowLoad(buildingSite); Building building = GetBuilding(snowLoad); ExceptionalSnowBehindParapet exceptionalSnowBehindParapet = GetExceptionalSnowBehindParapet(building); if (!ExposureCoefficient.HasValue) { buildingSite.CalculateExposureCoefficient(); } snowLoad.CalculateSnowLoad(); building.CalculateThermalCoefficient(); exceptionalSnowBehindParapet.CalculateDriftLength(); exceptionalSnowBehindParapet.CalculateSnowLoad(); var result = new Result(); result.Properties.Add("C_e_", buildingSite.ExposureCoefficient); result.Properties.Add("s_k_", snowLoad.DefaultCharacteristicSnowLoad); result.Properties.Add("V", snowLoad.VariationCoefficient); result.Properties.Add("C_esl_", snowLoad.ExceptionalSnowLoadCoefficient); result.Properties.Add("s_n_", snowLoad.SnowLoadForSpecificReturnPeriod); result.Properties.Add("s_Ad_", snowLoad.DesignExceptionalSnowLoadForSpecificReturnPeriod); result.Properties.Add("t_i_", building.InternalTemperature); result.Properties.Add("∆_t_", building.TempreatureDifference); result.Properties.Add("U", building.OverallHeatTransferCoefficient); result.Properties.Add("C_t_", building.ThermalCoefficient); result.Properties.Add("l_s_", exceptionalSnowBehindParapet.DriftLength); result.Properties.Add("μ_1_", exceptionalSnowBehindParapet.ShapeCoefficient); result.Properties.Add("s", exceptionalSnowBehindParapet.SnowLoad); return(result); }
public IResult Calculate() { BuildingSite buildingSite = GetBuildingSite(); SnowLoad snowLoad = GetSnowLoad(buildingSite); Building building = GetBuilding(snowLoad); ExceptionalMultiSpanRoof exceptionalMultiSpanRoof = GetExceptionalMultiSpanRoof(building); if (!ExposureCoefficient.HasValue) { buildingSite.CalculateExposureCoefficient(); } snowLoad.CalculateSnowLoad(); building.CalculateThermalCoefficient(); exceptionalMultiSpanRoof.CalculateSnowLoad(); var result = new Result(); result.Properties.Add("C_e_", buildingSite.ExposureCoefficient); result.Properties.Add("s_k_", snowLoad.DefaultCharacteristicSnowLoad); result.Properties.Add("V", snowLoad.VariationCoefficient); result.Properties.Add("C_esl_", snowLoad.ExceptionalSnowLoadCoefficient); result.Properties.Add("s_n_", snowLoad.SnowLoadForSpecificReturnPeriod); result.Properties.Add("s_Ad_", snowLoad.DesignExceptionalSnowLoadForSpecificReturnPeriod); result.Properties.Add("t_i_", building.InternalTemperature); result.Properties.Add("∆_t_", building.TempreatureDifference); result.Properties.Add("U", building.OverallHeatTransferCoefficient); result.Properties.Add("C_t_", building.ThermalCoefficient); result.Properties.Add("b_3_", exceptionalMultiSpanRoof.HorizontalDimensionOfThreeSlopes); result.Properties.Add("μ_1_", exceptionalMultiSpanRoof.ShapeCoefficient); result.Properties.Add("s", exceptionalMultiSpanRoof.SnowLoad); return(result); }
public void DirectionalFactorTest_Success() { var terrain = new Mock <ITerrain>(); var buildingSite = new BuildingSite(heightAboveSeaLevel: 250, windZone: WindZone.II, terrain: terrain.Object); Assert.That(buildingSite.DirectionalFactor, Is.EqualTo(1.0)); }
public void CalculateExposureCoefficientTest_NoneTopography_Success() { var buildingSite = new BuildingSite(currentTopography: Topographies.None); buildingSite.CalculateExposureCoefficient(); Assert.AreEqual(1.2, buildingSite.ExposureCoefficient, "Exposure coefficient is wrong."); }
public void BasicWindVelocityTest_Success() { var terrain = new Mock <ITerrain>(); var buildingSite = new BuildingSite(heightAboveSeaLevel: 350, windZone: WindZone.II, terrain: terrain.Object); Assert.That(buildingSite.BasicWindVelocity, Is.EqualTo(26)); }
public void FundamentalValueBasicWindVelocityTest_Success( double heightAboveSeaLevel, WindZone windZone, double expectedResult) { var terrain = new Mock <ITerrain>(); var buildingSite = new BuildingSite(heightAboveSeaLevel, windZone, terrain.Object); Assert.That(buildingSite.FundamentalValueBasicWindVelocity, Is.EqualTo(expectedResult)); }
public static BuildingSite InstantiateNew(BuildingBlueprint blueprint) { GameObject prefab = PrefabLoader.GetPrefab <GameObject>(prefabPath); GameObject gObj = Instantiate(prefab) as GameObject; BuildingSite site = gObj.GetComponent <BuildingSite>(); site.data.blueprint = blueprint; return(site); }
protected SnowLoad GetSnowLoad(BuildingSite buildingSite) { if (SnowDensity.HasValue && ReturnPeriod.HasValue) { return(new SnowLoad(buildingSite, SnowDensity.Value, ReturnPeriod.Value, DesignSituation.HasValue ? DesignSituation.Value : default,
public void ConstructionTest_Success() { var terrain = new Mock <ITerrain>(); var buildingSite = new BuildingSite(heightAboveSeaLevel: 250, windZone: WindZone.II, terrain: terrain.Object); Assert.That(buildingSite.HeightAboveSeaLevel, Is.EqualTo(250)); Assert.That(buildingSite.WindZone, Is.EqualTo(WindZone.II)); }
public void CalculateExposureCoefficientTest_WindsweptTopography_Success() { var buildingSite = new BuildingSite(); buildingSite.CurrentTopography = TopographyEnum.Windswept; buildingSite.CalculateExposureCoefficient(); Assert.AreEqual(0.8, buildingSite.ExposureCoefficient, "Exposure coefficient is wrong."); }
public void CalculateExposureCoefficientTest_ShelteredTopography_Success() { var buildingSite = new BuildingSite(); buildingSite.CurrentTopography = TopographyEnum.Sheltered; buildingSite.CalculateExposureCoefficient(); Assert.AreEqual(1.2, buildingSite.ExposureCoefficient, "Exposure coefficient is wrong."); }
public void ExampleTest4_CalculateSnowLoad_Success() { var buildingSite = new BuildingSite(Zones.SecondZone, Topographies.Normal, altitudeAboveSea: 175); var snowLoad = new SnowLoad(buildingSite); var building = new Building(snowLoad); var monopitchRoof = new MonopitchRoof(building, 10); buildingSite.CalculateExposureCoefficient(); snowLoad.CalculateSnowLoad(); building.CalculateThermalCoefficient(); monopitchRoof.CalculateSnowLoad(); Assert.AreEqual(0.72, Math.Round(monopitchRoof.SnowLoadOnRoofValue, 3), "Snow load is not calculated properly."); }
private BuildingData CreateBuildingData( DesignSituation designSituation = DesignSituation.A, bool exceptional = false) { var buildingSite = new BuildingSite(ZoneEnum.FirstZone, TopographyEnum.Sheltered, 250); var snowLoad = new SnowLoad(buildingSite, designSituation, exceptional); var building = new Building(snowLoad); return(new BuildingData() { BuildingSite = buildingSite, SnowLoad = snowLoad, Building = building }); }
/// <summary> /// Generate Buildings on the edges of the road /// </summary> private void GenerateBuildingsOnRoad(Road road) { //create building parent if none exists if (_buildingParent == null) { _buildingParent = new GameObject("Buildings"); _buildingParent.SetParent(_townParent); } var cell = road.ParentCell; int offset = _terrainSettings.RoadWidth; const float minDistance = 0.2f; //access building prefabs for this cell var prefabs = GetPrefabsForType(cell.DistrictType); if (prefabs == null) { return; } //Create an offset line of this road towards the inside of the cell var offsetLine = road.GenerateOffsetParallelTowardsPoint(offset, cell.SitePoint); //calculate total length of the line var length = offsetLine.Length(); var traveled = minDistance * 2; //keep repeating until the end is reached while (traveled < length - (minDistance * 2)) { //get point on line using normalized values [0,1] var pc = traveled / length; var pos = offsetLine.FindRandomPointOnLine(pc, pc); //Select a random prefab var prefab = prefabs.GetRandomValue(); //Create a building site from this point var bs = BuildingSite.FromPoint(pos); bs.ParentRoad = road; //Spawn the building SpawnBuilding(pos.ToVector3(), prefab, bs); //travel along the line using the width of the building site traveled += (minDistance + bs.Width / 2); } }
public void GetPeakVelocityPressureTest_Success() { //Arrange: var building = new EqualHeightWalls(10, 10, 10); var terrain = new TerrainCategoryI(); var buildingSite = new BuildingSite(325, WindZone.I, terrain); var windLoadData = new WindLoadData(buildingSite, building); //Act: var result = windLoadData.GetPeakVelocityPressureAt(10); //Assert: Assert.That(result, Is.EqualTo(0.904).Within(0.001)); }
public void ExampleTest2_CalculateSnowLoad_Success() { var buildingSite = new BuildingSite(Zones.ThirdZone, Topographies.Normal, 360); var snowLoad = new SnowLoad(buildingSite); var building = new Building(snowLoad); var monopitchRoof = new MonopitchRoof(building, 5); buildingSite.CalculateExposureCoefficient(); snowLoad.CalculateSnowLoad(); building.CalculateThermalCoefficient(); monopitchRoof.CalculateSnowLoad(); Assert.AreEqual(1.248, Math.Round(monopitchRoof.SnowLoadOnRoofValue, 3), "Snow load for roof is not calculated properly."); }
public IResult Calculate() { EqualHeightWalls structureData = GetStructureData(); HeightDisplacement heightDisplacement = GetHeightDisplacement(structureData); Terrain terrain = GetTerrainCategory(heightDisplacement); BuildingSite buildingSite = GetBuildingSite(); WindLoadData windLoadData = GetWindLoadData(); WallsWindLoads wallsWindLoads = GetWallsWindLoads(); //snowguards.CalculateSnowLoad(); //var result = new Result(); //result.Properties.Add("F_s_", snowguards.ForceExertedBySnow); // return result; throw new NotImplementedException(); }
/// <summary> /// Spawn a building on the position /// </summary> private void SpawnBuilding(Vector3 position, GameObject prefab, BuildingSite building) { var road = building.ParentRoad; //Make the building face the road, make a perpendicular line from the building pos to the road var lookAtPos = road.FindPerpendicularPointOnLine(new Point(position.x, position.z)).ToVector3(); //get correct spawn height from the terrain position.y = _terrain.SampleHeight(position); lookAtPos.y = position.y; //Get bounds of the prefab and store them var size = prefab.GetPrefabBounds(); building.Width = (int)size.x; building.Height = (int)size.z; //don't spawn when there is a collision var colliderPos = position; colliderPos.y += size.y / 2; if (isOverlapping(prefab, position)) { return; } //instantiate the building var go = (GameObject)Object.Instantiate(prefab, position, prefab.transform.rotation); //look at the road go.transform.LookAt(lookAtPos); //flip on Y go.transform.RotateAround(position, go.transform.up, 180); go.isStatic = true; go.SetParent(_buildingParent); building.UserData = go; //Remove grass and other details around the object //RemoveDetailsAroundGameObject((GameObject)go); //Add to the buildings list _buildings.Add(building); }
public async Task <IActionResult> Insert(BuildingSiteModel model) { if (ModelState.IsValid) { var storageAccount = CloudStorageAccount.Parse(_configuration["BlobStorageConnectionString"]); var blobClient = storageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference(model.BuildingSiteLocation.ToLower().Replace(" ", "-")); await container.CreateIfNotExistsAsync(); var folder = "BuildigSitePhotos"; foreach (var file in model.Photos) { var id = Guid.NewGuid(); var fileExtension = Path.GetExtension(file.FileName); var blobName = $"{folder}/{id}{fileExtension}"; var blobRef = container.GetBlockBlobReference(blobName); using (var stream = file.OpenReadStream()) { await blobRef.UploadFromStreamAsync(stream); } } var buildingSite = new BuildingSite { CustomerName = model.CustomerName, CutomerEmail = model.CustomerEMail, BuildingSiteLocation = model.BuildingSiteLocation, PhotoFolderUri = $"{container.Name}/{folder}" }; _buildingSiteRepository.Insert(buildingSite); return(RedirectToAction("Index")); } ModelState.AddModelError("", "Errore generico"); return(View(model)); }
public void BasicWindVelocityTest_WithFactors_Success() { var terrain = new Mock <ITerrain>(); var seasonalFactor = new Mock <IFactor>(); seasonalFactor.Setup(sf => sf.GetFactor()).Returns(0.5); var directionalFactor = new Mock <IFactor>(); directionalFactor.Setup(sf => sf.GetFactor()).Returns(0.1); var buildingSite = new BuildingSite( heightAboveSeaLevel: 250, windZone: WindZone.I, terrain: terrain.Object, seasonalFactor: seasonalFactor.Object, directionalFactor: directionalFactor.Object); Assert.That(buildingSite.BasicWindVelocity, Is.EqualTo(1.1)); }
public void createBuilding(BuildingSite site, GameObject prefab) { var Village = Instantiate(prefab, site.Position, Quaternion.LookRotation(site.Position), BottomModels).GetComponent <Destructible>(); Village.transform.localPosition = new Vector3(Village.transform.localPosition.x, 0, Village.transform.localPosition.z); villageObjects.Add(Village); Village.AddOnDestroyListener(delegate() { villageObjects.Remove(Village); UiText.addVillage(); Timer(2, delegate { villagesToSpawn.Add(site); villagesSpawned.Remove(site); }); }); }
public void ExternalWindPressureCalculationsTest_AS_SX01a_Success() { //Arrange: var building = new EqualHeightWalls( length: 72, width: 30, height: 7.3); var terrain = new TerrainCategoryII(); var buildingSite = new BuildingSite(325, WindZone.II, terrain); var windLoadData = new WindLoadData(buildingSite, building); var verticalWallOfRectangularBuilding = new WallsWindLoads(building, windLoadData); //Act: var result = verticalWallOfRectangularBuilding.GetExternalWindPressureMaxAt(building.Height); //Assert: Assert.Multiple(() => { Assert.That(result[Field.D], Is.EqualTo(0.638).Within(0.001)); Assert.That(result[Field.E], Is.EqualTo(-0.273).Within(0.001)); }); }
public void ExampleTest1_CalculateSnowLoad_Success() { var buildingSite = new BuildingSite(Zones.FirstZone, Topographies.Normal, 127); buildingSite.CalculateExposureCoefficient(); var snowLoad = new SnowLoad(buildingSite); snowLoad.CalculateSnowLoad(); var building = new Building(snowLoad); building.CalculateThermalCoefficient(); var pitchedRoof = new PitchedRoof(building, 35, 5); pitchedRoof.CalculateSnowLoad(); Assert.AreEqual(0.467, Math.Round(pitchedRoof.LeftRoof.SnowLoadOnRoofValue, 3), "Snow load for left roof is not calculated properly."); Assert.AreEqual(0.56, Math.Round(pitchedRoof.RightRoof.SnowLoadOnRoofValue, 3), "Snow load for right roof is not calculated properly."); }
public void ExternalWindPressureCalculationsTest_Walls_Success() { //Arrange: var building = new EqualHeightWalls(10, 10, 15); var terrain = new TerrainCategoryIII(); var buildingSite = new BuildingSite(325, WindZone.I_III, terrain); var windLoadData = new WindLoadData(buildingSite, building); var verticalWallOfRectangularBuilding = new WallsWindLoads(building, windLoadData); //Act: var result = verticalWallOfRectangularBuilding.GetExternalWindPressureMaxAt(building.Height); //Assert: Assert.Multiple(() => { Assert.That(result[Field.A], Is.EqualTo(-0.754).Within(0.001)); Assert.That(result[Field.B], Is.EqualTo(-0.503).Within(0.001)); Assert.That(result[Field.D], Is.EqualTo(0.503).Within(0.001)); Assert.That(result[Field.E], Is.EqualTo(-0.330).Within(0.001)); }); }
public void Insert(BuildingSite value) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); string query = @" INSERT INTO [dbo].[BuildingSite] ([CustomerName] ,[CutomerEmail] ,[BuildingSiteLocation] ,[PhotoFolderUri]) VALUES (@CustomerName ,@CutomerEmail ,@BuildingSiteLocation ,@PhotoFolderUri)"; connection.Query(query, value); } }
public static void InicializeNew() { BuildingSite = new BuildingSite(); BuildingSite.BuildingList.Add(new Building(BuildingSite)); IsDataChanged = false; #region ForceParamKinds = new List <ForceParamKind>(); ForceParamKinds.Add(new ForceParamKind { Label = "Продольная сила N", UnitLabel = "Н", Addition = "Положительному значению силы соответствует направление вдоль оси Z (направлена вертикально вверх)" }); ForceParamKinds.Add(new ForceParamKind { Label = "Изгибающий момент Mx", UnitLabel = "Н*м", Addition = "За положительное значение момента принят момент против часовой стрелки если смотреть с конца оси X" }); ForceParamKinds.Add(new ForceParamKind { Label = "Изгибающий момент My", UnitLabel = "Н*м", Addition = "За положительное значение момента принят момент против часовой стрелки если смотреть с конца оси Y" }); ForceParamKinds.Add(new ForceParamKind { Label = "Поперечная сила Qx", UnitLabel = "Н", Addition = "Положительному значению силы соответствует направление вдоль оси X (направлена вправо по плану)" }); ForceParamKinds.Add(new ForceParamKind { Label = "Поперечная сила Qy", UnitLabel = "Н", Addition = "Положительному значению силы соответствует направление вдоль оси Y (направлена вверх по плану)" }); #endregion }