vaws.model package

vaws.model.config module

Config module

This module defines basic parameter values for simulation.

vaws.model.config.OUTPUT_DIR

“output”

vaws.model.config.INPUT_DIR

“input”

vaws.model.config.DEBRIS_DATA

“input/debris”

vaws.model.config.GUST_PROFILES_DATA

“input/gust_envelope_profiles”

vaws.model.config.HOUSE_DATA

“input/house”

vaws.model.config.FILE_HOUSE_DATA

‘house_data.csv’

vaws.model.config.FILE_CONN_GROUPS

‘conn_groups.csv’

vaws.model.config.FILE_CONN_TYPES

‘conn_types.csv’

vaws.model.config.FILE_CONNECTIONS

‘connections.csv’

vaws.model.config.FILE_ZONES

‘zones.csv’

vaws.model.config.FILE_COVERAGE_TYPES

‘coverage_types.csv’

vaws.model.config.FILE_COVERAGES

‘coverages.csv’

vaws.model.config.FILE_COVERAGES_CPE

‘coverages_cpe.csv’

vaws.model.config.FILE_INFLUENCES

‘influences.csv’

vaws.model.config.FILE_INFLUENCE_PATCHES

‘influence_patches.csv’

vaws.model.config.FILE_DAMAGE_COSTING_DATA

‘damage_costing_data.csv’

vaws.model.config.FILE_DAMAGE_FACTORINGS

‘damage_factorings.csv’

vaws.model.config.FILE_WATER_INGRESS_COSTING_DATA

‘water_ingress_costing_data.csv’

vaws.model.config.FILE_FOOTPRINT

‘footprint.csv’

vaws.model.config.FILE_FRONT_FACING_WALLS

‘front_facing_walls.csv’

# debris data
vaws.model.config.FILE_DEBRIS

‘debris.csv’

# results
vaws.model.config.FILE_RESULTS

‘results.h5’

Note

  • regional shielding may be indirectly disabled by setting ‘regional_shielding_factor’ to 1.0
  • differential shielding may be indirectly disabled by setting ‘building_spacing’ to 0
class vaws.model.config.Config(file_cfg=None, logger=None)[source]

Bases: object

Config class to set configuration for simulation

# model dependent attributes
house_bucket =

list

att_non_float =

list

house_bucket =

list

debris_bucket =

list

# model and wind dependent attributes
list_components =

list

group_bucket =

list

connection_bucket

list

zone_bucket

list

coverage_bucket

list

dic_obj_for_fitting

dict

att_time_invariant

list

connection_bucket = [('damaged', 1), ('capacity', 0), ('load', 1), ('strength', 0), ('dead_load', 0)]
coverage_bucket = [('strength_negative', 0), ('strength_positive', 0), ('momentum_capacity', 0), ('capacity', 0), ('load', 1), ('breached', 1), ('breached_area', 1)]
debris_bucket = [('mass', 1), ('frontal_area', 1), ('flight_time', 1), ('momentum', 1), ('flight_distance', 1), ('impact', 1)]
dic_obj_for_fitting = {'lognorm': 'vulnerability_lognorm', 'weibull': 'vulnerability_weibull'}
static get_diff_tuples(row, key1, key2)[source]
static get_lognormal_tuple(row, dic_, key)[source]
group_bucket = [('damaged_area', 1), ('prop_damaged', 1)]
header_for_cpe = ['name', 0, 1, 2, 3, 4, 5, 6, 7]
house_bucket = [('profile_index', 0), ('wind_dir_index', 0), ('terrain_height_multiplier', 0), ('shielding_multiplier', 0), ('qz', 1), ('cpi', 1), ('collapse', 0), ('di', 1), ('di_except_water', 1), ('repair_cost', 1), ('repair_cost_by_scenario', 1), ('water_ingress_cost', 1), ('window_breached', 1), ('no_debris_items', 1), ('no_debris_impacts', 1), ('breached_area', 1), ('mean_no_debris_items', 1)]
list_components = ['group', 'connection', 'zone', 'coverage', 'debris']
process_config()[source]
classmethod process_read_file_connections(dump, types)[source]
static read_column_separated_entry(value)[source]
read_config()[source]
static read_damage_costing_data(filename)[source]
Parameters:filename

