civil-tools-v 0.0.4__py3-none-any.whl → 0.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,11 +6,107 @@ from CivilTools.YDBLoader.BuildingDefine.StairPart import (
6
6
  LoadParams,
7
7
  StairLoad,
8
8
  LoadCalulateType,
9
+ Component,
9
10
  )
10
- from .UtilFunctions import MatrixSolver
11
+ from .UtilFunctions import MatrixSolver, ConcreteSolver
11
12
  from .DocTable import DocTable
12
13
  from .DocPicture import DocPicture
13
14
  from .DocParagraph import DocParagraph
15
+ from typing import List
16
+ from CivilTools.Const import Concrete, Steel
17
+ from CivilTools.FigureGenerator import StairCalculationSheetPNGPlotter
18
+
19
+
20
+ def analysis_moment_and_rebar(
21
+ moments: List[float], thickness, rebar_d, cover_thickness, concrete, rebar
22
+ ):
23
+ if len(moments) != 3:
24
+ raise ValueError("Length of Stair Moment Reult should be 3.")
25
+ total_result = []
26
+ for moment in moments:
27
+ result = ConcreteSolver.CalculateRebar(
28
+ moment, thickness, rebar_d, cover_thickness, concrete, rebar
29
+ )
30
+ total_result.append(result[0])
31
+ total_result.append(result[1])
32
+ return total_result
33
+
34
+
35
+ def analysis_w(
36
+ moments: List[float],
37
+ current_stair: StairPart,
38
+ cover_thickness: float,
39
+ concrete,
40
+ rebar,
41
+ ):
42
+ w_list = []
43
+ for moment in moments:
44
+ if moment < 0:
45
+ As = current_stair.up_real_rebar_area
46
+ rebar_d = current_stair.up_d
47
+ else:
48
+ As = current_stair.down_real_rebar_area
49
+ rebar_d = current_stair.down_d
50
+ w = ConcreteSolver.CalculateW(
51
+ moment,
52
+ As,
53
+ current_stair.main_thick,
54
+ cover_thickness,
55
+ concrete,
56
+ rebar,
57
+ rebar_d,
58
+ )
59
+ if moment < 0:
60
+ w_list.append(w)
61
+ w_list.append(0)
62
+ else:
63
+ w_list.append(0)
64
+ w_list.append(w)
65
+ return w_list
66
+
67
+
68
+ def analysis_real_rebar(
69
+ stair_part: StairPart, part: str, cal_rabar_area_list: List[float]
70
+ ):
71
+ if part == "left":
72
+ thick = stair_part.left_thick
73
+ elif part == "right":
74
+ thick = stair_part.right_thick
75
+ else:
76
+ thick = stair_part.main_thick
77
+ up_rebar = stair_part.up_real_rebar
78
+ up_rebar_area = stair_part.up_real_rebar_area
79
+ up_ratio = up_rebar_area / 1000 / thick
80
+ down_rebar = stair_part.down_real_rebar
81
+ down_rebar_area = stair_part.down_real_rebar_area
82
+ down_ratio = down_rebar_area / 1000 / thick
83
+
84
+ up_result = f"{up_rebar}({up_rebar_area:.1f},{up_ratio*100:.2f}%)"
85
+ down_result = f"{down_rebar}({down_rebar_area:.1f},{down_ratio*100:.2f}%)"
86
+ result = []
87
+ for i in range(len(cal_rabar_area_list)):
88
+ if i % 2 == 0:
89
+ if cal_rabar_area_list[i] <= up_rebar_area:
90
+ result.append(up_result)
91
+ else:
92
+ result.append("*{" + up_result + "}")
93
+ else:
94
+ if cal_rabar_area_list[i] <= down_rebar_area:
95
+ result.append(down_result)
96
+ else:
97
+ result.append("*{" + down_result + "}")
98
+ return result
99
+
100
+
101
+ def get_qe_moment(stair: StairPart, components: List[Component]):
102
+ if stair.stair_type == "AT":
103
+ return components[0].m_2
104
+ elif stair.stair_type == "BT":
105
+ return components[1].m_2
106
+ elif stair.stair_type == "CT":
107
+ return components[0].m_2
108
+ else:
109
+ return components[1].m_2
14
110
 
15
111
 
16
112
  class StairCalculationReport(BasicGenerator):
@@ -36,38 +132,35 @@ class StairCalculationReport(BasicGenerator):
36
132
  self.symbol_explain = "钢筋:d-HPB300;D-HRB335;E-HRB400;F-RRB400;G-HRB500;Q-HRBF400;R-HRB550"
37
133
  self.cut_line = "---------------------------------------------------------------------------------------------"
38
134
  self.concrete_data = {
39
- 30: [14.3, 1.43, 2.01, 30000], # // fc, ft, ftk, E
40
- 35: [16.7, 1.57, 2.20, 31500], # // fc, ft, ftk, E
41
- 40: [19.1, 1.71, 2.39, 32500], # // fc, ft, ftk, E
135
+ 30: Concrete.C30, # // fc, ft, ftk, E
136
+ 35: Concrete.C35, # // fc, ft, ftk, E
137
+ 40: Concrete.C40, # // fc, ft, ftk, E
42
138
  }
43
139
  self.concrete_density = 25
44
- self.rebar_level = "HRB400"
45
- self.rebar_fy = 360
140
+ self.rebar_level = Steel.HRB400
46
141
  self.indent = 0.22
47
142
  self.normal_font_size = 11
143
+ self.__clear_result()
144
+
145
+ def __clear_result(self):
146
+ self.left_calculate_rebar = None
147
+ self.middle_calculate_rebar = None
148
+ self.right_calculate_rabar = None
149
+ self.left_real_rebar = None
150
+ self.middle_real_rebar = None
151
+ self.right_real_rabar = None
152
+ self.disp_plastic = 0
153
+ self.crack_width = None
48
154
 
49
155
  # 数据入口!!!!
50
- def set_stair_data(self):
156
+ def set_stair_data(self, stair_list: List[StairPart]):
51
157
  """这个函数需要重写!!!!!是数据流入的最主要的入口"""
52
- position1 = Position(0, 2180, 0, 1910, 5030, 6850)
53
- sp1 = StairPart(position1, 13)
54
- sp1.left_thick = sp1.main_thick = sp1.right_thick = 130
55
- position2 = Position(0, 2180, 0, 1910, 5030, 6850)
56
- sp2 = StairPart(position2, 13)
57
- sp2.set_beam_offset(1, 500)
58
- position3 = Position(0, 2180, 0, 1910, 5030, 6850)
59
- sp3 = StairPart(position3, 13)
60
- sp3.set_beam_offset(2, 500)
61
- position4 = Position(0, 2180, 0, 1910, 5030, 6850)
62
- sp4 = StairPart(position4, 13)
63
- sp4.set_beam_offset(1, 500)
64
- sp4.set_beam_offset(2, 500)
65
-
66
- self.stair_list = [sp1, sp2, sp3, sp4]
158
+ self.stair_list = stair_list
67
159
 
68
160
  # 数据入口!!!!
69
161
  def set_calculate_info(self):
70
- self.load_param = LoadParams()
162
+ # 荷载相关的入口
163
+ self.load_param = LoadParams(1, 3.5)
71
164
  self.concrete_level = 30
72
165
  self.rebar_area_adjust_coef = 1
73
166
  self.cover_thickness = 15
@@ -106,6 +199,11 @@ class StairCalculationReport(BasicGenerator):
106
199
  self.left_slab_load.q, self.main_slab_load.q, self.right_slab_load.q
107
200
  )
108
201
  self.current_stair.set_calculate_result(solver.submit_problem())
202
+ sover_eq = MatrixSolver(self.current_stair)
203
+ sover_eq.set_load(
204
+ self.left_slab_load.qe, self.main_slab_load.qe, self.right_slab_load.qe
205
+ )
206
+ self.qe_result_components = sover_eq.submit_problem()
109
207
 
