structuraid_core 0.1.3 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -9
  3. data/lib/structuraid_core/design_codes/aci_318_19/rc/footings/bending_reinforcement_ratio.rb +65 -0
  4. data/lib/structuraid_core/design_codes/aci_318_19/rc/footings/one_way_shear_capacity.rb +29 -0
  5. data/lib/structuraid_core/design_codes/aci_318_19/rc/footings/punching_critical_section_perimeter.rb +105 -0
  6. data/lib/structuraid_core/design_codes/aci_318_19/rc/minimum_steel_cover.rb +55 -0
  7. data/lib/structuraid_core/design_codes/aci_318_19/rc/reduction_factor.rb +88 -0
  8. data/lib/structuraid_core/design_codes/nsr_10/rc/footings/bending_reinforcement_ratio.rb +66 -0
  9. data/lib/structuraid_core/design_codes/nsr_10/rc/footings/one_way_shear_capacity.rb +31 -0
  10. data/lib/structuraid_core/design_codes/nsr_10/rc/footings/punching_critical_section_perimeter.rb +103 -0
  11. data/lib/structuraid_core/design_codes/nsr_10/rc/minimum_steel_cover.rb +57 -0
  12. data/lib/structuraid_core/design_codes/nsr_10/rc/reduction_factor.rb +82 -0
  13. data/lib/structuraid_core/design_codes/schemas/rc/footings/bending_reinforcement_ratio_schema.rb +24 -0
  14. data/lib/structuraid_core/design_codes/schemas/rc/footings/one_way_shear_capacity_schema.rb +22 -0
  15. data/lib/structuraid_core/design_codes/schemas/rc/footings/punching_critical_section_perimeter_schema.rb +23 -0
  16. data/lib/structuraid_core/design_codes/schemas/rc/minimum_steel_cover_schema.rb +32 -0
  17. data/lib/structuraid_core/design_codes/schemas/rc/reduction_factor_schema.rb +17 -0
  18. data/lib/structuraid_core/design_codes/utils/schema_definition.rb +38 -9
  19. data/lib/structuraid_core/elements/column/rectangular.rb +5 -4
  20. data/lib/structuraid_core/elements/footing.rb +69 -2
  21. data/lib/structuraid_core/engineering/analysis/footing/base.rb +17 -0
  22. data/lib/structuraid_core/engineering/analysis/footing/centric_combined_two_columns.rb +99 -0
  23. data/lib/structuraid_core/engineering/analysis/footing/centric_isolated.rb +1 -1
  24. data/lib/structuraid_core/engineering/analysis/footing/utils/basic_geometry.rb +36 -0
  25. data/lib/structuraid_core/engineering/analysis/footing/utils/centroid.rb +33 -0
  26. data/lib/structuraid_core/engineering/analysis/footing/utils/one_way_moment.rb +63 -0
  27. data/lib/structuraid_core/engineering/analysis/footing/utils/one_way_shear.rb +46 -0
  28. data/lib/structuraid_core/engineering/base.rb +1 -1
  29. data/lib/structuraid_core/engineering/locations/absolute.rb +4 -0
  30. data/lib/structuraid_core/engineering/locations/base.rb +1 -0
  31. data/lib/structuraid_core/engineering/locations/collection.rb +51 -0
  32. data/lib/structuraid_core/engineering/locations/coordinates_system.rb +19 -4
  33. data/lib/structuraid_core/engineering/locations/relative.rb +17 -4
  34. data/lib/structuraid_core/errors/engineering/locations/duplicate_label_error.rb +13 -0
  35. data/lib/structuraid_core/loads/point_load.rb +3 -2
  36. data/lib/structuraid_core/version.rb +1 -1
  37. metadata +67 -2
