示例#1
0
    def test_initialize(self):
        import buildingspy.development.merger as m

        # Test a package that does not exist
        self.assertRaises(ValueError, m.IBPSA, "non_existent_modelica_package", self._dest_dir)
        self.assertRaises(ValueError, m.IBPSA, self._ibpsa_dir, "non_existent_modelica_package")

        # Test packages that do exist
        m.IBPSA(self._ibpsa_dir, self._dest_dir)
示例#2
0
    def test_merge(self):
        """Test merging the libraries
        """
        # This requires https://github.com/gitpython-developers/GitPython

        import shutil

        import buildingspy.development.merger as m

        mer = m.IBPSA(self._ibpsa_dir, self._dest_dir)
        mer.merge()

        if "tmp-BuildingsPy" in self._repDir:
            shutil.rmtree(self._repDir)
示例#3
0
import buildingspy.development.merger as m
import os
import io, json

fileName = "Resources/Scripts/mergePaths.txt"
if os.path.isfile(fileName):
    with open(fileName, 'r') as dataFile:
        data = json.loads(dataFile.read())
        annex60_dir = data['annex60_dir']
        dest_dir = data['dest_dir']

else:
    print fileName + " could not be found in your current working directory, please enter source and destination paths. \nThey will be saved for next time. Remove " + fileName + " to reset the paths."
    annex60_dir = raw_input("Enter annex60 directory path: \n")
    dest_dir = raw_input("Enter destination directory path: \n")
    data = {"annex60_dir": annex60_dir, "dest_dir": dest_dir}
    with open(fileName, 'w') as dataFile:
        json.dump(data, dataFile)

mer = m.IBPSA(annex60_dir, dest_dir)
mer.set_excluded_packages(["Experimental", "Obsolete"])
mer.merge(overwrite_reference_results=True)
示例#4
0
import json
import os
from builtins import input
''' This script merges the Modelica IBPSA Library into AixLib

This approach is taken from
https://github.com/open-ideas/IDEAS/tree/master/IDEAS/Scripts/mergeAnnex60Script.py
'''

fileName = "mergePaths.json"
if os.path.isfile(fileName):
    with open(fileName, 'r') as dataFile:
        data = json.loads(dataFile.read())
        ibpsa_dir = data['ibpsa_dir']
        aixlib_dir = data['aixlib_dir']

else:
    print(
        fileName +
        " could not be found in your current working directory, please enter source and destination paths. \nThey will be saved for next time. Remove "
        + fileName + " to reset the paths.")
    ibpsa_dir = input("Enter path of IBPSA Modelica Library: \n")
    aixlib_dir = input("Enter path of AixLib: \n")
    data = {"ibpsa_dir": ibpsa_dir, "aixlib_dir": aixlib_dir}
    with open(fileName, 'w') as dataFile:
        json.dump(data, dataFile)

mer = m.IBPSA(ibpsa_dir, aixlib_dir)
mer.set_excluded_packages(["Experimental", "Obsolete"])
mer.merge()
示例#5
0
import buildingspy.development.merger as m
import os
modelicapath = os.environ["MODELICAPATH"]
ibpsa_dir = os.path.join(modelicapath, "IBPSA")
dest_dir = os.path.join(modelicapath, "IbpsaMpc")
mer = m.IBPSA(ibpsa_dir, dest_dir)  # doctest: +SKIP

files = {
    "IBPSA.Fluid.Sources.Boundary_pT": {},
    "IBPSA.Fluid.Sources.Boundary_ph": {},
    "IBPSA.Fluid.Sources.MassFlowSource_T": {},
    "IBPSA.Fluid.Sources.MassFlowSource_h": {},
    "IBPSA.Fluid.Sources.PropertySource_T": {},
    "IBPSA.Fluid.Sources.PropertySource_h": {},
    "IBPSA.Fluid.Sources.BaseClasses.PartialPropertySource": {},
    "IBPSA.Fluid.Sources.BaseClasses.PartialSource": {},
    "IBPSA.Fluid.Sources.BaseClasses.PartialSource_Xi_C": {},
    "IBPSA.Fluid.Interfaces.PartialTwoPort": {},
    "IBPSA.Media.Air": {},
    "IBPSA.Utilities.Psychrometrics.Constants": {},
    # "": {},
    # "": {},
}

mer.mergeIbpsaMpc(files)