110
208
  def add_first_part(self):
111
209
  # 添加最大的标题
@@ -161,13 +259,13 @@ class StairCalculationReport(BasicGenerator):
161
259
 
162
260
  # 进行必要的计算
163
261
  self.load_calculate()
164
-
165
262
  self.do_the_math()
166
263
 
167
264
  # 添加part1已知条件
168
265
  self.add_1_basic_info()
169
266
  self.add_2_load_and_calculate()
170
267
  self.add_3_result()
268
+ self.draw_plots()
171
269
  self.add_blank_paragraph()
172
270
 
173
271
  def add_1_basic_info(self):
@@ -236,22 +334,22 @@ class StairCalculationReport(BasicGenerator):
236
334
  f"活载准永久值系数:{self.load_param.live_load_permenent_coef}"
237
335
  )
238
336
  self.add_paragraph(doc_par)
239
- doc_par.context = f"混凝土等级:C{self.concrete_level},f_{{c}} ={self.concrete_data[self.concrete_level][0]:.2f}MPa"
337
+ doc_par.context = f"混凝土等级:C{self.concrete_level},f_{{c}} ={self.concrete_data[self.concrete_level].fc:.2f}MPa"
240
338
  self.add_paragraph(doc_par)
241
339
  doc_par.context = f"混凝土容重:{self.concrete_density:.2f}kN/mm^{{3}}"
242
340
  self.add_paragraph(doc_par)
243
341
  doc_par.context = f"配筋调整系数:{self.rebar_area_adjust_coef:.2f};纵筋保护层厚度:c={self.cover_thickness}mm"
244
342
  self.add_paragraph(doc_par)
245
343
  doc_par.context = (
246
- f"梯板纵筋等级:{self.rebar_level};f_{{y}} ={self.rebar_fy}MPa"
344
+ f"梯板纵筋等级:{self.rebar_level.name};f_{{y}} ={self.rebar_level.fy}MPa"
247
345
  )
248
346
  self.add_paragraph(doc_par)
249
347
  doc_par.context = (
250
- f"梯梁纵筋等级:{self.rebar_level};f_{{y}} ={self.rebar_fy}MPa"
348
+ f"梯梁纵筋等级:{self.rebar_level.name};f_{{y}} ={self.rebar_level.fy}MPa"
251
349
  )
252
350
  self.add_paragraph(doc_par)
253
351
  doc_par.context = (
254
- f"梯梁箍筋等级:{self.rebar_level};f_{{y}} ={self.rebar_fy}MPa"
352
+ f"梯梁箍筋等级:{self.rebar_level.name};f_{{y}} ={self.rebar_level.fy}MPa"
255
353
  )
256
354
  self.add_paragraph(doc_par)
257
355
 
@@ -397,25 +495,22 @@ class StairCalculationReport(BasicGenerator):
397
495
  doc_par.context = "弯 矩:kN·m\t\t剪 力:kN/m\t\t挠 度:mm"
398
496
  doc_par.first_line_indent = indent
399
497
  self.add_paragraph(doc_par)
400
- doc_par.context = r"纵筋面积:mm^{2}/m\t\t截面尺寸:mm×mm\t\t裂 缝:mm"
498
+ doc_par.context = (
499
+ r"纵筋面积:mm^{2}/m" + "\t\t截面尺寸:mm×mm\t\t裂 缝:mm"
500
+ )
401
501
  self.add_paragraph(doc_par)
402
-
403
502
  self.add_blank_paragraph()
404
503
  doc_par.context = "板段配筋计算结果:"
405
504
  doc_par.first_line_indent = 0
406
505
  self.add_paragraph(doc_par)
407
506
  doc_par.context = "---------------------------------------------------------------------------------------------"
408
507
  self.add_paragraph(doc_par)
409
-
410
508
  self.insert_calculate_table()
411
-
412
- # self.insert_all_pictures()
413
-
414
509
  self.add_blank_paragraph()
