These commits include a styling refactor of the whole package to follow PEP8 standards and generally not have any line that exceeds 89 characters. This styling refactor also included the addition of several new comments and docstrings to make the code readable and maintainable. The stdout of the CLI command was also cleaned up to be more readable. A sample of the new CLI stdout is included below.
Functionally, nothing has changed about the current simulation workflow. The behavior of all existing CLI options has been left unchanged and this was tested in several different ways against the sample model. The only tweak that was made to a CLI element is that users now don't need to specify both start and end time in order to have them be used in the simulation. If they want, they can specify only a start time and the end time will automatically become the latest time available in the load profiles (and vice versa). This was not possible previously, which resulted in a lot of cases of accidentally running the whole year.
The second commit of this PR adds an --rnm option to the command, which changes the reader to read in OpenDSS files from an RNM simulation instead of trying to create them from features within the GeoJSON file. At the moment, this alternative simulation workflow includes writing out the CSV profiles from the GeoJSON and scenario, using the DiTTo OpenDSSReader to load the RNM DSS files, and then simulating the DiTTo model exactly like the models constructed from detailed URBANopt GeoJSON features. The writing of the CSV load profiles can be removed once the URBANopt RNM workflows switch to writing load profiles in the CSV format (instead of the LoadProfile.dss file that it currently uses). I should also note that the current DSS files coming out of URBANopt RNM workflows seem to fail a lot of checks that the urbanopt-ditto-reader performs before running the simulation and I imagine that there's still a good amount of work to do here. But, otherwise, the CLI is able to run the RNM files and output results into CSV files as expected.
Here is a sample stdout from the new CLI command:
CONFIGS USED:
urbanopt_scenario_file: C:\Users\chris\simulation\Buffalo_New_Development_GEB\honeybee_scenario.csv
equipment_file: C:\Users\chris\simulation\Buffalo_New_Development_GEB\electrical_database.json
opendss_folder: C:\Users\chris\simulation\Buffalo_New_Development_GEB\run\honeybee_scenario\opendss
urbanopt_geojson_file: C:\Users\chris\simulation\Buffalo_New_Development_GEB\BuffaloNewDevelopmentGEB.geojson
use_reopt: False
start_time: 2006/07/21 01:00:00
end_time: 2006/07/22 00:00:00
timestep: None
upgrade_transformers: False
RE-SERIALIZING MODEL
Warning - Load Mixed_use1 has no transformer. Assigning as MV load
Warning - Load Residential1 has no transformer. Assigning as MV load
Warning - Load Hospital1 has no transformer. Assigning as MV load
Warning - Load Hospital2 has no transformer. Assigning as MV load
Warning - Load Mixeduse2 has no transformer. Assigning as MV load
Warning - Load Mall1 has no transformer. Assigning as MV load
Warning - Load Residential6 has no transformer. Assigning as MV load
CHECKING MODEL
Checking that the network has no loops:
Checking loops for source ps_source
Result: ←[92m PASS ←[0m
Checking that all loads are connected to source:
Result: ←[92m PASS ←[0m
Checking for unique paths from each load to source:
Result: ←[92m PASS ←[0m
Checking that phases on either side of transformer are correct:
Result: ←[92m PASS ←[0m
Checking that phases from transformer to load and source match:
Warning - transformer found for system where no transformers required between load and customer
Warning - transformer found for system where no transformers required between load and customer
Warning - transformer found for system where no transformers required between load and customer
Warning - transformer found for system where no transformers required between load and customer
Warning - transformer found for system where no transformers required between load and customer
Warning - transformer found for system where no transformers required between load and customer
Result: ←[92m PASS ←[0m
SETTING UP SIMULATION
Specified start time of 2006/07/21 01:00:00 found in timeseries file
Specified end time of 2006/07/22 00:00:00 found in timeseries file
Running from 2006/07/21 01:00:00 to 2006/07/22 00:00:00:
Using default timestep of 60.0 minutes
BEGINNING SIMULATION
Timepoint: 2006/07/21 01:00:00
Timepoint: 2006/07/21 02:00:00
Timepoint: 2006/07/21 03:00:00
Timepoint: 2006/07/21 04:00:00
Timepoint: 2006/07/21 05:00:00
Timepoint: 2006/07/21 06:00:00
Timepoint: 2006/07/21 07:00:00
Timepoint: 2006/07/21 08:00:00
Timepoint: 2006/07/21 09:00:00
Timepoint: 2006/07/21 10:00:00
Timepoint: 2006/07/21 11:00:00
Timepoint: 2006/07/21 12:00:00
Timepoint: 2006/07/21 13:00:00
Timepoint: 2006/07/21 14:00:00
Timepoint: 2006/07/21 15:00:00
Timepoint: 2006/07/21 16:00:00
Timepoint: 2006/07/21 17:00:00
Timepoint: 2006/07/21 18:00:00
Timepoint: 2006/07/21 19:00:00
Timepoint: 2006/07/21 20:00:00
Timepoint: 2006/07/21 21:00:00
Timepoint: 2006/07/21 22:00:00
Timepoint: 2006/07/21 23:00:00
Timepoint: 2006/07/22 00:00:00
Done. Results located in C:\Users\chris\simulation\Buffalo_New_Development_GEB\run\honeybee_scenario\opendss
These commits include a styling refactor of the whole package to follow PEP8 standards and generally not have any line that exceeds 89 characters. This styling refactor also included the addition of several new comments and docstrings to make the code readable and maintainable. The stdout of the CLI command was also cleaned up to be more readable. A sample of the new CLI stdout is included below.
Functionally, nothing has changed about the current simulation workflow. The behavior of all existing CLI options has been left unchanged and this was tested in several different ways against the sample model. The only tweak that was made to a CLI element is that users now don't need to specify both start and end time in order to have them be used in the simulation. If they want, they can specify only a start time and the end time will automatically become the latest time available in the load profiles (and vice versa). This was not possible previously, which resulted in a lot of cases of accidentally running the whole year.
The second commit of this PR adds an
--rnm
option to the command, which changes the reader to read in OpenDSS files from an RNM simulation instead of trying to create them from features within the GeoJSON file. At the moment, this alternative simulation workflow includes writing out the CSV profiles from the GeoJSON and scenario, using the DiTTo OpenDSSReader to load the RNM DSS files, and then simulating the DiTTo model exactly like the models constructed from detailed URBANopt GeoJSON features. The writing of the CSV load profiles can be removed once the URBANopt RNM workflows switch to writing load profiles in the CSV format (instead of theLoadProfile.dss
file that it currently uses). I should also note that the current DSS files coming out of URBANopt RNM workflows seem to fail a lot of checks that the urbanopt-ditto-reader performs before running the simulation and I imagine that there's still a good amount of work to do here. But, otherwise, the CLI is able to run the RNM files and output results into CSV files as expected.Here is a sample stdout from the new CLI command: