def protected_steel(): from sfeprapy.func.temperature_steel_section import protected_steel_eurocode as steel from sfeprapy.func.temperature_fires import standard_fire_iso834 as fire from sfeprapy.dat.steel_carbon import Thermal import matplotlib.pyplot as plt import numpy as np steel_prop = Thermal() c = steel_prop.c() rho = 7850 t, T = fire(np.arange(0, 10080, 60), 20 + 273.15) for d_p in np.arange(0.001, 0.2 + 0.02, 0.02): t_s, T_s, d = steel(time=t, temperature_ambient=T, rho_steel=rho, c_steel_T=c, area_steel_section=0.017, k_protection=0.2, rho_protection=800, c_protection=1700, thickness_protection=d_p, perimeter_protected=2.14) plt.plot(t_s, T_s, label="d_p={:5.3f}".format(d_p)) plt.legend(loc=1) plt.show()
def travelling_fire(): from sfeprapy.func.temperature_fires import travelling_fire as fire time, temperature, data = fire(T_0=293.15, q_fd=900e6, RHRf=0.15e6, l=150, w=17.4, s=0.012, h_s=3.5, l_s=105, time_step=1200, time_ubound=22080) benchmark_time = [ 0, 1200, 2400, 3600, 4800, 6000, 7200, 8400, 9600, 10800, 12000, 13200, 14400, 15600, 16800, 18000, 19200, 20400, 21600, 22800 ] benchmark_temperature = [ 293, 374, 428, 481, 534, 592, 643, 722, 870, 1288, 1323, 1071, 773, 592, 454, 293, 293, 293, 293, 293 ] # Load data # Calculate least square against the referenced data x1 = time y1 = temperature x2 = benchmark_time y2 = benchmark_temperature print('Check least squares < 10: {}'.format( least_square(x1, y1, x2, y2) < 10))
def iso834(): import pandas as pd from sfeprapy.func.temperature_fires import standard_fire_iso834 as fire import numpy as np t = np.arange(0, 30*60, 5) res = {} res["TIME"], res["TEMPERATURE"] = fire(t, 273.15) res["TEMPERATURE"] -= 273.15 df = pd.DataFrame(res) df.to_csv("out.csv", index=False)
def t_square(): import pandas as pd import numpy as np from sfeprapy.func.temperature_fires import t_square as fire growth = "fast" cap_time = 300 dict_res = dict() dict_res["TIME [s]"] = np.arange(0, 30*60, 5) dict_res["HRR [kW]"] = fire(dict_res["TIME [s]"], growth, cap_hrr_to_time=cap_time) / 1000 df = pd.DataFrame(dict_res) df = df[["TIME [s]", "HRR [kW]"]] df.to_csv("fire "+growth+str(cap_time)+".csv", index=False)
def protected_steel2(): """ This test is for protected steel in eurocode under parametric fire curve. """ import copy import matplotlib.pyplot as plt from sfeprapy.func.temperature_fires import parametric_eurocode1 as fire from sfeprapy.func.temperature_steel_section import protected_steel_eurocode as steel from sfeprapy.dat.steel_carbon import Thermal steel_prop = Thermal() c = steel_prop.c() rho = steel_prop.rho() kwargs_fire = { "A_t": 360, "A_f": 100, "A_v": 72, "h_eq": 1, "q_fd": 600e6, "lambda_": 1, "rho": 1, "c": 2250000, "t_lim": 20 * 60, "time_end": 2 * 60 * 60, "time_step": 1, "time_start": 0, "temperature_initial": 293.15 } time_fire, temp_fire = fire(**kwargs_fire) kwargs_steel = { "time": time_fire, "temperature_ambient": temp_fire, "rho_steel_T": rho, "c_steel_T": c, "area_steel_section": 0.017, "k_protection": 0.2, "rho_protection": 800, "c_protection": 1700, "thickness_protection": 0.01, "perimeter_protected": 2.14 } time_steel, temp_steel, c = steel(**kwargs_steel) plt.plot(time_fire, temp_fire) plt.plot(time_steel, temp_steel) plt.show()
def travelling_fire(): from sfeprapy.func.temperature_fires import travelling_fire as fire import matplotlib.pyplot as plt import numpy as np time, temperature, data = fire( T_0=293.15, q_fd=900e6, RHRf=0.15e6, l=150, w=17.4, s=0.012, h_s=3.5, l_s=105, time_step=60, time_ubound=22080 ) fig, ax = plt.subplots() ax.plot(time/60, temperature-273.15) ax.set_xlabel('Time [min]') ax.set_ylabel('Temperature [C]') ax.set_xticks(np.arange(0, 361, 30)) ax.set_yticks(np.arange(0, 1201, 100)) plt.show()
def parametric_fire(): import copy import numpy as np import matplotlib.pyplot as plt from sfeprapy.func.temperature_fires import parametric_eurocode1 as fire kwargs = {"A_t": 360, "A_f": 100, "A_v": 72, "h_eq": 1, "q_fd": 600e6, "lambda_": 1, "rho": 1, "c": 2250000, "t_lim": 20*60, "time_end": 2*60*60, "time_step": 1, "time_start": 0, "temperature_initial": 293.15} fig, ax = plt.subplots() for i in [72, 50.4, 36.000000001, 32.4, 21.6, 14.4, 7.2]: if i == 36: print("stop") kwargs["A_v"] = i x, y = fire(**copy.copy(kwargs)) ax.plot(x/60, y-273.15, label="O={:03.2f}".format(kwargs["A_v"]*kwargs["h_eq"]**0.5/kwargs["A_t"])) ax.set_xlabel('Time [min]') ax.set_ylabel('Temperature [C]') ax.set_xticks(np.arange(0, 121, 10)) ax.set_yticks(np.arange(0, 1201, 100)) ax.grid(True) plt.legend(loc=1) plt.show() return 0
def test_eurocode_parametric_fire(): """ NAME: _test_eurocode_parametric_fire AUTHOR: yan fu VERSION: 0.0.1 DATE: 1 Oct 2018 DESCRIPTION: This function verifies sfeprapy.func.temperature_fires.parametric_eurocode1 based on figure 7 in the referenced document below. Holicky, M., Meterna, A., Sedlacek, G. and Schleich, J.B., 2005. Implementation of eurocodes, handbook 5, design of buildings for the fire situation. Leonardo da Vinci Pilot Project: Luxemboug. :return: """ import copy, pandas, os import numpy as np from sfeprapy.func.temperature_fires import parametric_eurocode1 as fire kwargs = { "A_t": 360, "A_f": 100, # "A_v": 72, "h_eq": 1, "q_fd": 600e6, "lambda_": 1, "rho": 1, "c": 2250000, "t_lim": 20 * 60, "time_end": 2 * 60 * 60, "time_step": 1, "time_start": 0, "temperature_initial": 293.15 } # define opening area A_v_list = [72, 50.4, 36.000000001, 32.4, 21.6, 14.4, 7.2] # Calculate fire curves x1_list = [] # calculated time array y1_list = [] # calculated temperature array for i in A_v_list: x, y = fire(A_v=i, **copy.copy(kwargs)) x += 10 * 60 x1_list.append(x / 60) y1_list.append(y - 273.15) # Validation data # Load data verification_data = pandas.read_csv( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ec_parametric_fire_verification_data.csv')) # Calculate least square against the referenced data for i in range(len(A_v_list)): x1 = x1_list[i] y1 = y1_list[i] x2 = verification_data['time_{}'.format(int(i + 1))] y2 = verification_data['temperature_{}'.format(int(i + 1))] assert least_square(x1, y1, x2, y2) < 100 return 0