Пример #1
0
    def add_asset_and_emit(self, esh: EnergySystemHandler, es_id: str, asset: EnergyAsset, area_bld_id: str):
        with self.flask_app.app_context():
            asset_to_be_added_list = list()
            port_list = self.calculate_port_list(asset)
            message = self.create_asset_discription_message(asset, port_list)
            asset_to_be_added_list.append(message)

            if not ESDLAsset.add_object_to_area(esh.get_energy_system(es_id), asset, area_bld_id):
                ESDLAsset.add_object_to_building(esh.get_energy_system(es_id), asset, area_bld_id)

            emit('add_esdl_objects', {'es_id': es_id, 'asset_pot_list': asset_to_be_added_list, 'zoom': False}, namespace='/esdl')
def get_or_create_esi_qau(esh: EnergySystemHandler,
                          active_es_id: str) -> esdl.QuantityAndUnits:
    es: esdl.EnergySystem = esh.get_energy_system(active_es_id)
    if not es.energySystemInformation:
        esi: esdl.EnergySystemInformation = esdl.EnergySystemInformation(
            id=str(uuid4()))
        es.energySystemInformation = esi
        esh.add_object_to_dict(active_es_id, esi)
    if not es.energySystemInformation.quantityAndUnits:
        qaus = esdl.QuantityAndUnits(id=str(uuid4()))
        es.energySystemInformation.quantityAndUnits = qaus
        esh.add_object_to_dict(active_es_id, qaus)
    return es.energySystemInformation.quantityAndUnits
from src.shape import Shape
from esdl.esdl_handler import EnergySystemHandler

esh = EnergySystemHandler()
esh.load_file('Nesselande contour warmtenet.esdl')
# esh.load_file('Arnhem Schuytgraaf contour warmtenet.esdl')

es = esh.get_energy_system()
polygon = es.instance[0].area.area[0].geometry

shape = Shape.create(polygon)
print(shape.get_wkt())