Returns:

Note: damage costing data may contain

static read_damage_factorings(filename)[source]

Read damage factorings

Parameters:filename – damage_factorings.csv

Returns: dict

read_debris(conf, key)[source]
classmethod read_file_connections(file_connections)[source]
classmethod read_file_zones(file_zones)[source]
read_fragility_thresholds(conf, key)[source]
static read_front_facing_walls(filename)[source]
read_heatmap(conf, key)[source]
static read_influence_patches(filename)[source]

Read influence patches

Parameters:filename – influence_patches.csv

Returns: dict

static read_influences(filename)[source]

Read influence coefficients

Parameters:filename – influences.csv

Returns: dict

read_main(conf, key)[source]
Parameters:
  • conf
  • key

Returns:

read_options(conf, key)[source]
read_wall_collapse(conf, key)[source]

read roof to wall connections related parameters :param conf: :param key:

Returns:

read_water_ingress(conf, key)[source]

read water ingress related parameters :param conf: :param key:

Returns:

TODO:

static read_water_ingress_costing_data(filename)[source]
static return_centroid(row)[source]
static return_norm_cdf(row)[source]
Parameters:row

Returns:

save_config(filename=None)[source]
set_connections(df_types, df_groups)[source]
set_costings(df_groups)[source]
set_coverages()[source]
set_coverages_cpe()[source]
set_debris_types()[source]
set_debris_vulnerability()[source]
set_footprint()[source]
set_fragility_thresholds()[source]
set_front_facing_walls()[source]
set_groups()[source]
set_house()[source]
set_influence_patches()[source]
set_influences()[source]
set_output_files()[source]
set_region_name(value)[source]
set_types()[source]
set_water_ingress()[source]
set_water_ingress_costings()[source]
set_wind_dir_index()[source]
set_wind_profiles()[source]
set_wind_speeds()[source]
set_zones()[source]
zone_bucket = [('pressure_cpe', 1), ('pressure_cpe_str', 1), ('cpe', 0), ('cpe_str', 0), ('cpe_eave', 0), ('differential_shielding', 0)]

vaws.model.connection module

Connection module

This module contains Connection class, ConnectionTypeGroup class, and Influence class.

class vaws.model.connection.Connection(name=None, logger=None, **kwargs)[source]

Bases: object

check_damage(wind_speed)[source]
wind_speed:

Returns:

dead_load

Returns – sample of dead load following lognormal dist.

influence_patch

return:

influences

return:

strength

return: a sampled strength from lognormal distribution

update_influence(source_connection, influence_coeff)[source]
Parameters:
  • source_connection – source connection (sheeting)
  • influence_coeff

Returns: load

class vaws.model.connection.ConnectionTypeGroup(name=None, logger=None, **kwargs)[source]

Bases: object

check_damage(wind_speed)[source]
Parameters:wind_speed – wind speed

Returns:

connection_by_grid
connections
damage_grid
damaged_area

Returns – prop_damaged_group, prop_damaged_area

prop_damaged

Returns – prop_damaged_group, prop_damaged_area

update_influence(house_inst)[source]
Parameters:house_inst – instance of House class

Returns:

Notes

influence_patch will be applied regardless of patch_dist influence coeff will be distributed only if patch_dist == 0 dist_dir == ‘col’: coeff will be distributed over the same char. dist_dir == ‘row’: coeff will be distributed over the same number row: chr, col: number

static update_influence_by_patch(damaged_connection, house_inst)[source]
Parameters:
  • damaged_connection – damaged_connection
  • house_inst – instance of House class

Returns:

class vaws.model.connection.Influence(name=None, coeff=None)[source]

Bases: object

source
vaws.model.connection.compute_load_by_zone(flag_pressure, dic_influences)[source]
Parameters:
  • flag_pressure
  • dic_influences
Returns:

vaws.model.coverage module

Coverage Module

This module contains Coverage class.

class vaws.model.coverage.Coverage(name=None, logger=None, **kwargs)[source]

Bases: vaws.model.zone.Zone

