Exemplo n.º 1
0
def get_light_pass(L, B, h):
    if (h == 0):
        B_h = 0
    else:
        B_h = B / h
    B_h = common.get_nearest(B_h, list(__lightpass_table.keys()))
    L_B = common.get_nearest(L / B, __lightpass_table[B_h].keys())
    return __lightpass_table[B_h][L_B]
Exemplo n.º 2
0
def get_light_utilization(A, B, h):
    I = (A * B) / (h * (A + B))
    I = common.get_nearest(I, [
        0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 3.5,
        4.0, 5.0
    ])
    return {
        0.5: 26,
        0.6: 30,
        0.7: 34,
        0.8: 38,
        0.9: 40,
        1.0: 43,
        1.1: 46,
        1.25: 48,
        1.5: 54,
        1.75: 57,
        2.0: 60,
        2.25: 62,
        2.5: 64,
        3.0: 68,
        3.5: 70,
        4.0: 72,
        5.0: 75
    }[I] / 100
Exemplo n.º 3
0
def get_windows(Sv):
    standard_width = sorted(Windows.widths)
    standard_heigth = sorted(Windows.heights)
    side = math.sqrt(Sv)
    if (side <= standard_heigth[-1]):
        height = common.get_nearest(side, standard_heigth)
        standard_area = list(map(lambda w: w * height, standard_width))
        area = common.get_nearest(Sv, standard_area)
        index = standard_area.index(area)
        width = standard_width[index]
        return (1, width, height)

    height = standard_width[-1]
    total_width = Sv / height
    standard_total_width = list(
        map(lambda w: w * math.ceil(total_width / w), standard_width))
    total = common.get_nearest(total_width, standard_total_width)
    index = standard_total_width.index(total)
    width = standard_width[index]
    return (math.ceil(total_width / width), width, height)
Exemplo n.º 4
0
def __get_kpo(work: Work, width, depth, w_top_height, w_bottom_height,
              front_windows, left_windows, right_windows):
    front_area = __get_window_area(w_top_height, w_bottom_height,
                                   front_windows)
    left_area = __get_window_area(w_top_height, w_bottom_height, left_windows)
    right_area = __get_window_area(w_top_height, w_bottom_height,
                                   right_windows)
    print('Перевірка освітленності для {0} м² вікон'.format(
        round(front_area + left_area + right_area, 2)))
    kpo = __get_total_KPO(width, depth, w_top_height, w_bottom_height,
                          front_windows, left_windows, right_windows)
    print('Освітленність становить: {0} %'.format(round(kpo, 2)))
    result = common.get_nearest(kpo, list(map(lambda w: w.day, Works.all())))
    if (result < work.day):
        print('Освітленність не відповідає вимогам: {0} %'.format(work.day))
    elif (result > work.day):
        print('Освітленність вища за вимоги: {0} %'.format(work.day))
    else:
        print('Освітленність відповідає вимогам')
    return result
Exemplo n.º 5
0
def get_reflection(L, B, h, cp):
    l = B / 2 if cp == 'window' else B - 1
    B_h = __get_B_h(B, h)
    L_B = __get_L_B(L, B)
    l_B = common.get_nearest(l / B, list(__reflection_table[B_h].keys()))
    return __reflection_table[B_h][l_B][L_B]
Exemplo n.º 6
0
 def test_get_nearest_right_side(self):
     nearest = common.get_nearest(100, [10, 20, 30])
     self.assertEqual(nearest, 30)
Exemplo n.º 7
0
 def test_get_nearest_left_side(self):
     nearest = common.get_nearest(1, [10, 20, 30])
     self.assertEqual(nearest, 10)
Exemplo n.º 8
0
 def test_get_nearest_in_middle(self):
     nearest = common.get_nearest(25, [10, 20, 30, 40])
     self.assertEqual(nearest, 30)
Exemplo n.º 9
0
 def test_get_nearest_from_right(self):
     nearest = common.get_nearest(29, [10, 20, 30, 40])
     self.assertEqual(nearest, 30)
Exemplo n.º 10
0
 def test_get_nearest_from_left(self):
     nearest = common.get_nearest(21, [10, 20, 30, 40])
     self.assertEqual(nearest, 20)
Exemplo n.º 11
0
 def test_get_nearest_right_item(self):
     nearest = common.get_nearest(30, [10, 20, 30, 40])
     self.assertEqual(nearest, 30)