415
510
 
416
511
  def insert_calculate_table(self):
417
512
  table_index = 1
418
- ft = self.concrete_data[self.concrete_level][1]
513
+ ft = self.concrete_data[self.concrete_level].ft
419
514
  if (
420
515
  self.current_stair.stair_type == "BT"
421
516
  or self.current_stair.stair_type == "DT"
@@ -430,6 +525,20 @@ class StairCalculationReport(BasicGenerator):
430
525
  shear_context = self.current_stair.get_shear_validate(
431
526
  "left", ft, self.cover_thickness
432
527
  )
528
+ total_rebar_result = analysis_moment_and_rebar(
529
+ moments,
530
+ self.current_stair.left_thick,
531
+ self.current_stair.down_d,
532
+ self.cover_thickness,
533
+ self.concrete_data[self.concrete_level],
534
+ self.rebar_level,
535
+ )
536
+
537
+ real_rebar_result = analysis_real_rebar(
538
+ self.current_stair, "left", total_rebar_result
539
+ )
540
+ self.left_calculate_rebar = total_rebar_result
541
+ self.left_real_rebar = real_rebar_result
433
542
 
434
543
  table_context = [
435
544
  ["截面位置", "左", "中", "右"],
@@ -441,10 +550,30 @@ class StairCalculationReport(BasicGenerator):
441
550
  ],
442
551
  ["剪力(V)", f"{shears[0]:.2f}", f"{shears[1]:.2f}", f"{shears[2]:.2f}"],
443
552
  ["抗剪截面验算", shear_context],
444
- ["上部计算纵筋As'", "", "", ""],
445
- ["下部计算纵筋As", "", "", ""],
446
- ["上部纵筋实配", "", "", ""],
447
- ["下部纵筋实配", "", "", ""],
553
+ [
554
+ "上部计算纵筋As'",
555
+ f"{total_rebar_result[0]:.1f}",
556
+ f"{total_rebar_result[2]:.1f}",
557
+ f"{total_rebar_result[4]:.1f}",
558
+ ],
559
+ [
560
+ "下部计算纵筋As",
561
+ f"{total_rebar_result[1]:.1f}",
562
+ f"{total_rebar_result[3]:.1f}",
563
+ f"{total_rebar_result[5]:.1f}",
564
+ ],
565
+ [
566
+ "上部纵筋实配",
567
+ real_rebar_result[0],
568
+ real_rebar_result[2],
569
+ real_rebar_result[4],
570
+ ],
571
+ [
572
+ "下部纵筋实配",
573
+ real_rebar_result[1],
574
+ real_rebar_result[3],
575
+ real_rebar_result[5],
576
+ ],
448
577
  ]
449
578
  left_table.set_table_context(table_context)
450
579
  self.add_table(left_table)
@@ -461,21 +590,88 @@ class StairCalculationReport(BasicGenerator):
461
590
  shear_context = self.current_stair.get_shear_validate(
462
591
  "main", ft, self.cover_thickness
463
592
  )
593
+ total_rebar_result = analysis_moment_and_rebar(
594
+ moments,
595
+ self.current_stair.main_thick,
596
+ self.current_stair.down_d,
597
+ self.cover_thickness,
598
+ self.concrete_data[self.concrete_level],
599
+ self.rebar_level,
600
+ )
601
+ real_rebar_result = analysis_real_rebar(
602
+ self.current_stair, "middle", total_rebar_result
603
+ )
604
+ self.middle_calculate_rebar = total_rebar_result
605
+ self.middle_real_rebar = real_rebar_result
606
+ disp_limit = (
607
+ self.current_stair.total_horizental_length / self.displacement_limit
608
+ )
609
+ disp_E = self.current_stair.get_calculate_disp()[3]
610
+ Mq = get_qe_moment(self.current_stair, self.qe_result_components)
611
+ disp_p = ConcreteSolver.CalculateDisplacement(
612
+ self.current_stair.main_thick,
613
+ disp_E,
614
+ self.cover_thickness,
615
+ self.concrete_data[self.concrete_level],
616
+ self.rebar_level,
617
+ self.current_stair.down_real_rebar_area,
618
+ Mq,
619
+ )
620
+ disp_validate_context = self.current_stair.get_displacement_validate(
621
+ disp_p, self.displacement_limit
622
+ )
464
623
 
