1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+ import os
4+ import sys
5+ baseName = os .path .basename (__file__ )
6+ dirName = os .path .dirname (__file__ )
7+ print ('basename: ' , baseName )
8+ print ('dirname: ' , dirName )
9+ sys .path .append (dirName + r'/../..' )
10+
11+ #Import all modules required to access RFEM
12+ from RFEM .enums import MemberEccentricitySpecificationType , ActionCategoryType , NodalSupportType ,\
13+ MemberSectionDistributionType , MemberSectionAlignment , SurfaceEccentricityAlignment
14+ from RFEM .initModel import Model , Calculate_all
15+ from RFEM .BasicObjects .material import Material
16+ from RFEM .BasicObjects .section import Section
17+ from RFEM .BasicObjects .thickness import Thickness
18+ from RFEM .BasicObjects .node import Node
19+ from RFEM .BasicObjects .line import Line
20+ from RFEM .BasicObjects .member import Member
21+ from RFEM .BasicObjects .surface import Surface
22+ from RFEM .TypesForNodes .nodalSupport import NodalSupport
23+ from RFEM .TypesForSurfaces .surfaceEccentricity import SurfaceEccentricity
24+ from RFEM .TypesForMembers .memberEccentricity import MemberEccentricity
25+ from RFEM .LoadCasesAndCombinations .loadCase import LoadCase
26+ from RFEM .Loads .surfaceLoad import SurfaceLoad
27+ from RFEM .Loads .freeLoad import FreeLoad
28+ from RFEM .Tools .PlausibilityCheck import PlausibilityCheck
29+
30+ if __name__ == "__main__" :
31+ # ----------------INPUT PARAMETERS------------------#
32+ # inicialize model and define parameters
33+ Model (model_name = "Concrete_bridge" )
34+
35+ num_bridge_fields = 8 # number of whole bridge fields (between pillars)
36+ bridge_height = float (18 ) # primary parameters, input in meters
37+ bridge_width = float (12 )
38+ bridge_length = float (16 ) # length of one field/span
39+ # secondary (derived) parameters, input optional in meters
40+ pillar_dimension = bridge_width / 6
41+ girder_width = pillar_dimension
42+ girder_height = bridge_width / 4
43+ beam_width = 0.4
44+ beam_height_inwards = bridge_width / 8
45+ beam_height_outwards = bridge_width / 16
46+ slab_thickness = 0.25
47+ # beam spacing setup
48+ beam_spacing = 5.0 # for variable establishment, not to be adjusted
49+ beams_per_field = 1 # for variable establishment, not to be adjusted
50+ for b in range (1 , int (bridge_length )):
51+ if bridge_length / b < 5.0 : # <- adjust maximum beam spacing here
52+ beam_spacing = bridge_length / b
53+ beams_per_field = b
54+ break
55+ # LOADING SETUP - if, true, the live load will only be applied on odd bridge fields
56+ # if false, loading will be constant for the whole bridge length
57+ alternating_live_loads = True
58+ live_load_magnitude = 20000.0
59+
60+ # ----------------INPUT PARAMETERS------------------#
61+
62+ # starting modification of the model
63+ Model .clientModel .service .begin_modification ()
64+ # materials
65+ Material (1 , "C30/37" )
66+ Material (2 , "C50/60" )
67+ # sections
68+ Section (1 ,"SQ_M1 " + str (pillar_dimension ), 2 , "pillar" )
69+ Section (2 ,f"R_M1 { girder_width } /{ girder_height } " , 2 , "girder" )
70+ Section (3 , f"R_M1 { beam_width } /{ beam_height_inwards } " , 2 , "beam_1" )
71+ Section (4 , f"R_M1 { beam_width } /{ beam_height_outwards } " , 2 , "beam_2" )
72+ # thicknesses
73+ Thickness (1 , material_no = 1 , uniform_thickness_d = slab_thickness )
74+
75+ # --------- BUILDING MODEL ----------- #
76+ print ("Constructing bridge..." )
77+
78+ # nodes
79+ # pillar nodes
80+ node_counter = 1
81+ for i in range (1 , num_bridge_fields + 2 ):
82+ Node (node_counter ,(i - 1 )* bridge_length , 0 , 0 )
83+ NodalSupport (i , f"{ node_counter } " , NodalSupportType .FIXED )
84+ Node (node_counter + 1 ,(i - 1 )* bridge_length , 0 , - bridge_height )
85+ node_counter += 2
86+ pillar_node_count = node_counter
87+
88+ # girder nodes
89+ Node (node_counter , - pillar_dimension / 2 , 0 , - bridge_height )
90+ Node (node_counter + 1 , num_bridge_fields * bridge_length + pillar_dimension / 2 , 0 , - bridge_height )
91+ girder_node_1 = node_counter
92+ girder_node_2 = node_counter + 1
93+ node_counter += 2
94+
95+ # beam nodes
96+ x_for_beams = beam_spacing / 2
97+ beam_start_node = node_counter
98+ for n in range (beams_per_field * num_bridge_fields ):
99+ if x_for_beams != n * bridge_length :
100+ Node (node_counter , x_for_beams , 0 , - bridge_height )
101+ Node (node_counter + 1 , x_for_beams , - bridge_width / 2 , - bridge_height )
102+ Node (node_counter + 2 , x_for_beams , bridge_width / 2 , - bridge_height )
103+ node_counter += 3
104+ x_for_beams += beam_spacing
105+
106+ # slab nodes and lines
107+ Node (node_counter , - pillar_dimension / 2 , - bridge_width / 2 , - bridge_height )
108+ Node (node_counter + 1 , - pillar_dimension / 2 , bridge_width / 2 , - bridge_height )
109+ Node (node_counter + 2 , bridge_length * num_bridge_fields + pillar_dimension / 2 , - bridge_width / 2 , - bridge_height )
110+ Node (node_counter + 3 , bridge_length * num_bridge_fields + pillar_dimension / 2 , bridge_width / 2 , - bridge_height )
111+ line_counter = 1
112+ Line .DeleteLine ("1 2 3 4" )
113+ Line .Polyline (line_counter , f"{ node_counter } { node_counter + 1 } { node_counter + 3 } { node_counter + 2 } { node_counter } " )
114+ node_counter += 4
115+
116+ # members - pillars
117+ m_count = 0
118+ MemberEccentricity (5 , name = 'pillar ecc.' , eccentricity_type = MemberEccentricitySpecificationType .TYPE_ABSOLUTE ,
119+ eccentricity_parameters = [1 , 0 , 0 , girder_height + slab_thickness ])
120+ for i in range (1 , pillar_node_count , 2 ):
121+ m_count += 1
122+ Member (m_count , i , i + 1 , params = {"member_eccentricity_end" :5 })
123+ print (f"Generating { m_count } pillars." )
124+ num_pillars = m_count
125+
126+ # members - girder
127+ print ("Generating girder." )
128+ m_count += 1
129+ MemberEccentricity (4 , name = 'girder ecc.' , eccentricity_type = MemberEccentricitySpecificationType .TYPE_ABSOLUTE ,
130+ eccentricity_parameters = [1 , 0 , 0 , girder_height / 2 + slab_thickness ])
131+ Member (m_count , girder_node_1 , girder_node_2 , start_section_no = 2 , end_section_no = 2 ,
132+ params = {"member_eccentricity_start" :4 , "member_eccentricity_end" :4 })
133+ # members - beams
134+ MemberEccentricity (1 , name = 'beam ecc.1' , eccentricity_type = MemberEccentricitySpecificationType .TYPE_ABSOLUTE ,
135+ eccentricity_parameters = [1 , 0 , 0 , beam_height_outwards / 2 + slab_thickness ])
136+ MemberEccentricity (2 , name = 'beam ecc.2' , eccentricity_type = MemberEccentricitySpecificationType .TYPE_ABSOLUTE ,
137+ eccentricity_parameters = [1 , 0 , - girder_width / 2 , beam_height_outwards / 2 + slab_thickness ])
138+ MemberEccentricity (3 , name = 'beam ecc.3' , eccentricity_type = MemberEccentricitySpecificationType .TYPE_ABSOLUTE ,
139+ eccentricity_parameters = [1 , 0 , girder_width / 2 , beam_height_outwards / 2 + slab_thickness ])
140+ for n in range (beams_per_field * num_bridge_fields ):
141+ Member .Beam (
142+ m_count + 1 , beam_start_node , beam_start_node + 1 ,
143+ MemberSectionDistributionType .SECTION_DISTRIBUTION_TYPE_LINEAR ,
144+ start_section_no = 3 , end_section_no = 4 ,
145+ distribution_parameters = [MemberSectionAlignment .SECTION_ALIGNMENT_TOP ],
146+ params = {"member_eccentricity_start" :2 , "member_eccentricity_end" :1 }
147+ )
148+ Member .Beam (
149+ m_count + 2 , beam_start_node , beam_start_node + 2 ,
150+ MemberSectionDistributionType .SECTION_DISTRIBUTION_TYPE_LINEAR ,
151+ start_section_no = 3 , end_section_no = 4 ,
152+ distribution_parameters = [MemberSectionAlignment .SECTION_ALIGNMENT_TOP ],
153+ params = {"member_eccentricity_start" :3 , "member_eccentricity_end" :1 }
154+ )
155+
156+
157+ m_count += 2
158+ beam_start_node += 3
159+
160+ print (f"Generating { m_count - num_pillars - 1 } support beams." )
161+ # bridge concrete slab
162+ print (f"Generating support slab, thickness { slab_thickness * 1000 } mm." )
163+ s_count = 1
164+ Surface (s_count , "1" , 1 , "bridge slab" )
165+ SurfaceEccentricity (1 , 0 , f"{ s_count } " , thickness_alignment = SurfaceEccentricityAlignment .ALIGN_TOP ,
166+ transverse_offset_object = None )
167+
168+ # loadcases
169+ LoadCase () # self weight
170+ LoadCase (2 , "Active Load" , [True , 0 , 0 , 1 ],
171+ ActionCategoryType .ACTION_CATEGORY_IMPOSED_LOADS_CATEGORY_F_TRAFFIC_AREA_VEHICLE_WEIGHT_LESS_OR_EQUAL_TO_30_KN_QI_F ,
172+ )
173+ if alternating_live_loads :
174+ if num_bridge_fields == 1 :
175+ FreeLoad .RectangularLoad (1 , 2 , "1" , load_magnitude_parameter = [live_load_magnitude ],
176+ load_location_parameter = [- pillar_dimension / 2 , - bridge_width / 2 , bridge_length + pillar_dimension / 2 , bridge_width / 2 , 0 ])
177+ else :
178+ # first field
179+ FreeLoad .RectangularLoad (1 , 2 , "1" , load_magnitude_parameter = [live_load_magnitude ],
180+ load_location_parameter = [- pillar_dimension / 2 , - bridge_width / 2 , bridge_length , bridge_width / 2 , 0 ])
181+ # inner fields
182+ for i in range (2 , num_bridge_fields , 2 ):
183+ FreeLoad .RectangularLoad (1 + i , 2 , "1" , load_magnitude_parameter = [live_load_magnitude ],
184+ load_location_parameter = [bridge_length * i , - bridge_width / 2 , bridge_length * (i + 1 ), bridge_width / 2 , 0 ])
185+ # last field
186+ if num_bridge_fields % 2 != 0 :
187+ FreeLoad .RectangularLoad (num_bridge_fields , 2 , "1" , load_magnitude_parameter = [live_load_magnitude ],
188+ load_location_parameter = [bridge_length * (num_bridge_fields - 1 ), - bridge_width / 2 , bridge_length * num_bridge_fields + pillar_dimension / 2 , bridge_width / 2 , 0 ])
189+ else :
190+ SurfaceLoad (1 , 2 , "1" , 20000 , "Road Traffic" )
191+
192+ Model .clientModel .service .finish_modification ()
193+ PlausibilityCheck ()
194+ print ("Calculating results." )
195+ Calculate_all ()
0 commit comments