Add project files.

This commit is contained in:
2025-07-09 16:15:14 +04:00
parent e0e07ca012
commit dc68787b0b
8 changed files with 303 additions and 0 deletions

40
Pages/Index.cshtml Normal file
View File

@@ -0,0 +1,40 @@
@page
@model IndexModel
<h2>Модель расчета поковок кольцо раскатное</h2>
<form method="post">
<p>
<label>D:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any" name="D" value="1360"/>
</p>
<p>
<label>d:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any" name="dd" value="540"/>
</p>
<p>
<label>H:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any" name="H" value="215,00"/>
</p>
<p>
<label>x:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any"
onchange="document.getElementById('z').value = this.value - 1" name="x" value="2"/>
</p>
<p>
<label>y:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any" name="y" value="20"/>
</p>
<p>
<label>z:</label><br />
<input type="text" id="z" oninput="validateDecimal(this)" step="any" name="z" readonly value="1"/>
</p>
<p>
<label>Q:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any" name="Q" value="60"/>
</p>
<p>
<label>Напуск на ТО:</label><br />
<input type="text" oninput="validateDecimal(this)" step="any" name="onTO" value="0"/>
</p>
<input type="submit" value="Отправить" />
</form>

160
Pages/Index.cshtml.cs Normal file
View File