624
+ w_list = analysis_w(
625
+ moments,
626
+ self.current_stair,
627
+ self.cover_thickness,
628
+ self.concrete_data[self.concrete_level],
629
+ self.rebar_level,
630
+ )
631
+ w_validate_context = self.current_stair.get_w_validate(
632
+ w_list, self.crack_width_limit
633
+ )
634
+ self.crack_width = w_list
635
+ self.disp_plastic = disp_p
465
636
  table_context = [
466
637
  ["截面位置", "左", "中", "右"],
467
638
  ["弯矩(M)", f"{moments[0]:.2f}", f"{moments[1]:.2f}", f"{moments[2]:.2f}"],
468
639
  ["剪力(V)", f"{shears[0]:.2f}", f"{shears[1]:.2f}", f"{shears[2]:.2f}"],
469
640
  ["抗剪截面验算", shear_context],
470
- ["上部计算纵筋As'", "", "", ""],
471
- ["下部计算纵筋As", "", "", ""],
472
- ["上部纵筋实配", "", "", ""],
473
- ["下部纵筋实配", "", "", ""],
474
- ["挠度限值", f"[f]={self.crack_width_limit:.2f}mm"],
475
- ["挠度验算结果", "满足"],
476
- ["裂缝宽度", "", "", ""],
641
+ [
642
+ "上部计算纵筋As'",
643
+ f"{total_rebar_result[0]:.1f}",
644
+ f"{total_rebar_result[2]:.1f}",
645
+ f"{total_rebar_result[4]:.1f}",
646
+ ],
647
+ [
648
+ "下部计算纵筋As",
649
+ f"{total_rebar_result[1]:.1f}",
650
+ f"{total_rebar_result[3]:.1f}",
651
+ f"{total_rebar_result[5]:.1f}",
652
+ ],
653
+ [
654
+ "上部纵筋实配",
655
+ real_rebar_result[0],
656
+ real_rebar_result[2],
657
+ real_rebar_result[4],
658
+ ],
659
+ [
660
+ "下部纵筋实配",
661
+ real_rebar_result[1],
662
+ real_rebar_result[3],
663
+ real_rebar_result[5],
664
+ ],
665
+ ["挠度限值", f"[f]={disp_limit:.2f}mm"],
666
+ ["挠度验算结果", disp_validate_context],
667
+ [
668
+ "裂缝宽度",
669
+ f"{max(w_list[0],w_list[1]):.3f}mm",
670
+ f"{max(w_list[2],w_list[3]):.3f}mm",
671
+ f"{max(w_list[4],w_list[5]):.3f}mm",
672
+ ],
477
673
  ["裂缝限值", f"[ω]={self.crack_width_limit:.2f}mm"],
478
- ["裂缝验算结果", ""],
674
+ ["裂缝验算结果", w_validate_context],
479
675
  ]
480
676
  cal_table.set_table_context(table_context)
481
677
  self.add_table(cal_table)
@@ -496,7 +692,19 @@ class StairCalculationReport(BasicGenerator):
496
692
  shear_context = self.current_stair.get_shear_validate(
497
693
  "right", ft, self.cover_thickness
498
694
  )