breached_area
check_damage(qz, cpi, combination_factor, wind_speed)[source]
Parameters:
  • qz
  • cpi
  • combination_factor
  • wind_speed
Returns:

momentum_capacity
strength_negative
strength_positive

vaws.model.curve module

Curve module

This module contains functions related to fragility and vulnerability curves.

vaws.model.curve.compute_pe(row, denom)[source]
vaws.model.curve.fit_fragility_curves(cfg, dmg_idx)[source]
Parameters:
  • cfg
  • dmg_idx – numpy array

Returns: dict with keys of damage state

vaws.model.curve.fit_fragility_curves_using_mle(cfg, df_dmg_idx)[source]
Parameters:
  • cfg
  • df_dmg_idx

Returns: dict with keys of damage state

vaws.model.curve.fit_vulnerability_curve(cfg, df_dmg_idx)[source]
Parameters:
  • cfg
  • df_dmg_idx

Returns: dict of fitted_curve

vaws.model.curve.likelihood(param, data, idx)[source]
Parameters:
  • param – med, std
  • data – pd.DataFrame with speed(index), pe1, pe2, pe3, pe4
  • idx – index from 1 to 4
Returns:

vaws.model.curve.no_within_bounds(row, bounds)[source]
vaws.model.curve.vulnerability_lognorm(x, med, std)[source]

Return vulnerability in lognormal CDF

Parameters:
  • x – 3sec gust wind speed at 10m height
  • med – exp(mean of log x)
  • std – standard deviation of log x

Returns: lognorm.cdf(x, std, loc=0, scale=med)

vaws.model.curve.vulnerability_lognorm_pdf(x, med, std)[source]

Return PDF of vulnerability curve in Lognormal

Parameters:
  • x – 3sec gust wind speed at 10m height
  • med – exp(mean of log x)
  • std – standard deviation of log x

Returns: lognorm.pdf(x, std, loc=0, scale=med)

vaws.model.curve.vulnerability_weibull(x, alpha, beta)[source]

Return vulnerability in Weibull CDF

Parameters:
  • x – 3sec gust wind speed at 10m height
  • alpha – parameter value used in defining vulnerability curve
  • beta – ditto

Returns: weibull_min.cdf(x, shape, loc=0, scale)

Note

weibull_min.pdf = c/s * (x/s)**(c-1) * exp(-(x/s)**c)
c: shape, s: scale, loc=0

weibull_min.cdf = 1 - exp(-(x/s)**c)

while Australian wind vulnerability is defined as

DI = 1 - exp(-(x/exp(beta))**(1/alpha))

therefore:

s = exp(beta) c = 1/alpha
vaws.model.curve.vulnerability_weibull_pdf(x, alpha, beta)[source]

Return PDF of vulnerability curve in Weibull

Parameters:
  • x – 3sec gust wind speed at 10m height
  • alpha – parameter value used in defining vulnerability curve
  • beta – ditto

Returns: weibull_min.cdf(x, shape, loc=0, scale)

vaws.model.damage_costing module

Damage Costing Module - costing profiles for a “type of damage”
  • loaded from the database
  • imported from house
  • referenced by damage module to cost damages
class vaws.model.damage_costing.Costing(name=None, **kwargs)[source]

Bases: object

compute_cost(x)[source]
envelope_repair
internal_repair
static type1(x, c1, c2, c3)[source]
Parameters:
  • x – damage ratio between 0 and 1
  • c1 – coefficients
  • c2
  • c3

Returns: c1*x**2 + c2*x + c3

static type2(x, c1, c2, c3)[source]
Parameters:
  • x – damage ratio between 0 and 1
  • c1 – coefficients
  • c2
  • c3

Returns: c1*x**c2

class vaws.model.damage_costing.WaterIngressCosting(name=None, **kwargs)[source]

Bases: object

compute_cost(x)[source]
cost
vaws.model.damage_costing.compute_water_ingress_given_damage(damage_index, wind_speed, water_ingress)[source]
Parameters:
  • damage_index
  • wind_speed
  • water_ingress – pd.DataFrame

Returns:

vaws.model.debris module

