代码拉取完成,页面将自动刷新
'''
Author: your name
Date: 2021-11-30 10:19:25
LastEditTime: 2021-12-01 16:57:06
LastEditors: Please set LastEditors
Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
FilePath: \flood-evacuation-risk-assessment\SaftyAssessment.py
'''
import json
import numpy as np
#输入水深&流速,输出
def EscapeVelocity(hf, v):
height = 1.7
M = hf*v**2/9.81 + hf**2/2
vesc = 0.6639*M**-0.103
return vesc
#人体稳定性曲线
def ReadHumanStabilityCurve(fileName):
with open(fileName) as f:
data = json.load(f)
depth = data['stability']['Adult']['ctDepth']
velocity = data['stability']['Adult']['ctVelocity']
return depth, velocity
#风险程度
def CalHazardDegree(hf, u, hcurve, ucurve):
uInstability = np.interp(hf, hcurve, ucurve)
if hf < 0.2:
return 0
HD = u/uInstability
if HD > 1:
HD = 1
return HD
#计算不同位置的逃生时间
def CalEvaculationTime(depth, velocity, EscapePoint, EscapeLength, fileName):
Results = np.empty([depth.shape[0], depth.shape[1]], dtype=float)
#对于不同时间循环
Hf, Uc = ReadHumanStabilityCurve(fileName)
for i in range(0, depth.shape[0]):
for j, Lines in enumerate(EscapePoint):
tempTimeForaLine = []
for k, item in enumerate(Lines):
#获取一条逃生线段起始点的流态
hs = depth.iloc[i+1, item[0]]
he = depth.iloc[i+1, item[1]]
us = velocity.iloc[i+1, item[0]]
ue = velocity.iloc[i+1, item[0]]
esVelocity = EscapeVelocity(0.5*(hs + he), 0.5*(us +ue))
HD = CalHazardDegree(0.5*(hs + he), 0.5*(us +ue), Hf, Uc)
if HD > 0.9 and 0.5*(hs + he) > 0.3:
esTime = 9999
else:
esTime = EscapeLength[j][k] / esVelocity
tempTimeForaLine.append(esTime)
for k in range(0,len(Lines)):
#Results[Lines[k][0]-1, i] = sum(tempTimeForaLine[k+1:len(Lines)-1])
Results[i, Lines[k][0]-1] = sum(tempTimeForaLine[k:len(Lines)-1])
return Results
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。