@@ -0,0 +1,46 @@
1
+ module StructuraidCore
2
+ module Engineering
3
+ module Analysis
4
+ module Footing
5
+ module Utils
6
+ module OneWayShear
7
+ def shear_at(x_distance)
8
+ return [] if x_distance > section_length || x_distance.negative?
9
+
10
+ shear = [
11
+ shear_stretch_1(x_distance),
12
+ shear_stretch_2(x_distance),
13
+ shear_stretch_3(x_distance)
14
+ ].select(&:nonzero?)
15
+ return [0] if shear.empty?
16
+
17
+ shear
18
+ end
19
+
20
+ private
21
+
22
+ def shear_stretch_1(x_distance)
23
+ return 0.0 if x_distance > length_border_to_first_column || x_distance.zero?
24
+
25
+ -solicitation_load * x_distance
26
+ end
27
+
28
+ def shear_stretch_2(x_distance)
29
+ local_length_1 = length_border_to_first_column
30
+ local_length_2 = length_first_column_to_second_column
31
+ return 0.0 if x_distance < local_length_1 || x_distance > local_length_1 + local_length_2
32
+
33
+ -reaction_at_first_column - solicitation_load * x_distance
34
+ end
35
+
36
+ def shear_stretch_3(x_distance)
37
+ return 0.0 if x_distance < length_border_to_first_column + length_first_column_to_second_column
38
+
39
+ -reaction_at_second_column - reaction_at_first_column - solicitation_load * x_distance
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -5,5 +5,5 @@ module StructuraidCore
5
5
  end
6
6
  end
7
7
 
8
- require_relative 'analysis/footing/centric_isolated'
8
+ require_relative 'analysis/footing/base'
9
9
  require_relative 'locations/base'
@@ -21,6 +21,10 @@ module StructuraidCore
21
21
  ]
22
22
  )
23
23
  end
24
+
25
+ def to_vector
26
+ Vector[value_x, value_y, value_z]
27
+ end
24
28
  end
25
29
  end
26
30
  end
@@ -10,3 +10,4 @@ end
10
10
  require_relative 'absolute'
11
11
  require_relative 'relative'
12
12
  require_relative 'coordinates_system'
13
+ require_relative 'collection'
@@ -0,0 +1,51 @@
1
+ module StructuraidCore
2
+ module Engineering
3
+ module Locations
4
+ class Collection < Base
5
+ include Enumerable
6
+
7
+ def initialize
8
+ @locations = []
9
+ end
10
+
11
+ def each(&block)
12
+ locations.each(&block)
13
+ end
14
+
15
+ def add(location)
16
+ raise DuplicateLabelError, location.label if find_by_label(location.label)
17
+
18
+ locations.push(location)
19
+ end
20
+
21
+ def inspect
22
+ locations.inspect
23
+ end
24
+
25
+ def find_by_label(label)
26
+ locations.find { |location| location.label == label.to_sym }
27
+ end
28
+
29
+ def last
30
+ locations.last
31
+ end
32
+
33
+ def prepend(location)
34
+ locations.prepend(location)
35
+ end
36
+
37
+ def find_or_add_by_label(location)
38
+ add(location)
39
+ find_by_label(location.label)
40
+ rescue DuplicateLabelError => e
41
+ Warning.warn(e.message)
42
+ find_by_label(location.label)
43
+ end
44
+
45
+ private
46
+
47
+ attr_reader :locations
48
+ end
49
+ end
50
+ end
51
+ end
@@ -4,11 +4,11 @@ module StructuraidCore
4
4
  module Engineering
5
5
  module Locations
6
6
  class CoordinatesSystem < Base
7
- attr_reader :relative_locations, :axis_1
7
+ attr_reader :relative_locations, :axis_1, :anchor_location
8
8
 
9
- def initialize(anchor_location:, relative_locations: [])
9
+ def initialize(anchor_location:)
10
10
  @anchor_location = anchor_location
11
- @relative_locations = relative_locations
11
+ @relative_locations = Collection.new
12
12
  @axis_1 = Vector[1.0, 0.0, 0.0]
13
13
  @axis_3 = Vector[0.0, 0.0, 1.0]
14
14
  end
@@ -19,13 +19,28 @@ module StructuraidCore
19
19
  end
20
20
 
21
21
  def add_location(relative_location)
22
- relative_locations << relative_location
22
+ relative_locations.add(relative_location)
23
+ end
24
+
25
+ def add_location_from_vector(vector, label:)
26
+ relative_location = Relative.from_vector(vector, label:)
27
+ add_location(relative_location)
28
+ end
29
+
30
+ def find_or_add_location_from_vector(vector, label:)
31
+ relative_location = Relative.from_vector(vector, label:)
32
+
33
+ relative_locations.find_or_add_by_label(relative_location)
23
34
  end
