Material diagram Window was changed
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportForceResultToCSVLogic : IExportResultLogic
|
||||
{
|
||||
const string separator = ";";
|
||||
StringBuilder output;
|
||||
IForcesResults results;
|
||||
public string FileName { get; set; }
|
||||
|
||||
public void Export()
|
||||
{
|
||||
ExportHeadings();
|
||||
ExportBoby();
|
||||
try
|
||||
{
|
||||
File.AppendAllText(FileName, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public ExportForceResultToCSVLogic(IForcesResults forcesResults)
|
||||
{
|
||||
this.results = forcesResults;
|
||||
output = new StringBuilder();
|
||||
}
|
||||
|
||||
private void ExportHeadings()
|
||||
{
|
||||
string[] headings =
|
||||
{
|
||||
"Limit State",
|
||||
"Calc duration",
|
||||
"Mx",
|
||||
"My",
|
||||
"Nz",
|
||||
"kx",
|
||||
"ky",
|
||||
"epsz"
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
}
|
||||
private void ExportBoby()
|
||||
{
|
||||
foreach (var item in results.ForcesResultList)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
var tuple = item.DesignForceTuple.ForceTuple;
|
||||
var strainMatrix = item.LoaderResults.StrainMatrix;
|
||||
string[] newLine =
|
||||
{
|
||||
item.DesignForceTuple.LimitState.ToString(),
|
||||
item.DesignForceTuple.CalcTerm.ToString(),
|
||||
tuple.Mx.ToString(),
|
||||
tuple.My.ToString(),
|
||||
tuple.Nz.ToString(),
|
||||
strainMatrix.Kx.ToString(),
|
||||
strainMatrix.Ky.ToString(),
|
||||
strainMatrix.EpsZ.ToString()
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportGeometryResultToCSVLogic : IExportResultLogic
|
||||
{
|
||||
const string separator = ";";
|
||||
StringBuilder output;
|
||||
IGeometryResult result;
|
||||
public string FileName { get; set; }
|
||||
public ExportGeometryResultToCSVLogic(IGeometryResult geometryResult)
|
||||
{
|
||||
this.result = geometryResult;
|
||||
output = new StringBuilder();
|
||||
}
|
||||
public void Export()
|
||||
{
|
||||
ExportHeadings();
|
||||
ExportBoby();
|
||||
try
|
||||
{
|
||||
File.AppendAllText(FileName, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void ExportHeadings()
|
||||
{
|
||||
string[] headings =
|
||||
{
|
||||
"Name",
|
||||
"Short",
|
||||
"Measerement Unit",
|
||||
"Value",
|
||||
"Description",
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
}
|
||||
private void ExportBoby()
|
||||
{
|
||||
foreach (var item in result.TextParameters)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
string[] newLine =
|
||||
{
|
||||
item.Name,
|
||||
item.ShortName,
|
||||
item.MeasurementUnit,
|
||||
item.Value.ToString(),
|
||||
item.Description
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportToCSVLogic : IExportResultLogic
|
||||
{
|
||||
string filename;
|
||||
|
||||
public void Export(INdmResult ndmResult)
|
||||
{
|
||||
string separator = ";";
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
if (ndmResult is ForcesResults)
|
||||
{
|
||||
var forceResults = ndmResult as ForcesResults;
|
||||
string[] headings =
|
||||
{
|
||||
"Limit State",
|
||||
"Calc duration",
|
||||
"Mx",
|
||||
"My",
|
||||
"Nz",
|
||||
"kx",
|
||||
"ky",
|
||||
"epsz"
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
foreach (var item in forceResults.ForcesResultList)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
var tuple = item.DesignForceTuple.ForceTuple;
|
||||
var strainMatrix = item.LoaderResults.StrainMatrix;
|
||||
string[] newLine =
|
||||
{
|
||||
item.DesignForceTuple.LimitState.ToString(),
|
||||
item.DesignForceTuple.CalcTerm.ToString(),
|
||||
tuple.Mx.ToString(),
|
||||
tuple.My.ToString(),
|
||||
tuple.Nz.ToString(),
|
||||
strainMatrix.Kx.ToString(),
|
||||
strainMatrix.Ky.ToString(),
|
||||
strainMatrix.EpsZ.ToString()
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
File.AppendAllText(filename, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown +": "+ nameof(ndmResult));
|
||||
}
|
||||
|
||||
public ExportToCSVLogic(string filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public class GeometryCalculator : IGeometryCalculator
|
||||
{
|
||||
TextParametersLogic parametersLogic;
|
||||
IGeometryResult geometryResult;
|
||||
public string Name { get; set; }
|
||||
|
||||
public INdmResult Result => geometryResult;
|
||||
|
||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||
}
|
||||
|
||||
public GeometryCalculator(TextParametersLogic parametersLogic)
|
||||
{
|
||||
this.parametersLogic = parametersLogic;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
geometryResult = new GeometryResult() { IsValid = true };
|
||||
geometryResult.TextParameters = parametersLogic.GetTextParameters();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public class GeometryResult : IGeometryResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<ITextParameter> TextParameters { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryCalculator : INdmCalculator
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryResult : INdmResult
|
||||
{
|
||||
List<ITextParameter> TextParameters { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public interface IExportResultLogic
|
||||
{
|
||||
void Export(INdmResult ndmResult);
|
||||
string FileName { get; set; }
|
||||
void Export();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,17 +27,51 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
var parameters = new List<ITextParameter>();
|
||||
parameters.AddRange(GetGravityCenter(prefixInitial, ndms));
|
||||
parameters.AddRange(GetSimpleArea(ndms));
|
||||
parameters.AddRange(GetArea(prefixInitial, ndms));
|
||||
parameters.AddRange(GetSecondMomentOfArea(prefixInitial, ndms));
|
||||
parameters.AddRange(GetMomentOfInertia(prefixInitial, ndms));
|
||||
parameters.AddRange(GetGravityCenter(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetArea(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetSecondMomentOfArea(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetMomentOfInertia(prefixActual, ndms, strainMatrix));
|
||||
parameters.AddRange(GetAreaRatio(ndms, strainMatrix));
|
||||
parameters.AddRange(GetMomentOfInertiaRatio(ndms, strainMatrix));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetSecondMomentOfArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
private IEnumerable<ITextParameter> GetSimpleArea(IEnumerable<INdm> ndms)
|
||||
{
|
||||
const string name = "Moment of inertia";
|
||||
const string name = "Summary Area";
|
||||
const string shortName = "A";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitName = $"{unitArea.Name}";
|
||||
var unitMultiPlayer = unitArea.Multiplyer;
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{name}",
|
||||
ShortName = $"{shortName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{name} of cross-section without reduction"
|
||||
};
|
||||
try
|
||||
{
|
||||
firstParameter.Value = ndms.Sum(x => x.Area) * unitMultiPlayer;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
firstParameter.IsValid = false;
|
||||
firstParameter.Value = double.NaN;
|
||||
firstParameter.Description += $": {ex}";
|
||||
}
|
||||
parameters.Add(firstParameter);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetMomentOfInertia(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Bending stiffness";
|
||||
const string shortName = "EI";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitStress = CommonOperation.GetUnit(UnitTypes.Stress, "MPa");
|
||||
@@ -47,7 +81,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} {name} {firstAxisName.ToUpper()}",
|
||||
ShortName = $"I{firstAxisName}",
|
||||
ShortName = $"{shortName}{firstAxisName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} {name} of cross-section arbitrary {firstAxisName}-axis multiplied by {prefix} modulus"
|
||||
};
|
||||
@@ -55,7 +89,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} {name} {secondAxisName}",
|
||||
ShortName = $"I{secondAxisName}",
|
||||
ShortName = $"{shortName}{secondAxisName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} {name} of cross-section arbitrary {secondAxisName}-axis multiplied by {prefix} modulus"
|
||||
};
|
||||
@@ -78,9 +112,51 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
parameters.Add(secondParameter);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetMomentOfInertiaRatio(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Bending stiffness";
|
||||
const string shortName = "EI";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefixActual}/{prefixInitial} {name} {firstAxisName.ToUpper()} ratio",
|
||||
ShortName = $"{shortName}{firstAxisName}-ratio",
|
||||
MeasurementUnit = "-",
|
||||
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {firstAxisName}-axis ratio"
|
||||
};
|
||||
var secondParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefixActual}/{prefixInitial} {name} {secondAxisName} ratio",
|
||||
ShortName = $"{shortName}{secondAxisName}-ratio",
|
||||
MeasurementUnit = "-",
|
||||
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {secondAxisName}-axis ratio"
|
||||
};
|
||||
try
|
||||
{
|
||||
var initialMoments = GeometryOperations.GetReducedMomentsOfInertia(locNdms);
|
||||
var actualMoments = GeometryOperations.GetReducedMomentsOfInertia(locNdms, locStrainMatrix);
|
||||
firstParameter.Value = actualMoments.MomentX / initialMoments.MomentX;
|
||||
secondParameter.Value = actualMoments.MomentY / initialMoments.MomentY;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
firstParameter.IsValid = false;
|
||||
firstParameter.Value = double.NaN;
|
||||
firstParameter.Description += $": {ex}";
|
||||
secondParameter.IsValid = false;
|
||||
secondParameter.Value = double.NaN;
|
||||
secondParameter.Description += $": {ex}";
|
||||
}
|
||||
parameters.Add(firstParameter);
|
||||
parameters.Add(secondParameter);
|
||||
return parameters;
|
||||
}
|
||||
private IEnumerable<ITextParameter> GetArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
const string name = "Longitudinal stiffness";
|
||||
const string shortName = "EA";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var unitArea = CommonOperation.GetUnit(UnitTypes.Area, "mm2");
|
||||
var unitStress = CommonOperation.GetUnit(UnitTypes.Stress, "MPa");
|
||||
@@ -89,10 +165,10 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefix} Area",
|
||||
ShortName = "EA",
|
||||
Name = $"{prefix} {name}",
|
||||
ShortName = $"{shortName}",
|
||||
MeasurementUnit = unitName,
|
||||
Description = $"{prefix} Area of cross-section multiplied by {prefix} modulus"
|
||||
Description = $"{prefix} {name} of cross-section multiplied by {prefix} modulus"
|
||||
};
|
||||
try
|
||||
{
|
||||
@@ -107,13 +183,39 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
parameters.Add(firstParameter);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetAreaRatio(IEnumerable<INdm> locNdms, IStrainMatrix locStrainMatrix)
|
||||
{
|
||||
const string name = "Longitudinal stiffness";
|
||||
const string shortName = "EA";
|
||||
var parameters = new List<ITextParameter>();
|
||||
var firstParameter = new TextParameter()
|
||||
{
|
||||
IsValid = true,
|
||||
Name = $"{prefixActual}/{prefixInitial} {name} ratio",
|
||||
ShortName = $"{shortName}-ratio",
|
||||
MeasurementUnit = "-",
|
||||
Description = $"{prefixActual}/{prefixInitial} {name}-ratio of cross-section"
|
||||
};
|
||||
try
|
||||
{
|
||||
var actual = GeometryOperations.GetReducedArea(locNdms, locStrainMatrix);
|
||||
var initial = GeometryOperations.GetReducedArea(locNdms);
|
||||
firstParameter.Value = actual / initial;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
firstParameter.IsValid = false;
|
||||
firstParameter.Value = double.NaN;
|
||||
firstParameter.Description += $": {ex}";
|
||||
}
|
||||
parameters.Add(firstParameter);
|
||||
return parameters;
|
||||
}
|
||||
public TextParametersLogic(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
this.ndms = ndms;
|
||||
this.strainMatrix = strainMatrix;
|
||||
}
|
||||
|
||||
private IEnumerable<ITextParameter> GetGravityCenter(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
|
||||
{
|
||||
var parameters = new List<ITextParameter>();
|
||||
|
||||
Reference in New Issue
Block a user