View on GitHub

Steamtrain

Steamtrain is an automation system for TRNSYS 15 to calculate Australian Small-scale technology certificates (STCs) and Victorian energy efficiency certificates (VEECs), written in Python 3+.

download .ZIPdownload .TGZ

How to install

  1. Clone the project from git@github.com:nelsonzheng/Steamtrain.git.
  2. Edit the root_path value inside project/config/config.json to reflect your working folder.
  3. Edit the trnsys_path value inside project/config/config.json to reflect your Trnsys.exe install path.
  4. Run project/setup.py to copy necessary files into your working folder.

Usage

Fresh pre-run checklist and validation

To ensure that your run is not contaminated by previous runs, complete the following procedure.

  1. Run project/setup.py again
  2. Delete any existing .log files in the root_path
  3. Delete root_path/Domestic_CER or root_path/Domestic_VEEC folder
  4. Check the accuracy of values in the following database tables:
    • databases/booster_data_db.csv
    • databases/collector_data_db.csv
    • databases/controller_data.csv
    • databases/iam_data.json
    • databases/pump_data_db.csv
    • databases/solar_loop_data_db.csv
    • databases/tank_data_db.csv
  5. Check the accuracy of values presented in:
    • component_list/booster_db.csv
    • component_list/booster_mapper.csv
    • component_list/brands_db.csv
    • component_list/collector_db.csv
    • component_list/tank_db.csv
  6. Check accuracy of values in:
    • Weatherdata/
    • Includefiles/
  7. Run schedule_comparison.py to compare your systems.csv with databases/schedule_db.csv.
    This comparison will allow the user to identify if any of the systems that are about to be modeled are not yet on the schedule.

STC Simulation Process

Please complete all of the following steps.

  1. CER TRNSYS Automation Procedure
  2. Post Simulation
  3. Audit Processes

CER TRNSYS Automation Procedure

The main procedure to run TRNSYS15 simulations for Clean Energy Regulator Small-scale technology certificates (STCs).

Run main.py to begin simulation process

Systems List Generation
>>> Would you like to automatically generate a list of all systems? (y/n):
General Advice

Users are advised to answer y upon first run and edit the generated list to their liking. For any runs after the initial run, users should answer n to avoid having to edit their custom systems list repeatedly.

Answering Yes
>>> Would you like to automatically generate a list of all systems? (y/n):y

Answering y will generate a system.csv in your root_path with permutations and combinations of all possible systems given the .csv components list files in the component_list folder

Answering No
>>> Would you like to automatically generate a list of all systems? (y/n):n

Answering n will not do anything. However, in order to proceed users are required to create their own systems.csv file with the list of systems that they would like to automate.

The systems.csv should be in the following format with a system per line.

AE-160-SS-BOT-10
AC-250-GL-26N-30
AB-315-TS-20N-44

Manual editing of systems.csv
>>> Script paused for manual systems list editing. 
>>> Press <Enter> to continue when ready:

The script will pause at this point to allow the user to edit their automatically generated systems.csv or to create their own systems.csv.

Auditing

It is important to begin your audit process at this point. Begin by generating the Technical Details Sheet detailed below. Audit file and folder generation is best left until TRNSYS automation has been completed.

Press <Enter> once you are ready to continue.

Generate .DCK Files
>>> Generate DCK files? (y/n):
Answering Yes
>>> Generate DCK files? (y/n):y

Answering y will generate up to twelve .DCK files for each system in the systems.csv file. For CER each system will be simulated in four zones and at three different load sizes.

The .DCK files will be organized into the following folder structure: Domestic_CER > Booster type > Tank type > System model name > System .DCK files

E.g. Domestic_CER > Gas > GL > AC-250-GL-26N-20 > AC-250-GL-26N-20-Z3-L2.DCK

Answering No
>>> Generate DCK files? (y/n):n

Answering n will not generate any files.

Systems TRNSYS Automation
>>> Simulate DCK files in TRNSYS? (y/n):
Answering Yes

Answering y will instruct the script to run all .DCK files found in Domestic_CER.

The automation process will instantiate n-1 number of simultaneous TRNSYS15 processes, where n is the number of virtual or physical cores available on your computer's CPU. I.e. an Intel i7 CPU with 8 cores will run 7 TRNSYS15 processes simultaneously.

Answering No

Answering n will not run any .DCK files

Collation of .OUT data
>>> Collate system .OUT data? (y/n):
Answering Yes

Answering y will:

Answering No

Answering n will do nothing.

Post CER simulation

After the run process is complete and systems_zoned_lpg.csv is available, the list of systems are ready to be opened in your favorite spreadsheet software application and pasted into your Part C - Domestic Hot Water Heaters spreadsheet for submission. Be sure to check your list against the schedule and remove any unavailable or unwanted systems.

Audit Processes

Technical Details Sheet Generation - tds_gen.py

The technical details sheet takes data from the same database tables as the ones used to generate the .DCK files and should be generated after the systems list is finalized.

The technical details sheet will be created in the root_path and saved as tds.csv in the format ready to be pasted into your Technical Details Sheet.

