Skip to content

ThreePhaseMethod

frads.ThreePhaseMethod

ThreePhaseMethod(config)

Bases: PhaseMethod

Three phase method implementation.

Attributes:

Name Type Description
config

A WorkflowConfig object

octree

A path to the octree file

window_senders Dict[str, SurfaceSender]

A dictionary of window sender matrices

window_receivers

A dictionary of window receiver matrices

window_bsdfs

A dictionary of window BSDF matrices

daylight_matrices

A dictionary of daylight matrices

view_window_matrices

A dictionary of view window matrices

sensor_window_matrices

A dictionary of sensor window matrices

calculate_edgps

calculate_edgps(
    view,
    bsdf,
    time,
    dni,
    dhi,
    ambient_bounce=1,
    save_hdr=None,
)

Calculate enhanced simplified daylight glare probability (EDGPs) for a view.

Parameters:

Name Type Description Default
view str

view name, must be in config.model.views

required
bsdf Dict[str, str]

a dictionary of window name as key and bsdf matrix or matrix name as value

required
time datetime

datetime object

required
dni float

direct normal irradiance

required
dhi float

diffuse horizontal irradiance

required
ambient_bounce int

ambient bounce, default to 1. Could be set to zero for macroscopic non-scattering systems.

1

Returns: EDGPs

calculate_sensor

calculate_sensor(sensor, bsdf, time, dni, dhi)

Calculate illuminance for a sensor.

Parameters:

Name Type Description Default
sensor str

The sensor name

required
bsdf Dict[str, str]

A dictionary of window name as key and bsdf matrix or matrix name as value

required
time datetime

The datetime object

required
dni float

The direct normal irradiance

required
dhi float

The diffuse horizontal irradiance

required

Returns: A float value of illuminance

calculate_sensor_from_wea

calculate_sensor_from_wea(sensor)

Calculates the sensor values from wea data.

Parameters:

Name Type Description Default
sensor str

The specific sensor for which the calculation is to be performed.

required

Returns:

Type Description
ndarray

numpy.ndarray: A matrix containing the calculated sensor values based on the Weather Attribute data, sensor configuration, and various matrices related to windows, daylight, and sky.

Raises:

Type Description
ValueError

If no wea data is available.

Examples:

sensor_values = sensor_config.calculate_sensor_from_wea("sensor_name")

calculate_view

calculate_view(view, bsdf, time, dni, dhi)

Calculate (render) a view.

Parameters:

Name Type Description Default
view str

The view name

required
bsdf ndarray

The BSDF matrix

required
time datetime

The datetime object

required
dni float

The direct normal irradiance

required
dhi float

The diffuse horizontal irradiance

required

Returns: A image as numpy array

calculate_view_from_wea

calculate_view_from_wea(view)

Calculate(render) view from wea data.

Parameters:

Name Type Description Default
view str

The view name

required

Returns: A series of HDR images as a numpy array

generate_matrices

generate_matrices(view_matrices=True)

Generate all required matrices

Parameters:

Name Type Description Default
view_matrices bool

Toggle to generate view matrices. Toggle it off can be useful for not needing the view matrices but still need the view data for things like edgps calculation.

True

load_matrices

load_matrices()

Load matrices from a .npz file in the Matrices directory.

save_matrices

save_matrices()

Saves the view window matrices, sensor window matrices, and daylight matrices to a NumPy .npz file.

The matrices are saved with keys formed by concatenating the corresponding view, sensor, or window name with '_window_matrix' or '_daylight_matrix'.