499
-
695
+ total_rebar_result = analysis_moment_and_rebar(
696
+ moments,
697
+ self.current_stair.right_thick,
698
+ self.current_stair.down_d,
699
+ self.cover_thickness,
700
+ self.concrete_data[self.concrete_level],
701
+ self.rebar_level,
702
+ )
703
+ real_rebar_result = analysis_real_rebar(
704
+ self.current_stair, "right", total_rebar_result
705
+ )
706
+ self.right_calculate_rebar = total_rebar_result
707
+ self.right_real_rebar = real_rebar_result
500
708
  table_context = [
501
709
  ["截面位置", "左", "中", "右"],
502
710
  [
@@ -507,21 +715,107 @@ class StairCalculationReport(BasicGenerator):
507
715
  ],
508
716
  ["剪力(V)", f"{shears[0]:.2f}", f"{shears[1]:.2f}", f"{shears[2]:.2f}"],
509
717
  ["抗剪截面验算", shear_context],
510
- ["上部计算纵筋As'", "", "", ""],
511
- ["下部计算纵筋As", "", "", ""],
512
- ["上部纵筋实配", "", "", ""],
513
- ["下部纵筋实配", "", "", ""],
718
+ [
719
+ "上部计算纵筋As'",
720
+ f"{total_rebar_result[0]:.1f}",
721
+ f"{total_rebar_result[2]:.1f}",
722
+ f"{total_rebar_result[4]:.1f}",
723
+ ],
724
+ [
725
+ "下部计算纵筋As",
726
+ f"{total_rebar_result[1]:.1f}",
727
+ f"{total_rebar_result[3]:.1f}",
728
+ f"{total_rebar_result[5]:.1f}",
729
+ ],
730
+ [
731
+ "上部纵筋实配",
732
+ real_rebar_result[0],
733
+ real_rebar_result[2],
734
+ real_rebar_result[4],
735
+ ],
736
+ [
737
+ "下部纵筋实配",
738
+ real_rebar_result[1],
739
+ real_rebar_result[3],
740
+ real_rebar_result[5],
741
+ ],
514
742
  ]
515
743
  right_table.set_table_context(table_context)
516
744
 
517
745
  self.add_table(right_table)
518
746
  table_index += 1
519
747
 
748
+ def draw_plots(self):
749
+ self.__prepare_draw_data()
750
+ plot_width = 11
751
+ plotter = StairCalculationSheetPNGPlotter(self.current_stair)
752
+ plotter.plot_moment(self.current_stair.get_calculate_moments())
753
+ moment_figure = DocPicture(plotter.to_stream(), width=plot_width)
754
+ self.add_picture(moment_figure)
755
+
756
+ plotter = StairCalculationSheetPNGPlotter(self.current_stair)
757
+ shears = self.current_stair.get_calculate_shears()
758
+ plotter.plot_shear(shears[:3] + shears[-3:])
759
+ shear_figure = DocPicture(plotter.to_stream(), width=plot_width)
760
+ self.add_picture(shear_figure)
761
+
762
+ plotter = StairCalculationSheetPNGPlotter(self.current_stair)
763
+ plotter.plot_calculate_rebar_area(
764
+ self.left_calculate_rebar,
765
+ self.middle_calculate_rebar,
766
+ self.right_calculate_rabar,
767
+ )
768
+ cal_rebar_figure = DocPicture(plotter.to_stream(), width=plot_width)
769
+ self.add_picture(cal_rebar_figure)
770
+
771
+ plotter = StairCalculationSheetPNGPlotter(self.current_stair)
772
+ plotter.plot_real_rebar(
773
+ self.left_real_rebar, self.middle_real_rebar, self.right_real_rabar
774
+ )
775
+ real_rebar_figure = DocPicture(plotter.to_stream(), width=plot_width)
776
+ self.add_picture(real_rebar_figure)
777
+
778
+ plotter = StairCalculationSheetPNGPlotter(self.current_stair)
779
+ plotter.plot_displacement(self.disp_plastic)
780
+ disp_figure = DocPicture(plotter.to_stream(), width=plot_width)
781
+ self.add_picture(disp_figure)
782
+
783
+ plotter = StairCalculationSheetPNGPlotter(self.current_stair)
784
+ plotter.plot_crack(self.crack_width)
785
+ crack_figure = DocPicture(plotter.to_stream(), width=plot_width)
786
+ self.add_picture(crack_figure)
787
+
788
+ def __prepare_draw_data(self):
789
+ if self.current_stair.left_extend_length > 0:
790
+ self.left_calculate_rebar[2] = -999
791
+ self.left_real_rebar = [i.split("(")[0] for i in self.left_real_rebar]
792
+ self.left_real_rebar[0] = ""
793
+ self.left_real_rebar[1] = ""
794
+ self.left_real_rebar[4] = ""
795
+ self.left_real_rebar[5] = ""
796
+
797
+ if self.current_stair.right_extend_length > 0:
798
+ self.right_calculate_rebar[2] = -999
799
+ self.right_real_rebar = [i.split("(")[0] for i in self.right_real_rebar]
800
+ self.right_real_rebar[0] = ""
801
+ self.right_real_rebar[1] = ""
802
+ self.right_real_rebar[4] = ""
803
+ self.right_real_rebar[5] = ""
804
+
805
+ self.middle_calculate_rebar[2] = -999
806
+ self.middle_real_rebar = [i.split("(")[0] for i in self.middle_real_rebar]
807
+ self.middle_real_rebar[1] = ""
808
+ self.middle_real_rebar[2] = ""
809
+ self.middle_real_rebar[5] = ""
810
+
811
+ self.crack_width = [f"{i:.3f}mm" if i > 0 else "" for i in self.crack_width]
812
+
520
813
  def create(self):