Debris Module - adapted from JDH Consulting and Martin’s work
  • An instance of Debris class represents a debris item
  • generate sources of debris.
  • generate debris items from those sources.
  • track items and sample target collisions.
  • handle collisions (impact)
class vaws.model.debris.Debris(debris_source, debris_type, debris_property, wind_speed, rnd_state, logger=None, flag_poly=2)[source]

Bases: object

cdav
check_coverages(coverages, prob_coverages)[source]
check_impact(footprint, boundary)[source]
compute_coeff_beta_dist()[source]

Returns: parameters of beta distribution

Notes

The ratio of horizontal velocity of the windborne debris object to the wind gust velocity is related to the horizontal distance travelled, x as below

um/vs approx.= 1-exp(-b*sqrt(x))

where um: horizontal velocity of the debris object
vs: local gust wind speed x: horizontal distance travelled b: a parameter, sqrt(rho*CD*A/m)

The ratio is assumed to follow a beta distribution with mean, and

flight_distance

Returns – flight distance based on the methodology in Appendix of Lin and Vanmarcke (2008)

Notes

The coefficients of fifth order polynomials are from

Lin and Vanmarcke (2008), while quadratic form are proposed by Martin.

flight_time
frontal_area
landing
mass
momentum

Returns – momentum of debris object

Notes

The ratio of horizontal velocity of the windborne debris object to the wind gust velocity is related to the horizontal distance travelled, x as below

um/vs approx.= 1-exp(-b*sqrt(x))

where um: horizontal velocity of the debris object
vs: local gust wind speed x: horizontal distance travelled b: a parameter, sqrt(rho*CD*A/m)

The ratio is assumed to follow a beta distribution with mean, and

trajectory
vaws.model.debris.check_impact_by_debris(debris_item, footprint, boundary)[source]
Parameters:
  • debris_item
  • footprint
  • boundary
Returns:

vaws.model.debris.create_sources(radius, angle, bldg_spacing, flag_staggered, restrict_y_cord=False)[source]

define a debris generation region for a building :param radius: :param angle: (in degree) :param bldg_spacing: :param flag_staggered: :param restrict_y_cord:

# FIXME !! NO VALUE is assigned to restrict_yord

Returns:

vaws.model.debris.generate_debris_items(cfg, mean_no_debris_items, wind_speed, rnd_state)[source]
Parameters:
  • cfg – instance of Config
  • mean_no_debris_items – mean no. of debris items
  • wind_speed – wind speed
  • rnd_state – instance of mtrand.RandomState
Returns:

vaws.model.house module

class vaws.model.house.House(cfg, seed, logger=None)[source]

Bases: object

apply_damage_factoring(area_by_group)[source]
assign_costing(damage_scenario)[source]
Parameters:damage_scenario

Returns:

assign_windward(wall_name)[source]
Parameters:wall_name
Returns:
breached_area
check_house_collapse(wind_speed)[source]
Parameters:wind_speed

Returns: collapse of house

combination_factor

AS/NZS 1170.2 action combination factor, Kc reduction when wind pressures from more than one building surface, e.g., walls and roof

compute_area_by_group()[source]
compute_area_by_scenario(revised_area)[source]
compute_damage_index(wind_speed)[source]
Parameters:wind_speed
Returns:repair cost / replacement cost
Return type:damage_index

Note

  1. compute sum of damaged area by group
  2. revised damage area by group by applying damage factoring
  3. calculate sum of revised damaged area by damage scenario
  4. apply costing modules
compute_qz(wind_speed)[source]

calculate qz, velocity pressure given wind velocity qz = 1/2*rho_air*(V*Mz,cat*Ms)**2 * 1.0e-3 (kN) :param wind_speed: wind velocity (m/s)

Returns:qz
compute_water_ingress_cost(damage_name, water_ingress_perc)[source]
cpi
damage_increment
debris_coverages
debris_coverages_area
debris_coverages_area_ratio
debris_momentums

list of momentums of generated debris items

determine_scenario_for_water_ingress_costing(prop_area_by_scenario)[source]
fill_bucket()[source]
footprint

create house footprint by wind direction Note that debris source model is generated assuming wind blows from East.

