User data for cracks were added

This commit is contained in:
Evgeny Redikultsev
2024-05-18 15:51:59 +05:00
parent b32a7ce7df
commit 845929406e
31 changed files with 925 additions and 175 deletions

View File

@@ -0,0 +1,82 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
//All rights reserved.
namespace StructureHelperLogics.NdmCalculations.Cracking
{
/// <summary>
/// Logic of calculating of factor of softening by power expression
/// </summary>
public class ExpSofteningLogic : ICrackSofteningLogic
{
private double forceRatio;
private double powerFactor;
public double PowerFactor
{
get => powerFactor;
set
{
if (value < 0)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Power Factor must not be less than zero");
}
powerFactor = value;
}
}
/// <summary>
/// Factor betta in exponential softening model of reinforced concrete
/// </summary>
public double BettaFactor { get; set; }
public double ForceRatio
{
get => forceRatio;
set
{
if (value < 0)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be less than zero");
}
else if (value > 1)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be greater than 1.0");
}
forceRatio = value;
}
}
/// <inheritdoc/>
public double PsiSMin {get;set;}
public IShiftTraceLogger? TraceLogger { get; set; }
public ExpSofteningLogic()
{
PsiSMin = 0.2d;
PowerFactor = 2d;
BettaFactor = 0.8d;
}
/// <inheritdoc/>
public double GetSofteningFactor()
{
TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service);
TraceLogger?.AddMessage($"Logic of calculation of psi_s factor based on exponential softening model");
TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor");
TraceLogger?.AddMessage($"But not less than psi_s_min = {PsiSMin}");
TraceLogger?.AddMessage($"BettaFactor = {BettaFactor}");
TraceLogger?.AddMessage($"ForceRatio = {ForceRatio}");
TraceLogger?.AddMessage($"PowerFactor = {PowerFactor}");
double psi;
psi = 1 - BettaFactor * Math.Pow(ForceRatio, PowerFactor);
TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor = 1 - {BettaFactor} * {ForceRatio} ^ {PowerFactor} = {psi}");
double psi_c = Math.Max(psi, PsiSMin);
TraceLogger?.AddMessage($"Since psi_s = {psi} and psi_s_min = {PsiSMin},\npsi_s = {psi_c}");
return psi_c;
}
}
}

View File

@@ -0,0 +1,21 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
/// <summary>
/// Logic of calculating of factor of softening in crack of RC structures
/// </summary>
public interface ICrackSofteningLogic : ILogic
{
/// <summary>
/// Returns softening factor
/// </summary>
/// <returns></returns>
double GetSofteningFactor();
}
}

View File

