Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.2 Deployment #353

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<FileVersion>7.1.0.0</FileVersion>
<FileVersion>7.2.0.0</FileVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<Description>https://github.com/BHoM/LifeCycleAssessment_Toolkit</Description>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>https://github.com/BHoM/LifeCycleAssessment_Toolkit</Description>
<FileVersion>7.1.0.0</FileVersion>
<FileVersion>7.2.0.0</FileVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<RootNamespace>BH.Engine.LifeCycleAssessment</RootNamespace>
<OutputPath>..\Build\</OutputPath>
Expand Down
84 changes: 84 additions & 0 deletions LifeCycleAssessment_Engine/Modify/ModifyInsulationEPD.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Geometry;
using BH.oM.Dimensional;
using System;
using System.Collections.Generic;
using System.Linq;
using BH.oM.Base;
using BH.Engine.Geometry;
using BH.Engine.Spatial;
using BH.Engine.Base;
using BH.oM.Physical.FramingProperties;

using BH.oM.Base.Attributes;
using System.ComponentModel;
using BH.oM.LifeCycleAssessment.MaterialFragments;
using BH.oM.Quantities.Attributes;
using System.Reflection;

namespace BH.Engine.Facade
{
public static partial class Modify
{
/***************************************************/
/**** Public Methods ****/
/***************************************************/

[Description("Scales the quantity values in an area based insulation EPD based on project RSI (m2K/W).")]
[Input("insulationEPD", "Insulation EPD to scale quantity values for.")]
[Input("rSI", "RSI for insulation (m2K/W).")]
[Output("modifiedEPD", "FrameEdgeProperty with modified section profile depth.")]
public static EnvironmentalProductDeclaration ModifyInsulationEPD(this EnvironmentalProductDeclaration insulationEPD, double rSI)

Check warning on line 52 in LifeCycleAssessment_Engine/Modify/ModifyInsulationEPD.cs

View check run for this annotation

BHoMBot-CI / beta-code-compliance

LifeCycleAssessment_Engine/Modify/ModifyInsulationEPD.cs#L52

Modify methods should return void, or their return type should be different to the input type of their first parameter - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/ModifyReturnsDifferentType
{
if (rSI <= 0 || rSI == double.NaN)
{
Base.Compute.RecordError($"Valid RSI is not assigned.");
return null;
}

if (insulationEPD == null)
{
Base.Compute.RecordError($"Cannot convert null EPD.");
return null;
}

if (insulationEPD.QuantityType != oM.LifeCycleAssessment.QuantityType.Area)
{
Base.Compute.RecordError($"ModifyInsulationEPD only works on insulation EPDs with Area quantity type.");
return null;
}

foreach (EnvironmentalMetric environmentalMetric in insulationEPD.EnvironmentalMetrics)
{
foreach (PropertyInfo property in environmentalMetric.GetType().GetProperties().ToList())
{
if (property.PropertyType == typeof(double))
environmentalMetric.SetPropertyValue(property.Name, (double)property.GetValue(environmentalMetric) * rSI);
}
}

return insulationEPD;
}
}
}