@@ -0,0 +1,160 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
public class IndexModel : PageModel
{
public double D { get; private set; }
public double dd { get; private set; }
public double H { get; private set; }
public double x { get; private set; }
public double y { get; private set; }
public double z { get; private set; }
public double Q { get; private set; }
public double onTO { get; private set; }
public double h1 { get; private set; }
public double h2 { get; private set; }
public void OnPost(double D, double dd, double H, double x, double y, double z, double Q, double onTO)
{
h1 = H * x + (y * z) + onTO;
h2 = H * x + (y * z) + Q + onTO;
#region Расчет размеров поковки
// H заготовки = (Н1+б)+-∆/2
// Размер
double H_Billet = h1 + SearchLimit(D, h1).Item1;
// Допуск на размер +-
int limit1 = SearchLimit(D, h1).Item2;
// H заготовки с пробой = (Н2+б)+-∆/2
double H_BilletWithBlank = h2 + SearchLimit(D, h2).Item1;
// Допуск на размер +-
int limit2 = SearchLimit(D, h2).Item2;
// D дет = D+напуск на ТО
double D_Detail = D + onTO;
// D заг = (D+б)+-∆/2+напуск на ТО
double D_Billet = D_Detail + SearchLimit(D, h1).Item1 + onTO;
int limit3 = SearchLimit(D, h1).Item2;
// D заг с пробой= (D+б)+-∆/2+напуск на ТО
double D_BilletWithBlank = D_Detail + SearchLimit(D, h2).Item1 + onTO;
int limit4 = SearchLimit(D, h2).Item2;
// d дет=d-напуск на ТО
double d_Detail = dd + onTO;
// d заг =(dдет-б)+-3б
double d_Billet = d_Detail - SearchLimit(D, h1).Item1;
int limit5 = SearchLimit(D, h1).Item2 * 3;
//d заг с пробой =(dдет-б)+-3б
double d_BilletWithBlank = d_Detail - SearchLimit(D, h2).Item1;
int limit6 = SearchLimit(D, h2).Item2 * 3;
#endregion
#region Расчет массы поковки без пробы
// Диск номинал
double D_calc =
#endregion
#region Расчет массы поковки c пробой
#endregion
}
private (int, int) SearchLimit(double D, double H)
{
// Диапазоны высоты H
double[] heightRanges = new double[]
{
100, 150, 200, 250, 315, 400, 500, 630, 800, 1000, 1250, 1400, 1600, 1800, 2000, 2250, 2500
};
// Диапазоны диаметра D
double[] diameterRanges = new double[]
{
499, 500, 630, 800, 1000, 1250, 1400, 1600, 1800, 2000, 2250, 2500, 2800, 3150, 3500, 4000, 4500, 5000
};
(int, int)[,] limits = new (int, int)[,]
{
// Св. 100 до 150 включ.
{ (24,9), (25,9), (27,10), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) },
// Св. 150 до 200
{ (24,9), (25,9), (27,10), (29,11), (31,11), (35,13), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) },
// Св. 200 до 250
{ (25,9), (26,9), (28,10), (30,11), (32,12), (36,13), (38,14), (40,15), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) },
// Св. 250 до 315
{ (27,10), (28,10), (30,11), (32,12), (34,13), (38,14), (41,15), (44,16), (47,18), (51,19), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) },
// Св. 315 до 400
{ (28,10), (29,11), (31,11), (33,12), (35,13), (40,15), (42,16), (46,17), (49,19), (53,20), (57,21), (61,23), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) },
// Св. 400 до 500
{ (29,11), (30,11), (31,11), (34,13), (36,13), (41,15), (44,16), (48,18), (51,19), (55,21), (59,22), (63,24), (67,25), (71,27), (-1,-1), (-1,-1), (-1,-1) },
// Св. 500 до 630
{ (30,11), (31,11), (33,12), (35,13), (37,14), (43,16), (46,17), (50,19), (53,20), (57,21), (61,23), (65,25), (69,26), (75,28), (80,30), (95,37), (-1,-1) },
// Св. 630 до 800
{ (-1,-1), (33,12), (36,13), (38,14), (41,15), (46,17), (50,19), (54,20), (57,21), (61,23), (65,25), (71,27), (77,29), (83,31), (89,34), (98,39), (105,43) },
// Св. 800 до 1000
{ (-1,-1), (-1,-1), (37,14), (40,15), (43,16), (48,18), (52,20), (56,21), (59,22), (63,24), (68,26), (74,28), (80,30), (86,33), (92,36), (101,41), (108,46) },
// Св. 1000 до 1250
{ (-1,-1), (-1,-1), (-1,-1), (44,16), (46,17), (52,20), (56,21), (60,23), (64,24), (68,26), (74,28), (81,30), (86,33), (92,36), (98,39), (105,43), (112,48) },
// Св. 1250 до 1400
{ (-1,-1), (-1,-1), (-1,-1), (-1,-1), (47,18), (54,20), (58,22), (62,23), (67,25), (72,27), (78,29), (83,31), (89,34), (95,37), (101,41), (108,45), (115,50) },
// Св. 1400 до 1600
{ (-1,-1), (-1,-1), (-1,-1), (-1,-1), (48,18), (56,21), (60,23), (65,24), (69,26), (75,28), (81,30), (87,34), (93,36), (99,39), (104,42), (110,47), (119,51) },
// Св. 1600 до 1800
{ (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (58,22), (63,23), (67,25), (73,27), (79,29), (85,33), (91,35), (97,38), (102,41), (106,43), (113,48), (120,52) },
// Св. 1800 до 2000
{ (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (64,23), (68,25), (75,28), (81,30), (87,34), (92,36), (98,38), (103,41), (107,43), (115,50), (121,52) },
// Св. 2000 до 2250
{ (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (69,26), (76,28), (82,30), (88,34), (94,37), (100,40), (104,42), (110,47), (116,50), (122,52) },
// Св. 2250 до 2500
{ (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (82,30), (85,32), (91,35), (97,38), (100,41), (108,43), (114,49), (119,51), (125,53) }
};
int FindIndex(double val, double[] ranges)
{
for (int i = 0; i < ranges.Length; i++)
{
if (val <= ranges[i])
return i - 1;
}
return -1;
}
int hIndex = FindIndex(H, heightRanges);
int dIndex = FindIndex(D, diameterRanges);
if (D < 499)
dIndex = 0;
if (hIndex == -1 || dIndex == -1)
return (-1, -1);
return limits[hIndex, dIndex];
}
}