24
35
 
25
36
  def axis_2
26
37
  axis_3.cross_product axis_1
27
38
  end
28
39
 
40
+ def find_location(label)
41
+ relative_locations.find_by_label(label)
42
+ end
43
+
29
44
  private
30
45
 
31
46
  attr_reader :axis_3
@@ -4,20 +4,33 @@ module StructuraidCore
4
4
  module Engineering
5
5
  module Locations
6
6
  class Relative < Base
7
- attr_reader :value_1, :value_2, :value_3
7
+ attr_reader :label
8
+ attr_accessor :value_1, :value_2, :value_3
8
9
 
9
- def self.from_matrix(matrix)
10
+ def self.from_vector(vector, label: nil)
11
+ new(
12
+ value_1: vector[0],
13
+ value_2: vector[1],
14
+ value_3: vector[2],
15
+ label:
16
+ )
17
+ end
18
+
19
+ def self.from_matrix(matrix, label: nil)
10
20
  new(
11
21
  value_1: matrix[0, 0],
12
22
  value_2: matrix[1, 0],
13
- value_3: matrix[2, 0]
23
+ value_3: matrix[2, 0],
24
+ label:
14
25
  )
15
26
  end
16
27
 
17
- def initialize(value_1:, value_2:, value_3:)
28
+ def initialize(value_1:, value_2:, value_3:, label: nil)
18
29
  @value_1 = value_1.to_f
19
30
  @value_2 = value_2.to_f
20
31
  @value_3 = value_3.to_f
32
+
33
+ @label = label&.to_sym
21
34
  end
22
35
 
23
36
  def to_matrix
@@ -0,0 +1,13 @@
1
+ module StructuraidCore
2
+ module Engineering
3
+ module Locations
4
+ class DuplicateLabelError < StandardError
5
+ def initialize(label)
6
+ message = "location with label: #{label} already exists"
7
+
8
+ super(message)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,11 +2,12 @@ module StructuraidCore
2
2
  module Loads
3
3
  class PointLoad < Base
4
4
  attr_accessor :value
5
- attr_reader :location
5
+ attr_reader :location, :label
6
6
 
7
- def initialize(value:, location:)
7
+ def initialize(value:, location:, label: nil)
8
8
  @value = value.to_f
9
9
  @location = location
10
+ @label = label&.to_sym
10
11
  end
11
12
  end
12
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StructuraidCore
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structuraid_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pradaing
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2023-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 4.7.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: puma
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +122,20 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: 0.22.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: yard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: matrix
99
141
  requirement: !ruby/object:Gem::Requirement
@@ -158,17 +200,32 @@ files:
158
200
  - lib/structuraid_core/db/base.rb
159
201
  - lib/structuraid_core/db/rebars.yml
160
202
  - lib/structuraid_core/design_codes/aci_318_19/rc/elastic_modulus.rb
203
+ - lib/structuraid_core/design_codes/aci_318_19/rc/footings/bending_reinforcement_ratio.rb
161
204
  - lib/structuraid_core/design_codes/aci_318_19/rc/footings/min_height.rb
205
+ - lib/structuraid_core/design_codes/aci_318_19/rc/footings/one_way_shear_capacity.rb
206
+ - lib/structuraid_core/design_codes/aci_318_19/rc/footings/punching_critical_section_perimeter.rb
162
207
  - lib/structuraid_core/design_codes/aci_318_19/rc/footings/punching_shear_capacity.rb
208
+ - lib/structuraid_core/design_codes/aci_318_19/rc/minimum_steel_cover.rb
209
+ - lib/structuraid_core/design_codes/aci_318_19/rc/reduction_factor.rb
163
210
  - lib/structuraid_core/design_codes/base.rb
164
211
  - lib/structuraid_core/design_codes/nsr_10/rc/elastic_modulus.rb
