Module: EN14960::Calculators::AnchorCalculator

Extended by:
AnchorCalculator, T::Sig
Included in:
AnchorCalculator
Defined in:
lib/en14960/calculators/anchor_calculator.rb

Instance Method Summary collapse

Instance Method Details

#anchor_calculation_descriptionObject



84
85
86
# File 'lib/en14960/calculators/anchor_calculator.rb', line 84

def anchor_calculation_description
  "Anchors must be calculated based on the play area to ensure adequate ground restraint for wind loads."
end

#anchor_formula_textObject



76
77
78
79
80
81
# File 'lib/en14960/calculators/anchor_calculator.rb', line 76

def anchor_formula_text
  area_coeff = Constants::ANCHOR_CALCULATION_CONSTANTS[:area_coefficient]
  base_div = Constants::ANCHOR_CALCULATION_CONSTANTS[:base_divisor]
  safety_fact = Constants::ANCHOR_CALCULATION_CONSTANTS[:safety_factor]
  "((Area × #{area_coeff} × #{safety_fact}) ÷ #{base_div})"
end

#calculate(length:, width:, height:) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/en14960/calculators/anchor_calculator.rb', line 31

def calculate(length:, width:, height:)
  # EN 14960-1:2019 Lines 1175-1210 (Annex A) - Calculate exposed surface areas
  front_area = (width * height).round(1)
  sides_area = (length * height).round(1)

  required_front = calculate_required_anchors(front_area)
  required_sides = calculate_required_anchors(sides_area)

  # EN 14960-1:2019 Line 1204 - Calculate for each side
  total_required = (required_front + required_sides) * 2

  # EN 14960-1:2019 Lines 441-442 - "Each inflatable shall have at least six anchorage points"
  minimum = Constants::ANCHOR_CALCULATION_CONSTANTS[:minimum_anchors]
  total_required = [total_required, minimum].max

  area_coeff = Constants::ANCHOR_CALCULATION_CONSTANTS[:area_coefficient]
  base_div = Constants::ANCHOR_CALCULATION_CONSTANTS[:base_divisor]
  safety_mult = Constants::ANCHOR_CALCULATION_CONSTANTS[:safety_factor]

  formula_front = "((#{front_area} × #{area_coeff} * #{safety_mult}) ÷ #{base_div} = #{required_front}"
  formula_sides = "((#{sides_area} × #{area_coeff} * #{safety_mult}) ÷ #{base_div} = #{required_sides}"

  calculated_total = (required_front + required_sides) * 2

  breakdown = [
    ["Front/back area", "#{width}m (W) × #{height}m (H) = #{front_area}m²"],
    ["Sides area", "#{length}m (L) × #{height}m (H) = #{sides_area}m²"],
    ["Front & back anchor counts", formula_front],
    ["Left & right anchor counts", formula_sides],
    ["Calculated total anchors", "(#{required_front} + #{required_sides}) × 2 = #{calculated_total}"]
  ]

  # Add minimum requirement note if applicable
  if calculated_total < minimum
    breakdown << ["EN 14960 minimum", "Minimum #{minimum} anchors required, using #{minimum}"]
  end

  CalculatorResponse.new(
    value: total_required,
    value_suffix: "",
    breakdown: breakdown
  )
end

#calculate_required_anchors(area_m2) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/en14960/calculators/anchor_calculator.rb', line 15

def calculate_required_anchors(area_m2)
  # EN 14960-1:2019 Annex A (Lines 1175-1210) - Anchor calculation formula
  # Force = 0.5 × Cw × ρ × V² × A
  # Where: Cw = 1.5, ρ = 1.24 kg/m³, V = 11.1 m/s (Lines 1194-1199)
  # Number of anchors = Force / 1600N (Line 450 - each anchor withstands 1600N)
  return 0 if area_m2 <= 0

  # Pre-calculated: 0.5 × 1.5 × 1.24 × 11.1² ≈ 114
  area_coeff = Constants::ANCHOR_CALCULATION_CONSTANTS[:area_coefficient]
  base_div = Constants::ANCHOR_CALCULATION_CONSTANTS[:base_divisor]
  safety_mult = Constants::ANCHOR_CALCULATION_CONSTANTS[:safety_factor]

  ((area_m2.to_f * area_coeff * safety_mult) / base_div).ceil
end