Logics of accidental eccentricity were separated and tested

This commit is contained in:
Evgeny Redikultsev
2024-03-10 19:20:01 +05:00
parent 0a453c5a95
commit b81b7a0929
30 changed files with 885 additions and 331 deletions

View File

@@ -0,0 +1,54 @@
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
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 StructureHelperCommon.Models.Sections.Logics
{
public class RcAccEccentricityLogic : IRcAccEccentricityLogic
{
private const string accEccMessage = "Accidental eccentricity along {0}-axis";
/// <summary>
/// Properties of compressed member
/// </summary>
public double Length { get; set; }
/// <summary>
/// Size of cross-section along X-axis, m
/// </summary>
public double SizeX { get; set; }
/// <summary>
/// Size of cross-section along Y-axis, m
/// </summary>
public double SizeY { get; set; }
///<inheritdoc/>
public IShiftTraceLogger? TraceLogger { get; set; }
private IRcEccentricityAxisLogic eccentricityLogic;
public RcAccEccentricityLogic(IRcEccentricityAxisLogic eccentricityLogic)
{
this.eccentricityLogic = eccentricityLogic;
}
public RcAccEccentricityLogic() : this(new RcEccentricityAxisLogic())
{
}
public (double ex, double ey) GetValue()
{
eccentricityLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(string.Format(accEccMessage, "x"));
eccentricityLogic.Length = Length;
eccentricityLogic.Size = SizeX;
var xFullEccentricity = eccentricityLogic.GetValue();
TraceLogger?.AddMessage(string.Format(accEccMessage, "y"));
eccentricityLogic.Size = SizeY;
var yFullEccentricity = eccentricityLogic.GetValue();
return (xFullEccentricity, yFullEccentricity);
}
}
}