212
+ - lib/structuraid_core/design_codes/nsr_10/rc/footings/bending_reinforcement_ratio.rb
165
213
  - lib/structuraid_core/design_codes/nsr_10/rc/footings/min_height.rb
214
+ - lib/structuraid_core/design_codes/nsr_10/rc/footings/one_way_shear_capacity.rb
215
+ - lib/structuraid_core/design_codes/nsr_10/rc/footings/punching_critical_section_perimeter.rb
166
216
  - lib/structuraid_core/design_codes/nsr_10/rc/footings/punching_shear_capacity.rb
217
+ - lib/structuraid_core/design_codes/nsr_10/rc/minimum_steel_cover.rb
218
+ - lib/structuraid_core/design_codes/nsr_10/rc/reduction_factor.rb
167
219
  - lib/structuraid_core/design_codes/resolver.rb
168
220
  - lib/structuraid_core/design_codes/schemas/empty_schema.rb
169
221
  - lib/structuraid_core/design_codes/schemas/rc/elastic_modulus_schema.rb
222
+ - lib/structuraid_core/design_codes/schemas/rc/footings/bending_reinforcement_ratio_schema.rb
170
223
  - lib/structuraid_core/design_codes/schemas/rc/footings/min_height_schema.rb
224
+ - lib/structuraid_core/design_codes/schemas/rc/footings/one_way_shear_capacity_schema.rb
225
+ - lib/structuraid_core/design_codes/schemas/rc/footings/punching_critical_section_perimeter_schema.rb
171
226
  - lib/structuraid_core/design_codes/schemas/rc/footings/punching_shear_capacity_schema.rb
227
+ - lib/structuraid_core/design_codes/schemas/rc/minimum_steel_cover_schema.rb
228
+ - lib/structuraid_core/design_codes/schemas/rc/reduction_factor_schema.rb
172
229
  - lib/structuraid_core/design_codes/utils/code_requirement.rb
173
230
  - lib/structuraid_core/design_codes/utils/schema_definition.rb
174
231
  - lib/structuraid_core/elements/base.rb
@@ -181,10 +238,17 @@ files:
181
238
  - lib/structuraid_core/elements/reinforcement/straight_longitudinal.rb
182
239
  - lib/structuraid_core/elements/reinforcement/straight_longitudinal_layer.rb
183
240
  - lib/structuraid_core/elements/reinforcement/utils/rebar_data.rb
241
+ - lib/structuraid_core/engineering/analysis/footing/base.rb
242
+ - lib/structuraid_core/engineering/analysis/footing/centric_combined_two_columns.rb
184
243
  - lib/structuraid_core/engineering/analysis/footing/centric_isolated.rb
244
+ - lib/structuraid_core/engineering/analysis/footing/utils/basic_geometry.rb
245
+ - lib/structuraid_core/engineering/analysis/footing/utils/centroid.rb
246
+ - lib/structuraid_core/engineering/analysis/footing/utils/one_way_moment.rb
247
+ - lib/structuraid_core/engineering/analysis/footing/utils/one_way_shear.rb
185
248
  - lib/structuraid_core/engineering/base.rb
186
249
  - lib/structuraid_core/engineering/locations/absolute.rb
187
250
  - lib/structuraid_core/engineering/locations/base.rb
251
+ - lib/structuraid_core/engineering/locations/collection.rb
188
252
  - lib/structuraid_core/engineering/locations/coordinates_system.rb
189
253
  - lib/structuraid_core/engineering/locations/relative.rb
190
254
  - lib/structuraid_core/errors/base.rb
@@ -193,6 +257,7 @@ files:
193
257
  - lib/structuraid_core/errors/design_codes/unknown_design_code_error.rb
194
258
  - lib/structuraid_core/errors/design_codes/unrecognized_value_error.rb
195
259
  - lib/structuraid_core/errors/engineering/analysis/section_direction_error.rb
260
+ - lib/structuraid_core/errors/engineering/locations/duplicate_label_error.rb
196
261
  - lib/structuraid_core/errors/reinforcement/empty_layers.rb
197
262
  - lib/structuraid_core/errors/reinforcement/invalid_distribution_direction.rb
198
263
  - lib/structuraid_core/loads/base.rb