bifacial-radiance 0.5.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bifacial_radiance/HPCScripts/BasicSimulations/addNewModule.py +15 -0
- bifacial_radiance/HPCScripts/BasicSimulations/dask_on_node.sh +11 -0
- bifacial_radiance/HPCScripts/BasicSimulations/run_sbatch.sbatch +51 -0
- bifacial_radiance/HPCScripts/BasicSimulations/simulate_fixedtilt_gencumsky.py +110 -0
- bifacial_radiance/HPCScripts/BasicSimulations/simulate_fixedtilt_gendaylit.py +102 -0
- bifacial_radiance/HPCScripts/BasicSimulations/simulate_tracking_gendaylit.py +126 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/PuertoRico.py +168 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/PuertoRico_2.py +166 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/PuertoRico_Original.py +195 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/basic_module_sampling.py +154 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_B.py +162 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_Cases.py +122 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_CasesMonth.py +142 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_PRNew.py +91 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_PRNewP2.py +95 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_TreeResults.py +108 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/compile_basic_module_sampling.py +103 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/simulate_JackHourly.py +160 -0
- bifacial_radiance/HPCScripts/Other Examples (unorganized)/simulate_improvedArray_Oct2127.py +623 -0
- bifacial_radiance/TEMP/.gitignore +4 -0
- bifacial_radiance/__init__.py +24 -0
- bifacial_radiance/data/CEC Modules.csv +16860 -0
- bifacial_radiance/data/default.ini +65 -0
- bifacial_radiance/data/falsecolor.exe +0 -0
- bifacial_radiance/data/gencumsky/License.txt +54 -0
- bifacial_radiance/data/gencumsky/Makefile +17 -0
- bifacial_radiance/data/gencumsky/README.txt +9 -0
- bifacial_radiance/data/gencumsky/Solar Irradiation Modelling.doc +0 -0
- bifacial_radiance/data/gencumsky/Sun.cpp +118 -0
- bifacial_radiance/data/gencumsky/Sun.h +45 -0
- bifacial_radiance/data/gencumsky/average_val.awk +3 -0
- bifacial_radiance/data/gencumsky/cPerezSkyModel.cpp +238 -0
- bifacial_radiance/data/gencumsky/cPerezSkyModel.h +57 -0
- bifacial_radiance/data/gencumsky/cSkyVault.cpp +536 -0
- bifacial_radiance/data/gencumsky/cSkyVault.h +86 -0
- bifacial_radiance/data/gencumsky/climateFile.cpp +312 -0
- bifacial_radiance/data/gencumsky/climateFile.h +37 -0
- bifacial_radiance/data/gencumsky/cumulative.cal +177 -0
- bifacial_radiance/data/gencumsky/cumulative.rad +14 -0
- bifacial_radiance/data/gencumsky/cumulativesky_rotated.rad +2 -0
- bifacial_radiance/data/gencumsky/gencumulativesky +0 -0
- bifacial_radiance/data/gencumsky/gencumulativesky.cpp +269 -0
- bifacial_radiance/data/gencumsky/make_gencumskyexe.py +107 -0
- bifacial_radiance/data/gencumsky/paths.h +62 -0
- bifacial_radiance/data/gencumulativesky +0 -0
- bifacial_radiance/data/gencumulativesky.exe +0 -0
- bifacial_radiance/data/ground.rad +83 -0
- bifacial_radiance/data/module.json +103 -0
- bifacial_radiance/gui.py +1696 -0
- bifacial_radiance/images/fig1_fixed_small.gif +0 -0
- bifacial_radiance/images/fig2_tracked_small.gif +0 -0
- bifacial_radiance/load.py +1156 -0
- bifacial_radiance/main.py +5673 -0
- bifacial_radiance/mismatch.py +461 -0
- bifacial_radiance/modelchain.py +299 -0
- bifacial_radiance/module.py +1427 -0
- bifacial_radiance/performance.py +466 -0
- bifacial_radiance/spectral_utils.py +555 -0
- bifacial_radiance-0.5.1.dist-info/METADATA +129 -0
- bifacial_radiance-0.5.1.dist-info/RECORD +63 -0
- bifacial_radiance-0.5.1.dist-info/WHEEL +6 -0
- bifacial_radiance-0.5.1.dist-info/licenses/LICENSE +30 -0
- bifacial_radiance-0.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import bifacial_radiance
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
testfolder = 'TEMP'
|
|
5
|
+
|
|
6
|
+
if not os.path.exists(testfolder):
|
|
7
|
+
os.makedirs(testfolder)
|
|
8
|
+
|
|
9
|
+
rad_obj = bifacial_radiance.RadianceObj('makemod', testfolder)
|
|
10
|
+
|
|
11
|
+
moduletype='tutorial-module'
|
|
12
|
+
x = 2
|
|
13
|
+
y = 1
|
|
14
|
+
|
|
15
|
+
rad_obj.makeModule(name=moduletype, x=x, y=y)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/bash
|
|
2
|
+
|
|
3
|
+
PATH=$PATH:$HOME/Radiance/bin
|
|
4
|
+
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/Radiance/lib
|
|
5
|
+
RAYPATH=$RAYPATH:$HOME/Radiance/lib
|
|
6
|
+
export PATH
|
|
7
|
+
export LD_LIBRARY_PATH
|
|
8
|
+
export RAYPATH
|
|
9
|
+
|
|
10
|
+
dask-worker --interface=ib0 --nprocs 18 --nthreads 1 \
|
|
11
|
+
--scheduler-file=/scratch/sayala/dask_testing/scheduler.json
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/bash
|
|
2
|
+
|
|
3
|
+
#SBATCH --job-name="demo_run"
|
|
4
|
+
#SBATCH --nodes=2
|
|
5
|
+
#SBATCH --ntasks-per-node=36
|
|
6
|
+
#SBATCH --time=15
|
|
7
|
+
#SBATCH --export=ALL
|
|
8
|
+
#SBATCH --account=pvsoiling
|
|
9
|
+
# --partition=debug
|
|
10
|
+
#SBATCH --mail-type=ALL
|
|
11
|
+
#SBATCH --mail-user=silvana.ovaitt@nrel.gov
|
|
12
|
+
|
|
13
|
+
# Save info
|
|
14
|
+
python3 /home/sayala/BasicSimulations/addNewModule.py
|
|
15
|
+
|
|
16
|
+
#-----------------------
|
|
17
|
+
export BASE=/scratch/$USER
|
|
18
|
+
mkdir -p $BASE/$SLURM_JOB_ID
|
|
19
|
+
cd $BASE/$SLURM_JOB_ID
|
|
20
|
+
# Record starting time
|
|
21
|
+
date
|
|
22
|
+
|
|
23
|
+
# Save info
|
|
24
|
+
cat $0 > $SLURM_JOB_ID.script
|
|
25
|
+
printenv > $SLURM_JOB_ID.env
|
|
26
|
+
cp /home/sayala/BasicSimulations/simulate_tracking_gendaylit.py .
|
|
27
|
+
|
|
28
|
+
# Start up dask scheduler
|
|
29
|
+
dask-scheduler --interface ib0 \
|
|
30
|
+
--scheduler-file=/scratch/sayala/dask_testing/scheduler.json &
|
|
31
|
+
|
|
32
|
+
# Wait for scheduler to start
|
|
33
|
+
sleep 5
|
|
34
|
+
|
|
35
|
+
# Start up dask worker on all nodes (Note, script is used to also set
|
|
36
|
+
# environment variables on all the nodes. If these were set by default
|
|
37
|
+
# (using bash_profile for example), the commented command below could
|
|
38
|
+
# be used to start up workers.
|
|
39
|
+
srun /home/sayala/BasicSimulations/dask_on_node.sh &
|
|
40
|
+
|
|
41
|
+
mkdir RUNS
|
|
42
|
+
cd RUNS
|
|
43
|
+
|
|
44
|
+
# Wait for workers to start
|
|
45
|
+
sleep 5
|
|
46
|
+
|
|
47
|
+
# Run script to submit tasks
|
|
48
|
+
python3 /home/sayala/BasicSimulations/simulate_tracking_gendaylit.py
|
|
49
|
+
|
|
50
|
+
# Record ending time
|
|
51
|
+
date
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import os
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import time
|
|
5
|
+
import math
|
|
6
|
+
from itertools import chain
|
|
7
|
+
from itertools import product
|
|
8
|
+
import bifacial_radiance
|
|
9
|
+
from dask.distributed import Client
|
|
10
|
+
import math
|
|
11
|
+
|
|
12
|
+
# Generate spectra for DNI, DHI and albedo using smarts
|
|
13
|
+
|
|
14
|
+
# Run simulation using the given timestamp and wavelength
|
|
15
|
+
def simulate_single(tilt=None, results_folder_fmt=None, weather_file=None):
|
|
16
|
+
|
|
17
|
+
# Verify test_folder exists
|
|
18
|
+
test_folder = results_folder_fmt.format(f'{tilt:02}')
|
|
19
|
+
if not os.path.exists(test_folder):
|
|
20
|
+
os.makedirs(test_folder)
|
|
21
|
+
|
|
22
|
+
# Variables that stay the same
|
|
23
|
+
#Main Variables needed throughout
|
|
24
|
+
albedo = 0.6
|
|
25
|
+
sim_general_name = 'bifacial_example'
|
|
26
|
+
lat = 37.5
|
|
27
|
+
lon = -77.6
|
|
28
|
+
moduletype = 'tutorial-module'
|
|
29
|
+
pitch = 3
|
|
30
|
+
clearance_height = 0.2
|
|
31
|
+
azimuth = 180
|
|
32
|
+
nMods = 20
|
|
33
|
+
nRows = 7
|
|
34
|
+
hpc = True
|
|
35
|
+
|
|
36
|
+
pitch = 3
|
|
37
|
+
clearance_height = 0.2
|
|
38
|
+
azimuth = 90
|
|
39
|
+
nMods = 20
|
|
40
|
+
nRows = 7
|
|
41
|
+
hpc = True
|
|
42
|
+
|
|
43
|
+
sim_name = sim_general_name+'_'+str(tilt)
|
|
44
|
+
demo = bifacial_radiance.RadianceObj(sim_name,str(test_folder))
|
|
45
|
+
demo.setGround(albedo)
|
|
46
|
+
metdata = demo.readWeatherFile(weather_file)
|
|
47
|
+
demo.genCumSky(savefile = sim_name)
|
|
48
|
+
sceneDict = {'tilt':tilt,'pitch':pitch,'clearance_height':clearance_height,'azimuth':azimuth, 'nMods': nMods, 'nRows': nRows}
|
|
49
|
+
scene = demo.makeScene(moduletype=moduletype,sceneDict=sceneDict, hpc=hpc, radname = sim_name)
|
|
50
|
+
octfile = demo.makeOct(filelist= demo.getfilelist(), octname = demo.basename , hpc=hpc)
|
|
51
|
+
analysis = bifacial_radiance.AnalysisObj(octfile=octfile, name=sim_name)
|
|
52
|
+
frontscan, backscan = analysis.moduleAnalysis(scene=scene)
|
|
53
|
+
frontdict, backdict = analysis.analysis(octfile, name=sim_name, frontscan=frontscan, backscan=backscan)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
results = 1
|
|
57
|
+
|
|
58
|
+
return results
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def run_simulations_dask(tilts, kwargs):
|
|
62
|
+
# Create client
|
|
63
|
+
|
|
64
|
+
scheduler_file = '/scratch/sayala/dask_testing/scheduler.json'
|
|
65
|
+
client = Client(scheduler_file=scheduler_file)
|
|
66
|
+
|
|
67
|
+
# Iterate over inputs
|
|
68
|
+
futures = []
|
|
69
|
+
|
|
70
|
+
# Add Iterations HERE
|
|
71
|
+
|
|
72
|
+
for tilt in tilts:
|
|
73
|
+
futures.append(client.submit(simulate_single, tilt=tilt, **kwargs))
|
|
74
|
+
|
|
75
|
+
# Get results for all simulations
|
|
76
|
+
res = client.gather(futures)
|
|
77
|
+
|
|
78
|
+
# Close all dask workers and scheduler
|
|
79
|
+
try:
|
|
80
|
+
client.shutdown()
|
|
81
|
+
except:
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
# Close client
|
|
85
|
+
client.close()
|
|
86
|
+
|
|
87
|
+
res = 'FINISHED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
|
88
|
+
return res
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
|
|
93
|
+
print(" I AM HERE")
|
|
94
|
+
# Define locations within file system
|
|
95
|
+
weather_file = '/home/sayala/WeatherFiles/USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.epw'
|
|
96
|
+
results_folder_fmt = '/scratch/sayala/RadianceScenes/BasicSimulations/FixedTilt_Gencumsky/Tilt_{}'
|
|
97
|
+
|
|
98
|
+
# Define inputs
|
|
99
|
+
kwargs = {
|
|
100
|
+
'weather_file': weather_file,
|
|
101
|
+
'results_folder_fmt': results_folder_fmt
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Array for all hours in the year
|
|
105
|
+
tilts = [25, 30]
|
|
106
|
+
|
|
107
|
+
# Pass variables being looped on, and kwargs
|
|
108
|
+
run_simulations_dask(tilts, kwargs)
|
|
109
|
+
|
|
110
|
+
print("*********** DONE ************")
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import os
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import time
|
|
5
|
+
import math
|
|
6
|
+
from itertools import chain
|
|
7
|
+
from itertools import product
|
|
8
|
+
import bifacial_radiance
|
|
9
|
+
from dask.distributed import Client
|
|
10
|
+
import math
|
|
11
|
+
|
|
12
|
+
# Generate spectra for DNI, DHI and albedo using smarts
|
|
13
|
+
|
|
14
|
+
# Run simulation using the given timestamp and wavelength
|
|
15
|
+
def simulate_single(idx=None, results_folder_fmt=None, weather_file=None):
|
|
16
|
+
|
|
17
|
+
# Verify test_folder exists
|
|
18
|
+
test_folder = results_folder_fmt.format(f'{idx:04}')
|
|
19
|
+
if not os.path.exists(test_folder):
|
|
20
|
+
os.makedirs(test_folder)
|
|
21
|
+
|
|
22
|
+
# Variables that stay the same
|
|
23
|
+
#Main Variables needed throughout
|
|
24
|
+
albedo = 0.6
|
|
25
|
+
sim_general_name = 'bifacial_example'
|
|
26
|
+
lat = 37.5
|
|
27
|
+
lon = -77.6
|
|
28
|
+
moduletype = 'tutorial-module'
|
|
29
|
+
tilt = 10
|
|
30
|
+
pitch = 3
|
|
31
|
+
clearance_height = 0.2
|
|
32
|
+
azimuth = 180
|
|
33
|
+
nMods = 20
|
|
34
|
+
nRows = 7
|
|
35
|
+
hpc = True
|
|
36
|
+
|
|
37
|
+
sim_name = sim_general_name+'_'+str(idx)
|
|
38
|
+
demo = bifacial_radiance.RadianceObj(sim_name,str(test_folder), hpc=True)
|
|
39
|
+
demo.setGround(albedo)
|
|
40
|
+
metdata = demo.readWeatherFile(weather_file)
|
|
41
|
+
demo.gendaylit(idx)
|
|
42
|
+
sceneDict = {'tilt':tilt,'pitch':pitch,'clearance_height':clearance_height,'azimuth':azimuth, 'nMods': nMods, 'nRows': nRows}
|
|
43
|
+
scene = demo.makeScene(module=moduletype,sceneDict=sceneDict,radname = sim_name)
|
|
44
|
+
octfile = demo.makeOct(octname = demo.basename)
|
|
45
|
+
analysis = bifacial_radiance.AnalysisObj(octfile=octfile, name=sim_name, hpc=True)
|
|
46
|
+
frontscan, backscan = analysis.moduleAnalysis(scene=scene)
|
|
47
|
+
frontdict, backdict = analysis.analysis(octfile, name=sim_name, frontscan=frontscan, backscan=backscan)
|
|
48
|
+
results = 1
|
|
49
|
+
|
|
50
|
+
return results
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def run_simulations_dask(indices, kwargs):
|
|
54
|
+
# Create client
|
|
55
|
+
|
|
56
|
+
scheduler_file = '/scratch/sayala/dask_testing/scheduler.json'
|
|
57
|
+
client = Client(scheduler_file=scheduler_file)
|
|
58
|
+
|
|
59
|
+
# Iterate over inputs
|
|
60
|
+
futures = []
|
|
61
|
+
|
|
62
|
+
# Add Iterations HERE
|
|
63
|
+
|
|
64
|
+
for idx in indices:
|
|
65
|
+
futures.append(client.submit(simulate_single, idx=idx, **kwargs))
|
|
66
|
+
|
|
67
|
+
# Get results for all simulations
|
|
68
|
+
res = client.gather(futures)
|
|
69
|
+
|
|
70
|
+
# Close all dask workers and scheduler
|
|
71
|
+
try:
|
|
72
|
+
client.shutdown()
|
|
73
|
+
except:
|
|
74
|
+
pass
|
|
75
|
+
|
|
76
|
+
# Close client
|
|
77
|
+
client.close()
|
|
78
|
+
|
|
79
|
+
res = 'FINISHED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
|
80
|
+
return res
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if __name__ == "__main__":
|
|
84
|
+
|
|
85
|
+
# Define locations within file system
|
|
86
|
+
weather_file = '/home/sayala/WeatherFiles/USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.epw'
|
|
87
|
+
results_folder_fmt = '/scratch/sayala/RadianceScenes/BasicSimulations/FixedTilt_Gendaylit/Timestamp_{}'
|
|
88
|
+
|
|
89
|
+
# Define inputs
|
|
90
|
+
kwargs = {
|
|
91
|
+
'weather_file': weather_file,
|
|
92
|
+
'results_folder_fmt': results_folder_fmt
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# Array for all hours in the year
|
|
96
|
+
indices = np.array(list(range(0, 8760)))
|
|
97
|
+
indices = np.array(list(range(4020, 4022)))
|
|
98
|
+
|
|
99
|
+
# Pass variables being looped on, and kwargs
|
|
100
|
+
run_simulations_dask(indices, kwargs)
|
|
101
|
+
|
|
102
|
+
print("*********** DONE ************")
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import os
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import time
|
|
5
|
+
import math
|
|
6
|
+
from itertools import chain
|
|
7
|
+
from itertools import product
|
|
8
|
+
import bifacial_radiance
|
|
9
|
+
from dask.distributed import Client
|
|
10
|
+
import math
|
|
11
|
+
|
|
12
|
+
# Generate spectra for DNI, DHI and albedo using smarts
|
|
13
|
+
|
|
14
|
+
# Run simulation using the given timestamp and wavelength
|
|
15
|
+
def simulate_single(daydate=None, results_folder_fmt=None, weather_file=None):
|
|
16
|
+
|
|
17
|
+
# Verify test_folder exists
|
|
18
|
+
test_folder = results_folder_fmt.format(f'{daydate}')
|
|
19
|
+
if not os.path.exists(test_folder):
|
|
20
|
+
os.makedirs(test_folder)
|
|
21
|
+
|
|
22
|
+
# Variables that stay the same
|
|
23
|
+
#Main Variables needed throughout
|
|
24
|
+
albedo = 0.6
|
|
25
|
+
sim_general_name = 'bifacial_example'
|
|
26
|
+
lat = 37.5
|
|
27
|
+
lon = -77.6
|
|
28
|
+
moduletype = 'tutorial-module'
|
|
29
|
+
gcr = 0.35
|
|
30
|
+
hub_height = 0.2
|
|
31
|
+
|
|
32
|
+
nMods = 20
|
|
33
|
+
nRows = 7
|
|
34
|
+
hpc = True
|
|
35
|
+
cumulativesky = False
|
|
36
|
+
|
|
37
|
+
limit_angle = 60
|
|
38
|
+
backtrack = True
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
sim_name = sim_general_name+'_'+str(daydate)
|
|
42
|
+
demo = bifacial_radiance.RadianceObj(sim_name,str(test_folder))
|
|
43
|
+
demo.setGround(albedo)
|
|
44
|
+
metdata = demo.readWeatherFile(weather_file, coerce_year=2021)
|
|
45
|
+
sceneDict = {'gcr':gcr,'hub_height':hub_height, 'nMods': nMods, 'nRows': nRows}
|
|
46
|
+
trackerdict = demo.set1axis(limit_angle = limit_angle, backtrack = backtrack, gcr = gcr, cumulativesky = cumulativesky)
|
|
47
|
+
|
|
48
|
+
# Restrict trackerdict here
|
|
49
|
+
#foodict = {k: v for k, v in trackerdict.items() if k.startswith('21'+'_'+day_date)}
|
|
50
|
+
#trackerdict = demo.gendaylit1axis(trackerdict = foodict)
|
|
51
|
+
trackerdict = demo.gendaylit1axis(startdate=daydate, enddate=daydate)
|
|
52
|
+
trackerdict = demo.makeScene1axis(moduletype=moduletype,sceneDict=sceneDict, cumulativesky=cumulativesky, hpc=hpc) #makeScene creates a .rad file with 20 modules per row, 7 rows.
|
|
53
|
+
trackerdict = demo.makeOct1axis(customname = sim_name, hpc=hpc)
|
|
54
|
+
demo.analysis1axis(customname = sim_name, hpc=hpc)
|
|
55
|
+
|
|
56
|
+
results = 1
|
|
57
|
+
|
|
58
|
+
return results
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def run_simulations_dask(daylist, kwargs):
|
|
62
|
+
# Create client
|
|
63
|
+
|
|
64
|
+
scheduler_file = '/scratch/sayala/dask_testing/scheduler.json'
|
|
65
|
+
client = Client(scheduler_file=scheduler_file)
|
|
66
|
+
|
|
67
|
+
# Iterate over inputs
|
|
68
|
+
futures = []
|
|
69
|
+
|
|
70
|
+
# Add Iterations HERE
|
|
71
|
+
|
|
72
|
+
for daydate in daylist:
|
|
73
|
+
futures.append(client.submit(simulate_single, daydate=daydate, **kwargs))
|
|
74
|
+
|
|
75
|
+
# Get results for all simulations
|
|
76
|
+
res = client.gather(futures)
|
|
77
|
+
|
|
78
|
+
# Close all dask workers and scheduler
|
|
79
|
+
try:
|
|
80
|
+
client.shutdown()
|
|
81
|
+
except:
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
# Close client
|
|
85
|
+
client.close()
|
|
86
|
+
|
|
87
|
+
res = 'FINISHED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
|
88
|
+
return res
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__":
|
|
92
|
+
print(">>>>>>>>>>>>>>>>>> STARTING !")
|
|
93
|
+
# Define locations within file system
|
|
94
|
+
weather_file = '/home/sayala/WeatherFiles/USA_CO_Boulder-Broomfield-Jefferson.County.AP.724699_TMY3.epw'
|
|
95
|
+
results_folder_fmt = '/scratch/sayala/RadianceScenes/BasicSimulations/Gendaylit1axis/Day_{}'
|
|
96
|
+
|
|
97
|
+
# Define inputs
|
|
98
|
+
kwargs = {
|
|
99
|
+
'weather_file': weather_file,
|
|
100
|
+
'results_folder_fmt': results_folder_fmt
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
import datetime
|
|
104
|
+
|
|
105
|
+
FullYear = False
|
|
106
|
+
|
|
107
|
+
if FullYear:
|
|
108
|
+
start = datetime.datetime.strptime("01-01-2021", "%d-%m-%Y")
|
|
109
|
+
end = datetime.datetime.strptime("31-12-2021", "%d-%m-%Y") # 2014 not a leap year.
|
|
110
|
+
else:
|
|
111
|
+
start = datetime.datetime.strptime("24-03-2021", "%d-%m-%Y")
|
|
112
|
+
end = datetime.datetime.strptime("27-03-2021", "%d-%m-%Y") # 2014 not a leap year.
|
|
113
|
+
|
|
114
|
+
date_generated = [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)]
|
|
115
|
+
|
|
116
|
+
daylist = []
|
|
117
|
+
for date in date_generated:
|
|
118
|
+
daylist.append(date.strftime("%y_%m_%d"))
|
|
119
|
+
# loop doesn't add last day :
|
|
120
|
+
daylist.append('21_12_31')
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Pass variables being looped on, and kwargs
|
|
124
|
+
run_simulations_dask(daylist, kwargs)
|
|
125
|
+
|
|
126
|
+
print("*********** DONE ************")
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import os
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import time
|
|
5
|
+
import math
|
|
6
|
+
from itertools import chain
|
|
7
|
+
import bifacial_radiance
|
|
8
|
+
from dask.distributed import Client
|
|
9
|
+
from math import sin, cos, radians
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Run simulation using the given timestamp
|
|
13
|
+
def simulate_single(xgap=None, numpanels = None, sensorx=None,
|
|
14
|
+
test_folder_fmt=None, weather_file=None):
|
|
15
|
+
|
|
16
|
+
ft2m = 0.3048
|
|
17
|
+
hub_height = 8.0 * ft2m
|
|
18
|
+
y = 1
|
|
19
|
+
pitch = 0.001 # y * np.cos(np.radians(tilt))+D
|
|
20
|
+
ygap = 0.15
|
|
21
|
+
tilt = 18
|
|
22
|
+
|
|
23
|
+
sim_name = ('Coffee_'+str(numpanels)+'up_'+
|
|
24
|
+
str(round(xgap,1))+'_xgap_'+str(sensorx)+'posx')
|
|
25
|
+
|
|
26
|
+
# Verify test_folder exists before creating radiance obj
|
|
27
|
+
test_folder = test_folder_fmt.format(f'{numpanels}',
|
|
28
|
+
f'{round(xgap,1)}',f'{sensorx:03}')
|
|
29
|
+
|
|
30
|
+
if not os.path.exists(test_folder):
|
|
31
|
+
os.makedirs(test_folder)
|
|
32
|
+
|
|
33
|
+
lat = 18.202142
|
|
34
|
+
lon = -66.759187
|
|
35
|
+
albedo = 0.25 # Grass value from Torres Molina, "Measuring UHI in Puerto Rico" 18th LACCEI
|
|
36
|
+
# International Multi-Conference for Engineering, Education, and Technology
|
|
37
|
+
x = 1.64
|
|
38
|
+
|
|
39
|
+
azimuth = 180
|
|
40
|
+
if numpanels == 3:
|
|
41
|
+
nMods = 9
|
|
42
|
+
if numpanels == 4:
|
|
43
|
+
nMods = 7
|
|
44
|
+
nRows = 1
|
|
45
|
+
moduletype = 'PR_'+str(numpanels)+'up_'+str(round(xgap,1))+'xgap'
|
|
46
|
+
|
|
47
|
+
hpc = False
|
|
48
|
+
|
|
49
|
+
demo = bifacial_radiance.RadianceObj(sim_name,str(test_folder))
|
|
50
|
+
demo.setGround(albedo)
|
|
51
|
+
demo.readWeatherFile(weather_file)
|
|
52
|
+
|
|
53
|
+
sceneDict = {'tilt':tilt,'pitch':pitch,'hub_height':hub_height,'azimuth':azimuth, 'nMods': nMods, 'nRows': nRows}
|
|
54
|
+
scene = demo.makeScene(moduletype=moduletype,sceneDict=sceneDict, hpc=hpc, radname = sim_name)
|
|
55
|
+
|
|
56
|
+
demo.genCumSky()
|
|
57
|
+
|
|
58
|
+
octfile = demo.makeOct(filelist = demo.getfilelist(), octname = demo.basename, hpc=hpc)
|
|
59
|
+
analysis = bifacial_radiance.AnalysisObj(octfile=octfile, name=sim_name)
|
|
60
|
+
|
|
61
|
+
ii = 1
|
|
62
|
+
jj = 1
|
|
63
|
+
|
|
64
|
+
simplesim=False
|
|
65
|
+
if simplesim:
|
|
66
|
+
sensorsy_front = 20
|
|
67
|
+
sensorsy_back = 1
|
|
68
|
+
sensorsx_front = 1
|
|
69
|
+
sensorsx_back = 1
|
|
70
|
+
else:
|
|
71
|
+
sensorsy_front = 201
|
|
72
|
+
sensorsy_back = 1
|
|
73
|
+
sensorsx_front = 1
|
|
74
|
+
sensorsx_back = 1
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
frontscan, backscan = analysis.moduleAnalysis(scene, sensorsy_front=sensorsy_front,
|
|
78
|
+
sensorsx_front=sensorsx_front,
|
|
79
|
+
sensorsy_back=sensorsy_back,
|
|
80
|
+
sensorsx_back=sensorsx_back)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
xinc = 0.10 # cm . Sampling every 10 cm.
|
|
84
|
+
yinc = 0.10 # cm . Sampling every 10 cm
|
|
85
|
+
|
|
86
|
+
frontscan['zstart'] = 0.01
|
|
87
|
+
frontscan['xstart'] = -20+sensorx*xinc
|
|
88
|
+
frontscan['orient'] = '0 0 -1'
|
|
89
|
+
frontscan['zinc'] = 0
|
|
90
|
+
frontscan['yinc'] = yinc
|
|
91
|
+
frontscan['ystart'] = -10 # n
|
|
92
|
+
frontdict, backdict = analysis.analysis(octfile = octfile, name = 'xloc_'+str(sensorx),
|
|
93
|
+
frontscan=frontscan, backscan=backscan)
|
|
94
|
+
|
|
95
|
+
results = 1
|
|
96
|
+
|
|
97
|
+
print("***** Finished simulation for "+ str(sim_name))
|
|
98
|
+
|
|
99
|
+
results=1
|
|
100
|
+
return results
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def run_simulations_dask(xgaps, numpanelss, sensorsxs, kwargs):
|
|
105
|
+
# Create client
|
|
106
|
+
|
|
107
|
+
scheduler_file = '/scratch/sayala/dask_testing/scheduler.json'
|
|
108
|
+
client = Client(scheduler_file=scheduler_file)
|
|
109
|
+
|
|
110
|
+
# Iterate over inputs
|
|
111
|
+
futures = []
|
|
112
|
+
|
|
113
|
+
for nn in range (0, len(numpanelss)):
|
|
114
|
+
numpanels = numpanelss[nn]
|
|
115
|
+
for xx in range (0, len(xgaps)):
|
|
116
|
+
xgap = xgaps[xx]
|
|
117
|
+
for ii in sensorsxs:
|
|
118
|
+
futures.append(client.submit(simulate_single, xgap=xgap, numpanels=numpanels, sensorx=ii,**kwargs))
|
|
119
|
+
|
|
120
|
+
# Get results for all simulations
|
|
121
|
+
res = client.gather(futures)
|
|
122
|
+
|
|
123
|
+
# Close all dask workers and scheduler
|
|
124
|
+
try:
|
|
125
|
+
client.shutdown()
|
|
126
|
+
except:
|
|
127
|
+
pass
|
|
128
|
+
|
|
129
|
+
# Close client
|
|
130
|
+
client.close()
|
|
131
|
+
|
|
132
|
+
res = 'FINISHED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
|
|
133
|
+
return res
|
|
134
|
+
|
|
135
|
+
if __name__ == "__main__":
|
|
136
|
+
# Define locations within file system
|
|
137
|
+
|
|
138
|
+
weather_file = '/scratch/sayala/JORDAN/PRI_Mercedita.AP.785203_TMY3.epw'
|
|
139
|
+
test_folder_fmt = '/scratch/sayala/JORDAN/PUERTO_RICO_NEW/numpanels_{}_xgap_{}_Posx_{}'
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# Define inputs
|
|
143
|
+
kwargs = {
|
|
144
|
+
'weather_file': weather_file,
|
|
145
|
+
'test_folder_fmt': test_folder_fmt
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# indices = np.array(list(range(2881, 6552)))
|
|
149
|
+
ft2m = 0.3048
|
|
150
|
+
lat = 18.202142
|
|
151
|
+
|
|
152
|
+
# Loops
|
|
153
|
+
|
|
154
|
+
# simplesim
|
|
155
|
+
simplesim=False
|
|
156
|
+
if simplesim:
|
|
157
|
+
xgaps = np.array([3, 4])*ft2m
|
|
158
|
+
numpanelss = np.array([3, 4])
|
|
159
|
+
sensorsxs = 2
|
|
160
|
+
else:
|
|
161
|
+
xgaps = np.array([3, 4, 6, 9, 12, 15, 18, 21]) * ft2m
|
|
162
|
+
numpanelss = np.array([3, 4])
|
|
163
|
+
sensorsxs = np.array(list(range(0, 401)))
|
|
164
|
+
|
|
165
|
+
# Specify method for running simulation
|
|
166
|
+
use_dask = True
|
|
167
|
+
if use_dask:
|
|
168
|
+
run_simulations_dask(xgaps, numpanelss, sensorsxs, kwargs)
|