Audit Files - auditfiles.py

The generation of audit files should be completed alongside the Technical Details Sheet. However, since the simulation process takes a while longer, the .OUT and .LST files will not be available until everything is complete. Therefore it is highly recommended to run auditfiles.py after TRNSYS automation is complete and finalized.

The audit files and folders are created as required by CER inside the root_path/audit.

VEEC Simulation Process

Please complete all of the following steps.

  1. VEEC TRNSYS Automation Procedure
  2. Post VEET Simulation
  3. VEET Audit Processes

VEEC TRNSYS Automation Procedure

The main procedure to run TRNSYS15 simulations for Victorian Energy Efficiency Certificates (VEECs).

Run main_veec.py to begin simulation process

Systems List Generation
>>> Would you like to automatically generate a list of all systems? (y/n):
General Advice

Users are advised to answer y upon first run and edit the generated list to their liking. For any runs after the initial run, users should answer n to avoid having to edit their custom systems list repeatedly.

Answering Yes
>>> Would you like to automatically generate a list of all systems? (y/n):y

Answering y will generate a system.csv in your root_path with permutations and combinations of all possible systems given the .csv components list files in the component_list folder

Answering No
>>> Would you like to automatically generate a list of all systems? (y/n):n

Answering n will not do anything. However, in order to proceed users are required to create their own systems.csv file with the list of systems that they would like to automate.

The systems.csv should be in the following format with a system per line.

AE-160-SS-BOT-10
AC-250-GL-26N-30
AB-315-TS-20N-44

Manual editing of systems.csv
>>> Script paused for manual systems list editing. 
>>> Press <Enter> to continue when ready:

The script will pause at this point to allow the user to edit their automatically generated systems.csv or to create their own systems.csv.

Auditing

It is important to begin your audit process at this point. Don't forget to run the auditfiles.py script at the end!

Press <Enter> once you are ready to continue.

Generate .DCK Files
>>> Generate DCK files? (y/n):
Answering Yes
>>> Generate DCK files? (y/n):y

Answering y will generate up to two .DCK file for each system in systems.csv file. For VEET, each system will be simulated in Zone 4 and at loads 1 and 2.

The .DCK files will be organized into the following folder structure: Domestic_VEEC > Booster type > Tank type > System model name > System .DCK files

E.g. Domestic_VEEC > Gas > GL > AC-250-GL-26N-20 > AC-250-GL-26N-20-Z3-L2.DCK

Answering No
>>> Generate DCK files? (y/n):n

Answering n will not generate any files.

Systems TRNSYS Automation
>>> Simulate DCK files in TRNSYS? (y/n):
Answering Yes

Answering y will instruct the script to run all .DCK files found in Domestic_VEEC.

The automation process will instantiate n-1 number of simultaneous TRNSYS15 processes, where n is the number of virtual or physical cores available on your computer's CPU. I.e. an Intel i7 CPU with 8 cores will run 7 TRNSYS15 processes simultaneously.

Answering No

Answering n will not run any .DCK files

Collation of .OUT data
>>> Collate system .OUT data? (y/n):
Answering Yes

Answering y will:

Answering No

Answering n will do nothing.

Post VEET simulation

After the run process is complete and systems_zoned_lpg.csv is available, the list of systems are ready to be opened in your favorite spreadsheet software application and pasted into your Solar Water - Application spreadsheet for submission. Be sure to check your list against the schedule and remove any unavailable or unwanted systems.

VEET Audit Processes

Audit Files - auditfiles_veec.py

The generation of audit files should be completed alongside the TRNSYS Automation. However, since the simulation process takes a while longer, the .OUT and .LST files will not be available until everything is complete. Therefore it is highly recommended to run auditfiles.py after TRNSYS automation is complete and finalized.

The audit files will be created in a similar structure to CER audit files inside root_path/audit.

Recovery

As each system simulation is completed, the system model name will be added to a .log file named with the timestamp at which run procedure was first started. Simulations that are semi-complete will not be added to this log.

When re-running main.py or main_veec.py after an incomplete or crashed run, the script will prompt you with the following:

Do you want to recover?

>>> We have detected that the last automation run was not completed.
>>> Would you like to recover from where it last stopped? (y/n):
Answering Yes

Answering y will compare the entire list of .DCK files to the ones listed in the latest .log file. The difference in the list of .DCKs will be simulated.

Answering No

Answering n will run every simulation from the start.

License

This project could be released under WTFPL in the future.

Known potential error causing conditions

Using space inside naming of root_path

Using a space inside the naming structure will cause an error whilst running TRNSYS. E.g. Version22 2

Using .6 inside naming of root_path

Using a .6 inside the naming structure will only allow 1 system to run at a time, bugging out the other parallel processes of TRNSYS. E.g. Version22-10.6

Running TRNSYS automation after generating audit folder

Attempting to re-run TRNSYS automation through main.py or main_veec.py after the audit folder has been created will cause an error as the system will try to run the .DCK files in the audit folder too. Please delete the root_path/audit folder before re-running.