From 46d1dd213844da6ae7f1c7bc13e969da1057bd1f Mon Sep 17 00:00:00 2001 From: Arun Subramanian Date: Thu, 11 Mar 2021 13:47:39 +0100 Subject: [PATCH 01/12] Added new API endpoint for converting validation results to MapEditor JSON format. --- .../api/controller/validationToMessages.py | 154 ++++++++++++++++++ esdlvalidator/api/setup.py | 1 + 2 files changed, 155 insertions(+) create mode 100644 esdlvalidator/api/controller/validationToMessages.py diff --git a/esdlvalidator/api/controller/validationToMessages.py b/esdlvalidator/api/controller/validationToMessages.py new file mode 100644 index 0000000..3e63049 --- /dev/null +++ b/esdlvalidator/api/controller/validationToMessages.py @@ -0,0 +1,154 @@ +import json +import uuid +from datetime import datetime as dt +from math import cos, sin, atan2, sqrt, radians, degrees + +from flask import request, Response +from flask_restx import Resource +from pyecore.resources import ResourceSet +from pyecore.resources.resource import HttpURI + +from esdlvalidator.api import app +from esdlvalidator.api.controller import validationService +from esdlvalidator.core.esdl import EnergySystemInformation, Notes, Line, Point, Polygon, Note +from esdlvalidator.core.esdl.esh import StringURI +from esdlvalidator.core.esdl.resources.xmlresource import XMLResource +from esdlvalidator.core.exceptions import SchemaNotFound +from esdlvalidator.validation.functions import utils + +parser = app.api.parser() + + +@app.ns_validation_to_msgs.route('/') +class ValidationToMessagesController(Resource): + """Validate an ESDL file and return an ESDL with notes""" + + @app.ns_validation_to_msgs.doc(description="Post a new validation schema", responses={ + 200: "Ok", + 404: "Schema not found", + 400: "Unknown filetype, Invalid ESDL"}) + @app.api.expect(parser, validate=True) + def post(self): + """Validate an ESDL file against one or more validation schemas""" + + file = request.data.decode('utf-8') + if "schemas" not in request.args: + return "Bad Request: Required 'schemas' parameter missing", 400 + schema_list = [id for id in request.args['schemas'].split(',')] + try: + result = validationService.validateContents(file, schema_list) + except SchemaNotFound as e: + return e.message, 400 + + json_result = [] + + if 'schemas' in result: + for schema in result['schemas']: + if 'validations' in schema: + for validation in schema['validations']: + if 'errors' in validation: + for error in validation['errors']: + if 'offending_asset' in error: + asset = error['offending_asset'] + msgs = self.get_messages(json_result, asset) + msgs.append({'message': error['message'], 'severity': 'ERROR'}) + json_result = self.set_messages(json_result, asset, msgs) + if 'warnings' in validation: + for warning in validation['warnings']: + if 'offending_asset' in warning: + asset = warning['offending_asset'] + msgs = self.get_messages(json_result, asset) + msgs.append({'message': warning['message'], 'severity': 'WARNING'}) + json_result = self.set_messages(json_result, asset, msgs) + + return Response(response=json.dumps(json_result), status=200, mimetype='text/json') + + @staticmethod + def get_messages(result, asset): + for element in result: + if element["assetID"] == asset: + return element["messages"] + return [] + + @staticmethod + def set_messages(result, asset, msgs): + for element in result: + if element["assetID"] == asset: + element["messages"] = msgs + return result + result.append({"assetID": asset, "messages": msgs}) + return result + + def update_esdl(self, resource, results: dict): + asset_notes = {} + now = dt.now() + + notes = Notes() + notes.id = str(uuid.uuid4()) + notes.name = "Validation Notes" + + for schema in results['schemas']: + for validation in schema['validations']: + if "errors" in validation: + for error in validation['errors']: + if isinstance(error, dict): + asset_id = error["offending_asset"] + message = error["message"] + if asset_id in asset_notes: + note = asset_notes[asset_id] + note.text = note.text + "\nERROR: {}".format(message) + else: + asset = resource.uuid_dict[asset_id] + p = self.get_center_point(asset) + note = Note(id=str(uuid.uuid4()), mapLocation=p, author="ESDLValidatorService", + title=asset_id, text="ERROR: {}".format(message), date=now) + asset_notes[asset_id] = note + if "warnings" in validation: + for warning in validation['warnings']: + if isinstance(warning, dict): + asset_id = warning["offending_asset"] + message = warning["message"] + if asset_id in asset_notes: + note = asset_notes[asset_id] + note.text = note.text + "\nWARNING: {}".format(message) + else: + asset = resource.uuid_dict[asset_id] + p = self.get_center_point(asset) + note = Note(id=str(uuid.uuid4()), mapLocation=p, author="ESDLValidatorService", + title=asset_id, text="WARNING: {}".format(message), date=now) + asset_notes[asset_id] = note + for n in asset_notes.values(): + notes.note.append(n) + + return notes + + @staticmethod + def get_center_point(asset): + a = asset + while not utils.has_attribute(a, 'geometry'): + a = a.eContainer() + geometry = a.geometry + points = None + if isinstance(geometry, Polygon): + points = geometry.exterior[0:2] + elif isinstance(geometry, Line): + points = geometry.point[0:2] + elif isinstance(geometry, Point): + points = [geometry] + x = [] + y = [] + z = [] + for p in points: + x.append(cos(radians(p.lat)) * cos(radians(p.lon))) + y.append(cos(radians(p.lat)) * sin(radians(p.lon))) + z.append(sin(radians(p.lat))) + + x_avg = (sum(x) / len(x)) + y_avg = (sum(y) / len(y)) + z_avg = (sum(z) / len(z)) + + lon = atan2(y_avg, x_avg) + hyp = sqrt(x_avg * x_avg + y_avg * y_avg) + lat = atan2(z_avg, hyp) + + return Point(lat=degrees(lat), lon=degrees(lon)) diff --git a/esdlvalidator/api/setup.py b/esdlvalidator/api/setup.py index e177411..5291a2d 100644 --- a/esdlvalidator/api/setup.py +++ b/esdlvalidator/api/setup.py @@ -50,4 +50,5 @@ def __init__(self): self.api = Api(self.apiBlueprint, version=self.settings.version, title=self.settings.title, description=self.settings.description) self.ns_validation = self.api.namespace("validation", "ESDL validation endpoint") self.ns_validation_to_notes = self.api.namespace("validationToNotes", "ESDL-aas validation endpoint") + self.ns_validation_to_msgs = self.api.namespace("validationToMessages", "ESDL-aas validation endpoint to return JSON") self.ns_schema = self.api.namespace("schema", "Validation schema endpoint") From aa623dd40e194d92bf2bf259f32c5f54d2180691 Mon Sep 17 00:00:00 2001 From: Arun Subramanian Date: Thu, 9 Sep 2021 14:07:49 +0200 Subject: [PATCH 02/12] Migrated from static esdl to pyESDL --- .../api/controller/validationToMessages.py | 6 +- .../api/controller/validationToNotes.py | 7 +- esdlvalidator/api/manage.py | 1 + esdlvalidator/core/esdl/__init__.py | 242 - esdlvalidator/core/esdl/esdl.py | 4922 ----------------- esdlvalidator/core/esdl/esh.py | 98 - .../core/esdl/resources/xmlresource.py | 65 - esdlvalidator/core/esdl/utils.py | 4 +- .../functions/tests/test_function_select.py | 2 +- requirements.txt | 3 +- 10 files changed, 9 insertions(+), 5341 deletions(-) delete mode 100644 esdlvalidator/core/esdl/__init__.py delete mode 100644 esdlvalidator/core/esdl/esdl.py delete mode 100644 esdlvalidator/core/esdl/esh.py delete mode 100644 esdlvalidator/core/esdl/resources/xmlresource.py diff --git a/esdlvalidator/api/controller/validationToMessages.py b/esdlvalidator/api/controller/validationToMessages.py index 3e63049..6c28d9e 100644 --- a/esdlvalidator/api/controller/validationToMessages.py +++ b/esdlvalidator/api/controller/validationToMessages.py @@ -3,16 +3,12 @@ from datetime import datetime as dt from math import cos, sin, atan2, sqrt, radians, degrees +from esdl import Notes, Line, Point, Polygon, Note from flask import request, Response from flask_restx import Resource -from pyecore.resources import ResourceSet -from pyecore.resources.resource import HttpURI from esdlvalidator.api import app from esdlvalidator.api.controller import validationService -from esdlvalidator.core.esdl import EnergySystemInformation, Notes, Line, Point, Polygon, Note -from esdlvalidator.core.esdl.esh import StringURI -from esdlvalidator.core.esdl.resources.xmlresource import XMLResource from esdlvalidator.core.exceptions import SchemaNotFound from esdlvalidator.validation.functions import utils diff --git a/esdlvalidator/api/controller/validationToNotes.py b/esdlvalidator/api/controller/validationToNotes.py index 591dd03..09e2410 100644 --- a/esdlvalidator/api/controller/validationToNotes.py +++ b/esdlvalidator/api/controller/validationToNotes.py @@ -2,16 +2,13 @@ from datetime import datetime as dt from math import cos, sin, atan2, sqrt, radians, degrees +from esdl import Notes, Line, Point, Polygon, Note +from esdl.esdl_handler import StringURI from flask import request, Response from flask_restx import Resource -from pyecore.resources import ResourceSet -from pyecore.resources.resource import HttpURI from esdlvalidator.api import app from esdlvalidator.api.controller import validationService -from esdlvalidator.core.esdl import EnergySystemInformation, Notes, Line, Point, Polygon, Note -from esdlvalidator.core.esdl.esh import StringURI -from esdlvalidator.core.esdl.resources.xmlresource import XMLResource from esdlvalidator.core.exceptions import SchemaNotFound from esdlvalidator.validation.functions import utils diff --git a/esdlvalidator/api/manage.py b/esdlvalidator/api/manage.py index 7352387..43b457b 100644 --- a/esdlvalidator/api/manage.py +++ b/esdlvalidator/api/manage.py @@ -7,6 +7,7 @@ from esdlvalidator.api.controller.validation import app as validationApi from esdlvalidator.api.controller.schema import app as schemaApi from esdlvalidator.api.controller.validationToNotes import app as validationToNotesApi +from esdlvalidator.api.controller.validationToMessages import app as validationToMsgsApi from esdlvalidator.core.exceptions import ApiException logger = logging.getLogger(__name__) diff --git a/esdlvalidator/core/esdl/__init__.py b/esdlvalidator/core/esdl/__init__.py deleted file mode 100644 index c2364ec..0000000 --- a/esdlvalidator/core/esdl/__init__.py +++ /dev/null @@ -1,242 +0,0 @@ -from pyecore.resources import global_registry -from .esdl import getEClassifier, eClassifiers -from .esdl import name, nsURI, nsPrefix, eClass -from .esdl import EnergyAsset, Producer, Consumer, Storage, Conversion, Transport, CommodityEnum, EnergySystem, WindTurbine, PVPanel, Battery, ElectricityNetwork, ElectricityCable, AggregatedConsumer, BuildingUnit, Area, Port, AggregatedProducer, AreaScopeEnum, ProfileTypeEnum, DurationUnitEnum, InPort, OutPort, Asset, GenericConsumer, GenericProducer, GenericStorage, GenericTransport, GenericConversion, AggregatedTransport, AggregatedConversion, AggregatedStorage, BuildingTypeEnum, GenericBuilding, ConsTypeEnum, HeatStorage, GasHeater, HeatNetwork, GasNetwork, Insulation, Import, Export, Pipe, GeothermalSource, CoGeneration, HeatPump, SourceTypeEnum, AggrTypeEnum, AreaTypeEnum, HeatingDemand, HeatDemandTypeEnum, ElectricityDemand, GasDemand, GeothermalPotential, Point, Polygon, OwnershipRentalTypeEnum, EconomicProperties, SocialProperties, LegalArea, RoofTypeEnum, EnergyLabelEnum, EnergyService, DemandResponseService, Transformer, HeatExchange, ResidentialBuildingTypeEnum, Item, Measures, EConnection, HConnection, GConnection, PowerPlant, PowerPlantFuelEnum, AbstractBuilding, Instance, Service, AggregatorService, EVChargingStation, Potential, WindPotential, AggregatedBuilding, SectorEnum, EnergyCarrier, Losses, PowerToX, CCS, RenewableTypeEnum, StateOfMatterEnum, Carriers, FuelCell, XToPower, EnergySystemInformation, Pump, Valve, GenericProfile, StaticProfile, DateTimeProfile, ProfileElement, ExternalProfile, SingleValue, GenericDistribution, Percentile, PercentileDistribution, CoolingDemand, Airco, CostInformation, SpecificLabelDistribution, StringLabelDistribution, EnergyLabelDistribution, StringItem, EnergyLabelPerc, FromToDistribution, FromToItem, PItemStat, AbstractVariance, SymmetricVariance, AssymmetricVariance, DoubleAssymmetricVariance, GeothermalSourceTypeEnum, CHPTypeEnum, CHP, Party, URIProfile, DatabaseProfile, InfluxDBProfile, Line, Geometry, GlazingTypeEnum, VentilationTypeEnum, GasHeaterTypeEnum, InhabitantsTypeEnum, AdditionalHeatingSourceTypeEnum, GeothermalPotentialEnum, GeothermalPowerEnum, Commodity, GasCommodity, HeatCommodity, ElectricityCommodity, Carrier, Range, SolarPotential, Duration, ProfileReference, Profiles, Parties, DataSources, DataSource, EnergyDemand, SolarCollector, ResidualHeatSource, ResidualHeatSourceTypeEnum, FermentationPlant, ResidualHeatSourcePotential, SubPolygon, MultiPolygon, EnergyCommodity, MobilityDemand, MobilityFuelTypeEnum, VehicleTypeEnum, MobilityFuelInformation, VehicleFuelEfficiency, MobilityProperties, NumberOfVehicles, VehicleCount, Electrolyzer, GasStorage, Services, ControlStrategy, DrivenByDemand, QuantityAndUnitType, MultiplierEnum, PhysicalQuantityEnum, UnitEnum, AbstractDataSource, DataSourceReference, TimeUnitEnum, KPIs, KPI, QuantityAndUnits, AbstractQuantityAndUnit, QuantityAndUnitReference, EnergyMarket, GasConversion, GasConversionTypeEnum, Parameters, StringParameter, DoubleParameter, IntegerParameter, BooleanParameter, DrivenBySupply, DrivenByProfile, PVInstallation, PVInstallationTypeEnum, WindTurbineTypeEnum, CircuitBreaker, Measure, WaterToPower, WaterToPowerTypeEnum, Sectors, Sector, EnergyNetwork, AbstractConductor, AbstractSwitch, AbstractTransformer, AbstractConnection, MultiLine, SolarCollectorTypeEnum, HeatRadiationDeviceTypeEnum, CoolingDeviceType, GeothermalEnergyPotential, AbstractGTPotential, UTESPotential, AbstractInstanceDate, InstanceDate, InstancePeriod, RoomHeater, RoomHeaterTypeEnum, BiomassPotential, BiomassHeater, BiomassHeaterTypeEnum, UTESPotentialTypeEnum, UTES, WaterBuffer, UTESTypeEnum, Glazing, InterpolationMethodEnum, WKT, WKB, SearchAreaWind, SearchAreaSolar, Joint, StorageStrategy, CurtailmentStrategy, PVTInstallation, BuildingUsage, WeekSchedule, DaySchedule, Event, AbstractBuildingUsage, BuildingUsageReference, BuildingUsageInformation, BuildingTypeDistribution, BuildingTypePercentage, ResidentialBuildingTypeDistribution, ResidentialBuildingTypePercentage, OwnershipRentalTypeDistribution, OwnershipRentalTypePercentage, DoubleKPI, StringKPI, IntKPI, FromToIntItem, FromToDoubleItem, Matter, PipeDiameterEnum, Bus, AbstractSensor, Sensor, Switch, Compressor, PressureReducingValve, CompoundMatter, CompoundMatterComponent, PIDController, PVPark, WindPark, IntTargetKPI, DoubleTargetKPI, StringTargetKPI, AssetStateEnum, Restriction, BuildingTypeRestriction, AreaTypeRestriction, Templates, AssetTemplate, TemplatedAsset, Address, QuantityAndUnitScopeEnum, GenericLabelDistribution, DistributionKPI, SinkConsumer, SourceProducer, MinimumLabelRestriction, LabelJump, AbstractMeasure, MeasureReference, Building, BuildingInformation, ResidentialBuildingInformation, BuildingStructureInformation, CompoundAsset, InitialValue, Table, TableRow, ValveTypeEnum, AbstractActiveSwitch, AbstractPassiveSwitch, CheckValve, AirVessel, Notes, Note, Fuel, Material, Matters, AbstractMatter, MatterReference, CompoundTypeEnum, EnvironmentalProfiles, AbstractBehaviour, GenericTransferFunction, InputOutputQuantityRelation, DelayTransferFunction, AbstractTransferFunction, CombinedTransferFunction, CombinationFunctionEnum, TransferFunctionTypeEnum, ElectricityProducer, HeatProducer, GasProducer, MeasureTypeEnum - - -from . import esdl - -__all__ = ['EnergyAsset', 'Producer', 'Consumer', 'Storage', 'Conversion', 'Transport', 'CommodityEnum', 'EnergySystem', 'WindTurbine', 'PVPanel', 'Battery', 'ElectricityNetwork', 'ElectricityCable', 'AggregatedConsumer', 'BuildingUnit', 'Area', 'Port', 'AggregatedProducer', 'AreaScopeEnum', 'ProfileTypeEnum', 'DurationUnitEnum', 'InPort', 'OutPort', 'Asset', 'GenericConsumer', 'GenericProducer', 'GenericStorage', 'GenericTransport', 'GenericConversion', 'AggregatedTransport', 'AggregatedConversion', 'AggregatedStorage', 'BuildingTypeEnum', 'GenericBuilding', 'ConsTypeEnum', 'HeatStorage', 'GasHeater', 'HeatNetwork', 'GasNetwork', 'Insulation', 'Import', 'Export', 'Pipe', 'GeothermalSource', 'CoGeneration', 'HeatPump', 'SourceTypeEnum', 'AggrTypeEnum', 'AreaTypeEnum', 'HeatingDemand', 'HeatDemandTypeEnum', 'ElectricityDemand', 'GasDemand', 'GeothermalPotential', 'Point', 'Polygon', 'OwnershipRentalTypeEnum', 'EconomicProperties', 'SocialProperties', 'LegalArea', 'RoofTypeEnum', 'EnergyLabelEnum', 'EnergyService', 'DemandResponseService', 'Transformer', 'HeatExchange', 'ResidentialBuildingTypeEnum', 'Item', 'Measures', 'EConnection', 'HConnection', 'GConnection', 'PowerPlant', 'PowerPlantFuelEnum', 'AbstractBuilding', 'Instance', 'Service', 'AggregatorService', 'EVChargingStation', 'Potential', 'WindPotential', 'AggregatedBuilding', 'SectorEnum', 'EnergyCarrier', 'Losses', 'PowerToX', 'CCS', 'RenewableTypeEnum', 'StateOfMatterEnum', 'Carriers', 'FuelCell', 'XToPower', 'EnergySystemInformation', 'Pump', 'Valve', 'GenericProfile', 'StaticProfile', 'DateTimeProfile', 'ProfileElement', 'ExternalProfile', 'SingleValue', 'GenericDistribution', 'Percentile', 'PercentileDistribution', 'CoolingDemand', 'Airco', 'CostInformation', 'SpecificLabelDistribution', 'StringLabelDistribution', 'EnergyLabelDistribution', 'StringItem', 'EnergyLabelPerc', 'FromToDistribution', 'FromToItem', 'PItemStat', 'AbstractVariance', 'SymmetricVariance', 'AssymmetricVariance', 'DoubleAssymmetricVariance', 'GeothermalSourceTypeEnum', 'CHPTypeEnum', 'CHP', 'Party', 'URIProfile', 'DatabaseProfile', 'InfluxDBProfile', 'Line', 'Geometry', 'GlazingTypeEnum', 'VentilationTypeEnum', 'GasHeaterTypeEnum', 'InhabitantsTypeEnum', 'AdditionalHeatingSourceTypeEnum', 'GeothermalPotentialEnum', 'GeothermalPowerEnum', 'Commodity', 'GasCommodity', 'HeatCommodity', 'ElectricityCommodity', 'Carrier', 'Range', 'SolarPotential', 'Duration', 'ProfileReference', 'Profiles', 'Parties', 'DataSources', 'DataSource', 'EnergyDemand', 'SolarCollector', 'ResidualHeatSource', 'ResidualHeatSourceTypeEnum', 'FermentationPlant', 'ResidualHeatSourcePotential', 'SubPolygon', 'MultiPolygon', 'EnergyCommodity', 'MobilityDemand', 'MobilityFuelTypeEnum', 'VehicleTypeEnum', 'MobilityFuelInformation', 'VehicleFuelEfficiency', 'MobilityProperties', 'NumberOfVehicles', 'VehicleCount', 'Electrolyzer', 'GasStorage', 'Services', - 'ControlStrategy', 'DrivenByDemand', 'QuantityAndUnitType', 'MultiplierEnum', 'PhysicalQuantityEnum', 'UnitEnum', 'AbstractDataSource', 'DataSourceReference', 'TimeUnitEnum', 'KPIs', 'KPI', 'QuantityAndUnits', 'AbstractQuantityAndUnit', 'QuantityAndUnitReference', 'EnergyMarket', 'GasConversion', 'GasConversionTypeEnum', 'Parameters', 'StringParameter', 'DoubleParameter', 'IntegerParameter', 'BooleanParameter', 'DrivenBySupply', 'DrivenByProfile', 'PVInstallation', 'PVInstallationTypeEnum', 'WindTurbineTypeEnum', 'CircuitBreaker', 'Measure', 'WaterToPower', 'WaterToPowerTypeEnum', 'Sectors', 'Sector', 'EnergyNetwork', 'AbstractConductor', 'AbstractSwitch', 'AbstractTransformer', 'AbstractConnection', 'MultiLine', 'SolarCollectorTypeEnum', 'HeatRadiationDeviceTypeEnum', 'CoolingDeviceType', 'GeothermalEnergyPotential', 'AbstractGTPotential', 'UTESPotential', 'AbstractInstanceDate', 'InstanceDate', 'InstancePeriod', 'RoomHeater', 'RoomHeaterTypeEnum', 'BiomassPotential', 'BiomassHeater', 'BiomassHeaterTypeEnum', 'UTESPotentialTypeEnum', 'UTES', 'WaterBuffer', 'UTESTypeEnum', 'Glazing', 'InterpolationMethodEnum', 'WKT', 'WKB', 'SearchAreaWind', 'SearchAreaSolar', 'Joint', 'StorageStrategy', 'CurtailmentStrategy', 'PVTInstallation', 'BuildingUsage', 'WeekSchedule', 'DaySchedule', 'Event', 'AbstractBuildingUsage', 'BuildingUsageReference', 'BuildingUsageInformation', 'BuildingTypeDistribution', 'BuildingTypePercentage', 'ResidentialBuildingTypeDistribution', 'ResidentialBuildingTypePercentage', 'OwnershipRentalTypeDistribution', 'OwnershipRentalTypePercentage', 'DoubleKPI', 'StringKPI', 'IntKPI', 'FromToIntItem', 'FromToDoubleItem', 'Matter', 'PipeDiameterEnum', 'Bus', 'AbstractSensor', 'Sensor', 'Switch', 'Compressor', 'PressureReducingValve', 'CompoundMatter', 'CompoundMatterComponent', 'PIDController', 'PVPark', 'WindPark', 'IntTargetKPI', 'DoubleTargetKPI', 'StringTargetKPI', 'AssetStateEnum', 'Restriction', 'BuildingTypeRestriction', 'AreaTypeRestriction', 'Templates', 'AssetTemplate', 'TemplatedAsset', 'Address', 'QuantityAndUnitScopeEnum', 'GenericLabelDistribution', 'DistributionKPI', 'SinkConsumer', 'SourceProducer', 'MinimumLabelRestriction', 'LabelJump', 'AbstractMeasure', 'MeasureReference', 'Building', 'BuildingInformation', 'ResidentialBuildingInformation', 'BuildingStructureInformation', 'CompoundAsset', 'InitialValue', 'Table', 'TableRow', 'ValveTypeEnum', 'AbstractActiveSwitch', 'AbstractPassiveSwitch', 'CheckValve', 'AirVessel', 'Notes', 'Note', 'Fuel', 'Material', 'Matters', 'AbstractMatter', 'MatterReference', 'CompoundTypeEnum', 'EnvironmentalProfiles', 'AbstractBehaviour', 'GenericTransferFunction', 'InputOutputQuantityRelation', 'DelayTransferFunction', 'AbstractTransferFunction', 'CombinedTransferFunction', 'CombinationFunctionEnum', 'TransferFunctionTypeEnum', 'ElectricityProducer', 'HeatProducer', 'GasProducer', 'MeasureTypeEnum'] - -eSubpackages = [] -eSuperPackage = None -esdl.eSubpackages = eSubpackages -esdl.eSuperPackage = eSuperPackage - -EnergyAsset.behaviour.eType = AbstractBehaviour -Storage.profile.eType = GenericProfile -EnergySystem.measures.eType = Measures -EnergySystem.instance.eType = Instance -EnergySystem.energySystemInformation.eType = EnergySystemInformation -EnergySystem.parties.eType = Parties -EnergySystem.services.eType = Services -EnergySystem.templates.eType = Templates -AggregatedConsumer.aggregationOf.eType = Consumer -Area.socialProperties.eType = SocialProperties -Area.economicProperties.eType = EconomicProperties -Area.mobilityProperties.eType = MobilityProperties -Area.KPIs.eType = KPIs -Area.potential.eType = Potential -Area.geometry.eType = Geometry -Area.measures.eType = Measures -Area.sector.eType = Sector -Port.profile.eType = GenericProfile -Port.carrier.eType = Carrier -AggregatedProducer.aggregationOf.eType = Producer -Asset.geometry.eType = Geometry -Asset.costInformation.eType = CostInformation -Asset.KPIs.eType = KPIs -Asset.material.eType = AbstractMatter -AggregatedTransport.aggregationOf.eType = Transport -AggregatedConversion.aggregationOf.eType = Conversion -AggregatedStorage.aggregationOf.eType = Storage -GenericBuilding.address.eType = Address -GenericBuilding.buildinginformation.eType = BuildingInformation -CoGeneration.energyCarrier.eType = EnergyCarrier -Polygon.exterior.eType = SubPolygon -Polygon.interior.eType = SubPolygon -Item.dataSource.eType = AbstractDataSource -Item.sector.eType = Sector -Measures.measure.eType = AbstractMeasure -PowerPlant.energyCarrier.eType = EnergyCarrier -PowerPlant.mustRun.eType = GenericProfile -AbstractBuilding.buildingUsage.eType = AbstractBuildingUsage -AbstractBuilding.potential.eType = Potential -Instance.area.eType = Area -Instance.date.eType = AbstractInstanceDate -Potential.geometry.eType = Geometry -Potential.quantityAndUnit.eType = AbstractQuantityAndUnit -AggregatedBuilding.aggregationOf.eType = AbstractBuilding -AggregatedBuilding.energyLabelDistribution.eType = EnergyLabelDistribution -AggregatedBuilding.buildingYearDistribution.eType = FromToDistribution -AggregatedBuilding.buildingTypeDistribution.eType = BuildingTypeDistribution -AggregatedBuilding.residentialBuildingTypeDistribution.eType = ResidentialBuildingTypeDistribution -AggregatedBuilding.ownershipRentalTypeDistribution.eType = OwnershipRentalTypeDistribution -EnergyCarrier.energyContentUnit.eType = AbstractQuantityAndUnit -EnergyCarrier.emissionUnit.eType = AbstractQuantityAndUnit -EnergyCarrier.composition.eType = AbstractMatter -Carriers.carrier.eType = Carrier -Carriers.dataSource.eType = AbstractDataSource -EnergySystemInformation.carriers.eType = Carriers -EnergySystemInformation.profiles.eType = Profiles -EnergySystemInformation.dataSources.eType = DataSources -EnergySystemInformation.mobilityFuelInformation.eType = MobilityFuelInformation -EnergySystemInformation.quantityAndUnits.eType = QuantityAndUnits -EnergySystemInformation.sectors.eType = Sectors -EnergySystemInformation.buildingUsageInformation.eType = BuildingUsageInformation -EnergySystemInformation.notes.eType = Notes -EnergySystemInformation.matters.eType = Matters -EnergySystemInformation.environmentalProfiles.eType = EnvironmentalProfiles -Pump.pumpCurveTable.eType = Table -Valve.flowCoefficient.eType = Table -GenericProfile.dataSource.eType = AbstractDataSource -GenericProfile.profileQuantityAndUnit.eType = AbstractQuantityAndUnit -DateTimeProfile.element.eType = ProfileElement -PercentileDistribution.percentile.eType = Percentile -CostInformation.investmentCosts.eType = GenericProfile -CostInformation.installationCosts.eType = GenericProfile -CostInformation.fixedOperationalAndMaintenanceCosts.eType = GenericProfile -CostInformation.marginalCosts.eType = GenericProfile -CostInformation.variableOperationalAndMaintenanceCosts.eType = GenericProfile -CostInformation.discountRate.eType = GenericProfile -CostInformation.variableOperationalCosts.eType = GenericProfile -CostInformation.fixedMaintenanceCosts.eType = GenericProfile -CostInformation.fixedOperationalCosts.eType = GenericProfile -CostInformation.variableMaintenanceCosts.eType = GenericProfile -StringLabelDistribution.stringItem.eType = StringItem -EnergyLabelDistribution.labelPerc.eType = EnergyLabelPerc -FromToDistribution.fromToItem.eType = FromToItem -Party.sector.eType = Sector -Line.point.eType = Point -Carrier.cost.eType = GenericProfile -Carrier.dataSource.eType = AbstractDataSource -ProfileReference.reference.eType = GenericProfile -Profiles.profile.eType = GenericProfile -Parties.party.eType = Party -DataSources.dataSource.eType = DataSource -SubPolygon.point.eType = Point -MultiPolygon.polygon.eType = Polygon -MobilityFuelInformation.vehicleFuelEfficiency.eType = VehicleFuelEfficiency -MobilityFuelInformation.dataSource.eType = AbstractDataSource -MobilityProperties.numberOfVehicles.eType = NumberOfVehicles -NumberOfVehicles.vehicleCount.eType = VehicleCount -Services.service.eType = Service -DrivenByDemand.outPort.eType = OutPort -DataSourceReference.reference.eType = DataSource -KPIs.kpi.eType = KPI -KPI.quantityAndUnit.eType = AbstractQuantityAndUnit -QuantityAndUnits.quantityAndUnit.eType = QuantityAndUnitType -QuantityAndUnitReference.reference.eType = QuantityAndUnitType -EnergyMarket.asset.eType = Asset -EnergyMarket.carrier.eType = Carrier -EnergyMarket.parameters.eType = Parameters -EnergyMarket.marketPrice.eType = GenericProfile -Parameters.parameterUnit.eType = AbstractQuantityAndUnit -DrivenBySupply.inPort.eType = InPort -DrivenByProfile.profile.eType = GenericProfile -DrivenByProfile.port.eType = Port -Measure.asset.eType = Asset -Measure.costInformation.eType = CostInformation -Measure.restriction.eType = Restriction -Measure.labelJump.eType = LabelJump -Sectors.sector.eType = Sector -Sectors.dataSource.eType = AbstractDataSource -Sector.dataSource.eType = AbstractDataSource -MultiLine.line.eType = Line -StorageStrategy.marginalChargeCosts.eType = GenericProfile -StorageStrategy.marginalDischargeCosts.eType = GenericProfile -BuildingUsage.coolingSetpoints.eType = WeekSchedule -BuildingUsage.heatingSetpoints.eType = WeekSchedule -BuildingUsage.openingHours.eType = WeekSchedule -WeekSchedule.mon.eType = DaySchedule -WeekSchedule.tue.eType = DaySchedule -WeekSchedule.wed.eType = DaySchedule -WeekSchedule.thu.eType = DaySchedule -WeekSchedule.fri.eType = DaySchedule -WeekSchedule.sat.eType = DaySchedule -WeekSchedule.sun.eType = DaySchedule -WeekSchedule.weekdays.eType = DaySchedule -WeekSchedule.weekenddays.eType = DaySchedule -DaySchedule.event.eType = Event -BuildingUsageReference.reference.eType = BuildingUsage -BuildingUsageInformation.buildingUsage.eType = BuildingUsage -BuildingTypeDistribution.buildingTypePercentage.eType = BuildingTypePercentage -ResidentialBuildingTypeDistribution.residentialBuildingTypePercentage.eType = ResidentialBuildingTypePercentage -OwnershipRentalTypeDistribution.ownershipRentalTypePercentage.eType = OwnershipRentalTypePercentage -DoubleKPI.target.eType = DoubleTargetKPI -StringKPI.target.eType = StringTargetKPI -IntKPI.target.eType = IntTargetKPI -Sensor.quantityAndUnit.eType = AbstractQuantityAndUnit -CompoundMatter.component.eType = CompoundMatterComponent -CompoundMatterComponent.matter.eType = AbstractMatter -PIDController.sensor.eType = Sensor -PIDController.setPoint.eType = GenericProfile -Templates.assetTemplate.eType = AssetTemplate -AssetTemplate.asset.eType = Asset -TemplatedAsset.asset.eType = Asset -TemplatedAsset.template.eType = AssetTemplate -DistributionKPI.distribution.eType = GenericLabelDistribution -LabelJump.buildingYearRange.eType = Range -MeasureReference.reference.eType = Measure -CompoundAsset.asset.eType = Asset -Table.row.eType = TableRow -Table.header.eType = AbstractQuantityAndUnit -Table.datasource.eType = AbstractDataSource -Notes.note.eType = Note -Note.mapLocation.eType = Point -Fuel.energyContentUnit.eType = AbstractQuantityAndUnit -Fuel.emissionUnit.eType = AbstractQuantityAndUnit -Matters.dataSource.eType = AbstractDataSource -Matters.matter.eType = Matter -MatterReference.reference.eType = Matter -EnvironmentalProfiles.outsideTemperatureProfile.eType = GenericProfile -EnvironmentalProfiles.solarIrradianceProfile.eType = GenericProfile -EnvironmentalProfiles.windSpeedProfile.eType = GenericProfile -EnvironmentalProfiles.windDirectionProfile.eType = GenericProfile -EnvironmentalProfiles.soilTemperatureProfile.eType = GenericProfile -EnvironmentalProfiles.relativeHumidityProfile.eType = GenericProfile -CombinedTransferFunction.component.eType = AbstractTransferFunction -EnergyAsset.port.eType = Port -EnergyAsset.controlStrategy.eType = ControlStrategy -Conversion.residualHeatSourcePotential.eType = ResidualHeatSourcePotential -Area.asset.eType = Asset -Area.area.eType = Area -Area.containingArea.eType = Area -Area.containingArea.eOpposite = Area.area -Area.isOwnedBy.eType = Party -Port.energyasset.eType = EnergyAsset -Port.energyasset.eOpposite = EnergyAsset.port -InPort.connectedTo.eType = OutPort -OutPort.connectedTo.eType = InPort -OutPort.connectedTo.eOpposite = InPort.connectedTo -Asset.area.eType = Area -Asset.area.eOpposite = Area.asset -Asset.containingBuilding.eType = AbstractBuilding -GeothermalSource.geothermalPotential.eType = AbstractGTPotential -Item.isOwnedBy.eType = Party -AbstractBuilding.asset.eType = Asset -AbstractBuilding.asset.eOpposite = Asset.containingBuilding -Party.owns.eType = Item -Party.owns.eOpposite = Item.isOwnedBy -Party.ownsArea.eType = Area -Party.ownsArea.eOpposite = Area.isOwnedBy -ResidualHeatSource.residualHeatSourcePotential.eType = ResidualHeatSourcePotential -ResidualHeatSourcePotential.associatedConversionAsset.eType = Conversion -ResidualHeatSourcePotential.associatedConversionAsset.eOpposite = Conversion.residualHeatSourcePotential -ResidualHeatSourcePotential.residualHeatSource.eType = ResidualHeatSource -ResidualHeatSourcePotential.residualHeatSource.eOpposite = ResidualHeatSource.residualHeatSourcePotential -ControlStrategy.energyAsset.eType = EnergyAsset -ControlStrategy.energyAsset.eOpposite = EnergyAsset.controlStrategy -AbstractGTPotential.geothermalSource.eType = GeothermalSource -AbstractGTPotential.geothermalSource.eOpposite = GeothermalSource.geothermalPotential -UTESPotential.UTES.eType = UTES -UTES.UTESPotential.eType = UTESPotential -UTES.UTESPotential.eOpposite = UTESPotential.UTES - -otherClassifiers = [CommodityEnum, AreaScopeEnum, ProfileTypeEnum, DurationUnitEnum, BuildingTypeEnum, ConsTypeEnum, SourceTypeEnum, AggrTypeEnum, AreaTypeEnum, HeatDemandTypeEnum, OwnershipRentalTypeEnum, RoofTypeEnum, EnergyLabelEnum, ResidentialBuildingTypeEnum, PowerPlantFuelEnum, SectorEnum, RenewableTypeEnum, StateOfMatterEnum, GeothermalSourceTypeEnum, CHPTypeEnum, GlazingTypeEnum, VentilationTypeEnum, GasHeaterTypeEnum, InhabitantsTypeEnum, AdditionalHeatingSourceTypeEnum, GeothermalPotentialEnum, GeothermalPowerEnum, - ResidualHeatSourceTypeEnum, MobilityFuelTypeEnum, VehicleTypeEnum, MultiplierEnum, PhysicalQuantityEnum, UnitEnum, TimeUnitEnum, GasConversionTypeEnum, PVInstallationTypeEnum, WindTurbineTypeEnum, WaterToPowerTypeEnum, SolarCollectorTypeEnum, HeatRadiationDeviceTypeEnum, CoolingDeviceType, RoomHeaterTypeEnum, BiomassHeaterTypeEnum, UTESPotentialTypeEnum, UTESTypeEnum, InterpolationMethodEnum, PipeDiameterEnum, AssetStateEnum, QuantityAndUnitScopeEnum, ValveTypeEnum, CompoundTypeEnum, CombinationFunctionEnum, TransferFunctionTypeEnum, MeasureTypeEnum] - -for classif in otherClassifiers: - eClassifiers[classif.name] = classif - classif.ePackage = eClass - -for classif in eClassifiers.values(): - eClass.eClassifiers.append(classif.eClass) - -for subpack in eSubpackages: - eClass.eSubpackages.append(subpack.eClass) - -register_packages = [esdl] + eSubpackages -for pack in register_packages: - global_registry[pack.nsURI] = pack diff --git a/esdlvalidator/core/esdl/esdl.py b/esdlvalidator/core/esdl/esdl.py deleted file mode 100644 index f6a85bf..0000000 --- a/esdlvalidator/core/esdl/esdl.py +++ /dev/null @@ -1,4922 +0,0 @@ -"""Definition of meta model 'esdl'.""" -from functools import partial -import pyecore.ecore as Ecore -from pyecore.ecore import * - - -name = 'esdl' -nsURI = 'http://www.tno.nl/esdl' -nsPrefix = 'esdl' - -eClass = EPackage(name=name, nsURI=nsURI, nsPrefix=nsPrefix) - -eClassifiers = {} -getEClassifier = partial(Ecore.getEClassifier, searchspace=eClassifiers) -CommodityEnum = EEnum('CommodityEnum', literals=[ - 'UNDEFINED', 'ELECTRICITY', 'GAS', 'HEAT', 'H2', 'BIOGAS', 'CO2', 'ENERGY']) - -AreaScopeEnum = EEnum('AreaScopeEnum', literals=['UNDEFINED', 'BUILDING', 'STREET', 'ZIPCODE', 'NEIGHBOURHOOD', - 'DISTRICT', 'VILLAGE', 'CITY', 'MUNICIPALITY', 'REGION', 'PROVINCE', 'STATE', 'COUNTRY', 'CONTINENT']) - -ProfileTypeEnum = EEnum('ProfileTypeEnum', literals=['UNDEFINED', 'SOLARIRRADIANCE_IN_W_PER_M2', 'WINDSPEED_IN_M_PER_S', 'STATEOFCHARGE_IN_WS', 'ENERGY_IN_WH', 'ENERGY_IN_KWH', 'ENERGY_IN_MWH', 'ENERGY_IN_GWH', 'ENERGY_IN_J', 'ENERGY_IN_KJ', 'ENERGY_IN_MJ', 'ENERGY_IN_GJ', 'ENERGY_IN_TJ', - 'ENERGY_IN_PJ', 'TEMPERATURE_IN_C', 'TEMPERATURE_IN_K', 'POWER_IN_W', 'POWER_IN_KW', 'POWER_IN_MW', 'POWER_IN_GW', 'POWER_IN_TW', 'MONEY_IN_EUR', 'MONEY_IN_KEUR', 'MONEY_IN_MEUR', 'PERCENTAGE', 'MONEY_IN_EUR_PER_KW', 'MONEY_IN_EUR_PER_KWH', 'VOLUME_IN_M3', 'VOLUME_IN_LITERS']) - -DurationUnitEnum = EEnum('DurationUnitEnum', literals=[ - 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR']) - -BuildingTypeEnum = EEnum('BuildingTypeEnum', literals=['UNDEFINED', 'RESIDENTIAL', 'GATHERING', 'PRISON', 'HEALTHCARE', - 'INDUSTRY', 'OFFICE', 'EDUCATION', 'SPORTS', 'SHOPPING', 'HOTEL', 'AGRICULTURE', 'GREENHOUSE', 'UTILITY', 'OTHER']) - -ConsTypeEnum = EEnum('ConsTypeEnum', literals=['PRIMARY', 'FINAL']) - -SourceTypeEnum = EEnum('SourceTypeEnum', literals=[ - 'UNDEFINED', 'AIR', 'SUB_SURFACE', 'AQUIFER', 'SURFACE_WATER', 'HEAT_NETWORK']) - -AggrTypeEnum = EEnum('AggrTypeEnum', literals=[ - 'UNDEFINED', 'NOT_AGGREGATED', 'PER_COMMODITY', 'TOTAL_ENERGY', 'TOTAL_CAPABILITY', 'PER_CAPIBILITY']) - -AreaTypeEnum = EEnum('AreaTypeEnum', literals=['UNDEFINED', 'ROAD', 'RAILWAY', 'TERRAIN', - 'RURAL_AREA', 'BUILT', 'WATER', 'SEA', 'RIVER', 'CANAL', 'LAKE', 'LAND', 'PARCEL']) - -HeatDemandTypeEnum = EEnum('HeatDemandTypeEnum', literals=[ - 'UNDEFINED', 'SPACE_HEATING', 'HOT_TAPWATER', 'SH_AND_HTW', 'COOKING', 'OTHER']) - -OwnershipRentalTypeEnum = EEnum('OwnershipRentalTypeEnum', literals=[ - 'UNDEFINED', 'PRIVATELY_OWNED', 'PRIVATE_RENTAL', 'HOUSING_ASSOCIATION']) - -RoofTypeEnum = EEnum('RoofTypeEnum', literals=[ - 'UNDEFINED', 'FLATROOF', 'SLANTEDROOF', 'COMBINATION']) - -EnergyLabelEnum = EEnum('EnergyLabelEnum', literals=['UNDEFINED', 'LABEL_G', 'LABEL_F', 'LABEL_E', - 'LABEL_D', 'LABEL_C', 'LABEL_B', 'LABEL_A', 'LABEL_AP', 'LABEL_APP', 'LABEL_APPP', 'LABEL_APPPP']) - -ResidentialBuildingTypeEnum = EEnum('ResidentialBuildingTypeEnum', literals=['UNDEFINED', 'VRIJSTAANDE_WONING', 'TWEE_ONDER_EEN_KAP_WONING', 'RIJWONING', - 'MAISONNETTEWONING', 'GALERIJWONING', 'PORTIEKWONING', 'FLATWONING', 'TUSSENWONING', 'HOEKWONING', 'GALERIJCOMPLEX', 'APPARTEMENTENCOMPLEX', 'APPARTEMENT']) - -PowerPlantFuelEnum = EEnum('PowerPlantFuelEnum', literals=[ - 'UNDEFINED', 'COAL', 'BLAST_FURNACE_GAS', 'NATURAL_GAS', 'URANIUM', 'HYDROGEN']) - -SectorEnum = EEnum('SectorEnum', literals=[ - 'UNDEFINED', 'GEBOUWDE_OMGEVING', 'ZAKELIJKE_DIENSTVERLENING', 'INDUSTRIE', 'AGRO_TUINBOUW']) - -RenewableTypeEnum = EEnum('RenewableTypeEnum', literals=['UNDEFINED', 'RENEWABLE', 'FOSSIL']) - -StateOfMatterEnum = EEnum('StateOfMatterEnum', literals=['UNDEFINED', 'SOLID', 'LIQUID', 'GASEOUS']) - -GeothermalSourceTypeEnum = EEnum('GeothermalSourceTypeEnum', literals=[ - 'UNDEFINED', 'HEAT', 'ELECTRICITY']) - -CHPTypeEnum = EEnum('CHPTypeEnum', literals=['UNDEFINED', 'STEG', 'GAS_TURBINE', 'GAS_MOTOR']) - -GlazingTypeEnum = EEnum('GlazingTypeEnum', literals=[ - 'UNDEFINED', 'ENKEL_GLAS', 'DUBBEL_GLAS', 'HR_GLAS', 'HRP_GLAS', 'HRPP_GLAS', 'HRPPP_GLAS']) - -VentilationTypeEnum = EEnum('VentilationTypeEnum', literals=[ - 'UNDEFINED', 'NATURAL', 'MECHANIC_IN', 'MECHANIC_OUT', 'MECHANIC_INOUT', 'BALANCED', 'BALANCED_WITH_HEATRECUPERATION']) - -GasHeaterTypeEnum = EEnum('GasHeaterTypeEnum', literals=[ - 'UNDEFINED', 'CR', 'VR', 'HR100', 'HR104', 'HR107', 'HRE', 'HRWW']) - -InhabitantsTypeEnum = EEnum('InhabitantsTypeEnum', literals=[ - 'UNDEFINED', 'ALLEENSTAAND', 'TWEEVERDIENERS', 'GEZIN_MET_KINDEREN', 'SENIOREN']) - -AdditionalHeatingSourceTypeEnum = EEnum( - 'AdditionalHeatingSourceTypeEnum', literals=['NONE', 'ELECTRIC', 'GAS']) - -GeothermalPotentialEnum = EEnum('GeothermalPotentialEnum', literals=['UNKNOWN', 'POSSIBLE', 'GOOD']) - -GeothermalPowerEnum = EEnum('GeothermalPowerEnum', literals=[ - 'UNKNOWN', 'POSSIBLE_GT5MWTH', 'GOOD_GT5MWTH', 'GOOD_GT7P5MWTH', 'GOOD_GT10MWTH']) - -ResidualHeatSourceTypeEnum = EEnum('ResidualHeatSourceTypeEnum', literals=[ - 'UNDEFINED', 'INDUSTRIAL', 'DATACENTER', 'COOLING_HOUSE', 'OTHER']) - -MobilityFuelTypeEnum = EEnum('MobilityFuelTypeEnum', literals=[ - 'UNDEFINED', 'PETROL', 'DIESEL', 'HYDROGEN', 'LPG', 'BIOFUEL', 'ELECTRICITY', 'OIL', 'LNG', 'KEROSENE']) - -VehicleTypeEnum = EEnum('VehicleTypeEnum', literals=['UNDEFINED', 'CAR', 'TRUCK', 'VAN', 'BUS', 'METRO', 'TRAM', 'TRAIN', 'PASSENGER_TRAIN', - 'FREIGHT_TRAIN', 'SCOOTER', 'MOTOR_CYCLE', 'NONROAD_VEHICLE', 'AGRARIAN_VEHICLE', 'BARGE', 'INTERNATIONAL_SHIPPING', 'AIRCRAFT', 'OTHER', 'TOTAL']) - -MultiplierEnum = EEnum('MultiplierEnum', literals=['NONE', 'ATTO', 'FEMTO', 'PICO', 'NANO', 'MICRO', - 'MILLI', 'CENTI', 'DECI', 'DEKA', 'HECTO', 'KILO', 'MEGA', 'GIGA', 'TERA', 'TERRA', 'PETA', 'EXA']) - -PhysicalQuantityEnum = EEnum('PhysicalQuantityEnum', literals=['UNDEFINED', 'ENERGY', 'POWER', 'VOLTAGE', 'PRESSURE', 'TEMPERATURE', 'EMISSION', 'COST', 'TIME', 'LENGTH', 'DISTANCE', 'IRRADIANCE', - 'SPEED', 'STATE_OF_CHARGE', 'VOLUME', 'AREA', 'POWER_REACTIVE', 'COMPOSITION', 'FLOW', 'STATE', 'HEAD', 'POSITION', 'COEFFICIENT', 'WEIGHT', 'FORCE', 'CURRENT', 'RELATIVE_HUMIDITY', 'DIRECTION']) - -UnitEnum = EEnum('UnitEnum', literals=['NONE', 'JOULE', 'WATTHOUR', 'WATT', 'VOLT', 'BAR', 'PSI', 'DEGREES_CELSIUS', 'KELVIN', 'GRAM', 'EURO', 'DOLLAR', 'SECOND', 'MINUTE', 'QUARTER', 'HOUR', 'DAY', - 'WEEK', 'MONTH', 'YEAR', 'METRE', 'SQUARE_METRE', 'CUBIC_METRE', 'LITRE', 'WATTSECOND', 'ARE', 'HECTARE', 'PERCENT', 'VOLT_AMPERE', 'VOLT_AMPERE_REACTIVE', 'PASCAL', 'NEWTON', 'AMPERE', 'DEGREES']) - -TimeUnitEnum = EEnum('TimeUnitEnum', literals=[ - 'NONE', 'SECOND', 'MINUTE', 'QUARTER', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR']) - -GasConversionTypeEnum = EEnum('GasConversionTypeEnum', literals=['UNDEFINED', 'SMR', 'ATR']) - -PVInstallationTypeEnum = EEnum('PVInstallationTypeEnum', literals=[ - 'UNDEFINED', 'ROOFTOP_PV', 'BUILDING_INTEGRATED_PV', 'WINDOW', 'ROAD', 'FIELD', 'WATER']) - -WindTurbineTypeEnum = EEnum('WindTurbineTypeEnum', literals=[ - 'UNDEFINED', 'WIND_ON_LAND', 'WIND_AT_SEA', 'WIND_ON_COAST', 'WIND_ON_BUILDING']) - -WaterToPowerTypeEnum = EEnum('WaterToPowerTypeEnum', literals=[ - 'UNDEFINED', 'HYDRO_POWER', 'WAVE_POWER', 'TIDAL_POWER', 'OSMOTIC_POWER']) - -SolarCollectorTypeEnum = EEnum('SolarCollectorTypeEnum', literals=[ - 'UNDEFINED', 'ROOFTOP', 'BUILDING_INTEGRATED_SC', 'ROAD', 'FIELD', 'WATER']) - -HeatRadiationDeviceTypeEnum = EEnum('HeatRadiationDeviceTypeEnum', literals=[ - 'UNDEFINED', 'HT_RADIATOR', 'LT_RADIATOR', 'FLOOR_HEATING', 'WALL_HEATING', 'INFRARED_PANEL', 'AIR_HANDLING_UNIT']) - -CoolingDeviceType = EEnum('CoolingDeviceType', literals=[ - 'UNDEFINED', 'FLOOR_COOLING', 'AIR_HANDLING_UNIT']) - -RoomHeaterTypeEnum = EEnum('RoomHeaterTypeEnum', literals=[ - 'UNDEFINED', 'GAS_STOVE', 'WOOD_STOVE', 'ELECTRIC', 'INFRARED_PANEL']) - -BiomassHeaterTypeEnum = EEnum('BiomassHeaterTypeEnum', literals=[ - 'UNDEFINED', 'FULLY_AUTOMATED', 'SEMI_AUTOMATED', 'PELLET_FIRED', 'CHP']) - -UTESPotentialTypeEnum = EEnum('UTESPotentialTypeEnum', literals=[ - 'UNDEFINED', 'HEAT_OPEN', 'HEAT_CLOSED', 'COLD_OPEN', 'COLD_CLOSED']) - -UTESTypeEnum = EEnum('UTESTypeEnum', literals=[ - 'UNDEFINED', 'AQUIFER_TES', 'BOREHOLE_TES', 'CAVERN_TES', 'OTHER']) - -InterpolationMethodEnum = EEnum('InterpolationMethodEnum', literals=[ - 'UNDEFINED', 'NONE', 'LINEAR', 'CUBIC', 'NEAREST', 'PREVIOUS', 'NEXT', 'OTHER']) - -PipeDiameterEnum = EEnum('PipeDiameterEnum', literals=['VALUE_SPECIFIED', 'DN6', 'DN8', 'DN10', 'DN15', 'DN20', 'DN25', 'DN32', 'DN40', 'DN50', 'DN65', 'DN80', 'DN100', - 'DN125', 'DN150', 'DN200', 'DN250', 'DN300', 'DN350', 'DN400', 'DN450', 'DN500', 'DN600', 'DN650', 'DN700', 'DN800', 'DN900', 'DN1000', 'DN1100', 'DN1200']) - -AssetStateEnum = EEnum('AssetStateEnum', literals=['ENABLED', 'DISABLED', 'OPTIONAL']) - -QuantityAndUnitScopeEnum = EEnum('QuantityAndUnitScopeEnum', literals=[ - 'UNDEFINED', 'CONNECTION', 'BUILDING', 'HOUSEHOLD']) - -ValveTypeEnum = EEnum('ValveTypeEnum', literals=[ - 'UNDEFINED', 'BUTTERFLY', 'BALL', 'GATE', 'GATE_VALVE_SQUARE']) - -CompoundTypeEnum = EEnum('CompoundTypeEnum', literals=['UNDEFINED', 'MIXED', 'LAYERED']) - -CombinationFunctionEnum = EEnum('CombinationFunctionEnum', literals=['MULTIPLICATION', 'ADDITION']) - -TransferFunctionTypeEnum = EEnum('TransferFunctionTypeEnum', literals=[ - 'UNDEFINED', 'POWER_SETPOINT_RESPONSE', 'TEMPERATURE_SETPOINT_RESPONSE']) - -MeasureTypeEnum = EEnum('MeasureTypeEnum', literals=[ - 'UNDEFINED', 'ADD_GEOMETRY', 'MODEL_RESTRICTION']) - - -class EnergySystem(EObject, metaclass=MetaEClass): - """This is the main class to describe an EnergySystem in ESDL. Each energy system description should start with this class. More information about ESDL and the Energy System can be found in the gitbook at https://energytransition.gitbook.io/esdl/""" - name = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - geographicalScope = EAttribute(eType=EString, derived=False, changeable=True) - sector = EAttribute(eType=SectorEnum, derived=False, changeable=True, upper=-1) - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - version = EAttribute(eType=EString, derived=False, changeable=True) - esdlVersion = EAttribute(eType=EString, derived=False, changeable=True) - measures = EReference(ordered=True, unique=True, containment=True) - instance = EReference(ordered=True, unique=True, containment=True, upper=-1) - energySystemInformation = EReference(ordered=True, unique=True, containment=True) - parties = EReference(ordered=True, unique=True, containment=True) - services = EReference(ordered=True, unique=True, containment=True) - templates = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, name=None, description=None, geographicalScope=None, sector=None, measures=None, instance=None, energySystemInformation=None, parties=None, services=None, id=None, version=None, templates=None, esdlVersion=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if name is not None: - self.name = name - - if description is not None: - self.description = description - - if geographicalScope is not None: - self.geographicalScope = geographicalScope - - if sector: - self.sector.extend(sector) - - if id is not None: - self.id = id - - if version is not None: - self.version = version - - if esdlVersion is not None: - self.esdlVersion = esdlVersion - - if measures is not None: - self.measures = measures - - if instance: - self.instance.extend(instance) - - if energySystemInformation is not None: - self.energySystemInformation = energySystemInformation - - if parties is not None: - self.parties = parties - - if services is not None: - self.services = services - - if templates is not None: - self.templates = templates - - -class Area(EObject, metaclass=MetaEClass): - """The Area class represents a physical geographic area or a more abstract logical area. In both cases it is the 'asset container', in a sense that all assets within the area are contained by the Area instance.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - scope = EAttribute(eType=AreaScopeEnum, derived=False, changeable=True, - default_value=AreaScopeEnum.UNDEFINED) - type = EAttribute(eType=AreaTypeEnum, derived=False, changeable=True) - geometryReference = EAttribute(eType=EString, derived=False, changeable=True) - buildingDensity = EAttribute(eType=EDouble, derived=False, changeable=True) - socialProperties = EReference(ordered=True, unique=True, containment=True) - economicProperties = EReference(ordered=True, unique=True, containment=True) - asset = EReference(ordered=True, unique=True, containment=True, upper=-1) - area = EReference(ordered=True, unique=True, containment=True, upper=-1) - containingArea = EReference(ordered=True, unique=True, containment=False) - isOwnedBy = EReference(ordered=True, unique=True, containment=False) - mobilityProperties = EReference(ordered=True, unique=True, containment=True) - KPIs = EReference(ordered=True, unique=True, containment=True) - potential = EReference(ordered=True, unique=True, containment=True, upper=-1) - geometry = EReference(ordered=True, unique=True, containment=True) - measures = EReference(ordered=True, unique=True, containment=True) - sector = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, id=None, name=None, scope=None, type=None, socialProperties=None, economicProperties=None, asset=None, area=None, containingArea=None, isOwnedBy=None, geometryReference=None, mobilityProperties=None, buildingDensity=None, KPIs=None, potential=None, geometry=None, measures=None, sector=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if scope is not None: - self.scope = scope - - if type is not None: - self.type = type - - if geometryReference is not None: - self.geometryReference = geometryReference - - if buildingDensity is not None: - self.buildingDensity = buildingDensity - - if socialProperties is not None: - self.socialProperties = socialProperties - - if economicProperties is not None: - self.economicProperties = economicProperties - - if asset: - self.asset.extend(asset) - - if area: - self.area.extend(area) - - if containingArea is not None: - self.containingArea = containingArea - - if isOwnedBy is not None: - self.isOwnedBy = isOwnedBy - - if mobilityProperties is not None: - self.mobilityProperties = mobilityProperties - - if KPIs is not None: - self.KPIs = KPIs - - if potential: - self.potential.extend(potential) - - if geometry is not None: - self.geometry = geometry - - if measures is not None: - self.measures = measures - - if sector is not None: - self.sector = sector - - -@abstract -class Port(EObject, metaclass=MetaEClass): - """Ports allow connections between EnergyAssets. Ports can be connected to one or more other ports. There are two types of ports: InPort and OutPort, which defines the primary direction of positive energy flow. InPorts can only be connected to OutPorts and vice versa.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - maxPower = EAttribute(eType=EDouble, derived=False, changeable=True) - simultaneousPower = EAttribute(eType=EDouble, derived=False, changeable=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - energyasset = EReference(ordered=True, unique=True, containment=False) - profile = EReference(ordered=True, unique=True, containment=True, upper=-1) - carrier = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, id=None, maxPower=None, energyasset=None, profile=None, carrier=None, simultaneousPower=None, name=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if maxPower is not None: - self.maxPower = maxPower - - if simultaneousPower is not None: - self.simultaneousPower = simultaneousPower - - if name is not None: - self.name = name - - if energyasset is not None: - self.energyasset = energyasset - - if profile: - self.profile.extend(profile) - - if carrier is not None: - self.carrier = carrier - - -class EconomicProperties(EObject, metaclass=MetaEClass): - """(experimental) Can be used to define the economic properties of an area""" - averageIncome = EAttribute(eType=EDouble, derived=False, changeable=True) - averageWOZvalue = EAttribute(eType=EDouble, derived=False, changeable=True) - percentageOwnerOccupiedProperties = EAttribute(eType=EDouble, derived=False, changeable=True) - percentageHousingAssociation = EAttribute(eType=EDouble, derived=False, changeable=True) - percentagePrivateRental = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, averageIncome=None, averageWOZvalue=None, percentageOwnerOccupiedProperties=None, percentageHousingAssociation=None, percentagePrivateRental=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if averageIncome is not None: - self.averageIncome = averageIncome - - if averageWOZvalue is not None: - self.averageWOZvalue = averageWOZvalue - - if percentageOwnerOccupiedProperties is not None: - self.percentageOwnerOccupiedProperties = percentageOwnerOccupiedProperties - - if percentageHousingAssociation is not None: - self.percentageHousingAssociation = percentageHousingAssociation - - if percentagePrivateRental is not None: - self.percentagePrivateRental = percentagePrivateRental - - -class SocialProperties(EObject, metaclass=MetaEClass): - """(experimental) Can be used to define the social properties of an area""" - socialCohesion = EAttribute(eType=EDouble, derived=False, changeable=True) - populationDensity = EAttribute(eType=EInt, derived=False, changeable=True) - numberOfInhabitants = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, socialCohesion=None, populationDensity=None, numberOfInhabitants=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if socialCohesion is not None: - self.socialCohesion = socialCohesion - - if populationDensity is not None: - self.populationDensity = populationDensity - - if numberOfInhabitants is not None: - self.numberOfInhabitants = numberOfInhabitants - - -@abstract -class Item(EObject, metaclass=MetaEClass): - """Class describing an abstract thing in an energy system. It is the parent of many other classes in ESDL, such as Assets, Services and Potentials. Parties can own Items""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - shortName = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - originalIdInSource = EAttribute(eType=EString, derived=False, changeable=True) - isOwnedBy = EReference(ordered=True, unique=True, containment=False) - dataSource = EReference(ordered=True, unique=True, containment=True) - sector = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, id=None, name=None, shortName=None, isOwnedBy=None, description=None, originalIdInSource=None, dataSource=None, sector=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if shortName is not None: - self.shortName = shortName - - if description is not None: - self.description = description - - if originalIdInSource is not None: - self.originalIdInSource = originalIdInSource - - if isOwnedBy is not None: - self.isOwnedBy = isOwnedBy - - if dataSource is not None: - self.dataSource = dataSource - - if sector is not None: - self.sector = sector - - -class Instance(EObject, metaclass=MetaEClass): - """Instances are used to represent different representations of the same EnergySystem. Most of the times only one Instance will be used. The primary use case for having more than one Instance is when you have different aggregations of the same EnergySystem in the same model (e.g. the same region on house level and aggregated on neighbourhood level). Another option would be to create different instances for different years (to describe the progress of the energy transition).""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - detailLevel = EAttribute(eType=AreaScopeEnum, derived=False, - changeable=True, default_value=AreaScopeEnum.UNDEFINED) - aggrType = EAttribute(eType=AggrTypeEnum, derived=False, changeable=True) - area = EReference(ordered=True, unique=True, containment=True) - date = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, id=None, name=None, description=None, detailLevel=None, aggrType=None, area=None, date=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if description is not None: - self.description = description - - if detailLevel is not None: - self.detailLevel = detailLevel - - if aggrType is not None: - self.aggrType = aggrType - - if area is not None: - self.area = area - - if date is not None: - self.date = date - - -class Carriers(EObject, metaclass=MetaEClass): - """Collection of carriers as part of the Energy System Information. Both energy carriers and commodities.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - carrier = EReference(ordered=True, unique=True, containment=True, upper=-1) - dataSource = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, carrier=None, dataSource=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if carrier: - self.carrier.extend(carrier) - - if dataSource is not None: - self.dataSource = dataSource - - -class EnergySystemInformation(EObject, metaclass=MetaEClass): - """Describes reusable information of the energy system, that other classes can refer to in this energy system, such as carriers, profiles, data sources, quantity and units.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - carriers = EReference(ordered=True, unique=True, containment=True) - profiles = EReference(ordered=True, unique=True, containment=True) - dataSources = EReference(ordered=True, unique=True, containment=True) - mobilityFuelInformation = EReference(ordered=True, unique=True, containment=True) - quantityAndUnits = EReference(ordered=True, unique=True, containment=True) - sectors = EReference(ordered=True, unique=True, containment=True) - buildingUsageInformation = EReference(ordered=True, unique=True, containment=True) - notes = EReference(ordered=True, unique=True, containment=True) - matters = EReference(ordered=True, unique=True, containment=True) - environmentalProfiles = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, carriers=None, profiles=None, dataSources=None, mobilityFuelInformation=None, quantityAndUnits=None, sectors=None, id=None, buildingUsageInformation=None, notes=None, matters=None, environmentalProfiles=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if carriers is not None: - self.carriers = carriers - - if profiles is not None: - self.profiles = profiles - - if dataSources is not None: - self.dataSources = dataSources - - if mobilityFuelInformation is not None: - self.mobilityFuelInformation = mobilityFuelInformation - - if quantityAndUnits is not None: - self.quantityAndUnits = quantityAndUnits - - if sectors is not None: - self.sectors = sectors - - if buildingUsageInformation is not None: - self.buildingUsageInformation = buildingUsageInformation - - if notes is not None: - self.notes = notes - - if matters is not None: - self.matters = matters - - if environmentalProfiles is not None: - self.environmentalProfiles = environmentalProfiles - - -@abstract -class GenericProfile(EObject, metaclass=MetaEClass): - """All profiles should describe these fields: a name and a ProfileType. There are two different profile types: static, with static values stored in the ESDL model itself. And External, which allows you to refer to an externally defined profile (e.g. in an Energy Information System or a timeseries database)""" - name = EAttribute(eType=EString, derived=False, changeable=True) - profileType = EAttribute(eType=ProfileTypeEnum, derived=False, - changeable=True, default_value=ProfileTypeEnum.UNDEFINED) - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - interpolationMethod = EAttribute(eType=InterpolationMethodEnum, derived=False, - changeable=True, default_value=InterpolationMethodEnum.UNDEFINED) - dataSource = EReference(ordered=True, unique=True, containment=True) - profileQuantityAndUnit = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, name=None, profileType=None, id=None, dataSource=None, profileQuantityAndUnit=None, interpolationMethod=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if name is not None: - self.name = name - - if profileType is not None: - self.profileType = profileType - - if id is not None: - self.id = id - - if interpolationMethod is not None: - self.interpolationMethod = interpolationMethod - - if dataSource is not None: - self.dataSource = dataSource - - if profileQuantityAndUnit is not None: - self.profileQuantityAndUnit = profileQuantityAndUnit - - def getProfile(self, from_=None, to=None, aggregationPrecision=None): - - raise NotImplementedError('operation getProfile(...) not yet implemented') - - def setProfile(self, profileElementList=None): - - raise NotImplementedError('operation setProfile(...) not yet implemented') - - -class ProfileElement(EObject, metaclass=MetaEClass): - """ProfileElement describes a single profile element describing a range and a value which is valid for this range. From-field is inclusive, To-field is exclusive, allowing you to describe ranges such as 1-1-2017T00:00:00.000 to 1-1-2018T00:00:00.000 instead of 31-12-2017T23:59:59:999. The to-field may be ommitted, meaning this value is valid for all time after the specified to-datetime. -Examples: The heat demand of a municipality in 2013 is 20 PJ. The range you define is then from 1-1-2013T to 1-1-2014T and the value 20 and ProfileType ENERGY_IN_PJ""" - from_ = EAttribute(eType=EDate, derived=False, changeable=True) - to = EAttribute(eType=EDate, derived=False, changeable=True) - value = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, from_=None, to=None, value=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if from_ is not None: - self.from_ = from_ - - if to is not None: - self.to = to - - if value is not None: - self.value = value - - -@abstract -class GenericDistribution(EObject, metaclass=MetaEClass): - """Abstract class to represent different types of distributions""" - name = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, name=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if name is not None: - self.name = name - - -class Percentile(EObject, metaclass=MetaEClass): - """Defines the percentile of a percentile distribution""" - percentile = EAttribute(eType=EInt, derived=False, changeable=True) - value = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, percentile=None, value=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if percentile is not None: - self.percentile = percentile - - if value is not None: - self.value = value - - -class CostInformation(EObject, metaclass=MetaEClass): - """Describes the costs to acquire, install and maintain a certain asset.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - investmentCosts = EReference(ordered=True, unique=True, containment=True) - installationCosts = EReference(ordered=True, unique=True, containment=True) - fixedOperationalAndMaintenanceCosts = EReference(ordered=True, unique=True, containment=True) - marginalCosts = EReference(ordered=True, unique=True, containment=True) - variableOperationalAndMaintenanceCosts = EReference(ordered=True, unique=True, containment=True) - discountRate = EReference(ordered=True, unique=True, containment=True) - variableOperationalCosts = EReference(ordered=True, unique=True, containment=True) - fixedMaintenanceCosts = EReference(ordered=True, unique=True, containment=True) - fixedOperationalCosts = EReference(ordered=True, unique=True, containment=True) - variableMaintenanceCosts = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, investmentCosts=None, installationCosts=None, fixedOperationalAndMaintenanceCosts=None, marginalCosts=None, variableOperationalAndMaintenanceCosts=None, id=None, discountRate=None, variableOperationalCosts=None, fixedMaintenanceCosts=None, fixedOperationalCosts=None, variableMaintenanceCosts=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if investmentCosts is not None: - self.investmentCosts = investmentCosts - - if installationCosts is not None: - self.installationCosts = installationCosts - - if fixedOperationalAndMaintenanceCosts is not None: - self.fixedOperationalAndMaintenanceCosts = fixedOperationalAndMaintenanceCosts - - if marginalCosts is not None: - self.marginalCosts = marginalCosts - - if variableOperationalAndMaintenanceCosts is not None: - self.variableOperationalAndMaintenanceCosts = variableOperationalAndMaintenanceCosts - - if discountRate is not None: - self.discountRate = discountRate - - if variableOperationalCosts is not None: - self.variableOperationalCosts = variableOperationalCosts - - if fixedMaintenanceCosts is not None: - self.fixedMaintenanceCosts = fixedMaintenanceCosts - - if fixedOperationalCosts is not None: - self.fixedOperationalCosts = fixedOperationalCosts - - if variableMaintenanceCosts is not None: - self.variableMaintenanceCosts = variableMaintenanceCosts - - -class StringItem(EObject, metaclass=MetaEClass): - """Defines a label and a percentage, used in StringLabelDistribution""" - label = EAttribute(eType=EString, derived=False, changeable=True) - value = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, label=None, value=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if label is not None: - self.label = label - - if value is not None: - self.value = value - - -class EnergyLabelPerc(EObject, metaclass=MetaEClass): - """Defines an energy label and a percentage, used in EnergyLabelDistribution""" - energyLabel = EAttribute(eType=EnergyLabelEnum, derived=False, changeable=True) - percentage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, energyLabel=None, percentage=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if energyLabel is not None: - self.energyLabel = energyLabel - - if percentage is not None: - self.percentage = percentage - - -@abstract -class FromToItem(EObject, metaclass=MetaEClass): - """Defines a range and a percentage, used in the FromToDistribution class""" - value = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, value=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value is not None: - self.value = value - - -class PItemStat(EObject, metaclass=MetaEClass): - """(experimental) Used to define statistical information""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - sigma = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, value=None, sigma=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value is not None: - self.value = value - - if sigma is not None: - self.sigma = sigma - - -@abstract -class AbstractVariance(EObject, metaclass=MetaEClass): - """(experimental) Used to define statistical information""" - - def __init__(self, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - -class Party(EObject, metaclass=MetaEClass): - """Defines a stakeholder in the energy system, to represent ownership""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - shortName = EAttribute(eType=EString, derived=False, changeable=True) - owns = EReference(ordered=True, unique=True, containment=False, upper=-1) - ownsArea = EReference(ordered=True, unique=True, containment=False, upper=-1) - sector = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, owns=None, id=None, name=None, shortName=None, ownsArea=None, sector=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if shortName is not None: - self.shortName = shortName - - if owns: - self.owns.extend(owns) - - if ownsArea: - self.ownsArea.extend(ownsArea) - - if sector is not None: - self.sector = sector - - -@abstract -class Geometry(EObject, metaclass=MetaEClass): - """Abstract class to define the shape/location of an asset or area. Parent class of e.g. Point, Line and Polygon""" - CRS = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, CRS=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if CRS is not None: - self.CRS = CRS - - -@abstract -class Carrier(EObject, metaclass=MetaEClass): - """Abstract class to define the carrier of energy, e.g. a energy carrier or a commodity (such as electricity)""" - name = EAttribute(eType=EString, derived=False, changeable=True) - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - cost = EReference(ordered=True, unique=True, containment=True) - dataSource = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, name=None, id=None, cost=None, dataSource=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if name is not None: - self.name = name - - if id is not None: - self.id = id - - if cost is not None: - self.cost = cost - - if dataSource is not None: - self.dataSource = dataSource - - -class Duration(EObject, metaclass=MetaEClass): - """Defines the duration of a profile query""" - value = EAttribute(eType=ELong, derived=False, changeable=True) - durationUnit = EAttribute(eType=DurationUnitEnum, derived=False, - changeable=True, default_value=DurationUnitEnum.SECOND) - - def __init__(self, *, value=None, durationUnit=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value is not None: - self.value = value - - if durationUnit is not None: - self.durationUnit = durationUnit - - -class Profiles(EObject, metaclass=MetaEClass): - """Container for profiles in the Energy System Information where other profiles can refer to""" - id = EAttribute(eType=EString, derived=False, changeable=True) - profile = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, profile=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if profile: - self.profile.extend(profile) - - -class Parties(EObject, metaclass=MetaEClass): - """Container for parties that have a role in the energy system""" - party = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, party=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if party: - self.party.extend(party) - - -class DataSources(EObject, metaclass=MetaEClass): - """Collection of datasources used in the energy system""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - dataSource = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, dataSource=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if dataSource: - self.dataSource.extend(dataSource) - - -class SubPolygon(EObject, metaclass=MetaEClass): - """Part of a Polygon used to describe the internal or external boundary""" - point = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, point=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if point: - self.point.extend(point) - - -class MobilityFuelInformation(EObject, metaclass=MetaEClass): - """Collection of information about vehicles, fuels and efficiency""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - vehicleFuelEfficiency = EReference(ordered=True, unique=True, containment=True, upper=-1) - dataSource = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, vehicleFuelEfficiency=None, dataSource=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if vehicleFuelEfficiency: - self.vehicleFuelEfficiency.extend(vehicleFuelEfficiency) - - if dataSource is not None: - self.dataSource = dataSource - - -class VehicleFuelEfficiency(EObject, metaclass=MetaEClass): - """Information about vehicles, fuels and efficiency, used in MobilityFuelInformation""" - vehicleType = EAttribute(eType=VehicleTypeEnum, derived=False, changeable=True) - fuel = EAttribute(eType=MobilityFuelTypeEnum, derived=False, changeable=True) - efficiency = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, vehicleType=None, fuel=None, efficiency=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if vehicleType is not None: - self.vehicleType = vehicleType - - if fuel is not None: - self.fuel = fuel - - if efficiency is not None: - self.efficiency = efficiency - - -class MobilityProperties(EObject, metaclass=MetaEClass): - """(experimental) Can be used to define the mobility properties of an area""" - numberOfVehicles = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, numberOfVehicles=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if numberOfVehicles is not None: - self.numberOfVehicles = numberOfVehicles - - -class NumberOfVehicles(EObject, metaclass=MetaEClass): - """(experimental) Provides the ability to define the number of vehicles of an area""" - vehicleCount = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, vehicleCount=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if vehicleCount: - self.vehicleCount.extend(vehicleCount) - - -class VehicleCount(EObject, metaclass=MetaEClass): - """(experimental) Defines the number of vehicles per vehicle type""" - type = EAttribute(eType=VehicleTypeEnum, derived=False, changeable=True) - count = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, type=None, count=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if type is not None: - self.type = type - - if count is not None: - self.count = count - - -class Services(EObject, metaclass=MetaEClass): - """Defines a collection of logical services used in the energy system, e.g. Demand-Response, Aggregator services, Energy markets and control strategies.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - service = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, service=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if service: - self.service.extend(service) - - -@abstract -class AbstractDataSource(EObject, metaclass=MetaEClass): - """Abstract class to describe data sources or references to data sources""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - - def __init__(self, *, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - -class KPIs(EObject, metaclass=MetaEClass): - """Collection of key performance indicators of areas or assets""" - id = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - kpi = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, kpi=None, id=None, description=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if description is not None: - self.description = description - - if kpi: - self.kpi.extend(kpi) - - -@abstract -class KPI(EObject, metaclass=MetaEClass): - """Defines a key performance indicator (KPI)""" - id = EAttribute(eType=EString, derived=False, changeable=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - quantityAndUnit = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, id=None, name=None, quantityAndUnit=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if quantityAndUnit is not None: - self.quantityAndUnit = quantityAndUnit - - -class QuantityAndUnits(EObject, metaclass=MetaEClass): - """Collection of QuantityAndUnitTypes defined in the EnergySystemInformation section""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - quantityAndUnit = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, quantityAndUnit=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if quantityAndUnit: - self.quantityAndUnit.extend(quantityAndUnit) - - -@abstract -class AbstractQuantityAndUnit(EObject, metaclass=MetaEClass): - """Abstract class to describe QuantityAndUnitTypes or references to these""" - - def __init__(self, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - -@abstract -class Parameters(EObject, metaclass=MetaEClass): - """Used to describe properties of an EnergyMarket""" - name = EAttribute(eType=EString, derived=False, changeable=True) - parameterUnit = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, name=None, parameterUnit=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if name is not None: - self.name = name - - if parameterUnit is not None: - self.parameterUnit = parameterUnit - - -class Sectors(EObject, metaclass=MetaEClass): - """Collection of sectors. Both Party and Item can link to a sector""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - sector = EReference(ordered=True, unique=True, containment=True, upper=-1) - dataSource = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, sector=None, dataSource=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if sector: - self.sector.extend(sector) - - if dataSource is not None: - self.dataSource = dataSource - - -class Sector(EObject, metaclass=MetaEClass): - """Defines a sector. Can be used for the Standaard Bedrijfsindeling (SBI) of the CBS in the Netherlands""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - code = EAttribute(eType=EString, derived=False, changeable=True) - dataSource = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, id=None, name=None, description=None, dataSource=None, code=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if description is not None: - self.description = description - - if code is not None: - self.code = code - - if dataSource is not None: - self.dataSource = dataSource - - -@abstract -class AbstractInstanceDate(EObject, metaclass=MetaEClass): - """Abstract class to define the date or period of the validity of the data that is used in this instance """ - - def __init__(self, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - -class WeekSchedule(EObject, metaclass=MetaEClass): - """Specifies a week schedule for building usage""" - mon = EReference(ordered=True, unique=True, containment=True) - tue = EReference(ordered=True, unique=True, containment=True) - wed = EReference(ordered=True, unique=True, containment=True) - thu = EReference(ordered=True, unique=True, containment=True) - fri = EReference(ordered=True, unique=True, containment=True) - sat = EReference(ordered=True, unique=True, containment=True) - sun = EReference(ordered=True, unique=True, containment=True) - weekdays = EReference(ordered=True, unique=True, containment=True) - weekenddays = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, mon=None, tue=None, wed=None, thu=None, fri=None, sat=None, sun=None, weekdays=None, weekenddays=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if mon is not None: - self.mon = mon - - if tue is not None: - self.tue = tue - - if wed is not None: - self.wed = wed - - if thu is not None: - self.thu = thu - - if fri is not None: - self.fri = fri - - if sat is not None: - self.sat = sat - - if sun is not None: - self.sun = sun - - if weekdays is not None: - self.weekdays = weekdays - - if weekenddays is not None: - self.weekenddays = weekenddays - - -class DaySchedule(EObject, metaclass=MetaEClass): - """Specifies a day schedule as part of a week schedule. A day schedule is a collection of events with a timestamp""" - event = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, event=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if event: - self.event.extend(event) - - -class Event(EObject, metaclass=MetaEClass): - """Event with a timestamp""" - id = EAttribute(eType=EString, derived=False, changeable=True) - time = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - value = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, id=None, time=None, description=None, value=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if time is not None: - self.time = time - - if description is not None: - self.description = description - - if value is not None: - self.value = value - - -@abstract -class AbstractBuildingUsage(EObject, metaclass=MetaEClass): - """Abstract class to support references to building usages""" - - def __init__(self, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - -class BuildingUsageInformation(EObject, metaclass=MetaEClass): - """Part of Energy System Information that specifies generic building usage information that can be referenced from multiple individual buildings""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - buildingUsage = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, buildingUsage=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if buildingUsage: - self.buildingUsage.extend(buildingUsage) - - -class BuildingTypePercentage(EObject, metaclass=MetaEClass): - """Specifies the percentage of the selected building type""" - buildingType = EAttribute(eType=BuildingTypeEnum, derived=False, changeable=True) - percentage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, buildingType=None, percentage=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if buildingType is not None: - self.buildingType = buildingType - - if percentage is not None: - self.percentage = percentage - - -class ResidentialBuildingTypePercentage(EObject, metaclass=MetaEClass): - """Specifies the percentage of the selected residential building type""" - residentialBuildingType = EAttribute( - eType=ResidentialBuildingTypeEnum, derived=False, changeable=True) - percentage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, residentialBuildingType=None, percentage=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if residentialBuildingType is not None: - self.residentialBuildingType = residentialBuildingType - - if percentage is not None: - self.percentage = percentage - - -class OwnershipRentalTypePercentage(EObject, metaclass=MetaEClass): - """Specifies the percentage of the selected housing type""" - ownershipRentalType = EAttribute(eType=OwnershipRentalTypeEnum, derived=False, - changeable=True, default_value=OwnershipRentalTypeEnum.UNDEFINED) - percentage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, ownershipRentalType=None, percentage=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if ownershipRentalType is not None: - self.ownershipRentalType = ownershipRentalType - - if percentage is not None: - self.percentage = percentage - - -class CompoundMatterComponent(EObject, metaclass=MetaEClass): - """One of the components of a CompoundMatter instance""" - mixFraction = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - layerWidth = EAttribute(eType=EDouble, derived=False, changeable=True) - matter = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, mixFraction=None, matter=None, layerWidth=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if mixFraction is not None: - self.mixFraction = mixFraction - - if layerWidth is not None: - self.layerWidth = layerWidth - - if matter is not None: - self.matter = matter - - -class IntTargetKPI(EObject, metaclass=MetaEClass): - - value = EAttribute(eType=EInt, derived=False, changeable=True) - year = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, value=None, year=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value is not None: - self.value = value - - if year is not None: - self.year = year - - -class DoubleTargetKPI(EObject, metaclass=MetaEClass): - - value = EAttribute(eType=EDouble, derived=False, changeable=True) - year = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, value=None, year=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value is not None: - self.value = value - - if year is not None: - self.year = year - - -class StringTargetKPI(EObject, metaclass=MetaEClass): - - value = EAttribute(eType=EString, derived=False, changeable=True) - year = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, value=None, year=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value is not None: - self.value = value - - if year is not None: - self.year = year - - -class Templates(EObject, metaclass=MetaEClass): - """Collection of templates, e.g. asset templates. -""" - assetTemplate = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, assetTemplate=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if assetTemplate: - self.assetTemplate.extend(assetTemplate) - - -class Address(EObject, metaclass=MetaEClass): - """The address of a building unit.""" - streetName = EAttribute(eType=EString, derived=False, changeable=True) - houseNumber = EAttribute(eType=EInt, derived=False, changeable=True) - houseNumberLetter = EAttribute(eType=EString, derived=False, changeable=True) - houseNumberAnnex = EAttribute(eType=EString, derived=False, changeable=True) - postalCode = EAttribute(eType=EString, derived=False, changeable=True) - city = EAttribute(eType=EString, derived=False, changeable=True) - stateOrProvince = EAttribute(eType=EString, derived=False, changeable=True) - country = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, streetName=None, houseNumber=None, houseNumberLetter=None, houseNumberAnnex=None, postalCode=None, city=None, stateOrProvince=None, country=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if streetName is not None: - self.streetName = streetName - - if houseNumber is not None: - self.houseNumber = houseNumber - - if houseNumberLetter is not None: - self.houseNumberLetter = houseNumberLetter - - if houseNumberAnnex is not None: - self.houseNumberAnnex = houseNumberAnnex - - if postalCode is not None: - self.postalCode = postalCode - - if city is not None: - self.city = city - - if stateOrProvince is not None: - self.stateOrProvince = stateOrProvince - - if country is not None: - self.country = country - - -class LabelJump(EObject, metaclass=MetaEClass): - - fromLabel = EAttribute(eType=EnergyLabelEnum, derived=False, changeable=True) - toLabel = EAttribute(eType=EnergyLabelEnum, derived=False, changeable=True) - buildingType = EAttribute(eType=ResidentialBuildingTypeEnum, derived=False, changeable=True) - buildingYearRange = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, fromLabel=None, toLabel=None, buildingType=None, buildingYearRange=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if fromLabel is not None: - self.fromLabel = fromLabel - - if toLabel is not None: - self.toLabel = toLabel - - if buildingType is not None: - self.buildingType = buildingType - - if buildingYearRange is not None: - self.buildingYearRange = buildingYearRange - - -@abstract -class BuildingInformation(EObject, metaclass=MetaEClass): - """Super class of all different kinds of extra information that can be specified for a building""" - - def __init__(self, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - -class Table(EObject, metaclass=MetaEClass): - """Table class that represents data in a table structure. Current examples are the pump curve table and a table describing the flowCoefficient of a checkvalve (relation between pressure drop and flow rate)""" - name = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - row = EReference(ordered=True, unique=True, containment=True, upper=-1) - header = EReference(ordered=True, unique=True, containment=True, upper=-1) - datasource = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, row=None, header=None, name=None, description=None, datasource=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if name is not None: - self.name = name - - if description is not None: - self.description = description - - if row: - self.row.extend(row) - - if header: - self.header.extend(header) - - if datasource is not None: - self.datasource = datasource - - -class TableRow(EObject, metaclass=MetaEClass): - - value = EAttribute(eType=EDouble, derived=False, changeable=True, upper=-1) - - def __init__(self, *, value=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if value: - self.value.extend(value) - - -class Notes(EObject, metaclass=MetaEClass): - """Collection of notes that can be added to the map, like postits (with comments in HTML)""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - note = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, note=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if note: - self.note.extend(note) - - -class Note(EObject, metaclass=MetaEClass): - """An individual note that can have a location on the map, to document certain decisions""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - title = EAttribute(eType=EString, derived=False, changeable=True) - author = EAttribute(eType=EString, derived=False, changeable=True) - text = EAttribute(eType=EString, derived=False, changeable=True) - date = EAttribute(eType=EDate, derived=False, changeable=True) - mapLocation = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, id=None, mapLocation=None, title=None, author=None, text=None, date=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if title is not None: - self.title = title - - if author is not None: - self.author = author - - if text is not None: - self.text = text - - if date is not None: - self.date = date - - if mapLocation is not None: - self.mapLocation = mapLocation - - -class Matters(EObject, metaclass=MetaEClass): - - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - dataSource = EReference(ordered=True, unique=True, containment=True) - matter = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, id=None, dataSource=None, matter=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if dataSource is not None: - self.dataSource = dataSource - - if matter: - self.matter.extend(matter) - - -@abstract -class AbstractMatter(EObject, metaclass=MetaEClass): - """Abstract class for describing Matters, can be instantiated as a subclass of Matter or as a MatterReference.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, id=None, name=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - -class EnvironmentalProfiles(EObject, metaclass=MetaEClass): - - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - outsideTemperatureProfile = EReference(ordered=True, unique=True, containment=True) - solarIrradianceProfile = EReference(ordered=True, unique=True, containment=True) - windSpeedProfile = EReference(ordered=True, unique=True, containment=True) - windDirectionProfile = EReference(ordered=True, unique=True, containment=True) - soilTemperatureProfile = EReference(ordered=True, unique=True, containment=True) - relativeHumidityProfile = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, outsideTemperatureProfile=None, solarIrradianceProfile=None, windSpeedProfile=None, windDirectionProfile=None, soilTemperatureProfile=None, relativeHumidityProfile=None, id=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if outsideTemperatureProfile is not None: - self.outsideTemperatureProfile = outsideTemperatureProfile - - if solarIrradianceProfile is not None: - self.solarIrradianceProfile = solarIrradianceProfile - - if windSpeedProfile is not None: - self.windSpeedProfile = windSpeedProfile - - if windDirectionProfile is not None: - self.windDirectionProfile = windDirectionProfile - - if soilTemperatureProfile is not None: - self.soilTemperatureProfile = soilTemperatureProfile - - if relativeHumidityProfile is not None: - self.relativeHumidityProfile = relativeHumidityProfile - - -@abstract -class AbstractBehaviour(EObject, metaclass=MetaEClass): - """Abstract class for specification of the (dynamic) behaviour of an asset""" - id = EAttribute(eType=EString, derived=False, changeable=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, id=None, name=None, **kwargs): - if kwargs: - raise AttributeError('unexpected arguments: {}'.format(kwargs)) - - super().__init__() - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - -class InPort(Port): - """Represents a port with a positive energy direction into the asset, e.g. for a Consumer. See Port for more details""" - connectedTo = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, connectedTo=None, **kwargs): - - super().__init__(**kwargs) - - if connectedTo: - self.connectedTo.extend(connectedTo) - - -class OutPort(Port): - """Represents a port with a positive energy direction out of the asset, e.g. for a Producer. See Port for more details""" - connectedTo = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, connectedTo=None, **kwargs): - - super().__init__(**kwargs) - - if connectedTo: - self.connectedTo.extend(connectedTo) - - -@abstract -class Asset(Item): - """Assets are all physical thing in the EnergySystem. Assets can have a location, a geometry, commissioning and decommissioning dates, cost information (investment, installation and operation and maintenance costs).""" - surfaceArea = EAttribute(eType=EInt, derived=False, changeable=True) - commissioningDate = EAttribute(eType=EDate, derived=False, changeable=True) - decommissioningDate = EAttribute(eType=EDate, derived=False, changeable=True) - owner = EAttribute(eType=EString, derived=False, changeable=True) - technicalLifetime = EAttribute(eType=EDouble, derived=False, changeable=True) - aggregated = EAttribute(eType=EBoolean, derived=False, changeable=True) - aggregationCount = EAttribute(eType=EInt, derived=False, changeable=True, default_value=1) - installationDuration = EAttribute(eType=EDouble, derived=False, changeable=True) - assetType = EAttribute(eType=EString, derived=False, changeable=True) - state = EAttribute(eType=AssetStateEnum, derived=False, changeable=True) - manufacturer = EAttribute(eType=EString, derived=False, changeable=True) - area = EReference(ordered=True, unique=True, containment=False) - containingBuilding = EReference(ordered=True, unique=True, containment=False) - geometry = EReference(ordered=True, unique=True, containment=True) - costInformation = EReference(ordered=True, unique=True, containment=True) - KPIs = EReference(ordered=True, unique=True, containment=True) - material = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, surfaceArea=None, commissioningDate=None, decommissioningDate=None, owner=None, area=None, containingBuilding=None, geometry=None, costInformation=None, technicalLifetime=None, aggregated=None, aggregationCount=None, installationDuration=None, KPIs=None, assetType=None, state=None, material=None, manufacturer=None, **kwargs): - - super().__init__(**kwargs) - - if surfaceArea is not None: - self.surfaceArea = surfaceArea - - if commissioningDate is not None: - self.commissioningDate = commissioningDate - - if decommissioningDate is not None: - self.decommissioningDate = decommissioningDate - - if owner is not None: - self.owner = owner - - if technicalLifetime is not None: - self.technicalLifetime = technicalLifetime - - if aggregated is not None: - self.aggregated = aggregated - - if aggregationCount is not None: - self.aggregationCount = aggregationCount - - if installationDuration is not None: - self.installationDuration = installationDuration - - if assetType is not None: - self.assetType = assetType - - if state is not None: - self.state = state - - if manufacturer is not None: - self.manufacturer = manufacturer - - if area is not None: - self.area = area - - if containingBuilding is not None: - self.containingBuilding = containingBuilding - - if geometry is not None: - self.geometry = geometry - - if costInformation is not None: - self.costInformation = costInformation - - if KPIs is not None: - self.KPIs = KPIs - - if material is not None: - self.material = material - - -class Point(Geometry): - """Describes a point geometry, which can be used for giving assets a location on a map""" - lat = EAttribute(eType=EDouble, derived=False, changeable=True) - lon = EAttribute(eType=EDouble, derived=False, changeable=True) - elevation = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, lat=None, lon=None, elevation=None, **kwargs): - - super().__init__(**kwargs) - - if lat is not None: - self.lat = lat - - if lon is not None: - self.lon = lon - - if elevation is not None: - self.elevation = elevation - - -class Polygon(Geometry): - """Describes a polygon geometry, which can be used for defining the shape of an area or building""" - exterior = EReference(ordered=True, unique=True, containment=True) - interior = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, exterior=None, interior=None, **kwargs): - - super().__init__(**kwargs) - - if exterior is not None: - self.exterior = exterior - - if interior: - self.interior.extend(interior) - - -class Measures(Item): - """Collection of measures that can be applied to an energy system""" - measure = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, measure=None, **kwargs): - - super().__init__(**kwargs) - - if measure: - self.measure.extend(measure) - - -@abstract -class Service(Item): - """Abstract class to represent logical entities in the energy system, e.g. demand response services, energy markets, etc.""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class Potential(Item): - """Abstract class that represents energy potentials in an area, like wind potential, geothermal potential, residual heat source potential, etc.""" - geometryReference = EAttribute(eType=EString, derived=False, changeable=True) - aggregated = EAttribute(eType=EBoolean, derived=False, changeable=True, default_value=False) - aggregationCount = EAttribute(eType=EInt, derived=False, changeable=True, default_value=1) - geometry = EReference(ordered=True, unique=True, containment=True) - quantityAndUnit = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, geometry=None, geometryReference=None, quantityAndUnit=None, aggregated=None, aggregationCount=None, **kwargs): - - super().__init__(**kwargs) - - if geometryReference is not None: - self.geometryReference = geometryReference - - if aggregated is not None: - self.aggregated = aggregated - - if aggregationCount is not None: - self.aggregationCount = aggregationCount - - if geometry is not None: - self.geometry = geometry - - if quantityAndUnit is not None: - self.quantityAndUnit = quantityAndUnit - - -class EnergyCarrier(Carrier): - """Defines a carrier of energy with its emission and energy content properties""" - energyContent = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - emission = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - energyCarrierType = EAttribute(eType=RenewableTypeEnum, derived=False, changeable=True) - stateOfMatter = EAttribute(eType=StateOfMatterEnum, derived=False, - changeable=True, default_value=StateOfMatterEnum.UNDEFINED) - energyContentUnit = EReference(ordered=True, unique=True, containment=True) - emissionUnit = EReference(ordered=True, unique=True, containment=True) - composition = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, energyContent=None, emission=None, energyCarrierType=None, energyContentUnit=None, emissionUnit=None, composition=None, stateOfMatter=None, **kwargs): - - super().__init__(**kwargs) - - if energyContent is not None: - self.energyContent = energyContent - - if emission is not None: - self.emission = emission - - if energyCarrierType is not None: - self.energyCarrierType = energyCarrierType - - if stateOfMatter is not None: - self.stateOfMatter = stateOfMatter - - if energyContentUnit is not None: - self.energyContentUnit = energyContentUnit - - if emissionUnit is not None: - self.emissionUnit = emissionUnit - - if composition is not None: - self.composition = composition - - -@abstract -class StaticProfile(GenericProfile): - """Stores the profile in the ESDL model itself, in contrast with an external profile, which refers to an external source for a profile""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class ExternalProfile(GenericProfile): - """ExternalProfile allows to refer to an externally defined profile. Common uses are a profile defined in a (timeseries) database such as InfluxDB. -It allows you to specify a multiplier to scale the supplied external profile by a certain factor (e.g. when using NEDU profiles). Default the multiplier is '1'.""" - multiplier = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=1.0) - startDate = EAttribute(eType=EDate, derived=False, changeable=True) - endDate = EAttribute(eType=EDate, derived=False, changeable=True) - - def __init__(self, *, multiplier=None, startDate=None, endDate=None, **kwargs): - - super().__init__(**kwargs) - - if multiplier is not None: - self.multiplier = multiplier - - if startDate is not None: - self.startDate = startDate - - if endDate is not None: - self.endDate = endDate - - -class PercentileDistribution(GenericDistribution): - """Defines a distribution in terms of percentiles""" - percentile = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, percentile=None, **kwargs): - - super().__init__(**kwargs) - - if percentile: - self.percentile.extend(percentile) - - -@abstract -class SpecificLabelDistribution(GenericDistribution): - """Abstract class to define a distribution with labels""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class SymmetricVariance(AbstractVariance): - """(experimental) Used to define statistical information""" - sigma = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, sigma=None, **kwargs): - - super().__init__(**kwargs) - - if sigma is not None: - self.sigma = sigma - - -class AssymmetricVariance(AbstractVariance): - """(experimental) Used to define statistical information""" - sigmaMin = EAttribute(eType=EDouble, derived=False, changeable=True) - sigmaPlus = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, sigmaMin=None, sigmaPlus=None, **kwargs): - - super().__init__(**kwargs) - - if sigmaMin is not None: - self.sigmaMin = sigmaMin - - if sigmaPlus is not None: - self.sigmaPlus = sigmaPlus - - -class DoubleAssymmetricVariance(AbstractVariance): - """(experimental) Used to define statistical information""" - plus34perc = EAttribute(eType=EDouble, derived=False, changeable=True) - plus48perc = EAttribute(eType=EDouble, derived=False, changeable=True) - min34perc = EAttribute(eType=EDouble, derived=False, changeable=True) - min48perc = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, plus34perc=None, plus48perc=None, min34perc=None, min48perc=None, **kwargs): - - super().__init__(**kwargs) - - if plus34perc is not None: - self.plus34perc = plus34perc - - if plus48perc is not None: - self.plus48perc = plus48perc - - if min34perc is not None: - self.min34perc = min34perc - - if min48perc is not None: - self.min48perc = min48perc - - -class Line(Geometry): - """Describes a line geometry based on a list of points, which can be used to define the shape of pipes and cables""" - point = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, point=None, **kwargs): - - super().__init__(**kwargs) - - if point: - self.point.extend(point) - - -@abstract -class Commodity(Carrier): - """Abstract class for commodities""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class DataSource(AbstractDataSource): - """A DataSource describes the source of the piece of information used in the energy system. E.g. a profile from NEDU or typical parameters of an Asset""" - name = EAttribute(eType=EString, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - reference = EAttribute(eType=EString, derived=False, changeable=True) - attribution = EAttribute(eType=EString, derived=False, changeable=True) - releaseDate = EAttribute(eType=EDate, derived=False, changeable=True) - version = EAttribute(eType=EString, derived=False, changeable=True) - licence = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, name=None, description=None, reference=None, attribution=None, releaseDate=None, version=None, licence=None, **kwargs): - - super().__init__(**kwargs) - - if name is not None: - self.name = name - - if description is not None: - self.description = description - - if reference is not None: - self.reference = reference - - if attribution is not None: - self.attribution = attribution - - if releaseDate is not None: - self.releaseDate = releaseDate - - if version is not None: - self.version = version - - if licence is not None: - self.licence = licence - - -class MultiPolygon(Geometry): - """Collection of Polygons""" - polygon = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, polygon=None, **kwargs): - - super().__init__(**kwargs) - - if polygon: - self.polygon.extend(polygon) - - -class QuantityAndUnitType(AbstractQuantityAndUnit): - """Defines the quantity and its unit for a specific parameter. Used in e.g. profiles and KPIs. For example Energy in Joules or CO2 emission in kton.""" - physicalQuantity = EAttribute(eType=PhysicalQuantityEnum, derived=False, changeable=True) - multiplier = EAttribute(eType=MultiplierEnum, derived=False, changeable=True) - unit = EAttribute(eType=UnitEnum, derived=False, changeable=True) - perMultiplier = EAttribute(eType=MultiplierEnum, derived=False, changeable=True) - perUnit = EAttribute(eType=UnitEnum, derived=False, changeable=True) - description = EAttribute(eType=EString, derived=False, changeable=True) - perTimeUnit = EAttribute(eType=TimeUnitEnum, derived=False, changeable=True) - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - perScope = EAttribute(eType=QuantityAndUnitScopeEnum, derived=False, changeable=True) - - def __init__(self, *, physicalQuantity=None, multiplier=None, unit=None, perMultiplier=None, perUnit=None, description=None, perTimeUnit=None, id=None, perScope=None, **kwargs): - - super().__init__(**kwargs) - - if physicalQuantity is not None: - self.physicalQuantity = physicalQuantity - - if multiplier is not None: - self.multiplier = multiplier - - if unit is not None: - self.unit = unit - - if perMultiplier is not None: - self.perMultiplier = perMultiplier - - if perUnit is not None: - self.perUnit = perUnit - - if description is not None: - self.description = description - - if perTimeUnit is not None: - self.perTimeUnit = perTimeUnit - - if id is not None: - self.id = id - - if perScope is not None: - self.perScope = perScope - - -class DataSourceReference(AbstractDataSource): - """Defines a reference to a datasource, defined in the collection of DataSources (as part of the EnergySystemInformation)""" - reference = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, reference=None, **kwargs): - - super().__init__(**kwargs) - - if reference is not None: - self.reference = reference - - -class QuantityAndUnitReference(AbstractQuantityAndUnit): - """Defines a reference to a QuantityAndUnitType defined in the collection of QuantityAndUnits (as part of the EnergySystemInformation)""" - reference = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, reference=None, **kwargs): - - super().__init__(**kwargs) - - if reference is not None: - self.reference = reference - - -class StringParameter(Parameters): - """Defines a parameter of type String""" - value = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class DoubleParameter(Parameters): - """Defines a parameter of type Double""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class IntegerParameter(Parameters): - """Defines a parameter of type Integer""" - value = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class BooleanParameter(Parameters): - """Defines a parameter of type Boolean""" - value = EAttribute(eType=EBoolean, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class MultiLine(Geometry): - """Defines a collection of lines""" - line = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, line=None, **kwargs): - - super().__init__(**kwargs) - - if line: - self.line.extend(line) - - -class InstanceDate(AbstractInstanceDate): - """Describes the date of the validity of the data that is used in this instance """ - date = EAttribute(eType=EDate, derived=False, changeable=True) - - def __init__(self, *, date=None, **kwargs): - - super().__init__(**kwargs) - - if date is not None: - self.date = date - - -class InstancePeriod(AbstractInstanceDate): - """Describes the period of the validity of the data that is used in this instance """ - fromDate = EAttribute(eType=EDate, derived=False, changeable=True) - toDate = EAttribute(eType=EDate, derived=False, changeable=True) - - def __init__(self, *, fromDate=None, toDate=None, **kwargs): - - super().__init__(**kwargs) - - if fromDate is not None: - self.fromDate = fromDate - - if toDate is not None: - self.toDate = toDate - - -class WKT(Geometry): - """Well-Known Text (see https://en.wikipedia.org/wiki/Well-known_text)""" - value = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class WKB(Geometry): - """Well-Known Binary (See https://en.wikipedia.org/wiki/Well-known_text#Well-known_binary)""" - value = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class BuildingUsage(AbstractBuildingUsage): - """Collection of information about the usage of a building, such as temperature set points and opening hours.""" - id = EAttribute(eType=EString, derived=False, changeable=True, iD=True) - name = EAttribute(eType=EString, derived=False, changeable=True) - coolingSetpoints = EReference(ordered=True, unique=True, containment=True) - heatingSetpoints = EReference(ordered=True, unique=True, containment=True) - openingHours = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, id=None, name=None, coolingSetpoints=None, heatingSetpoints=None, openingHours=None, **kwargs): - - super().__init__(**kwargs) - - if id is not None: - self.id = id - - if name is not None: - self.name = name - - if coolingSetpoints is not None: - self.coolingSetpoints = coolingSetpoints - - if heatingSetpoints is not None: - self.heatingSetpoints = heatingSetpoints - - if openingHours is not None: - self.openingHours = openingHours - - -class BuildingUsageReference(AbstractBuildingUsage): - """Specifies a reference to building usage (such as opening hours)""" - reference = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, reference=None, **kwargs): - - super().__init__(**kwargs) - - if reference is not None: - self.reference = reference - - -class DoubleKPI(KPI): - """Specifies a KPI value as a double""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - target = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, value=None, target=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if target: - self.target.extend(target) - - -class StringKPI(KPI): - """Specifies a KPI value as a string""" - value = EAttribute(eType=EString, derived=False, changeable=True) - target = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, value=None, target=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if target: - self.target.extend(target) - - -class IntKPI(KPI): - """Specifies a KPI value as an integer""" - value = EAttribute(eType=EInt, derived=False, changeable=True) - target = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, value=None, target=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if target: - self.target.extend(target) - - -class FromToIntItem(FromToItem): - """Specifies a percentage range as an integer value, as part of a distribution, e.g. for defining a period of years (1945-1960) in Aggregated Buildings""" - from_ = EAttribute(eType=EInt, derived=False, changeable=True) - to = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, from_=None, to=None, **kwargs): - - super().__init__(**kwargs) - - if from_ is not None: - self.from_ = from_ - - if to is not None: - self.to = to - - -class FromToDoubleItem(FromToItem): - """Specifies a percentage range as an double value, as part of a distribution, e.g. for defining energy usage (2.5-5.0 GJ of hot tap water) in Aggregated Buildings""" - from_ = EAttribute(eType=EDouble, derived=False, changeable=True) - to = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, from_=None, to=None, **kwargs): - - super().__init__(**kwargs) - - if from_ is not None: - self.from_ = from_ - - if to is not None: - self.to = to - - -@abstract -class Matter(AbstractMatter): - """Abstract class for describing matters. There are three subclasses: - -- Material: for the materials of which Assets are made, but also for raw materials (e.g. water as an input for an electrolyzer) -- Fuels: for decomposing EnergyCarriers -- CompoundMatter for creating a mixture or a collection of Materials or Fuels""" - density = EAttribute(eType=EDouble, derived=False, changeable=True) - stateOfMatter = EAttribute(eType=StateOfMatterEnum, derived=False, changeable=True) - - def __init__(self, *, density=None, stateOfMatter=None, **kwargs): - - super().__init__(**kwargs) - - if density is not None: - self.density = density - - if stateOfMatter is not None: - self.stateOfMatter = stateOfMatter - - -@abstract -class Restriction(Item): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class AssetTemplate(Item): - """Template for an asset. Can be used to specify a generic asset type where specific instances can refer to and inherit properties of. -""" - asset = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, asset=None, **kwargs): - - super().__init__(**kwargs) - - if asset is not None: - self.asset = asset - - -@abstract -class GenericLabelDistribution(GenericDistribution): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class DistributionKPI(KPI): - - distribution = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, distribution=None, **kwargs): - - super().__init__(**kwargs) - - if distribution is not None: - self.distribution = distribution - - -@abstract -class AbstractMeasure(Item): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class ResidentialBuildingInformation(BuildingInformation): - """Class that contains extra information that can be specified for a residential building""" - numberOfInhabitants = EAttribute(eType=EInt, derived=False, changeable=True) - inhabitantsType = EAttribute(eType=InhabitantsTypeEnum, derived=False, - changeable=True, default_value=InhabitantsTypeEnum.UNDEFINED) - residentialBuildingType = EAttribute(eType=ResidentialBuildingTypeEnum, derived=False, - changeable=True, default_value=ResidentialBuildingTypeEnum.UNDEFINED) - ownershipRentalType = EAttribute(eType=OwnershipRentalTypeEnum, derived=False, - changeable=True, default_value=OwnershipRentalTypeEnum.UNDEFINED) - - def __init__(self, *, numberOfInhabitants=None, inhabitantsType=None, residentialBuildingType=None, ownershipRentalType=None, **kwargs): - - super().__init__(**kwargs) - - if numberOfInhabitants is not None: - self.numberOfInhabitants = numberOfInhabitants - - if inhabitantsType is not None: - self.inhabitantsType = inhabitantsType - - if residentialBuildingType is not None: - self.residentialBuildingType = residentialBuildingType - - if ownershipRentalType is not None: - self.ownershipRentalType = ownershipRentalType - - -class BuildingStructureInformation(BuildingInformation): - - slantedRoofArea = EAttribute(eType=EDouble, derived=False, changeable=True) - wallArea = EAttribute(eType=EDouble, derived=False, changeable=True) - roofType = EAttribute(eType=RoofTypeEnum, derived=False, changeable=True) - flatRoofArea = EAttribute(eType=EDouble, derived=False, changeable=True) - windowArea = EAttribute(eType=EDouble, derived=False, changeable=True) - glassType = EAttribute(eType=GlazingTypeEnum, derived=False, changeable=True) - height = EAttribute(eType=EDouble, derived=False, changeable=True) - orientation = EAttribute(eType=EInt, derived=False, changeable=True) - rcWall = EAttribute(eType=EDouble, derived=False, changeable=True) - rcRoof = EAttribute(eType=EDouble, derived=False, changeable=True) - ventilationType = EAttribute(eType=VentilationTypeEnum, derived=False, changeable=True) - rcFloor = EAttribute(eType=EDouble, derived=False, changeable=True) - uWindow = EAttribute(eType=EDouble, derived=False, changeable=True) - perimeter = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, slantedRoofArea=None, wallArea=None, roofType=None, flatRoofArea=None, windowArea=None, glassType=None, height=None, orientation=None, rcWall=None, rcRoof=None, ventilationType=None, rcFloor=None, uWindow=None, perimeter=None, **kwargs): - - super().__init__(**kwargs) - - if slantedRoofArea is not None: - self.slantedRoofArea = slantedRoofArea - - if wallArea is not None: - self.wallArea = wallArea - - if roofType is not None: - self.roofType = roofType - - if flatRoofArea is not None: - self.flatRoofArea = flatRoofArea - - if windowArea is not None: - self.windowArea = windowArea - - if glassType is not None: - self.glassType = glassType - - if height is not None: - self.height = height - - if orientation is not None: - self.orientation = orientation - - if rcWall is not None: - self.rcWall = rcWall - - if rcRoof is not None: - self.rcRoof = rcRoof - - if ventilationType is not None: - self.ventilationType = ventilationType - - if rcFloor is not None: - self.rcFloor = rcFloor - - if uWindow is not None: - self.uWindow = uWindow - - if perimeter is not None: - self.perimeter = perimeter - - -class MatterReference(AbstractMatter): - """can be used to refer to a Matter from the collection of Matters (part of EnergySystemInformation)""" - reference = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, reference=None, **kwargs): - - super().__init__(**kwargs) - - if reference is not None: - self.reference = reference - - -class InputOutputQuantityRelation(AbstractBehaviour): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class AbstractTransferFunction(AbstractBehaviour): - """Abstract class for a TransferFunction for the specification of the behaviour of an asset""" - type = EAttribute(eType=TransferFunctionTypeEnum, derived=False, changeable=True) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - -@abstract -class EnergyAsset(Asset): - """An abstract class that describes a connectable Asset using ports. EnergyAssets main subclasses contain the 5 capability type: Producer, Consumer, Storage, Conversion and Transport """ - port = EReference(ordered=True, unique=True, containment=True, upper=-1) - controlStrategy = EReference(ordered=True, unique=True, containment=False) - behaviour = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, port=None, controlStrategy=None, behaviour=None, **kwargs): - - super().__init__(**kwargs) - - if port: - self.port.extend(port) - - if controlStrategy is not None: - self.controlStrategy = controlStrategy - - if behaviour: - self.behaviour.extend(behaviour) - - -class Insulation(Asset): - """Describes insulation that can be added to a building. The relation with the heat consumption is not defined and requires manual modelling""" - thermalInsulation = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, thermalInsulation=None, **kwargs): - - super().__init__(**kwargs) - - if thermalInsulation is not None: - self.thermalInsulation = thermalInsulation - - -class LegalArea(Potential): - """Used to define an area in which its purpose is defined by legal authorities, such as restricted areas. E.g. in areas where water is extracted, it is not allowed to plan new UTES.""" - purpose = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, purpose=None, **kwargs): - - super().__init__(**kwargs) - - if purpose is not None: - self.purpose = purpose - - -@abstract -class EnergyService(Service): - """Abstract class to represent logical entities in the energy system, e.g. demand response services, energy markets, etc.""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class AbstractBuilding(Asset): - """Describes the shared properties of building, building unit and aggregated building""" - asset = EReference(ordered=True, unique=True, containment=True, upper=-1) - buildingUsage = EReference(ordered=True, unique=True, containment=True) - potential = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, asset=None, buildingUsage=None, potential=None, **kwargs): - - super().__init__(**kwargs) - - if asset: - self.asset.extend(asset) - - if buildingUsage is not None: - self.buildingUsage = buildingUsage - - if potential: - self.potential.extend(potential) - - -class WindPotential(Potential): - """Defines the potential for wind energy. This class can be used instead of 'SearchAreaWind' in case there is more information available.""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - fullLoadHours = EAttribute(eType=EInt, derived=False, changeable=True) - area = EAttribute(eType=EDouble, derived=False, changeable=True) - height = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, value=None, fullLoadHours=None, area=None, height=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if fullLoadHours is not None: - self.fullLoadHours = fullLoadHours - - if area is not None: - self.area = area - - if height is not None: - self.height = height - - -class DateTimeProfile(StaticProfile): - """Describes a profile using one or more Profile elements. Each element defines a from- and a to-datetime and a value which is valid for this range. The to-field may be ommitted, meaning this value is valid for all time after the to-date.""" - element = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, element=None, **kwargs): - - super().__init__(**kwargs) - - if element: - self.element.extend(element) - - -class SingleValue(StaticProfile): - """A profile used to define a single value. This should be used when no information is present about the time. E.g. the price of a PV panel as currently known -When a model queries for a value from a certain date (and to a certain date), that information will be ignored and it will always return this value.""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class StringLabelDistribution(GenericLabelDistribution): - """Defines a distribution in terms of self-defined labels""" - stringItem = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, stringItem=None, **kwargs): - - super().__init__(**kwargs) - - if stringItem: - self.stringItem.extend(stringItem) - - -class EnergyLabelDistribution(SpecificLabelDistribution): - """Defines a distribution in terms of energy labels""" - labelPerc = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, labelPerc=None, **kwargs): - - super().__init__(**kwargs) - - if labelPerc: - self.labelPerc.extend(labelPerc) - - -class FromToDistribution(GenericLabelDistribution): - """Defines a distribution in terms of 'from' and 'to'""" - fromToItem = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, fromToItem=None, **kwargs): - - super().__init__(**kwargs) - - if fromToItem: - self.fromToItem.extend(fromToItem) - - -class URIProfile(ExternalProfile): - """Describes a reference to a profile in an information system using a URI (e.g. a URI to a profile in Energy Information System (EIS))""" - URI = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, URI=None, **kwargs): - - super().__init__(**kwargs) - - if URI is not None: - self.URI = URI - - -@abstract -class DatabaseProfile(ExternalProfile): - """Describes the fields of a generic database-based profile""" - host = EAttribute(eType=EString, derived=False, changeable=True) - port = EAttribute(eType=EInt, derived=False, changeable=True) - database = EAttribute(eType=EString, derived=False, changeable=True) - filters = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, host=None, port=None, database=None, filters=None, **kwargs): - - super().__init__(**kwargs) - - if host is not None: - self.host = host - - if port is not None: - self.port = port - - if database is not None: - self.database = database - - if filters is not None: - self.filters = filters - - -class GasCommodity(Commodity): - """Defines a gas commodity. This class can be used as an abstract way of modelling gas commodity and can be used in conjunction with electricity commodity and heat commodity. If more detailed modelling is necessary, use energy carriers.""" - pressure = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, pressure=None, **kwargs): - - super().__init__(**kwargs) - - if pressure is not None: - self.pressure = pressure - - -class HeatCommodity(Commodity): - """Defines a heat commodity""" - supplyTemperature = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - returnTemperature = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, supplyTemperature=None, returnTemperature=None, **kwargs): - - super().__init__(**kwargs) - - if supplyTemperature is not None: - self.supplyTemperature = supplyTemperature - - if returnTemperature is not None: - self.returnTemperature = returnTemperature - - -class ElectricityCommodity(Commodity): - """Defines an electricity commodity""" - voltage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, voltage=None, **kwargs): - - super().__init__(**kwargs) - - if voltage is not None: - self.voltage = voltage - - -class Range(StaticProfile): - """Defines a range between two values""" - minValue = EAttribute(eType=EDouble, derived=False, changeable=True) - maxValue = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, minValue=None, maxValue=None, **kwargs): - - super().__init__(**kwargs) - - if minValue is not None: - self.minValue = minValue - - if maxValue is not None: - self.maxValue = maxValue - - -class SolarPotential(Potential): - """Defines the potential for solar energy. This class can be used instead of 'SearchAreaSolar' in case there is more information available.""" - value = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - solarPotentialType = EAttribute(eType=PVInstallationTypeEnum, derived=False, - changeable=True, default_value=PVInstallationTypeEnum.UNDEFINED) - fullLoadHours = EAttribute(eType=EInt, derived=False, changeable=True) - area = EAttribute(eType=EDouble, derived=False, changeable=True) - angle = EAttribute(eType=EInt, derived=False, changeable=True) - orientation = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, value=None, solarPotentialType=None, fullLoadHours=None, area=None, angle=None, orientation=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if solarPotentialType is not None: - self.solarPotentialType = solarPotentialType - - if fullLoadHours is not None: - self.fullLoadHours = fullLoadHours - - if area is not None: - self.area = area - - if angle is not None: - self.angle = angle - - if orientation is not None: - self.orientation = orientation - - -class ProfileReference(StaticProfile): - """Used to refer to profiles defined in the Energy System Information section""" - multiplier = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=1.0) - reference = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, multiplier=None, reference=None, **kwargs): - - super().__init__(**kwargs) - - if multiplier is not None: - self.multiplier = multiplier - - if reference is not None: - self.reference = reference - - -class ResidualHeatSourcePotential(Potential): - """Defines the residual heat potential in a specific area.""" - value = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - type = EAttribute(eType=ResidualHeatSourceTypeEnum, derived=False, changeable=True) - associatedConversionAsset = EReference(ordered=True, unique=True, containment=False) - residualHeatSource = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, value=None, type=None, associatedConversionAsset=None, residualHeatSource=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if type is not None: - self.type = type - - if associatedConversionAsset is not None: - self.associatedConversionAsset = associatedConversionAsset - - if residualHeatSource is not None: - self.residualHeatSource = residualHeatSource - - -class EnergyCommodity(Commodity): - """Generic energy commodity, to be used in (national) energy balances (when the type of energy is not important)""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Measure(AbstractMeasure): - """A single measure or a combination of measures with collective cost information that can be applied to an energy system. An example of a measure-combination would be a combination of insulation and a heat pump.""" - type = EAttribute(eType=MeasureTypeEnum, derived=False, changeable=True) - asset = EReference(ordered=True, unique=True, containment=True, upper=-1) - costInformation = EReference(ordered=True, unique=True, containment=True) - restriction = EReference(ordered=True, unique=True, containment=True, upper=-1) - labelJump = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, asset=None, costInformation=None, restriction=None, labelJump=None, type=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if asset: - self.asset.extend(asset) - - if costInformation is not None: - self.costInformation = costInformation - - if restriction: - self.restriction.extend(restriction) - - if labelJump is not None: - self.labelJump = labelJump - - -@abstract -class AbstractGTPotential(Potential): - """Abstract class to describe geothermal potential""" - geothermalSource = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, geothermalSource=None, **kwargs): - - super().__init__(**kwargs) - - if geothermalSource: - self.geothermalSource.extend(geothermalSource) - - -class UTESPotential(Potential): - """Defines the potential for underground thermal energy storage (UTES). E.g. ATES or BTES potential""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - type = EAttribute(eType=UTESPotentialTypeEnum, derived=False, changeable=True) - UTES = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, value=None, type=None, UTES=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - if type is not None: - self.type = type - - if UTES: - self.UTES.extend(UTES) - - -class BiomassPotential(Potential): - """Defines the biomass potential in a specific area.""" - value = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class Glazing(Asset): - """Allows to specify the glass of a building, e.g. for calculating heat loss""" - uWindow = EAttribute(eType=EDouble, derived=False, changeable=True) - glazingType = EAttribute(eType=GlazingTypeEnum, derived=False, - changeable=True, default_value=GlazingTypeEnum.UNDEFINED) - - def __init__(self, *, uWindow=None, glazingType=None, **kwargs): - - super().__init__(**kwargs) - - if uWindow is not None: - self.uWindow = uWindow - - if glazingType is not None: - self.glazingType = glazingType - - -class SearchAreaWind(Potential): - """Specifies search areas for wind turbines. Search areas are a kind of 'legal' areas that have been appointed by the (local) government as possible areas for wind installations. Further research should give insight in the real potential (in terms of energy).""" - fullLoadHours = EAttribute(eType=EInt, derived=False, changeable=True) - area = EAttribute(eType=EDouble, derived=False, changeable=True) - height = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, fullLoadHours=None, area=None, height=None, **kwargs): - - super().__init__(**kwargs) - - if fullLoadHours is not None: - self.fullLoadHours = fullLoadHours - - if area is not None: - self.area = area - - if height is not None: - self.height = height - - -class SearchAreaSolar(Potential): - """Specifies search areas for solar installations. Search areas are a kind of 'legal' areas that have been appointed by the (local) government as possible areas for solar installations. Further research should give insight in the real potential (in terms of energy).""" - fullLoadHours = EAttribute(eType=EInt, derived=False, changeable=True) - area = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, fullLoadHours=None, area=None, **kwargs): - - super().__init__(**kwargs) - - if fullLoadHours is not None: - self.fullLoadHours = fullLoadHours - - if area is not None: - self.area = area - - -class BuildingTypeDistribution(SpecificLabelDistribution): - """Specifies the way the building type is distributed in this area (e.g. Utility, Residential), specifing the percentage of buildings per type.""" - buildingTypePercentage = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, buildingTypePercentage=None, **kwargs): - - super().__init__(**kwargs) - - if buildingTypePercentage: - self.buildingTypePercentage.extend(buildingTypePercentage) - - -class ResidentialBuildingTypeDistribution(SpecificLabelDistribution): - """Specifies the way the residential building type is distributed in this area (e.g. Vrijstaande Woning, Hoekwoning, Flatwoning), specifing the percentage of buildings per residential type.""" - residentialBuildingTypePercentage = EReference( - ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, residentialBuildingTypePercentage=None, **kwargs): - - super().__init__(**kwargs) - - if residentialBuildingTypePercentage: - self.residentialBuildingTypePercentage.extend(residentialBuildingTypePercentage) - - -class OwnershipRentalTypeDistribution(SpecificLabelDistribution): - """Specifies the way the housing type is distributed in this area (e.g. Owner occupied, Housing Association, Private Rental), specifing the percentage of buildings per housing type.""" - ownershipRentalTypePercentage = EReference( - ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, ownershipRentalTypePercentage=None, **kwargs): - - super().__init__(**kwargs) - - if ownershipRentalTypePercentage: - self.ownershipRentalTypePercentage.extend(ownershipRentalTypePercentage) - - -class CompoundMatter(Matter): - """Composition of different Matters, either mixed (mix of gasses or liquids) or layered. - -Examples of layered Matters -- a construction of a wall, roof, or floor with isolation -- double or triple glazing consisting of multiple layers -- a heatnetwork pipe or electrical cable consisting of multiple layers""" - compoundType = EAttribute(eType=CompoundTypeEnum, derived=False, changeable=True) - component = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, component=None, compoundType=None, **kwargs): - - super().__init__(**kwargs) - - if compoundType is not None: - self.compoundType = compoundType - - if component: - self.component.extend(component) - - -class BuildingTypeRestriction(Restriction): - - type = EAttribute(eType=BuildingTypeEnum, derived=False, changeable=True, upper=-1) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type: - self.type.extend(type) - - -class AreaTypeRestriction(Restriction): - - type = EAttribute(eType=AreaTypeEnum, derived=False, changeable=True, upper=-1) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type: - self.type.extend(type) - - -class TemplatedAsset(Asset): - """An instantiated asset that is referring to an asset template and the specific asset. The asset template contains generic information, the specific asset contains specific information about this instance (e.g. geometry).""" - asset = EReference(ordered=True, unique=True, containment=True) - template = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, asset=None, template=None, **kwargs): - - super().__init__(**kwargs) - - if asset is not None: - self.asset = asset - - if template is not None: - self.template = template - - -class MinimumLabelRestriction(Restriction): - - label = EAttribute(eType=EnergyLabelEnum, derived=False, changeable=True) - - def __init__(self, *, label=None, **kwargs): - - super().__init__(**kwargs) - - if label is not None: - self.label = label - - -class MeasureReference(AbstractMeasure): - - reference = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, reference=None, **kwargs): - - super().__init__(**kwargs) - - if reference is not None: - self.reference = reference - - -class CompoundAsset(Asset): - - asset = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, asset=None, **kwargs): - - super().__init__(**kwargs) - - if asset: - self.asset.extend(asset) - - -class InitialValue(StaticProfile): - """Can be used to explicitely set an initial value of a certain parameter. Used as input for simulation models that calculate this parameter over time, but need a value to initialize the model.""" - value = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, value=None, **kwargs): - - super().__init__(**kwargs) - - if value is not None: - self.value = value - - -class Fuel(Matter): - """a Fuel like wood, oil, gas, and so on.""" - energyContent = EAttribute(eType=EDouble, derived=False, changeable=True) - emission = EAttribute(eType=EDouble, derived=False, changeable=True) - energyContentUnit = EReference(ordered=True, unique=True, containment=True) - emissionUnit = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, energyContent=None, emission=None, energyContentUnit=None, emissionUnit=None, **kwargs): - - super().__init__(**kwargs) - - if energyContent is not None: - self.energyContent = energyContent - - if emission is not None: - self.emission = emission - - if energyContentUnit is not None: - self.energyContentUnit = energyContentUnit - - if emissionUnit is not None: - self.emissionUnit = emissionUnit - - -class Material(Matter): - """a Material like copper, aluminum, wood, stone, concrete, water, styrofoam, plaster""" - thermalConductivity = EAttribute(eType=EDouble, derived=False, changeable=True) - electricalConductivity = EAttribute(eType=EDouble, derived=False, changeable=True) - youngsModulus = EAttribute(eType=EDouble, derived=False, changeable=True) - specificHeatCapacity = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, thermalConductivity=None, electricalConductivity=None, youngsModulus=None, specificHeatCapacity=None, **kwargs): - - super().__init__(**kwargs) - - if thermalConductivity is not None: - self.thermalConductivity = thermalConductivity - - if electricalConductivity is not None: - self.electricalConductivity = electricalConductivity - - if youngsModulus is not None: - self.youngsModulus = youngsModulus - - if specificHeatCapacity is not None: - self.specificHeatCapacity = specificHeatCapacity - - -class GenericTransferFunction(AbstractTransferFunction): - """Generic transfer function with numerator and denominator""" - numerator = EAttribute(eType=EDouble, derived=False, changeable=True, upper=-1) - denominator = EAttribute(eType=EDouble, derived=False, changeable=True, upper=-1) - - def __init__(self, *, numerator=None, denominator=None, **kwargs): - - super().__init__(**kwargs) - - if numerator: - self.numerator.extend(numerator) - - if denominator: - self.denominator.extend(denominator) - - -class DelayTransferFunction(AbstractTransferFunction): - """Delay transfer function with a time constant""" - timeConstant = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, timeConstant=None, **kwargs): - - super().__init__(**kwargs) - - if timeConstant is not None: - self.timeConstant = timeConstant - - -class CombinedTransferFunction(AbstractTransferFunction): - """Combination of multiple transfer functions by addition of multiplication of individual components""" - combinationFunction = EAttribute(eType=CombinationFunctionEnum, derived=False, changeable=True) - component = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, component=None, combinationFunction=None, **kwargs): - - super().__init__(**kwargs) - - if combinationFunction is not None: - self.combinationFunction = combinationFunction - - if component: - self.component.extend(component) - - -@abstract -class Producer(EnergyAsset): - """An abstract class that describes EnergyAssets that can produce energy. It is one of the 5 capabilities in ESDL""" - prodType = EAttribute(eType=RenewableTypeEnum, derived=False, - changeable=True, default_value=RenewableTypeEnum.RENEWABLE) - operationalHours = EAttribute(eType=EInt, derived=False, changeable=True) - fullLoadHours = EAttribute(eType=EInt, derived=False, changeable=True) - power = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, prodType=None, operationalHours=None, fullLoadHours=None, power=None, **kwargs): - - super().__init__(**kwargs) - - if prodType is not None: - self.prodType = prodType - - if operationalHours is not None: - self.operationalHours = operationalHours - - if fullLoadHours is not None: - self.fullLoadHours = fullLoadHours - - if power is not None: - self.power = power - - -@abstract -class Consumer(EnergyAsset): - """An abstract class that describes EnergyAssets that can consume energy. It is one of the 5 capabilities in ESDL""" - consType = EAttribute(eType=ConsTypeEnum, derived=False, changeable=True, - default_value=ConsTypeEnum.PRIMARY) - power = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, consType=None, power=None, **kwargs): - - super().__init__(**kwargs) - - if consType is not None: - self.consType = consType - - if power is not None: - self.power = power - - -@abstract -class Storage(EnergyAsset): - """An abstract class that describes EnergyAssets that can store energy. It is one of the 5 capabilities in ESDL""" - capacity = EAttribute(eType=EDouble, derived=False, changeable=True) - chargeEfficiency = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - dischargeEfficiency = EAttribute(eType=EDouble, derived=False, - changeable=True, default_value=0.0) - selfDischargeRate = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - fillLevel = EAttribute(eType=EDouble, derived=False, changeable=True) - maxChargeRate = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - maxDischargeRate = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - profile = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, capacity=None, chargeEfficiency=None, profile=None, dischargeEfficiency=None, selfDischargeRate=None, fillLevel=None, maxChargeRate=None, maxDischargeRate=None, **kwargs): - - super().__init__(**kwargs) - - if capacity is not None: - self.capacity = capacity - - if chargeEfficiency is not None: - self.chargeEfficiency = chargeEfficiency - - if dischargeEfficiency is not None: - self.dischargeEfficiency = dischargeEfficiency - - if selfDischargeRate is not None: - self.selfDischargeRate = selfDischargeRate - - if fillLevel is not None: - self.fillLevel = fillLevel - - if maxChargeRate is not None: - self.maxChargeRate = maxChargeRate - - if maxDischargeRate is not None: - self.maxDischargeRate = maxDischargeRate - - if profile is not None: - self.profile = profile - - -@abstract -class Conversion(EnergyAsset): - """An abstract class that describes EnergyAssets that can convert one energy carrier into another. It is one of the 5 capabilities in ESDL""" - efficiency = EAttribute(eType=EDouble, derived=False, changeable=True) - operationalHours = EAttribute(eType=EInt, derived=False, changeable=True) - fullLoadHours = EAttribute(eType=EInt, derived=False, changeable=True) - power = EAttribute(eType=EDouble, derived=False, changeable=True) - residualHeatSourcePotential = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, efficiency=None, operationalHours=None, fullLoadHours=None, power=None, residualHeatSourcePotential=None, **kwargs): - - super().__init__(**kwargs) - - if efficiency is not None: - self.efficiency = efficiency - - if operationalHours is not None: - self.operationalHours = operationalHours - - if fullLoadHours is not None: - self.fullLoadHours = fullLoadHours - - if power is not None: - self.power = power - - if residualHeatSourcePotential is not None: - self.residualHeatSourcePotential = residualHeatSourcePotential - - -@abstract -class Transport(EnergyAsset): - """An abstract class that describes EnergyAssets that can transport energy. It is one of the 5 capabilities in ESDL""" - capacity = EAttribute(eType=EDouble, derived=False, changeable=True) - efficiency = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, capacity=None, efficiency=None, **kwargs): - - super().__init__(**kwargs) - - if capacity is not None: - self.capacity = capacity - - if efficiency is not None: - self.efficiency = efficiency - - -@abstract -class GenericBuilding(AbstractBuilding): - """Represents a physical building""" - buildingYear = EAttribute(eType=EInt, derived=False, changeable=True) - type = EAttribute(eType=BuildingTypeEnum, derived=False, changeable=True, - upper=-1, default_value=BuildingTypeEnum.UNDEFINED) - floorArea = EAttribute(eType=EDouble, derived=False, changeable=True) - numberOfFloors = EAttribute(eType=EInt, derived=False, changeable=True) - energyLabel = EAttribute(eType=EnergyLabelEnum, derived=False, - changeable=True, default_value=EnergyLabelEnum.UNDEFINED) - energyIndex = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - address = EReference(ordered=True, unique=True, containment=True) - buildinginformation = EReference(ordered=True, unique=True, containment=True, upper=-1) - - def __init__(self, *, buildingYear=None, type=None, floorArea=None, numberOfFloors=None, address=None, buildinginformation=None, energyLabel=None, energyIndex=None, **kwargs): - - super().__init__(**kwargs) - - if buildingYear is not None: - self.buildingYear = buildingYear - - if type: - self.type.extend(type) - - if floorArea is not None: - self.floorArea = floorArea - - if numberOfFloors is not None: - self.numberOfFloors = numberOfFloors - - if energyLabel is not None: - self.energyLabel = energyLabel - - if energyIndex is not None: - self.energyIndex = energyIndex - - if address is not None: - self.address = address - - if buildinginformation: - self.buildinginformation.extend(buildinginformation) - - -class GeothermalPotential(AbstractGTPotential): - """Defines the geothermal potential in a specific area. This type focusses on temperature and depth of the well. See GeothermalEnergyPotental for class focussing on Energy""" - temperature = EAttribute(eType=EInt, derived=False, changeable=True) - depth = EAttribute(eType=EInt, derived=False, changeable=True) - potential = EAttribute(eType=GeothermalPotentialEnum, derived=False, changeable=True) - powerPerDoublet = EAttribute(eType=GeothermalPowerEnum, derived=False, - changeable=True, default_value=GeothermalPowerEnum.UNKNOWN) - - def __init__(self, *, temperature=None, depth=None, potential=None, powerPerDoublet=None, **kwargs): - - super().__init__(**kwargs) - - if temperature is not None: - self.temperature = temperature - - if depth is not None: - self.depth = depth - - if potential is not None: - self.potential = potential - - if powerPerDoublet is not None: - self.powerPerDoublet = powerPerDoublet - - -class DemandResponseService(EnergyService): - """Indicates a service supporting demand response in the energy system""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class AggregatorService(EnergyService): - """Indicates a aggregator service exploiting flexibility in the energy system""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class AggregatedBuilding(AbstractBuilding): - """Represents more than one building aggregated into one entity. It supports different types of aggregation, such as building type, energy label etc.""" - numberOfBuildings = EAttribute(eType=EInt, derived=False, changeable=True) - floorArea = EAttribute(eType=EDouble, derived=False, changeable=True) - aggregationOf = EReference(ordered=True, unique=True, containment=False, upper=-1) - energyLabelDistribution = EReference(ordered=True, unique=True, containment=True) - buildingYearDistribution = EReference(ordered=True, unique=True, containment=True) - buildingTypeDistribution = EReference(ordered=True, unique=True, containment=True) - residentialBuildingTypeDistribution = EReference(ordered=True, unique=True, containment=True) - ownershipRentalTypeDistribution = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, aggregationOf=None, numberOfBuildings=None, energyLabelDistribution=None, buildingYearDistribution=None, buildingTypeDistribution=None, residentialBuildingTypeDistribution=None, ownershipRentalTypeDistribution=None, floorArea=None, **kwargs): - - super().__init__(**kwargs) - - if numberOfBuildings is not None: - self.numberOfBuildings = numberOfBuildings - - if floorArea is not None: - self.floorArea = floorArea - - if aggregationOf: - self.aggregationOf.extend(aggregationOf) - - if energyLabelDistribution is not None: - self.energyLabelDistribution = energyLabelDistribution - - if buildingYearDistribution is not None: - self.buildingYearDistribution = buildingYearDistribution - - if buildingTypeDistribution is not None: - self.buildingTypeDistribution = buildingTypeDistribution - - if residentialBuildingTypeDistribution is not None: - self.residentialBuildingTypeDistribution = residentialBuildingTypeDistribution - - if ownershipRentalTypeDistribution is not None: - self.ownershipRentalTypeDistribution = ownershipRentalTypeDistribution - - -class InfluxDBProfile(DatabaseProfile): - """Describes a profile based on a measurement and field as part of an InfluxDB timeseries query""" - measurement = EAttribute(eType=EString, derived=False, changeable=True) - field = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, measurement=None, field=None, **kwargs): - - super().__init__(**kwargs) - - if measurement is not None: - self.measurement = measurement - - if field is not None: - self.field = field - - -@abstract -class ControlStrategy(EnergyService): - """Defines a control strategy for a specific asset""" - energyAsset = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, energyAsset=None, **kwargs): - - super().__init__(**kwargs) - - if energyAsset is not None: - self.energyAsset = energyAsset - - -class EnergyMarket(EnergyService): - """Defines an EnergyMarket of the energy system. A market is defined by specifying the assets that participate in this market.""" - asset = EReference(ordered=True, unique=True, containment=False, upper=-1) - carrier = EReference(ordered=True, unique=True, containment=False) - parameters = EReference(ordered=True, unique=True, containment=True, upper=-1) - marketPrice = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, asset=None, carrier=None, parameters=None, marketPrice=None, **kwargs): - - super().__init__(**kwargs) - - if asset: - self.asset.extend(asset) - - if carrier is not None: - self.carrier = carrier - - if parameters: - self.parameters.extend(parameters) - - if marketPrice is not None: - self.marketPrice = marketPrice - - -class GeothermalEnergyPotential(AbstractGTPotential): - """Defines the geothermal potential in a specific area. This type focusses on energy and depth of the well. See GeothermalPotental for class focussing on temperature""" - depth = EAttribute(eType=EInt, derived=False, changeable=True) - value = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, depth=None, value=None, **kwargs): - - super().__init__(**kwargs) - - if depth is not None: - self.depth = depth - - if value is not None: - self.value = value - - -class Battery(Storage): - """A battery can store electrical energy. This is a Storage capability""" - maxChargeDischargeCycles = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, maxChargeDischargeCycles=None, **kwargs): - - super().__init__(**kwargs) - - if maxChargeDischargeCycles is not None: - self.maxChargeDischargeCycles = maxChargeDischargeCycles - - -class AggregatedConsumer(Consumer): - """Represents an aggregation of multiple consumers as one aggregated consumer. It allows you to reference the consumers it is aggregated of by using the aggregationOf reference. Can be used to aggregate a heterogeneous collection of consumers (e.g. of different types)""" - aggregationOf = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, aggregationOf=None, **kwargs): - - super().__init__(**kwargs) - - if aggregationOf: - self.aggregationOf.extend(aggregationOf) - - -class BuildingUnit(GenericBuilding): - """Describes a physical part of a building. In dutch 'verblijfsobject' in the BAG national building and address registry. This can be used e.g. to model appartments in appartment complexes""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class AggregatedProducer(Producer): - """Represents an aggregation of multiple producers as one aggregated producer. It allows you to reference the producers it is aggregated of by using the aggregationOf reference. Can be used to aggregate a heterogeneous collection of producers (e.g. of different types)""" - aggregationOf = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, aggregationOf=None, **kwargs): - - super().__init__(**kwargs) - - if aggregationOf: - self.aggregationOf.extend(aggregationOf) - - -class GenericConsumer(Consumer): - """Generic consumer class that can be used in cases that the actual asset type is not important or not supported yet in ESDL""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class GenericProducer(Producer): - """Generic producer class that can be used in cases that the actual asset type is not important or not supported yet in ESDL""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class GenericStorage(Storage): - """Generic storage class that can be used in cases that the actual asset type is not important or not supported yet in ESDL""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class GenericTransport(Transport): - """Generic transport class that can be used in cases that the actual asset type is not important or not supported yet in ESDL""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class GenericConversion(Conversion): - """Generic conversion class that can be used in cases that the actual asset type is not important or not supported yet in ESDL""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class AggregatedTransport(Transport): - """Represents an aggregation of multiple transport assets as one aggregated transport asset. It allows you to reference the transport asset it is aggregated of by using the aggregationOf reference. Can be used to aggregate a heterogeneous collection of transport assets (e.g. of different types)""" - aggregationOf = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, aggregationOf=None, **kwargs): - - super().__init__(**kwargs) - - if aggregationOf: - self.aggregationOf.extend(aggregationOf) - - -class AggregatedConversion(Conversion): - """Represents an aggregation of multiple conversion assets as one aggregated conversion asset. It allows you to reference the conversion asset it is aggregated of by using the aggregationOf reference. Can be used to aggregate a heterogeneous collection of conversion assets (e.g. of different types)""" - aggregationOf = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, aggregationOf=None, **kwargs): - - super().__init__(**kwargs) - - if aggregationOf: - self.aggregationOf.extend(aggregationOf) - - -class AggregatedStorage(Storage): - """Represents an aggregation of multiple storage assets as one aggregated storage asset. It allows you to reference the storage asset it is aggregated of by using the aggregationOf reference. Can be used to aggregate a heterogeneous collection of storage assets (e.g. of different types)""" - aggregationOf = EReference(ordered=True, unique=True, containment=False, upper=-1) - - def __init__(self, *, aggregationOf=None, **kwargs): - - super().__init__(**kwargs) - - if aggregationOf: - self.aggregationOf.extend(aggregationOf) - - -class HeatStorage(Storage): - """Generic heat storage asset with min and max temperatures""" - minStorageTemperature = EAttribute(eType=EDouble, derived=False, changeable=True) - maxStorageTemperature = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, minStorageTemperature=None, maxStorageTemperature=None, **kwargs): - - super().__init__(**kwargs) - - if minStorageTemperature is not None: - self.minStorageTemperature = minStorageTemperature - - if maxStorageTemperature is not None: - self.maxStorageTemperature = maxStorageTemperature - - -class GasHeater(Conversion): - """Converts gas to heat, e.g. a gas boiler or gas heater""" - minimumBurnRate = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - type = EAttribute(eType=GasHeaterTypeEnum, derived=False, changeable=True) - - def __init__(self, *, minimumBurnRate=None, type=None, **kwargs): - - super().__init__(**kwargs) - - if minimumBurnRate is not None: - self.minimumBurnRate = minimumBurnRate - - if type is not None: - self.type = type - - -class Import(Producer): - """Represents a source that delivers imported energy into the current energy system. Used to model the rest of the energy system that is out of the current scope""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Export(Consumer): - """Represents a consumer that consumes exported energy from the current energy system. Used to model the rest of the energy system that is out of the current scope""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class CoGeneration(Conversion): - """Abstract asset describing a co-generation plant that produces heat and electricity""" - heatEfficiency = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - electricalEfficiency = EAttribute(eType=EDouble, derived=False, - changeable=True, default_value=0.0) - HERatio = EAttribute(eType=EDouble, derived=False, changeable=True) - fuelType = EAttribute(eType=PowerPlantFuelEnum, derived=False, changeable=True) - leadCommodity = EAttribute(eType=CommodityEnum, derived=False, changeable=True) - energyCarrier = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, heatEfficiency=None, electricalEfficiency=None, energyCarrier=None, HERatio=None, fuelType=None, leadCommodity=None, **kwargs): - - super().__init__(**kwargs) - - if heatEfficiency is not None: - self.heatEfficiency = heatEfficiency - - if electricalEfficiency is not None: - self.electricalEfficiency = electricalEfficiency - - if HERatio is not None: - self.HERatio = HERatio - - if fuelType is not None: - self.fuelType = fuelType - - if leadCommodity is not None: - self.leadCommodity = leadCommodity - - if energyCarrier is not None: - self.energyCarrier = energyCarrier - - -class HeatPump(Conversion): - """Describes a Heat Pump""" - source = EAttribute(eType=SourceTypeEnum, derived=False, changeable=True) - stages = EAttribute(eType=EInt, derived=False, changeable=True, default_value=1) - COP = EAttribute(eType=EDouble, derived=False, changeable=True) - additionalHeatingSourceType = EAttribute( - eType=AdditionalHeatingSourceTypeEnum, derived=False, changeable=True) - - def __init__(self, *, source=None, stages=None, COP=None, additionalHeatingSourceType=None, **kwargs): - - super().__init__(**kwargs) - - if source is not None: - self.source = source - - if stages is not None: - self.stages = stages - - if COP is not None: - self.COP = COP - - if additionalHeatingSourceType is not None: - self.additionalHeatingSourceType = additionalHeatingSourceType - - -class HeatingDemand(Consumer): - """Describes the heating demand of e.g. a household, area, etc.""" - type = EAttribute(eType=HeatDemandTypeEnum, derived=False, changeable=True) - deviceType = EAttribute(eType=HeatRadiationDeviceTypeEnum, derived=False, changeable=True) - minTemperature = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - maxTemperature = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, type=None, deviceType=None, minTemperature=None, maxTemperature=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if deviceType is not None: - self.deviceType = deviceType - - if minTemperature is not None: - self.minTemperature = minTemperature - - if maxTemperature is not None: - self.maxTemperature = maxTemperature - - -class ElectricityDemand(Consumer): - """Describes the electricity demand of e.g. a household, area, etc.""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class GasDemand(Consumer): - """Describes the gas demand of e.g. a household, area, etc. This can be used for all types of gasses (e.g. CO2, Natural Gas, Hydrogen, etc.)""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class PowerPlant(Conversion): - """Defines an electricity generating plant""" - fuel = EAttribute(eType=PowerPlantFuelEnum, derived=False, changeable=True) - maxLoad = EAttribute(eType=EInt, derived=False, changeable=True) - minLoad = EAttribute(eType=EInt, derived=False, changeable=True) - effMaxLoad = EAttribute(eType=EDouble, derived=False, changeable=True) - effMinLoad = EAttribute(eType=EDouble, derived=False, changeable=True) - energyCarrier = EReference(ordered=True, unique=True, containment=False) - mustRun = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, fuel=None, maxLoad=None, minLoad=None, effMaxLoad=None, effMinLoad=None, energyCarrier=None, mustRun=None, **kwargs): - - super().__init__(**kwargs) - - if fuel is not None: - self.fuel = fuel - - if maxLoad is not None: - self.maxLoad = maxLoad - - if minLoad is not None: - self.minLoad = minLoad - - if effMaxLoad is not None: - self.effMaxLoad = effMaxLoad - - if effMinLoad is not None: - self.effMinLoad = effMinLoad - - if energyCarrier is not None: - self.energyCarrier = energyCarrier - - if mustRun is not None: - self.mustRun = mustRun - - -class EVChargingStation(Consumer): - """Represents a charging station for electrical vehicles. Both single private-owned car chargers and public charging spaces can be modelled by this class""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Losses(Consumer): - """Used to define losses explicitly (as a Consumer capability)""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class PowerToX(Conversion): - """Represents the ability to convert electricity to some other form of energy""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class CCS(Storage): - """Represents Carbon Capture and Storage""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class XToPower(Conversion): - """Represents the ability to convert some other form of energy to electricity""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class CoolingDemand(Consumer): - """Describes the cooling demand of e.g. a building""" - deviceType = EAttribute(eType=CoolingDeviceType, derived=False, changeable=True) - - def __init__(self, *, deviceType=None, **kwargs): - - super().__init__(**kwargs) - - if deviceType is not None: - self.deviceType = deviceType - - -class Airco(Conversion): - """Represents an air conditioning unit""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class EnergyDemand(Consumer): - """Allows to describe the total energy demand when differentiation between energy carriers is not possible or required, otherwise e.g. ElectricityDemand or HeatingDemand is an alternative""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class FermentationPlant(Conversion): - """Defines a plant fuelled by biomass""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class MobilityDemand(Consumer): - """Energy demand of the mobility sector. Allows to specify the vehicle types, fuel types and their efficiency and distance travelled""" - type = EAttribute(eType=VehicleTypeEnum, derived=False, changeable=True, upper=-1) - fuelType = EAttribute(eType=MobilityFuelTypeEnum, derived=False, changeable=True) - distance = EAttribute(eType=EInt, derived=False, changeable=True) - efficiency = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, type=None, fuelType=None, distance=None, efficiency=None, **kwargs): - - super().__init__(**kwargs) - - if type: - self.type.extend(type) - - if fuelType is not None: - self.fuelType = fuelType - - if distance is not None: - self.distance = distance - - if efficiency is not None: - self.efficiency = efficiency - - -class GasStorage(Storage): - """Defines a gas storage asset, see also CCS""" - minStoragePressure = EAttribute(eType=EDouble, derived=False, changeable=True) - maxStoragePressure = EAttribute(eType=EDouble, derived=False, - changeable=True, default_value=0.0) - - def __init__(self, *, minStoragePressure=None, maxStoragePressure=None, **kwargs): - - super().__init__(**kwargs) - - if minStoragePressure is not None: - self.minStoragePressure = minStoragePressure - - if maxStoragePressure is not None: - self.maxStoragePressure = maxStoragePressure - - -class DrivenByDemand(ControlStrategy): - """Control strategy specifying that an asset is driven by the demand of one of the output ports""" - outPort = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, outPort=None, **kwargs): - - super().__init__(**kwargs) - - if outPort is not None: - self.outPort = outPort - - -class GasConversion(Conversion): - """Defines an asset that can convert gas into another form of gas. E.g. SMR or ATR.""" - type = EAttribute(eType=GasConversionTypeEnum, derived=False, changeable=True) - outputPressure = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, type=None, outputPressure=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if outputPressure is not None: - self.outputPressure = outputPressure - - -class DrivenBySupply(ControlStrategy): - """Control strategy specifying that an asset is driven by the supply of one of the input ports (used in ESDL-based simulation tools)""" - inPort = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, inPort=None, **kwargs): - - super().__init__(**kwargs) - - if inPort is not None: - self.inPort = inPort - - -class DrivenByProfile(ControlStrategy): - """Control strategy specifying that an asset is driven by a profile specified in one of the ports (used in ESDL-based simulation tools)""" - profile = EReference(ordered=True, unique=True, containment=True) - port = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, profile=None, port=None, **kwargs): - - super().__init__(**kwargs) - - if profile is not None: - self.profile = profile - - if port is not None: - self.port = port - - -class EnergyNetwork(Transport): - """Defines an energy network. Used for national energy balances, when the specific energy carrier is not required""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class AbstractConductor(Transport): - """Abstract class to describe conductors such as cables and pipes and joining them using a joint""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class AbstractSwitch(Transport): - """Abstract class to describe switches such as valve and a circuit breaker""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class AbstractTransformer(Transport): - """Abstract class to describe transformers, such as Heat exchangers, transformers and pumps""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -@abstract -class AbstractConnection(Transport): - """Abstract class to describe connections of a building to a grid. E.g. a heat connection, gas connection and electricity connection""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class RoomHeater(Conversion): - """Defines an asset for heating rooms, such as infra red panels, gas stove, etc.""" - type = EAttribute(eType=RoomHeaterTypeEnum, derived=False, changeable=True) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - -class BiomassHeater(Conversion): - """Converts biomass into heat and/or electricity""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class StorageStrategy(ControlStrategy): - """Control strategy specifying that a storage asset is driven by two profiles specifying the marginal cost to define its charging and discharging behavior (used in ESDL-based simulation tools)""" - marginalChargeCosts = EReference(ordered=True, unique=True, containment=True) - marginalDischargeCosts = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, marginalChargeCosts=None, marginalDischargeCosts=None, **kwargs): - - super().__init__(**kwargs) - - if marginalChargeCosts is not None: - self.marginalChargeCosts = marginalChargeCosts - - if marginalDischargeCosts is not None: - self.marginalDischargeCosts = marginalDischargeCosts - - -class CurtailmentStrategy(ControlStrategy): - """Control strategy that specifies a max power at which the production is curtailed""" - maxPower = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, maxPower=None, **kwargs): - - super().__init__(**kwargs) - - if maxPower is not None: - self.maxPower = maxPower - - -class PVTInstallation(Producer): - """Defines an installation that combines PV and thermal energy collection""" - type = EAttribute(eType=SolarCollectorTypeEnum, derived=False, changeable=True, - default_value=SolarCollectorTypeEnum.UNDEFINED) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - -@abstract -class AbstractSensor(Transport): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class PIDController(ControlStrategy): - """Control strategy specifying that an asset is driven by a PID controller (used in ESDL-based simulation tools)""" - Kp = EAttribute(eType=EDouble, derived=False, changeable=True) - Ki = EAttribute(eType=EDouble, derived=False, changeable=True) - Kd = EAttribute(eType=EDouble, derived=False, changeable=True) - sensor = EReference(ordered=True, unique=True, containment=False) - setPoint = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, Kp=None, Ki=None, Kd=None, sensor=None, setPoint=None, **kwargs): - - super().__init__(**kwargs) - - if Kp is not None: - self.Kp = Kp - - if Ki is not None: - self.Ki = Ki - - if Kd is not None: - self.Kd = Kd - - if sensor is not None: - self.sensor = sensor - - if setPoint is not None: - self.setPoint = setPoint - - -class SinkConsumer(Consumer): - """(Deprecated, will be removed in future ESDL versions) Represents a consumer that consumes exported energy from the current energy system. Used to model the rest of the energy system that is out of the current scope""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class SourceProducer(Producer): - """(Deprecated, will be removed in future ESDL versions) Represents a source that delivers imported energy into the current energy system. Used to model the rest of the energy system that is out of the current scope""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Building(GenericBuilding): - """Represents a physical building""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class AirVessel(Transport): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class ElectricityProducer(Producer): - """Describes a (generic) electricity producing asset""" - minPower = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, minPower=None, **kwargs): - - super().__init__(**kwargs) - - if minPower is not None: - self.minPower = minPower - - -class HeatProducer(Producer): - """Describes a (generic) heat producing asset""" - minTemperature = EAttribute(eType=EDouble, derived=False, changeable=True) - maxTemperature = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, minTemperature=None, maxTemperature=None, **kwargs): - - super().__init__(**kwargs) - - if minTemperature is not None: - self.minTemperature = minTemperature - - if maxTemperature is not None: - self.maxTemperature = maxTemperature - - -class GasProducer(Producer): - """Describes a (generic) gas producing asset""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class WindTurbine(ElectricityProducer): - """Describes an individual wind turbine. A wind turbine is a producer capability""" - rotorDiameter = EAttribute(eType=EDouble, derived=False, changeable=True) - height = EAttribute(eType=EDouble, derived=False, changeable=True) - type = EAttribute(eType=WindTurbineTypeEnum, derived=False, changeable=True) - - def __init__(self, *, rotorDiameter=None, height=None, type=None, **kwargs): - - super().__init__(**kwargs) - - if rotorDiameter is not None: - self.rotorDiameter = rotorDiameter - - if height is not None: - self.height = height - - if type is not None: - self.type = type - - -class PVPanel(ElectricityProducer): - """Describes an individual PV panel. See PVInstallation for multiple PV panels. This is a Producer capability""" - panelEfficiency = EAttribute(eType=EDouble, derived=False, changeable=True) - inverterEfficiency = EAttribute(eType=EDouble, derived=False, changeable=True) - angle = EAttribute(eType=EInt, derived=False, changeable=True) - orientation = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, panelEfficiency=None, inverterEfficiency=None, angle=None, orientation=None, **kwargs): - - super().__init__(**kwargs) - - if panelEfficiency is not None: - self.panelEfficiency = panelEfficiency - - if inverterEfficiency is not None: - self.inverterEfficiency = inverterEfficiency - - if angle is not None: - self.angle = angle - - if orientation is not None: - self.orientation = orientation - - -class ElectricityNetwork(EnergyNetwork): - """Describes an complete Electricty network, without detailing the complete topology. It is a Transport capability""" - voltage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, voltage=None, **kwargs): - - super().__init__(**kwargs) - - if voltage is not None: - self.voltage = voltage - - -class ElectricityCable(AbstractConductor): - """Describes a representation of an electricity cable. When defining the geometry of a cable by means of a line, the first point of the line refers to the first port and the last point of the line refers to the second port.""" - length = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, length=None, **kwargs): - - super().__init__(**kwargs) - - if length is not None: - self.length = length - - -class HeatNetwork(EnergyNetwork): - """Describes an complete heat network, without detailing the complete topology. It is a Transport capability""" - temperature = EAttribute(eType=EDouble, derived=False, changeable=True) - temperatureMin = EAttribute(eType=EDouble, derived=False, changeable=True) - temperatureMax = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, temperature=None, temperatureMin=None, temperatureMax=None, **kwargs): - - super().__init__(**kwargs) - - if temperature is not None: - self.temperature = temperature - - if temperatureMin is not None: - self.temperatureMin = temperatureMin - - if temperatureMax is not None: - self.temperatureMax = temperatureMax - - -class GasNetwork(EnergyNetwork): - """Describes an complete gas network, without detailing the complete topology. It is a Transport capability""" - pressure = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, pressure=None, **kwargs): - - super().__init__(**kwargs) - - if pressure is not None: - self.pressure = pressure - - -class Pipe(AbstractConductor): - """Represents a pipe to transport gasses or fluids. When defining the geometry of a pipe by means of a line, the first point of the line refers to the first port and the last point of the line refers to the second port.""" - innerDiameter = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - outerDiameter = EAttribute(eType=EDouble, derived=False, changeable=True) - length = EAttribute(eType=EDouble, derived=False, changeable=True) - roughness = EAttribute(eType=EDouble, derived=False, changeable=True) - diameter = EAttribute(eType=PipeDiameterEnum, derived=False, changeable=True) - - def __init__(self, *, innerDiameter=None, outerDiameter=None, length=None, roughness=None, diameter=None, **kwargs): - - super().__init__(**kwargs) - - if innerDiameter is not None: - self.innerDiameter = innerDiameter - - if outerDiameter is not None: - self.outerDiameter = outerDiameter - - if length is not None: - self.length = length - - if roughness is not None: - self.roughness = roughness - - if diameter is not None: - self.diameter = diameter - - -class GeothermalSource(HeatProducer): - """Geothermal source including the installation that connects the source to the network""" - wellDepth = EAttribute(eType=EDouble, derived=False, changeable=True) - geothermalSourceType = EAttribute(eType=GeothermalSourceTypeEnum, - derived=False, changeable=True) - COP = EAttribute(eType=EDouble, derived=False, changeable=True) - aquiferTemperature = EAttribute(eType=EDouble, derived=False, changeable=True) - flowRate = EAttribute(eType=EDouble, derived=False, changeable=True) - pumpPower = EAttribute(eType=EDouble, derived=False, changeable=True) - geothermalPotential = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, wellDepth=None, geothermalSourceType=None, COP=None, aquiferTemperature=None, flowRate=None, pumpPower=None, geothermalPotential=None, **kwargs): - - super().__init__(**kwargs) - - if wellDepth is not None: - self.wellDepth = wellDepth - - if geothermalSourceType is not None: - self.geothermalSourceType = geothermalSourceType - - if COP is not None: - self.COP = COP - - if aquiferTemperature is not None: - self.aquiferTemperature = aquiferTemperature - - if flowRate is not None: - self.flowRate = flowRate - - if pumpPower is not None: - self.pumpPower = pumpPower - - if geothermalPotential is not None: - self.geothermalPotential = geothermalPotential - - -class Transformer(AbstractTransformer): - """Electrical transformer between different voltage levels""" - voltagePrimary = EAttribute(eType=EDouble, derived=False, changeable=True) - voltageSecundary = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, voltagePrimary=None, voltageSecundary=None, **kwargs): - - super().__init__(**kwargs) - - if voltagePrimary is not None: - self.voltagePrimary = voltagePrimary - - if voltageSecundary is not None: - self.voltageSecundary = voltageSecundary - - -class HeatExchange(AbstractTransformer): - """Exchange heat between two circuits""" - heatTransferCoefficient = EAttribute(eType=EDouble, derived=False, changeable=True) - lengthPrimarySide = EAttribute(eType=EDouble, derived=False, changeable=True) - diameterPrimarySide = EAttribute(eType=EDouble, derived=False, changeable=True) - roughnessPrimarySide = EAttribute(eType=EDouble, derived=False, changeable=True) - lengthSecundarySide = EAttribute(eType=EDouble, derived=False, - changeable=True, default_value=0.0) - diameterSecundarySide = EAttribute( - eType=EDouble, derived=False, changeable=True, default_value=0.0) - roughnessSecundarySide = EAttribute( - eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, heatTransferCoefficient=None, lengthPrimarySide=None, diameterPrimarySide=None, roughnessPrimarySide=None, lengthSecundarySide=None, diameterSecundarySide=None, roughnessSecundarySide=None, **kwargs): - - super().__init__(**kwargs) - - if heatTransferCoefficient is not None: - self.heatTransferCoefficient = heatTransferCoefficient - - if lengthPrimarySide is not None: - self.lengthPrimarySide = lengthPrimarySide - - if diameterPrimarySide is not None: - self.diameterPrimarySide = diameterPrimarySide - - if roughnessPrimarySide is not None: - self.roughnessPrimarySide = roughnessPrimarySide - - if lengthSecundarySide is not None: - self.lengthSecundarySide = lengthSecundarySide - - if diameterSecundarySide is not None: - self.diameterSecundarySide = diameterSecundarySide - - if roughnessSecundarySide is not None: - self.roughnessSecundarySide = roughnessSecundarySide - - -class EConnection(AbstractConnection): - """Electricity connection of a building. Defines the demarcation between the inhouse network and the electricity grid (location where the (smart) meter is located)""" - EANCode = EAttribute(eType=EString, derived=False, changeable=True) - - def __init__(self, *, EANCode=None, **kwargs): - - super().__init__(**kwargs) - - if EANCode is not None: - self.EANCode = EANCode - - -class HConnection(AbstractConnection): - """Heat connection of a building. Defines the demarcation between the inhouse network and the heat grid (location where the (smart) meter is located)""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class GConnection(AbstractConnection): - """Gas connection of a building. Defines the demarcation between the inhouse network and the gas grid (location where the (smart) meter is located)""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class FuelCell(CoGeneration): - """Defines a Fuel Cell""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Pump(AbstractTransformer): - """Defines a pump, e.g. in a water or heat network""" - pumpCapacity = EAttribute(eType=EDouble, derived=False, changeable=True) - pumpEfficiency = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - polarMomentOfInertia = EAttribute(eType=EDouble, derived=False, changeable=True) - ratedSpeed = EAttribute(eType=EDouble, derived=False, changeable=True) - pumpCurveTable = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, pumpCapacity=None, pumpEfficiency=None, polarMomentOfInertia=None, ratedSpeed=None, pumpCurveTable=None, **kwargs): - - super().__init__(**kwargs) - - if pumpCapacity is not None: - self.pumpCapacity = pumpCapacity - - if pumpEfficiency is not None: - self.pumpEfficiency = pumpEfficiency - - if polarMomentOfInertia is not None: - self.polarMomentOfInertia = polarMomentOfInertia - - if ratedSpeed is not None: - self.ratedSpeed = ratedSpeed - - if pumpCurveTable is not None: - self.pumpCurveTable = pumpCurveTable - - -class CHP(CoGeneration): - """Describes a Combined Heat and Power installation""" - CHPType = EAttribute(eType=CHPTypeEnum, derived=False, changeable=True) - - def __init__(self, *, CHPType=None, **kwargs): - - super().__init__(**kwargs) - - if CHPType is not None: - self.CHPType = CHPType - - -class SolarCollector(HeatProducer): - """Defines a SolarCollector asset""" - type = EAttribute(eType=SolarCollectorTypeEnum, derived=False, changeable=True) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - -class ResidualHeatSource(HeatProducer): - """Defines a source of residual heat, e.g. a data center or factory""" - type = EAttribute(eType=ResidualHeatSourceTypeEnum, derived=False, changeable=True) - residualHeatSourcePotential = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, type=None, residualHeatSourcePotential=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if residualHeatSourcePotential is not None: - self.residualHeatSourcePotential = residualHeatSourcePotential - - -class Electrolyzer(PowerToX): - """Defines an electrolyzer that converts electricity into hydrogen""" - outputPressure = EAttribute(eType=EDouble, derived=False, changeable=True) - maxLoad = EAttribute(eType=EInt, derived=False, changeable=True) - minLoad = EAttribute(eType=EInt, derived=False, changeable=True) - effMaxLoad = EAttribute(eType=EDouble, derived=False, changeable=True) - effMinLoad = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, outputPressure=None, maxLoad=None, minLoad=None, effMaxLoad=None, effMinLoad=None, **kwargs): - - super().__init__(**kwargs) - - if outputPressure is not None: - self.outputPressure = outputPressure - - if maxLoad is not None: - self.maxLoad = maxLoad - - if minLoad is not None: - self.minLoad = minLoad - - if effMaxLoad is not None: - self.effMaxLoad = effMaxLoad - - if effMinLoad is not None: - self.effMinLoad = effMinLoad - - -class WaterToPower(ElectricityProducer): - """Defines an asset that uses water to produce electricity. E.g. hydro power, tidal power, wave power or osmotic power""" - type = EAttribute(eType=WaterToPowerTypeEnum, derived=False, changeable=True) - - def __init__(self, *, type=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - -class UTES(HeatStorage): - """Underground Thermal Energy Storage""" - type = EAttribute(eType=UTESTypeEnum, derived=False, changeable=True, - default_value=UTESTypeEnum.UNDEFINED) - UTESPotential = EReference(ordered=True, unique=True, containment=False) - - def __init__(self, *, type=None, UTESPotential=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if UTESPotential is not None: - self.UTESPotential = UTESPotential - - -class WaterBuffer(HeatStorage): - """Storage by means of storing energy in water, e.g. a tank.""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Joint(AbstractConductor): - """A Joint is a means to connect AbstractConductors, such as Pipes and ElectricalCables. This helps when these conductors have opposite Ports.""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Bus(AbstractConductor): - - voltage = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, voltage=None, **kwargs): - - super().__init__(**kwargs) - - if voltage is not None: - self.voltage = voltage - - -class Sensor(AbstractSensor): - - quantityAndUnit = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, quantityAndUnit=None, **kwargs): - - super().__init__(**kwargs) - - if quantityAndUnit is not None: - self.quantityAndUnit = quantityAndUnit - - -class Compressor(AbstractTransformer): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class PressureReducingValve(AbstractTransformer): - - valveCoefficient = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, valveCoefficient=None, **kwargs): - - super().__init__(**kwargs) - - if valveCoefficient is not None: - self.valveCoefficient = valveCoefficient - - -@abstract -class AbstractActiveSwitch(AbstractSwitch): - - position = EAttribute(eType=EDouble, derived=False, changeable=True) - - def __init__(self, *, position=None, **kwargs): - - super().__init__(**kwargs) - - if position is not None: - self.position = position - - -@abstract -class AbstractPassiveSwitch(AbstractSwitch): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Valve(AbstractActiveSwitch): - """Defines a valve, e.g. in a water, gas or heat network""" - type = EAttribute(eType=ValveTypeEnum, derived=False, changeable=True) - innerDiameter = EAttribute(eType=EDouble, derived=False, changeable=True) - flowCoefficient = EReference(ordered=True, unique=True, containment=True) - - def __init__(self, *, type=None, innerDiameter=None, flowCoefficient=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if innerDiameter is not None: - self.innerDiameter = innerDiameter - - if flowCoefficient is not None: - self.flowCoefficient = flowCoefficient - - -class PVInstallation(PVPanel): - """Defines a Photo Voltaic Installation, e.g. roof top PV, a PV field or parc.""" - type = EAttribute(eType=PVInstallationTypeEnum, derived=False, changeable=True) - numberOfPanels = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, type=None, numberOfPanels=None, **kwargs): - - super().__init__(**kwargs) - - if type is not None: - self.type = type - - if numberOfPanels is not None: - self.numberOfPanels = numberOfPanels - - -class CircuitBreaker(AbstractPassiveSwitch): - """Defines a circuit breaker in electric transmission or distribution grids""" - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class Switch(AbstractActiveSwitch): - - def __init__(self, **kwargs): - - super().__init__(**kwargs) - - -class PVPark(PVPanel): - """Defines a PV park of multiple panels""" - numberOfPanels = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, numberOfPanels=None, **kwargs): - - super().__init__(**kwargs) - - if numberOfPanels is not None: - self.numberOfPanels = numberOfPanels - - -class WindPark(WindTurbine): - """Defines a wind park of multiple turbines""" - numberOfTurbines = EAttribute(eType=EInt, derived=False, changeable=True) - - def __init__(self, *, numberOfTurbines=None, **kwargs): - - super().__init__(**kwargs) - - if numberOfTurbines is not None: - self.numberOfTurbines = numberOfTurbines - - -class CheckValve(AbstractPassiveSwitch): - - innerDiameter = EAttribute(eType=EDouble, derived=False, changeable=True) - reopenDeltaP = EAttribute(eType=EDouble, derived=False, changeable=True) - flowCoefficient = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0) - - def __init__(self, *, innerDiameter=None, reopenDeltaP=None, flowCoefficient=None, **kwargs): - - super().__init__(**kwargs) - - if innerDiameter is not None: - self.innerDiameter = innerDiameter - - if reopenDeltaP is not None: - self.reopenDeltaP = reopenDeltaP - - if flowCoefficient is not None: - self.flowCoefficient = flowCoefficient diff --git a/esdlvalidator/core/esdl/esh.py b/esdlvalidator/core/esdl/esh.py deleted file mode 100644 index f575f37..0000000 --- a/esdlvalidator/core/esdl/esh.py +++ /dev/null @@ -1,98 +0,0 @@ -# This work is based on original code developed and copyrighted by TNO 2020. -# Subsequent contributions are licensed to you by the developers of such code and are -# made available to the Project under one or several contributor license agreements. -# -# This work is licensed to you under the Apache License, Version 2.0. -# You may obtain a copy of the license at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Contributors: -# TNO - Initial implementation -# Manager: -# TNO - -import uuid -import logging - -from io import BytesIO - -from pyecore.resources import ResourceSet, URI -from pyecore.resources import ResourceSet, URI -from pyecore.utils import alias - -from esdlvalidator.core.esdl.resources.xmlresource import XMLResource -from esdlvalidator.core.esdl import esdl - -log = logging.getLogger(__name__) - - -class EnergySystemHandler: - - def __init__(self): - self.rset = None - self.resource = None - self.energy_system = None - - self._new_resource_set() - - esdl.ProfileElement.from_.name = 'from' - setattr(esdl.ProfileElement, 'from', esdl.ProfileElement.from_) - alias('start', esdl.ProfileElement.from_) - - #esdl.FromToIntPerc.from_.name = 'from' - #setattr(esdl.FromToIntPerc, 'from', esdl.FromToIntPerc.from_) - #alias('start', esdl.FromToIntPerc.from_) - - #esdl.FromToDoublePerc.from_.name = 'from' - #setattr(esdl.FromToDoublePerc, 'from', esdl.FromToDoublePerc.from_) - #alias('start', esdl.FromToDoublePerc.from_) - - def _new_resource_set(self): - self.rset = ResourceSet() - self._set_resource_factories() - - def _set_resource_factories(self): - # Assign files with the .esdl extension to the XMLResource instead of default XMI - self.rset.resource_factory['esdl'] = XMLResource - self.rset.resource_factory['*'] = XMLResource - - def load_from_string(self, esdl_string, name='from_string'): - """Loads an energy system from a string and adds it to a *new* resourceSet - :returns the loaded EnergySystem """ - uri = StringURI(name + '.esdl', esdl_string) - self._new_resource_set() - self.resource = self.rset.create_resource(uri) - try: - self.resource.load() - self.energy_system = self.resource.contents[0] - return self.resource - except Exception as e: - log.error("Exception when loading resource: {}: {}".format(name, e)) - raise - - def get_energy_system(self): - return self.energy_system - - -class StringURI(URI): - def __init__(self, uri, text=None): - super(StringURI, self).__init__(uri) - if text is not None: - self.__stream = BytesIO(text.encode('UTF-8')) - - def getvalue(self): - readbytes = self.__stream.getvalue() - # somehow stringIO does not work, so we use BytesIO - string = readbytes.decode('UTF-8') - return string - - def create_instream(self): - return self.__stream - - def create_outstream(self): - self.__stream = BytesIO() - return self.__stream - - def get_stream(self): - return self.__stream diff --git a/esdlvalidator/core/esdl/resources/xmlresource.py b/esdlvalidator/core/esdl/resources/xmlresource.py deleted file mode 100644 index 572eb17..0000000 --- a/esdlvalidator/core/esdl/resources/xmlresource.py +++ /dev/null @@ -1,65 +0,0 @@ -# This work is based on original code developed and copyrighted by TNO 2020. -# Subsequent contributions are licensed to you by the developers of such code and are -# made available to the Project under one or several contributor license agreements. -# -# This work is licensed to you under the Apache License, Version 2.0. -# You may obtain a copy of the license at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Contributors: -# TNO - Initial implementation -# Manager: -# TNO - -from pyecore.resources.xmi import XMIResource, XMIOptions, XMI_URL, XSI_URL, XSI -from lxml.etree import QName, Element, ElementTree - -""" -Extension of pyecore's XMIResource to support the XMLResource in EMF. -It basically removes the xmi:version stuff from the serialization. -""" -class XMLResource(XMIResource): - def __init__(self, uri=None, use_uuid=False): - super().__init__(uri, use_uuid) - self._later = [] - self.prefixes = {} - self.reverse_nsmap = {} - - def save(self, output=None, options=None): - self.options = options or {} - output = self.open_out_stream(output) - self.prefixes.clear() - self.reverse_nsmap.clear() - - serialize_default = \ - self.options.get(XMIOptions.SERIALIZE_DEFAULT_VALUES, - False) - nsmap = {XSI: XSI_URL} # remove XMI for XML serialization - - if len(self.contents) == 1: - root = self.contents[0] - self.register_eobject_epackage(root) - tmp_xmi_root = self._go_across(root, serialize_default) - else: - # this case hasn't been verified for XML serialization - tag = QName(XMI_URL, 'XMI') - tmp_xmi_root = Element(tag) - for root in self.contents: - root_node = self._go_across(root, serialize_default) - tmp_xmi_root.append(root_node) - - # update nsmap with prefixes register during the nodes creation - nsmap.update(self.prefixes) - xmi_root = Element(tmp_xmi_root.tag, nsmap=nsmap) - xmi_root[:] = tmp_xmi_root[:] - xmi_root.attrib.update(tmp_xmi_root.attrib) - #xmi_version = etree.QName(XMI_URL, 'version') # remove XMI version in XML serialization - #xmi_root.attrib[xmi_version] = '2.0' - tree = ElementTree(xmi_root) - tree.write(output, - pretty_print=True, - xml_declaration=True, - encoding=tree.docinfo.encoding) - output.flush() - self.uri.close_stream() diff --git a/esdlvalidator/core/esdl/utils.py b/esdlvalidator/core/esdl/utils.py index 0e367d9..17571a5 100644 --- a/esdlvalidator/core/esdl/utils.py +++ b/esdlvalidator/core/esdl/utils.py @@ -2,8 +2,8 @@ from pathlib import Path -from esdlvalidator.core.esdl import esdl -from esdlvalidator.core.esdl.esh import EnergySystemHandler +import esdl +from esdl.esdl_handler import EnergySystemHandler from esdlvalidator.core.exceptions import InvalidESDL from esdlvalidator.validation.functions import utils diff --git a/esdlvalidator/validation/functions/tests/test_function_select.py b/esdlvalidator/validation/functions/tests/test_function_select.py index bdd06dc..650a417 100644 --- a/esdlvalidator/validation/functions/tests/test_function_select.py +++ b/esdlvalidator/validation/functions/tests/test_function_select.py @@ -3,7 +3,7 @@ import types from esdlvalidator.core.esdl import utils -from esdlvalidator.core.esdl.esh import EnergySystemHandler +from esdl.esdl_handler import EnergySystemHandler from esdlvalidator.validation.functions.function import FunctionFactory, FunctionType diff --git a/requirements.txt b/requirements.txt index 6a07d3d..101b201 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,4 +25,5 @@ aniso8601>=8.1.1 six>=1.15.0 jsonschema>=3.2.0 pyrsistent>=0.17.3 -pycodestyle>=2.6.0 \ No newline at end of file +pycodestyle>=2.6.0 +pyESDL>=21.9.1 \ No newline at end of file From 60a82bc00a012f41868a6c13bb57c07fb6cb14b8 Mon Sep 17 00:00:00 2001 From: Plug Date: Wed, 16 Mar 2022 11:45:59 +0100 Subject: [PATCH 03/12] Flask restx upgrade to fix '_endpoint_from_view_func' issue --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 101b201..e017f51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,8 @@ lxml>=4.6.2 numpy>=1.19.4 flask>=1.1.2 flask-cors==1.10.3 -flask-restx==0.2.0 +flask-restx==0.5.0 +Flask-RESTful>0.3.8 waitress>=1.4.4 tinydb>=4.3.0 autodiscover>=0.0.3 From a0bc00d3b813a99a5c3b7d70621ef1ce2d6372ca Mon Sep 17 00:00:00 2001 From: plugrbf Date: Wed, 30 Mar 2022 10:21:18 +0200 Subject: [PATCH 04/12] Added new check to resolve issue --- .../functions/check_connected_to.py | 35 ++ testdata/schema_chess.json | 312 +++++++++--------- 2 files changed, 191 insertions(+), 156 deletions(-) create mode 100644 esdlvalidator/validation/functions/check_connected_to.py diff --git a/esdlvalidator/validation/functions/check_connected_to.py b/esdlvalidator/validation/functions/check_connected_to.py new file mode 100644 index 0000000..b2dc476 --- /dev/null +++ b/esdlvalidator/validation/functions/check_connected_to.py @@ -0,0 +1,35 @@ +import json + +from esdlvalidator.validation.functions.function import FunctionFactory, FunctionCheck, FunctionDefinition, \ + ArgDefinition, FunctionType, CheckResult + + +@FunctionFactory.register(FunctionType.CHECK, "connected_to") +class ContainsConnectedTo(FunctionCheck): + + def get_function_definition(self): + return FunctionDefinition( + "connected_to", + "Check if an asset is connected to", + [ + ArgDefinition("assetType", "The type of asset to which selected asset must be connected to", True), + ArgDefinition("resultMsgJSON", "Display output in JSON format", False) + ] + ) + + def before_execute(self): + pass + + def execute(self): + msg = {"offending_asset": self.value.id} + for port in self.value.port: + for connected_port in port.connectedTo: + if connected_port.energyasset.__class__.__name__ not in self.args['assetType']: + result = "{} cannot be connected to {}".format(self.value.id, connected_port.energyasset.id) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) + + return CheckResult(True) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 5fdad36..95e6fac 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -1,157 +1,157 @@ -{ - "name": "CHESS validation schema", - "description": "CHESS validation schema contains checks for CHESS", - "validations": [ - { - "name": "pipe_connected_to_pipe", - "description": "Find if no Pipes are connected to other Pipes", - "type": "error", - "message": "Pipe connected to another pipe", - "selects": [ - { - "function": "get", - "alias": "pipes", - "args": { - "type": "Pipe" - } - } - ], - "check": { - "function": "not_connected_to", - "dataset": "pipes", - "args": { - "assetType": "Pipe", - "resultMsgJSON": true - } - } - }, - { - "name": "joint_connected_to_joint", - "description": "Find if no joints are connected to other Joints", - "type": "error", - "message": "Joint connected to another joint", - "selects": [ - { - "function": "get", - "alias": "joints", - "args": { - "type": "Joint" - } - } - ], - "check": { - "function": "not_connected_to", - "dataset": "joints", - "args": { - "assetType": "Joint", - "resultMsgJSON": true - } - } - }, - { - "name": "diameter_undefined", - "description": "Find if both innerDiameter and diameter are not defined", - "type": "error", - "message": "Diameter not defined", - "selects": [ - { - "function": "get", - "alias": "pipes", - "args": { - "type": "Pipe" - } - } - ], - "check": { - "function": "multi_cond", - "dataset": "pipes", - "args": { - "properties": [ - "diameter", - "innerDiameter" - ], - "violations": [ - "VALUE_SPECIFIED", - 0.0 - ], - "resultMsgJSON": true - } - } - }, - { - "name": "unconnected_port", - "description": "Find if any port is left unconnected", - "type": "warning", - "message": "Unconnected port", - "selects": [ - { - "function": "get", - "alias": "assets", - "args": { - "type": "EnergyAsset" - } - } - ], - "check": { - "function": "unconnected_port", - "dataset": "assets", - "args": { - "resultMsgJSON": true - } - } - }, - { - "name": "producer_power_undefined", - "description": "An asset of type producer must have a power attribute (asset.power)", - "type": "error", - "message": "Producer missing power", - "selects": [ - { - "function": "get", - "alias": "producers", - "args": { - "type": "Producer" - } - } - ], - "check": { - "function": "not_null", - "dataset": "producers", - "args": { - "property": "power", - "counts_as_null": [ - 0.0 - ], - "resultMsgJSON": true - } - } - }, - { - "name": "consumer_profile_undefined", - "description": "An asset of type consumer must have a profile defined", - "type": "error", - "message": "Consumer missing profile", - "selects": [ - { - "function": "get_references", - "alias": "consumerInPorts", - "args": { - "assetType": "Consumer", - "referenceType": "InPort" - } - } - ], - "check": { - "function": "not_null", - "dataset": "consumerInPorts", - "args": { - "property": "profile", - "counts_as_null": [ - "EOrderedSet()" - ], - "resultMsgJSON": true - } - } - } - ] +{ + "name": "CHESS validation schema", + "description": "CHESS validation schema contains checks for CHESS", + "validations": [ + { + "name": "pipe_connected_to_pipe", + "description": "Find if no Pipes are connected to other Pipes", + "type": "error", + "message": "Pipe connected to another pipe", + "selects": [ + { + "function": "get", + "alias": "pipes", + "args": { + "type": "Pipe" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "pipes", + "args": { + "assetType": "Pipe", + "resultMsgJSON": true + } + } + }, + { + "name": "joint_connected_to_non_transport_asset", + "description": "Find if no joints are connected to non-transport assets, such as other joints.", + "type": "error", + "message": "Joint connected to non-transport asset", + "selects": [ + { + "function": "get", + "alias": "joints", + "args": { + "type": "Joint" + } + } + ], + "check": { + "function": "connected_to", + "dataset": "joints", + "args": { + "assetType": ["Pipe","ElectricityCable","Bus"], + "resultMsgJSON": true + } + } + }, + { + "name": "diameter_undefined", + "description": "Find if both innerDiameter and diameter are not defined", + "type": "error", + "message": "Diameter not defined", + "selects": [ + { + "function": "get", + "alias": "pipes", + "args": { + "type": "Pipe" + } + } + ], + "check": { + "function": "multi_cond", + "dataset": "pipes", + "args": { + "properties": [ + "diameter", + "innerDiameter" + ], + "violations": [ + "VALUE_SPECIFIED", + 0.0 + ], + "resultMsgJSON": true + } + } + }, + { + "name": "unconnected_port", + "description": "Find if any port is left unconnected", + "type": "warning", + "message": "Unconnected port", + "selects": [ + { + "function": "get", + "alias": "assets", + "args": { + "type": "EnergyAsset" + } + } + ], + "check": { + "function": "unconnected_port", + "dataset": "assets", + "args": { + "resultMsgJSON": true + } + } + }, + { + "name": "producer_power_undefined", + "description": "An asset of type producer must have a power attribute (asset.power)", + "type": "error", + "message": "Producer missing power", + "selects": [ + { + "function": "get", + "alias": "producers", + "args": { + "type": "Producer" + } + } + ], + "check": { + "function": "not_null", + "dataset": "producers", + "args": { + "property": "power", + "counts_as_null": [ + 0.0 + ], + "resultMsgJSON": true + } + } + }, + { + "name": "consumer_profile_undefined", + "description": "An asset of type consumer must have a profile defined", + "type": "error", + "message": "Consumer missing profile", + "selects": [ + { + "function": "get_references", + "alias": "consumerInPorts", + "args": { + "assetType": "Consumer", + "referenceType": "InPort" + } + } + ], + "check": { + "function": "not_null", + "dataset": "consumerInPorts", + "args": { + "property": "profile", + "counts_as_null": [ + "EOrderedSet()" + ], + "resultMsgJSON": true + } + } + } + ] } \ No newline at end of file From 6ed3bbcee169809e2071b2d123900d82c7e9f7d6 Mon Sep 17 00:00:00 2001 From: plugrbf Date: Wed, 30 Mar 2022 13:36:38 +0200 Subject: [PATCH 05/12] Expanded check to resolve issue --- .../validation/functions/check_profile.py | 41 +++++++++++++++++++ testdata/schema_chess.json | 19 ++++----- 2 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 esdlvalidator/validation/functions/check_profile.py diff --git a/esdlvalidator/validation/functions/check_profile.py b/esdlvalidator/validation/functions/check_profile.py new file mode 100644 index 0000000..68174b4 --- /dev/null +++ b/esdlvalidator/validation/functions/check_profile.py @@ -0,0 +1,41 @@ +import json +from esdlvalidator.validation.functions import utils +from esdlvalidator.validation.functions.function import FunctionFactory, FunctionCheck, FunctionDefinition, \ + ArgDefinition, FunctionType, CheckResult + + +@FunctionFactory.register(FunctionType.CHECK, "check_profile") +class ContainsNotConnectedTo(FunctionCheck): + + def get_function_definition(self): + return FunctionDefinition( + "check_profile", + "Check if asset has at least one profile attached to its ports", + [ + ArgDefinition("resultMsgJSON", "Display output in JSON format", False) + ] + ) + + def before_execute(self): + pass + + def execute(self): + msg = {"offending_asset": self.value.id} + if len(self.value.port) == 0: + result = "{} has no ports".format(self.value.id) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) + + for port in self.value.port: + if len(utils.get_attribute(port, "profile")) > 0: + return CheckResult(True) + + result = "{} does not have at least one profile".format(self.value.id) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 5fdad36..2b75a55 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -129,26 +129,21 @@ { "name": "consumer_profile_undefined", "description": "An asset of type consumer must have a profile defined", - "type": "error", - "message": "Consumer missing profile", + "type": "warning", + "message": "Missing profile", "selects": [ { - "function": "get_references", - "alias": "consumerInPorts", + "function": "get", + "alias": "consumers", "args": { - "assetType": "Consumer", - "referenceType": "InPort" + "type": "Consumer" } } ], "check": { - "function": "not_null", - "dataset": "consumerInPorts", + "function": "check_profile", + "dataset": "consumers", "args": { - "property": "profile", - "counts_as_null": [ - "EOrderedSet()" - ], "resultMsgJSON": true } } From 2b29821d2122f1461207657219779084bb43cef5 Mon Sep 17 00:00:00 2001 From: plugrbf Date: Tue, 5 Apr 2022 22:14:12 +0200 Subject: [PATCH 06/12] Refactoring connected_to function --- .../{check_connected_to.py => check_only_connected_to.py} | 6 +++--- testdata/schema_chess.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename esdlvalidator/validation/functions/{check_connected_to.py => check_only_connected_to.py} (86%) diff --git a/esdlvalidator/validation/functions/check_connected_to.py b/esdlvalidator/validation/functions/check_only_connected_to.py similarity index 86% rename from esdlvalidator/validation/functions/check_connected_to.py rename to esdlvalidator/validation/functions/check_only_connected_to.py index b2dc476..f1d6ad4 100644 --- a/esdlvalidator/validation/functions/check_connected_to.py +++ b/esdlvalidator/validation/functions/check_only_connected_to.py @@ -4,13 +4,13 @@ ArgDefinition, FunctionType, CheckResult -@FunctionFactory.register(FunctionType.CHECK, "connected_to") +@FunctionFactory.register(FunctionType.CHECK, "only_connected_to") class ContainsConnectedTo(FunctionCheck): def get_function_definition(self): return FunctionDefinition( - "connected_to", - "Check if an asset is connected to", + "only_connected_to", + "Check if an asset is only connected to", [ ArgDefinition("assetType", "The type of asset to which selected asset must be connected to", True), ArgDefinition("resultMsgJSON", "Display output in JSON format", False) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 95e6fac..4b0d639 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -40,7 +40,7 @@ } ], "check": { - "function": "connected_to", + "function": "only_connected_to", "dataset": "joints", "args": { "assetType": ["Pipe","ElectricityCable","Bus"], From 326c67118b413e512f62306b88e8d81a344d8319 Mon Sep 17 00:00:00 2001 From: plugrbf Date: Tue, 5 Apr 2022 22:31:02 +0200 Subject: [PATCH 07/12] Changed warning to error on missing port profile --- testdata/schema_chess.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 2b75a55..a0021be 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -129,7 +129,7 @@ { "name": "consumer_profile_undefined", "description": "An asset of type consumer must have a profile defined", - "type": "warning", + "type": "error", "message": "Missing profile", "selects": [ { From f27836923f6f76774703178309ccfdb6296d11a4 Mon Sep 17 00:00:00 2001 From: plugrbf Date: Tue, 5 Apr 2022 23:37:51 +0200 Subject: [PATCH 08/12] Changed warning to error on missing port profile --- testdata/schema_chess.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 4b0d639..85b33bd 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -43,7 +43,7 @@ "function": "only_connected_to", "dataset": "joints", "args": { - "assetType": ["Pipe","ElectricityCable","Bus"], + "assetType": "Pipe", "resultMsgJSON": true } } From 1f91c1b26a141465667604409ff409af33d31728 Mon Sep 17 00:00:00 2001 From: plugrbf Date: Tue, 5 Apr 2022 23:41:14 +0200 Subject: [PATCH 09/12] Joint check now only considers Pipes valid transport assets in CHESS --- testdata/schema_chess.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 85b33bd..e874a02 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -27,7 +27,7 @@ }, { "name": "joint_connected_to_non_transport_asset", - "description": "Find if no joints are connected to non-transport assets, such as other joints.", + "description": "Find if no joints are connected to non-transport assets.", "type": "error", "message": "Joint connected to non-transport asset", "selects": [ From d24cf8eb4e1c404310fac9459fa840c15481ec7b Mon Sep 17 00:00:00 2001 From: plugrbf Date: Wed, 6 Apr 2022 11:31:43 +0200 Subject: [PATCH 10/12] Issue solution demonstrated with generic consumer-port-profile check --- .../functions/check_attribute_exists.py | 74 +++++++++++++++++++ .../validation/functions/check_profile.py | 41 ---------- testdata/schema_chess.json | 9 ++- 3 files changed, 80 insertions(+), 44 deletions(-) create mode 100644 esdlvalidator/validation/functions/check_attribute_exists.py delete mode 100644 esdlvalidator/validation/functions/check_profile.py diff --git a/esdlvalidator/validation/functions/check_attribute_exists.py b/esdlvalidator/validation/functions/check_attribute_exists.py new file mode 100644 index 0000000..a702af1 --- /dev/null +++ b/esdlvalidator/validation/functions/check_attribute_exists.py @@ -0,0 +1,74 @@ +import json +from esdlvalidator.validation.functions import utils +from esdlvalidator.validation.functions.function import FunctionFactory, FunctionCheck, FunctionDefinition, \ + ArgDefinition, FunctionType, CheckResult + + +@FunctionFactory.register(FunctionType.CHECK, "check_attribute_exists") +class ContainsNotConnectedTo(FunctionCheck): + + def get_function_definition(self): + return FunctionDefinition( + "check_attribute_exists", + "Check if asset component has attribute", # make component optional? + [ + ArgDefinition("component", "The component containing the attribute", True), + ArgDefinition("attribute", "The attribute that needs to checked", True), + ArgDefinition("check_all", "Whether to check any or all component attribute exist", False), + ArgDefinition("resultMsgJSON", "Display output in JSON format", False) + ] + ) + + def before_execute(self): + pass + + def execute(self): + msg = {"offending_asset": self.value.id} + + components = [] + if hasattr(self.value, self.args["component"]): + components = getattr(self.value, self.args["component"]) + + if len(components) == 0: + result = "{} has no components of type {}".format(self.value.id, self.args["component"]) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) + + if 'check_all' in self.args and not isinstance(self.args['check_all'], bool): + result = "Bad Schema: check_all must be a boolean, but is {} instead".format(type(self.args['check_all'])) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) + + if 'check_all' in self.args and self.args['check_all']: + for item in components: + attr = utils.get_attribute(item, self.args["attribute"]) + if attr is None or len(attr) == 0: + result = "{} is missing attribute {} in component {}".format(self.value.id, + self.args["attribute"], + item.id) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) + return CheckResult(True) + + else: + for item in components: + attr = utils.get_attribute(item, self.args["attribute"]) + if attr is not None and len(attr) > 0: + return CheckResult(True) + result = "{} does not have at least one component {} containing attribute {}".format(self.value.id, + self.args["component"], + self.args["attribute"]) + if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: + msg["message"] = result + return CheckResult(False, msg) + else: + return CheckResult(False, result) diff --git a/esdlvalidator/validation/functions/check_profile.py b/esdlvalidator/validation/functions/check_profile.py deleted file mode 100644 index 68174b4..0000000 --- a/esdlvalidator/validation/functions/check_profile.py +++ /dev/null @@ -1,41 +0,0 @@ -import json -from esdlvalidator.validation.functions import utils -from esdlvalidator.validation.functions.function import FunctionFactory, FunctionCheck, FunctionDefinition, \ - ArgDefinition, FunctionType, CheckResult - - -@FunctionFactory.register(FunctionType.CHECK, "check_profile") -class ContainsNotConnectedTo(FunctionCheck): - - def get_function_definition(self): - return FunctionDefinition( - "check_profile", - "Check if asset has at least one profile attached to its ports", - [ - ArgDefinition("resultMsgJSON", "Display output in JSON format", False) - ] - ) - - def before_execute(self): - pass - - def execute(self): - msg = {"offending_asset": self.value.id} - if len(self.value.port) == 0: - result = "{} has no ports".format(self.value.id) - if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: - msg["message"] = result - return CheckResult(False, msg) - else: - return CheckResult(False, result) - - for port in self.value.port: - if len(utils.get_attribute(port, "profile")) > 0: - return CheckResult(True) - - result = "{} does not have at least one profile".format(self.value.id) - if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: - msg["message"] = result - return CheckResult(False, msg) - else: - return CheckResult(False, result) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index a0021be..277dd7a 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -128,8 +128,8 @@ }, { "name": "consumer_profile_undefined", - "description": "An asset of type consumer must have a profile defined", - "type": "error", + "description": "An asset of type consumer must have a profile defined on one of its ports", + "type": "warning", "message": "Missing profile", "selects": [ { @@ -141,9 +141,12 @@ } ], "check": { - "function": "check_profile", + "function": "check_attribute_exists", "dataset": "consumers", "args": { + "attribute": "profile", + "component": "port", + "check_all": false, "resultMsgJSON": true } } From f04d5655fce05cd8a8fe5fded7200559c5b6fb7f Mon Sep 17 00:00:00 2001 From: plugrbf Date: Wed, 6 Apr 2022 12:53:35 +0200 Subject: [PATCH 11/12] Refactoring function name --- ...tribute_exists.py => check_child_attribute.py} | 15 ++++++++------- testdata/schema_chess.json | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) rename esdlvalidator/validation/functions/{check_attribute_exists.py => check_child_attribute.py} (86%) diff --git a/esdlvalidator/validation/functions/check_attribute_exists.py b/esdlvalidator/validation/functions/check_child_attribute.py similarity index 86% rename from esdlvalidator/validation/functions/check_attribute_exists.py rename to esdlvalidator/validation/functions/check_child_attribute.py index a702af1..ab8e98b 100644 --- a/esdlvalidator/validation/functions/check_attribute_exists.py +++ b/esdlvalidator/validation/functions/check_child_attribute.py @@ -4,15 +4,15 @@ ArgDefinition, FunctionType, CheckResult -@FunctionFactory.register(FunctionType.CHECK, "check_attribute_exists") +@FunctionFactory.register(FunctionType.CHECK, "check_child_attribute") class ContainsNotConnectedTo(FunctionCheck): def get_function_definition(self): return FunctionDefinition( - "check_attribute_exists", - "Check if asset component has attribute", # make component optional? + "check_child_attribute", + "Check if asset component has attribute", [ - ArgDefinition("component", "The component containing the attribute", True), + ArgDefinition("component", "The child component containing the attribute", True), ArgDefinition("attribute", "The attribute that needs to checked", True), ArgDefinition("check_all", "Whether to check any or all component attribute exist", False), ArgDefinition("resultMsgJSON", "Display output in JSON format", False) @@ -49,9 +49,10 @@ def execute(self): for item in components: attr = utils.get_attribute(item, self.args["attribute"]) if attr is None or len(attr) == 0: - result = "{} is missing attribute {} in component {}".format(self.value.id, - self.args["attribute"], - item.id) + result = "{} is missing attribute {} in component {} of type {}".format(self.value.id, + self.args["attribute"], + item.id, + self.args["component"]) if 'resultMsgJSON' in self.args and self.args['resultMsgJSON']: msg["message"] = result return CheckResult(False, msg) diff --git a/testdata/schema_chess.json b/testdata/schema_chess.json index 277dd7a..17b5f1b 100644 --- a/testdata/schema_chess.json +++ b/testdata/schema_chess.json @@ -141,7 +141,7 @@ } ], "check": { - "function": "check_attribute_exists", + "function": "check_child_attribute", "dataset": "consumers", "args": { "attribute": "profile", From 0d892df7ae880a4ed650df966e536e108e2be933 Mon Sep 17 00:00:00 2001 From: Ewoud Werkman Date: Thu, 18 Aug 2022 16:33:14 +0200 Subject: [PATCH 12/12] Add schema currently available in the MapEditor --- testdata/schema_chess_2022-08-18.json | 220 ++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 testdata/schema_chess_2022-08-18.json diff --git a/testdata/schema_chess_2022-08-18.json b/testdata/schema_chess_2022-08-18.json new file mode 100644 index 0000000..872904a --- /dev/null +++ b/testdata/schema_chess_2022-08-18.json @@ -0,0 +1,220 @@ +{ + "name": "CHESS validation schema", + "description": "CHESS validation schema contains checks for CHESS", + "validations": [{ + "name": "pipe_connected_to_pipe", + "description": "Find if no Pipes are connected to other Pipes", + "type": "error", + "message": "Pipe connected to another pipe", + "selects": [{ + "function": "get", + "alias": "pipes", + "args": { + "type": "Pipe" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "pipes", + "args": { + "assetType": "Pipe", + "resultMsgJSON": true + } + } + }, { + "name": "producer_connected_to_joint", + "description": "Find if no producers are connected to Joints", + "type": "error", + "message": "Producer connected to joint", + "selects": [{ + "function": "get", + "alias": "prod", + "args": { + "type": "Producer" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "prod", + "args": { + "assetType": "Joint", + "resultMsgJSON": true + } + } + }, { + "name": "consumer_connected_to_joint", + "description": "Find if no consumers are connected to Joints", + "type": "error", + "message": "Consumer connected to joint", + "selects": [{ + "function": "get", + "alias": "cons", + "args": { + "type": "Consumer" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "cons", + "args": { + "assetType": "Joint", + "resultMsgJSON": true + } + } + }, { + "name": "storage_connected_to_joint", + "description": "Find if no storages are connected to Joints", + "type": "error", + "message": "Storage connected to joint", + "selects": [{ + "function": "get", + "alias": "sto", + "args": { + "type": "Storage" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "sto", + "args": { + "assetType": "Joint", + "resultMsgJSON": true + } + } + }, { + "name": "conversion_connected_to_joint", + "description": "Find if no conversions are connected to Joints", + "type": "error", + "message": "Conversion connected to joint", + "selects": [{ + "function": "get", + "alias": "conv", + "args": { + "type": "Conversion" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "conv", + "args": { + "assetType": "Joint", + "resultMsgJSON": true + } + } + }, { + "name": "joint_connected_to_joint", + "description": "Find if no joints are connected to other Joints", + "type": "error", + "message": "Joint connected to another joint", + "selects": [{ + "function": "get", + "alias": "joints", + "args": { + "type": "Joint" + } + } + ], + "check": { + "function": "not_connected_to", + "dataset": "joints", + "args": { + "assetType": "Joint", + "resultMsgJSON": true + } + } + }, { + "name": "diameter_undefined", + "description": "Find if both innerDiameter and diameter are not defined", + "type": "error", + "message": "Diameter not defined", + "selects": [{ + "function": "get", + "alias": "pipes", + "args": { + "type": "Pipe" + } + } + ], + "check": { + "function": "multi_cond", + "dataset": "pipes", + "args": { + "properties": ["diameter", "innerDiameter"], + "violations": ["VALUE_SPECIFIED", 0.0], + "resultMsgJSON": true + } + } + }, { + "name": "unconnected_port", + "description": "Find if any port is left unconnected", + "type": "warning", + "message": "Unconnected port", + "selects": [{ + "function": "get", + "alias": "assets", + "args": { + "type": "EnergyAsset" + } + } + ], + "check": { + "function": "unconnected_port", + "dataset": "assets", + "args": { + "resultMsgJSON": true + } + } + }, { + "name": "producer_power_undefined", + "description": "An asset of type producer must have a power attribute (asset.power)", + "type": "error", + "message": "Producer missing power", + "selects": [{ + "function": "get", + "alias": "producers", + "args": { + "type": "Producer" + } + } + ], + "check": { + "function": "not_null", + "dataset": "producers", + "args": { + "property": "power", + "counts_as_null": [0.0], + "resultMsgJSON": true + } + } + }, { + "name": "consumer_profile_undefined", + "description": "An asset of type consumer must have a profile defined", + "type": "error", + "message": "Consumer missing profile", + "selects": [{ + "function": "get_references", + "alias": "consumerInPorts", + "args": { + "assetType": "Consumer", + "referenceType": "InPort" + } + } + ], + "check": { + "function": "not_null", + "dataset": "consumerInPorts", + "args": { + "property": "profile", + "counts_as_null": ["EOrderedSet()"], + "resultMsgJSON": true + } + } + } + ], + "id": "6139f62803a5f590c2367933" +}