The IDFVersionUpdater GUI simply calls the each individual fortran utilities called TransitionV-X-X-X-to-Y-Y-Y
, eg Transition-V9-6-0-to-V22-1-0
. You'll find those in the PreProcess/IDFVersionUpdater
folder. You can just have python do a system call to these utilities which take one argument, and that is the path to the IDF file to translate.
For it to work you should change the current directory to the EnergyPlus PreProcess/IDFVersionUpdater
folder, and that folder should not be write protected (on Windows it shouldn't by default, as it installs to C:\EnergyPlusV-X-Y-Z
if I recall correctly, and not in Program Files, but worst case just copy the entire PreProcess\IDFVersionUpdater
folder somewhere else)
A minimal example would be something like that:
In [1]: import subprocess
...: from pathlib import Path
In [2]: idfs = list(Path('.').resolve().glob('*.idf'))
...: idfs
Out[2]:
[PosixPath('/media/DataExt4/tmp/1ZoneUncontroller.idf'),
PosixPath('/media/DataExt4/tmp/idf2.idf')]
In [3]: TRANSITION_CLI_DIR = Path('C:\EnergyPlusV22-1-0\PreProcess\IDFVersionUpdater\')
In [4]: transition_exe = TRANSITION_CLI_DIR / 'Transition-V9-6-0-to-V22-1-0'
In [5]: subprocess.check_output([transition_exe, idfs[0]], cwd=TRANSITION_CLI_DIR)
Out[5]: b' Transition Starting\n Conversion 9.6 => 22.1\n Processing Old IDD -- V9-6-0-Energy+.idd\n Processing New IDD -- V22-1-0-Energy+.idd\n Will create new full IDFs\n Will create new IDF lines with units where applicable\n Will create new IDF lines leaving blank incoming fields as blank (no default fill)\n F\n Processing IDF -- /media/DataExt4/tmp/1ZoneUncontrolled.idf\n Processing IDF -- Processing idf objects . . .\n Processing IDF -- Processing idf objects complete.\n'
Side note, the library you linked to (idf-updater) may work with windows as well, the pypi description just says it was "Built for Linux and MacOS as windows has the IDFVersionUpdater.exe", not that it doesn't work on windows.