public void CostAtMax_Succeeds() { var utilization = new WallShearUtilization(new ForcePerLength(2000, ForcePerLengthUnit.PoundPerFoot)); var cost = utilization.GetNormalizedCost(); Assert.That(cost, Is.EqualTo(3.0).Within(1e-6)); }
public void CostModelBetweenZeroAndOne_Succeeds() { var utilization = new WallShearUtilization(new ForcePerLength(750, ForcePerLengthUnit.PoundPerFoot)); var cost = utilization.GetNormalizedCost(); Assert.That(cost, Is.EqualTo(0.875).Within(1e-6)); }
private WallCostCharacterization CharacterizeAllWallCosts() { double totalStructuralShearWallCost = 0; bool allWallsMeetShearLimit = true; foreach (BuildingLevelLateral2 level in _lateralLevels) { RigidAnalysis analysis = RigidAnalyses[level.Level]; foreach (AnalyticalWallLateral wall in analysis.Walls) { Force maxShear = analysis.Responses.WallLoadCaseResults[wall.UniqueId] .EnvelopeResponsesAbsolute(_loadCases).TotalShear; Length wallLength = new Length(wall.WallLine.Length, LengthUnit.Inch); var shearUtilization = new WallShearUtilization((ForcePerLength)(maxShear / wallLength)); totalStructuralShearWallCost += shearUtilization.GetNormalizedCost(); if (allWallsMeetShearLimit && shearUtilization.ExceedsLimit) { allWallsMeetShearLimit = false; } } } // geometry at lowest level var lowestLevel = _lateralLevels.OrderBy(l => l.Level.Elevation).First(); var geometry = new Geometry { BoundaryVertices = lowestLevel.Boundary.Vertices.ToList() }; foreach (AnalyticalWallLateral wall in RigidAnalyses[lowestLevel.Level].Walls) { geometry.Wall.Add(new WallGeometry { EndI = wall.WallLine.StartPoint, EndJ = wall.WallLine.EndPoint }); } return(new WallCostCharacterization { RandomizedBuilding = _serializedModel.RandomizedBuilding, TotalStructuralShearWallCost = totalStructuralShearWallCost, GrossSquareFeet = new Area(_lateralLevels.First().Boundary.GetArea(), AreaUnit.SquareInch).ConvertTo(AreaUnit.SquareFoot), Geometry = geometry, MeetsDriftLimit = true, MeetsWallDesignLimit = allWallsMeetShearLimit }); }