@@ -0,0 +1,161 @@
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class RebarStressSofteningLogic : ICrackSofteningLogic
{
private IStressLogic stressLogic;
private RebarStressResult afterCrackingRebarResult;
private RebarStressResult actualRebarResult;
private INdm concreteNdm;
private INdm rebarNdm;
private double rebarStrainActual;
private double concreteStrainActual;
private double rebarStressActual;
public double MinValueOfFactor { get; set; } = 0.2d;
public RebarPrimitive RebarPrimitive { get; set; }
public RebarCrackInputData InputData { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetSofteningFactor()
{
GetNdms();
return GetPsiSFactor(InputData.ForceTuple, InputData.CrackableNdmCollection, InputData.CrackedNdmCollection);
}
private void GetNdms()
{
var options = new TriangulationOptions()
{
CalcTerm = CalcTerms.ShortTerm,
LimiteState = LimitStates.SLS,
};
concreteNdm = RebarPrimitive.GetConcreteNdm(options);
concreteNdm.StressScale = 1d;
rebarNdm = RebarPrimitive.GetRebarNdm(options);
}
private double GetPsiSFactor(ForceTuple forceTuple, IEnumerable<INdm> crackableNndms, IEnumerable<INdm> crackedNndms)
{
var crackResult = calculateCrackTuples(forceTuple, crackableNndms);
if (crackResult.IsValid == false)
{
string errorString = LoggerStrings.CalculationError + crackResult.Description;
TraceLogger?.AddMessage($"Rebar name: {RebarPrimitive.Name}\n" + errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
actualRebarResult = GetRebarStressResult(forceTuple);
rebarStrainActual = actualRebarResult.RebarStrain;
rebarStressActual = actualRebarResult.RebarStress;
TraceLogger?.AddMessage($"Actual strain of rebar EpsilonS = {rebarStrainActual}(dimensionless)");
concreteStrainActual = concreteNdm.Prestrain;
//concreteStrainActual = stressLogic.GetTotalStrain(TupleConverter.ConvertToLoaderStrainMatrix(strainTupleActual), concreteNdm);
TraceLogger?.AddMessage($"Actual strain of concrete on the axis of rebar EpsilonC = {concreteStrainActual}(dimensionless)");
if (crackResult.IsSectionCracked == false)
{
TraceLogger?.AddMessage($"Section is not cracked PsiS = {MinValueOfFactor}");
return MinValueOfFactor;
}
if (crackResult.FactorOfCrackAppearance == 0d)
{
TraceLogger?.AddMessage($"Section is cracked in start force combination, PsiS = 1.0");
return 1d;
}
afterCrackingRebarResult = GetRebarStressResult(crackResult.TupleOfCrackAppearance as ForceTuple);
var stressInCracking = afterCrackingRebarResult.RebarStress;
TraceLogger?.AddMessage($"Stress in rebar immediately after cracking Sigma,scrc = {stressInCracking}(Pa)");
TraceLogger?.AddMessage($"Actual stress in rebar Sigma,s = {rebarStressActual}(Pa)");
double psiS = GetExponentialSofteningFactor(stressInCracking);
TraceLogger?.AddMessage($"PsiS = {psiS}");
//return 0.94d;
return psiS;
}
private double GetExponentialSofteningFactor(double stressInCracking)
{
var stressRatio = stressInCracking / rebarStressActual;
var logic = new ExpSofteningLogic()
{
ForceRatio = stressRatio,
PsiSMin = MinValueOfFactor,
PowerFactor = 1d,
BettaFactor = 0.8d,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
};
double psiS = logic.GetSofteningFactor();
return psiS;
}
private CrackForceResult calculateCrackTuples(ForceTuple forceTuple, IEnumerable<INdm> ndms)
{
var sectionCrackedLogic = new SectionCrackedLogic()
{
NdmCollection = ndms,
CheckedNdmCollection = new List<INdm>() { concreteNdm },
TraceLogger = TraceLogger?.GetSimilarTraceLogger(100)
};
var crackedLogis = new CrackedLogic(sectionCrackedLogic)
{
StartTuple = new ForceTuple(),
EndTuple = forceTuple,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(100)
};
var calculator = new CrackForceCalculator(crackedLogis)
{
NdmCollection = ndms,
EndTuple = forceTuple,
Accuracy = new Accuracy()
{
IterationAccuracy = 0.01d,
MaxIterationCount = 1000
},
TraceLogger = TraceLogger?.GetSimilarTraceLogger(150)
};
calculator.Run();
return calculator.Result as CrackForceResult;
}
private RebarStressResult GetRebarStressResult(ForceTuple forceTuple)
{
var calculator = new RebarStressCalculator()
{
ForceTuple = forceTuple,
NdmCollection = InputData.CrackedNdmCollection,
RebarPrimitive = RebarPrimitive
};
calculator.Run();
var result = calculator.Result as RebarStressResult;
if (result.IsValid == false)
{
string errorString = LoggerStrings.CalculationError + result.Description;
TraceLogger?.AddMessage($"Rebar name: {RebarPrimitive.Name}\n" + errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
return result;
}
}
}

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class StabSoftetingLogic : ICrackSofteningLogic
{
private double stabSofteningValue;
public IShiftTraceLogger? TraceLogger { get; set; }
public StabSoftetingLogic(double stabSofteningValue)
{
this.stabSofteningValue = stabSofteningValue;
}
public double GetSofteningFactor()
{
TraceLogger?.AddMessage($"Constant value of softening factor PsiS = {stabSofteningValue}");
return stabSofteningValue;
}
}
}