521
814
  self.add_first_part()
522
815
  for i in range(len(self.stair_list)):
523
816
  stair = self.stair_list[i]
524
817
  self.add_single_stair(stair, i + 1)
818
+ self.__clear_result()
525
819
  if i < len(self.stair_list) - 1:
526
820
  self.add_page_break()
527
821
 
@@ -2,6 +2,8 @@ from docx.oxml.xmlchemy import BaseOxmlElement
2
2
  from docx.oxml.ns import qn, nsdecls
3
3
  from CivilTools.YDBLoader.BuildingDefine.StairPart import StairPart, Component
4
4
  import numpy as np
5
+ from CivilTools.Const import ConcreteLevel, SteelLevel
6
+ from typing import List
5
7
 
6
8
 
7
9
  # 网上找的代码,有点东西
@@ -226,4 +228,93 @@ class MatrixSolver:
226
228
  comp_f -= comp.create_f()
227
229
  comp.set_f(comp_f[0][0], comp_f[1][0], comp_f[3][0], comp_f[4][0])
228
230
  comp.set_m(comp_f[2][0], comp_f[5][0])
231
+ comp.set_u(
232
+ comp_u[0][0],
233
+ comp_u[1][0],
234
+ comp_u[2][0],
235
+ comp_u[3][0],
236
+ comp_u[4][0],
237
+ comp_u[5][0],
238
+ )
229
239
  return self.comp_list
