This program calculates the average irradiance at a specified height in a room based on an IES file of a light fixture placed centrally in such a room. This is used to sense check some calculations in my investigations on modelling far UVC in some rooms.
-
Create and activate the virtual environment:
On macOS/Linux:
# Make the setup script executable chmod +x setup_venv.sh # Run the setup script ./setup_venv.sh
On Windows:
# Create virtual environment python -m venv venv # Activate virtual environment .\venv\Scripts\activate # Install requirements pip install -r requirements.txt
-
To activate the virtual environment in future sessions:
- On macOS/Linux:
source venv/bin/activate - On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
-
Make sure your virtual environment is activated (you should see
(venv)in your terminal prompt) -
Place your IES file in the same directory as the script or provide the full path to the IES file.
-
Modify the parameters in the
main()function ofies_irradiance_calculator.py:ies_file_path: Path to your IES fileroom_width: Width of the room in metersroom_length: Length of the room in metersmounting_height: Height at which the light fixture is mounted in meterstarget_height: Height at which you want to calculate the average irradiance in meters
-
Run the script:
python ies_irradiance_calculator.pyThe program will output the average irradiance in micro W / cm^2 across a flat surface at a specified height.
- The program parses the IES file to extract the photometric data (W / sterradians at different values of theta, phi in the diagram above).
- It creates an interpolator to estimate candela values at any angle.
- For each point in a grid at the specified height, it:
- Calculates the distance and angles to the light fixture
- Determines the candela value at those angles
- Applies the inverse square law to calculate irradiance
- Finally, it averages the irradiance values across all points to get the average irradiance at that height.
Below is a diagram showing the geometry and formula used for irradiance calculation at a given point:
- The default grid size for calculations is 0.5 meters. You can adjust this in the
calculate_average_irradiancemethod. - The program assumes the light fixture is mounted at the center of the room.
- All measurements should be in meters.