Returns:self.footprint
front_facing_walls
init_bucket()[source]
leeward_walls
mean_no_debris_items

dN = f * dD where

dN: incr. number of debris items, dD: incr in vulnerability (or damage index) f : a constant factor

if we use dD/dV (pdf of vulnerability), then dN = f * (dD/dV) * dV

Returns:
no_debris_impacts

total number of impacted debris items

no_debris_items

total number of generated debris items

profile_index
run_debris_and_update_cpi(wind_speed)[source]
Parameters:wind_speed
Returns:self.cpi self.cpi_wind_speed
run_simulation(wind_speed)[source]
set_connections()[source]
set_coverages()[source]
set_house_data()[source]
set_zones()[source]
shielding_multiplier

AS4055 (Wind loads for housing) defines the shielding multiplier for full, partial and no shielding as 0.85, 0.95 and 1.0, respectively.

Based on the JDH report, the following percentages are recommended for the shielding of houses well inside Australian urban areas:

Full shielding: 63%, Partial shielding: 15%, No shielding: 22%.

Note that regional shielding factor is less or equal to 0.85, then it model buildings are considered to be in Australian urban area.

side1_walls
side2_walls
terrain_height_multiplier
total_area_by_group
wind_dir_index
window_breached
windward_walls

vaws.model.main module

vaws.model.main.compute_damage_increment(cfg, bucket, ispeed)[source]
vaws.model.main.init_bucket(cfg)[source]
vaws.model.main.main()[source]
vaws.model.main.process_commandline()[source]
vaws.model.main.save_results_to_files(cfg, bucket)[source]
Parameters:
  • cfg
  • bucket

Returns:

vaws.model.main.set_logger(path_cfg, logging_level=None)[source]

debug, info, warning, error, critical

vaws.model.main.simulate_wind_damage_to_houses(cfg, call_back=None)[source]
Parameters:
  • cfg – instance of Config class
  • call_back – used by gui
Returns:

float: elapsed time bucket: list: list of results

Return type:

elapsed

vaws.model.main.update_bucket(cfg, bucket, results_by_speed, ispeed)[source]

vaws.model.output module

output.py - output module, postprocess and plot display engine

vaws.model.output.draw_influence(cfg, infl_dic, dic_ax, conn_name)[source]
vaws.model.output.plot_heatmap(grouped, values, vmin, vmax, vstep, xlim_max, ylim_max, file_name=None)[source]
Parameters:
  • grouped – pd.DataFrame (x_coord, y_coord, width, height)
  • values – np.array(N,1)
  • vmin – min. of scale in color bar
  • vmax – max. of scale in color bar
  • vstep – no. of scales in color bar
  • file_name – file to save

Returns:

vaws.model.output.plot_influence(cfg, conn_name, file_name=None)[source]
vaws.model.output.set_axis_etc(ax, xlim_max, ylim_max)[source]

vaws.model.stats module

vaws.model.stats.calc_big_a_b_values(shape_k)[source]
Parameters:
  • shape_k – parameter k of GEV III (JHD)
  • CDF
  • = u + a*A, s = a * B (m) –
  • m (where) – mean, s: std, u: location factor, a:scale factor
  • = (B) –
  • =

Returns: A, B

vaws.model.stats.calc_parameters_gev(mean_est, cov_est, big_a, big_b)[source]
Parameters:
  • mean_est – estimated mean (can be negative)
  • cov_est – cov
  • big_a – A value
  • big_b – B value
  • CDF
  • m = u+a*A, s = a*B, cov = s/m (where) –
  • = m*cov/B, u = m-a*A (a) –

Returns:

vaws.model.stats.compute_arithmetic_mean_stddev(m, stddev)[source]

compute arithmetic mean and std of x

Parameters:
  • m – mean of log x
  • stddev – std of log x

Returns: arithmetic mean, std of x

vaws.model.stats.compute_logarithmic_mean_stddev(m, stddev)[source]

