public void CalculateAngle(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport fReport) { double eps = 50, z = (3 - Math.Sqrt(5)) / 2; //5 //максимальная высота double minStampAngle = model.startAngle; double maxStampAngle = model.endAngle; double x3 = minStampAngle + z * (maxStampAngle - minStampAngle), x4 = maxStampAngle - z * (maxStampAngle - minStampAngle); for (int j = 0; maxStampAngle - minStampAngle > eps && model.blankVolume <= model.dieVolume; j++) { //для поиска max функции, для поиска min функции поменять знак на <= if (GetVolumeByAngle(x3, model, file, material, add, fReport) >= GetVolumeByAngle(x4, model, file, material, add, fReport)) { maxStampAngle = x4; x4 = x3; x3 = minStampAngle + maxStampAngle - x4; } else { minStampAngle = x3; x3 = x4; x4 = minStampAngle + maxStampAngle - x3; } //просчёт с изменением силы трения CalculateFriction(model, material, add, file, fReport); } double x = (minStampAngle + maxStampAngle) / 2; GetVolumeByAngle(x, model, file, material, add, fReport); //genReport.DrawAngleChart(); }
public void CalculateHeight(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file) { double eps = 0.1, z = (3 - Math.Sqrt(5)) / 2; //максимальная высота double maxBlankHeight = model.blankHeight; maxBlankHeight = maxBlankHeight + ((maxBlankHeight * 4) / 100); maxBlankHeight = Math.Round(maxBlankHeight, 2); double x3 = model.blankHeight + z * (maxBlankHeight - model.blankHeight), x4 = maxBlankHeight - z * (maxBlankHeight - model.blankHeight); for (int j = 0; maxBlankHeight - model.blankHeight > eps && model.blankVolume <= model.dieVolume; j++) { //для поиска max функции, для поиска min функции поменять знак на <= if (GetVolumeByHeight(x3, model, file, material, add) >= GetVolumeByHeight(x4, model, file, material, add)) { maxBlankHeight = x4; x4 = x3; x3 = model.blankHeight + maxBlankHeight - x4; } else { model.blankHeight = x3; x3 = x4; x4 = model.blankHeight + maxBlankHeight - x3; } } double x = (model.blankHeight + maxBlankHeight) / 2; GetVolumeByHeight(x, model, file, material, add); //genReport.DrawAngleChart(); }
public void Output(Routes rout, GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file) { try { StreamReader reader = new StreamReader(rout.pathIn); string content = reader.ReadToEnd(); reader.Close(); content = Regex.Replace(content, "@StampFolder", Convert.ToString(file.stampFolder)); content = Regex.Replace(content, "@BlankFolder", Convert.ToString(file.blankFolder)); content = Regex.Replace(content, "@PlatformFolder", Convert.ToString(file.platformFolder)); content = Regex.Replace(content, "@blankHeight", Convert.ToString(model.blankHeight)); content = Regex.Replace(content, "@materialDensity", Convert.ToString(material.materialDensity)); content = Regex.Replace(content, "@YoungsModulus", Convert.ToString(material.youngsModulus)); content = Regex.Replace(content, "@PoissonsRatio", Convert.ToString(material.poissonsRatio)); content = Regex.Replace(content, "@Plastic", material.getPlastic()); content = Regex.Replace(content, "@DieRadius", Convert.ToString(model.dieRadius)); content = Regex.Replace(content, "@Displacement", Convert.ToString(model.stampDisplacement)); content = Regex.Replace(content, "@Friction", Convert.ToString(model.friction)); content = Regex.Replace(content, "@Mesh", Convert.ToString(add.mesh)); content = Regex.Replace(content, "@Name", add.jobName); content = Regex.Replace(content, "@Core", Convert.ToString(add.numberOfCores)); content = Regex.Replace(content, "@caeSave", Convert.ToString(file.caeFolder)); content = Regex.Replace(content, "@blankPosition", Convert.ToString(model.blankPosition)); StreamWriter writer = new StreamWriter(rout.pathOut); writer.Write(content); writer.Close(); } catch (Exception e) { MessageBox.Show("Change: ", e.Message); } }
public void RefreshCombobox() { try { Form1._Form1.MaterialsList.Items.Clear(); Form1._Form1.ExtraMaterialsList.Items.Clear(); var fileName = new FileName(); var m = new MaterialsOptions(); string path = @"Materials\MaterialName.txt"; var lines = File.ReadAllLines(path).Where(arg => !string.IsNullOrWhiteSpace(arg)); File.WriteAllLines(path, lines); m.MaterialName = File.ReadLines(path).ToList(); foreach (var items in m.MaterialName) { Form1._Form1.MaterialsList.Items.Add(items); Form1._Form1.ExtraMaterialsList.Items.Add(items); } } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }
public double CalculateFriction(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport fReport) { double eps = 0.01, z = (3 - Math.Sqrt(5)) / 2; //0.1 //максимальная высота double minFriction = model.startFriction; double maxFriction = model.endFriction; double x5 = minFriction + z * (maxFriction - minFriction), x6 = maxFriction - z * (maxFriction - minFriction); for (int j = 0; maxFriction - minFriction > eps && model.blankVolume <= model.dieVolume; j++) { //для поиска max функции, для поиска min функции поменять знак на <= if (GetVolumeByFriction(x5, model, file, material, add, fReport) >= GetVolumeByFriction(x6, model, file, material, add, fReport)) { maxFriction = x6; x6 = x5; x5 = minFriction + maxFriction - x6; } else { minFriction = x5; x5 = x6; x6 = minFriction + maxFriction - x5; } } double x = (minFriction + maxFriction) / 2; GetVolumeByFriction(x, model, file, material, add, fReport); //genReport.DrawFrictionChart(model); return(model.pctOfDieFilling); }
public MaterialsManager(DataBaseConnection db, Sanitizer sanitizer, ITagsManager tagsManager, IOptions <MaterialsOptions> materialsOptions) : base(db) { this.tagsManager = tagsManager; this.sanitizer = sanitizer; this.materialsOptions = materialsOptions.Value; }
public CategoriesAdminManager( DataBaseConnection db, IOptions <MaterialsOptions> materialOptions, ICategoriesCache categoriesCache, SanitizerService sanitizerService) : base(db) { this.sanitizerService = sanitizerService; this.categoriesCache = categoriesCache; this.materialOptions = materialOptions.Value; }
public MaterialsManager( DataBaseConnection db, SanitizerService sanitizerService, ICategoriesCache categoriesCache, ITagsManager tagsManager, IOptions <MaterialsOptions> materialsOptions) : base(db) { this.tagsManager = tagsManager; this.sanitizerService = sanitizerService; this.materialsOptions = materialsOptions.Value; this.categoriesCache = categoriesCache; }
public MaterialsAuthorization( IAuthorizationService authorizationService, IOptions <MaterialsOptions> materialsOptions, OperationKeysContainer operationKeysContainer, DataBaseConnection db) { this.authorizationService = authorizationService; this.materialsOptions = materialsOptions.Value; this.db = db; OperationKeys = operationKeysContainer; }
public void Optimization(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport fReport) { double firstRadius = model.startBlankRadius; double lastRadius = firstRadius * 1.5; double eps = 0.01, z = (3 - Math.Sqrt(5)) / 2; //0.25 double x1 = firstRadius + z * (lastRadius - firstRadius), x2 = lastRadius - z * (lastRadius - firstRadius); // изменение угла в матрице #region hide //if (i == 5) //{ // model.setRadius = 3 + (0.09 * 18); //} //if (i == 10) //{ // model.setRadius = 3 + (0.18 * 18); //} //if (i == 15) //{ // model.setRadius = 3 + (0.27 * 18); //} #endregion for (model.incrBlankRadius = 0; lastRadius - firstRadius > eps; model.incrBlankRadius += 0.01) { //для поиска max функции, для поиска min функции поменять знак на <= if (GetVolumeByRadius(x1, model, file, material, add, fReport) >= GetVolumeByRadius(x2, model, file, material, add, fReport)) { lastRadius = x2; x2 = x1; x1 = firstRadius + lastRadius - x2; } else { firstRadius = x1; x1 = x2; x2 = firstRadius + lastRadius - x1; } CalculateAngle(model, material, add, file, fReport); } double result = (firstRadius + lastRadius) / 2; GetVolumeByRadius(result, model, file, material, add, fReport); CalculateAngle(model, material, add, file, fReport); Form1._Form1.LogArea("Конец расчётов."); }
public SimplexPlanning(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport finalReport, Routes rout, ArgumentsCMD cmd, FilesForVolume filesForVolume) { this.model = model; this.material = material; this.add = add; this.file = file; this.finalReport = finalReport; this.rout = rout; this.cmd = cmd; this.filesForVolume = filesForVolume; }
public MainFunction(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport finalReport, GeneralReport genReport, Routes rout, ArgumentsCMD cmd, FilesForVolume filesForVolume) { this.model = model; this.material = material; this.add = add; this.file = file; this.finalReport = finalReport; this.genReport = genReport; this.rout = rout; this.cmd = cmd; this.filesForVolume = filesForVolume; }
private void MaterialsList_SelectedIndexChanged(object sender, EventArgs e) { try { var materials = new MaterialsOptions(); string filename = MaterialsList.Text; string path = @"Materials\" + filename + ".csv"; materials.MaterialData = File.ReadLines(path) .Select(line => line.Split(';')) .ToDictionary(data => Convert.ToString(data[0]), data => Convert.ToString(data[1])); var _priceDataArray = from row in materials.MaterialData select new { Yield_Stress = row.Key, Plastic_Strain = row.Value }; PlasticData.DataSource = _priceDataArray.ToArray(); } catch (Exception exp) { MessageBox.Show(Convert.ToString(exp.Message)); } }
public double GetVolumeByAngle(double x, GeometryOptions model, FileName file, MaterialsOptions material, AdditionallyOptions add, CommonReport finalReport) { //добавляем здесь, так как прошло изменение радиуса //после изменения радиуса, добавляем последние значения в постройку графика //округляем высоту заготовки, иначе после работы алгоритма добавит как новую высоту, //из-за точности знаков после запятой и моего костыля :) model.stampAngle = Math.Round(model.startAngle); AngleChart(model); model.friction = model.startFriction; model.friction = Math.Round(model.startFriction, 2); x = Math.Round(x); #region "+" будут обозначены строки, котоыре необходимы в методе вычесления угла матрицы, заключенніе в регион model.dieRadius = (Math.Tan(x * Math.PI / 180) * 57) + 10; model.dieRadius = Math.Round(model.dieRadius, 1); //объём усеченного конуса (верхний радиус 10, нижний может меняться) model.dieVolume = (Math.PI * 57 * (Math.Pow(model.dieRadius, 2) + model.dieRadius * 10 + Math.Pow(10, 2))) / 3; model.dieVolume = Math.Round(model.dieVolume, 2); #endregion #region "+" model.blankUpperRadius = model.blankRadius - (Math.Tan(model.stampAngle * Math.PI / 180) * 2); model.blankPosition = (Math.PI * 2 * (Math.Pow(model.blankRadius, 2) + model.blankRadius * (model.blankUpperRadius) + Math.Pow((model.blankUpperRadius), 2))) / 3; model.blankPosition = Math.Round(model.blankPosition, 2); //объем цилиндра, не считая фаску (как будто её нет,а заготовка имеет форму просто цилиндра) double abstractRadiusVolume = Math.PI * Math.Pow(model.blankRadius, 2) * 2; double blankVolume = model.dieVolume + (abstractRadiusVolume - model.blankPosition); double tempVolume = blankVolume * 10; tempVolume /= 100; blankVolume += tempVolume; model.blankHeight = blankVolume / (Math.PI * Math.Pow(model.blankRadius, 2)); model.blankHeight = Math.Round(model.blankHeight, 2); model.blankPosition = model.blankHeight * ((model.dieRadius - model.blankRadius) / (model.dieRadius - 10)); model.blankPosition = Math.Round(model.blankPosition, 1); model.blankPosition += 2; //задаем перемещение матрицы model.stampDisplacement = model.blankPosition; model.stampDisplacement -= 3; #endregion model.stampAngle = x; string abaqusOutputFolder = "b" + Convert.ToString(model.blankRadius) + "r" + Convert.ToString(model.stampAngle) + "a"; file.outputFolder = Path.Combine(genReport.folderName, abaqusOutputFolder); if (!Directory.Exists(file.outputFolder)) { Directory.CreateDirectory(file.outputFolder); } file.caeFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, add.jobName + ".cae"); file.caeFolder = file.caeFolder.Replace(@"\", "/"); file.stampFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Stamp.IGS"); file.stampFolder = file.stampFolder.Replace(@"\", "/"); file.blankFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Blank.IGS"); file.blankFolder = file.blankFolder.Replace(@"\", "/"); file.platformFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Platform.IGS"); file.platformFolder = file.platformFolder.Replace(@"\", "/"); solid.UseSolid(file, model); rout.workingDirectory = file.outputFolder; rout.pathOut = rout.workingDirectory + @"\abaqusMacros.py"; change.Output(rout, model, material, add, file); //Form1._Form1.runAbaqus(file); //Form1._Form1.GetHistoryregionName(file); //Form1._Form1.Processing(model, file); genReport.folderName = Convert.ToString(model.blankRadius); //report.ReportReactionForce(model, genReport, file); //rpr.ReportVolume(model, genReport, file); AngleChart(model); //просчёт с изменением силы трения //CalculateFriction(model, material, add, file, finalReport); finalReport.AddData(model); //FReport.setMaxVolume.Add( // new VariablesForReport(model.blankRadius, model.blankRadius, // model.friction, model.pctOfDieFilling, model.setRectionForceToBlank) // ); return(model.pctOfDieFilling); }
public double GetVolumeByHeight(double x, GeometryOptions model, FileName file, MaterialsOptions material, AdditionallyOptions add) { //добавляем здесь, так как прошло изменение радиуса //после изменения радиуса, добавляем последние значения в постройку графика //округляем высоту заготовки, иначе после работы алгоритма добавит как новую высоту, //из-за точности знаков после запятой и моего костыля :) model.blankHeight = Math.Round(model.blankHeight, 2); AngleChart(model); model.blankHeight = Math.Round(x, 2); string abaqusOutputFolder = "b" + Convert.ToString(model.blankRadius) + "r" + Convert.ToString(model.blankHeight) + "h"; file.outputFolder = Path.Combine(genReport.folderName, abaqusOutputFolder); if (!Directory.Exists(file.outputFolder)) { Directory.CreateDirectory(file.outputFolder); } file.stampFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Stamp.IGS"); file.stampFolder = file.stampFolder.Replace(@"\", "/"); file.blankFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Blank.IGS"); file.blankFolder = file.blankFolder.Replace(@"\", "/"); file.platformFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Platform.IGS"); file.platformFolder = file.platformFolder.Replace(@"\", "/"); solid.UseSolid(file, model); rout.workingDirectory = file.outputFolder; rout.pathOut = rout.workingDirectory + @"\abaqusMacros.py"; change.Output(rout, model, material, add, file); //Form1._Form1.runAbaqus(file); //Form1._Form1.GetHistoryregionName(file); //Processing(model, file); genReport.folderName = Convert.ToString(model.blankRadius); //report.ReportReactionForce(model, genReport, file); //rpr.ReportVolume(model, genReport, file); //теперь добавляем, после изменения радиуса //genReport.volTempX.Add(model.blankHeight); //genReport.volTempY.Add(model.pctOfDieFilling); //genReport.RFTempX.Add(model.blankHeight); //genReport.RFTempY.Add(model.setRectionForceToBlank); AngleChart(model); return(model.pctOfDieFilling); }
public double GetVolumeByRadius(double x, GeometryOptions model, FileName file, MaterialsOptions material, AdditionallyOptions add, CommonReport finalReport) { model.stampAngle = model.startAngle; model.stampAngle = Math.Round(model.stampAngle); model.friction = model.startFriction; model.friction = Math.Round(model.startFriction, 2); #region "+" будут обозначены строки, котоыре необходимы в методе вычесления угла матрицы, заключенніе в регион //10 - верхний радиус model.dieRadius = (Math.Tan(model.stampAngle * Math.PI / 180) * 57) + 10; model.dieRadius = Math.Round(model.dieRadius, 1); //объем цилиндрического выреза в матрице // double tempVolume = Math.PI * Math.Pow(model.dieRadius, 2) * 4; //объём усеченного конуса (верхний радиус 10, нижний может меняться) model.dieVolume = (Math.PI * 57 * (Math.Pow(model.dieRadius, 2) + model.dieRadius * 10 + Math.Pow(10, 2))) / 3; // model.dieVolume = model.dieVolume + tempVolume; model.dieVolume = Math.Round(model.dieVolume, 2); #endregion //ЗАМЕНИТЬ НА Х ОБРАТНО model.blankRadius = x; model.blankRadius = Math.Round(model.blankRadius, 2); #region "+" model.blankUpperRadius = model.blankRadius - (Math.Tan(model.stampAngle * Math.PI / 180) * 2); model.blankPosition = (Math.PI * 2 * (Math.Pow(model.blankRadius, 2) + model.blankRadius * (model.blankUpperRadius) + Math.Pow((model.blankUpperRadius), 2))) / 3; model.blankPosition = Math.Round(model.blankPosition, 2); //объем цилиндра, не считая фаску (как будто её нет,а заготовка имеет форму просто цилиндра) double abstractRadiusVolume = Math.PI * Math.Pow(model.blankRadius, 2) * 2; double blankVolume = model.dieVolume + (abstractRadiusVolume - model.blankPosition); //объём зазора между матрицей и площадкой //double tempVolume = Math.Pow((model.dieRadius + 10), 2) * 3; double tempVolume = blankVolume * 10; tempVolume /= 100; blankVolume += tempVolume; model.blankHeight = blankVolume / (Math.PI * Math.Pow(model.blankRadius, 2)); model.blankHeight = Math.Round(model.blankHeight, 2); model.blankPosition = model.blankHeight * ((model.dieRadius - model.blankRadius) / (model.dieRadius - 10)); model.blankPosition = Math.Round(model.blankPosition, 1); model.blankPosition += 2; //задаем перемещение матрицы model.stampDisplacement = model.blankPosition; model.stampDisplacement -= 3; #endregion #region Создание общей папки с название радиуса заготовки genReport.folderName = Convert.ToString(model.blankRadius); if (!Directory.Exists(genReport.folderName)) { Directory.CreateDirectory(genReport.folderName); } #endregion string abaqusOutputFolder = "b" + Convert.ToString(model.blankRadius) + "r" + Convert.ToString(model.stampAngle) + "a"; file.outputFolder = Path.Combine(genReport.folderName, abaqusOutputFolder); if (!Directory.Exists(file.outputFolder)) { Directory.CreateDirectory(file.outputFolder); } file.caeFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, add.jobName + ".cae"); file.caeFolder = file.caeFolder.Replace(@"\", "/"); file.stampFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Stamp.IGS"); file.stampFolder = file.stampFolder.Replace(@"\", "/"); file.blankFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Blank.IGS"); file.blankFolder = file.blankFolder.Replace(@"\", "/"); file.platformFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Platform.IGS"); file.platformFolder = file.platformFolder.Replace(@"\", "/"); solid.UseSolid(file, model); rout.pathIn = "abaqusMacros.py"; // old rout.setWorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); rout.workingDirectory = file.outputFolder; rout.pathOut = rout.workingDirectory + @"\abaqusMacros.py"; change.Output(rout, model, material, add, file); //Form1._Form1.runAbaqus(file); //Form1._Form1.GetHistoryregionName(file); //Form1._Form1.Processing(model, file); //report.ReportReactionForce(model, genReport, file); //rpr.ReportVolume(model, genReport, file); finalReport.AddData(model); //FReport.setMaxVolume.Add( // new VariablesForReport(model.blankRadius, model.blankRadius, // model.friction, model.blankVolume, model.setRectionForceToBlank) // ); return(model.pctOfDieFilling); }
public void Optimization(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport fReport) { double firstRadius = model.startBlankRadius; double lastRadius = 10.5; //double firstRadius = 10.87; //double lastRadius = firstRadius; double frictionStep = 0.1; for (model.stampAngle = model.startAngle; model.stampAngle <= model.endAngle; model.stampAngle += model.stepAngle) { for (model.incrBlankRadius = firstRadius; model.incrBlankRadius <= lastRadius; model.incrBlankRadius += 0.05) { // округляем из-за проблемы сложения чисел 0.1 + 0.2 for (model.friction = model.startFriction; model.friction <= model.endFriction; model.friction = Math.Round(model.friction + frictionStep, 1)) { // считаем радиус усечённого конуса model.dieRadius = (Math.Tan(model.stampAngle * Math.PI / 180) * 60) + 10; //объём цилиндра (верхний радиус 10, нижний может меняться) model.dieVolume = (Math.PI * 60 * (Math.Pow(model.dieRadius, 2) + model.dieRadius * 10 + Math.Pow(10, 2)) / 3); #region необходимо для вычесления облоя double upperRadius; double angle30X; double filletLength; //3 - радиус скругления, 90 - градус filletLength = Math.Tan((180 - (((90 + model.stampAngle) / 2) + 90)) * Math.PI / 180) * 3; upperRadius = model.dieRadius + filletLength + 10; angle30X = upperRadius - 5; #endregion double lowerVolume = Math.Pow((angle30X - 5), 2) * Math.PI * 1; model.dieVolume += lowerVolume; double shave = Math.Pow(angle30X, 2) * Math.PI * 1; shave -= lowerVolume; model.dieVolume = Math.Round(model.dieVolume, 1); model.blankRadius = model.incrBlankRadius; model.blankUpperRadius = model.blankRadius - (Math.Tan(model.stampAngle * Math.PI / 180) * 2); model.blankChamferVolume = (Math.PI * 2 * (Math.Pow(model.blankRadius, 2) + model.blankRadius * (model.blankUpperRadius) + Math.Pow((model.blankUpperRadius), 2))) / 3; model.blankChamferVolume = Math.Round(model.blankChamferVolume, 2); //объем цилиндра, не считая фаску (как будто её нет,а заготовка имеет форму просто цилиндра) double abstractRadiusVolume = Math.PI * Math.Pow(model.blankRadius, 2) * 2; double blankVolume = model.dieVolume + (abstractRadiusVolume - model.blankChamferVolume); blankVolume += shave; model.blankHeight = blankVolume / (Math.PI * Math.Pow(model.blankRadius, 2)); model.blankHeight = Math.Round(model.blankHeight, 2); double radiusAfterLowerFillet = angle30X - 5; double radiusHeightInStamp; //необходимо для вычесления объёма от пуансона до конца матрицы model.lowerFilletRadius = radiusAfterLowerFillet; radiusHeightInStamp = 60 * ((radiusAfterLowerFillet - model.blankRadius) / (radiusAfterLowerFillet - 10)); if (model.blankRadius > 12.5) { //model.blankPosition = model.blankHeight * ((model.dieRadius - model.blankRadius) / (model.dieRadius - 10)); model.blankPosition = model.blankHeight * ((radiusAfterLowerFillet - model.blankRadius) / (radiusAfterLowerFillet - 10)); model.blankPosition = Math.Round(model.blankPosition, 1); model.blankPosition = Math.Abs(model.blankPosition - model.blankHeight); //model.blankPosition += 2; } else if (model.blankRadius > 10) { //model.blankPosition = 60 * ((model.dieRadius - model.blankRadius) / (model.dieRadius - 10)); model.blankPosition = model.blankHeight - radiusHeightInStamp; model.blankPosition = Math.Round(model.blankPosition, 1); model.blankPosition += 5; } else { //предположим, что это высота заготовки, которая равняется разницей в высоте //между ей и высотой матрицы, должно помочь, когда заготовка высокая double tempHeight = model.blankHeight - 60; model.blankPosition = tempHeight * ((model.dieRadius - 10) / (model.dieRadius - 10)); model.blankPosition = Math.Round(model.blankPosition, 1); //допуск +2мм на всякий пожарный случай model.blankPosition += 2; } //задаем перемещение матрицы model.stampDisplacement = model.blankPosition; //оставляем зазор 3мм model.stampDisplacement -= 1; #region Создание общей папки с название радиуса заготовки genReport.folderName = Convert.ToString(model.blankRadius); if (!Directory.Exists(genReport.folderName)) { Directory.CreateDirectory(genReport.folderName); } #endregion string abaqusOutputFolder = Convert.ToString(model.blankRadius) + "r" + Convert.ToString(model.stampAngle) + "a" + Convert.ToString(model.friction) + "f"; file.outputFolder = Path.Combine(genReport.folderName, abaqusOutputFolder); if (!Directory.Exists(file.outputFolder)) { Directory.CreateDirectory(file.outputFolder); } file.caeFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, add.jobName + ".cae"); file.caeFolder = file.caeFolder.Replace(@"\", "/"); file.stampFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Stamp.IGS"); file.stampFolder = file.stampFolder.Replace(@"\", "/"); file.blankFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Blank.IGS"); file.blankFolder = file.blankFolder.Replace(@"\", "/"); file.platformFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Platform.IGS"); file.platformFolder = file.platformFolder.Replace(@"\", "/"); solid.UseSolid(file, model); rout.pathIn = "abaqusMacros.py"; // old rout.setWorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); rout.workingDirectory = file.outputFolder; rout.pathOut = rout.workingDirectory + @"\abaqusMacros.py"; change.Output(rout, model, material, add, file); //Form1._Form1.runAbaqus(file); //Form1._Form1.GetHistoryregionName(file); //Form1._Form1.Processing(model, file); //report.ReportReactionForce(model, genReport, file); //rpr.ReportVolume(model, genReport, file); RadiusChart(model); FrictionChart(model); } //genReport.DrawFrictionChart(model); } //genReport.DrawRadiusChart(model); } }
public ActivitiesPresenter( IOptions <MaterialsOptions> materialsOptions, DataBaseConnection db) : base(db) { this.materialsOptions = materialsOptions.Value; }
public double GetVolumeByFriction(double x, GeometryOptions model, FileName file, MaterialsOptions material, AdditionallyOptions add, CommonReport finalReport) { model.friction = Math.Round(model.startFriction, 2); FrictionChart(model); x = Math.Round(x, 2); model.friction = x; string abaqusOutputFolder = "b" + Convert.ToString(model.stampAngle) + "a" + Convert.ToString(model.friction) + "f"; file.outputFolder = Path.Combine(genReport.folderName, abaqusOutputFolder); if (!Directory.Exists(file.outputFolder)) { Directory.CreateDirectory(file.outputFolder); } file.caeFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, add.jobName + ".cae"); file.caeFolder = file.caeFolder.Replace(@"\", "/"); file.stampFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Stamp.IGS"); file.stampFolder = file.stampFolder.Replace(@"\", "/"); file.blankFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Blank.IGS"); file.blankFolder = file.blankFolder.Replace(@"\", "/"); file.platformFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, "Platform.IGS"); file.platformFolder = file.platformFolder.Replace(@"\", "/"); solid.UseSolid(file, model); rout.workingDirectory = file.outputFolder; rout.pathOut = rout.workingDirectory + @"\abaqusMacros.py"; change.Output(rout, model, material, add, file); //Form1._Form1.runAbaqus(file); //Form1._Form1.GetHistoryregionName(file); //Processing(model, file); genReport.folderName = Convert.ToString(model.blankRadius); //report.ReportReactionForce(model, genReport, file); //rpr.ReportVolume(model, genReport, file); FrictionChart(model); finalReport.AddData(model); //FReport.setMaxVolume.Add( // new VariablesForReport(model.blankRadius, model.blankRadius, // model.friction, model.blankVolume, model.setRectionForceToBlank) // ); return(model.pctOfDieFilling); }