240
+
241
+
242
+ class ConcreteSolver:
243
+ @classmethod
244
+ def CalculateRebar(
245
+ cls,
246
+ moment: float,
247
+ thickness: float,
248
+ rebar_d: float,
249
+ cover_thickness: float,
250
+ concrete: ConcreteLevel,
251
+ rebar: SteelLevel,
252
+ min_rebar_ratio: float = 0.002,
253
+ ) -> List[float]:
254
+ h0 = thickness - rebar_d / 2 - cover_thickness
255
+ alpha_s = abs(moment) * 1000000 / concrete.fc / 1000 / h0 / h0
256
+ temp_yita = 1 - (1 - 2 * alpha_s) ** 0.5
257
+ rebar_cal = temp_yita * concrete.fc * 1000 * h0 / rebar.fy
258
+ rebar_min = thickness * min_rebar_ratio * 1000
259
+ result = [max(rebar_cal, rebar_min), rebar_min]
260
+ if moment < 0:
261
+ return result
262
+ else:
263
+ return result[::-1]
264
+
265
+ @classmethod
266
+ def CalculateDisplacement(
267
+ cls,
268
+ thickness: float,
269
+ disp_E: float,
270
+ cover_thickness: float,
271
+ concrete: ConcreteLevel,
272
+ rebar: SteelLevel,
273
+ As: float,
274
+ Mq: float,
275
+ ):
276
+ Es = rebar.elastic_module
277
+ Ec = concrete.elastic_module
278
+ ftk = concrete.ftk
279
+ h0 = thickness - cover_thickness
280
+ EI = Ec / 12 * 1000 * (thickness) ** 3
281
+ rhote = As / (thickness * 1000 / 2)
282
+ sigmas = Mq * 1000000 / (0.87 * h0 * As)
283
+ psi = 1.1 - 0.65 * ftk / (rhote * sigmas)
284
+ psi = max(min(psi, 1), 0.2)
285
+ alphaE = Es / Ec
286
+ rho = As / (1000 * h0)
287
+ Bs = Es * As * (h0) ** 2 / (1.15 * psi + 0.2 + 6 * alphaE * rho / (1 + 3.5 * 0))
288
+ B = Bs / 1.6
289
+ disp_P = disp_E * EI / B
290
+ return float(disp_P)
291
+
292
+ @classmethod
293
+ def CalculateW(
294
+ cls,
295
+ moment: float,
296
+ As: float,
297
+ thickness: float,
298
+ cover_thickness: float,
299
+ concrete: ConcreteLevel,
300
+ rebar: SteelLevel,
301
+ rebar_d: float,
302
+ ):
303
+ if moment == 0:
304
+ return 0
305
+ ftk = concrete.ftk
306
+ Es = rebar.elastic_module
307
+ h0 = thickness - cover_thickness
308
+ rhote = As / (thickness * 1000 / 2)
309
+ sigmas = abs(moment) * 1000000 / (0.87 * h0 * As)
310
+ psi = 1.1 - 0.65 * ftk / (rhote * sigmas)
311
+ psi = max(min(psi, 1), 0.2)
312
+ alphacr = 1.9 # 普通混凝土受弯构件
313
+ w = (
314
+ alphacr
315
+ * psi
316
+ * sigmas
317
+ / Es
318
+ * (1.9 * cover_thickness + 0.08 * rebar_d / rhote)
319
+ )
320
+ return w
@@ -2,13 +2,21 @@ from enum import Enum
2
2
 
3
3
 
4
4
  class LoadParams:
5
- def __init__(self):
6
- self.append_dead_load = 1
7
- self.live_load = 3.5
8
- self.dead_load_coef = 1.3
9
- self.live_load_coef = 1.5
10
- self.live_load_adjust_coef = 1
11
- self.live_load_permenent_coef = 0.5
5
+ def __init__(
6
+ self,
7
+ append_dead_load: float = 1,
8
+ live_load: float = 3.5,
9
+ dead_load_coef: float = 1.3,
10
+ live_load_coef: float = 1.5,
11
+ live_load_adjust_coef=1,
12
+ live_load_permenent_coef=0.5,
13
+ ):
14
+ self.append_dead_load = append_dead_load
15
+ self.live_load = live_load
16
+ self.dead_load_coef = dead_load_coef
17
+ self.live_load_coef = live_load_coef
18
+ self.live_load_adjust_coef = live_load_adjust_coef
19
+ self.live_load_permenent_coef = live_load_permenent_coef
12
20
 
13
21
 
14
22
  class LoadType(Enum):
@@ -90,6 +90,14 @@ class Component:
90
90
  self.m_1 = m_1 / 1e6
91
91
  self.m_2 = m_2 / 1e6
92
92
 
93
+ def set_u(self, u1x, u1y, u1r, u2x, u2y, u2r):
94
+ self.u_1_x = u1x
95
+ self.u_1_y = u1y
96
+ self.u_1_r = u1r
97
+ self.u_2_x = u2x
98
+ self.u_2_y = u2y
99
+ self.u_2_r = u2r
100
+
93
101
  @property
94
102
  def v1(self):
95
103
  return self.f_1_y * np.cos(self.alpha) - self.f_1_x * np.sin(self.alpha)