compute mean of log x with mean and std. of x :param m: arithmetic mean of x :param stddev: arithmetic standard deviation of x :param mu = 2*log: :type mu = 2*log: m) - 0.5*log(v + m**2 :param std = sqrt: :type std = sqrt: log(V/m**2 +1) :param if m is zero, then return -999, 0.0:

Returns: mean and std of log x

vaws.model.stats.sample_gev(mean_est, cov_est, shape_k, big_a, big_b, rnd_state=None)[source]

JHD F(u) = exp{-[1-k(U-u)/a]**(1/k)} where a: scale factor, u: location factor k < 0: Type II (Frechet), k > 0: Type III (Weibull)

scipy.stats.genextreme.rvs(c, loc=0, scale=1, size=1, random_state=None) c: shape (or k)

Parameters:
  • mean_est
  • big_a
  • big_b
  • cov_est
  • shape_k
  • rnd_state – None, integer or np.random.RandomState

Returns: random sample from the extreme value distribution Type III

vaws.model.stats.sample_lognorm_given_mean_stddev(m, stddev, rnd_state)[source]

generate rv following lognorm dist :param m: mean of x :param stddev: std of x :param rnd_state: np.random.RandomState :param size: size of rv (default: 1)

Returns:

vaws.model.stats.sample_lognormal(mu_lnx, std_lnx, rnd_state)[source]

draw a sample from a lognormal distribution with mu, std of logarithmic x If std is zero, just return exp(mu_lnx)

Parameters:
  • mu_lnx – mean of log x
  • std_lnx – std of log x
  • rnd_state – numpy.random.RandomState

Returns:

vaws.model.version module

Single point of truth for version information

vaws.model.zone module

Zone Module - reference storage
  • loaded from database.
  • imported from ‘../data/houses/subfolder/zones.csv’
  • holds zone area and CPE means.
  • holds runtime sampled CPE per zone.
  • calculates Cpe pressure load from wind pressure.
class vaws.model.zone.Zone(name=None, **kwargs)[source]

Bases: object

calc_zone_pressure(cpi, qz, combination_factor)[source]

Determine wind pressure loads (Cpe) on each zone (to be distributed onto connections)

Parameters:
  • cpi – internal pressure coefficient
  • qz – free stream wind pressure
  • combination_factor – action combination factor
Returns:

zone pressure

Return type:

pressure

cpe

Sample external Zone pressures for sheeting based on TypeIII General Extreme Value distribution

cpe_eave

Sample external Zone Pressures for eaves Cpe, based on TypeIII General Extreme Value distribution

cpe_str

Sample external Zone Pressures for structure based on TypeIII General Extreme Value distribution

differential_shielding

The following recommendations for differential shielding for buildings deemed to be subject to full shielding are made:

  • For outer suburban situations and country towns (building_spacing=40m):
    Neglect shielding effects (self.shielding_multiplier=1.0), except for the leading edges of upwind roofs. For the latter an implied pressure ratio of Ms^2 (equal to 0.85^2 for the full shielding cases (Ms=0.85), and 0.95^2 for partial shielding cases (Ms=0.95)) can be adopted.
  • For inner suburban buildings (building_spacing=20m) with full shielding (Ms=0.85):
    Reduce the shielding multiplier to 0.7 for upwind roof areas, except adjacent to the ridge (implying a pressure reduction factor of 0.49). Retain a nominal value of Ms of 0.85 for all other surfaces.
  • For inner suburban buildings (building_spacing=20m) deemed to have partial shielding (Ms=0.95):
    Reduce the shielding multiplier to 0.8 for upwind roof areas, except adjacent to the ridge (implying a pressure reduction factor of 0.64). Retain a nominal value of Ms of 0.95 for all other surfaces.

differential_shielding_factor = Ms,adj**2 / Ms ** 2

vaws.model.zone.get_grid_from_zone_location(_zone_name)[source]

Extract 0 based grid refs from string location (eg ‘A10’ to 0, 9)

vaws.model.zone.get_zone_location_from_grid(_zone_grid)[source]

Create a string location (eg ‘A10’) from zero based grid refs (col=0, row=9)

Parameters:_zone_grid – tuple

Returns: string location

vaws.model.zone.num2str(n)[source]

n: number return string

vaws.model.zone.str2num(s)[source]

s: string return number