diff --git a/.gitignore b/.gitignore index 728a25c41f..305e73e838 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ node_modules applications .cache .idea +.vscode/ /env/ /Agents/*/{build,dist}/ /Agents/*.egg @@ -38,3 +39,4 @@ rabbitmq-server.download.tar.xz /docs/source/volttron_api/ *ecobee_*.json .env* +dist/ diff --git a/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-agent.rst b/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-agent.rst index 636ee06db8..e45704ffb3 100644 --- a/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-agent.rst +++ b/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-agent.rst @@ -1,118 +1,36 @@ .. _IEEE-2030_5-Agent: -===================== -IEEE 2030.5 DER Agent -===================== +=========================== +IEEE 2030.5 EndDevice Agent +=========================== -The IEEE 2030.5 Agent (IEEE2030_5 in the VOLTTRON repository) implements a IEEE 2030.5 server that receives HTTP -`POST`/`PUT` requests from IEEE 2030.5 devices. The requests are routed to the IEEE 2030.5 Agent over the VOLTTRON -message bus by VOLTTRON's Master Web Service. The IEEE 2030.5 Agent returns an appropriate HTTP response. In some -cases (e.g., DERControl requests), this response includes a data payload. +The IEEE 2030.5 Agent (IEEE_2030_5 in the VOLTTRON repository) acts as an IEEE 2030.5 EndDevice (client). This +agent establishes a secure connection to a TLS-enabled 2030.5 server and discovers its capabilities. It verifies +the server's identity based on the Registration function set and uses the FunctionSetAssignments function set to +determine the appropriate DERProgram to run. The agent regularly checks for changes in default controls and +active DERControls and responds accordingly. It also listens to one or more subscriptions to the VOLTTRON message +bus for information (points) to POST/PUT to the 2030.5 server. -The IEEE 2030.5 Agent maps IEEE 2030.5 resource data to a VOLTTRON IEEE 2030.5 data model based on SunSpec, using block -numbers and point names as defined in the SunSpec Information Model, which in turn is harmonized with 61850. The data -model is given in detail below. +You can access the agent code, README, and demo from `IEEE_2030_5 Agent `_. -Each device's data is stored by the IEEE 2030.5 Agent in an `EndDevice` memory structure. This structure is not -persisted to a database. Each `EndDevice` retains only the most recently received value for each field. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Common Smart Inverter Profile (CSIP) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The IEEE2030_5 Agent exposes RPC calls for getting and setting EndDevice data. +This agent is not a fully compliant CSIP client, meaning it does not support all of the function sets +within the CSIP Profile of 2030.5. It provides the following function sets: +- End Device +- Time +- Distributed Energy Resources +- Metering +- Metering Mirror -VOLTTRON IEEE 2030.5 Device Driver ----------------------------------- +As time goes on it is likely that this list will be extended through user supported additions and project needs. -The :ref:`IEEE 2030.5 device driver ` is a new addition to VOLTTRON Platform Driver Agent's -family of standard device drivers. It exposes ``get_point``/``set_point calls`` for IEEE 2030.5 EndDevice fields. +################ +2030.5 Reference +################ -The IEEE 2030.5 device driver periodically issues IEEE2030_5 Agent RPC calls to refresh its cached representation of -EndDevice data. It issues RPC calls to IEEE2030_5Agent as needed when responding to ``get_point``, ``set_point`` and -``scrape_all`` calls. - - -Field Definitions -^^^^^^^^^^^^^^^^^ - -These field IDs correspond to the ones in the IEEE 2030.5 device driver's configuration file, ``ieee2030_5.csv``. -They have been used in that file's "Volttron Point Name" column and also in its "Point Name" column. - -================= ============================= ==================================================== ======= ====== -Field ID IEEE 2030.5 Resource/Property Description Units Type -================= ============================= ==================================================== ======= ====== -b1_Md device_information Model (32 char lim). string - mfModel -b1_Opt device_information Long-form device identifier (32 char lim). string - lfdi -b1_SN abstract_device Short-form device identifier (32 char lim). string - sfdi -b1_Vr device_information Version (16 char lim). string - mfHwVer -b113_A mirror_meter_reading AC current. A float - PhaseCurrentAvg -b113_DCA mirror_meter_reading DC current. A float - InstantPackCurrent -b113_DCV mirror_meter_reading DC voltage. V float - LineVoltageAvg -b113_DCW mirror_meter_reading DC power. W float - PhasePowerAvg -b113_PF mirror_meter_reading AC power factor. % float - PhasePFA -b113_WH mirror_meter_reading AC energy. Wh float - EnergyIMP -b120_AhrRtg der_capability Usable capacity of the battery. Ah float - rtgAh Maximum charge minus minimum charge. -b120_ARtg der_capability Maximum RMS AC current level capability of the A float - rtgA inverter. -b120_MaxChaRte der_capability Maximum rate of energy transfer into the device. W float - rtgMaxChargeRate -b120_MaxDisChaRte der_capability Maximum rate of energy transfer out of the device. W float - rtgMaxDischargeRate -b120_WHRtg der_capability Nominal energy rating of the storage device. Wh float - rtgWh -b120_WRtg der_capability Continuous power output capability of the inverter. W float - rtgW -b121_WMax der_settings Maximum power output. Default to WRtg. W float - setMaxChargeRate -b122_ActWh mirror_meter_reading AC lifetime active (real) energy output. Wh float - EnergyEXP -b122_StorConn der_status CONNECTED=0, AVAILABLE=1, OPERATING=2, TEST=3. enum - storConnectStatus -b124_WChaMax der_control Setpoint for maximum charge. This is the only W float - opModFixedFlow field that is writable with a set_point call. -b403_Tmp mirror_meter_reading Pack temperature. C float - InstantPackTemp -b404_DCW PEVInfo Power flow in or out of the inverter. W float - chargingPowerNow -b404_DCWh der_availability Output energy (absolute SOC). Wh float - availabilityDuration Calculated as (availabilityDuration / 3600) * WMax. -b802_LocRemCtl der_status Control Mode: REMOTE=0, LOCAL=1. enum - localControlModeStatus -b802_SoC der_status State of Charge %. % WHRtg float - stateOfChargeStatus -b802_State der_status DISCONNECTED=1, INITIALIZING=2, CONNECTED=3, enum - inverterStatus STANDBY=4, SOC PROTECTION=5, FAULT=99. -================= ============================= ==================================================== ======= ====== - - -Revising and Expanding the Field Definitions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The IEEE 2030.5-to-SunSpec field mappings in this implementation are a relatively thin subset of all possible -field definitions. Developers are encouraged to expand the definitions. - -The procedure for expanding the field mappings requires you to make changes in two places: - -1. Update the driver's point definitions in ``services/core/PlatformDriverAgent/platform_driver/ieee2030_5.csv`` -2. Update the IEEE 2030.5-to-SunSpec field mappings in ``services/core/IEEE2030_5Agent/ieee2030_5/end_device.py`` and - ``__init__.py`` - -When updating VOLTTRON's IEEE 2030.5 data model, please use field IDs that conform to the SunSpec -block-number-and-field-name model outlined in the SunSpec Information Model Reference (see the link below). - -View the :ref:`IEEE 2030.5 agent specification document ` to learn more about IEEE 2030.5 and -the IEEE 2030.5 agent and driver. - - -.. toctree:: - - ieee-2030_5-specification +`IEEE 2030.5 Standards `_ +`IEEE_2030_5 Agent `_ diff --git a/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-specification.rst b/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-specification.rst deleted file mode 100644 index 361f9e1150..0000000000 --- a/docs/source/agent-framework/core-service-agents/ieee-2030_5-agent/ieee-2030_5-specification.rst +++ /dev/null @@ -1,207 +0,0 @@ -.. _IEEE-2030_5-Specification: - -======================= -IEEE 2030.5 DER Support -======================= - -Version 1.0 - -Smart Energy Profile 2.0 (SEP 2.0, IEEE 2030.5) specifies a REST architecture built around the core HTTP verbs: GET, -HEAD, PUT, POST and DELETE. A specification for the IEEE 2030.5 protocol can be found -`here `_. - -IEEE 2030.5 EndDevices (clients) POST XML resources representing their state, and GET XML resources containing command -and control information from the server. The server never reaches out to the client unless a "subscription" is -registered and supported for a particular resource type. This implementation does not use IEEE 2030.5 registered -subscriptions. - -The IEEE 2030.5 specification requires HTTP headers, and it explicitly requires RESTful response codes, for example: - - - 201 - "Created" - - 204 - "No Content" - - 301 - "Moved Permanently" - - etc. - -IEEE 2030.5 message encoding may be either XML or EXI. Only XML is supported in this implementation. - -IEEE 2030.5 requires HTTPS/TLS version 1.2 along with support for the cipher suite TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8. -Production installation requires a certificate issued by a IEEE 2030.5 CA. The encryption requirement can be met by -using a web server such as Apache to proxy the HTTPs traffic. - -IEEE 2030.5 discovery, if supported, must be implemented by an xmDNS server. Avahi can be modified to perform this -function. - - -Function Sets -============= - -IEEE 2030.5 groups XML resources into "Function Sets." Some of these function sets provide a core set of functionality -used across higher-level function sets. This implementation implements resources from the following function sets: - - - Time - - Device Information - - Device Capabilities - - End Device - - Function Set Assignments - - Power Status - - Distributed Energy Resources - - -Distributed Energy Resources (DERs) ------------------------------------ - -Distributed energy resources (DERs) are devices that generate energy, e.g., solar inverters, or store energy, e.g., -battery storage systems, electric vehicle supply equipment (EVSEs). These devices are managed by a IEEE 2030.5 DER -server using DERPrograms which are described by the IEEE 2030.5 specification as follows: - - Servers host one or more DERPrograms, which in turn expose DERControl events to DER clients. - DERControl instances contain attributes that allow DER clients to respond to events - that are targeted to their device type. A DERControl instance also includes scheduling - attributes that allow DER clients to store and process future events. These attributes - include start time and duration, as well an indication of the need for randomization of - the start and / or duration of the event. The IEEE 2030.5 DER client model is based on the - SunSpec Alliance Inverter Control Model [SunSpec] which is derived from - IEC 61850-90-7 [61850] and [EPRI]. - -EndDevices post multiple IEEE 2030.5 resources describing their status. The following is an -example of a Power Status resource that might be posted by an EVSE (vehicle charging station): - -.. code-block:: xml - - - 4 - 1487812095 - 1 - 9300 - - - 3 - -5 - - - 3 - 22 - - - 3 - 7 - - 11280 - 10000 - 9223372036854775807 - 1487812095 - - - - -Design Details --------------- - -.. image:: files/volttron_ieee2030_5.jpg - -VOLTTRON's IEEE 2030.5 implementation includes a IEEE 2030.5 Agent and a IEEE 2030.5 device driver, as described below. - - -VOLTTRON IEEE 2030.5 Device Driver -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The IEEE 2030.5 device driver is a new addition to VOLTTRON Platform Driver Agent's family of standard device drivers. It -exposes `get_point`/`set_point` calls for IEEE 2030.5 EndDevice fields. - -The IEEE 2030.5 device driver periodically issues the IEEE 2030.5 Agent RPC calls to refresh its cached representation -of EndDevice data. It issues RPC calls to the IEEE 2030.5 Agent as needed when responding to `get_point`, `set_point` -and `scrape_all` calls. - -Field Definitions -^^^^^^^^^^^^^^^^^ - -These field IDs correspond to the ones in the IEEE 2030.5 device driver's configuration file, `ieee2030_5.csv`. -They have been used in that file's `Volttron Point Name` column and also in its `Point Name` column. - -================= ============================= ==================================================== ======= ====== -Field ID IEEE 2030.5 Resource/Property Description Units Type -================= ============================= ==================================================== ======= ====== -b1_Md device_information Model (32 char lim). string - mfModel -b1_Opt device_information Long-form device identifier (32 char lim). string - lfdi -b1_SN abstract_device Short-form device identifier (32 char lim). string - sfdi -b1_Vr device_information Version (16 char lim). string - mfHwVer -b113_A mirror_meter_reading AC current. A float - PhaseCurrentAvg -b113_DCA mirror_meter_reading DC current. A float - InstantPackCurrent -b113_DCV mirror_meter_reading DC voltage. V float - LineVoltageAvg -b113_DCW mirror_meter_reading DC power. W float - PhasePowerAvg -b113_PF mirror_meter_reading AC power factor. % float - PhasePFA -b113_WH mirror_meter_reading AC energy. Wh float - EnergyIMP -b120_AhrRtg der_capability Usable capacity of the battery. Ah float - rtgAh Maximum charge minus minimum charge. -b120_ARtg der_capability Maximum RMS AC current level capability of the A float - rtgA inverter. -b120_MaxChaRte der_capability Maximum rate of energy transfer into the device. W float - rtgMaxChargeRate -b120_MaxDisChaRte der_capability Maximum rate of energy transfer out of the device. W float - rtgMaxDischargeRate -b120_WHRtg der_capability Nominal energy rating of the storage device. Wh float - rtgWh -b120_WRtg der_capability Continuous power output capability of the inverter. W float - rtgW -b121_WMax der_settings Maximum power output. Default to WRtg. W float - setMaxChargeRate -b122_ActWh mirror_meter_reading AC lifetime active (real) energy output. Wh float - EnergyEXP -b122_StorConn der_status CONNECTED=0, AVAILABLE=1, OPERATING=2, TEST=3. enum - storConnectStatus -b124_WChaMax der_control Setpoint for maximum charge. This is the only W float - opModFixedFlow field that is writable with a set_point call. -b403_Tmp mirror_meter_reading Pack temperature. C float - InstantPackTemp -b404_DCW PEVInfo Power flow in or out of the inverter. W float - chargingPowerNow -b404_DCWh der_availability Output energy (absolute SOC). Wh float - availabilityDuration Calculated as (availabilityDuration / 3600) * WMax. -b802_LocRemCtl der_status Control Mode: REMOTE=0, LOCAL=1. enum - localControlModeStatus -b802_SoC der_status State of Charge %. % WHRtg float - stateOfChargeStatus -b802_State der_status DISCONNECTED=1, INITIALIZING=2, CONNECTED=3, enum - inverterStatus STANDBY=4, SOC PROTECTION=5, FAULT=99. -================= ============================= ==================================================== ======= ====== - - -Revising and Expanding the Field Definitions --------------------------------------------- - -The IEEE 2030.5-to-SunSpec field mappings in this implementation are a relatively thin subset of all possible -field definitions. Developers are encouraged to expand the definitions. - -The procedure for expanding the field mappings requires you to make changes in two places: - -1. Update the driver's point definitions in `services/core/PlatformDriverAgent/platform_driver/ieee2030_5.csv` -2. Update the IEEE 2030.5-to-SunSpec field mappings in `services/core/IEEE2030_5Agent/ieee2030_5/end_device.py` and - `__init__.py` - -When updating VOLTTRON's IEEE 2030.5 data model, please use field IDs that conform to the SunSpec -block-number-and-field-name model outlined in the SunSpec Information Model Reference (see the link below). - - -For Further Information -======================= - -SunSpec References: - - - Information model specification: http://sunspec.org/wp-content/uploads/2015/06/SunSpec-Information-Models-12041.pdf - - Information model reference spreadsheet: http://sunspec.org/wp-content/uploads/2015/06/SunSpec-Information-Model-Reference.xlsx - - Inverter models: http://sunspec.org/wp-content/uploads/2015/06/SunSpec-Inverter-Models-12020.pdf - - Energy storage models: http://sunspec.org/wp-content/uploads/2015/06/SunSpec-Energy-Storage-Models-12032.pdf - -Questions? Please contact: - - - Rob Calvert (rob@kisensum.com) or James Sheridan (james@kisensum.com) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..06556a1356 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,13 @@ +[tool.yapfignore] +ignore_patterns = [ + ".env/**", + ".pytest_cache/**", + "dist/**", + "docs/**", +] + +[tool.yapf] +based_on_style = "pep8" +spaces_before_comment = 4 +column_limit = 99 +split_before_logical_operator = true \ No newline at end of file diff --git a/requirements.py b/requirements.py index 951dac43a9..4d121a3af2 100644 --- a/requirements.py +++ b/requirements.py @@ -101,6 +101,7 @@ 'pytest_asyncio==0.19.0', 'pytest_timeout==2.1.0'], 'weather': ['Pint==0.19.2'], + 'yapf': ['yapf'], 'web': ['ws4py==0.5.1', 'PyJWT==1.7.1', 'Jinja2==3.1.2', diff --git a/scripts/pycharm-launch.py b/scripts/pycharm-launch.py index a2a5694d5c..e2663799c6 100644 --- a/scripts/pycharm-launch.py +++ b/scripts/pycharm-launch.py @@ -17,12 +17,13 @@ input box put services/core/VolttronCentral/volttroncentral/agent.py. """ import argparse -import shutil -import string -import sys import os import runpy +import shutil +import string import subprocess +import sys + from volttron.platform import jsonapi __author__ = 'Craig Allwardt' @@ -31,16 +32,21 @@ parser = argparse.ArgumentParser() parser.add_argument("agent", help="Path to the agent file to be executed.") -parser.add_argument("-s", "--silence", const=True, dest="silence", nargs="?", +parser.add_argument("-s", + "--silence", + const=True, + dest="silence", + nargs="?", help="Silence the help message.") -parser.add_argument("-n", "--no-config", action="store_true", +parser.add_argument("-n", + "--no-config", + action="store_true", help="Don't include the default config in the agent directory.") parsed = parser.parse_args() mod_name = [os.path.basename(parsed.agent)] if not os.path.isfile(parsed.agent): - sys.stdout.write("Passed argument must be a python file! {}". - format(parsed.agent)) + sys.stdout.write("Passed argument must be a python file! {}".format(parsed.agent)) sys.exit() abspath = os.path.abspath(os.path.join(parsed.agent, os.pardir)) @@ -60,14 +66,12 @@ def write_required_statement(out=sys.stderr): - out.write( - """Required Environment Variables - AGENT_VIP_IDENTITY - Required + out.write("""Required Environment Variables + AGENT_VIP_IDENTITY - Required Optional Environmental Variables AGENT_CONFIG - Set to /config by default VOLTTRON_HOME - Set to ~/.volttron by default -""" - ) +""") sys.path.insert(0, abspath) @@ -89,9 +93,7 @@ def write_required_statement(out=sys.stderr): if not volttron_home: os.environ['VOLTTRON_HOME'] = os.path.abspath( - os.path.expandvars( - os.path.join( - os.path.expanduser("~"), '.volttron'))) + os.path.expandvars(os.path.join(os.path.expanduser("~"), '.volttron'))) volttron_home = os.environ.get('VOLTTRON_HOME') # Now register the @@ -101,7 +103,7 @@ def write_required_statement(out=sys.stderr): sys.stderr.write("AGENT_VIP_IDENTITY MUST be set in environment\n") sys.exit(10) -valid_chars = "_.%s%s" % (string.ascii_letters, string.digits) +valid_chars = "_.-%s%s" % (string.ascii_letters, string.digits) for c in agent_identity: if c not in valid_chars: @@ -111,48 +113,65 @@ def write_required_statement(out=sys.stderr): sys.exit(10) if agent_identity: - new_dir = os.path.join(volttron_home, 'keystores', agent_identity) - if not os.path.exists(new_dir): - os.makedirs(new_dir) + agent_keystore_dir = os.path.join(volttron_home, 'keystores', agent_identity) + if os.path.exists(agent_keystore_dir): + with open(agent_keystore_dir + '/keystore.json', 'r') as fin: + json_obj = jsonapi.loads(fin.read()) + pubkey = json_obj['public'] + secret = json_obj['secret'] + else: + os.makedirs(agent_keystore_dir) try: output = subprocess.check_output(['vctl', 'auth', 'keypair'], - env=os.environ.copy(), universal_newlines=True, stderr=subprocess.STDOUT) + env=os.environ.copy(), + universal_newlines=True, + stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - sys.stderr.write("Couldn't get key pair for identity: {}\n".format( - agent_identity - )) + sys.stderr.write("Couldn't get key pair for identity: {}\n".format(agent_identity)) sys.stderr.write("Call was:\n\tvctl auth keypair\n") sys.stderr.write("Output of command: {}".format(e.output)) sys.stderr.write("Your environment might not be setup correctly!") - os.rmdir(new_dir) + os.rmdir(agent_keystore_dir) write_required_statement() sys.exit(20) else: - keystore_file = os.path.join(new_dir, "keystore.json") + keystore_file = os.path.join(agent_keystore_dir, "keystore.json") json_obj = jsonapi.loads(output) with open(keystore_file, 'w') as fout: fout.write(output) pubkey = json_obj['public'] + secret = json_obj['secret'] try: - params = ['vctl', 'auth', 'add', - '--credentials', "{}".format(pubkey), '--user_id', agent_identity, - '--capabilities', "edit_config_store", - '--comments', "Added from pycharm-launch.py script." - ] - output = subprocess.check_output(params, env=os.environ.copy(), universal_newlines=True) + params = [ + 'vctl', 'auth', 'add', '--credentials', "{}".format(pubkey), '--user_id', + agent_identity, '--capabilities', "edit_config_store", '--comments', + "Added from pycharm-launch.py script." + ] + print(" ".join(params)) + output = subprocess.check_output(params, + env=os.environ.copy(), + universal_newlines=True) except subprocess.CalledProcessError as e: sys.stderr.write(str(e)) sys.stderr.write("Command returned following output: {}".format(e.output)) - shutil.rmtree(new_dir) - sys.stderr.write("Couldn't authenticate agent id: {}\n".format( - agent_identity - )) + shutil.rmtree(agent_keystore_dir) + sys.stderr.write("Couldn't authenticate agent id: {}\n".format(agent_identity)) sys.stderr.write("Call was: {}\n".format(params)) sys.stderr.write("Your environment might not be setup correctly!") write_required_statement() sys.exit(20) +if not pubkey or not secret: + raise ValueError(f"Missing publickey or secretkey for {agent_identity}") + +# Populate the serverkey +with open(os.path.join(volttron_home, "keystore"), 'r') as fin: + json_obj = jsonapi.loads(fin.read()) + os.environ['VOLTTRON_SERVERKEY'] = json_obj['public'] + +os.environ['AGENT_PUBLICKEY'] = pubkey +os.environ['AGENT_SECRETKEY'] = secret if not parsed.silence: sys.stdout.write("For your information (-s) to not print this message.") write_required_statement(sys.stdout) diff --git a/services/core/IEEE2030_5Agent/IDENTITY b/services/core/IEEE2030_5Agent/IDENTITY deleted file mode 100644 index e722eb9048..0000000000 --- a/services/core/IEEE2030_5Agent/IDENTITY +++ /dev/null @@ -1 +0,0 @@ -IEEE2030_5agent diff --git a/services/core/IEEE2030_5Agent/IEEE2030_5/__init__.py b/services/core/IEEE2030_5Agent/IEEE2030_5/__init__.py deleted file mode 100644 index e6ebd475e7..0000000000 --- a/services/core/IEEE2030_5Agent/IEEE2030_5/__init__.py +++ /dev/null @@ -1,87 +0,0 @@ -from collections import namedtuple - -STOR_UNKNOWN = -1 -STOR_DISCONNECTED = 1 -STOR_CONNECTED = 5 - -CONTROL_MODE_LOCAL = 0 -CONTROL_MODE_REMOTE = 1 - -INVERTER_STATUS_UNKNOWN = -1 -INVERTER_NORMAL = 0 -INVERTER_OFF = 1 -INVERTER_STARTING = 3 -INVERTER_FORCED_POWER_REDUCTION = 5 -INVERTER_FAULT = 7 -INVERTER_CELL_BALANCING = 10 - -MRID_SUFFIX_FUNCTION_SET_ASSIGNMENT = 3 -MRID_SUFFIX_DER_PROGRAM = 4 -MRID_SUFFIX_DER_CONTROL = 5 - -EVENT_STATUS_SCHEDULE = 0 -EVENT_STATUS_ACTIVE = 1 -EVENT_STATUS_CANCELLED = 2 -EVENT_STATUS_CANCELLED_RANDOM = 3 -EVENT_STATUS_SUPERCEDED = 4 - -QUALITY_NTP = 3 - -STATUS_CODES = { - 200: '200 OK', - 201: '201 Created', - 204: '204 No Content', - 500: '500 Internal Error', -} -XML_HEADERS = [("Content-Type", "application/sep+xml")] -CREATED_HEADERS = [("Content-Length", "0")] - -Endpoint = namedtuple('Endpoint', ['url', 'callback']) -IEEE2030_5_ENDPOINTS = { - "dcap": Endpoint(url="/dcap", callback='dcap'), - "tm": Endpoint(url="/dcap/tm", callback='tm'), - "sdev": Endpoint(url="/dcap/sdev", callback='sdev'), - "edev-list": Endpoint(url="/dcap/edev", callback='edev_list'), - - "sdev-di": Endpoint(url="/dcap/sdev/di", callback='sdev_di'), - "sdev-log": Endpoint(url="/dcap/sdev/log", callback='sdev_log'), - - "mup-list": Endpoint(url="/dcap/mup", callback='mup_list'), -} -IEEE2030_5_MUP_ENDPOINTS = { - "mup": Endpoint(url="/dcap/mup/{}", callback='mup'), -} -IEEE2030_5_EDEV_ENDPOINTS = { - "edev": Endpoint(url="/dcap/edev/{}", callback='edev'), - "reg": Endpoint(url="/dcap/edev/{}/reg", callback='edev_reg'), - "di": Endpoint(url="/dcap/edev/{}/di", callback='edev_di'), - "dstat": Endpoint(url="/dcap/edev/{}/dstat", callback='edev_dstat'), - "ps": Endpoint(url="/dcap/edev/{}/ps", callback='edev_ps'), - "der-list": Endpoint(url="/dcap/edev/{}/der", callback='edev_der_list'), - - "derp-list": Endpoint(url="/dcap/edev/{}/derp", callback='edev_derp_list'), - "derp": Endpoint(url="/dcap/edev/{}/derp/1", callback='edev_derp'), - - "der": Endpoint(url="/dcap/edev/{}/der/1", callback='edev_der'), - "dera": Endpoint(url="/dcap/edev/{}/der/1/dera", callback='edev_dera'), - "dercap": Endpoint(url="/dcap/edev/{}/der/1/dercap", callback='edev_dercap'), - "derg": Endpoint(url="/dcap/edev/{}/der/1/derg", callback='edev_derg'), - "ders": Endpoint(url="/dcap/edev/{}/der/1/ders", callback='edev_ders'), - - "derc-list": Endpoint(url="/dcap/edev/{}/derc", callback='edev_derc_list'), - "derc": Endpoint(url="/dcap/edev/{}/derc/1", callback='edev_derc'), - - "fsa-list": Endpoint(url="/dcap/edev/{}/fsa", callback='edev_fsa_list'), - "fsa": Endpoint(url="/dcap/edev/{}/fsa/0", callback='edev_fsa'), -} - -RESOURCE_MAPPING = { - "DeviceInformation": "device_information", - "MirrorMeterReading": "mup", - "DERStatus": "der_status", - "DERControl": "der_control", - "DERCapability": "der_capability", - "DERSettings": "der_settings", - "DERAvailability": "der_availability", - "PowerStatus": "power_status", -} diff --git a/services/core/IEEE2030_5Agent/IEEE2030_5/agent.py b/services/core/IEEE2030_5Agent/IEEE2030_5/agent.py deleted file mode 100644 index 332834b2e3..0000000000 --- a/services/core/IEEE2030_5Agent/IEEE2030_5/agent.py +++ /dev/null @@ -1,564 +0,0 @@ -# -*- coding: utf-8 -*- {{{ -# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: -# -# Copyright 2020, Battelle Memorial Institute. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This material was prepared as an account of work sponsored by an agency of -# the United States Government. Neither the United States Government nor the -# United States Department of Energy, nor Battelle, nor any of their -# employees, nor any jurisdiction or organization that has cooperated in the -# development of these materials, makes any warranty, express or -# implied, or assumes any legal liability or responsibility for the accuracy, -# completeness, or usefulness or any information, apparatus, product, -# software, or process disclosed, or represents that its use would not infringe -# privately owned rights. Reference herein to any specific commercial product, -# process, or service by trade name, trademark, manufacturer, or otherwise -# does not necessarily constitute or imply its endorsement, recommendation, or -# favoring by the United States Government or any agency thereof, or -# Battelle Memorial Institute. The views and opinions of authors expressed -# herein do not necessarily state or reflect those of the -# United States Government or any agency thereof. -# -# PACIFIC NORTHWEST NATIONAL LABORATORY operated by -# BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY -# under Contract DE-AC05-76RL01830 -# }}} - -from .end_device import EndDevice, MUP, IEEE2030_5Renderer, IEEE2030_5Time -from datetime import datetime, timedelta -from volttron.platform.agent import utils -from volttron.platform.vip.agent import Agent, Core, RPC -import IEEE2030_5 -import base64 -import logging -import pytz -import sys -from . import xsd_models - -utils.setup_logging() -_log = logging.getLogger(__name__) -__version__ = '1.0' - - -class IEEE2030_5Exception(Exception): - pass - - -def IEEE2030_5_agent(config_path, **kwargs): - """Parses the IEEE2030_5 Agent configuration and returns an instance of - the agent created using that configuation. - - :param config_path: Path to a configuation file. - - :type config_path: str - :returns: IEEE 2030.5 Agent - :rtype: IEEE2030_5Agent - """ - try: - config = utils.load_config(config_path) - except Exception: - config = {} - - if not config: - _log.info("Using IEEE 2030.5 Agent defaults for starting configuration.") - - devices = config.get('devices', []) # To add devices, include them in a config file - # This default should be overridden in config file - IEEE2030_5_server_sfdi = config.get('IEEE2030_5_server_sfdi', 'foo') - # This default should be overridden in config file - IEEE2030_5_server_lfdi = config.get('IEEE2030_5_server_lfdi', 'bar') - load_shed_device_category = config.get('load_shed_device_category', '0020') - timezone = config.get('timezone', 'America/Los_Angeles') - - return IEEE2030_5Agent(devices, - IEEE2030_5_server_sfdi, - IEEE2030_5_server_lfdi, - load_shed_device_category, - timezone, - **kwargs) - - -class IEEE2030_5Agent(Agent): - """ - Agent that handles IEEE 2030.5 communication. - - IEEE2030_5Agent uses the VOLTTRON web service to communicate with IEEE 2030.5 end devices. - End device configuration is outlined in the agent config file. - - IEEE 2030.5 data is exposed via get_point(), get_points() and set_point() calls. - A IEEE 2030.5 device driver (IEEE2030_5.py under PlatformDriverAgent) can be configured, - which gets and sets data by sending RPCs to this agent. - - For further information about this subsystem, please see the VOLTTRON - IEEE 2030.5 DER Support specification, which is located in VOLTTRON readthedocs - under specifications/IEEE2030_5_agent.html. - - This agent can be installed as follows: - export IEEE2030_5_ROOT=$VOLTTRON_ROOT/services/core/IEEE2030_5Agent - cd $VOLTTRON_ROOT - python scripts/install-agent.py -s $IEEE2030_5_ROOT -i IEEE2030_5agent -c $IEEE2030_5_ROOT/config - -t IEEE2030_5agent -f - """ - - def __init__(self, device_config=[], IEEE2030_5_server_sfdi='foo', IEEE2030_5_server_lfdi='bar', - load_shed_device_category='0020', timezone='America/Los_Angeles', **kwargs): - super(IEEE2030_5Agent, self).__init__(enable_web=True, **kwargs) - - self.device_config = device_config - self.IEEE2030_5_server_sfdi = IEEE2030_5_server_sfdi - self.IEEE2030_5_server_lfdi = IEEE2030_5_server_lfdi - self.load_shed_device_category = load_shed_device_category - self.timezone = timezone - self.devices = {} - - self.default_config = {"devices": device_config, - "IEEE2030_5_server_sfdi": IEEE2030_5_server_sfdi, - "IEEE2030_5_server_lfdi": IEEE2030_5_server_lfdi, - "load_shed_device_category": load_shed_device_category, - "timezone": timezone} - self.vip.config.set_default("config", self.default_config) - self.devices = self.register_devices(device_config) - self.mups = [] - - self.vip.config.subscribe(self.configure, actions=["NEW", "UPDATE"], pattern="config") - - def configure(self, configure, actions, contents): - config = self.default_config.copy() - config.update(contents) - _log.debug("Configuring IEEE 2030.5 Agent") - - self.device_config = config["devices"] - self.IEEE2030_5_server_sfdi = config["IEEE2030_5_server_sfdi"] - self.IEEE2030_5_server_lfdi = config["IEEE2030_5_server_lfdi"] - self.load_shed_device_category = config["load_shed_device_category"] - self.timezone = config["timezone"] - self.devices = self.register_devices(self.device_config) - self.register_endpoints(self) - - @Core.receiver('onstart') - def register_endpoints(self, sender): - """ Register HTTP endpoints. - - Registers all IEEE 2030.5 related endpoints. Endpoints are defined in the end_device.py file. - """ - # _log.debug("Deregistering Endpoints: {}".format(self.__class__.__name__)) - for endpoint in self.vip.web._endpoints: - try: - split_path = endpoint.split('/') - if split_path[2] == 'edev' and int(split_path[3]): - if int(split_path[3]) not in self.devices.keys(): - pass - # If code is ever introduced to unregister an endpoint, do so here! - # self.vip.web.unregister_endpoint(endpoint) - except (IndexError, ValueError): - pass - - _log.debug("Registering Endpoints: {}".format(self.__class__.__name__)) - for _, endpoint in IEEE2030_5.IEEE2030_5_ENDPOINTS.items(): - if endpoint.url not in self.vip.web._endpoints: - self.vip.web.register_endpoint(endpoint.url, getattr(self, endpoint.callback), "raw") - for device_id, device in self.devices.items(): - for _, endpoint in IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS.items(): - if endpoint.url.format(device_id) not in self.vip.web._endpoints: - self.vip.web.register_endpoint(endpoint.url.format(device_id), - getattr(self, endpoint.callback), "raw") - - def register_devices(self, devices): - """ Register IEEE 2030.5 end devices. - - :param devices: End devices from agent config file. - :type devices: List - - :return: Dictionary of EndDevice objects keyed by ID. - """ - _log.debug("Loading Devices: {}".format(self.__class__.__name__)) - end_devices = self.devices - for device in devices: - if device['sfdi'] not in [k.sfdi for k in end_devices.values()]: - d = EndDevice(sfdi=device["sfdi"], - lfdi=device["lfdi"], - load_shed_device_category=device["load_shed_device_category"], - pin_code=device["pin_code"]) - end_devices[d.id] = d - else: - d = self.get_end_device(sfdi=device['sfdi']) - d.lfdi = device['lfdi'] - d.load_shed_device_category = device['load_shed_device_category'] - d.pin_code = device['pin_code'] - - old_indices = [] - for index, d in end_devices.items(): - if d.sfdi not in [device['sfdi'] for device in devices]: - old_indices.append(index) - for i in old_indices: - end_devices.pop(i) - return end_devices - - def get_end_device(self, path=None, sfdi=None, lfdi=None): - """ Helper function to return end device object. - - Only one of path or sfdi should be used for End Device lookup - - :param path: Path Info of HTTP endpoint request - :param sfdi: SFDI of end device - :param lfdi: LFDI of end device - :return: EndDevice object - """ - if path: - end_device_id = path.split('/')[3] - try: - device = self.devices[int(end_device_id)] - return device - except KeyError: - raise IEEE2030_5Exception("Invalid end device requested") - else: - end_device = None - for device in self.devices.values(): - if device.sfdi == sfdi or device.lfdi == lfdi: - end_device = device - if end_device is None: - raise IEEE2030_5Exception("Invalid end device requested") - return end_device - - def process_edev(self, env, data, xsd_type, attr_name): - """ Process HTTP requests and prepare response - - :param env: Request Environment variables - :param data: Request data - :param xsd_type: XSD object type request represents - :param attr_name: Attribute of EndDevice object that corresponds to the XSD Object - :return: Tuple of (Status Code, Response Data, Headers) - """ - device = self.get_end_device(env['PATH_INFO']) - if env['REQUEST_METHOD'] in ('POST', 'PUT'): - obj = xsd_models.parseString(data, silence=True) - if type(obj) == xsd_type: - setattr(device, attr_name, obj) - return [IEEE2030_5.STATUS_CODES[204], '', IEEE2030_5.CREATED_HEADERS] - else: - _log.warning("Bad XML input for HTTP Endpoint.") - return [IEEE2030_5.STATUS_CODES[500], '', IEEE2030_5.XML_HEADERS] - else: - return IEEE2030_5Agent.prep_200_response({'received_data': data, 'result': getattr(device, attr_name)}) - - @staticmethod - def add_meter_readings(mup, meter_readings): - """ Update/Create Meter Readings for MUP based on existance. - - If Meter Reading already exists, send an update. If it does not, create new Meter Reading for MUP. - - :param mup: MUP object - :param meter_readings: List of incoming Meter Readings to insert into MUP object. - :return: None - """ - for meter_reading in meter_readings: - flag = True - for index, xsd in enumerate(mup.mup_xsd.get_MirrorMeterReading()): - if meter_reading.description == mup.mup_xsd.get_MirrorMeterReading()[index].description: - mup.mup_xsd.replace_MirrorMeterReading_at(index, meter_reading) - flag = False - if flag: - mup.mup_xsd.add_MirrorMeterReading(meter_reading) - - @staticmethod - def prep_200_response(render_dict): - """Helper function to prep standard 200 responses with XML formatted data - - :param render_dict: dictionary to render into XML serializable string - - :return: Tuple of (Status Code, Response Data, Headers) - """ - return (IEEE2030_5.STATUS_CODES[200], - base64.b64encode(IEEE2030_5Renderer.render(render_dict)).decode('ascii'), - IEEE2030_5.XML_HEADERS) - - @RPC.export - def get_point(self, sfdi, point_name): - _log.debug("EndDevice {0}: Getting value for {1}".format(sfdi, point_name)) - end_device = self.get_end_device(sfdi=sfdi) - try: - point_definition = end_device.mappings[point_name] - return end_device.field_value(point_definition['IEEE 2030.5 Resource Name'], - point_definition['IEEE 2030.5 Field Name']) - except KeyError: - raise IEEE2030_5Exception("{0} not a configured point name.".format(point_name)) - - @RPC.export - def get_points(self, sfdi): - _log.debug("EndDevice {0}: Getting all configured point values".format(sfdi)) - end_device = self.get_end_device(sfdi=sfdi) - try: - end_device_points = {} - for volttron_point_name, point_definition in end_device.mappings.items(): - field_value = end_device.field_value(point_definition['IEEE 2030.5 Resource Name'], - point_definition['IEEE 2030.5 Field Name']) - end_device_points[volttron_point_name] = field_value - return end_device_points - except Exception as e: - raise IEEE2030_5Exception(e) - - @RPC.export - def set_point(self, sfdi, point_name, value): - _log.debug("EndDevice {0}: Setting {1} to {2}".format(sfdi, point_name, value)) - end_device = self.get_end_device(sfdi=sfdi) - try: - setattr(end_device, point_name, value) - except Exception as e: - raise IEEE2030_5Exception(e) - - @RPC.export - def config_points(self, sfdi, point_map): - _log.debug("EndDevice {0}: Configuring points: {1}".format(sfdi, point_map)) - end_device = self.get_end_device(sfdi=sfdi) - end_device.mappings = point_map - - ########################################################################## - # The following methods are callback functions for IEEE 2030.5 Endpoints # - ########################################################################## - - def dcap(self, env, data): - dcap = xsd_models.DeviceCapability( - EndDeviceListLink=xsd_models.EndDeviceListLink(), - MirrorUsagePointListLink=xsd_models.MirrorUsagePointListLink(), - SelfDeviceLink=xsd_models.SelfDeviceLink() - ) - dcap.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["dcap"].url) - - dcap.EndDeviceListLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["edev-list"].url) - dcap.SelfDeviceLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["sdev"].url) - - dcap.TimeLink = xsd_models.TimeLink() - dcap.TimeLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["tm"].url) - - dcap.MirrorUsagePointListLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["mup-list"].url) - - return IEEE2030_5Agent.prep_200_response({"result": dcap}) - - def sdev(self, env, data): - sdev = xsd_models.SelfDevice() - sdev.sFDI = xsd_models.SFDIType(valueOf_=int(self.IEEE2030_5_server_sfdi)) - sdev.loadShedDeviceCategory = xsd_models.DeviceCategoryType(valueOf_=self.load_shed_device_category) - sdev.DeviceInformationLink = xsd_models.DeviceInformationLink() - sdev.DeviceInformationLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["sdev-di"].url) - sdev.LogEventListLink = xsd_models.LogEventListLink() - sdev.LogEventListLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["sdev-log"].url) - sdev.LogEventListLink.set_all(1) - return IEEE2030_5Agent.prep_200_response({"result": sdev}) - - def sdev_di(self, env, data): - sep_device_information = xsd_models.DeviceInformation(lFDI=self.IEEE2030_5_server_lfdi) - return IEEE2030_5Agent.prep_200_response({"result": sep_device_information}) - - def sdev_log(self, env, data): - sep_log_event_list = xsd_models.LogEventList() - return IEEE2030_5Agent.prep_200_response({"result": sep_log_event_list}) - - def tm(self, env, data): - now_utc = datetime.utcnow().replace(tzinfo=pytz.utc) - local_tz = pytz.timezone(self.timezone) - now_local = datetime.now().replace(tzinfo=local_tz) - - start_dst_utc, end_dst_utc = [dt for dt in local_tz._utc_transition_times if dt.year == now_local.year] - - utc_offset = local_tz.utcoffset(start_dst_utc - timedelta(days=1)) - dst_offset = local_tz.utcoffset(start_dst_utc + timedelta(days=1)) - utc_offset - local_but_utc = datetime.now().replace(tzinfo=pytz.utc) - - tm = xsd_models.Time( - currentTime=IEEE2030_5Time(now_utc), - dstEndTime=IEEE2030_5Time(end_dst_utc.replace(tzinfo=pytz.utc)), - dstOffset=xsd_models.TimeOffsetType(valueOf_=int(dst_offset.total_seconds())), - dstStartTime=IEEE2030_5Time(start_dst_utc.replace(tzinfo=pytz.utc)), - localTime=IEEE2030_5Time(local_but_utc), - quality=IEEE2030_5.QUALITY_NTP, - tzOffset=xsd_models.TimeOffsetType(valueOf_=int(utc_offset.total_seconds())) - ) - tm.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["tm"].url) - return IEEE2030_5Agent.prep_200_response({"result": tm}) - - def edev_list(self, env, data): - device_list = xsd_models.EndDeviceList() - start, limit = parse_list_query(env['QUERY_STRING'].encode('ascii', 'ignore'), len(self.devices)) - - for i in range(start, limit): - device_list.add_EndDevice(self.devices[i].end_device) - - device_list.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["edev-list"].url) - device_list.set_results(max(0, len(range(start, limit)))) - device_list.set_all(len(self.devices)) - - return IEEE2030_5Agent.prep_200_response({'received_data': data, 'result': device_list}) - - def edev(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.EndDevice, attr_name="end_device") - - def edev_di(self, env, data): - return self.process_edev(env=env, data=data, - xsd_type=xsd_models.DeviceInformation, attr_name="device_information") - - def edev_dstat(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DeviceStatus, attr_name="device_status") - - def edev_fsa_list(self, env, data): - device = self.get_end_device(env['PATH_INFO']) - fsa_list = xsd_models.FunctionSetAssignmentsList() - fsa_list.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS["fsa-list"].url.format(device.id)) - fsa_list.add_FunctionSetAssignments(device.function_set_assignments) - fsa_list.set_all(1) - fsa_list.set_results(1) - return IEEE2030_5Agent.prep_200_response({"result": fsa_list}) - - def edev_fsa(self, env, data): - return self.process_edev(env=env, data=data, - xsd_type=xsd_models.FunctionSetAssignments, attr_name="function_set_assignments") - - def edev_ps(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.PowerStatus, attr_name="power_status") - - def edev_reg(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.Registration, attr_name="registration") - - def edev_der_list(self, env, data): - device = self.get_end_device(env['PATH_INFO']) - der_list = xsd_models.DERList() - der_list.set_all(1) - der_list.set_results(1) - der_list.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS["der-list"].url.format(device.id)) - der_list.add_DER(device.der) - return IEEE2030_5Agent.prep_200_response({"result": der_list}) - - def edev_der(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DER, attr_name="der") - - def edev_dera(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DERAvailability, attr_name="der_availability") - - def edev_derc_list(self, env, data): - device = self.get_end_device(env['PATH_INFO']) - derc_list = xsd_models.DERControlList() - derc_list.set_all(1) - derc_list.set_results(1) - derc_list.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS["derc-list"].url.format(device.id)) - derc_list.add_DERControl(device.der_control_xsd_object()) - return IEEE2030_5Agent.prep_200_response({"result": derc_list}) - - def edev_derc(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DERControl, attr_name="der_control") - - def edev_dercap(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DERCapability, attr_name="der_capability") - - def edev_derg(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DERSettings, attr_name="der_settings") - - def edev_derp_list(self, env, data): - device = self.get_end_device(env['PATH_INFO']) - derp_list = xsd_models.DERProgramList() - derp_list.set_all(1) - derp_list.set_results(1) - derp_list.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS["derp-list"].url.format(device.id)) - derp_list.add_DERProgram(device.der_program) - return IEEE2030_5Agent.prep_200_response({"result": derp_list}) - - def edev_derp(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DERProgram, attr_name="der_program") - - def edev_ders(self, env, data): - return self.process_edev(env=env, data=data, xsd_type=xsd_models.DERStatus, attr_name="der_status") - - def mup_list(self, env, data): - if env['REQUEST_METHOD'] in ('POST', 'PUT'): - endpoint = IEEE2030_5.IEEE2030_5_MUP_ENDPOINTS["mup"] - mup = xsd_models.parseString(data, silence=True) - device = self.get_end_device(lfdi=mup.get_deviceLFDI()) - if device.mup is None: - m = MUP(mup) - m.mup_xsd.set_href(endpoint.url.format(m.id)) - device.mup = m - self.mups.append(m) - if endpoint.url.format(m.id) not in self.vip.web._endpoints: - self.vip.web.register_endpoint(endpoint.url.format(m.id), getattr(self, endpoint.callback), "raw") - else: - IEEE2030_5Agent.add_meter_readings(device.mup, mup.get_MirrorMeterReading()) - - return [IEEE2030_5.STATUS_CODES[201], - '', - IEEE2030_5.XML_HEADERS+[("Location", endpoint.url.format(device.mup.id))]] - - else: - mup_list = xsd_models.MirrorUsagePointList() - - start, limit = parse_list_query(env['QUERY_STRING'].encode('ascii', 'ignore'), len(self.mups)) - - for i in range(start, limit): - mup_list.add_MirrorUsagePoint(self.mups[i].mup_xsd) - - mup_list.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["mup-list"].url) - mup_list.set_results(max(0, len(range(start, limit)))) - mup_list.set_all(len(self.mups)) - - return IEEE2030_5Agent.prep_200_response({"result": mup_list}) - - def mup(self, env, data): - mup_id = env['PATH_INFO'].split('/')[3] - mup = self.mups[int(mup_id)] - if env['REQUEST_METHOD'] in ('POST', 'PUT'): - device = self.get_end_device(lfdi=mup.mup_xsd.get_deviceLFDI()) - obj = xsd_models.parseString(data, silence=True) - if type(obj) == xsd_models.MirrorUsagePoint: - readings = obj.get_MirrorMeterReading() - elif type(obj) == xsd_models.MirrorMeterReading: - readings = [obj] - else: - _log.warning("Bad XML input for HTTP Endpoint.") - return [IEEE2030_5.STATUS_CODES[500], '', IEEE2030_5.XML_HEADERS] - IEEE2030_5Agent.add_meter_readings(device.mup, readings) - - return [IEEE2030_5.STATUS_CODES[201], - '', - IEEE2030_5.XML_HEADERS + [ - ("Location", IEEE2030_5.IEEE2030_5_MUP_ENDPOINTS["mup"].url.format(mup.id))]] - else: - xsd_object = getattr(mup, 'mup_xsd') - return IEEE2030_5Agent.prep_200_response({'received_data': data, 'result': xsd_object}) - - -def parse_list_query(query, length): - """Parses the IEEE 2030.5 query string parameters associated with list resources. - - There is some defensive code here to avoid errors on negative numbers. - - :param query: The request QUERY PARAMS dictionary - :param length: Length of the list - :return: (start index 0 based, limit) - xrange style - """ - params = {a[0]: a[1] for a in [x.split('=') for x in query.split("&")]} if len(query) > 0 else {} - start = max(0, int(params.get('s', '0'))) - limit = max(0, min(length, start + int(params.get('l', '255')))) - return start, limit - - -def main(): - """Main method called to start the agent.""" - utils.vip_main(IEEE2030_5_agent, identity='IEEE2030_5agent', - version=__version__) - - -if __name__ == '__main__': - # Entry point for script - try: - sys.exit(main()) - except KeyboardInterrupt: - pass diff --git a/services/core/IEEE2030_5Agent/IEEE2030_5/end_device.py b/services/core/IEEE2030_5Agent/IEEE2030_5/end_device.py deleted file mode 100644 index 5bd6f3ae49..0000000000 --- a/services/core/IEEE2030_5Agent/IEEE2030_5/end_device.py +++ /dev/null @@ -1,441 +0,0 @@ -# }}} - -from datetime import datetime, timedelta -import IEEE2030_5 -import calendar -import logging -import pytz -import io -import time -from . import xsd_models -from volttron.platform.agent import utils - -utils.setup_logging() -_log = logging.getLogger(__name__) - - -class EndDevice: - """ Object representing an End Device in IEEE 2030.5 - - End Devices talk with the IEEE 2030.5 Agent over HTTP using XML formatting. This End Device representation stores - configuration information about the End Device and exports that information as XSD Objects when various - endpoint urls are queried. - """ - enddevice_id = 0 - - def __init__(self, sfdi, lfdi, load_shed_device_category, pin_code): - """Representation of End Device object. - - :param sfdi: Short Form Device Identifier - :param lfdi: Long Form Device Identifier - :param load_shed_device_category: Load Shed Device Category - :param pin_code: Pin Code - """ - - # Basic Device Configurations - self.sfdi = sfdi - self.lfdi = lfdi - self.loadShedDeviceCategory = load_shed_device_category - self.pinCode = pin_code - self.registeredOn = datetime.utcnow().replace(tzinfo=pytz.utc) - - # Global Device ID. Updates as End Devices are registered. - self.id = EndDevice.enddevice_id - EndDevice.enddevice_id += 1 - - self.mappings = {} - - # IEEE 2030.5 Resource Initialization - self._end_device = xsd_models.EndDevice( - FunctionSetAssignmentsListLink=xsd_models.FunctionSetAssignmentsListLink(), - RegistrationLink=xsd_models.RegistrationLink(), - ) - self._end_device.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['edev'].url.format(self.id)) - self._end_device.sFDI = xsd_models.SFDIType(valueOf_=self.sfdi) - self._end_device.loadShedDeviceCategory = xsd_models.DeviceCategoryType(valueOf_=self.loadShedDeviceCategory) - self._end_device.FunctionSetAssignmentsListLink.\ - set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['fsa-list'].url.format(self.id)) - self._end_device.FunctionSetAssignmentsListLink.set_all(1) - self._end_device.RegistrationLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['reg'].url.format(self.id)) - self._end_device.DeviceInformationLink = xsd_models.DeviceInformationLink() - self._end_device.DeviceInformationLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['di'].url.format(self.id)) - self._end_device.DeviceStatusLink = xsd_models.DeviceStatus() - self._end_device.DeviceStatusLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['dstat'].url.format(self.id)) - self._end_device.PowerStatusLink = xsd_models.PowerStatusLink() - self._end_device.PowerStatusLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['ps'].url.format(self.id)) - self._end_device.DERListLink = xsd_models.DERListLink() - self._end_device.DERListLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['der-list'].url.format(self.id)) - self._end_device.DERListLink.set_all(1) - - self._device_information = xsd_models.DeviceInformation() - self._device_status = xsd_models.DeviceStatus() - self._power_status = xsd_models.PowerStatus() - - self._function_set_assignments = xsd_models.FunctionSetAssignments( - subscribable='0', - mRID=xsd_models.mRIDType(valueOf_=mrid_helper(self.id, IEEE2030_5.MRID_SUFFIX_FUNCTION_SET_ASSIGNMENT)), - description="FSA", - ) - self._function_set_assignments.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS["fsa"].url.format(self.id)) - self._function_set_assignments.DERProgramListLink = xsd_models.DERProgramListLink() - self._function_set_assignments.DERProgramListLink.\ - set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS["derp-list"].url.format(self.id)) - self._function_set_assignments.DERProgramListLink.set_all(1) - self._function_set_assignments.TimeLink = xsd_models.TimeLink() - self._function_set_assignments.TimeLink.set_href(IEEE2030_5.IEEE2030_5_ENDPOINTS["tm"].url) - - self._registration = xsd_models.Registration( - dateTimeRegistered=IEEE2030_5Time(self.registeredOn), - pIN=xsd_models.PINType(valueOf_=int(self.pinCode))) - self._registration.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['reg'].url.format(self.id)) - - self._der = xsd_models.DER( - AssociatedDERProgramListLink=xsd_models.AssociatedDERProgramListLink(), - CurrentDERProgramLink=xsd_models.CurrentDERProgramLink(), - DERAvailabilityLink=xsd_models.DERAvailabilityLink(), - DERCapabilityLink=xsd_models.DERCapabilityLink(), - DERSettingsLink=xsd_models.DERSettingsLink(), - DERStatusLink=xsd_models.DERStatusLink() - ) - self._der.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['der'].url.format(self.id)) - self._der.AssociatedDERProgramListLink.set_href( - IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derp-list'].url.format(self.id)) - self._der.AssociatedDERProgramListLink.set_all(1) - self._der.CurrentDERProgramLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derp'].url.format(self.id)) - self._der.DERAvailabilityLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['dera'].url.format(self.id)) - self._der.DERCapabilityLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['dercap'].url.format(self.id)) - self._der.DERSettingsLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derg'].url.format(self.id)) - self._der.DERStatusLink.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['ders'].url.format(self.id)) - - self._der_program = xsd_models.DERProgram( - DERControlListLink=xsd_models.DERControlListLink(), - primacy=xsd_models.PrimacyType(valueOf_=1) - ) - self._der_program.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derp'].url.format(self.id)) - self._der_program.set_mRID( - xsd_models.mRIDType(valueOf_=mrid_helper(self.id, IEEE2030_5.MRID_SUFFIX_DER_PROGRAM))) - self._der_program.set_version(xsd_models.VersionType(valueOf_='0')) - self._der_program.set_description("DER Program") - self._der_program.DERControlListLink.set_href( - IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derc-list'].url.format(self.id)) - self._der_program.DERControlListLink.set_all(1) - - self._der_settings = xsd_models.DERSettings() - self._der_capability = xsd_models.DERCapability() - self._der_status = xsd_models.DERStatus() - self._der_availability = xsd_models.DERAvailability() - - self._der_control = xsd_models.DERControl(DERControlBase=xsd_models.DERControlBase()) - self._der_control.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derc'].url.format(self.id)) - self._der_control.set_description("DER Control") - - self._mup = None - - def meter_reading_helper(self, attr_name): - """ Helper method for attributes that use meter readings - - :param attr_name: Name of SunSpec attribute - :return: Value of IEEE 2030.5 Meter Reading correlated with SunSpec attribute - """ - if self.mup is not None: - for reading in self.mup.mup_xsd.get_MirrorMeterReading(): - if reading.get_description() == attr_name: - power_of_ten = reading.get_ReadingType() - value = reading.get_Reading().get_value() - return float(value) * pow(10, int(power_of_ten.get_powerOfTenMultiplier().get_valueOf_())) \ - if power_of_ten is not None else float(value) - return None - - ##################################################################### - # Currently WChaMax is the only SunSpec register we support # - # writing to. Because of the way IEEE 2030.5 is set up, we can read # - # any register by giving it a proper IEEE 2030.5 resource and field # - # but writing to registers will require special agent config # - ##################################################################### - - def b124_WChaMax(self, value): - now = datetime.utcnow().replace(tzinfo=pytz.utc) - mrid = mrid_helper(self.id, int(time.mktime(now.timetuple()))) - self.der_control.get_DERControlBase().set_opModFixedFlow(xsd_models.SignedPerCent(valueOf_=value)) - self.der_control.set_mRID(xsd_models.mRIDType(valueOf_=mrid)) - self.der_control.set_creationTime(IEEE2030_5Time(now)) - self.der_control.set_EventStatus(xsd_models.EventStatus( - currentStatus=IEEE2030_5.EVENT_STATUS_ACTIVE, - dateTime=IEEE2030_5Time(now), - potentiallySuperseded=True, - potentiallySupersededTime=IEEE2030_5Time(now), - reason="Dispatch" - )) - self.der_control.set_interval(xsd_models.DateTimeInterval(duration=3600 * 24, start=IEEE2030_5Time(now))) - - def field_value(self, resource, field): - """ Given a IEEE 2030.5 field name, return the value of that field. - :param resource: IEEE 2030.5 resource name - :param field: IEEE 2030.5 field name (may be dotted notation if a nested field) - :return: field value - """ - - # Special Corner cases that exist outside of official IEEE 2030.5 fields - if field == 'sFDI': - return self.sfdi - elif field == 'SOC': - _log.debug('Calculating DERAvailability.soc...') - if self.field_value("DERAvailability", "availabilityDuration") is not None and \ - self.field_value("DERSettings", "setMaxChargeRate") is not None: - duration = self.field_value("DERAvailability", "availabilityDuration") / 3600.0 - max_charge = self.field_value("DERSettings", "setMaxChargeRate") - soc = duration * max_charge - else: - soc = None - return soc - - # Translate from IEEE 2030.5 resource (DeviceInformation) to EndDevice attribute (device_information) - converted_resource = IEEE2030_5.RESOURCE_MAPPING[resource] - if hasattr(self, converted_resource): - IEEE2030_5_resource = getattr(self, converted_resource) - else: - raise AttributeError("{} is not a valid IEEE 2030.5 Resource".format(resource)) - - # MUPs have special case handling - if converted_resource == "mup": - return self.meter_reading_helper(field) - - IEEE2030_5_field = self.get_field(IEEE2030_5_resource, field) - if hasattr(IEEE2030_5_field, 'value'): - field_value = IEEE2030_5_field.value - if hasattr(IEEE2030_5_field, 'multiplier') and type(IEEE2030_5_field.multiplier) == \ - xsd_models.PowerOfTenMultiplierType: - field_value = float(field_value) * pow(10, int(IEEE2030_5_field.multiplier.get_valueOf_())) - elif type(field_value) == xsd_models.PerCent: - field_value = int(field_value.get_valueOf_()) / 100.0 - else: - # Depending on field choice, this could be a nested xsd model, not JSON serializable. - pass - else: - field_value = IEEE2030_5_field - - return field_value - - @staticmethod - def get_field(resource, field): - """ Recursive helper method to retrieve field from IEEE 2030.5 resource - - If IEEE 2030.5 fields have not been defined, this method will return None - - :param resource: IEEE 2030.5 resource (xsd_models object) - :param field: IEEE 2030.5 field name - :return: value of field - """ - fields = field.split('.', 1) - if len(fields) == 1: - IEEE2030_5_field = getattr(resource, field, None) - else: - meta_field = getattr(resource, fields[0], None) - IEEE2030_5_field = EndDevice.get_field(meta_field, fields[1]) if meta_field else None - return IEEE2030_5_field - - ############################################################ - # XSD Object representation methods. # - # These objects represent various IEEE2030_5 Resources. # - # These Resource objects mirror HTTP request GET and POSTS # - ############################################################ - - @property - def end_device(self): - return self._end_device - - @property - def device_information(self): - return self._device_information - - @device_information.setter - def device_information(self, value): - self._device_information = value - self._device_information.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['di'].url.format(self.id)) - - @property - def device_status(self): - return self._device_status - - @device_status.setter - def device_status(self, value): - self._device_status = value - self._device_status.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['dstat'].url.format(self.id)) - - @property - def function_set_assignments(self): - return self._function_set_assignments - - @property - def power_status(self): - return self._power_status - - @power_status.setter - def power_status(self, value): - self._power_status = value - self._power_status.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['ps'].url.format(self.id)) - - @property - def registration(self): - return self._registration - - @property - def der(self): - return self._der - - @property - def der_program(self): - return self._der_program - - @property - def der_control(self): - return self._der_control - - @property - def der_availability(self): - return self._der_availability - - @der_availability.setter - def der_availability(self, value): - self._der_availability = value - self._der_availability.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['dera'].url.format(self.id)) - - @property - def der_capability(self): - return self._der_capability - - @der_capability.setter - def der_capability(self, value): - self._der_capability = value - self._der_capability.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['dercap'].url.format(self.id)) - - @property - def der_status(self): - return self._der_status - - @der_status.setter - def der_status(self, value): - self._der_status = value - self._der_status.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['ders'].url.format(self.id)) - - @property - def der_settings(self): - return self._der_settings - - @der_settings.setter - def der_settings(self, value): - self._der_settings = value - self._der_settings.set_href(IEEE2030_5.IEEE2030_5_EDEV_ENDPOINTS['derg'].url.format(self.id)) - - @property - def mup(self): - return self._mup - - @mup.setter - def mup(self, value): - self._mup = value - - -class MUP: - """ Object representing an MUP in IEEE2030_5 """ - mup_id = 0 - - def __init__(self, xsd): - self.id = MUP.mup_id - MUP.mup_id += 1 - self.mup_xsd = xsd - - -class IEEE2030_5Renderer: - """ Takes IEEE 2030.5 Type objects and renders them as XML formatted data for HTTP response. """ - - media_type = 'application/sep+xml' - - @staticmethod - def export(xsd_object, make_pretty=True): - """Export IEEE 2030.5 object into serializable XML - - :param xsd_object: IEEE 2030.5 object to export - :param make_pretty: Boolean value determining whether or not to use newline characters between XML elements. - - :return: String of XML serialized data. - """ - buff = io.StringIO() - xsd_object.export( - buff, - 1, - namespacedef_='xmlns="http://zigbee.org/sep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', - pretty_print=make_pretty - ) - return buff.getvalue() - - @staticmethod - def render(data): - """ Wrapper function around the export method. - - :param data: XSD object to render. Empty string if data does not come in correctly. - :return: Formatted XML string. - """ - if data is None: - return '' - - if 'rendered_result' not in data: - if 'result' not in data: - data['rendered_result'] = '' - else: - make_pretty = True - data['rendered_result'] = IEEE2030_5Renderer.export(data['result'], make_pretty) - - return data['rendered_result'] - - -class IEEE2030_5Parser: - """ Takes XML formatted string and renders it as an XSD object. """ - media_type = 'application/sep+xml' - - @staticmethod - def parse(stream): - """ Parses the incoming bytestream as XML and returns the resulting data. """ - return xsd_models.parseString(stream, silence=True) - - -def mrid_helper(edev_pk, resource_suffix): - """ Helper method to create universally unique ID for any resource object - - :param edev_pk: Primary Key of End Device object - :param resource_suffix: Suffix to add to hash to create unique ID - :return: UUID (MRID) value. (In hex-decimal) - """ - hex_string = hex(int(edev_pk)*10000000000000+resource_suffix*100)[2:].upper() - if hex_string.endswith('L'): - hex_string = hex_string[:-1] - if (len(hex_string)) % 2 == 1: - hex_string = "0{0}".format(hex_string) - return hex_string - - -def IEEE2030_5Time(dt_obj, local=False): - """ Return a proper IEEE2030_5 TimeType object for the dt_obj passed in. - - From IEEE 2030.5 spec: - TimeType Object (Int64) - Time is a signed 64 bit value representing the number of seconds - since 0 hours, 0 minutes, 0 seconds, on the 1st of January, 1970, - in UTC, not counting leap seconds. - - :param dt_obj: Datetime object to convert to IEEE2030_5 TimeType object. - :param local: dt_obj is in UTC or Local time. Default to UTC time. - :return: Time XSD object - :raises: If utc_dt_obj is not UTC - """ - - if dt_obj.tzinfo is None: - raise Exception("IEEE 2030.5 times should be timezone aware UTC or local") - - if dt_obj.utcoffset() != timedelta(0) and not local: - raise Exception("IEEE 2030.5 TimeType should be based on UTC") - - if local: - return xsd_models.TimeType(valueOf_=int(time.mktime(dt_obj.timetuple()))) - else: - return xsd_models.TimeType(valueOf_=int(calendar.timegm(dt_obj.timetuple()))) diff --git a/services/core/IEEE2030_5Agent/IEEE2030_5/xsd_models.py b/services/core/IEEE2030_5Agent/IEEE2030_5/xsd_models.py deleted file mode 100644 index 8d76e5a883..0000000000 --- a/services/core/IEEE2030_5Agent/IEEE2030_5/xsd_models.py +++ /dev/null @@ -1,35078 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Generated Sat Oct 11 16:09:18 2014 by generateDS.py version 2.13a. -# -# Command line options: -# ('-o', 'xsd_models.py') -# -# Command line arguments: -# sep.xsd -# -# Command line: -# generateDS.py -o "xsd_models.py" sep.xsd -# -# Current working directory (os.getcwd()): -# sep2 -# - -import sys -import getopt -import re as re_ -import base64 -import datetime as datetime_ - -etree_ = None -Verbose_import_ = False -( - XMLParser_import_none, XMLParser_import_lxml, - XMLParser_import_elementtree -) = list(range(3)) -XMLParser_import_library = None -try: - # lxml - from lxml import etree as etree_ - XMLParser_import_library = XMLParser_import_lxml - if Verbose_import_: - print("running with lxml.etree") -except ImportError: - try: - # cElementTree from Python 2.5+ - import xml.etree.cElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with cElementTree on Python 2.5+") - except ImportError: - try: - # ElementTree from Python 2.5+ - import xml.etree.ElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with ElementTree on Python 2.5+") - except ImportError: - try: - # normal cElementTree install - import cElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with cElementTree") - except ImportError: - try: - # normal ElementTree install - import elementtree.ElementTree as etree_ - XMLParser_import_library = XMLParser_import_elementtree - if Verbose_import_: - print("running with ElementTree") - except ImportError: - raise ImportError( - "Failed to import ElementTree from any known place") - - -def parsexml_(*args, **kwargs): - if (XMLParser_import_library == XMLParser_import_lxml and - 'parser' not in kwargs): - # Use the lxml ElementTree compatible parser so that, e.g., - # we ignore comments. - kwargs['parser'] = etree_.ETCompatXMLParser() - doc = etree_.parse(*args, **kwargs) - return doc - -# -# User methods -# -# Calls to the methods in these classes are generated by generateDS.py. -# You can replace these methods by re-implementing the following class -# in a module named generatedssuper.py. - -try: - from generatedssuper import GeneratedsSuper -except ImportError as exp: - - class GeneratedsSuper: - tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') - class _FixedOffsetTZ(datetime_.tzinfo): - def __init__(self, offset, name): #pylint: disable=super-init-not-called - self.__offset = datetime_.timedelta(minutes=offset) - self.__name = name - def utcoffset(self, dt): - return self.__offset - def tzname(self, dt): - return self.__name - def dst(self, dt): - return None - def gds_format_string(self, input_data, input_name=''): - return input_data - def gds_validate_string(self, input_data, node, input_name=''): - if not input_data: - return '' - else: - return input_data - def gds_format_base64(self, input_data, input_name=''): - return base64.b64encode(input_data) - def gds_validate_base64(self, input_data, node, input_name=''): - return input_data - def gds_format_integer(self, input_data, input_name=''): - return '%d' % input_data - def gds_validate_integer(self, input_data, node, input_name=''): - return input_data - def gds_format_integer_list(self, input_data, input_name=''): - return '%s' % input_data - def gds_validate_integer_list(self, input_data, node, input_name=''): - values = input_data.split() - for value in values: - try: - float(value) - except (TypeError, ValueError): - raise_parse_error(node, 'Requires sequence of integers') - return input_data - def gds_format_float(self, input_data, input_name=''): - return ('%.15f' % input_data).rstrip('0') - def gds_validate_float(self, input_data, node, input_name=''): - return input_data - def gds_format_float_list(self, input_data, input_name=''): - return '%s' % input_data - def gds_validate_float_list(self, input_data, node, input_name=''): - values = input_data.split() - for value in values: - try: - float(value) - except (TypeError, ValueError): - raise_parse_error(node, 'Requires sequence of floats') - return input_data - def gds_format_double(self, input_data, input_name=''): - return '%e' % input_data - def gds_validate_double(self, input_data, node, input_name=''): - return input_data - def gds_format_double_list(self, input_data, input_name=''): - return '%s' % input_data - def gds_validate_double_list(self, input_data, node, input_name=''): - values = input_data.split() - for value in values: - try: - float(value) - except (TypeError, ValueError): - raise_parse_error(node, 'Requires sequence of doubles') - return input_data - def gds_format_boolean(self, input_data, input_name=''): - return ('%s' % input_data).lower() - def gds_validate_boolean(self, input_data, node, input_name=''): - return input_data - def gds_format_boolean_list(self, input_data, input_name=''): - return '%s' % input_data - def gds_validate_boolean_list(self, input_data, node, input_name=''): - values = input_data.split() - for value in values: - if value not in ('true', '1', 'false', '0', ): - raise_parse_error( - node, - 'Requires sequence of booleans ' - '("true", "1", "false", "0")') - return input_data - def gds_validate_datetime(self, input_data, node, input_name=''): - return input_data - def gds_format_datetime(self, input_data, input_name=''): - if input_data.microsecond == 0: - _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( - input_data.year, - input_data.month, - input_data.day, - input_data.hour, - input_data.minute, - input_data.second, - ) - else: - _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( - input_data.year, - input_data.month, - input_data.day, - input_data.hour, - input_data.minute, - input_data.second, - ('%f' % (float(input_data.microsecond) / 1000000))[2:], - ) - if input_data.tzinfo is not None: - tzoff = input_data.tzinfo.utcoffset(input_data) - if tzoff is not None: - total_seconds = tzoff.seconds + (86400 * tzoff.days) - if total_seconds == 0: - _svalue += 'Z' - else: - if total_seconds < 0: - _svalue += '-' - total_seconds *= -1 - else: - _svalue += '+' - hours = total_seconds // 3600 - minutes = (total_seconds - (hours * 3600)) // 60 - _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) - return _svalue - @classmethod - def gds_parse_datetime(cls, input_data): - tz = None - if input_data[-1] == 'Z': - tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') - input_data = input_data[:-1] - else: - results = GeneratedsSuper.tzoff_pattern.search(input_data) - if results is not None: - tzoff_parts = results.group(2).split(':') - tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) - if results.group(1) == '-': - tzoff *= -1 - tz = GeneratedsSuper._FixedOffsetTZ( - tzoff, results.group(0)) - input_data = input_data[:-6] - time_parts = input_data.split('.') - if len(time_parts) > 1: - micro_seconds = int(float('0.' + time_parts[1]) * 1000000) - input_data = '%s.%s' % (time_parts[0], micro_seconds, ) - dt = datetime_.datetime.strptime( - input_data, '%Y-%m-%dT%H:%M:%S.%f') - else: - dt = datetime_.datetime.strptime( - input_data, '%Y-%m-%dT%H:%M:%S') - dt = dt.replace(tzinfo=tz) - return dt - def gds_validate_date(self, input_data, node, input_name=''): - return input_data - def gds_format_date(self, input_data, input_name=''): - _svalue = '%04d-%02d-%02d' % ( - input_data.year, - input_data.month, - input_data.day, - ) - try: - if input_data.tzinfo is not None: - tzoff = input_data.tzinfo.utcoffset(input_data) - if tzoff is not None: - total_seconds = tzoff.seconds + (86400 * tzoff.days) - if total_seconds == 0: - _svalue += 'Z' - else: - if total_seconds < 0: - _svalue += '-' - total_seconds *= -1 - else: - _svalue += '+' - hours = total_seconds // 3600 - minutes = (total_seconds - (hours * 3600)) // 60 - _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) - except AttributeError: - pass - return _svalue - @classmethod - def gds_parse_date(cls, input_data): - tz = None - if input_data[-1] == 'Z': - tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') - input_data = input_data[:-1] - else: - results = GeneratedsSuper.tzoff_pattern.search(input_data) - if results is not None: - tzoff_parts = results.group(2).split(':') - tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) - if results.group(1) == '-': - tzoff *= -1 - tz = GeneratedsSuper._FixedOffsetTZ( - tzoff, results.group(0)) - input_data = input_data[:-6] - dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') - dt = dt.replace(tzinfo=tz) - return dt.date() - def gds_validate_time(self, input_data, node, input_name=''): - return input_data - def gds_format_time(self, input_data, input_name=''): - if input_data.microsecond == 0: - _svalue = '%02d:%02d:%02d' % ( - input_data.hour, - input_data.minute, - input_data.second, - ) - else: - _svalue = '%02d:%02d:%02d.%s' % ( - input_data.hour, - input_data.minute, - input_data.second, - ('%f' % (float(input_data.microsecond) / 1000000))[2:], - ) - if input_data.tzinfo is not None: - tzoff = input_data.tzinfo.utcoffset(input_data) - if tzoff is not None: - total_seconds = tzoff.seconds + (86400 * tzoff.days) - if total_seconds == 0: - _svalue += 'Z' - else: - if total_seconds < 0: - _svalue += '-' - total_seconds *= -1 - else: - _svalue += '+' - hours = total_seconds // 3600 - minutes = (total_seconds - (hours * 3600)) // 60 - _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) - return _svalue - @classmethod - def gds_parse_time(cls, input_data): - tz = None - if input_data[-1] == 'Z': - tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') - input_data = input_data[:-1] - else: - results = GeneratedsSuper.tzoff_pattern.search(input_data) - if results is not None: - tzoff_parts = results.group(2).split(':') - tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) - if results.group(1) == '-': - tzoff *= -1 - tz = GeneratedsSuper._FixedOffsetTZ( - tzoff, results.group(0)) - input_data = input_data[:-6] - if len(input_data.split('.')) > 1: - dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') - else: - dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') - dt = dt.replace(tzinfo=tz) - return dt.time() - def gds_str_lower(self, instring): - return instring.lower() - def get_path_(self, node): - path_list = [] - self.get_path_list_(node, path_list) - path_list.reverse() - path = '/'.join(path_list) - return path - Tag_strip_pattern_ = re_.compile(r'\{.*\}') - def get_path_list_(self, node, path_list): - if node is None: - return - tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) - if tag: - path_list.append(tag) - self.get_path_list_(node.getparent(), path_list) - def get_class_obj_(self, node, default_class=None): - class_obj1 = default_class - if 'xsi' in node.nsmap: - classname = node.get('{%s}type' % node.nsmap['xsi']) - if classname is not None: - names = classname.split(':') - if len(names) == 2: - classname = names[1] - class_obj2 = globals().get(classname) - if class_obj2 is not None: - class_obj1 = class_obj2 - return class_obj1 - def gds_build_any(self, node, type_name=None): - return None - @classmethod - def gds_reverse_node_mapping(cls, mapping): - return dict(((v, k) for k, v in mapping.items())) - - -# -# If you have installed IPython you can uncomment and use the following. -# IPython is available from http://ipython.scipy.org/. -# - -## from IPython.Shell import IPShellEmbed -## args = '' -## ipshell = IPShellEmbed(args, -## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') - -# Then use the following line where and when you want to drop into the -# IPython shell: -# ipshell(' -- Entering ipshell.\nHit Ctrl-D to exit') - -# -# Globals -# - -ExternalEncoding = 'ascii' -Tag_pattern_ = re_.compile(r'({.*})?(.*)') -String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") -Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') - -# -# Support/utility functions. -# - - -def showIndent(outfile, level, pretty_print=True): - if pretty_print: - for idx in range(level): - outfile.write(' ') - - -def quote_xml(inStr): - if not inStr: - return '' - s1 = (isinstance(inStr, str) and inStr or - '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - return s1 - - -def quote_attrib(inStr): - s1 = (isinstance(inStr, str) and inStr or - '%s' % inStr) - s1 = s1.replace('&', '&') - s1 = s1.replace('<', '<') - s1 = s1.replace('>', '>') - if '"' in s1: - if "'" in s1: - s1 = '"%s"' % s1.replace('"', """) - else: - s1 = "'%s'" % s1 - else: - s1 = '"%s"' % s1 - return s1 - - -def quote_python(inStr): - s1 = inStr - if s1.find("'") == -1: - if s1.find('\n') == -1: - return "'%s'" % s1 - else: - return "'''%s'''" % s1 - else: - if s1.find('"') != -1: - s1 = s1.replace('"', '\\"') - if s1.find('\n') == -1: - return '"%s"' % s1 - else: - return '"""%s"""' % s1 - - -def get_all_text_(node): - if node.text is not None: - text = node.text - else: - text = '' - for child in node: - if child.tail is not None: - text += child.tail - return text - - -def find_attr_value_(attr_name, node): - attrs = node.attrib - attr_parts = attr_name.split(':') - value = None - if len(attr_parts) == 1: - value = attrs.get(attr_name) - elif len(attr_parts) == 2: - prefix, name = attr_parts - namespace = node.nsmap.get(prefix) - if namespace is not None: - value = attrs.get('{%s}%s' % (namespace, name, )) - return value - - -class GDSParseError(Exception): - pass - - -def raise_parse_error(node, msg): - if XMLParser_import_library == XMLParser_import_lxml: - msg = '%s (element %s/line %d)' % ( - msg, node.tag, node.sourceline, ) - else: - msg = '%s (element %s)' % (msg, node.tag, ) - raise GDSParseError(msg) - - -class MixedContainer: - # Constants for category: - CategoryNone = 0 - CategoryText = 1 - CategorySimple = 2 - CategoryComplex = 3 - # Constants for content_type: - TypeNone = 0 - TypeText = 1 - TypeString = 2 - TypeInteger = 3 - TypeFloat = 4 - TypeDecimal = 5 - TypeDouble = 6 - TypeBoolean = 7 - TypeBase64 = 8 - def __init__(self, category, content_type, name, value): - self.category = category - self.content_type = content_type - self.name = name - self.value = value - def getCategory(self): - return self.category - def getContenttype(self, content_type): - return self.content_type - def getValue(self): - return self.value - def getName(self): - return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): - if self.category == MixedContainer.CategoryText: - # Prevent exporting empty content as empty lines. - if self.value.strip(): - outfile.write(self.value) - elif self.category == MixedContainer.CategorySimple: - self.exportSimple(outfile, level, name) - else: # category == MixedContainer.CategoryComplex - self.value.export(outfile, level, namespace, name, pretty_print) - def exportSimple(self, outfile, level, name): - if self.content_type == MixedContainer.TypeString: - outfile.write('<%s>%s' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeInteger or \ - self.content_type == MixedContainer.TypeBoolean: - outfile.write('<%s>%d' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeFloat or \ - self.content_type == MixedContainer.TypeDecimal: - outfile.write('<%s>%f' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeDouble: - outfile.write('<%s>%g' % ( - self.name, self.value, self.name)) - elif self.content_type == MixedContainer.TypeBase64: - outfile.write('<%s>%s' % ( - self.name, base64.b64encode(self.value), self.name)) - def to_etree(self, element): - if self.category == MixedContainer.CategoryText: - # Prevent exporting empty content as empty lines. - if self.value.strip(): - if len(element) > 0: - if element[-1].tail is None: - element[-1].tail = self.value - else: - element[-1].tail += self.value - else: - if element.text is None: - element.text = self.value - else: - element.text += self.value - elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) - subelement.text = self.to_etree_simple() - else: # category == MixedContainer.CategoryComplex - self.value.to_etree(element) - def to_etree_simple(self): - if self.content_type == MixedContainer.TypeString: - text = self.value - elif (self.content_type == MixedContainer.TypeInteger or - self.content_type == MixedContainer.TypeBoolean): - text = '%d' % self.value - elif (self.content_type == MixedContainer.TypeFloat or - self.content_type == MixedContainer.TypeDecimal): - text = '%f' % self.value - elif self.content_type == MixedContainer.TypeDouble: - text = '%g' % self.value - elif self.content_type == MixedContainer.TypeBase64: - text = '%s' % base64.b64encode(self.value) - return text - def exportLiteral(self, outfile, level, name): - if self.category == MixedContainer.CategoryText: - showIndent(outfile, level) - outfile.write( - 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) - elif self.category == MixedContainer.CategorySimple: - showIndent(outfile, level) - outfile.write( - 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) - else: # category == MixedContainer.CategoryComplex - showIndent(outfile, level) - outfile.write( - 'model_.MixedContainer(%d, %d, "%s",\n' % ( - self.category, self.content_type, self.name,)) - self.value.exportLiteral(outfile, level + 1) - showIndent(outfile, level) - outfile.write(')\n') - - -class MemberSpec_: - def __init__(self, name='', data_type='', container=0): - self.name = name - self.data_type = data_type - self.container = container - def set_name(self, name): self.name = name - def get_name(self): return self.name - def set_data_type(self, data_type): self.data_type = data_type - def get_data_type_chain(self): return self.data_type - def get_data_type(self): - if isinstance(self.data_type, list): - if len(self.data_type) > 0: - return self.data_type[-1] - else: - return 'xs:string' - else: - return self.data_type - def set_container(self, container): self.container = container - def get_container(self): return self.container - - -def _cast(typ, value): - if typ is None or value is None: - return value - return typ(value) - -# -# Data representation classes. -# - - -class Temperature(GeneratedsSuper): - """Specification of a temperature.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, subject=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.subject = subject - self.value = value - def factory(*args_, **kwargs_): - if Temperature.subclass: - return Temperature.subclass(*args_, **kwargs_) - else: - return Temperature(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_subject(self): return self.subject - def set_subject(self, subject): self.subject = subject - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_Int16(self, value): - # Validate type Int16, a restriction on xs:short. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.subject is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Temperature', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Temperature') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Temperature', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Temperature'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Temperature', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.subject is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssubject>%s%s' % (namespace_, self.gds_format_integer(self.subject, input_name='subject'), namespace_, eol_)) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Temperature'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.subject is not None: - showIndent(outfile, level) - outfile.write('subject=%d,\n' % self.subject) - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'subject': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'subject') - self.subject = ival_ - self.validate_UInt8(self.subject) # validate type UInt8 - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int16(self.value) # validate type Int16 -# end class Temperature - - -class Condition(GeneratedsSuper): - """Indicates a condition that must be satisfied for the Notification to - be triggered.""" - subclass = None - superclass = None - def __init__(self, attributeIdentifier=None, lowerThreshold=None, upperThreshold=None): - self.original_tagname_ = None - self.attributeIdentifier = attributeIdentifier - self.lowerThreshold = lowerThreshold - self.upperThreshold = upperThreshold - def factory(*args_, **kwargs_): - if Condition.subclass: - return Condition.subclass(*args_, **kwargs_) - else: - return Condition(*args_, **kwargs_) - factory = staticmethod(factory) - def get_attributeIdentifier(self): return self.attributeIdentifier - def set_attributeIdentifier(self, attributeIdentifier): self.attributeIdentifier = attributeIdentifier - def get_lowerThreshold(self): return self.lowerThreshold - def set_lowerThreshold(self, lowerThreshold): self.lowerThreshold = lowerThreshold - def get_upperThreshold(self): return self.upperThreshold - def set_upperThreshold(self, upperThreshold): self.upperThreshold = upperThreshold - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_Int48(self, value): - # Validate type Int48, a restriction on xs:long. - pass - def hasContent_(self): - if ( - self.attributeIdentifier is not None or - self.lowerThreshold is not None or - self.upperThreshold is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Condition', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Condition') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Condition', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Condition'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Condition', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.attributeIdentifier is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sattributeIdentifier>%s%s' % (namespace_, self.gds_format_integer(self.attributeIdentifier, input_name='attributeIdentifier'), namespace_, eol_)) - if self.lowerThreshold is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slowerThreshold>%s%s' % (namespace_, self.gds_format_integer(self.lowerThreshold, input_name='lowerThreshold'), namespace_, eol_)) - if self.upperThreshold is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%supperThreshold>%s%s' % (namespace_, self.gds_format_integer(self.upperThreshold, input_name='upperThreshold'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Condition'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.attributeIdentifier is not None: - showIndent(outfile, level) - outfile.write('attributeIdentifier=%d,\n' % self.attributeIdentifier) - if self.lowerThreshold is not None: - showIndent(outfile, level) - outfile.write('lowerThreshold=%d,\n' % self.lowerThreshold) - if self.upperThreshold is not None: - showIndent(outfile, level) - outfile.write('upperThreshold=%d,\n' % self.upperThreshold) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'attributeIdentifier': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'attributeIdentifier') - self.attributeIdentifier = ival_ - self.validate_UInt8(self.attributeIdentifier) # validate type UInt8 - elif nodeName_ == 'lowerThreshold': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'lowerThreshold') - self.lowerThreshold = ival_ - self.validate_Int48(self.lowerThreshold) # validate type Int48 - elif nodeName_ == 'upperThreshold': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'upperThreshold') - self.upperThreshold = ival_ - self.validate_Int48(self.upperThreshold) # validate type Int48 -# end class Condition - - -class AppliedTargetReduction(GeneratedsSuper): - """Specifies the value of the TargetReduction applied by the device.""" - subclass = None - superclass = None - def __init__(self, type_=None, value=None): - self.original_tagname_ = None - self.type_ = type_ - self.value = value - def factory(*args_, **kwargs_): - if AppliedTargetReduction.subclass: - return AppliedTargetReduction.subclass(*args_, **kwargs_) - else: - return AppliedTargetReduction(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.type_ is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AppliedTargetReduction', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AppliedTargetReduction') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AppliedTargetReduction', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AppliedTargetReduction'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='AppliedTargetReduction', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.type_ is not None: - self.type_.export(outfile, level, namespace_, name_='type', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='AppliedTargetReduction'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.type_ is not None: - showIndent(outfile, level) - outfile.write('type_=model_.UnitType(\n') - self.type_.exportLiteral(outfile, level, name_='type') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'type': - obj_ = UnitType.factory() - obj_.build(child_) - self.type_ = obj_ - obj_.original_tagname_ = 'type' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class AppliedTargetReduction - - -class DRLCCapabilities(GeneratedsSuper): - """Contains information about the static capabilities of the device, to - allow service providers to know what types of functions are - supported, what the normal operating ranges and limits are, and - other similar information, in order to provide better - suggestions of applicable programs to receive the maximum - benefit.""" - subclass = None - superclass = None - def __init__(self, averageEnergy=None, maxDemand=None, optionsImplemented=None): - self.original_tagname_ = None - self.averageEnergy = averageEnergy - self.maxDemand = maxDemand - self.optionsImplemented = optionsImplemented - def factory(*args_, **kwargs_): - if DRLCCapabilities.subclass: - return DRLCCapabilities.subclass(*args_, **kwargs_) - else: - return DRLCCapabilities(*args_, **kwargs_) - factory = staticmethod(factory) - def get_averageEnergy(self): return self.averageEnergy - def set_averageEnergy(self, averageEnergy): self.averageEnergy = averageEnergy - def get_maxDemand(self): return self.maxDemand - def set_maxDemand(self, maxDemand): self.maxDemand = maxDemand - def get_optionsImplemented(self): return self.optionsImplemented - def set_optionsImplemented(self, optionsImplemented): self.optionsImplemented = optionsImplemented - def validate_HexBinary32(self, value): - # Validate type HexBinary32, a restriction on xs:hexBinary. - pass - def hasContent_(self): - if ( - self.averageEnergy is not None or - self.maxDemand is not None or - self.optionsImplemented is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DRLCCapabilities', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DRLCCapabilities') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DRLCCapabilities', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DRLCCapabilities'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DRLCCapabilities', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.averageEnergy is not None: - self.averageEnergy.export(outfile, level, namespace_, name_='averageEnergy', pretty_print=pretty_print) - if self.maxDemand is not None: - self.maxDemand.export(outfile, level, namespace_, name_='maxDemand', pretty_print=pretty_print) - if self.optionsImplemented is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%soptionsImplemented>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.optionsImplemented).encode(ExternalEncoding), input_name='optionsImplemented'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='DRLCCapabilities'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.averageEnergy is not None: - showIndent(outfile, level) - outfile.write('averageEnergy=model_.RealEnergy(\n') - self.averageEnergy.exportLiteral(outfile, level, name_='averageEnergy') - showIndent(outfile, level) - outfile.write('),\n') - if self.maxDemand is not None: - showIndent(outfile, level) - outfile.write('maxDemand=model_.ActivePower(\n') - self.maxDemand.exportLiteral(outfile, level, name_='maxDemand') - showIndent(outfile, level) - outfile.write('),\n') - if self.optionsImplemented is not None: - showIndent(outfile, level) - outfile.write('optionsImplemented=%s,\n' % quote_python(self.optionsImplemented).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'averageEnergy': - obj_ = RealEnergy.factory() - obj_.build(child_) - self.averageEnergy = obj_ - obj_.original_tagname_ = 'averageEnergy' - elif nodeName_ == 'maxDemand': - obj_ = ActivePower.factory() - obj_.build(child_) - self.maxDemand = obj_ - obj_.original_tagname_ = 'maxDemand' - elif nodeName_ == 'optionsImplemented': - optionsImplemented_ = child_.text - optionsImplemented_ = self.gds_validate_string(optionsImplemented_, node, 'optionsImplemented') - self.optionsImplemented = optionsImplemented_ - self.validate_HexBinary32(self.optionsImplemented) # validate type HexBinary32 -# end class DRLCCapabilities - - -class PowerSourceType(GeneratedsSuper): - """0 - none 1 - mains 2 - battery 3 - local generation 4 - emergency 5 - - unknown All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PowerSourceType.subclass: - return PowerSourceType.subclass(*args_, **kwargs_) - else: - return PowerSourceType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PowerSourceType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PowerSourceType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PowerSourceType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PowerSourceType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PowerSourceType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PowerSourceType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PowerSourceType - - -class PEVInfo(GeneratedsSuper): - """Contains attributes that can be exposed by PEVs and other devices - that have charging requirements.""" - subclass = None - superclass = None - def __init__(self, chargingPowerNow=None, energyRequestNow=None, maxForwardPower=None, minimumChargingDuration=None, targetStateOfCharge=None, timeChargeIsNeeded=None, timeChargingStatusPEV=None): - self.original_tagname_ = None - self.chargingPowerNow = chargingPowerNow - self.energyRequestNow = energyRequestNow - self.maxForwardPower = maxForwardPower - self.minimumChargingDuration = minimumChargingDuration - self.targetStateOfCharge = targetStateOfCharge - self.timeChargeIsNeeded = timeChargeIsNeeded - self.timeChargingStatusPEV = timeChargingStatusPEV - def factory(*args_, **kwargs_): - if PEVInfo.subclass: - return PEVInfo.subclass(*args_, **kwargs_) - else: - return PEVInfo(*args_, **kwargs_) - factory = staticmethod(factory) - def get_chargingPowerNow(self): return self.chargingPowerNow - def set_chargingPowerNow(self, chargingPowerNow): self.chargingPowerNow = chargingPowerNow - def get_energyRequestNow(self): return self.energyRequestNow - def set_energyRequestNow(self, energyRequestNow): self.energyRequestNow = energyRequestNow - def get_maxForwardPower(self): return self.maxForwardPower - def set_maxForwardPower(self, maxForwardPower): self.maxForwardPower = maxForwardPower - def get_minimumChargingDuration(self): return self.minimumChargingDuration - def set_minimumChargingDuration(self, minimumChargingDuration): self.minimumChargingDuration = minimumChargingDuration - def get_targetStateOfCharge(self): return self.targetStateOfCharge - def set_targetStateOfCharge(self, targetStateOfCharge): self.targetStateOfCharge = targetStateOfCharge - def get_timeChargeIsNeeded(self): return self.timeChargeIsNeeded - def set_timeChargeIsNeeded(self, timeChargeIsNeeded): self.timeChargeIsNeeded = timeChargeIsNeeded - def get_timeChargingStatusPEV(self): return self.timeChargingStatusPEV - def set_timeChargingStatusPEV(self, timeChargingStatusPEV): self.timeChargingStatusPEV = timeChargingStatusPEV - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.chargingPowerNow is not None or - self.energyRequestNow is not None or - self.maxForwardPower is not None or - self.minimumChargingDuration is not None or - self.targetStateOfCharge is not None or - self.timeChargeIsNeeded is not None or - self.timeChargingStatusPEV is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PEVInfo', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PEVInfo') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PEVInfo', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PEVInfo'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PEVInfo', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.chargingPowerNow is not None: - self.chargingPowerNow.export(outfile, level, namespace_, name_='chargingPowerNow', pretty_print=pretty_print) - if self.energyRequestNow is not None: - self.energyRequestNow.export(outfile, level, namespace_, name_='energyRequestNow', pretty_print=pretty_print) - if self.maxForwardPower is not None: - self.maxForwardPower.export(outfile, level, namespace_, name_='maxForwardPower', pretty_print=pretty_print) - if self.minimumChargingDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sminimumChargingDuration>%s%s' % (namespace_, self.gds_format_integer(self.minimumChargingDuration, input_name='minimumChargingDuration'), namespace_, eol_)) - if self.targetStateOfCharge is not None: - self.targetStateOfCharge.export(outfile, level, namespace_, name_='targetStateOfCharge', pretty_print=pretty_print) - if self.timeChargeIsNeeded is not None: - self.timeChargeIsNeeded.export(outfile, level, namespace_, name_='timeChargeIsNeeded', pretty_print=pretty_print) - if self.timeChargingStatusPEV is not None: - self.timeChargingStatusPEV.export(outfile, level, namespace_, name_='timeChargingStatusPEV', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='PEVInfo'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.chargingPowerNow is not None: - showIndent(outfile, level) - outfile.write('chargingPowerNow=model_.ActivePower(\n') - self.chargingPowerNow.exportLiteral(outfile, level, name_='chargingPowerNow') - showIndent(outfile, level) - outfile.write('),\n') - if self.energyRequestNow is not None: - showIndent(outfile, level) - outfile.write('energyRequestNow=model_.RealEnergy(\n') - self.energyRequestNow.exportLiteral(outfile, level, name_='energyRequestNow') - showIndent(outfile, level) - outfile.write('),\n') - if self.maxForwardPower is not None: - showIndent(outfile, level) - outfile.write('maxForwardPower=model_.ActivePower(\n') - self.maxForwardPower.exportLiteral(outfile, level, name_='maxForwardPower') - showIndent(outfile, level) - outfile.write('),\n') - if self.minimumChargingDuration is not None: - showIndent(outfile, level) - outfile.write('minimumChargingDuration=%d,\n' % self.minimumChargingDuration) - if self.targetStateOfCharge is not None: - showIndent(outfile, level) - outfile.write('targetStateOfCharge=model_.PerCent(\n') - self.targetStateOfCharge.exportLiteral(outfile, level, name_='targetStateOfCharge') - showIndent(outfile, level) - outfile.write('),\n') - if self.timeChargeIsNeeded is not None: - showIndent(outfile, level) - outfile.write('timeChargeIsNeeded=model_.TimeType(\n') - self.timeChargeIsNeeded.exportLiteral(outfile, level, name_='timeChargeIsNeeded') - showIndent(outfile, level) - outfile.write('),\n') - if self.timeChargingStatusPEV is not None: - showIndent(outfile, level) - outfile.write('timeChargingStatusPEV=model_.TimeType(\n') - self.timeChargingStatusPEV.exportLiteral(outfile, level, name_='timeChargingStatusPEV') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'chargingPowerNow': - obj_ = ActivePower.factory() - obj_.build(child_) - self.chargingPowerNow = obj_ - obj_.original_tagname_ = 'chargingPowerNow' - elif nodeName_ == 'energyRequestNow': - obj_ = RealEnergy.factory() - obj_.build(child_) - self.energyRequestNow = obj_ - obj_.original_tagname_ = 'energyRequestNow' - elif nodeName_ == 'maxForwardPower': - obj_ = ActivePower.factory() - obj_.build(child_) - self.maxForwardPower = obj_ - obj_.original_tagname_ = 'maxForwardPower' - elif nodeName_ == 'minimumChargingDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'minimumChargingDuration') - self.minimumChargingDuration = ival_ - self.validate_UInt32(self.minimumChargingDuration) # validate type UInt32 - elif nodeName_ == 'targetStateOfCharge': - obj_ = PerCent.factory() - obj_.build(child_) - self.targetStateOfCharge = obj_ - obj_.original_tagname_ = 'targetStateOfCharge' - elif nodeName_ == 'timeChargeIsNeeded': - obj_ = TimeType.factory() - obj_.build(child_) - self.timeChargeIsNeeded = obj_ - obj_.original_tagname_ = 'timeChargeIsNeeded' - elif nodeName_ == 'timeChargingStatusPEV': - obj_ = TimeType.factory() - obj_.build(child_) - self.timeChargingStatusPEV = obj_ - obj_.original_tagname_ = 'timeChargingStatusPEV' -# end class PEVInfo - - -class IEEE_802_15_4(GeneratedsSuper): - """Contains 802.15.4 link layer specific attributes.""" - subclass = None - superclass = None - def __init__(self, capabilityInfo=None, NeighborListLink=None, shortAddress=None): - self.original_tagname_ = None - self.capabilityInfo = capabilityInfo - self.NeighborListLink = NeighborListLink - self.shortAddress = shortAddress - def factory(*args_, **kwargs_): - if IEEE_802_15_4.subclass: - return IEEE_802_15_4.subclass(*args_, **kwargs_) - else: - return IEEE_802_15_4(*args_, **kwargs_) - factory = staticmethod(factory) - def get_capabilityInfo(self): return self.capabilityInfo - def set_capabilityInfo(self, capabilityInfo): self.capabilityInfo = capabilityInfo - def get_NeighborListLink(self): return self.NeighborListLink - def set_NeighborListLink(self, NeighborListLink): self.NeighborListLink = NeighborListLink - def get_shortAddress(self): return self.shortAddress - def set_shortAddress(self, shortAddress): self.shortAddress = shortAddress - def validate_HexBinary8(self, value): - # Validate type HexBinary8, a restriction on xs:hexBinary. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.capabilityInfo is not None or - self.NeighborListLink is not None or - self.shortAddress is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IEEE_802_15_4', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IEEE_802_15_4') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IEEE_802_15_4', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IEEE_802_15_4'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='IEEE_802_15_4', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.capabilityInfo is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scapabilityInfo>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.capabilityInfo).encode(ExternalEncoding), input_name='capabilityInfo'), namespace_, eol_)) - if self.NeighborListLink is not None: - self.NeighborListLink.export(outfile, level, namespace_, name_='NeighborListLink', pretty_print=pretty_print) - if self.shortAddress is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sshortAddress>%s%s' % (namespace_, self.gds_format_integer(self.shortAddress, input_name='shortAddress'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='IEEE_802_15_4'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.capabilityInfo is not None: - showIndent(outfile, level) - outfile.write('capabilityInfo=%s,\n' % quote_python(self.capabilityInfo).encode(ExternalEncoding)) - if self.NeighborListLink is not None: - showIndent(outfile, level) - outfile.write('NeighborListLink=model_.NeighborListLink(\n') - self.NeighborListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.shortAddress is not None: - showIndent(outfile, level) - outfile.write('shortAddress=%d,\n' % self.shortAddress) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'capabilityInfo': - capabilityInfo_ = child_.text - capabilityInfo_ = self.gds_validate_string(capabilityInfo_, node, 'capabilityInfo') - self.capabilityInfo = capabilityInfo_ - self.validate_HexBinary8(self.capabilityInfo) # validate type HexBinary8 - elif nodeName_ == 'NeighborListLink': - obj_ = NeighborListLink.factory() - obj_.build(child_) - self.NeighborListLink = obj_ - obj_.original_tagname_ = 'NeighborListLink' - elif nodeName_ == 'shortAddress': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'shortAddress') - self.shortAddress = ival_ - self.validate_UInt16(self.shortAddress) # validate type UInt16 -# end class IEEE_802_15_4 - - -class loWPAN(GeneratedsSuper): - """Contains information specific to 6LoWPAN.""" - subclass = None - superclass = None - def __init__(self, octetsRx=None, octetsTx=None, packetsRx=None, packetsTx=None, rxFragError=None): - self.original_tagname_ = None - self.octetsRx = octetsRx - self.octetsTx = octetsTx - self.packetsRx = packetsRx - self.packetsTx = packetsTx - self.rxFragError = rxFragError - def factory(*args_, **kwargs_): - if loWPAN.subclass: - return loWPAN.subclass(*args_, **kwargs_) - else: - return loWPAN(*args_, **kwargs_) - factory = staticmethod(factory) - def get_octetsRx(self): return self.octetsRx - def set_octetsRx(self, octetsRx): self.octetsRx = octetsRx - def get_octetsTx(self): return self.octetsTx - def set_octetsTx(self, octetsTx): self.octetsTx = octetsTx - def get_packetsRx(self): return self.packetsRx - def set_packetsRx(self, packetsRx): self.packetsRx = packetsRx - def get_packetsTx(self): return self.packetsTx - def set_packetsTx(self, packetsTx): self.packetsTx = packetsTx - def get_rxFragError(self): return self.rxFragError - def set_rxFragError(self, rxFragError): self.rxFragError = rxFragError - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.octetsRx is not None or - self.octetsTx is not None or - self.packetsRx is not None or - self.packetsTx is not None or - self.rxFragError is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='loWPAN', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='loWPAN') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='loWPAN', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='loWPAN'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='loWPAN', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.octetsRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%soctetsRx>%s%s' % (namespace_, self.gds_format_integer(self.octetsRx, input_name='octetsRx'), namespace_, eol_)) - if self.octetsTx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%soctetsTx>%s%s' % (namespace_, self.gds_format_integer(self.octetsTx, input_name='octetsTx'), namespace_, eol_)) - if self.packetsRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%spacketsRx>%s%s' % (namespace_, self.gds_format_integer(self.packetsRx, input_name='packetsRx'), namespace_, eol_)) - if self.packetsTx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%spacketsTx>%s%s' % (namespace_, self.gds_format_integer(self.packetsTx, input_name='packetsTx'), namespace_, eol_)) - if self.rxFragError is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srxFragError>%s%s' % (namespace_, self.gds_format_integer(self.rxFragError, input_name='rxFragError'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='loWPAN'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.octetsRx is not None: - showIndent(outfile, level) - outfile.write('octetsRx=%d,\n' % self.octetsRx) - if self.octetsTx is not None: - showIndent(outfile, level) - outfile.write('octetsTx=%d,\n' % self.octetsTx) - if self.packetsRx is not None: - showIndent(outfile, level) - outfile.write('packetsRx=%d,\n' % self.packetsRx) - if self.packetsTx is not None: - showIndent(outfile, level) - outfile.write('packetsTx=%d,\n' % self.packetsTx) - if self.rxFragError is not None: - showIndent(outfile, level) - outfile.write('rxFragError=%d,\n' % self.rxFragError) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'octetsRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'octetsRx') - self.octetsRx = ival_ - self.validate_UInt32(self.octetsRx) # validate type UInt32 - elif nodeName_ == 'octetsTx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'octetsTx') - self.octetsTx = ival_ - self.validate_UInt32(self.octetsTx) # validate type UInt32 - elif nodeName_ == 'packetsRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'packetsRx') - self.packetsRx = ival_ - self.validate_UInt32(self.packetsRx) # validate type UInt32 - elif nodeName_ == 'packetsTx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'packetsTx') - self.packetsTx = ival_ - self.validate_UInt32(self.packetsTx) # validate type UInt32 - elif nodeName_ == 'rxFragError': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'rxFragError') - self.rxFragError = ival_ - self.validate_UInt32(self.rxFragError) # validate type UInt32 -# end class loWPAN - - -class PowerConfiguration(GeneratedsSuper): - """Contains configuration related to the device's power sources""" - subclass = None - superclass = None - def __init__(self, batteryInstallTime=None, lowChargeThreshold=None): - self.original_tagname_ = None - self.batteryInstallTime = batteryInstallTime - self.lowChargeThreshold = lowChargeThreshold - def factory(*args_, **kwargs_): - if PowerConfiguration.subclass: - return PowerConfiguration.subclass(*args_, **kwargs_) - else: - return PowerConfiguration(*args_, **kwargs_) - factory = staticmethod(factory) - def get_batteryInstallTime(self): return self.batteryInstallTime - def set_batteryInstallTime(self, batteryInstallTime): self.batteryInstallTime = batteryInstallTime - def get_lowChargeThreshold(self): return self.lowChargeThreshold - def set_lowChargeThreshold(self, lowChargeThreshold): self.lowChargeThreshold = lowChargeThreshold - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.batteryInstallTime is not None or - self.lowChargeThreshold is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PowerConfiguration', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PowerConfiguration') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PowerConfiguration', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PowerConfiguration'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PowerConfiguration', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.batteryInstallTime is not None: - self.batteryInstallTime.export(outfile, level, namespace_, name_='batteryInstallTime', pretty_print=pretty_print) - if self.lowChargeThreshold is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slowChargeThreshold>%s%s' % (namespace_, self.gds_format_integer(self.lowChargeThreshold, input_name='lowChargeThreshold'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='PowerConfiguration'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.batteryInstallTime is not None: - showIndent(outfile, level) - outfile.write('batteryInstallTime=model_.TimeType(\n') - self.batteryInstallTime.exportLiteral(outfile, level, name_='batteryInstallTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.lowChargeThreshold is not None: - showIndent(outfile, level) - outfile.write('lowChargeThreshold=%d,\n' % self.lowChargeThreshold) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'batteryInstallTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.batteryInstallTime = obj_ - obj_.original_tagname_ = 'batteryInstallTime' - elif nodeName_ == 'lowChargeThreshold': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'lowChargeThreshold') - self.lowChargeThreshold = ival_ - self.validate_UInt32(self.lowChargeThreshold) # validate type UInt32 -# end class PowerConfiguration - - -class TimeConfiguration(GeneratedsSuper): - """Contains attributes related to the configuration of the time - service.""" - subclass = None - superclass = None - def __init__(self, dstEndRule=None, dstOffset=None, dstStartRule=None, tzOffset=None): - self.original_tagname_ = None - self.dstEndRule = dstEndRule - self.dstOffset = dstOffset - self.dstStartRule = dstStartRule - self.tzOffset = tzOffset - def factory(*args_, **kwargs_): - if TimeConfiguration.subclass: - return TimeConfiguration.subclass(*args_, **kwargs_) - else: - return TimeConfiguration(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dstEndRule(self): return self.dstEndRule - def set_dstEndRule(self, dstEndRule): self.dstEndRule = dstEndRule - def get_dstOffset(self): return self.dstOffset - def set_dstOffset(self, dstOffset): self.dstOffset = dstOffset - def get_dstStartRule(self): return self.dstStartRule - def set_dstStartRule(self, dstStartRule): self.dstStartRule = dstStartRule - def get_tzOffset(self): return self.tzOffset - def set_tzOffset(self, tzOffset): self.tzOffset = tzOffset - def hasContent_(self): - if ( - self.dstEndRule is not None or - self.dstOffset is not None or - self.dstStartRule is not None or - self.tzOffset is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeConfiguration', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeConfiguration') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeConfiguration', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeConfiguration'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='TimeConfiguration', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dstEndRule is not None: - self.dstEndRule.export(outfile, level, namespace_, name_='dstEndRule', pretty_print=pretty_print) - if self.dstOffset is not None: - self.dstOffset.export(outfile, level, namespace_, name_='dstOffset', pretty_print=pretty_print) - if self.dstStartRule is not None: - self.dstStartRule.export(outfile, level, namespace_, name_='dstStartRule', pretty_print=pretty_print) - if self.tzOffset is not None: - self.tzOffset.export(outfile, level, namespace_, name_='tzOffset', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TimeConfiguration'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dstEndRule is not None: - showIndent(outfile, level) - outfile.write('dstEndRule=model_.DstRuleType(\n') - self.dstEndRule.exportLiteral(outfile, level, name_='dstEndRule') - showIndent(outfile, level) - outfile.write('),\n') - if self.dstOffset is not None: - showIndent(outfile, level) - outfile.write('dstOffset=model_.TimeOffsetType(\n') - self.dstOffset.exportLiteral(outfile, level, name_='dstOffset') - showIndent(outfile, level) - outfile.write('),\n') - if self.dstStartRule is not None: - showIndent(outfile, level) - outfile.write('dstStartRule=model_.DstRuleType(\n') - self.dstStartRule.exportLiteral(outfile, level, name_='dstStartRule') - showIndent(outfile, level) - outfile.write('),\n') - if self.tzOffset is not None: - showIndent(outfile, level) - outfile.write('tzOffset=model_.TimeOffsetType(\n') - self.tzOffset.exportLiteral(outfile, level, name_='tzOffset') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dstEndRule': - obj_ = DstRuleType.factory() - obj_.build(child_) - self.dstEndRule = obj_ - obj_.original_tagname_ = 'dstEndRule' - elif nodeName_ == 'dstOffset': - obj_ = TimeOffsetType.factory() - obj_.build(child_) - self.dstOffset = obj_ - obj_.original_tagname_ = 'dstOffset' - elif nodeName_ == 'dstStartRule': - obj_ = DstRuleType.factory() - obj_.build(child_) - self.dstStartRule = obj_ - obj_.original_tagname_ = 'dstStartRule' - elif nodeName_ == 'tzOffset': - obj_ = TimeOffsetType.factory() - obj_.build(child_) - self.tzOffset = obj_ - obj_.original_tagname_ = 'tzOffset' -# end class TimeConfiguration - - -class ApplianceLoadReduction(GeneratedsSuper): - """The ApplianceLoadReduction object is used by a Demand Response - service provider to provide signals for ENERGY STAR compliant - appliances. See the definition of ApplianceLoadReductionType for - more information.""" - subclass = None - superclass = None - def __init__(self, type_=None): - self.original_tagname_ = None - self.type_ = type_ - def factory(*args_, **kwargs_): - if ApplianceLoadReduction.subclass: - return ApplianceLoadReduction.subclass(*args_, **kwargs_) - else: - return ApplianceLoadReduction(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def hasContent_(self): - if ( - self.type_ is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ApplianceLoadReduction', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ApplianceLoadReduction') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ApplianceLoadReduction', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ApplianceLoadReduction'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ApplianceLoadReduction', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.type_ is not None: - self.type_.export(outfile, level, namespace_, name_='type', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ApplianceLoadReduction'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.type_ is not None: - showIndent(outfile, level) - outfile.write('type_=model_.ApplianceLoadReductionType(\n') - self.type_.exportLiteral(outfile, level, name_='type') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'type': - obj_ = ApplianceLoadReductionType.factory() - obj_.build(child_) - self.type_ = obj_ - obj_.original_tagname_ = 'type' -# end class ApplianceLoadReduction - - -class DutyCycle(GeneratedsSuper): - """Duty cycle control is a device specific issue and is managed by the - device. The duty cycle of the device under control should span - the shortest practical time period in accordance with the nature - of the device under control and the intent of the request for - demand reduction. The default factory setting SHOULD be three - minutes for each 10% of duty cycle. This indicates that the - default time period over which a duty cycle is applied is 30 - minutes, meaning a 10% duty cycle would cause a device to be ON - for 3 minutes. The “off state” SHALL precede the “on - state”.""" - subclass = None - superclass = None - def __init__(self, normalValue=None): - self.original_tagname_ = None - self.normalValue = normalValue - def factory(*args_, **kwargs_): - if DutyCycle.subclass: - return DutyCycle.subclass(*args_, **kwargs_) - else: - return DutyCycle(*args_, **kwargs_) - factory = staticmethod(factory) - def get_normalValue(self): return self.normalValue - def set_normalValue(self, normalValue): self.normalValue = normalValue - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.normalValue is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DutyCycle', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DutyCycle') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DutyCycle', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DutyCycle'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DutyCycle', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.normalValue is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snormalValue>%s%s' % (namespace_, self.gds_format_integer(self.normalValue, input_name='normalValue'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='DutyCycle'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.normalValue is not None: - showIndent(outfile, level) - outfile.write('normalValue=%d,\n' % self.normalValue) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'normalValue': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'normalValue') - self.normalValue = ival_ - self.validate_UInt8(self.normalValue) # validate type UInt8 -# end class DutyCycle - - -class Offset(GeneratedsSuper): - """If a temperature offset is sent that causes the heating or cooling - temperature set point to exceed the limit boundaries that are - programmed into the device, the device SHALL respond by setting - the temperature at the limit. If an EDC is being targeted at - multiple devices or to a device that controls multiple devices - (e.g., EMS), it can provide multiple Offset types within one - EDC. For events with multiple Offset types, a client SHALL - select the Offset that best fits their operating function. - Alternatively, an event with a single Offset type can be - targeted at an EMS in order to request a percentage load - reduction on the average energy usage of the entire premise. An - EMS SHOULD use the Metering function set to determine the - initial load in the premise, reduce energy consumption by - controlling devices at its disposal, and at the conclusion of - the event, once again use the Metering function set to determine - if the desired load reduction was achieved.""" - subclass = None - superclass = None - def __init__(self, coolingOffset=None, heatingOffset=None, loadAdjustmentPercentageOffset=None): - self.original_tagname_ = None - self.coolingOffset = coolingOffset - self.heatingOffset = heatingOffset - self.loadAdjustmentPercentageOffset = loadAdjustmentPercentageOffset - def factory(*args_, **kwargs_): - if Offset.subclass: - return Offset.subclass(*args_, **kwargs_) - else: - return Offset(*args_, **kwargs_) - factory = staticmethod(factory) - def get_coolingOffset(self): return self.coolingOffset - def set_coolingOffset(self, coolingOffset): self.coolingOffset = coolingOffset - def get_heatingOffset(self): return self.heatingOffset - def set_heatingOffset(self, heatingOffset): self.heatingOffset = heatingOffset - def get_loadAdjustmentPercentageOffset(self): return self.loadAdjustmentPercentageOffset - def set_loadAdjustmentPercentageOffset(self, loadAdjustmentPercentageOffset): self.loadAdjustmentPercentageOffset = loadAdjustmentPercentageOffset - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.coolingOffset is not None or - self.heatingOffset is not None or - self.loadAdjustmentPercentageOffset is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Offset', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Offset') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Offset', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Offset'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Offset', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.coolingOffset is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scoolingOffset>%s%s' % (namespace_, self.gds_format_integer(self.coolingOffset, input_name='coolingOffset'), namespace_, eol_)) - if self.heatingOffset is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sheatingOffset>%s%s' % (namespace_, self.gds_format_integer(self.heatingOffset, input_name='heatingOffset'), namespace_, eol_)) - if self.loadAdjustmentPercentageOffset is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sloadAdjustmentPercentageOffset>%s%s' % (namespace_, self.gds_format_integer(self.loadAdjustmentPercentageOffset, input_name='loadAdjustmentPercentageOffset'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Offset'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.coolingOffset is not None: - showIndent(outfile, level) - outfile.write('coolingOffset=%d,\n' % self.coolingOffset) - if self.heatingOffset is not None: - showIndent(outfile, level) - outfile.write('heatingOffset=%d,\n' % self.heatingOffset) - if self.loadAdjustmentPercentageOffset is not None: - showIndent(outfile, level) - outfile.write('loadAdjustmentPercentageOffset=%d,\n' % self.loadAdjustmentPercentageOffset) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'coolingOffset': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'coolingOffset') - self.coolingOffset = ival_ - self.validate_UInt8(self.coolingOffset) # validate type UInt8 - elif nodeName_ == 'heatingOffset': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'heatingOffset') - self.heatingOffset = ival_ - self.validate_UInt8(self.heatingOffset) # validate type UInt8 - elif nodeName_ == 'loadAdjustmentPercentageOffset': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'loadAdjustmentPercentageOffset') - self.loadAdjustmentPercentageOffset = ival_ - self.validate_UInt8(self.loadAdjustmentPercentageOffset) # validate type UInt8 -# end class Offset - - -class SetPoint(GeneratedsSuper): - """The SetPoint object is used to apply specific temperature set points - to a temperature control device. The values of the - heatingSetpoint and coolingSetpoint attributes SHALL be - calculated as follows: Cooling/Heating Temperature Set Point / - 100 = temperature in degrees Celsius where -273.15°C <= - temperature <= 327.67°C, corresponding to a Cooling and/or - Heating Temperature Set Point. The maximum resolution this - format allows is 0.01°C. The field not present in a Response - indicates that this field has not been used by the end device. - If a temperature is sent that exceeds the temperature limit - boundaries that are programmed into the device, the device SHALL - respond by setting the temperature at the limit.""" - subclass = None - superclass = None - def __init__(self, coolingSetpoint=None, heatingSetpoint=None): - self.original_tagname_ = None - self.coolingSetpoint = coolingSetpoint - self.heatingSetpoint = heatingSetpoint - def factory(*args_, **kwargs_): - if SetPoint.subclass: - return SetPoint.subclass(*args_, **kwargs_) - else: - return SetPoint(*args_, **kwargs_) - factory = staticmethod(factory) - def get_coolingSetpoint(self): return self.coolingSetpoint - def set_coolingSetpoint(self, coolingSetpoint): self.coolingSetpoint = coolingSetpoint - def get_heatingSetpoint(self): return self.heatingSetpoint - def set_heatingSetpoint(self, heatingSetpoint): self.heatingSetpoint = heatingSetpoint - def validate_Int16(self, value): - # Validate type Int16, a restriction on xs:short. - pass - def hasContent_(self): - if ( - self.coolingSetpoint is not None or - self.heatingSetpoint is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SetPoint', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SetPoint') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SetPoint', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SetPoint'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='SetPoint', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.coolingSetpoint is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scoolingSetpoint>%s%s' % (namespace_, self.gds_format_integer(self.coolingSetpoint, input_name='coolingSetpoint'), namespace_, eol_)) - if self.heatingSetpoint is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sheatingSetpoint>%s%s' % (namespace_, self.gds_format_integer(self.heatingSetpoint, input_name='heatingSetpoint'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='SetPoint'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.coolingSetpoint is not None: - showIndent(outfile, level) - outfile.write('coolingSetpoint=%d,\n' % self.coolingSetpoint) - if self.heatingSetpoint is not None: - showIndent(outfile, level) - outfile.write('heatingSetpoint=%d,\n' % self.heatingSetpoint) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'coolingSetpoint': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'coolingSetpoint') - self.coolingSetpoint = ival_ - self.validate_Int16(self.coolingSetpoint) # validate type Int16 - elif nodeName_ == 'heatingSetpoint': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'heatingSetpoint') - self.heatingSetpoint = ival_ - self.validate_Int16(self.heatingSetpoint) # validate type Int16 -# end class SetPoint - - -class TargetReduction(GeneratedsSuper): - """The TargetReduction object is used by a Demand Response service - provider to provide a RECOMMENDED threshold that a - device/premises should maintain its consumption below. For - example, a service provider can provide a RECOMMENDED threshold - of some kWh for a 3-hour event. This means that the - device/premises would maintain its consumption below the - specified limit for the specified period.""" - subclass = None - superclass = None - def __init__(self, type_=None, value=None): - self.original_tagname_ = None - self.type_ = type_ - self.value = value - def factory(*args_, **kwargs_): - if TargetReduction.subclass: - return TargetReduction.subclass(*args_, **kwargs_) - else: - return TargetReduction(*args_, **kwargs_) - factory = staticmethod(factory) - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.type_ is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TargetReduction', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReduction') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TargetReduction', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TargetReduction'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='TargetReduction', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.type_ is not None: - self.type_.export(outfile, level, namespace_, name_='type', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='TargetReduction'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.type_ is not None: - showIndent(outfile, level) - outfile.write('type_=model_.UnitType(\n') - self.type_.exportLiteral(outfile, level, name_='type') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'type': - obj_ = UnitType.factory() - obj_.build(child_) - self.type_ = obj_ - obj_.original_tagname_ = 'type' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class TargetReduction - - -class CostKindType(GeneratedsSuper): - """0 - Carbon Dioxide emissions, in grams per unit 1 - Sulfur Dioxide - emissions, in grams per unit 2 - Nitrogen Oxides emissions, in - grams per unit 3 - Renewable generation, as a percentage of - overall generation All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if CostKindType.subclass: - return CostKindType.subclass(*args_, **kwargs_) - else: - return CostKindType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CostKindType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CostKindType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='CostKindType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CostKindType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CostKindType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='CostKindType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class CostKindType - - -class EnvironmentalCost(GeneratedsSuper): - """Provides alternative or secondary price information for the relevant - RateComponent. Supports jurisdictions that seek to convey the - environmental price per unit of the specified commodity not - expressed in currency. Implementers and consumers can use this - attribute to prioritize operations of their HAN devices (e.g., - PEV charging during times of high availability of renewable - electricity resources).""" - subclass = None - superclass = None - def __init__(self, amount=None, costKind=None, costLevel=None, numCostLevels=None): - self.original_tagname_ = None - self.amount = amount - self.costKind = costKind - self.costLevel = costLevel - self.numCostLevels = numCostLevels - def factory(*args_, **kwargs_): - if EnvironmentalCost.subclass: - return EnvironmentalCost.subclass(*args_, **kwargs_) - else: - return EnvironmentalCost(*args_, **kwargs_) - factory = staticmethod(factory) - def get_amount(self): return self.amount - def set_amount(self, amount): self.amount = amount - def get_costKind(self): return self.costKind - def set_costKind(self, costKind): self.costKind = costKind - def get_costLevel(self): return self.costLevel - def set_costLevel(self, costLevel): self.costLevel = costLevel - def get_numCostLevels(self): return self.numCostLevels - def set_numCostLevels(self, numCostLevels): self.numCostLevels = numCostLevels - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.amount is not None or - self.costKind is not None or - self.costLevel is not None or - self.numCostLevels is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EnvironmentalCost', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EnvironmentalCost') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EnvironmentalCost', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EnvironmentalCost'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='EnvironmentalCost', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.amount is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%samount>%s%s' % (namespace_, self.gds_format_integer(self.amount, input_name='amount'), namespace_, eol_)) - if self.costKind is not None: - self.costKind.export(outfile, level, namespace_, name_='costKind', pretty_print=pretty_print) - if self.costLevel is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scostLevel>%s%s' % (namespace_, self.gds_format_integer(self.costLevel, input_name='costLevel'), namespace_, eol_)) - if self.numCostLevels is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snumCostLevels>%s%s' % (namespace_, self.gds_format_integer(self.numCostLevels, input_name='numCostLevels'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='EnvironmentalCost'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.amount is not None: - showIndent(outfile, level) - outfile.write('amount=%d,\n' % self.amount) - if self.costKind is not None: - showIndent(outfile, level) - outfile.write('costKind=model_.CostKindType(\n') - self.costKind.exportLiteral(outfile, level, name_='costKind') - showIndent(outfile, level) - outfile.write('),\n') - if self.costLevel is not None: - showIndent(outfile, level) - outfile.write('costLevel=%d,\n' % self.costLevel) - if self.numCostLevels is not None: - showIndent(outfile, level) - outfile.write('numCostLevels=%d,\n' % self.numCostLevels) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'amount': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'amount') - self.amount = ival_ - self.validate_UInt32(self.amount) # validate type UInt32 - elif nodeName_ == 'costKind': - obj_ = CostKindType.factory() - obj_.build(child_) - self.costKind = obj_ - obj_.original_tagname_ = 'costKind' - elif nodeName_ == 'costLevel': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'costLevel') - self.costLevel = ival_ - self.validate_UInt8(self.costLevel) # validate type UInt8 - elif nodeName_ == 'numCostLevels': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'numCostLevels') - self.numCostLevels = ival_ - self.validate_UInt8(self.numCostLevels) # validate type UInt8 -# end class EnvironmentalCost - - -class PriorityType(GeneratedsSuper): - """Indicates the priority of a message: 0 - Low 1 - Normal 2 - High 3 - - Critical All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PriorityType.subclass: - return PriorityType.subclass(*args_, **kwargs_) - else: - return PriorityType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PriorityType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PriorityType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PriorityType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PriorityType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PriorityType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PriorityType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PriorityType - - -class Charge(GeneratedsSuper): - """Charges contain charges on a customer bill. These could be items - like taxes, levies, surcharges, rebates, or others. This is - meant to allow the HAN device to retrieve enough information to - be able to reconstruct an estimate of what the total bill would - look like. Providers can provide line item billing, including - multiple charge kinds (e.g. taxes, surcharges) at whatever - granularity desired, using as many Charges as desired during a - billing period. There can also be any number of Charges - associated with different ReadingTypes to distinguish between - TOU tiers, consumption blocks, or demand charges.""" - subclass = None - superclass = None - def __init__(self, description=None, kind=None, value=None): - self.original_tagname_ = None - self.description = description - self.kind = kind - self.value = value - def factory(*args_, **kwargs_): - if Charge.subclass: - return Charge.subclass(*args_, **kwargs_) - else: - return Charge(*args_, **kwargs_) - factory = staticmethod(factory) - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_kind(self): return self.kind - def set_kind(self, kind): self.kind = kind - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_String20(self, value): - # Validate type String20, a restriction on xs:string. - pass - def validate_Int32(self, value): - # Validate type Int32, a restriction on xs:int. - pass - def hasContent_(self): - if ( - self.description is not None or - self.kind is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Charge', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Charge') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Charge', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Charge'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Charge', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.kind is not None: - self.kind.export(outfile, level, namespace_, name_='kind', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Charge'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.kind is not None: - showIndent(outfile, level) - outfile.write('kind=model_.ChargeKind(\n') - self.kind.exportLiteral(outfile, level, name_='kind') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String20(self.description) # validate type String20 - elif nodeName_ == 'kind': - obj_ = ChargeKind.factory() - obj_.build(child_) - self.kind = obj_ - obj_.original_tagname_ = 'kind' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int32(self.value) # validate type Int32 -# end class Charge - - -class ChargeKind(GeneratedsSuper): - """Kind of charge. 0 - Consumption Charge 1 - Rebate 2 - Auxiliary - Charge 3 - Demand Charge 4 - Tax Charge""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if ChargeKind.subclass: - return ChargeKind.subclass(*args_, **kwargs_) - else: - return ChargeKind(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ChargeKind', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ChargeKind') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='ChargeKind', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ChargeKind'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ChargeKind', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='ChargeKind'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ChargeKind - - -class AccountingUnit(GeneratedsSuper): - """Unit for accounting; use either 'energyUnit' or 'currencyUnit' to - specify the unit for 'value'.""" - subclass = None - superclass = None - def __init__(self, energyUnit=None, monetaryUnit=None, multiplier=None, value=None): - self.original_tagname_ = None - self.energyUnit = energyUnit - self.monetaryUnit = monetaryUnit - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if AccountingUnit.subclass: - return AccountingUnit.subclass(*args_, **kwargs_) - else: - return AccountingUnit(*args_, **kwargs_) - factory = staticmethod(factory) - def get_energyUnit(self): return self.energyUnit - def set_energyUnit(self, energyUnit): self.energyUnit = energyUnit - def get_monetaryUnit(self): return self.monetaryUnit - def set_monetaryUnit(self, monetaryUnit): self.monetaryUnit = monetaryUnit - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_Int32(self, value): - # Validate type Int32, a restriction on xs:int. - pass - def hasContent_(self): - if ( - self.energyUnit is not None or - self.monetaryUnit is not None or - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AccountingUnit', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AccountingUnit') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AccountingUnit', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AccountingUnit'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='AccountingUnit', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.energyUnit is not None: - self.energyUnit.export(outfile, level, namespace_, name_='energyUnit', pretty_print=pretty_print) - if self.monetaryUnit is not None: - self.monetaryUnit.export(outfile, level, namespace_, name_='monetaryUnit', pretty_print=pretty_print) - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='AccountingUnit'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.energyUnit is not None: - showIndent(outfile, level) - outfile.write('energyUnit=model_.RealEnergy(\n') - self.energyUnit.exportLiteral(outfile, level, name_='energyUnit') - showIndent(outfile, level) - outfile.write('),\n') - if self.monetaryUnit is not None: - showIndent(outfile, level) - outfile.write('monetaryUnit=model_.CurrencyCode(\n') - self.monetaryUnit.exportLiteral(outfile, level, name_='monetaryUnit') - showIndent(outfile, level) - outfile.write('),\n') - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'energyUnit': - obj_ = RealEnergy.factory() - obj_.build(child_) - self.energyUnit = obj_ - obj_.original_tagname_ = 'energyUnit' - elif nodeName_ == 'monetaryUnit': - obj_ = CurrencyCode.factory() - obj_.build(child_) - self.monetaryUnit = obj_ - obj_.original_tagname_ = 'monetaryUnit' - elif nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int32(self.value) # validate type Int32 -# end class AccountingUnit - - -class PrepayModeType(GeneratedsSuper): - """0 - Central Wallet 1 - ESI 2 - Local 3 - Credit All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PrepayModeType.subclass: - return PrepayModeType.subclass(*args_, **kwargs_) - else: - return PrepayModeType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrepayModeType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrepayModeType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrepayModeType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrepayModeType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PrepayModeType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PrepayModeType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PrepayModeType - - -class ServiceChange(GeneratedsSuper): - """Specifies a change to the service status.""" - subclass = None - superclass = None - def __init__(self, newStatus=None, startTime=None): - self.original_tagname_ = None - self.newStatus = newStatus - self.startTime = startTime - def factory(*args_, **kwargs_): - if ServiceChange.subclass: - return ServiceChange.subclass(*args_, **kwargs_) - else: - return ServiceChange(*args_, **kwargs_) - factory = staticmethod(factory) - def get_newStatus(self): return self.newStatus - def set_newStatus(self, newStatus): self.newStatus = newStatus - def get_startTime(self): return self.startTime - def set_startTime(self, startTime): self.startTime = startTime - def hasContent_(self): - if ( - self.newStatus is not None or - self.startTime is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ServiceChange', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceChange') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ServiceChange', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ServiceChange'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ServiceChange', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.newStatus is not None: - self.newStatus.export(outfile, level, namespace_, name_='newStatus', pretty_print=pretty_print) - if self.startTime is not None: - self.startTime.export(outfile, level, namespace_, name_='startTime', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ServiceChange'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.newStatus is not None: - showIndent(outfile, level) - outfile.write('newStatus=model_.ServiceStatusType(\n') - self.newStatus.exportLiteral(outfile, level, name_='newStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.startTime is not None: - showIndent(outfile, level) - outfile.write('startTime=model_.TimeType(\n') - self.startTime.exportLiteral(outfile, level, name_='startTime') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'newStatus': - obj_ = ServiceStatusType.factory() - obj_.build(child_) - self.newStatus = obj_ - obj_.original_tagname_ = 'newStatus' - elif nodeName_ == 'startTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.startTime = obj_ - obj_.original_tagname_ = 'startTime' -# end class ServiceChange - - -class CreditStatusType(GeneratedsSuper): - """0 - Credit Ok 1 - Credit Low 2 - Credit Exhausted 3 - Credit - Negative All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if CreditStatusType.subclass: - return CreditStatusType.subclass(*args_, **kwargs_) - else: - return CreditStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CreditStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CreditStatusType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='CreditStatusType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CreditStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CreditStatusType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='CreditStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class CreditStatusType - - -class CreditTypeType(GeneratedsSuper): - """0 - Regular 1 - Emergency 2 - Regular, then Emergency 3 - Emergency, - then Regular All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if CreditTypeType.subclass: - return CreditTypeType.subclass(*args_, **kwargs_) - else: - return CreditTypeType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CreditTypeType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CreditTypeType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='CreditTypeType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CreditTypeType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CreditTypeType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='CreditTypeType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class CreditTypeType - - -class CreditTypeChange(GeneratedsSuper): - """Specifies a change to the credit type.""" - subclass = None - superclass = None - def __init__(self, newType=None, startTime=None): - self.original_tagname_ = None - self.newType = newType - self.startTime = startTime - def factory(*args_, **kwargs_): - if CreditTypeChange.subclass: - return CreditTypeChange.subclass(*args_, **kwargs_) - else: - return CreditTypeChange(*args_, **kwargs_) - factory = staticmethod(factory) - def get_newType(self): return self.newType - def set_newType(self, newType): self.newType = newType - def get_startTime(self): return self.startTime - def set_startTime(self, startTime): self.startTime = startTime - def hasContent_(self): - if ( - self.newType is not None or - self.startTime is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CreditTypeChange', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CreditTypeChange') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CreditTypeChange', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CreditTypeChange'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CreditTypeChange', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.newType is not None: - self.newType.export(outfile, level, namespace_, name_='newType', pretty_print=pretty_print) - if self.startTime is not None: - self.startTime.export(outfile, level, namespace_, name_='startTime', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CreditTypeChange'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.newType is not None: - showIndent(outfile, level) - outfile.write('newType=model_.CreditTypeType(\n') - self.newType.exportLiteral(outfile, level, name_='newType') - showIndent(outfile, level) - outfile.write('),\n') - if self.startTime is not None: - showIndent(outfile, level) - outfile.write('startTime=model_.TimeType(\n') - self.startTime.exportLiteral(outfile, level, name_='startTime') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'newType': - obj_ = CreditTypeType.factory() - obj_.build(child_) - self.newType = obj_ - obj_.original_tagname_ = 'newType' - elif nodeName_ == 'startTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.startTime = obj_ - obj_.original_tagname_ = 'startTime' -# end class CreditTypeChange - - -class ServiceStatusType(GeneratedsSuper): - """0 - Connected 1 - Disconnected 2 - Armed for Connect 3 - Armed for - Disconnect 4 - No Contactor 5 - Load Limited All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if ServiceStatusType.subclass: - return ServiceStatusType.subclass(*args_, **kwargs_) - else: - return ServiceStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ServiceStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceStatusType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='ServiceStatusType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ServiceStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ServiceStatusType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='ServiceStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ServiceStatusType - - -class RequestStatus(GeneratedsSuper): - """The RequestStatus object is used to indicate the current status of a - Flow Reservation Request.""" - subclass = None - superclass = None - def __init__(self, dateTime=None, requestStatus=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.requestStatus = requestStatus - def factory(*args_, **kwargs_): - if RequestStatus.subclass: - return RequestStatus.subclass(*args_, **kwargs_) - else: - return RequestStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_requestStatus(self): return self.requestStatus - def set_requestStatus(self, requestStatus): self.requestStatus = requestStatus - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.requestStatus is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RequestStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RequestStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RequestStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RequestStatus'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='RequestStatus', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.requestStatus is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srequestStatus>%s%s' % (namespace_, self.gds_format_integer(self.requestStatus, input_name='requestStatus'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='RequestStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.requestStatus is not None: - showIndent(outfile, level) - outfile.write('requestStatus=%d,\n' % self.requestStatus) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'requestStatus': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'requestStatus') - self.requestStatus = ival_ - self.validate_UInt8(self.requestStatus) # validate type UInt8 -# end class RequestStatus - - -class DERType(GeneratedsSuper): - """0 - Not applicable / Unknown 1 - Virtual or mixed DER 2 - - Reciprocating engine 3 - Fuel cell 4 - Photovoltaic system 5 - - Combined heat and power 80 - Storage (immobile) 81 - Electric - vehicle / EVSE 82 - Combined PV and storage All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DERType.subclass: - return DERType.subclass(*args_, **kwargs_) - else: - return DERType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DERType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DERType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DERType - - -class DERControlBase(GeneratedsSuper): - """Distributed Energy Resource (DER) control values.""" - subclass = None - superclass = None - def __init__(self, opModFixedFlow=None, opModFixedPF=None, opModFixedVAr=None, opModFixedW=None, opModFreqWatt=None, opModHVRT=None, opModLVRT=None, opModVoltVAr=None, opModVoltWatt=None, opModWattPF=None, rampTms=None): - self.original_tagname_ = None - self.opModFixedFlow = opModFixedFlow - self.opModFixedPF = opModFixedPF - self.opModFixedVAr = opModFixedVAr - self.opModFixedW = opModFixedW - self.opModFreqWatt = opModFreqWatt - self.opModHVRT = opModHVRT - self.opModLVRT = opModLVRT - self.opModVoltVAr = opModVoltVAr - self.opModVoltWatt = opModVoltWatt - self.opModWattPF = opModWattPF - self.rampTms = rampTms - def factory(*args_, **kwargs_): - if DERControlBase.subclass: - return DERControlBase.subclass(*args_, **kwargs_) - else: - return DERControlBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_opModFixedFlow(self): return self.opModFixedFlow - def set_opModFixedFlow(self, opModFixedFlow): self.opModFixedFlow = opModFixedFlow - def get_opModFixedPF(self): return self.opModFixedPF - def set_opModFixedPF(self, opModFixedPF): self.opModFixedPF = opModFixedPF - def get_opModFixedVAr(self): return self.opModFixedVAr - def set_opModFixedVAr(self, opModFixedVAr): self.opModFixedVAr = opModFixedVAr - def get_opModFixedW(self): return self.opModFixedW - def set_opModFixedW(self, opModFixedW): self.opModFixedW = opModFixedW - def get_opModFreqWatt(self): return self.opModFreqWatt - def set_opModFreqWatt(self, opModFreqWatt): self.opModFreqWatt = opModFreqWatt - def get_opModHVRT(self): return self.opModHVRT - def set_opModHVRT(self, opModHVRT): self.opModHVRT = opModHVRT - def get_opModLVRT(self): return self.opModLVRT - def set_opModLVRT(self, opModLVRT): self.opModLVRT = opModLVRT - def get_opModVoltVAr(self): return self.opModVoltVAr - def set_opModVoltVAr(self, opModVoltVAr): self.opModVoltVAr = opModVoltVAr - def get_opModVoltWatt(self): return self.opModVoltWatt - def set_opModVoltWatt(self, opModVoltWatt): self.opModVoltWatt = opModVoltWatt - def get_opModWattPF(self): return self.opModWattPF - def set_opModWattPF(self, opModWattPF): self.opModWattPF = opModWattPF - def get_rampTms(self): return self.rampTms - def set_rampTms(self, rampTms): self.rampTms = rampTms - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.opModFixedFlow is not None or - self.opModFixedPF is not None or - self.opModFixedVAr is not None or - self.opModFixedW is not None or - self.opModFreqWatt is not None or - self.opModHVRT is not None or - self.opModLVRT is not None or - self.opModVoltVAr is not None or - self.opModVoltWatt is not None or - self.opModWattPF is not None or - self.rampTms is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERControlBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERControlBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERControlBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERControlBase'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DERControlBase', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.opModFixedFlow is not None: - self.opModFixedFlow.export(outfile, level, namespace_, name_='opModFixedFlow', pretty_print=pretty_print) - if self.opModFixedPF is not None: - self.opModFixedPF.export(outfile, level, namespace_, name_='opModFixedPF', pretty_print=pretty_print) - if self.opModFixedVAr is not None: - self.opModFixedVAr.export(outfile, level, namespace_, name_='opModFixedVAr', pretty_print=pretty_print) - if self.opModFixedW is not None: - self.opModFixedW.export(outfile, level, namespace_, name_='opModFixedW', pretty_print=pretty_print) - if self.opModFreqWatt is not None: - self.opModFreqWatt.export(outfile, level, namespace_, name_='opModFreqWatt', pretty_print=pretty_print) - if self.opModHVRT is not None: - self.opModHVRT.export(outfile, level, namespace_, name_='opModHVRT', pretty_print=pretty_print) - if self.opModLVRT is not None: - self.opModLVRT.export(outfile, level, namespace_, name_='opModLVRT', pretty_print=pretty_print) - if self.opModVoltVAr is not None: - self.opModVoltVAr.export(outfile, level, namespace_, name_='opModVoltVAr', pretty_print=pretty_print) - if self.opModVoltWatt is not None: - self.opModVoltWatt.export(outfile, level, namespace_, name_='opModVoltWatt', pretty_print=pretty_print) - if self.opModWattPF is not None: - self.opModWattPF.export(outfile, level, namespace_, name_='opModWattPF', pretty_print=pretty_print) - if self.rampTms is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srampTms>%s%s' % (namespace_, self.gds_format_integer(self.rampTms, input_name='rampTms'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='DERControlBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.opModFixedFlow is not None: - showIndent(outfile, level) - outfile.write('opModFixedFlow=model_.SignedPerCent(\n') - self.opModFixedFlow.exportLiteral(outfile, level, name_='opModFixedFlow') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModFixedPF is not None: - showIndent(outfile, level) - outfile.write('opModFixedPF=model_.FixedPowerFactor(\n') - self.opModFixedPF.exportLiteral(outfile, level, name_='opModFixedPF') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModFixedVAr is not None: - showIndent(outfile, level) - outfile.write('opModFixedVAr=model_.FixedVAr(\n') - self.opModFixedVAr.exportLiteral(outfile, level, name_='opModFixedVAr') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModFixedW is not None: - showIndent(outfile, level) - outfile.write('opModFixedW=model_.PerCent(\n') - self.opModFixedW.exportLiteral(outfile, level, name_='opModFixedW') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModFreqWatt is not None: - showIndent(outfile, level) - outfile.write('opModFreqWatt=model_.DERCurveLink(\n') - self.opModFreqWatt.exportLiteral(outfile, level, name_='opModFreqWatt') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModHVRT is not None: - showIndent(outfile, level) - outfile.write('opModHVRT=model_.CurvePairType(\n') - self.opModHVRT.exportLiteral(outfile, level, name_='opModHVRT') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModLVRT is not None: - showIndent(outfile, level) - outfile.write('opModLVRT=model_.CurvePairType(\n') - self.opModLVRT.exportLiteral(outfile, level, name_='opModLVRT') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModVoltVAr is not None: - showIndent(outfile, level) - outfile.write('opModVoltVAr=model_.DERCurveLink(\n') - self.opModVoltVAr.exportLiteral(outfile, level, name_='opModVoltVAr') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModVoltWatt is not None: - showIndent(outfile, level) - outfile.write('opModVoltWatt=model_.DERCurveLink(\n') - self.opModVoltWatt.exportLiteral(outfile, level, name_='opModVoltWatt') - showIndent(outfile, level) - outfile.write('),\n') - if self.opModWattPF is not None: - showIndent(outfile, level) - outfile.write('opModWattPF=model_.DERCurveLink(\n') - self.opModWattPF.exportLiteral(outfile, level, name_='opModWattPF') - showIndent(outfile, level) - outfile.write('),\n') - if self.rampTms is not None: - showIndent(outfile, level) - outfile.write('rampTms=%d,\n' % self.rampTms) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'opModFixedFlow': - obj_ = SignedPerCent.factory() - obj_.build(child_) - self.opModFixedFlow = obj_ - obj_.original_tagname_ = 'opModFixedFlow' - elif nodeName_ == 'opModFixedPF': - obj_ = FixedPowerFactor.factory() - obj_.build(child_) - self.opModFixedPF = obj_ - obj_.original_tagname_ = 'opModFixedPF' - elif nodeName_ == 'opModFixedVAr': - obj_ = FixedVAr.factory() - obj_.build(child_) - self.opModFixedVAr = obj_ - obj_.original_tagname_ = 'opModFixedVAr' - elif nodeName_ == 'opModFixedW': - obj_ = PerCent.factory() - obj_.build(child_) - self.opModFixedW = obj_ - obj_.original_tagname_ = 'opModFixedW' - elif nodeName_ == 'opModFreqWatt': - obj_ = DERCurveLink.factory() - obj_.build(child_) - self.opModFreqWatt = obj_ - obj_.original_tagname_ = 'opModFreqWatt' - elif nodeName_ == 'opModHVRT': - obj_ = CurvePairType.factory() - obj_.build(child_) - self.opModHVRT = obj_ - obj_.original_tagname_ = 'opModHVRT' - elif nodeName_ == 'opModLVRT': - obj_ = CurvePairType.factory() - obj_.build(child_) - self.opModLVRT = obj_ - obj_.original_tagname_ = 'opModLVRT' - elif nodeName_ == 'opModVoltVAr': - obj_ = DERCurveLink.factory() - obj_.build(child_) - self.opModVoltVAr = obj_ - obj_.original_tagname_ = 'opModVoltVAr' - elif nodeName_ == 'opModVoltWatt': - obj_ = DERCurveLink.factory() - obj_.build(child_) - self.opModVoltWatt = obj_ - obj_.original_tagname_ = 'opModVoltWatt' - elif nodeName_ == 'opModWattPF': - obj_ = DERCurveLink.factory() - obj_.build(child_) - self.opModWattPF = obj_ - obj_.original_tagname_ = 'opModWattPF' - elif nodeName_ == 'rampTms': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'rampTms') - self.rampTms = ival_ - self.validate_UInt16(self.rampTms) # validate type UInt16 -# end class DERControlBase - - -class DERControlType(GeneratedsSuper): - """Control modes supported by the DER. Bit positions SHALL be defined - as follows: 0 - Volt-VAr Mode 1 - Frequency-Watt Mode 2 - Watt- - PowerFactor Mode 3 - Volt-Watt Mode 4 - Low Voltage Ride Through - Mode 5 - High Voltage Ride Through Mode 6-9 - reserved 10 - - setGenConnect 11 - setStorConnect 12 - Fixed W 13 - Fixed VAr 14 - - Fixed PF 15 - Charge mode 16 - Discharge mode All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DERControlType.subclass: - return DERControlType.subclass(*args_, **kwargs_) - else: - return DERControlType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERControlType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERControlType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERControlType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERControlType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DERControlType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DERControlType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DERControlType - - -class CurveData(GeneratedsSuper): - """Data point values for defining a curve or schedule""" - subclass = None - superclass = None - def __init__(self, excitation=None, xvalue=None, yvalue=None): - self.original_tagname_ = None - self.excitation = excitation - self.xvalue = xvalue - self.yvalue = yvalue - def factory(*args_, **kwargs_): - if CurveData.subclass: - return CurveData.subclass(*args_, **kwargs_) - else: - return CurveData(*args_, **kwargs_) - factory = staticmethod(factory) - def get_excitation(self): return self.excitation - def set_excitation(self, excitation): self.excitation = excitation - def get_xvalue(self): return self.xvalue - def set_xvalue(self, xvalue): self.xvalue = xvalue - def get_yvalue(self): return self.yvalue - def set_yvalue(self, yvalue): self.yvalue = yvalue - def validate_Int8(self, value): - # Validate type Int8, a restriction on xs:byte. - pass - def validate_Int32(self, value): - # Validate type Int32, a restriction on xs:int. - pass - def hasContent_(self): - if ( - self.excitation is not None or - self.xvalue is not None or - self.yvalue is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CurveData', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CurveData') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CurveData', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CurveData'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CurveData', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.excitation is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sexcitation>%s%s' % (namespace_, self.gds_format_integer(self.excitation, input_name='excitation'), namespace_, eol_)) - if self.xvalue is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sxvalue>%s%s' % (namespace_, self.gds_format_integer(self.xvalue, input_name='xvalue'), namespace_, eol_)) - if self.yvalue is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%syvalue>%s%s' % (namespace_, self.gds_format_integer(self.yvalue, input_name='yvalue'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='CurveData'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.excitation is not None: - showIndent(outfile, level) - outfile.write('excitation=%d,\n' % self.excitation) - if self.xvalue is not None: - showIndent(outfile, level) - outfile.write('xvalue=%d,\n' % self.xvalue) - if self.yvalue is not None: - showIndent(outfile, level) - outfile.write('yvalue=%d,\n' % self.yvalue) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'excitation': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'excitation') - self.excitation = ival_ - self.validate_Int8(self.excitation) # validate type Int8 - elif nodeName_ == 'xvalue': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'xvalue') - self.xvalue = ival_ - self.validate_Int32(self.xvalue) # validate type Int32 - elif nodeName_ == 'yvalue': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'yvalue') - self.yvalue = ival_ - self.validate_Int32(self.yvalue) # validate type Int32 -# end class CurveData - - -class DERCurveType(GeneratedsSuper): - """0 - Volt-VAr Mode 1 - Frequency-Watt Curve Mode 2 - Watt-PowerFactor - Mode 3 - Volt-Watt Mode 4 - Low Voltage Ride Through Mode 5 - - High Voltage Ride Through Mode All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DERCurveType.subclass: - return DERCurveType.subclass(*args_, **kwargs_) - else: - return DERCurveType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCurveType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCurveType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCurveType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DERCurveType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DERCurveType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DERCurveType - - -class CurvePairType(GeneratedsSuper): - """Specifies a pair of DERCurves.""" - subclass = None - superclass = None - def __init__(self, lowerLimit=None, upperLimit=None): - self.original_tagname_ = None - self.lowerLimit = lowerLimit - self.upperLimit = upperLimit - def factory(*args_, **kwargs_): - if CurvePairType.subclass: - return CurvePairType.subclass(*args_, **kwargs_) - else: - return CurvePairType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_lowerLimit(self): return self.lowerLimit - def set_lowerLimit(self, lowerLimit): self.lowerLimit = lowerLimit - def get_upperLimit(self): return self.upperLimit - def set_upperLimit(self, upperLimit): self.upperLimit = upperLimit - def hasContent_(self): - if ( - self.lowerLimit is not None or - self.upperLimit is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CurvePairType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CurvePairType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CurvePairType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CurvePairType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CurvePairType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.lowerLimit is not None: - self.lowerLimit.export(outfile, level, namespace_, name_='lowerLimit', pretty_print=pretty_print) - if self.upperLimit is not None: - self.upperLimit.export(outfile, level, namespace_, name_='upperLimit', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CurvePairType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.lowerLimit is not None: - showIndent(outfile, level) - outfile.write('lowerLimit=model_.DERCurveLink(\n') - self.lowerLimit.exportLiteral(outfile, level, name_='lowerLimit') - showIndent(outfile, level) - outfile.write('),\n') - if self.upperLimit is not None: - showIndent(outfile, level) - outfile.write('upperLimit=model_.DERCurveLink(\n') - self.upperLimit.exportLiteral(outfile, level, name_='upperLimit') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'lowerLimit': - obj_ = DERCurveLink.factory() - obj_.build(child_) - self.lowerLimit = obj_ - obj_.original_tagname_ = 'lowerLimit' - elif nodeName_ == 'upperLimit': - obj_ = DERCurveLink.factory() - obj_.build(child_) - self.upperLimit = obj_ - obj_.original_tagname_ = 'upperLimit' -# end class CurvePairType - - -class DERUnitRefType(GeneratedsSuper): - """Specifies context for interpreting percent values: 0 - N/A 1 - - %setMaxW 2 - %setMaxVAr 3 - %statVArAvail 4 - %setEffectiveV 5 - - %setMaxChargeRate 6 - %setMaxDischargeRate All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DERUnitRefType.subclass: - return DERUnitRefType.subclass(*args_, **kwargs_) - else: - return DERUnitRefType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERUnitRefType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERUnitRefType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERUnitRefType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERUnitRefType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DERUnitRefType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DERUnitRefType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DERUnitRefType - - -class CurrentRMS(GeneratedsSuper): - """Average flow of charge through a conductor.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if CurrentRMS.subclass: - return CurrentRMS.subclass(*args_, **kwargs_) - else: - return CurrentRMS(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CurrentRMS', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CurrentRMS') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CurrentRMS', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CurrentRMS'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CurrentRMS', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='CurrentRMS'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class CurrentRMS - - -class FixedPointType(GeneratedsSuper): - """Abstract type for specifying a fixed-point value without a given - unit of measure.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if FixedPointType.subclass: - return FixedPointType.subclass(*args_, **kwargs_) - else: - return FixedPointType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_Int16(self, value): - # Validate type Int16, a restriction on xs:short. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FixedPointType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FixedPointType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FixedPointType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FixedPointType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='FixedPointType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='FixedPointType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int16(self.value) # validate type Int16 -# end class FixedPointType - - -class UnsignedFixedPointType(GeneratedsSuper): - """Abstract type for specifying an unsigned fixed-point value without a - given unit of measure.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if UnsignedFixedPointType.subclass: - return UnsignedFixedPointType.subclass(*args_, **kwargs_) - else: - return UnsignedFixedPointType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UnsignedFixedPointType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UnsignedFixedPointType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UnsignedFixedPointType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UnsignedFixedPointType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='UnsignedFixedPointType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='UnsignedFixedPointType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class UnsignedFixedPointType - - -class ActivePower(GeneratedsSuper): - """The active (real) power P (in W) is the product of root-mean-square - (RMS) voltage, RMS current, and cos(theta) where theta is the - phase angle of current relative to voltage. It is the primary - measure of the rate of flow of energy.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if ActivePower.subclass: - return ActivePower.subclass(*args_, **kwargs_) - else: - return ActivePower(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_Int16(self, value): - # Validate type Int16, a restriction on xs:short. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActivePower', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActivePower') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActivePower', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActivePower'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ActivePower', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ActivePower'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int16(self.value) # validate type Int16 -# end class ActivePower - - -class AmpereHour(GeneratedsSuper): - """Available electric charge""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if AmpereHour.subclass: - return AmpereHour.subclass(*args_, **kwargs_) - else: - return AmpereHour(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AmpereHour', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AmpereHour') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AmpereHour', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AmpereHour'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='AmpereHour', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='AmpereHour'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class AmpereHour - - -class ApparentPower(GeneratedsSuper): - """The apparent power S (in VA) is the product of root mean square - (RMS) voltage and RMS current.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if ApparentPower.subclass: - return ApparentPower.subclass(*args_, **kwargs_) - else: - return ApparentPower(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ApparentPower', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ApparentPower') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ApparentPower', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ApparentPower'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ApparentPower', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ApparentPower'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class ApparentPower - - -class ReactivePower(GeneratedsSuper): - """The reactive power Q (in var) is the product of root mean square - (RMS) voltage, RMS current, and sin(theta) where theta is the - phase angle of current relative to voltage.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if ReactivePower.subclass: - return ReactivePower.subclass(*args_, **kwargs_) - else: - return ReactivePower(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_Int16(self, value): - # Validate type Int16, a restriction on xs:short. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReactivePower', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReactivePower') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReactivePower', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReactivePower'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ReactivePower', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ReactivePower'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int16(self.value) # validate type Int16 -# end class ReactivePower - - -class FixedPowerFactor(GeneratedsSuper): - """Specifies a setpoint for Displacement Power Factor, the ratio - between apparent and active powers at the fundamental frequency - (e.g. 60 Hz).""" - subclass = None - superclass = None - def __init__(self, displacement=None, multiplier=None): - self.original_tagname_ = None - self.displacement = displacement - self.multiplier = multiplier - def factory(*args_, **kwargs_): - if FixedPowerFactor.subclass: - return FixedPowerFactor.subclass(*args_, **kwargs_) - else: - return FixedPowerFactor(*args_, **kwargs_) - factory = staticmethod(factory) - def get_displacement(self): return self.displacement - def set_displacement(self, displacement): self.displacement = displacement - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def validate_Int16(self, value): - # Validate type Int16, a restriction on xs:short. - pass - def hasContent_(self): - if ( - self.displacement is not None or - self.multiplier is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FixedPowerFactor', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FixedPowerFactor') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FixedPowerFactor', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FixedPowerFactor'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='FixedPowerFactor', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.displacement is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdisplacement>%s%s' % (namespace_, self.gds_format_integer(self.displacement, input_name='displacement'), namespace_, eol_)) - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FixedPowerFactor'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.displacement is not None: - showIndent(outfile, level) - outfile.write('displacement=%d,\n' % self.displacement) - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'displacement': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'displacement') - self.displacement = ival_ - self.validate_Int16(self.displacement) # validate type Int16 - elif nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' -# end class FixedPowerFactor - - -class FixedVAr(GeneratedsSuper): - """Specifies a signed setpoint for reactive power.""" - subclass = None - superclass = None - def __init__(self, refType=None, value=None): - self.original_tagname_ = None - self.refType = refType - self.value = value - def factory(*args_, **kwargs_): - if FixedVAr.subclass: - return FixedVAr.subclass(*args_, **kwargs_) - else: - return FixedVAr(*args_, **kwargs_) - factory = staticmethod(factory) - def get_refType(self): return self.refType - def set_refType(self, refType): self.refType = refType - def get_value(self): return self.value - def set_value(self, value): self.value = value - def hasContent_(self): - if ( - self.refType is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FixedVAr', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FixedVAr') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FixedVAr', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FixedVAr'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='FixedVAr', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.refType is not None: - self.refType.export(outfile, level, namespace_, name_='refType', pretty_print=pretty_print) - if self.value is not None: - self.value.export(outfile, level, namespace_, name_='value', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FixedVAr'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.refType is not None: - showIndent(outfile, level) - outfile.write('refType=model_.DERUnitRefType(\n') - self.refType.exportLiteral(outfile, level, name_='refType') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=model_.SignedPerCent(\n') - self.value.exportLiteral(outfile, level, name_='value') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'refType': - obj_ = DERUnitRefType.factory() - obj_.build(child_) - self.refType = obj_ - obj_.original_tagname_ = 'refType' - elif nodeName_ == 'value': - obj_ = SignedPerCent.factory() - obj_.build(child_) - self.value = obj_ - obj_.original_tagname_ = 'value' -# end class FixedVAr - - -class WattHour(GeneratedsSuper): - """Active (real) energy""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if WattHour.subclass: - return WattHour.subclass(*args_, **kwargs_) - else: - return WattHour(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='WattHour', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='WattHour') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='WattHour', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='WattHour'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='WattHour', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='WattHour'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class WattHour - - -class VoltageRMS(GeneratedsSuper): - """Average electric potential difference between two points.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if VoltageRMS.subclass: - return VoltageRMS.subclass(*args_, **kwargs_) - else: - return VoltageRMS(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='VoltageRMS', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='VoltageRMS') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='VoltageRMS', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='VoltageRMS'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='VoltageRMS', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='VoltageRMS'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt16(self.value) # validate type UInt16 -# end class VoltageRMS - - -class ConnectStatusType(GeneratedsSuper): - """DER ConnectStatus value: 0 - N/A 1 - disconnected_unavail 2 - - disconnected_avail 3 - connected_unavail 4 - connected_avail 5 - - connected_on 6 - test_mode All other values reserved.""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if ConnectStatusType.subclass: - return ConnectStatusType.subclass(*args_, **kwargs_) - else: - return ConnectStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConnectStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConnectStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConnectStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConnectStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ConnectStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ConnectStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt8(self.value) # validate type UInt8 -# end class ConnectStatusType - - -class InverterStatusType(GeneratedsSuper): - """DER InverterStatus value: 0 - N/A 1 - off 2 - sleeping (auto- - shutdown) or DER is at low output power/voltage 3 - starting up - or ON but not producing power 4 - tracking MPPT power point 5 - - forced power reduction/derating 6 - shutting down 7 - one or - more faults exist 8 - standby (service on unit) - DER may be at - high output voltage/power 9 - test mode 10 - as defined in - manufacturer status All other values reserved.""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if InverterStatusType.subclass: - return InverterStatusType.subclass(*args_, **kwargs_) - else: - return InverterStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='InverterStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='InverterStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='InverterStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='InverterStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='InverterStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='InverterStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt8(self.value) # validate type UInt8 -# end class InverterStatusType - - -class LocalControlModeStatusType(GeneratedsSuper): - """DER LocalControlModeStatus/value: 0 – local control 1 – remote - control All other values reserved.""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if LocalControlModeStatusType.subclass: - return LocalControlModeStatusType.subclass(*args_, **kwargs_) - else: - return LocalControlModeStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LocalControlModeStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LocalControlModeStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LocalControlModeStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LocalControlModeStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='LocalControlModeStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='LocalControlModeStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt8(self.value) # validate type UInt8 -# end class LocalControlModeStatusType - - -class ManufacturerStatusType(GeneratedsSuper): - """DER ManufacturerStatus/value: String data type""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if ManufacturerStatusType.subclass: - return ManufacturerStatusType.subclass(*args_, **kwargs_) - else: - return ManufacturerStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_String6(self, value): - # Validate type String6, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ManufacturerStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ManufacturerStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ManufacturerStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ManufacturerStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ManufacturerStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.value).encode(ExternalEncoding), input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ManufacturerStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%s,\n' % quote_python(self.value).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - value_ = child_.text - value_ = self.gds_validate_string(value_, node, 'value') - self.value = value_ - self.validate_String6(self.value) # validate type String6 -# end class ManufacturerStatusType - - -class OperationalModeStatusType(GeneratedsSuper): - """DER OperationalModeStatus value: 0 - Not applicable / Unknown 1 - - Off 2 - Operational mode 3 - Test mode All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if OperationalModeStatusType.subclass: - return OperationalModeStatusType.subclass(*args_, **kwargs_) - else: - return OperationalModeStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='OperationalModeStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='OperationalModeStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='OperationalModeStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OperationalModeStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='OperationalModeStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='OperationalModeStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt8(self.value) # validate type UInt8 -# end class OperationalModeStatusType - - -class StateOfChargeStatusType(GeneratedsSuper): - """DER StateOfChargeStatus value: Percent data type""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if StateOfChargeStatusType.subclass: - return StateOfChargeStatusType.subclass(*args_, **kwargs_) - else: - return StateOfChargeStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='StateOfChargeStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='StateOfChargeStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='StateOfChargeStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='StateOfChargeStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='StateOfChargeStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - self.value.export(outfile, level, namespace_, name_='value', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='StateOfChargeStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=model_.PerCent(\n') - self.value.exportLiteral(outfile, level, name_='value') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - obj_ = PerCent.factory() - obj_.build(child_) - self.value = obj_ - obj_.original_tagname_ = 'value' -# end class StateOfChargeStatusType - - -class StorageModeStatusType(GeneratedsSuper): - """DER StorageModeStatus value: 0 – storage charging 1 – storage - discharging 2 – storage holding All other values reserved.""" - subclass = None - superclass = None - def __init__(self, dateTime=None, value=None): - self.original_tagname_ = None - self.dateTime = dateTime - self.value = value - def factory(*args_, **kwargs_): - if StorageModeStatusType.subclass: - return StorageModeStatusType.subclass(*args_, **kwargs_) - else: - return StorageModeStatusType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.dateTime is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='StorageModeStatusType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='StorageModeStatusType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='StorageModeStatusType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='StorageModeStatusType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='StorageModeStatusType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='StorageModeStatusType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt8(self.value) # validate type UInt8 -# end class StorageModeStatusType - - -class Link(GeneratedsSuper): - """Links provide a reference, via URI, to another resource.A URI - reference.""" - subclass = None - superclass = None - def __init__(self, href=None): - self.original_tagname_ = None - self.href = _cast(None, href) - def factory(*args_, **kwargs_): - if Link.subclass: - return Link.subclass(*args_, **kwargs_) - else: - return Link(*args_, **kwargs_) - factory = staticmethod(factory) - def get_href(self): return self.href - def set_href(self, href): self.href = href - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Link', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Link') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Link', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Link'): - if self.href is not None and 'href' not in already_processed: - already_processed.add('href') - outfile.write(' href=%s' % (self.gds_format_string(quote_attrib(self.href).encode(ExternalEncoding), input_name='href'), )) - def exportChildren(self, outfile, level, namespace_='', name_='Link', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='Link'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.href is not None and 'href' not in already_processed: - already_processed.add('href') - showIndent(outfile, level) - outfile.write('href="%s",\n' % (self.href,)) - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('href', node) - if value is not None and 'href' not in already_processed: - already_processed.add('href') - self.href = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Link - - -class ListLink(Link): - """ListLinks provide a reference, via URI, to a List.Indicates the - total number of items in the referenced list.""" - subclass = None - superclass = Link - def __init__(self, all=None): - self.original_tagname_ = None - super(ListLink, self).__init__() - self.all = _cast(None, all) - def factory(*args_, **kwargs_): - if ListLink.subclass: - return ListLink.subclass(*args_, **kwargs_) - else: - return ListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def get_all(self): return self.all - def set_all(self, all): self.all = all - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - super(ListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ListLink'): - super(ListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ListLink') - if self.all is not None and 'all' not in already_processed: - already_processed.add('all') - outfile.write(' all=%s' % (quote_attrib(self.all), )) - def exportChildren(self, outfile, level, namespace_='', name_='ListLink', fromsubclass_=False, pretty_print=True): - super(ListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.all is not None and 'all' not in already_processed: - already_processed.add('all') - showIndent(outfile, level) - outfile.write('all=%d,\n' % (self.all,)) - super(ListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('all', node) - if value is not None and 'all' not in already_processed: - already_processed.add('all') - try: - self.all = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - self.validate_UInt16(self.all) # validate type UInt16 - super(ListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ListLink - - -class Resource(GeneratedsSuper): - """A resource is an addressable unit of information, either a - collection (List) or instance of an object (identifiedObject, or - simply, Resource)A reference to the resource address (URI). - Required in a response to a GET, ignored otherwise.""" - subclass = None - superclass = None - def __init__(self, href=None): - self.original_tagname_ = None - self.href = _cast(None, href) - def factory(*args_, **kwargs_): - if Resource.subclass: - return Resource.subclass(*args_, **kwargs_) - else: - return Resource(*args_, **kwargs_) - factory = staticmethod(factory) - def get_href(self): return self.href - def set_href(self, href): self.href = href - def hasContent_(self): - if ( - - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Resource', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Resource') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Resource', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Resource'): - if self.href is not None and 'href' not in already_processed: - already_processed.add('href') - outfile.write(' href=%s' % (self.gds_format_string(quote_attrib(self.href).encode(ExternalEncoding), input_name='href'), )) - def exportChildren(self, outfile, level, namespace_='', name_='Resource', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='Resource'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.href is not None and 'href' not in already_processed: - already_processed.add('href') - showIndent(outfile, level) - outfile.write('href="%s",\n' % (self.href,)) - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('href', node) - if value is not None and 'href' not in already_processed: - already_processed.add('href') - self.href = value - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class Resource - - -class RespondableResource(Resource): - """A Resource to which a Response can be requested.A reference to the - response resource address (URI). Required on a response to a GET - if responseRequired is "true".Indicates whether or not a - response is required upon receipt, creation or update of this - resource. Responses shall be posted to the collection specified - in "replyTo". If the resource has a deviceCategory field, - devices that match one or more of the device types indicated in - deviceCategory SHALL respond according to the rules listed - below. If the category does not match, the device SHALL NOT - respond. If the resource does not have a deviceCategory field, a - device receiving the resource SHALL respond according to the - rules listed below. Value encoded as hex according to the - following bit assignments, any combination is possible. See - Table 10-10 for the list of appropriate Response status codes to - be sent for these purposes. 0 - End device shall indicate that - message was received 1 - End device shall indicate specific - response. 2 - End user / customer response is required. All - other values reserved.""" - subclass = None - superclass = Resource - def __init__(self, replyTo=None, responseRequired='00'): - self.original_tagname_ = None - super(RespondableResource, self).__init__() - self.replyTo = _cast(None, replyTo) - self.responseRequired = _cast(None, responseRequired) - def factory(*args_, **kwargs_): - if RespondableResource.subclass: - return RespondableResource.subclass(*args_, **kwargs_) - else: - return RespondableResource(*args_, **kwargs_) - factory = staticmethod(factory) - def get_replyTo(self): return self.replyTo - def set_replyTo(self, replyTo): self.replyTo = replyTo - def get_responseRequired(self): return self.responseRequired - def set_responseRequired(self, responseRequired): self.responseRequired = responseRequired - def validate_HexBinary8(self, value): - # Validate type HexBinary8, a restriction on xs:hexBinary. - pass - def hasContent_(self): - if ( - super(RespondableResource, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RespondableResource', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RespondableResource') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RespondableResource', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RespondableResource'): - super(RespondableResource, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RespondableResource') - if self.replyTo is not None and 'replyTo' not in already_processed: - already_processed.add('replyTo') - outfile.write(' replyTo=%s' % (self.gds_format_string(quote_attrib(self.replyTo).encode(ExternalEncoding), input_name='replyTo'), )) - if self.responseRequired is not None and 'responseRequired' not in already_processed: - already_processed.add('responseRequired') - outfile.write(' responseRequired=%s' % (quote_attrib(self.responseRequired), )) - def exportChildren(self, outfile, level, namespace_='', name_='RespondableResource', fromsubclass_=False, pretty_print=True): - super(RespondableResource, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='RespondableResource'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.replyTo is not None and 'replyTo' not in already_processed: - already_processed.add('replyTo') - showIndent(outfile, level) - outfile.write('replyTo="%s",\n' % (self.replyTo,)) - if self.responseRequired is not None and 'responseRequired' not in already_processed: - already_processed.add('responseRequired') - showIndent(outfile, level) - outfile.write('responseRequired="%s",\n' % (self.responseRequired,)) - super(RespondableResource, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RespondableResource, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('replyTo', node) - if value is not None and 'replyTo' not in already_processed: - already_processed.add('replyTo') - self.replyTo = value - value = find_attr_value_('responseRequired', node) - if value is not None and 'responseRequired' not in already_processed: - already_processed.add('responseRequired') - self.responseRequired = value - self.validate_HexBinary8(self.responseRequired) # validate type HexBinary8 - super(RespondableResource, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RespondableResource, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RespondableResource - - -class RespondableSubscribableIdentifiedObject(RespondableResource): - """An IdentifiedObject to which a Response can be requested.Indicates - whether or not subscriptions are supported for this resource, - and whether or not conditional (thresholds) are supported. If - not specified, is "not subscribable" (0).""" - subclass = None - superclass = RespondableResource - def __init__(self, subscribable='0', mRID=None, description=None, version=None): - self.original_tagname_ = None - super(RespondableSubscribableIdentifiedObject, self).__init__() - self.subscribable = _cast(None, subscribable) - self.mRID = mRID - self.description = description - self.version = version - def factory(*args_, **kwargs_): - if RespondableSubscribableIdentifiedObject.subclass: - return RespondableSubscribableIdentifiedObject.subclass(*args_, **kwargs_) - else: - return RespondableSubscribableIdentifiedObject(*args_, **kwargs_) - factory = staticmethod(factory) - def get_mRID(self): return self.mRID - def set_mRID(self, mRID): self.mRID = mRID - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_version(self): return self.version - def set_version(self, version): self.version = version - def get_subscribable(self): return self.subscribable - def set_subscribable(self, subscribable): self.subscribable = subscribable - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def validate_SubscribableType(self, value): - # Validate type SubscribableType, a restriction on UInt8. - pass - def hasContent_(self): - if ( - self.mRID is not None or - self.description is not None or - self.version is not None or - super(RespondableSubscribableIdentifiedObject, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RespondableSubscribableIdentifiedObject', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RespondableSubscribableIdentifiedObject') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RespondableSubscribableIdentifiedObject', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RespondableSubscribableIdentifiedObject'): - super(RespondableSubscribableIdentifiedObject, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RespondableSubscribableIdentifiedObject') - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - outfile.write(' subscribable=%s' % (quote_attrib(self.subscribable), )) - def exportChildren(self, outfile, level, namespace_='', name_='RespondableSubscribableIdentifiedObject', fromsubclass_=False, pretty_print=True): - super(RespondableSubscribableIdentifiedObject, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.mRID is not None: - self.mRID.export(outfile, level, namespace_, name_='mRID', pretty_print=pretty_print) - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.version is not None: - self.version.export(outfile, level, namespace_, name_='version', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RespondableSubscribableIdentifiedObject'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - showIndent(outfile, level) - outfile.write('subscribable=%d,\n' % (self.subscribable,)) - super(RespondableSubscribableIdentifiedObject, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RespondableSubscribableIdentifiedObject, self).exportLiteralChildren(outfile, level, name_) - if self.mRID is not None: - showIndent(outfile, level) - outfile.write('mRID=model_.mRIDType(\n') - self.mRID.exportLiteral(outfile, level, name_='mRID') - showIndent(outfile, level) - outfile.write('),\n') - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.version is not None: - showIndent(outfile, level) - outfile.write('version=model_.VersionType(\n') - self.version.exportLiteral(outfile, level, name_='version') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('subscribable', node) - if value is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - self.subscribable = value - self.validate_SubscribableType(self.subscribable) # validate type SubscribableType - super(RespondableSubscribableIdentifiedObject, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'mRID': - obj_ = mRIDType.factory() - obj_.build(child_) - self.mRID = obj_ - obj_.original_tagname_ = 'mRID' - elif nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String32(self.description) # validate type String32 - elif nodeName_ == 'version': - obj_ = VersionType.factory() - obj_.build(child_) - self.version = obj_ - obj_.original_tagname_ = 'version' - super(RespondableSubscribableIdentifiedObject, self).buildChildren(child_, node, nodeName_, True) -# end class RespondableSubscribableIdentifiedObject - - -class SubscribableResource(Resource): - """A Resource to which a Subscription can be requested.Indicates - whether or not subscriptions are supported for this resource, - and whether or not conditional (thresholds) are supported. If - not specified, is "not subscribable" (0).""" - subclass = None - superclass = Resource - def __init__(self, subscribable='0'): - self.original_tagname_ = None - super(SubscribableResource, self).__init__() - self.subscribable = _cast(None, subscribable) - def factory(*args_, **kwargs_): - if SubscribableResource.subclass: - return SubscribableResource.subclass(*args_, **kwargs_) - else: - return SubscribableResource(*args_, **kwargs_) - factory = staticmethod(factory) - def get_subscribable(self): return self.subscribable - def set_subscribable(self, subscribable): self.subscribable = subscribable - def validate_SubscribableType(self, value): - # Validate type SubscribableType, a restriction on UInt8. - pass - def hasContent_(self): - if ( - super(SubscribableResource, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubscribableResource', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubscribableResource') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubscribableResource', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubscribableResource'): - super(SubscribableResource, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SubscribableResource') - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - outfile.write(' subscribable=%s' % (quote_attrib(self.subscribable), )) - def exportChildren(self, outfile, level, namespace_='', name_='SubscribableResource', fromsubclass_=False, pretty_print=True): - super(SubscribableResource, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SubscribableResource'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - showIndent(outfile, level) - outfile.write('subscribable=%d,\n' % (self.subscribable,)) - super(SubscribableResource, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SubscribableResource, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('subscribable', node) - if value is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - self.subscribable = value - self.validate_SubscribableType(self.subscribable) # validate type SubscribableType - super(SubscribableResource, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SubscribableResource, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SubscribableResource - - -class Error(GeneratedsSuper): - """Contains information about the nature of an error if a request could - not be completed successfully.""" - subclass = None - superclass = None - def __init__(self, maxRetryDuration=None, reasonCode=None): - self.original_tagname_ = None - self.maxRetryDuration = maxRetryDuration - self.reasonCode = reasonCode - def factory(*args_, **kwargs_): - if Error.subclass: - return Error.subclass(*args_, **kwargs_) - else: - return Error(*args_, **kwargs_) - factory = staticmethod(factory) - def get_maxRetryDuration(self): return self.maxRetryDuration - def set_maxRetryDuration(self, maxRetryDuration): self.maxRetryDuration = maxRetryDuration - def get_reasonCode(self): return self.reasonCode - def set_reasonCode(self, reasonCode): self.reasonCode = reasonCode - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.maxRetryDuration is not None or - self.reasonCode is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Error', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Error') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Error', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Error'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='Error', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.maxRetryDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smaxRetryDuration>%s%s' % (namespace_, self.gds_format_integer(self.maxRetryDuration, input_name='maxRetryDuration'), namespace_, eol_)) - if self.reasonCode is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sreasonCode>%s%s' % (namespace_, self.gds_format_integer(self.reasonCode, input_name='reasonCode'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Error'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.maxRetryDuration is not None: - showIndent(outfile, level) - outfile.write('maxRetryDuration=%d,\n' % self.maxRetryDuration) - if self.reasonCode is not None: - showIndent(outfile, level) - outfile.write('reasonCode=%d,\n' % self.reasonCode) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'maxRetryDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'maxRetryDuration') - self.maxRetryDuration = ival_ - self.validate_UInt16(self.maxRetryDuration) # validate type UInt16 - elif nodeName_ == 'reasonCode': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'reasonCode') - self.reasonCode = ival_ - self.validate_UInt16(self.reasonCode) # validate type UInt16 -# end class Error - - -class Event(RespondableSubscribableIdentifiedObject): - """An Event indicates information that applies to a particular period - of time. Events SHALL be executed relative to the time of the - server, as described in the Time function set section 11.1.""" - subclass = None - superclass = RespondableSubscribableIdentifiedObject - def __init__(self, creationTime=None, EventStatus=None, interval=None): - self.original_tagname_ = None - super(Event, self).__init__() - self.creationTime = creationTime - self.EventStatus = EventStatus - self.interval = interval - def factory(*args_, **kwargs_): - if Event.subclass: - return Event.subclass(*args_, **kwargs_) - else: - return Event(*args_, **kwargs_) - factory = staticmethod(factory) - def get_creationTime(self): return self.creationTime - def set_creationTime(self, creationTime): self.creationTime = creationTime - def get_EventStatus(self): return self.EventStatus - def set_EventStatus(self, EventStatus): self.EventStatus = EventStatus - def get_interval(self): return self.interval - def set_interval(self, interval): self.interval = interval - def hasContent_(self): - if ( - self.creationTime is not None or - self.EventStatus is not None or - self.interval is not None or - super(Event, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Event', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Event') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Event', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Event'): - super(Event, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Event') - def exportChildren(self, outfile, level, namespace_='', name_='Event', fromsubclass_=False, pretty_print=True): - super(Event, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.creationTime is not None: - self.creationTime.export(outfile, level, namespace_, name_='creationTime', pretty_print=pretty_print) - if self.EventStatus is not None: - self.EventStatus.export(outfile, level, namespace_, name_='EventStatus', pretty_print=pretty_print) - if self.interval is not None: - self.interval.export(outfile, level, namespace_, name_='interval', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='Event'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Event, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Event, self).exportLiteralChildren(outfile, level, name_) - if self.creationTime is not None: - showIndent(outfile, level) - outfile.write('creationTime=model_.TimeType(\n') - self.creationTime.exportLiteral(outfile, level, name_='creationTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.EventStatus is not None: - showIndent(outfile, level) - outfile.write('EventStatus=model_.EventStatus(\n') - self.EventStatus.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.interval is not None: - showIndent(outfile, level) - outfile.write('interval=model_.DateTimeInterval(\n') - self.interval.exportLiteral(outfile, level, name_='interval') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Event, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'creationTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.creationTime = obj_ - obj_.original_tagname_ = 'creationTime' - elif nodeName_ == 'EventStatus': - obj_ = EventStatus.factory() - obj_.build(child_) - self.EventStatus = obj_ - obj_.original_tagname_ = 'EventStatus' - elif nodeName_ == 'interval': - obj_ = DateTimeInterval.factory() - obj_.build(child_) - self.interval = obj_ - obj_.original_tagname_ = 'interval' - super(Event, self).buildChildren(child_, node, nodeName_, True) -# end class Event - - -class EventStatus(GeneratedsSuper): - """Current status information relevant to a specific object. The Status - object is used to indicate the current status of an Event. - Devices can read the containing resource (e.g. TextMessage) to - get the most up to date status of the event. Devices can also - subscribe to a specific resource instance to get updates when - any of its attributes change, including the Status object.""" - subclass = None - superclass = None - def __init__(self, currentStatus=None, dateTime=None, potentiallySuperseded=None, potentiallySupersededTime=None, reason=None): - self.original_tagname_ = None - self.currentStatus = currentStatus - self.dateTime = dateTime - self.potentiallySuperseded = potentiallySuperseded - self.potentiallySupersededTime = potentiallySupersededTime - self.reason = reason - def factory(*args_, **kwargs_): - if EventStatus.subclass: - return EventStatus.subclass(*args_, **kwargs_) - else: - return EventStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_currentStatus(self): return self.currentStatus - def set_currentStatus(self, currentStatus): self.currentStatus = currentStatus - def get_dateTime(self): return self.dateTime - def set_dateTime(self, dateTime): self.dateTime = dateTime - def get_potentiallySuperseded(self): return self.potentiallySuperseded - def set_potentiallySuperseded(self, potentiallySuperseded): self.potentiallySuperseded = potentiallySuperseded - def get_potentiallySupersededTime(self): return self.potentiallySupersededTime - def set_potentiallySupersededTime(self, potentiallySupersededTime): self.potentiallySupersededTime = potentiallySupersededTime - def get_reason(self): return self.reason - def set_reason(self, reason): self.reason = reason - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_String192(self, value): - # Validate type String192, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.currentStatus is not None or - self.dateTime is not None or - self.potentiallySuperseded is not None or - self.potentiallySupersededTime is not None or - self.reason is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EventStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EventStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EventStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EventStatus'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='EventStatus', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.currentStatus is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scurrentStatus>%s%s' % (namespace_, self.gds_format_integer(self.currentStatus, input_name='currentStatus'), namespace_, eol_)) - if self.dateTime is not None: - self.dateTime.export(outfile, level, namespace_, name_='dateTime', pretty_print=pretty_print) - if self.potentiallySuperseded is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%spotentiallySuperseded>%s%s' % (namespace_, self.gds_format_boolean(self.potentiallySuperseded, input_name='potentiallySuperseded'), namespace_, eol_)) - if self.potentiallySupersededTime is not None: - self.potentiallySupersededTime.export(outfile, level, namespace_, name_='potentiallySupersededTime', pretty_print=pretty_print) - if self.reason is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sreason>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.reason).encode(ExternalEncoding), input_name='reason'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='EventStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.currentStatus is not None: - showIndent(outfile, level) - outfile.write('currentStatus=%d,\n' % self.currentStatus) - if self.dateTime is not None: - showIndent(outfile, level) - outfile.write('dateTime=model_.TimeType(\n') - self.dateTime.exportLiteral(outfile, level, name_='dateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.potentiallySuperseded is not None: - showIndent(outfile, level) - outfile.write('potentiallySuperseded=%s,\n' % self.potentiallySuperseded) - if self.potentiallySupersededTime is not None: - showIndent(outfile, level) - outfile.write('potentiallySupersededTime=model_.TimeType(\n') - self.potentiallySupersededTime.exportLiteral(outfile, level, name_='potentiallySupersededTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.reason is not None: - showIndent(outfile, level) - outfile.write('reason=%s,\n' % quote_python(self.reason).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'currentStatus': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'currentStatus') - self.currentStatus = ival_ - self.validate_UInt8(self.currentStatus) # validate type UInt8 - elif nodeName_ == 'dateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTime = obj_ - obj_.original_tagname_ = 'dateTime' - elif nodeName_ == 'potentiallySuperseded': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'potentiallySuperseded') - self.potentiallySuperseded = ival_ - elif nodeName_ == 'potentiallySupersededTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.potentiallySupersededTime = obj_ - obj_.original_tagname_ = 'potentiallySupersededTime' - elif nodeName_ == 'reason': - reason_ = child_.text - reason_ = self.gds_validate_string(reason_, node, 'reason') - self.reason = reason_ - self.validate_String192(self.reason) # validate type String192 -# end class EventStatus - - -class RandomizableEvent(Event): - """An Event that can indicate time ranges over which the start time and - duration SHALL be randomized.""" - subclass = None - superclass = Event - def __init__(self, randomizeDuration=None, randomizeStart=None): - self.original_tagname_ = None - super(RandomizableEvent, self).__init__() - self.randomizeDuration = randomizeDuration - self.randomizeStart = randomizeStart - def factory(*args_, **kwargs_): - if RandomizableEvent.subclass: - return RandomizableEvent.subclass(*args_, **kwargs_) - else: - return RandomizableEvent(*args_, **kwargs_) - factory = staticmethod(factory) - def get_randomizeDuration(self): return self.randomizeDuration - def set_randomizeDuration(self, randomizeDuration): self.randomizeDuration = randomizeDuration - def get_randomizeStart(self): return self.randomizeStart - def set_randomizeStart(self, randomizeStart): self.randomizeStart = randomizeStart - def hasContent_(self): - if ( - self.randomizeDuration is not None or - self.randomizeStart is not None or - super(RandomizableEvent, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RandomizableEvent', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RandomizableEvent') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RandomizableEvent', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RandomizableEvent'): - super(RandomizableEvent, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RandomizableEvent') - def exportChildren(self, outfile, level, namespace_='', name_='RandomizableEvent', fromsubclass_=False, pretty_print=True): - super(RandomizableEvent, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.randomizeDuration is not None: - self.randomizeDuration.export(outfile, level, namespace_, name_='randomizeDuration', pretty_print=pretty_print) - if self.randomizeStart is not None: - self.randomizeStart.export(outfile, level, namespace_, name_='randomizeStart', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RandomizableEvent'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RandomizableEvent, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RandomizableEvent, self).exportLiteralChildren(outfile, level, name_) - if self.randomizeDuration is not None: - showIndent(outfile, level) - outfile.write('randomizeDuration=model_.OneHourRangeType(\n') - self.randomizeDuration.exportLiteral(outfile, level, name_='randomizeDuration') - showIndent(outfile, level) - outfile.write('),\n') - if self.randomizeStart is not None: - showIndent(outfile, level) - outfile.write('randomizeStart=model_.OneHourRangeType(\n') - self.randomizeStart.exportLiteral(outfile, level, name_='randomizeStart') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RandomizableEvent, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'randomizeDuration': - obj_ = OneHourRangeType.factory() - obj_.build(child_) - self.randomizeDuration = obj_ - obj_.original_tagname_ = 'randomizeDuration' - elif nodeName_ == 'randomizeStart': - obj_ = OneHourRangeType.factory() - obj_.build(child_) - self.randomizeStart = obj_ - obj_.original_tagname_ = 'randomizeStart' - super(RandomizableEvent, self).buildChildren(child_, node, nodeName_, True) -# end class RandomizableEvent - - -class AccumulationBehaviourType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 3 = Cumulative The - sum of the previous billing period values. Note: - “Cumulative” is commonly used in conjunction with - “demand.” Each demand reset causes the maximum demand value - for the present billing period (since the last demand reset) to - accumulate as an accumulative total of all maximum demands. So - instead of “zeroing” the demand register, a demand reset has - the affect of adding the present maximum demand to this - accumulating total. 4 = DeltaData The difference between the - value at the end of the prescribed interval and the beginning of - the interval. This is used for incremental interval data. Note: - One common application would be for load profile data, another - use might be to report the number of events within an interval - (such as the number of equipment energizations within the - specified period of time.) 6 = Indicating As if a needle is - swung out on the meter face to a value to indicate the current - value. (Note: An “indicating” value is typically measured - over hundreds of milliseconds or greater, or may imply a - “pusher” mechanism to capture a value. Compare this to - “instantaneous” which is measured over a shorter period of - time.) 9 = Summation A form of accumulation which is selective - with respect to time. Note : “Summation” could be considered - a specialization of “Bulk Quantity” according to the rules - of inheritance where “Summation” selectively accumulates - pulses over a timing pattern, and “BulkQuantity” accumulates - pulses all of the time. 12 = Instantaneous Typically measured - over the fastest period of time allowed by the definition of the - metric (usually milliseconds or tens of milliseconds.) (Note: - “Instantaneous” was moved to attribute #3 in 61968-9Ed2 from - attribute #1 in 61968-9Ed1.) All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if AccumulationBehaviourType.subclass: - return AccumulationBehaviourType.subclass(*args_, **kwargs_) - else: - return AccumulationBehaviourType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AccumulationBehaviourType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AccumulationBehaviourType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='AccumulationBehaviourType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AccumulationBehaviourType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='AccumulationBehaviourType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='AccumulationBehaviourType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class AccumulationBehaviourType - - -class ApplianceLoadReductionType(GeneratedsSuper): - """0 - Delay Appliance Load Parameter requesting the appliance to - respond by providing a moderate load reduction for the duration - of a delay period. Typically referring to a “non-emergency” - event in which appliances can continue operating if already in a - load consuming period. 1 - Temporary Appliance Load Reduction - Parameter requesting the appliance to respond by providing an - aggressive load reduction for a short time period. Typically - referring to an “emergency/spinning reserve” event in which - an appliance should start shedding load if currently in a load - consuming period. * Full definition of how appliances react when - receiving each parameter is document in the EPA document - - ENERGY STAR® Program Requirements, Product Specification for - Residential Refrigerators and Freezers, Eligibility Criteria 5, - Draft 2 Version 5.0. All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if ApplianceLoadReductionType.subclass: - return ApplianceLoadReductionType.subclass(*args_, **kwargs_) - else: - return ApplianceLoadReductionType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ApplianceLoadReductionType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ApplianceLoadReductionType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='ApplianceLoadReductionType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ApplianceLoadReductionType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ApplianceLoadReductionType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='ApplianceLoadReductionType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ApplianceLoadReductionType - - -class CommodityType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 1 = Electricity - secondary metered value (a premises meter is typically a - secondary meter) 2 = Electricity primary metered value 4 = Air 7 - = NaturalGas 8 = Propane 9 = PotableWater 10 = Steam 11 = - WasteWater 12 = HeatingFluid 13 = CoolingFluid All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if CommodityType.subclass: - return CommodityType.subclass(*args_, **kwargs_) - else: - return CommodityType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CommodityType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CommodityType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='CommodityType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CommodityType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CommodityType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='CommodityType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class CommodityType - - -class ConsumptionBlockType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 1 = Block 1 2 = Block - 2 3 = Block 3 4 = Block 4 5 = Block 5 6 = Block 6 7 = Block 7 8 - = Block 8 9 = Block 9 10 = Block 10 11 = Block 11 12 = Block 12 - 13 = Block 13 14 = Block 14 15 = Block 15 16 = Block 16 All - other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if ConsumptionBlockType.subclass: - return ConsumptionBlockType.subclass(*args_, **kwargs_) - else: - return ConsumptionBlockType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConsumptionBlockType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionBlockType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConsumptionBlockType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConsumptionBlockType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ConsumptionBlockType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='ConsumptionBlockType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ConsumptionBlockType - - -class CurrencyCode(GeneratedsSuper): - """Follows codes defined in [ISO 4217]. 0 - Not Applicable (default, if - not specified) 36 - Australian Dollar 124 - Canadian Dollar 840 - - US Dollar 978 - Euro This is not a complete list.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if CurrencyCode.subclass: - return CurrencyCode.subclass(*args_, **kwargs_) - else: - return CurrencyCode(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CurrencyCode', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CurrencyCode') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='CurrencyCode', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CurrencyCode'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='CurrencyCode', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='CurrencyCode'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class CurrencyCode - - -class DataQualifierType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 2 = Average 8 = - Maximum 9 = Minimum 12 = Normal All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DataQualifierType.subclass: - return DataQualifierType.subclass(*args_, **kwargs_) - else: - return DataQualifierType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DataQualifierType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DataQualifierType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DataQualifierType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DataQualifierType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DataQualifierType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DataQualifierType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DataQualifierType - - -class DateTimeInterval(GeneratedsSuper): - """Interval of date and time.""" - subclass = None - superclass = None - def __init__(self, duration=None, start=None): - self.original_tagname_ = None - self.duration = duration - self.start = start - def factory(*args_, **kwargs_): - if DateTimeInterval.subclass: - return DateTimeInterval.subclass(*args_, **kwargs_) - else: - return DateTimeInterval(*args_, **kwargs_) - factory = staticmethod(factory) - def get_duration(self): return self.duration - def set_duration(self, duration): self.duration = duration - def get_start(self): return self.start - def set_start(self, start): self.start = start - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.duration is not None or - self.start is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DateTimeInterval', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DateTimeInterval') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DateTimeInterval', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DateTimeInterval'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DateTimeInterval', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.duration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sduration>%s%s' % (namespace_, self.gds_format_integer(self.duration, input_name='duration'), namespace_, eol_)) - if self.start is not None: - self.start.export(outfile, level, namespace_, name_='start', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DateTimeInterval'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.duration is not None: - showIndent(outfile, level) - outfile.write('duration=%d,\n' % self.duration) - if self.start is not None: - showIndent(outfile, level) - outfile.write('start=model_.TimeType(\n') - self.start.exportLiteral(outfile, level, name_='start') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'duration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'duration') - self.duration = ival_ - self.validate_UInt32(self.duration) # validate type UInt32 - elif nodeName_ == 'start': - obj_ = TimeType.factory() - obj_.build(child_) - self.start = obj_ - obj_.original_tagname_ = 'start' -# end class DateTimeInterval - - -class DeviceCategoryType(GeneratedsSuper): - """The Device category types defined. Bit positions SHALL be defined as - follows: 0 - Programmable Communicating Thermostat 1 - Strip - Heaters 2 - Baseboard Heaters 3 - Water Heater 4 - Pool Pump 5 - - Sauna 6 - Hot tub 7 - Smart Appliance 8 - Irrigation Pump 9 - - Managed Commercial and Industrial (C&I) Loads 10 - Simple - misc. (Residential On/Off) loads 11 - Exterior Lighting 12 - - Interior Lighting 13 - Electric Vehicle 14 - Generation Systems - 15 - Load Control Switch 16 - Smart Inverter 17 - EVSE 18 - RESU - 19 - Energy Management System 20 - Smart Energy Module All other - values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DeviceCategoryType.subclass: - return DeviceCategoryType.subclass(*args_, **kwargs_) - else: - return DeviceCategoryType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceCategoryType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceCategoryType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceCategoryType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceCategoryType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DeviceCategoryType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DeviceCategoryType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DeviceCategoryType - - -class DstRuleType(GeneratedsSuper): - """Bit map encoded rule from which is calculated the start or end time, - within the current year, to which daylight savings time offset - must be applied. The rule encoding: Bits 0 - 11: seconds 0 - - 3599 Bits 12 - 16: hours 0 - 23 Bits 17 - 19: day of the week 0 - = not applicable, 1 - 7 (Monday = 1) Bits:20 - 24: day of the - month 0 = not applicable, 1 - 31 Bits: 25 - 27: operator - (detailed below) Bits: 28 - 31: month 1 - 12 Rule value of - 0xFFFFFFFF means rule processing/DST correction is disabled. The - operators: 0: DST starts/ends on the Day of the Month 1: DST - starts/ends on the Day of the Week that is on or after the Day - of the Month 2: DST starts/ends on the first occurrence of the - Day of the Week in a month 3: DST starts/ends on the second - occurrence of the Day of the Week in a month 4: DST starts/ends - on the third occurrence of the Day of the Week in a month 5: DST - starts/ends on the forth occurrence of the Day of the Week in a - month 6: DST starts/ends on the fifth occurrence of the Day of - the Week in a month 7: DST starts/ends on the last occurrence of - the Day of the Week in a month An example: DST starts on third - Friday in March at 1:45 AM. The rule... Seconds: 2700 Hours: 1 - Day of Week: 5 Day of Month: 0 Operator: 4 Month: 3""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if DstRuleType.subclass: - return DstRuleType.subclass(*args_, **kwargs_) - else: - return DstRuleType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DstRuleType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DstRuleType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='DstRuleType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DstRuleType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='DstRuleType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='DstRuleType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class DstRuleType - - -class FlowDirectionType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 1 = Forward - (delivered to customer) 19 = Reverse (received from customer) - All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if FlowDirectionType.subclass: - return FlowDirectionType.subclass(*args_, **kwargs_) - else: - return FlowDirectionType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowDirectionType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowDirectionType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowDirectionType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowDirectionType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='FlowDirectionType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='FlowDirectionType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class FlowDirectionType - - -class KindType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 3 = Currency 8 = - Demand 12 = Energy 37 = Power All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if KindType.subclass: - return KindType.subclass(*args_, **kwargs_) - else: - return KindType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='KindType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='KindType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='KindType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='KindType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='KindType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='KindType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class KindType - - -class LocaleType(GeneratedsSuper): - """[RFC 4646] identifier of a language-region""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if LocaleType.subclass: - return LocaleType.subclass(*args_, **kwargs_) - else: - return LocaleType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LocaleType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LocaleType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='LocaleType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LocaleType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='LocaleType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='LocaleType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class LocaleType - - -class mRIDType(GeneratedsSuper): - """A master resource identifier. The IANA PEN [PEN] provider ID SHALL - be specified in bits 0-31, the least-significant bits, and - objects created by that provider SHALL be assigned unique IDs - with the remaining 96 bits. - 0xFFFFFFFFFFFFFFFFFFFFFFFF[XXXXXXXX], where [XXXXXXXX] is the - PEN, is reserved for a object that is being created (e.g., a - ReadingSet for the current time that is still accumulating). - Except for this special reserved identifier, each modification - of an object (resource) representation MUST have a different - "version".""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if mRIDType.subclass: - return mRIDType.subclass(*args_, **kwargs_) - else: - return mRIDType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='mRIDType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='mRIDType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='mRIDType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='mRIDType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='mRIDType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='mRIDType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class mRIDType - - -class OneHourRangeType(GeneratedsSuper): - """A signed time offset, typically applied to a Time value, expressed - in seconds, with range -3600 to 3600.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if OneHourRangeType.subclass: - return OneHourRangeType.subclass(*args_, **kwargs_) - else: - return OneHourRangeType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='OneHourRangeType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='OneHourRangeType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='OneHourRangeType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='OneHourRangeType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='OneHourRangeType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='OneHourRangeType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class OneHourRangeType - - -class PENType(GeneratedsSuper): - """IANA Private Enterprise Number [PEN].""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PENType.subclass: - return PENType.subclass(*args_, **kwargs_) - else: - return PENType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PENType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PENType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PENType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PENType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PENType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PENType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PENType - - -class PerCent(GeneratedsSuper): - """Used for percentages, specified in hundredths of a percent, 0 - - 10000. (10000 = 100%)""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PerCent.subclass: - return PerCent.subclass(*args_, **kwargs_) - else: - return PerCent(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PerCent', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PerCent') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PerCent', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PerCent'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PerCent', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PerCent'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PerCent - - -class PhaseCode(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 32 = Phase C (and S2) - 33 = Phase CN (and S2N) 40 = Phase CA 64 = Phase B 65 = Phase BN - 66 = Phase BC 128 = Phase A (and S1) 129 = Phase AN (and S1N) - 132 = Phase AB 224 = Phase ABC All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PhaseCode.subclass: - return PhaseCode.subclass(*args_, **kwargs_) - else: - return PhaseCode(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PhaseCode', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PhaseCode') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PhaseCode', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PhaseCode'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PhaseCode', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PhaseCode'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PhaseCode - - -class PINType(GeneratedsSuper): - """6 digit unsigned decimal integer (0 - 999999). (Note that this only - requires 20 bits, if it can be allocated.)""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PINType.subclass: - return PINType.subclass(*args_, **kwargs_) - else: - return PINType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PINType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PINType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PINType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PINType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PINType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PINType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PINType - - -class PowerOfTenMultiplierType(GeneratedsSuper): - """-9 = nano=x10^-9 -6 = micro=x10^-6 -3 = milli=x10^-3 0 = none=x1 - (default, if not specified) 1 = deca=x10 2 = hecto=x100 3 = - kilo=x1000 6 = Mega=x10^6 9 = Giga=x10^9 This is not a complete - list. Any integer between -9 and 9 SHALL be supported, - indicating the power of ten multiplier for the units.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PowerOfTenMultiplierType.subclass: - return PowerOfTenMultiplierType.subclass(*args_, **kwargs_) - else: - return PowerOfTenMultiplierType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PowerOfTenMultiplierType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PowerOfTenMultiplierType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PowerOfTenMultiplierType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PowerOfTenMultiplierType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PowerOfTenMultiplierType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PowerOfTenMultiplierType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PowerOfTenMultiplierType - - -class PrimacyType(GeneratedsSuper): - """Values possible for indication of "Primary" provider: 0: In home - energy management system 1: Contracted premises service provider - 2: Non-contractual service provider All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if PrimacyType.subclass: - return PrimacyType.subclass(*args_, **kwargs_) - else: - return PrimacyType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrimacyType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrimacyType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrimacyType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrimacyType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='PrimacyType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='PrimacyType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class PrimacyType - - -class RealEnergy(GeneratedsSuper): - """Real electrical energy""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if RealEnergy.subclass: - return RealEnergy.subclass(*args_, **kwargs_) - else: - return RealEnergy(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_UInt48(self, value): - # Validate type UInt48, a restriction on xs:unsignedLong. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RealEnergy', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RealEnergy') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RealEnergy', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RealEnergy'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='RealEnergy', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='RealEnergy'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_UInt48(self.value) # validate type UInt48 -# end class RealEnergy - - -class RoleFlagsType(GeneratedsSuper): - """Specifies the roles that apply to a usage point. Bit 0 - isMirror - - SHALL be set if the server is not the measurement device Bit 1 - - isPremisesAggregationPoint - SHALL be set if the UsagePoint is - the point of delivery for a premises Bit 2 - isPEV - SHALL be - set if the usage applies to an electric vehicle Bit 3 - isDER - - SHALL be set if the usage applies to a distributed energy - resource, capable of delivering power to the grid. Bit 4 - - isRevenueQuality - SHALL be set if usage was measured by a - device certified as revenue quality Bit 5 - isDC - SHALL be set - if the usage point measures direct current Bit 6 - isSubmeter - - SHALL be set if the usage point is not a premises aggregation - point Bit 7-15 - Reserved""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if RoleFlagsType.subclass: - return RoleFlagsType.subclass(*args_, **kwargs_) - else: - return RoleFlagsType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RoleFlagsType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RoleFlagsType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='RoleFlagsType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RoleFlagsType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='RoleFlagsType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='RoleFlagsType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class RoleFlagsType - - -class ServiceKind(GeneratedsSuper): - """Service kind 0 - electricity 1 - gas 2 - water 3 - time 4 - pressure - 5 - heat 6 - cooling All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if ServiceKind.subclass: - return ServiceKind.subclass(*args_, **kwargs_) - else: - return ServiceKind(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ServiceKind', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceKind') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='ServiceKind', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ServiceKind'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='ServiceKind', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='ServiceKind'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class ServiceKind - - -class SFDIType(GeneratedsSuper): - """Unsigned integer, max inclusive 687194767359, which is 2^36-1 - (68719476735), with added check digit. See Section 8.3.2 for - check digit calculation.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if SFDIType.subclass: - return SFDIType.subclass(*args_, **kwargs_) - else: - return SFDIType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SFDIType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SFDIType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='SFDIType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SFDIType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='SFDIType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='SFDIType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class SFDIType - - -class SignedPerCent(GeneratedsSuper): - """Used for signed percentages, specified in hundredths of a percent, - -10000 - 10000. (10000 = 100%)""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if SignedPerCent.subclass: - return SignedPerCent.subclass(*args_, **kwargs_) - else: - return SignedPerCent(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - # Added by Kisensum so that 0 value will generate element - self.valueOf_ is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SignedPerCent', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SignedPerCent') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='SignedPerCent', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SignedPerCent'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='SignedPerCent', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='SignedPerCent'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class SignedPerCent - - -class SignedRealEnergy(GeneratedsSuper): - """Real electrical energy, signed.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.value = value - def factory(*args_, **kwargs_): - if SignedRealEnergy.subclass: - return SignedRealEnergy.subclass(*args_, **kwargs_) - else: - return SignedRealEnergy(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_Int48(self, value): - # Validate type Int48, a restriction on xs:long. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SignedRealEnergy', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SignedRealEnergy') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SignedRealEnergy', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SignedRealEnergy'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='SignedRealEnergy', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='SignedRealEnergy'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int48(self.value) # validate type Int48 -# end class SignedRealEnergy - - -class TimeOffsetType(GeneratedsSuper): - """A signed time offset, typically applied to a Time value, expressed - in seconds.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if TimeOffsetType.subclass: - return TimeOffsetType.subclass(*args_, **kwargs_) - else: - return TimeOffsetType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeOffsetType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeOffsetType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeOffsetType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeOffsetType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='TimeOffsetType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='TimeOffsetType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class TimeOffsetType - - -class TimeType(GeneratedsSuper): - """Time is a signed 64 bit value representing the number of seconds - since 0 hours, 0 minutes, 0 seconds, on the 1st of January, - 1970, in UTC, not counting leap seconds.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if TimeType.subclass: - return TimeType.subclass(*args_, **kwargs_) - else: - return TimeType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='TimeType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='TimeType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class TimeType - - -class TOUType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 1 = TOU A 2 = TOU B 3 - = TOU C 4 = TOU D 5 = TOU E 6 = TOU F 7 = TOU G 8 = TOU H 9 = - TOU I 10 = TOU J 11 = TOU K 12 = TOU L 13 = TOU M 14 = TOU N 15 - = TOU O All other values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if TOUType.subclass: - return TOUType.subclass(*args_, **kwargs_) - else: - return TOUType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TOUType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TOUType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='TOUType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TOUType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='TOUType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='TOUType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class TOUType - - -class UnitType(GeneratedsSuper): - """The unit types defined for end device control target reductions. 0 - - kWh 1 - kW 2 - Watts 3 - Cubic Meters 4 - Cubic Feet 5 - US - Gallons 6 - Imperial Gallons 7 - BTUs 8 - Liters 9 - kPA (gauge) - 10 - kPA (absolute) 11 - Mega Joule 12 - Unitless All other - values reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if UnitType.subclass: - return UnitType.subclass(*args_, **kwargs_) - else: - return UnitType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UnitType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UnitType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='UnitType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UnitType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='UnitType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='UnitType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class UnitType - - -class UnitValueType(GeneratedsSuper): - """Type for specification of a specific value, with units and power of - ten multiplier.""" - subclass = None - superclass = None - def __init__(self, multiplier=None, unit=None, value=None): - self.original_tagname_ = None - self.multiplier = multiplier - self.unit = unit - self.value = value - def factory(*args_, **kwargs_): - if UnitValueType.subclass: - return UnitValueType.subclass(*args_, **kwargs_) - else: - return UnitValueType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_multiplier(self): return self.multiplier - def set_multiplier(self, multiplier): self.multiplier = multiplier - def get_unit(self): return self.unit - def set_unit(self, unit): self.unit = unit - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_Int32(self, value): - # Validate type Int32, a restriction on xs:int. - pass - def hasContent_(self): - if ( - self.multiplier is not None or - self.unit is not None or - self.value is not None - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UnitValueType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UnitValueType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UnitValueType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UnitValueType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='UnitValueType', fromsubclass_=False, pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.multiplier is not None: - self.multiplier.export(outfile, level, namespace_, name_='multiplier', pretty_print=pretty_print) - if self.unit is not None: - self.unit.export(outfile, level, namespace_, name_='unit', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='UnitValueType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - if self.multiplier is not None: - showIndent(outfile, level) - outfile.write('multiplier=model_.PowerOfTenMultiplierType(\n') - self.multiplier.exportLiteral(outfile, level, name_='multiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.unit is not None: - showIndent(outfile, level) - outfile.write('unit=model_.UomType(\n') - self.unit.exportLiteral(outfile, level, name_='unit') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'multiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.multiplier = obj_ - obj_.original_tagname_ = 'multiplier' - elif nodeName_ == 'unit': - obj_ = UomType.factory() - obj_.build(child_) - self.unit = obj_ - obj_.original_tagname_ = 'unit' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int32(self.value) # validate type Int32 -# end class UnitValueType - - -class UomType(GeneratedsSuper): - """0 = Not Applicable (default, if not specified) 5 = A (Current in - Amperes (RMS)) 6 = Kelvin (Temperature) 23 = Degrees Celsius - (Relative temperature) 29 = Voltage 31 = J (Energy joule) 33 = - Hz (Frequency) 38 =W (Real power in Watts) 42 = m3 (Cubic Meter) - 61 = VA (Apparent power) 63 = var (Reactive power) 65 = CosTheta - (Displacement Power Factor) 67 = V² (Volts squared) 69 = A² - (Amp squared) 71 = VAh (Apparent energy) 72 = Wh (Real energy in - Watt-hours) 73 = varh (Reactive energy) 106 = Ah (Ampere-hours / - Available Charge) 119 = ft3 (Cubic Feet) 122 = ft3/h (Cubic Feet - per Hour) 125 = m3/h (Cubic Meter per Hour) 128 = US gl (US - Gallons) 129 = US gl/h (US Gallons per Hour) 130 = IMP gl - (Imperial Gallons) 131 = IMP gl/h (Imperial Gallons per Hour) - 132 = BTU 133 = BTU/h 134 = Liter 137 = L/h (Liters per Hour) - 140 = PA(gauge) 155 = PA(absolute) 169 = Therm All other values - reserved.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if UomType.subclass: - return UomType.subclass(*args_, **kwargs_) - else: - return UomType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UomType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UomType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='UomType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UomType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='UomType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='UomType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class UomType - - -class VersionType(GeneratedsSuper): - """Version SHALL indicate a distinct identifier for each revision of an - IdentifiedObject. If not specified, a default version of "0" - (initial version) SHALL be assumed. Upon modification of any - IdentifiedObject, the mRID SHALL remain the same, but the - version SHALL be incremented. Servers MAY NOT modify objects - that they did not create, unless they were notified of the - change from the entity controlling the object's PEN.""" - subclass = None - superclass = None - def __init__(self, valueOf_=None): - self.original_tagname_ = None - self.valueOf_ = valueOf_ - def factory(*args_, **kwargs_): - if VersionType.subclass: - return VersionType.subclass(*args_, **kwargs_) - else: - return VersionType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_valueOf_(self): return self.valueOf_ - def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ - def hasContent_(self): - if ( - self.valueOf_ - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='VersionType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='VersionType') - if self.hasContent_(): - outfile.write('>') - outfile.write(str(self.valueOf_).encode(ExternalEncoding)) - self.exportChildren(outfile, level + 1, namespace_='', name_='VersionType', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='VersionType'): - pass - def exportChildren(self, outfile, level, namespace_='', name_='VersionType', fromsubclass_=False, pretty_print=True): - pass - def exportLiteral(self, outfile, level, name_='VersionType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - pass - def exportLiteralChildren(self, outfile, level, name_): - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - self.valueOf_ = get_all_text_(node) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - pass - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - pass -# end class VersionType - - -class ReadingBase(Resource): - """Specific value measured by a meter or other asset. ReadingBase is - abstract, used to define the elements common to Reading and - IntervalReading.""" - subclass = None - superclass = Resource - def __init__(self, consumptionBlock=None, qualityFlags=None, timePeriod=None, touTier=None, value=None): - self.original_tagname_ = None - super(ReadingBase, self).__init__() - self.consumptionBlock = consumptionBlock - self.qualityFlags = qualityFlags - self.timePeriod = timePeriod - self.touTier = touTier - self.value = value - def factory(*args_, **kwargs_): - if ReadingBase.subclass: - return ReadingBase.subclass(*args_, **kwargs_) - else: - return ReadingBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_consumptionBlock(self): return self.consumptionBlock - def set_consumptionBlock(self, consumptionBlock): self.consumptionBlock = consumptionBlock - def get_qualityFlags(self): return self.qualityFlags - def set_qualityFlags(self, qualityFlags): self.qualityFlags = qualityFlags - def get_timePeriod(self): return self.timePeriod - def set_timePeriod(self, timePeriod): self.timePeriod = timePeriod - def get_touTier(self): return self.touTier - def set_touTier(self, touTier): self.touTier = touTier - def get_value(self): return self.value - def set_value(self, value): self.value = value - def validate_HexBinary16(self, value): - # Validate type HexBinary16, a restriction on xs:hexBinary. - pass - def validate_Int48(self, value): - # Validate type Int48, a restriction on xs:long. - pass - def hasContent_(self): - if ( - self.consumptionBlock is not None or - self.qualityFlags is not None or - self.timePeriod is not None or - self.touTier is not None or - self.value is not None or - super(ReadingBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingBase'): - super(ReadingBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingBase') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingBase', fromsubclass_=False, pretty_print=True): - super(ReadingBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.consumptionBlock is not None: - self.consumptionBlock.export(outfile, level, namespace_, name_='consumptionBlock', pretty_print=pretty_print) - if self.qualityFlags is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%squalityFlags>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.qualityFlags).encode(ExternalEncoding), input_name='qualityFlags'), namespace_, eol_)) - if self.timePeriod is not None: - self.timePeriod.export(outfile, level, namespace_, name_='timePeriod', pretty_print=pretty_print) - if self.touTier is not None: - self.touTier.export(outfile, level, namespace_, name_='touTier', pretty_print=pretty_print) - if self.value is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%svalue>%s%s' % (namespace_, self.gds_format_integer(self.value, input_name='value'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ReadingBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingBase, self).exportLiteralChildren(outfile, level, name_) - if self.consumptionBlock is not None: - showIndent(outfile, level) - outfile.write('consumptionBlock=model_.ConsumptionBlockType(\n') - self.consumptionBlock.exportLiteral(outfile, level, name_='consumptionBlock') - showIndent(outfile, level) - outfile.write('),\n') - if self.qualityFlags is not None: - showIndent(outfile, level) - outfile.write('qualityFlags=%s,\n' % quote_python(self.qualityFlags).encode(ExternalEncoding)) - if self.timePeriod is not None: - showIndent(outfile, level) - outfile.write('timePeriod=model_.DateTimeInterval(\n') - self.timePeriod.exportLiteral(outfile, level, name_='timePeriod') - showIndent(outfile, level) - outfile.write('),\n') - if self.touTier is not None: - showIndent(outfile, level) - outfile.write('touTier=model_.TOUType(\n') - self.touTier.exportLiteral(outfile, level, name_='touTier') - showIndent(outfile, level) - outfile.write('),\n') - if self.value is not None: - showIndent(outfile, level) - outfile.write('value=%d,\n' % self.value) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'consumptionBlock': - obj_ = ConsumptionBlockType.factory() - obj_.build(child_) - self.consumptionBlock = obj_ - obj_.original_tagname_ = 'consumptionBlock' - elif nodeName_ == 'qualityFlags': - qualityFlags_ = child_.text - qualityFlags_ = self.gds_validate_string(qualityFlags_, node, 'qualityFlags') - self.qualityFlags = qualityFlags_ - self.validate_HexBinary16(self.qualityFlags) # validate type HexBinary16 - elif nodeName_ == 'timePeriod': - obj_ = DateTimeInterval.factory() - obj_.build(child_) - self.timePeriod = obj_ - obj_.original_tagname_ = 'timePeriod' - elif nodeName_ == 'touTier': - obj_ = TOUType.factory() - obj_.build(child_) - self.touTier = obj_ - obj_.original_tagname_ = 'touTier' - elif nodeName_ == 'value': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'value') - self.value = ival_ - self.validate_Int48(self.value) # validate type Int48 - super(ReadingBase, self).buildChildren(child_, node, nodeName_, True) -# end class ReadingBase - - -class SubscribableList(SubscribableResource): - """A List to which a Subscription can be requested.The number - specifying "all" of the items in the list. Required on GET, - ignored otherwise.Indicates the number of items in this page of - results.""" - subclass = None - superclass = SubscribableResource - def __init__(self, all=None, results=None): - self.original_tagname_ = None - super(SubscribableList, self).__init__() - self.all = _cast(None, all) - self.results = _cast(None, results) - def factory(*args_, **kwargs_): - if SubscribableList.subclass: - return SubscribableList.subclass(*args_, **kwargs_) - else: - return SubscribableList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_all(self): return self.all - def set_all(self, all): self.all = all - def get_results(self): return self.results - def set_results(self, results): self.results = results - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - super(SubscribableList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubscribableList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubscribableList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubscribableList', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubscribableList'): - super(SubscribableList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SubscribableList') - if self.all is not None and 'all' not in already_processed: - already_processed.add('all') - outfile.write(' all=%s' % (quote_attrib(self.all), )) - if self.results is not None and 'results' not in already_processed: - already_processed.add('results') - outfile.write(' results=%s' % (quote_attrib(self.results), )) - def exportChildren(self, outfile, level, namespace_='', name_='SubscribableList', fromsubclass_=False, pretty_print=True): - super(SubscribableList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SubscribableList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.all is not None and 'all' not in already_processed: - already_processed.add('all') - showIndent(outfile, level) - outfile.write('all=%d,\n' % (self.all,)) - if self.results is not None and 'results' not in already_processed: - already_processed.add('results') - showIndent(outfile, level) - outfile.write('results=%d,\n' % (self.results,)) - super(SubscribableList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SubscribableList, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('all', node) - if value is not None and 'all' not in already_processed: - already_processed.add('all') - try: - self.all = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - self.validate_UInt16(self.all) # validate type UInt16 - value = find_attr_value_('results', node) - if value is not None and 'results' not in already_processed: - already_processed.add('results') - try: - self.results = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - self.validate_UInt8(self.results) # validate type UInt8 - super(SubscribableList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SubscribableList, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SubscribableList - - -class SubscribableIdentifiedObject(SubscribableResource): - """An IdentifiedObject to which a Subscription can be requested.""" - subclass = None - superclass = SubscribableResource - def __init__(self, mRID=None, description=None, version=None): - self.original_tagname_ = None - super(SubscribableIdentifiedObject, self).__init__() - self.mRID = mRID - self.description = description - self.version = version - def factory(*args_, **kwargs_): - if SubscribableIdentifiedObject.subclass: - return SubscribableIdentifiedObject.subclass(*args_, **kwargs_) - else: - return SubscribableIdentifiedObject(*args_, **kwargs_) - factory = staticmethod(factory) - def get_mRID(self): return self.mRID - def set_mRID(self, mRID): self.mRID = mRID - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_version(self): return self.version - def set_version(self, version): self.version = version - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.mRID is not None or - self.description is not None or - self.version is not None or - super(SubscribableIdentifiedObject, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubscribableIdentifiedObject', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubscribableIdentifiedObject') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubscribableIdentifiedObject', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubscribableIdentifiedObject'): - super(SubscribableIdentifiedObject, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SubscribableIdentifiedObject') - def exportChildren(self, outfile, level, namespace_='', name_='SubscribableIdentifiedObject', fromsubclass_=False, pretty_print=True): - super(SubscribableIdentifiedObject, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.mRID is not None: - self.mRID.export(outfile, level, namespace_, name_='mRID', pretty_print=pretty_print) - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.version is not None: - self.version.export(outfile, level, namespace_, name_='version', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='SubscribableIdentifiedObject'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SubscribableIdentifiedObject, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SubscribableIdentifiedObject, self).exportLiteralChildren(outfile, level, name_) - if self.mRID is not None: - showIndent(outfile, level) - outfile.write('mRID=model_.mRIDType(\n') - self.mRID.exportLiteral(outfile, level, name_='mRID') - showIndent(outfile, level) - outfile.write('),\n') - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.version is not None: - showIndent(outfile, level) - outfile.write('version=model_.VersionType(\n') - self.version.exportLiteral(outfile, level, name_='version') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SubscribableIdentifiedObject, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'mRID': - obj_ = mRIDType.factory() - obj_.build(child_) - self.mRID = obj_ - obj_.original_tagname_ = 'mRID' - elif nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String32(self.description) # validate type String32 - elif nodeName_ == 'version': - obj_ = VersionType.factory() - obj_.build(child_) - self.version = obj_ - obj_.original_tagname_ = 'version' - super(SubscribableIdentifiedObject, self).buildChildren(child_, node, nodeName_, True) -# end class SubscribableIdentifiedObject - - -class RespondableIdentifiedObject(RespondableResource): - """An IdentifiedObject to which a Response can be requested.""" - subclass = None - superclass = RespondableResource - def __init__(self, mRID=None, description=None, version=None): - self.original_tagname_ = None - super(RespondableIdentifiedObject, self).__init__() - self.mRID = mRID - self.description = description - self.version = version - def factory(*args_, **kwargs_): - if RespondableIdentifiedObject.subclass: - return RespondableIdentifiedObject.subclass(*args_, **kwargs_) - else: - return RespondableIdentifiedObject(*args_, **kwargs_) - factory = staticmethod(factory) - def get_mRID(self): return self.mRID - def set_mRID(self, mRID): self.mRID = mRID - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_version(self): return self.version - def set_version(self, version): self.version = version - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.mRID is not None or - self.description is not None or - self.version is not None or - super(RespondableIdentifiedObject, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RespondableIdentifiedObject', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RespondableIdentifiedObject') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RespondableIdentifiedObject', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RespondableIdentifiedObject'): - super(RespondableIdentifiedObject, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RespondableIdentifiedObject') - def exportChildren(self, outfile, level, namespace_='', name_='RespondableIdentifiedObject', fromsubclass_=False, pretty_print=True): - super(RespondableIdentifiedObject, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.mRID is not None: - self.mRID.export(outfile, level, namespace_, name_='mRID', pretty_print=pretty_print) - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.version is not None: - self.version.export(outfile, level, namespace_, name_='version', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RespondableIdentifiedObject'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RespondableIdentifiedObject, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RespondableIdentifiedObject, self).exportLiteralChildren(outfile, level, name_) - if self.mRID is not None: - showIndent(outfile, level) - outfile.write('mRID=model_.mRIDType(\n') - self.mRID.exportLiteral(outfile, level, name_='mRID') - showIndent(outfile, level) - outfile.write('),\n') - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.version is not None: - showIndent(outfile, level) - outfile.write('version=model_.VersionType(\n') - self.version.exportLiteral(outfile, level, name_='version') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RespondableIdentifiedObject, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'mRID': - obj_ = mRIDType.factory() - obj_.build(child_) - self.mRID = obj_ - obj_.original_tagname_ = 'mRID' - elif nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String32(self.description) # validate type String32 - elif nodeName_ == 'version': - obj_ = VersionType.factory() - obj_.build(child_) - self.version = obj_ - obj_.original_tagname_ = 'version' - super(RespondableIdentifiedObject, self).buildChildren(child_, node, nodeName_, True) -# end class RespondableIdentifiedObject - - -class List(Resource): - """Container to hold a collection of object instances or references. - See [ZB 11-0167] Design Patterns section for additional - details.The number specifying "all" of the items in the list. - Required on a response to a GET, ignored otherwise.Indicates the - number of items in this page of results.""" - subclass = None - superclass = Resource - def __init__(self, all=None, results=None): - self.original_tagname_ = None - super(List, self).__init__() - self.all = _cast(None, all) - self.results = _cast(None, results) - def factory(*args_, **kwargs_): - if List.subclass: - return List.subclass(*args_, **kwargs_) - else: - return List(*args_, **kwargs_) - factory = staticmethod(factory) - def get_all(self): return self.all - def set_all(self, all): self.all = all - def get_results(self): return self.results - def set_results(self, results): self.results = results - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - super(List, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='List', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='List') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='List', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='List'): - super(List, self).exportAttributes(outfile, level, already_processed, namespace_, name_='List') - if self.all is not None and 'all' not in already_processed: - already_processed.add('all') - outfile.write(' all=%s' % (quote_attrib(self.all), )) - if self.results is not None and 'results' not in already_processed: - already_processed.add('results') - outfile.write(' results=%s' % (quote_attrib(self.results), )) - def exportChildren(self, outfile, level, namespace_='', name_='List', fromsubclass_=False, pretty_print=True): - super(List, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='List'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.all is not None and 'all' not in already_processed: - already_processed.add('all') - showIndent(outfile, level) - outfile.write('all=%d,\n' % (self.all,)) - if self.results is not None and 'results' not in already_processed: - already_processed.add('results') - showIndent(outfile, level) - outfile.write('results=%d,\n' % (self.results,)) - super(List, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(List, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('all', node) - if value is not None and 'all' not in already_processed: - already_processed.add('all') - try: - self.all = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - self.validate_UInt16(self.all) # validate type UInt16 - value = find_attr_value_('results', node) - if value is not None and 'results' not in already_processed: - already_processed.add('results') - try: - self.results = int(value) - except ValueError as exp: - raise_parse_error(node, 'Bad integer attribute: %s' % exp) - self.validate_UInt8(self.results) # validate type UInt8 - super(List, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(List, self).buildChildren(child_, node, nodeName_, True) - pass -# end class List - - -class IdentifiedObject(Resource): - """This is a root class to provide common naming attributes for all - classes needing naming attributes""" - subclass = None - superclass = Resource - def __init__(self, mRID=None, description=None, version=None): - self.original_tagname_ = None - super(IdentifiedObject, self).__init__() - self.mRID = mRID - self.description = description - self.version = version - def factory(*args_, **kwargs_): - if IdentifiedObject.subclass: - return IdentifiedObject.subclass(*args_, **kwargs_) - else: - return IdentifiedObject(*args_, **kwargs_) - factory = staticmethod(factory) - def get_mRID(self): return self.mRID - def set_mRID(self, mRID): self.mRID = mRID - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_version(self): return self.version - def set_version(self, version): self.version = version - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.mRID is not None or - self.description is not None or - self.version is not None or - super(IdentifiedObject, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IdentifiedObject', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IdentifiedObject') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IdentifiedObject', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IdentifiedObject'): - super(IdentifiedObject, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IdentifiedObject') - def exportChildren(self, outfile, level, namespace_='', name_='IdentifiedObject', fromsubclass_=False, pretty_print=True): - super(IdentifiedObject, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.mRID is not None: - self.mRID.export(outfile, level, namespace_, name_='mRID', pretty_print=pretty_print) - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.version is not None: - self.version.export(outfile, level, namespace_, name_='version', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='IdentifiedObject'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IdentifiedObject, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IdentifiedObject, self).exportLiteralChildren(outfile, level, name_) - if self.mRID is not None: - showIndent(outfile, level) - outfile.write('mRID=model_.mRIDType(\n') - self.mRID.exportLiteral(outfile, level, name_='mRID') - showIndent(outfile, level) - outfile.write('),\n') - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.version is not None: - showIndent(outfile, level) - outfile.write('version=model_.VersionType(\n') - self.version.exportLiteral(outfile, level, name_='version') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IdentifiedObject, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'mRID': - obj_ = mRIDType.factory() - obj_.build(child_) - self.mRID = obj_ - obj_.original_tagname_ = 'mRID' - elif nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String32(self.description) # validate type String32 - elif nodeName_ == 'version': - obj_ = VersionType.factory() - obj_.build(child_) - self.version = obj_ - obj_.original_tagname_ = 'version' - super(IdentifiedObject, self).buildChildren(child_, node, nodeName_, True) -# end class IdentifiedObject - - -class UsagePointListLink(ListLink): - """SHALL contain a Link to a List of UsagePoint instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(UsagePointListLink, self).__init__() - def factory(*args_, **kwargs_): - if UsagePointListLink.subclass: - return UsagePointListLink.subclass(*args_, **kwargs_) - else: - return UsagePointListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(UsagePointListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UsagePointListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UsagePointListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UsagePointListLink'): - super(UsagePointListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointListLink') - def exportChildren(self, outfile, level, namespace_='', name_='UsagePointListLink', fromsubclass_=False, pretty_print=True): - super(UsagePointListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='UsagePointListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(UsagePointListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(UsagePointListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(UsagePointListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(UsagePointListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class UsagePointListLink - - -class UsagePointLink(Link): - """SHALL contain a Link to an instance of UsagePoint.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(UsagePointLink, self).__init__() - def factory(*args_, **kwargs_): - if UsagePointLink.subclass: - return UsagePointLink.subclass(*args_, **kwargs_) - else: - return UsagePointLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(UsagePointLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UsagePointLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UsagePointLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UsagePointLink'): - super(UsagePointLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointLink') - def exportChildren(self, outfile, level, namespace_='', name_='UsagePointLink', fromsubclass_=False, pretty_print=True): - super(UsagePointLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='UsagePointLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(UsagePointLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(UsagePointLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(UsagePointLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(UsagePointLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class UsagePointLink - - -class TimeTariffIntervalListLink(ListLink): - """SHALL contain a Link to a List of TimeTariffInterval instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(TimeTariffIntervalListLink, self).__init__() - def factory(*args_, **kwargs_): - if TimeTariffIntervalListLink.subclass: - return TimeTariffIntervalListLink.subclass(*args_, **kwargs_) - else: - return TimeTariffIntervalListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TimeTariffIntervalListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeTariffIntervalListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeTariffIntervalListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeTariffIntervalListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeTariffIntervalListLink'): - super(TimeTariffIntervalListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TimeTariffIntervalListLink') - def exportChildren(self, outfile, level, namespace_='', name_='TimeTariffIntervalListLink', fromsubclass_=False, pretty_print=True): - super(TimeTariffIntervalListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TimeTariffIntervalListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TimeTariffIntervalListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TimeTariffIntervalListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TimeTariffIntervalListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TimeTariffIntervalListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TimeTariffIntervalListLink - - -class TimeLink(Link): - """SHALL contain a Link to an instance of Time.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(TimeLink, self).__init__() - def factory(*args_, **kwargs_): - if TimeLink.subclass: - return TimeLink.subclass(*args_, **kwargs_) - else: - return TimeLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TimeLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeLink'): - super(TimeLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TimeLink') - def exportChildren(self, outfile, level, namespace_='', name_='TimeLink', fromsubclass_=False, pretty_print=True): - super(TimeLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TimeLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TimeLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TimeLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TimeLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TimeLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TimeLink - - -class TextMessageListLink(ListLink): - """SHALL contain a Link to a List of TextMessage instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(TextMessageListLink, self).__init__() - def factory(*args_, **kwargs_): - if TextMessageListLink.subclass: - return TextMessageListLink.subclass(*args_, **kwargs_) - else: - return TextMessageListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TextMessageListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TextMessageListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TextMessageListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TextMessageListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TextMessageListLink'): - super(TextMessageListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TextMessageListLink') - def exportChildren(self, outfile, level, namespace_='', name_='TextMessageListLink', fromsubclass_=False, pretty_print=True): - super(TextMessageListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TextMessageListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TextMessageListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TextMessageListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TextMessageListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TextMessageListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TextMessageListLink - - -class TariffProfileListLink(ListLink): - """SHALL contain a Link to a List of TariffProfile instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(TariffProfileListLink, self).__init__() - def factory(*args_, **kwargs_): - if TariffProfileListLink.subclass: - return TariffProfileListLink.subclass(*args_, **kwargs_) - else: - return TariffProfileListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TariffProfileListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TariffProfileListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfileListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TariffProfileListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TariffProfileListLink'): - super(TariffProfileListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfileListLink') - def exportChildren(self, outfile, level, namespace_='', name_='TariffProfileListLink', fromsubclass_=False, pretty_print=True): - super(TariffProfileListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TariffProfileListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TariffProfileListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TariffProfileListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TariffProfileListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TariffProfileListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TariffProfileListLink - - -class TariffProfileLink(Link): - """SHALL contain a Link to an instance of TariffProfile.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(TariffProfileLink, self).__init__() - def factory(*args_, **kwargs_): - if TariffProfileLink.subclass: - return TariffProfileLink.subclass(*args_, **kwargs_) - else: - return TariffProfileLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TariffProfileLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TariffProfileLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfileLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TariffProfileLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TariffProfileLink'): - super(TariffProfileLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfileLink') - def exportChildren(self, outfile, level, namespace_='', name_='TariffProfileLink', fromsubclass_=False, pretty_print=True): - super(TariffProfileLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TariffProfileLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TariffProfileLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TariffProfileLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TariffProfileLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TariffProfileLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TariffProfileLink - - -class TargetReadingListLink(ListLink): - """SHALL contain a Link to a List of TargetReading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(TargetReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if TargetReadingListLink.subclass: - return TargetReadingListLink.subclass(*args_, **kwargs_) - else: - return TargetReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TargetReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TargetReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TargetReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TargetReadingListLink'): - super(TargetReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='TargetReadingListLink', fromsubclass_=False, pretty_print=True): - super(TargetReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TargetReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TargetReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TargetReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TargetReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TargetReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TargetReadingListLink - - -class SupportedLocaleListLink(ListLink): - """SHALL contain a Link to a List of SupportedLocale instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(SupportedLocaleListLink, self).__init__() - def factory(*args_, **kwargs_): - if SupportedLocaleListLink.subclass: - return SupportedLocaleListLink.subclass(*args_, **kwargs_) - else: - return SupportedLocaleListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(SupportedLocaleListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SupportedLocaleListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SupportedLocaleListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SupportedLocaleListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SupportedLocaleListLink'): - super(SupportedLocaleListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SupportedLocaleListLink') - def exportChildren(self, outfile, level, namespace_='', name_='SupportedLocaleListLink', fromsubclass_=False, pretty_print=True): - super(SupportedLocaleListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SupportedLocaleListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SupportedLocaleListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SupportedLocaleListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SupportedLocaleListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SupportedLocaleListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SupportedLocaleListLink - - -class SupplyInterruptionOverrideListLink(ListLink): - """SHALL contain a Link to a List of SupplyInterruptionOverride - instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(SupplyInterruptionOverrideListLink, self).__init__() - def factory(*args_, **kwargs_): - if SupplyInterruptionOverrideListLink.subclass: - return SupplyInterruptionOverrideListLink.subclass(*args_, **kwargs_) - else: - return SupplyInterruptionOverrideListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(SupplyInterruptionOverrideListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SupplyInterruptionOverrideListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SupplyInterruptionOverrideListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SupplyInterruptionOverrideListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SupplyInterruptionOverrideListLink'): - super(SupplyInterruptionOverrideListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SupplyInterruptionOverrideListLink') - def exportChildren(self, outfile, level, namespace_='', name_='SupplyInterruptionOverrideListLink', fromsubclass_=False, pretty_print=True): - super(SupplyInterruptionOverrideListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SupplyInterruptionOverrideListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SupplyInterruptionOverrideListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SupplyInterruptionOverrideListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SupplyInterruptionOverrideListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SupplyInterruptionOverrideListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SupplyInterruptionOverrideListLink - - -class SubscriptionListLink(ListLink): - """SHALL contain a Link to a List of Subscription instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(SubscriptionListLink, self).__init__() - def factory(*args_, **kwargs_): - if SubscriptionListLink.subclass: - return SubscriptionListLink.subclass(*args_, **kwargs_) - else: - return SubscriptionListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(SubscriptionListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubscriptionListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubscriptionListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubscriptionListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubscriptionListLink'): - super(SubscriptionListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SubscriptionListLink') - def exportChildren(self, outfile, level, namespace_='', name_='SubscriptionListLink', fromsubclass_=False, pretty_print=True): - super(SubscriptionListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SubscriptionListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SubscriptionListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SubscriptionListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SubscriptionListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SubscriptionListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SubscriptionListLink - - -class ServiceSupplierLink(Link): - """SHALL contain a Link to an instance of ServiceSupplier.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(ServiceSupplierLink, self).__init__() - def factory(*args_, **kwargs_): - if ServiceSupplierLink.subclass: - return ServiceSupplierLink.subclass(*args_, **kwargs_) - else: - return ServiceSupplierLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ServiceSupplierLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ServiceSupplierLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceSupplierLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ServiceSupplierLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ServiceSupplierLink'): - super(ServiceSupplierLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceSupplierLink') - def exportChildren(self, outfile, level, namespace_='', name_='ServiceSupplierLink', fromsubclass_=False, pretty_print=True): - super(ServiceSupplierLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ServiceSupplierLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ServiceSupplierLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ServiceSupplierLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ServiceSupplierLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ServiceSupplierLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ServiceSupplierLink - - -class SelfDeviceLink(Link): - """SHALL contain a Link to an instance of SelfDevice.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(SelfDeviceLink, self).__init__() - def factory(*args_, **kwargs_): - if SelfDeviceLink.subclass: - return SelfDeviceLink.subclass(*args_, **kwargs_) - else: - return SelfDeviceLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(SelfDeviceLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SelfDeviceLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SelfDeviceLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SelfDeviceLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SelfDeviceLink'): - super(SelfDeviceLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SelfDeviceLink') - def exportChildren(self, outfile, level, namespace_='', name_='SelfDeviceLink', fromsubclass_=False, pretty_print=True): - super(SelfDeviceLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SelfDeviceLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SelfDeviceLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SelfDeviceLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SelfDeviceLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SelfDeviceLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SelfDeviceLink - - -class RPLSourceRoutesListLink(ListLink): - """SHALL contain a Link to a List of RPLSourceRoutes instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(RPLSourceRoutesListLink, self).__init__() - def factory(*args_, **kwargs_): - if RPLSourceRoutesListLink.subclass: - return RPLSourceRoutesListLink.subclass(*args_, **kwargs_) - else: - return RPLSourceRoutesListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(RPLSourceRoutesListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RPLSourceRoutesListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RPLSourceRoutesListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RPLSourceRoutesListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RPLSourceRoutesListLink'): - super(RPLSourceRoutesListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RPLSourceRoutesListLink') - def exportChildren(self, outfile, level, namespace_='', name_='RPLSourceRoutesListLink', fromsubclass_=False, pretty_print=True): - super(RPLSourceRoutesListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='RPLSourceRoutesListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RPLSourceRoutesListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RPLSourceRoutesListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RPLSourceRoutesListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RPLSourceRoutesListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RPLSourceRoutesListLink - - -class RPLInstanceListLink(ListLink): - """SHALL contain a Link to a List of RPLInterface instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(RPLInstanceListLink, self).__init__() - def factory(*args_, **kwargs_): - if RPLInstanceListLink.subclass: - return RPLInstanceListLink.subclass(*args_, **kwargs_) - else: - return RPLInstanceListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(RPLInstanceListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RPLInstanceListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RPLInstanceListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RPLInstanceListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RPLInstanceListLink'): - super(RPLInstanceListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RPLInstanceListLink') - def exportChildren(self, outfile, level, namespace_='', name_='RPLInstanceListLink', fromsubclass_=False, pretty_print=True): - super(RPLInstanceListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='RPLInstanceListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RPLInstanceListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RPLInstanceListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RPLInstanceListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RPLInstanceListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RPLInstanceListLink - - -class ResponseSetListLink(ListLink): - """SHALL contain a Link to a List of ResponseSet instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ResponseSetListLink, self).__init__() - def factory(*args_, **kwargs_): - if ResponseSetListLink.subclass: - return ResponseSetListLink.subclass(*args_, **kwargs_) - else: - return ResponseSetListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ResponseSetListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ResponseSetListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseSetListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ResponseSetListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ResponseSetListLink'): - super(ResponseSetListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseSetListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ResponseSetListLink', fromsubclass_=False, pretty_print=True): - super(ResponseSetListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ResponseSetListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ResponseSetListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ResponseSetListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ResponseSetListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ResponseSetListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ResponseSetListLink - - -class ResponseListLink(ListLink): - """SHALL contain a Link to a List of Response instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ResponseListLink, self).__init__() - def factory(*args_, **kwargs_): - if ResponseListLink.subclass: - return ResponseListLink.subclass(*args_, **kwargs_) - else: - return ResponseListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ResponseListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ResponseListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ResponseListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ResponseListLink'): - super(ResponseListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ResponseListLink', fromsubclass_=False, pretty_print=True): - super(ResponseListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ResponseListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ResponseListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ResponseListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ResponseListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ResponseListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ResponseListLink - - -class RegistrationLink(Link): - """SHALL contain a Link to an instance of Registration.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(RegistrationLink, self).__init__() - def factory(*args_, **kwargs_): - if RegistrationLink.subclass: - return RegistrationLink.subclass(*args_, **kwargs_) - else: - return RegistrationLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(RegistrationLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RegistrationLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RegistrationLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RegistrationLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RegistrationLink'): - super(RegistrationLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RegistrationLink') - def exportChildren(self, outfile, level, namespace_='', name_='RegistrationLink', fromsubclass_=False, pretty_print=True): - super(RegistrationLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='RegistrationLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RegistrationLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RegistrationLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RegistrationLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RegistrationLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RegistrationLink - - -class ReadingTypeLink(Link): - """SHALL contain a Link to an instance of ReadingType.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(ReadingTypeLink, self).__init__() - def factory(*args_, **kwargs_): - if ReadingTypeLink.subclass: - return ReadingTypeLink.subclass(*args_, **kwargs_) - else: - return ReadingTypeLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ReadingTypeLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingTypeLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingTypeLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingTypeLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingTypeLink'): - super(ReadingTypeLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingTypeLink') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingTypeLink', fromsubclass_=False, pretty_print=True): - super(ReadingTypeLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ReadingTypeLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingTypeLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingTypeLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingTypeLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ReadingTypeLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ReadingTypeLink - - -class ReadingSetListLink(ListLink): - """SHALL contain a Link to a List of ReadingSet instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ReadingSetListLink, self).__init__() - def factory(*args_, **kwargs_): - if ReadingSetListLink.subclass: - return ReadingSetListLink.subclass(*args_, **kwargs_) - else: - return ReadingSetListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ReadingSetListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingSetListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSetListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingSetListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingSetListLink'): - super(ReadingSetListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSetListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingSetListLink', fromsubclass_=False, pretty_print=True): - super(ReadingSetListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ReadingSetListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingSetListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingSetListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingSetListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ReadingSetListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ReadingSetListLink - - -class ReadingListLink(ListLink): - """SHALL contain a Link to a List of Reading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if ReadingListLink.subclass: - return ReadingListLink.subclass(*args_, **kwargs_) - else: - return ReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingListLink'): - super(ReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingListLink', fromsubclass_=False, pretty_print=True): - super(ReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ReadingListLink - - -class ReadingLink(Link): - """A Link to a Reading.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(ReadingLink, self).__init__() - def factory(*args_, **kwargs_): - if ReadingLink.subclass: - return ReadingLink.subclass(*args_, **kwargs_) - else: - return ReadingLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ReadingLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingLink'): - super(ReadingLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingLink') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingLink', fromsubclass_=False, pretty_print=True): - super(ReadingLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ReadingLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ReadingLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ReadingLink - - -class RateComponentListLink(ListLink): - """SHALL contain a Link to a List of RateComponent instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(RateComponentListLink, self).__init__() - def factory(*args_, **kwargs_): - if RateComponentListLink.subclass: - return RateComponentListLink.subclass(*args_, **kwargs_) - else: - return RateComponentListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(RateComponentListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RateComponentListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponentListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RateComponentListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RateComponentListLink'): - super(RateComponentListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponentListLink') - def exportChildren(self, outfile, level, namespace_='', name_='RateComponentListLink', fromsubclass_=False, pretty_print=True): - super(RateComponentListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='RateComponentListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RateComponentListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RateComponentListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RateComponentListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RateComponentListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RateComponentListLink - - -class RateComponentLink(Link): - """SHALL contain a Link to an instance of RateComponent.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(RateComponentLink, self).__init__() - def factory(*args_, **kwargs_): - if RateComponentLink.subclass: - return RateComponentLink.subclass(*args_, **kwargs_) - else: - return RateComponentLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(RateComponentLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RateComponentLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponentLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RateComponentLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RateComponentLink'): - super(RateComponentLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponentLink') - def exportChildren(self, outfile, level, namespace_='', name_='RateComponentLink', fromsubclass_=False, pretty_print=True): - super(RateComponentLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='RateComponentLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RateComponentLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RateComponentLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RateComponentLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(RateComponentLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class RateComponentLink - - -class ProjectionReadingListLink(ListLink): - """SHALL contain a Link to a List of ProjectionReading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ProjectionReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if ProjectionReadingListLink.subclass: - return ProjectionReadingListLink.subclass(*args_, **kwargs_) - else: - return ProjectionReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ProjectionReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ProjectionReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ProjectionReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ProjectionReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ProjectionReadingListLink'): - super(ProjectionReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ProjectionReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ProjectionReadingListLink', fromsubclass_=False, pretty_print=True): - super(ProjectionReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ProjectionReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ProjectionReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ProjectionReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ProjectionReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ProjectionReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ProjectionReadingListLink - - -class PriceResponseCfgListLink(ListLink): - """SHALL contain a Link to a List of PriceResponseCfg instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(PriceResponseCfgListLink, self).__init__() - def factory(*args_, **kwargs_): - if PriceResponseCfgListLink.subclass: - return PriceResponseCfgListLink.subclass(*args_, **kwargs_) - else: - return PriceResponseCfgListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(PriceResponseCfgListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PriceResponseCfgListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponseCfgListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PriceResponseCfgListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PriceResponseCfgListLink'): - super(PriceResponseCfgListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponseCfgListLink') - def exportChildren(self, outfile, level, namespace_='', name_='PriceResponseCfgListLink', fromsubclass_=False, pretty_print=True): - super(PriceResponseCfgListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='PriceResponseCfgListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PriceResponseCfgListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PriceResponseCfgListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PriceResponseCfgListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PriceResponseCfgListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PriceResponseCfgListLink - - -class PrepayOperationStatusLink(Link): - """SHALL contain a Link to an instance of PrepayOperationStatus.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(PrepayOperationStatusLink, self).__init__() - def factory(*args_, **kwargs_): - if PrepayOperationStatusLink.subclass: - return PrepayOperationStatusLink.subclass(*args_, **kwargs_) - else: - return PrepayOperationStatusLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(PrepayOperationStatusLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrepayOperationStatusLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrepayOperationStatusLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrepayOperationStatusLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrepayOperationStatusLink'): - super(PrepayOperationStatusLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PrepayOperationStatusLink') - def exportChildren(self, outfile, level, namespace_='', name_='PrepayOperationStatusLink', fromsubclass_=False, pretty_print=True): - super(PrepayOperationStatusLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='PrepayOperationStatusLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PrepayOperationStatusLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PrepayOperationStatusLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PrepayOperationStatusLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PrepayOperationStatusLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PrepayOperationStatusLink - - -class PrepaymentListLink(ListLink): - """SHALL contain a Link to a List of Prepayment instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(PrepaymentListLink, self).__init__() - def factory(*args_, **kwargs_): - if PrepaymentListLink.subclass: - return PrepaymentListLink.subclass(*args_, **kwargs_) - else: - return PrepaymentListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(PrepaymentListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrepaymentListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrepaymentListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrepaymentListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrepaymentListLink'): - super(PrepaymentListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PrepaymentListLink') - def exportChildren(self, outfile, level, namespace_='', name_='PrepaymentListLink', fromsubclass_=False, pretty_print=True): - super(PrepaymentListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='PrepaymentListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PrepaymentListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PrepaymentListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PrepaymentListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PrepaymentListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PrepaymentListLink - - -class PrepaymentLink(Link): - """SHALL contain a Link to an instance of Prepayment.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(PrepaymentLink, self).__init__() - def factory(*args_, **kwargs_): - if PrepaymentLink.subclass: - return PrepaymentLink.subclass(*args_, **kwargs_) - else: - return PrepaymentLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(PrepaymentLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrepaymentLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrepaymentLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrepaymentLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrepaymentLink'): - super(PrepaymentLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PrepaymentLink') - def exportChildren(self, outfile, level, namespace_='', name_='PrepaymentLink', fromsubclass_=False, pretty_print=True): - super(PrepaymentLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='PrepaymentLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PrepaymentLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PrepaymentLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PrepaymentLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PrepaymentLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PrepaymentLink - - -class PowerStatusLink(Link): - """SHALL contain a Link to an instance of PowerStatus.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(PowerStatusLink, self).__init__() - def factory(*args_, **kwargs_): - if PowerStatusLink.subclass: - return PowerStatusLink.subclass(*args_, **kwargs_) - else: - return PowerStatusLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(PowerStatusLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PowerStatusLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PowerStatusLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PowerStatusLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PowerStatusLink'): - super(PowerStatusLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PowerStatusLink') - def exportChildren(self, outfile, level, namespace_='', name_='PowerStatusLink', fromsubclass_=False, pretty_print=True): - super(PowerStatusLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='PowerStatusLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PowerStatusLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PowerStatusLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PowerStatusLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PowerStatusLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PowerStatusLink - - -class NotificationListLink(ListLink): - """SHALL contain a Link to a List of Notification instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(NotificationListLink, self).__init__() - def factory(*args_, **kwargs_): - if NotificationListLink.subclass: - return NotificationListLink.subclass(*args_, **kwargs_) - else: - return NotificationListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(NotificationListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='NotificationListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='NotificationListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='NotificationListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NotificationListLink'): - super(NotificationListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NotificationListLink') - def exportChildren(self, outfile, level, namespace_='', name_='NotificationListLink', fromsubclass_=False, pretty_print=True): - super(NotificationListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='NotificationListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(NotificationListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(NotificationListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(NotificationListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(NotificationListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class NotificationListLink - - -class NeighborListLink(ListLink): - """SHALL contain a Link to a List of Neighbor instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(NeighborListLink, self).__init__() - def factory(*args_, **kwargs_): - if NeighborListLink.subclass: - return NeighborListLink.subclass(*args_, **kwargs_) - else: - return NeighborListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(NeighborListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='NeighborListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='NeighborListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='NeighborListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NeighborListLink'): - super(NeighborListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NeighborListLink') - def exportChildren(self, outfile, level, namespace_='', name_='NeighborListLink', fromsubclass_=False, pretty_print=True): - super(NeighborListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='NeighborListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(NeighborListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(NeighborListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(NeighborListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(NeighborListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class NeighborListLink - - -class MirrorUsagePointListLink(ListLink): - """SHALL contain a Link to a List of MirrorUsagePoint instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(MirrorUsagePointListLink, self).__init__() - def factory(*args_, **kwargs_): - if MirrorUsagePointListLink.subclass: - return MirrorUsagePointListLink.subclass(*args_, **kwargs_) - else: - return MirrorUsagePointListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(MirrorUsagePointListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MirrorUsagePointListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorUsagePointListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MirrorUsagePointListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MirrorUsagePointListLink'): - super(MirrorUsagePointListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorUsagePointListLink') - def exportChildren(self, outfile, level, namespace_='', name_='MirrorUsagePointListLink', fromsubclass_=False, pretty_print=True): - super(MirrorUsagePointListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='MirrorUsagePointListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MirrorUsagePointListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MirrorUsagePointListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MirrorUsagePointListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(MirrorUsagePointListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class MirrorUsagePointListLink - - -class MeterReadingListLink(ListLink): - """SHALL contain a Link to a List of MeterReading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(MeterReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if MeterReadingListLink.subclass: - return MeterReadingListLink.subclass(*args_, **kwargs_) - else: - return MeterReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(MeterReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MeterReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MeterReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MeterReadingListLink'): - super(MeterReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='MeterReadingListLink', fromsubclass_=False, pretty_print=True): - super(MeterReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='MeterReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MeterReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MeterReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MeterReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(MeterReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class MeterReadingListLink - - -class MeterReadingLink(Link): - """SHALL contain a Link to an instance of MeterReading.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(MeterReadingLink, self).__init__() - def factory(*args_, **kwargs_): - if MeterReadingLink.subclass: - return MeterReadingLink.subclass(*args_, **kwargs_) - else: - return MeterReadingLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(MeterReadingLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MeterReadingLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MeterReadingLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MeterReadingLink'): - super(MeterReadingLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingLink') - def exportChildren(self, outfile, level, namespace_='', name_='MeterReadingLink', fromsubclass_=False, pretty_print=True): - super(MeterReadingLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='MeterReadingLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MeterReadingLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MeterReadingLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MeterReadingLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(MeterReadingLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class MeterReadingLink - - -class MessagingProgramListLink(ListLink): - """SHALL contain a Link to a List of MessagingProgram instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(MessagingProgramListLink, self).__init__() - def factory(*args_, **kwargs_): - if MessagingProgramListLink.subclass: - return MessagingProgramListLink.subclass(*args_, **kwargs_) - else: - return MessagingProgramListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(MessagingProgramListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MessagingProgramListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MessagingProgramListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MessagingProgramListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MessagingProgramListLink'): - super(MessagingProgramListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MessagingProgramListLink') - def exportChildren(self, outfile, level, namespace_='', name_='MessagingProgramListLink', fromsubclass_=False, pretty_print=True): - super(MessagingProgramListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='MessagingProgramListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MessagingProgramListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MessagingProgramListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MessagingProgramListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(MessagingProgramListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class MessagingProgramListLink - - -class LogEventListLink(ListLink): - """SHALL contain a Link to a List of LogEvent instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(LogEventListLink, self).__init__() - def factory(*args_, **kwargs_): - if LogEventListLink.subclass: - return LogEventListLink.subclass(*args_, **kwargs_) - else: - return LogEventListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(LogEventListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LogEventListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LogEventListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LogEventListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LogEventListLink'): - super(LogEventListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LogEventListLink') - def exportChildren(self, outfile, level, namespace_='', name_='LogEventListLink', fromsubclass_=False, pretty_print=True): - super(LogEventListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='LogEventListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LogEventListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LogEventListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LogEventListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(LogEventListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class LogEventListLink - - -class LoadShedAvailabilityLink(Link): - """SHALL contain a Link to an instance of LoadShedAvailability.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(LoadShedAvailabilityLink, self).__init__() - def factory(*args_, **kwargs_): - if LoadShedAvailabilityLink.subclass: - return LoadShedAvailabilityLink.subclass(*args_, **kwargs_) - else: - return LoadShedAvailabilityLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(LoadShedAvailabilityLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LoadShedAvailabilityLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LoadShedAvailabilityLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LoadShedAvailabilityLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LoadShedAvailabilityLink'): - super(LoadShedAvailabilityLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LoadShedAvailabilityLink') - def exportChildren(self, outfile, level, namespace_='', name_='LoadShedAvailabilityLink', fromsubclass_=False, pretty_print=True): - super(LoadShedAvailabilityLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='LoadShedAvailabilityLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LoadShedAvailabilityLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LoadShedAvailabilityLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LoadShedAvailabilityLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(LoadShedAvailabilityLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class LoadShedAvailabilityLink - - -class LLInterfaceListLink(ListLink): - """SHALL contain a Link to a List of LLInterface instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(LLInterfaceListLink, self).__init__() - def factory(*args_, **kwargs_): - if LLInterfaceListLink.subclass: - return LLInterfaceListLink.subclass(*args_, **kwargs_) - else: - return LLInterfaceListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(LLInterfaceListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LLInterfaceListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LLInterfaceListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LLInterfaceListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LLInterfaceListLink'): - super(LLInterfaceListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LLInterfaceListLink') - def exportChildren(self, outfile, level, namespace_='', name_='LLInterfaceListLink', fromsubclass_=False, pretty_print=True): - super(LLInterfaceListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='LLInterfaceListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LLInterfaceListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LLInterfaceListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LLInterfaceListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(LLInterfaceListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class LLInterfaceListLink - - -class IPInterfaceListLink(ListLink): - """SHALL contain a Link to a List of IPInterface instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(IPInterfaceListLink, self).__init__() - def factory(*args_, **kwargs_): - if IPInterfaceListLink.subclass: - return IPInterfaceListLink.subclass(*args_, **kwargs_) - else: - return IPInterfaceListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(IPInterfaceListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IPInterfaceListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IPInterfaceListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IPInterfaceListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IPInterfaceListLink'): - super(IPInterfaceListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IPInterfaceListLink') - def exportChildren(self, outfile, level, namespace_='', name_='IPInterfaceListLink', fromsubclass_=False, pretty_print=True): - super(IPInterfaceListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='IPInterfaceListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IPInterfaceListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IPInterfaceListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IPInterfaceListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IPInterfaceListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IPInterfaceListLink - - -class IPAddrListLink(ListLink): - """SHALL contain a Link to a List of IPAddr instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(IPAddrListLink, self).__init__() - def factory(*args_, **kwargs_): - if IPAddrListLink.subclass: - return IPAddrListLink.subclass(*args_, **kwargs_) - else: - return IPAddrListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(IPAddrListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IPAddrListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IPAddrListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IPAddrListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IPAddrListLink'): - super(IPAddrListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IPAddrListLink') - def exportChildren(self, outfile, level, namespace_='', name_='IPAddrListLink', fromsubclass_=False, pretty_print=True): - super(IPAddrListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='IPAddrListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IPAddrListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IPAddrListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IPAddrListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(IPAddrListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class IPAddrListLink - - -class HistoricalReadingListLink(ListLink): - """SHALL contain a Link to a List of HistoricalReading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(HistoricalReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if HistoricalReadingListLink.subclass: - return HistoricalReadingListLink.subclass(*args_, **kwargs_) - else: - return HistoricalReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(HistoricalReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HistoricalReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HistoricalReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HistoricalReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HistoricalReadingListLink'): - super(HistoricalReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='HistoricalReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='HistoricalReadingListLink', fromsubclass_=False, pretty_print=True): - super(HistoricalReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='HistoricalReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(HistoricalReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(HistoricalReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(HistoricalReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(HistoricalReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class HistoricalReadingListLink - - -class FunctionSetAssignmentsListLink(ListLink): - """SHALL contain a Link to a List of FunctionSetAssignments instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(FunctionSetAssignmentsListLink, self).__init__() - def factory(*args_, **kwargs_): - if FunctionSetAssignmentsListLink.subclass: - return FunctionSetAssignmentsListLink.subclass(*args_, **kwargs_) - else: - return FunctionSetAssignmentsListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(FunctionSetAssignmentsListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FunctionSetAssignmentsListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignmentsListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FunctionSetAssignmentsListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FunctionSetAssignmentsListLink'): - super(FunctionSetAssignmentsListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignmentsListLink') - def exportChildren(self, outfile, level, namespace_='', name_='FunctionSetAssignmentsListLink', fromsubclass_=False, pretty_print=True): - super(FunctionSetAssignmentsListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='FunctionSetAssignmentsListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FunctionSetAssignmentsListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FunctionSetAssignmentsListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FunctionSetAssignmentsListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(FunctionSetAssignmentsListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class FunctionSetAssignmentsListLink - - -class FlowReservationResponseListLink(ListLink): - """SHALL contain a Link to a List of FlowReservationResponse instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(FlowReservationResponseListLink, self).__init__() - def factory(*args_, **kwargs_): - if FlowReservationResponseListLink.subclass: - return FlowReservationResponseListLink.subclass(*args_, **kwargs_) - else: - return FlowReservationResponseListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(FlowReservationResponseListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowReservationResponseListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationResponseListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowReservationResponseListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowReservationResponseListLink'): - super(FlowReservationResponseListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationResponseListLink') - def exportChildren(self, outfile, level, namespace_='', name_='FlowReservationResponseListLink', fromsubclass_=False, pretty_print=True): - super(FlowReservationResponseListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='FlowReservationResponseListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FlowReservationResponseListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FlowReservationResponseListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FlowReservationResponseListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(FlowReservationResponseListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class FlowReservationResponseListLink - - -class FlowReservationRequestListLink(ListLink): - """SHALL contain a Link to a List of FlowReservationRequest instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(FlowReservationRequestListLink, self).__init__() - def factory(*args_, **kwargs_): - if FlowReservationRequestListLink.subclass: - return FlowReservationRequestListLink.subclass(*args_, **kwargs_) - else: - return FlowReservationRequestListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(FlowReservationRequestListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowReservationRequestListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationRequestListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowReservationRequestListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowReservationRequestListLink'): - super(FlowReservationRequestListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationRequestListLink') - def exportChildren(self, outfile, level, namespace_='', name_='FlowReservationRequestListLink', fromsubclass_=False, pretty_print=True): - super(FlowReservationRequestListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='FlowReservationRequestListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FlowReservationRequestListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FlowReservationRequestListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FlowReservationRequestListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(FlowReservationRequestListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class FlowReservationRequestListLink - - -class FileStatusLink(Link): - """SHALL contain a Link to an instance of FileStatus.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(FileStatusLink, self).__init__() - def factory(*args_, **kwargs_): - if FileStatusLink.subclass: - return FileStatusLink.subclass(*args_, **kwargs_) - else: - return FileStatusLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(FileStatusLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FileStatusLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FileStatusLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FileStatusLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FileStatusLink'): - super(FileStatusLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FileStatusLink') - def exportChildren(self, outfile, level, namespace_='', name_='FileStatusLink', fromsubclass_=False, pretty_print=True): - super(FileStatusLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='FileStatusLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FileStatusLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FileStatusLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FileStatusLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(FileStatusLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class FileStatusLink - - -class FileListLink(ListLink): - """SHALL contain a Link to a List of File instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(FileListLink, self).__init__() - def factory(*args_, **kwargs_): - if FileListLink.subclass: - return FileListLink.subclass(*args_, **kwargs_) - else: - return FileListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(FileListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FileListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FileListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FileListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FileListLink'): - super(FileListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FileListLink') - def exportChildren(self, outfile, level, namespace_='', name_='FileListLink', fromsubclass_=False, pretty_print=True): - super(FileListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='FileListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FileListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FileListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FileListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(FileListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class FileListLink - - -class FileLink(Link): - """This element MUST be set to the URI of the most recent File being - loaded/activated by the LD. In the case of file status 0, this - element MUST be omitted.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(FileLink, self).__init__() - def factory(*args_, **kwargs_): - if FileLink.subclass: - return FileLink.subclass(*args_, **kwargs_) - else: - return FileLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(FileLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FileLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FileLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FileLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FileLink'): - super(FileLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FileLink') - def exportChildren(self, outfile, level, namespace_='', name_='FileLink', fromsubclass_=False, pretty_print=True): - super(FileLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='FileLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FileLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FileLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FileLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(FileLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class FileLink - - -class EndDeviceListLink(ListLink): - """SHALL contain a Link to a List of EndDevice instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(EndDeviceListLink, self).__init__() - def factory(*args_, **kwargs_): - if EndDeviceListLink.subclass: - return EndDeviceListLink.subclass(*args_, **kwargs_) - else: - return EndDeviceListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(EndDeviceListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDeviceListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDeviceListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDeviceListLink'): - super(EndDeviceListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceListLink') - def exportChildren(self, outfile, level, namespace_='', name_='EndDeviceListLink', fromsubclass_=False, pretty_print=True): - super(EndDeviceListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='EndDeviceListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDeviceListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDeviceListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDeviceListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(EndDeviceListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class EndDeviceListLink - - -class EndDeviceLink(Link): - """SHALL contain a Link to an instance of EndDevice.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(EndDeviceLink, self).__init__() - def factory(*args_, **kwargs_): - if EndDeviceLink.subclass: - return EndDeviceLink.subclass(*args_, **kwargs_) - else: - return EndDeviceLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(EndDeviceLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDeviceLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDeviceLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDeviceLink'): - super(EndDeviceLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceLink') - def exportChildren(self, outfile, level, namespace_='', name_='EndDeviceLink', fromsubclass_=False, pretty_print=True): - super(EndDeviceLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='EndDeviceLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDeviceLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDeviceLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDeviceLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(EndDeviceLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class EndDeviceLink - - -class EndDeviceControlListLink(ListLink): - """SHALL contain a Link to a List of EndDeviceControl instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(EndDeviceControlListLink, self).__init__() - def factory(*args_, **kwargs_): - if EndDeviceControlListLink.subclass: - return EndDeviceControlListLink.subclass(*args_, **kwargs_) - else: - return EndDeviceControlListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(EndDeviceControlListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDeviceControlListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceControlListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDeviceControlListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDeviceControlListLink'): - super(EndDeviceControlListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceControlListLink') - def exportChildren(self, outfile, level, namespace_='', name_='EndDeviceControlListLink', fromsubclass_=False, pretty_print=True): - super(EndDeviceControlListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='EndDeviceControlListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDeviceControlListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDeviceControlListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDeviceControlListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(EndDeviceControlListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class EndDeviceControlListLink - - -class DeviceStatusLink(Link): - """SHALL contain a Link to an instance of DeviceStatus.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DeviceStatusLink, self).__init__() - def factory(*args_, **kwargs_): - if DeviceStatusLink.subclass: - return DeviceStatusLink.subclass(*args_, **kwargs_) - else: - return DeviceStatusLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DeviceStatusLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceStatusLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceStatusLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceStatusLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceStatusLink'): - super(DeviceStatusLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceStatusLink') - def exportChildren(self, outfile, level, namespace_='', name_='DeviceStatusLink', fromsubclass_=False, pretty_print=True): - super(DeviceStatusLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DeviceStatusLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DeviceStatusLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DeviceStatusLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DeviceStatusLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DeviceStatusLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DeviceStatusLink - - -class DeviceInformationLink(Link): - """SHALL contain a Link to an instance of DeviceInformation.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DeviceInformationLink, self).__init__() - def factory(*args_, **kwargs_): - if DeviceInformationLink.subclass: - return DeviceInformationLink.subclass(*args_, **kwargs_) - else: - return DeviceInformationLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DeviceInformationLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceInformationLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceInformationLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceInformationLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceInformationLink'): - super(DeviceInformationLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceInformationLink') - def exportChildren(self, outfile, level, namespace_='', name_='DeviceInformationLink', fromsubclass_=False, pretty_print=True): - super(DeviceInformationLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DeviceInformationLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DeviceInformationLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DeviceInformationLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DeviceInformationLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DeviceInformationLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DeviceInformationLink - - -class DeviceCapabilityLink(Link): - """SHALL contain a Link to an instance of DeviceCapability.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DeviceCapabilityLink, self).__init__() - def factory(*args_, **kwargs_): - if DeviceCapabilityLink.subclass: - return DeviceCapabilityLink.subclass(*args_, **kwargs_) - else: - return DeviceCapabilityLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DeviceCapabilityLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceCapabilityLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceCapabilityLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceCapabilityLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceCapabilityLink'): - super(DeviceCapabilityLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceCapabilityLink') - def exportChildren(self, outfile, level, namespace_='', name_='DeviceCapabilityLink', fromsubclass_=False, pretty_print=True): - super(DeviceCapabilityLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DeviceCapabilityLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DeviceCapabilityLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DeviceCapabilityLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DeviceCapabilityLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DeviceCapabilityLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DeviceCapabilityLink - - -class DERStatusLink(Link): - """SHALL contain a Link to an instance of DERStatus.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERStatusLink, self).__init__() - def factory(*args_, **kwargs_): - if DERStatusLink.subclass: - return DERStatusLink.subclass(*args_, **kwargs_) - else: - return DERStatusLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERStatusLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERStatusLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERStatusLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERStatusLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERStatusLink'): - super(DERStatusLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERStatusLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERStatusLink', fromsubclass_=False, pretty_print=True): - super(DERStatusLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERStatusLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERStatusLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERStatusLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERStatusLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERStatusLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERStatusLink - - -class DERSettingsLink(Link): - """SHALL contain a Link to an instance of DERSettings.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERSettingsLink, self).__init__() - def factory(*args_, **kwargs_): - if DERSettingsLink.subclass: - return DERSettingsLink.subclass(*args_, **kwargs_) - else: - return DERSettingsLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERSettingsLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERSettingsLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERSettingsLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERSettingsLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERSettingsLink'): - super(DERSettingsLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERSettingsLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERSettingsLink', fromsubclass_=False, pretty_print=True): - super(DERSettingsLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERSettingsLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERSettingsLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERSettingsLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERSettingsLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERSettingsLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERSettingsLink - - -class DERProgramListLink(ListLink): - """SHALL contain a Link to a List of DERProgram instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(DERProgramListLink, self).__init__() - def factory(*args_, **kwargs_): - if DERProgramListLink.subclass: - return DERProgramListLink.subclass(*args_, **kwargs_) - else: - return DERProgramListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERProgramListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERProgramListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgramListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERProgramListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERProgramListLink'): - super(DERProgramListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgramListLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERProgramListLink', fromsubclass_=False, pretty_print=True): - super(DERProgramListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERProgramListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERProgramListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERProgramListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERProgramListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERProgramListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERProgramListLink - - -class DERProgramLink(Link): - """SHALL contain a Link to an instance of DERProgram.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERProgramLink, self).__init__() - def factory(*args_, **kwargs_): - if DERProgramLink.subclass: - return DERProgramLink.subclass(*args_, **kwargs_) - else: - return DERProgramLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERProgramLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERProgramLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgramLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERProgramLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERProgramLink'): - super(DERProgramLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgramLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERProgramLink', fromsubclass_=False, pretty_print=True): - super(DERProgramLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERProgramLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERProgramLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERProgramLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERProgramLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERProgramLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERProgramLink - - -class DERListLink(ListLink): - """SHALL contain a Link to a List of DER instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(DERListLink, self).__init__() - def factory(*args_, **kwargs_): - if DERListLink.subclass: - return DERListLink.subclass(*args_, **kwargs_) - else: - return DERListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERListLink'): - super(DERListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERListLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERListLink', fromsubclass_=False, pretty_print=True): - super(DERListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERListLink - - -class DERLink(Link): - """SHALL contain a Link to an instance of DER.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERLink, self).__init__() - def factory(*args_, **kwargs_): - if DERLink.subclass: - return DERLink.subclass(*args_, **kwargs_) - else: - return DERLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERLink'): - super(DERLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERLink', fromsubclass_=False, pretty_print=True): - super(DERLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERLink - - -class DERCurveListLink(ListLink): - """SHALL contain a Link to a List of DERCurve instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(DERCurveListLink, self).__init__() - def factory(*args_, **kwargs_): - if DERCurveListLink.subclass: - return DERCurveListLink.subclass(*args_, **kwargs_) - else: - return DERCurveListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERCurveListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCurveListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCurveListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCurveListLink'): - super(DERCurveListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveListLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERCurveListLink', fromsubclass_=False, pretty_print=True): - super(DERCurveListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERCurveListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERCurveListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERCurveListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERCurveListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERCurveListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERCurveListLink - - -class DERCurveLink(Link): - """SHALL contain a Link to an instance of DERCurve.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERCurveLink, self).__init__() - def factory(*args_, **kwargs_): - if DERCurveLink.subclass: - return DERCurveLink.subclass(*args_, **kwargs_) - else: - return DERCurveLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERCurveLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCurveLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCurveLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCurveLink'): - super(DERCurveLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERCurveLink', fromsubclass_=False, pretty_print=True): - super(DERCurveLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERCurveLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERCurveLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERCurveLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERCurveLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERCurveLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERCurveLink - - -class DERControlListLink(ListLink): - """SHALL contain a Link to a List of DERControl instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(DERControlListLink, self).__init__() - def factory(*args_, **kwargs_): - if DERControlListLink.subclass: - return DERControlListLink.subclass(*args_, **kwargs_) - else: - return DERControlListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERControlListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERControlListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERControlListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERControlListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERControlListLink'): - super(DERControlListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERControlListLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERControlListLink', fromsubclass_=False, pretty_print=True): - super(DERControlListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERControlListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERControlListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERControlListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERControlListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERControlListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERControlListLink - - -class DERCapabilityLink(Link): - """SHALL contain a Link to an instance of DERCapability.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERCapabilityLink, self).__init__() - def factory(*args_, **kwargs_): - if DERCapabilityLink.subclass: - return DERCapabilityLink.subclass(*args_, **kwargs_) - else: - return DERCapabilityLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERCapabilityLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCapabilityLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCapabilityLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCapabilityLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCapabilityLink'): - super(DERCapabilityLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERCapabilityLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERCapabilityLink', fromsubclass_=False, pretty_print=True): - super(DERCapabilityLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERCapabilityLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERCapabilityLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERCapabilityLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERCapabilityLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERCapabilityLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERCapabilityLink - - -class DefaultDERControlLink(Link): - """SHALL contain a Link to an instance of DefaultDERControl. This is - the default mode of the DER which MAY be overridden by - DERControl events.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DefaultDERControlLink, self).__init__() - def factory(*args_, **kwargs_): - if DefaultDERControlLink.subclass: - return DefaultDERControlLink.subclass(*args_, **kwargs_) - else: - return DefaultDERControlLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DefaultDERControlLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DefaultDERControlLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DefaultDERControlLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DefaultDERControlLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DefaultDERControlLink'): - super(DefaultDERControlLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DefaultDERControlLink') - def exportChildren(self, outfile, level, namespace_='', name_='DefaultDERControlLink', fromsubclass_=False, pretty_print=True): - super(DefaultDERControlLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DefaultDERControlLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DefaultDERControlLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DefaultDERControlLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DefaultDERControlLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DefaultDERControlLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DefaultDERControlLink - - -class DERAvailabilityLink(Link): - """SHALL contain a Link to an instance of DERAvailability.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DERAvailabilityLink, self).__init__() - def factory(*args_, **kwargs_): - if DERAvailabilityLink.subclass: - return DERAvailabilityLink.subclass(*args_, **kwargs_) - else: - return DERAvailabilityLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DERAvailabilityLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERAvailabilityLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERAvailabilityLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERAvailabilityLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERAvailabilityLink'): - super(DERAvailabilityLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERAvailabilityLink') - def exportChildren(self, outfile, level, namespace_='', name_='DERAvailabilityLink', fromsubclass_=False, pretty_print=True): - super(DERAvailabilityLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DERAvailabilityLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERAvailabilityLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERAvailabilityLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERAvailabilityLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DERAvailabilityLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DERAvailabilityLink - - -class DemandResponseProgramListLink(ListLink): - """SHALL contain a Link to a List of DemandResponseProgram instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(DemandResponseProgramListLink, self).__init__() - def factory(*args_, **kwargs_): - if DemandResponseProgramListLink.subclass: - return DemandResponseProgramListLink.subclass(*args_, **kwargs_) - else: - return DemandResponseProgramListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DemandResponseProgramListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DemandResponseProgramListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgramListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DemandResponseProgramListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DemandResponseProgramListLink'): - super(DemandResponseProgramListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgramListLink') - def exportChildren(self, outfile, level, namespace_='', name_='DemandResponseProgramListLink', fromsubclass_=False, pretty_print=True): - super(DemandResponseProgramListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DemandResponseProgramListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DemandResponseProgramListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DemandResponseProgramListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DemandResponseProgramListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DemandResponseProgramListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DemandResponseProgramListLink - - -class DemandResponseProgramLink(Link): - """SHALL contain a Link to an instance of DemandResponseProgram.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(DemandResponseProgramLink, self).__init__() - def factory(*args_, **kwargs_): - if DemandResponseProgramLink.subclass: - return DemandResponseProgramLink.subclass(*args_, **kwargs_) - else: - return DemandResponseProgramLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(DemandResponseProgramLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DemandResponseProgramLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgramLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DemandResponseProgramLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DemandResponseProgramLink'): - super(DemandResponseProgramLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgramLink') - def exportChildren(self, outfile, level, namespace_='', name_='DemandResponseProgramLink', fromsubclass_=False, pretty_print=True): - super(DemandResponseProgramLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='DemandResponseProgramLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DemandResponseProgramLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DemandResponseProgramLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DemandResponseProgramLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(DemandResponseProgramLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class DemandResponseProgramLink - - -class CustomerAgreementListLink(ListLink): - """SHALL contain a Link to a List of CustomerAgreement instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(CustomerAgreementListLink, self).__init__() - def factory(*args_, **kwargs_): - if CustomerAgreementListLink.subclass: - return CustomerAgreementListLink.subclass(*args_, **kwargs_) - else: - return CustomerAgreementListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(CustomerAgreementListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAgreementListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAgreementListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAgreementListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAgreementListLink'): - super(CustomerAgreementListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAgreementListLink') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAgreementListLink', fromsubclass_=False, pretty_print=True): - super(CustomerAgreementListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='CustomerAgreementListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAgreementListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAgreementListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAgreementListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(CustomerAgreementListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class CustomerAgreementListLink - - -class CustomerAccountListLink(ListLink): - """SHALL contain a Link to a List of CustomerAccount instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(CustomerAccountListLink, self).__init__() - def factory(*args_, **kwargs_): - if CustomerAccountListLink.subclass: - return CustomerAccountListLink.subclass(*args_, **kwargs_) - else: - return CustomerAccountListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(CustomerAccountListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAccountListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccountListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAccountListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAccountListLink'): - super(CustomerAccountListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccountListLink') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAccountListLink', fromsubclass_=False, pretty_print=True): - super(CustomerAccountListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='CustomerAccountListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAccountListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAccountListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAccountListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(CustomerAccountListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class CustomerAccountListLink - - -class CustomerAccountLink(Link): - """SHALL contain a Link to an instance of CustomerAccount.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(CustomerAccountLink, self).__init__() - def factory(*args_, **kwargs_): - if CustomerAccountLink.subclass: - return CustomerAccountLink.subclass(*args_, **kwargs_) - else: - return CustomerAccountLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(CustomerAccountLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAccountLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccountLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAccountLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAccountLink'): - super(CustomerAccountLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccountLink') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAccountLink', fromsubclass_=False, pretty_print=True): - super(CustomerAccountLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='CustomerAccountLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAccountLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAccountLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAccountLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(CustomerAccountLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class CustomerAccountLink - - -class CreditRegisterListLink(ListLink): - """SHALL contain a Link to a List of CreditRegister instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(CreditRegisterListLink, self).__init__() - def factory(*args_, **kwargs_): - if CreditRegisterListLink.subclass: - return CreditRegisterListLink.subclass(*args_, **kwargs_) - else: - return CreditRegisterListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(CreditRegisterListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CreditRegisterListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CreditRegisterListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CreditRegisterListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CreditRegisterListLink'): - super(CreditRegisterListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CreditRegisterListLink') - def exportChildren(self, outfile, level, namespace_='', name_='CreditRegisterListLink', fromsubclass_=False, pretty_print=True): - super(CreditRegisterListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='CreditRegisterListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CreditRegisterListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CreditRegisterListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CreditRegisterListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(CreditRegisterListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class CreditRegisterListLink - - -class ConsumptionTariffIntervalListLink(ListLink): - """SHALL contain a Link to a List of ConsumptionTariffInterval - instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ConsumptionTariffIntervalListLink, self).__init__() - def factory(*args_, **kwargs_): - if ConsumptionTariffIntervalListLink.subclass: - return ConsumptionTariffIntervalListLink.subclass(*args_, **kwargs_) - else: - return ConsumptionTariffIntervalListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ConsumptionTariffIntervalListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConsumptionTariffIntervalListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionTariffIntervalListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConsumptionTariffIntervalListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConsumptionTariffIntervalListLink'): - super(ConsumptionTariffIntervalListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionTariffIntervalListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ConsumptionTariffIntervalListLink', fromsubclass_=False, pretty_print=True): - super(ConsumptionTariffIntervalListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ConsumptionTariffIntervalListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ConsumptionTariffIntervalListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ConsumptionTariffIntervalListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ConsumptionTariffIntervalListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ConsumptionTariffIntervalListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ConsumptionTariffIntervalListLink - - -class ConfigurationLink(Link): - """SHALL contain a Link to an instance of Configuration.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(ConfigurationLink, self).__init__() - def factory(*args_, **kwargs_): - if ConfigurationLink.subclass: - return ConfigurationLink.subclass(*args_, **kwargs_) - else: - return ConfigurationLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ConfigurationLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConfigurationLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConfigurationLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConfigurationLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConfigurationLink'): - super(ConfigurationLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ConfigurationLink') - def exportChildren(self, outfile, level, namespace_='', name_='ConfigurationLink', fromsubclass_=False, pretty_print=True): - super(ConfigurationLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ConfigurationLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ConfigurationLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ConfigurationLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ConfigurationLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ConfigurationLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ConfigurationLink - - -class BillingReadingSetListLink(ListLink): - """SHALL contain a Link to a List of BillingReadingSet instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(BillingReadingSetListLink, self).__init__() - def factory(*args_, **kwargs_): - if BillingReadingSetListLink.subclass: - return BillingReadingSetListLink.subclass(*args_, **kwargs_) - else: - return BillingReadingSetListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(BillingReadingSetListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingReadingSetListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingSetListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingReadingSetListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingReadingSetListLink'): - super(BillingReadingSetListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingSetListLink') - def exportChildren(self, outfile, level, namespace_='', name_='BillingReadingSetListLink', fromsubclass_=False, pretty_print=True): - super(BillingReadingSetListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='BillingReadingSetListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingReadingSetListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingReadingSetListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingReadingSetListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BillingReadingSetListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BillingReadingSetListLink - - -class BillingReadingListLink(ListLink): - """SHALL contain a Link to a List of BillingReading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(BillingReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if BillingReadingListLink.subclass: - return BillingReadingListLink.subclass(*args_, **kwargs_) - else: - return BillingReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(BillingReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingReadingListLink'): - super(BillingReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='BillingReadingListLink', fromsubclass_=False, pretty_print=True): - super(BillingReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='BillingReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BillingReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BillingReadingListLink - - -class BillingPeriodListLink(ListLink): - """SHALL contain a Link to a List of BillingPeriod instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(BillingPeriodListLink, self).__init__() - def factory(*args_, **kwargs_): - if BillingPeriodListLink.subclass: - return BillingPeriodListLink.subclass(*args_, **kwargs_) - else: - return BillingPeriodListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(BillingPeriodListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingPeriodListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingPeriodListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingPeriodListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingPeriodListLink'): - super(BillingPeriodListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingPeriodListLink') - def exportChildren(self, outfile, level, namespace_='', name_='BillingPeriodListLink', fromsubclass_=False, pretty_print=True): - super(BillingPeriodListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='BillingPeriodListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingPeriodListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingPeriodListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingPeriodListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(BillingPeriodListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class BillingPeriodListLink - - -class AssociatedUsagePointLink(Link): - """SHALL contain a Link to an instance of UsagePoint. If present, this - is the submeter that monitors the DER output.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(AssociatedUsagePointLink, self).__init__() - def factory(*args_, **kwargs_): - if AssociatedUsagePointLink.subclass: - return AssociatedUsagePointLink.subclass(*args_, **kwargs_) - else: - return AssociatedUsagePointLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(AssociatedUsagePointLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AssociatedUsagePointLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AssociatedUsagePointLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AssociatedUsagePointLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AssociatedUsagePointLink'): - super(AssociatedUsagePointLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AssociatedUsagePointLink') - def exportChildren(self, outfile, level, namespace_='', name_='AssociatedUsagePointLink', fromsubclass_=False, pretty_print=True): - super(AssociatedUsagePointLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='AssociatedUsagePointLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(AssociatedUsagePointLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(AssociatedUsagePointLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AssociatedUsagePointLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AssociatedUsagePointLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AssociatedUsagePointLink - - -class AssociatedDERProgramListLink(ListLink): - """SHALL contain a Link to a List of DERPrograms having the - DERControl(s) for this DER.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(AssociatedDERProgramListLink, self).__init__() - def factory(*args_, **kwargs_): - if AssociatedDERProgramListLink.subclass: - return AssociatedDERProgramListLink.subclass(*args_, **kwargs_) - else: - return AssociatedDERProgramListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(AssociatedDERProgramListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AssociatedDERProgramListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AssociatedDERProgramListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AssociatedDERProgramListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AssociatedDERProgramListLink'): - super(AssociatedDERProgramListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AssociatedDERProgramListLink') - def exportChildren(self, outfile, level, namespace_='', name_='AssociatedDERProgramListLink', fromsubclass_=False, pretty_print=True): - super(AssociatedDERProgramListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='AssociatedDERProgramListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(AssociatedDERProgramListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(AssociatedDERProgramListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AssociatedDERProgramListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AssociatedDERProgramListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AssociatedDERProgramListLink - - -class ActiveTimeTariffIntervalListLink(ListLink): - """SHALL contain a Link to a List of active TimeTariffInterval - instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveTimeTariffIntervalListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveTimeTariffIntervalListLink.subclass: - return ActiveTimeTariffIntervalListLink.subclass(*args_, **kwargs_) - else: - return ActiveTimeTariffIntervalListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveTimeTariffIntervalListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveTimeTariffIntervalListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveTimeTariffIntervalListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveTimeTariffIntervalListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveTimeTariffIntervalListLink'): - super(ActiveTimeTariffIntervalListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveTimeTariffIntervalListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveTimeTariffIntervalListLink', fromsubclass_=False, pretty_print=True): - super(ActiveTimeTariffIntervalListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveTimeTariffIntervalListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveTimeTariffIntervalListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveTimeTariffIntervalListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveTimeTariffIntervalListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveTimeTariffIntervalListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveTimeTariffIntervalListLink - - -class ActiveTextMessageListLink(ListLink): - """SHALL contain a Link to a List of active TextMessage instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveTextMessageListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveTextMessageListLink.subclass: - return ActiveTextMessageListLink.subclass(*args_, **kwargs_) - else: - return ActiveTextMessageListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveTextMessageListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveTextMessageListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveTextMessageListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveTextMessageListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveTextMessageListLink'): - super(ActiveTextMessageListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveTextMessageListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveTextMessageListLink', fromsubclass_=False, pretty_print=True): - super(ActiveTextMessageListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveTextMessageListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveTextMessageListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveTextMessageListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveTextMessageListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveTextMessageListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveTextMessageListLink - - -class ActiveTargetReadingListLink(ListLink): - """SHALL contain a Link to a List of active TargetReading instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveTargetReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveTargetReadingListLink.subclass: - return ActiveTargetReadingListLink.subclass(*args_, **kwargs_) - else: - return ActiveTargetReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveTargetReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveTargetReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveTargetReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveTargetReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveTargetReadingListLink'): - super(ActiveTargetReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveTargetReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveTargetReadingListLink', fromsubclass_=False, pretty_print=True): - super(ActiveTargetReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveTargetReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveTargetReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveTargetReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveTargetReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveTargetReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveTargetReadingListLink - - -class ActiveSupplyInterruptionOverrideListLink(ListLink): - """SHALL contain a Link to a List of active SupplyInterruptionOverride - instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveSupplyInterruptionOverrideListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveSupplyInterruptionOverrideListLink.subclass: - return ActiveSupplyInterruptionOverrideListLink.subclass(*args_, **kwargs_) - else: - return ActiveSupplyInterruptionOverrideListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveSupplyInterruptionOverrideListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveSupplyInterruptionOverrideListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveSupplyInterruptionOverrideListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveSupplyInterruptionOverrideListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveSupplyInterruptionOverrideListLink'): - super(ActiveSupplyInterruptionOverrideListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveSupplyInterruptionOverrideListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveSupplyInterruptionOverrideListLink', fromsubclass_=False, pretty_print=True): - super(ActiveSupplyInterruptionOverrideListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveSupplyInterruptionOverrideListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveSupplyInterruptionOverrideListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveSupplyInterruptionOverrideListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveSupplyInterruptionOverrideListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveSupplyInterruptionOverrideListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveSupplyInterruptionOverrideListLink - - -class ActiveProjectionReadingListLink(ListLink): - """SHALL contain a Link to a List of active ProjectionReading - instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveProjectionReadingListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveProjectionReadingListLink.subclass: - return ActiveProjectionReadingListLink.subclass(*args_, **kwargs_) - else: - return ActiveProjectionReadingListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveProjectionReadingListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveProjectionReadingListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveProjectionReadingListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveProjectionReadingListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveProjectionReadingListLink'): - super(ActiveProjectionReadingListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveProjectionReadingListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveProjectionReadingListLink', fromsubclass_=False, pretty_print=True): - super(ActiveProjectionReadingListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveProjectionReadingListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveProjectionReadingListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveProjectionReadingListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveProjectionReadingListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveProjectionReadingListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveProjectionReadingListLink - - -class ActiveFlowReservationListLink(ListLink): - """SHALL contain a Link to a List of active FlowReservation instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveFlowReservationListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveFlowReservationListLink.subclass: - return ActiveFlowReservationListLink.subclass(*args_, **kwargs_) - else: - return ActiveFlowReservationListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveFlowReservationListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveFlowReservationListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveFlowReservationListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveFlowReservationListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveFlowReservationListLink'): - super(ActiveFlowReservationListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveFlowReservationListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveFlowReservationListLink', fromsubclass_=False, pretty_print=True): - super(ActiveFlowReservationListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveFlowReservationListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveFlowReservationListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveFlowReservationListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveFlowReservationListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveFlowReservationListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveFlowReservationListLink - - -class ActiveEndDeviceControlListLink(ListLink): - """SHALL contain a Link to a List of active EndDeviceControl instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveEndDeviceControlListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveEndDeviceControlListLink.subclass: - return ActiveEndDeviceControlListLink.subclass(*args_, **kwargs_) - else: - return ActiveEndDeviceControlListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveEndDeviceControlListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveEndDeviceControlListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveEndDeviceControlListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveEndDeviceControlListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveEndDeviceControlListLink'): - super(ActiveEndDeviceControlListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveEndDeviceControlListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveEndDeviceControlListLink', fromsubclass_=False, pretty_print=True): - super(ActiveEndDeviceControlListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveEndDeviceControlListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveEndDeviceControlListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveEndDeviceControlListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveEndDeviceControlListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveEndDeviceControlListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveEndDeviceControlListLink - - -class ActiveDERControlListLink(ListLink): - """SHALL contain a Link to a List of active DERControl instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveDERControlListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveDERControlListLink.subclass: - return ActiveDERControlListLink.subclass(*args_, **kwargs_) - else: - return ActiveDERControlListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveDERControlListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveDERControlListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveDERControlListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveDERControlListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveDERControlListLink'): - super(ActiveDERControlListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveDERControlListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveDERControlListLink', fromsubclass_=False, pretty_print=True): - super(ActiveDERControlListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveDERControlListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveDERControlListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveDERControlListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveDERControlListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveDERControlListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveDERControlListLink - - -class ActiveCreditRegisterListLink(ListLink): - """SHALL contain a Link to a List of active CreditRegister instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveCreditRegisterListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveCreditRegisterListLink.subclass: - return ActiveCreditRegisterListLink.subclass(*args_, **kwargs_) - else: - return ActiveCreditRegisterListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveCreditRegisterListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveCreditRegisterListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveCreditRegisterListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveCreditRegisterListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveCreditRegisterListLink'): - super(ActiveCreditRegisterListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveCreditRegisterListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveCreditRegisterListLink', fromsubclass_=False, pretty_print=True): - super(ActiveCreditRegisterListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveCreditRegisterListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveCreditRegisterListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveCreditRegisterListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveCreditRegisterListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveCreditRegisterListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveCreditRegisterListLink - - -class ActiveBillingPeriodListLink(ListLink): - """SHALL contain a Link to a List of active BillingPeriod instances.""" - subclass = None - superclass = ListLink - def __init__(self): - self.original_tagname_ = None - super(ActiveBillingPeriodListLink, self).__init__() - def factory(*args_, **kwargs_): - if ActiveBillingPeriodListLink.subclass: - return ActiveBillingPeriodListLink.subclass(*args_, **kwargs_) - else: - return ActiveBillingPeriodListLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ActiveBillingPeriodListLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ActiveBillingPeriodListLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveBillingPeriodListLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ActiveBillingPeriodListLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ActiveBillingPeriodListLink'): - super(ActiveBillingPeriodListLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ActiveBillingPeriodListLink') - def exportChildren(self, outfile, level, namespace_='', name_='ActiveBillingPeriodListLink', fromsubclass_=False, pretty_print=True): - super(ActiveBillingPeriodListLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ActiveBillingPeriodListLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ActiveBillingPeriodListLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ActiveBillingPeriodListLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ActiveBillingPeriodListLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ActiveBillingPeriodListLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ActiveBillingPeriodListLink - - -class AccountBalanceLink(Link): - """SHALL contain a Link to an instance of AccountBalance.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(AccountBalanceLink, self).__init__() - def factory(*args_, **kwargs_): - if AccountBalanceLink.subclass: - return AccountBalanceLink.subclass(*args_, **kwargs_) - else: - return AccountBalanceLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(AccountBalanceLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AccountBalanceLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AccountBalanceLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AccountBalanceLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AccountBalanceLink'): - super(AccountBalanceLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AccountBalanceLink') - def exportChildren(self, outfile, level, namespace_='', name_='AccountBalanceLink', fromsubclass_=False, pretty_print=True): - super(AccountBalanceLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='AccountBalanceLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(AccountBalanceLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(AccountBalanceLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AccountBalanceLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AccountBalanceLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AccountBalanceLink - - -class DERStatus(SubscribableResource): - """DER status information.""" - subclass = None - superclass = SubscribableResource - def __init__(self, genConnectStatus=None, inverterStatus=None, localControlModeStatus=None, manufacturerStatus=None, operationalModeStatus=None, readingTime=None, stateOfChargeStatus=None, storageModeStatus=None, storConnectStatus=None): - self.original_tagname_ = None - super(DERStatus, self).__init__() - self.genConnectStatus = genConnectStatus - self.inverterStatus = inverterStatus - self.localControlModeStatus = localControlModeStatus - self.manufacturerStatus = manufacturerStatus - self.operationalModeStatus = operationalModeStatus - self.readingTime = readingTime - self.stateOfChargeStatus = stateOfChargeStatus - self.storageModeStatus = storageModeStatus - self.storConnectStatus = storConnectStatus - def factory(*args_, **kwargs_): - if DERStatus.subclass: - return DERStatus.subclass(*args_, **kwargs_) - else: - return DERStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_genConnectStatus(self): return self.genConnectStatus - def set_genConnectStatus(self, genConnectStatus): self.genConnectStatus = genConnectStatus - def get_inverterStatus(self): return self.inverterStatus - def set_inverterStatus(self, inverterStatus): self.inverterStatus = inverterStatus - def get_localControlModeStatus(self): return self.localControlModeStatus - def set_localControlModeStatus(self, localControlModeStatus): self.localControlModeStatus = localControlModeStatus - def get_manufacturerStatus(self): return self.manufacturerStatus - def set_manufacturerStatus(self, manufacturerStatus): self.manufacturerStatus = manufacturerStatus - def get_operationalModeStatus(self): return self.operationalModeStatus - def set_operationalModeStatus(self, operationalModeStatus): self.operationalModeStatus = operationalModeStatus - def get_readingTime(self): return self.readingTime - def set_readingTime(self, readingTime): self.readingTime = readingTime - def get_stateOfChargeStatus(self): return self.stateOfChargeStatus - def set_stateOfChargeStatus(self, stateOfChargeStatus): self.stateOfChargeStatus = stateOfChargeStatus - def get_storageModeStatus(self): return self.storageModeStatus - def set_storageModeStatus(self, storageModeStatus): self.storageModeStatus = storageModeStatus - def get_storConnectStatus(self): return self.storConnectStatus - def set_storConnectStatus(self, storConnectStatus): self.storConnectStatus = storConnectStatus - def hasContent_(self): - if ( - self.genConnectStatus is not None or - self.inverterStatus is not None or - self.localControlModeStatus is not None or - self.manufacturerStatus is not None or - self.operationalModeStatus is not None or - self.readingTime is not None or - self.stateOfChargeStatus is not None or - self.storageModeStatus is not None or - self.storConnectStatus is not None or - super(DERStatus, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERStatus'): - super(DERStatus, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERStatus') - def exportChildren(self, outfile, level, namespace_='', name_='DERStatus', fromsubclass_=False, pretty_print=True): - super(DERStatus, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.genConnectStatus is not None: - self.genConnectStatus.export(outfile, level, namespace_, name_='genConnectStatus', pretty_print=pretty_print) - if self.inverterStatus is not None: - self.inverterStatus.export(outfile, level, namespace_, name_='inverterStatus', pretty_print=pretty_print) - if self.localControlModeStatus is not None: - self.localControlModeStatus.export(outfile, level, namespace_, name_='localControlModeStatus', pretty_print=pretty_print) - if self.manufacturerStatus is not None: - self.manufacturerStatus.export(outfile, level, namespace_, name_='manufacturerStatus', pretty_print=pretty_print) - if self.operationalModeStatus is not None: - self.operationalModeStatus.export(outfile, level, namespace_, name_='operationalModeStatus', pretty_print=pretty_print) - if self.readingTime is not None: - self.readingTime.export(outfile, level, namespace_, name_='readingTime', pretty_print=pretty_print) - if self.stateOfChargeStatus is not None: - self.stateOfChargeStatus.export(outfile, level, namespace_, name_='stateOfChargeStatus', pretty_print=pretty_print) - if self.storageModeStatus is not None: - self.storageModeStatus.export(outfile, level, namespace_, name_='storageModeStatus', pretty_print=pretty_print) - if self.storConnectStatus is not None: - self.storConnectStatus.export(outfile, level, namespace_, name_='storConnectStatus', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERStatus, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERStatus, self).exportLiteralChildren(outfile, level, name_) - if self.genConnectStatus is not None: - showIndent(outfile, level) - outfile.write('genConnectStatus=model_.ConnectStatusType(\n') - self.genConnectStatus.exportLiteral(outfile, level, name_='genConnectStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.inverterStatus is not None: - showIndent(outfile, level) - outfile.write('inverterStatus=model_.InverterStatusType(\n') - self.inverterStatus.exportLiteral(outfile, level, name_='inverterStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.localControlModeStatus is not None: - showIndent(outfile, level) - outfile.write('localControlModeStatus=model_.LocalControlModeStatusType(\n') - self.localControlModeStatus.exportLiteral(outfile, level, name_='localControlModeStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.manufacturerStatus is not None: - showIndent(outfile, level) - outfile.write('manufacturerStatus=model_.ManufacturerStatusType(\n') - self.manufacturerStatus.exportLiteral(outfile, level, name_='manufacturerStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.operationalModeStatus is not None: - showIndent(outfile, level) - outfile.write('operationalModeStatus=model_.OperationalModeStatusType(\n') - self.operationalModeStatus.exportLiteral(outfile, level, name_='operationalModeStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.readingTime is not None: - showIndent(outfile, level) - outfile.write('readingTime=model_.TimeType(\n') - self.readingTime.exportLiteral(outfile, level, name_='readingTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.stateOfChargeStatus is not None: - showIndent(outfile, level) - outfile.write('stateOfChargeStatus=model_.StateOfChargeStatusType(\n') - self.stateOfChargeStatus.exportLiteral(outfile, level, name_='stateOfChargeStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.storageModeStatus is not None: - showIndent(outfile, level) - outfile.write('storageModeStatus=model_.StorageModeStatusType(\n') - self.storageModeStatus.exportLiteral(outfile, level, name_='storageModeStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.storConnectStatus is not None: - showIndent(outfile, level) - outfile.write('storConnectStatus=model_.ConnectStatusType(\n') - self.storConnectStatus.exportLiteral(outfile, level, name_='storConnectStatus') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERStatus, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'genConnectStatus': - obj_ = ConnectStatusType.factory() - obj_.build(child_) - self.genConnectStatus = obj_ - obj_.original_tagname_ = 'genConnectStatus' - elif nodeName_ == 'inverterStatus': - obj_ = InverterStatusType.factory() - obj_.build(child_) - self.inverterStatus = obj_ - obj_.original_tagname_ = 'inverterStatus' - elif nodeName_ == 'localControlModeStatus': - obj_ = LocalControlModeStatusType.factory() - obj_.build(child_) - self.localControlModeStatus = obj_ - obj_.original_tagname_ = 'localControlModeStatus' - elif nodeName_ == 'manufacturerStatus': - obj_ = ManufacturerStatusType.factory() - obj_.build(child_) - self.manufacturerStatus = obj_ - obj_.original_tagname_ = 'manufacturerStatus' - elif nodeName_ == 'operationalModeStatus': - obj_ = OperationalModeStatusType.factory() - obj_.build(child_) - self.operationalModeStatus = obj_ - obj_.original_tagname_ = 'operationalModeStatus' - elif nodeName_ == 'readingTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.readingTime = obj_ - obj_.original_tagname_ = 'readingTime' - elif nodeName_ == 'stateOfChargeStatus': - obj_ = StateOfChargeStatusType.factory() - obj_.build(child_) - self.stateOfChargeStatus = obj_ - obj_.original_tagname_ = 'stateOfChargeStatus' - elif nodeName_ == 'storageModeStatus': - obj_ = StorageModeStatusType.factory() - obj_.build(child_) - self.storageModeStatus = obj_ - obj_.original_tagname_ = 'storageModeStatus' - elif nodeName_ == 'storConnectStatus': - obj_ = ConnectStatusType.factory() - obj_.build(child_) - self.storConnectStatus = obj_ - obj_.original_tagname_ = 'storConnectStatus' - super(DERStatus, self).buildChildren(child_, node, nodeName_, True) -# end class DERStatus - - -class DERProgramList(List): - """A List element to hold DERProgram objects.""" - subclass = None - superclass = List - def __init__(self, DERProgram=None): - self.original_tagname_ = None - super(DERProgramList, self).__init__() - if DERProgram is None: - self.DERProgram = [] - else: - self.DERProgram = DERProgram - def factory(*args_, **kwargs_): - if DERProgramList.subclass: - return DERProgramList.subclass(*args_, **kwargs_) - else: - return DERProgramList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DERProgram(self): return self.DERProgram - def set_DERProgram(self, DERProgram): self.DERProgram = DERProgram - def add_DERProgram(self, value): self.DERProgram.append(value) - def insert_DERProgram_at(self, index, value): self.DERProgram.insert(index, value) - def replace_DERProgram_at(self, index, value): self.DERProgram[index] = value - def hasContent_(self): - if ( - self.DERProgram or - super(DERProgramList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERProgramList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgramList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERProgramList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERProgramList'): - super(DERProgramList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgramList') - def exportChildren(self, outfile, level, namespace_='', name_='DERProgramList', fromsubclass_=False, pretty_print=True): - super(DERProgramList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for DERProgram_ in self.DERProgram: - DERProgram_.export(outfile, level, namespace_, name_='DERProgram', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERProgramList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERProgramList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERProgramList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('DERProgram=[\n') - level += 1 - for DERProgram_ in self.DERProgram: - showIndent(outfile, level) - outfile.write('model_.DERProgram(\n') - DERProgram_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERProgramList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DERProgram': - obj_ = DERProgram.factory() - obj_.build(child_) - self.DERProgram.append(obj_) - obj_.original_tagname_ = 'DERProgram' - super(DERProgramList, self).buildChildren(child_, node, nodeName_, True) -# end class DERProgramList - - -class DERProgram(IdentifiedObject): - """Distributed Energy Resource program.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, ActiveDERControlListLink=None, DefaultDERControlLink=None, DERControlListLink=None, DERCurveListLink=None, primacy=None): - self.original_tagname_ = None - super(DERProgram, self).__init__() - self.ActiveDERControlListLink = ActiveDERControlListLink - self.DefaultDERControlLink = DefaultDERControlLink - self.DERControlListLink = DERControlListLink - self.DERCurveListLink = DERCurveListLink - self.primacy = primacy - def factory(*args_, **kwargs_): - if DERProgram.subclass: - return DERProgram.subclass(*args_, **kwargs_) - else: - return DERProgram(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ActiveDERControlListLink(self): return self.ActiveDERControlListLink - def set_ActiveDERControlListLink(self, ActiveDERControlListLink): self.ActiveDERControlListLink = ActiveDERControlListLink - def get_DefaultDERControlLink(self): return self.DefaultDERControlLink - def set_DefaultDERControlLink(self, DefaultDERControlLink): self.DefaultDERControlLink = DefaultDERControlLink - def get_DERControlListLink(self): return self.DERControlListLink - def set_DERControlListLink(self, DERControlListLink): self.DERControlListLink = DERControlListLink - def get_DERCurveListLink(self): return self.DERCurveListLink - def set_DERCurveListLink(self, DERCurveListLink): self.DERCurveListLink = DERCurveListLink - def get_primacy(self): return self.primacy - def set_primacy(self, primacy): self.primacy = primacy - def hasContent_(self): - if ( - self.ActiveDERControlListLink is not None or - self.DefaultDERControlLink is not None or - self.DERControlListLink is not None or - self.DERCurveListLink is not None or - self.primacy is not None or - super(DERProgram, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERProgram', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgram') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERProgram', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERProgram'): - super(DERProgram, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERProgram') - def exportChildren(self, outfile, level, namespace_='', name_='DERProgram', fromsubclass_=False, pretty_print=True): - super(DERProgram, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ActiveDERControlListLink is not None: - self.ActiveDERControlListLink.export(outfile, level, namespace_, name_='ActiveDERControlListLink', pretty_print=pretty_print) - if self.DefaultDERControlLink is not None: - self.DefaultDERControlLink.export(outfile, level, namespace_, name_='DefaultDERControlLink', pretty_print=pretty_print) - if self.DERControlListLink is not None: - self.DERControlListLink.export(outfile, level, namespace_, name_='DERControlListLink', pretty_print=pretty_print) - if self.DERCurveListLink is not None: - self.DERCurveListLink.export(outfile, level, namespace_, name_='DERCurveListLink', pretty_print=pretty_print) - if self.primacy is not None: - self.primacy.export(outfile, level, namespace_, name_='primacy', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERProgram'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERProgram, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERProgram, self).exportLiteralChildren(outfile, level, name_) - if self.ActiveDERControlListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveDERControlListLink=model_.ActiveDERControlListLink(\n') - self.ActiveDERControlListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DefaultDERControlLink is not None: - showIndent(outfile, level) - outfile.write('DefaultDERControlLink=model_.DefaultDERControlLink(\n') - self.DefaultDERControlLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERControlListLink is not None: - showIndent(outfile, level) - outfile.write('DERControlListLink=model_.DERControlListLink(\n') - self.DERControlListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERCurveListLink is not None: - showIndent(outfile, level) - outfile.write('DERCurveListLink=model_.DERCurveListLink(\n') - self.DERCurveListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.primacy is not None: - showIndent(outfile, level) - outfile.write('primacy=model_.PrimacyType(\n') - self.primacy.exportLiteral(outfile, level, name_='primacy') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERProgram, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ActiveDERControlListLink': - obj_ = ActiveDERControlListLink.factory() - obj_.build(child_) - self.ActiveDERControlListLink = obj_ - obj_.original_tagname_ = 'ActiveDERControlListLink' - elif nodeName_ == 'DefaultDERControlLink': - obj_ = DefaultDERControlLink.factory() - obj_.build(child_) - self.DefaultDERControlLink = obj_ - obj_.original_tagname_ = 'DefaultDERControlLink' - elif nodeName_ == 'DERControlListLink': - obj_ = DERControlListLink.factory() - obj_.build(child_) - self.DERControlListLink = obj_ - obj_.original_tagname_ = 'DERControlListLink' - elif nodeName_ == 'DERCurveListLink': - obj_ = DERCurveListLink.factory() - obj_.build(child_) - self.DERCurveListLink = obj_ - obj_.original_tagname_ = 'DERCurveListLink' - elif nodeName_ == 'primacy': - obj_ = PrimacyType.factory() - obj_.build(child_) - self.primacy = obj_ - obj_.original_tagname_ = 'primacy' - super(DERProgram, self).buildChildren(child_, node, nodeName_, True) -# end class DERProgram - - -class DERCurveList(List): - """A List element to hold DERCurve objects.""" - subclass = None - superclass = List - def __init__(self, DERCurve=None): - self.original_tagname_ = None - super(DERCurveList, self).__init__() - if DERCurve is None: - self.DERCurve = [] - else: - self.DERCurve = DERCurve - def factory(*args_, **kwargs_): - if DERCurveList.subclass: - return DERCurveList.subclass(*args_, **kwargs_) - else: - return DERCurveList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DERCurve(self): return self.DERCurve - def set_DERCurve(self, DERCurve): self.DERCurve = DERCurve - def add_DERCurve(self, value): self.DERCurve.append(value) - def insert_DERCurve_at(self, index, value): self.DERCurve.insert(index, value) - def replace_DERCurve_at(self, index, value): self.DERCurve[index] = value - def hasContent_(self): - if ( - self.DERCurve or - super(DERCurveList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCurveList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCurveList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCurveList'): - super(DERCurveList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurveList') - def exportChildren(self, outfile, level, namespace_='', name_='DERCurveList', fromsubclass_=False, pretty_print=True): - super(DERCurveList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for DERCurve_ in self.DERCurve: - DERCurve_.export(outfile, level, namespace_, name_='DERCurve', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERCurveList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERCurveList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERCurveList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('DERCurve=[\n') - level += 1 - for DERCurve_ in self.DERCurve: - showIndent(outfile, level) - outfile.write('model_.DERCurve(\n') - DERCurve_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERCurveList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DERCurve': - obj_ = DERCurve.factory() - obj_.build(child_) - self.DERCurve.append(obj_) - obj_.original_tagname_ = 'DERCurve' - super(DERCurveList, self).buildChildren(child_, node, nodeName_, True) -# end class DERCurveList - - -class CurrentDERProgramLink(Link): - """SHALL contain a Link to an instance of DERProgram. If present, this - is the DERProgram containing the currently active DERControl.""" - subclass = None - superclass = Link - def __init__(self): - self.original_tagname_ = None - super(CurrentDERProgramLink, self).__init__() - def factory(*args_, **kwargs_): - if CurrentDERProgramLink.subclass: - return CurrentDERProgramLink.subclass(*args_, **kwargs_) - else: - return CurrentDERProgramLink(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(CurrentDERProgramLink, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CurrentDERProgramLink', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CurrentDERProgramLink') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CurrentDERProgramLink', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CurrentDERProgramLink'): - super(CurrentDERProgramLink, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CurrentDERProgramLink') - def exportChildren(self, outfile, level, namespace_='', name_='CurrentDERProgramLink', fromsubclass_=False, pretty_print=True): - super(CurrentDERProgramLink, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='CurrentDERProgramLink'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CurrentDERProgramLink, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CurrentDERProgramLink, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CurrentDERProgramLink, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(CurrentDERProgramLink, self).buildChildren(child_, node, nodeName_, True) - pass -# end class CurrentDERProgramLink - - -class DERCurve(IdentifiedObject): - """DER related curves such as Volt-VAr mode curves. Relationship - between an independent variable (X-axis) and one or two - dependent variables (Y-axis and excitation).""" - subclass = None - superclass = IdentifiedObject - def __init__(self, creationTime=None, CurveData=None, curveType=None, rampDecTms=None, rampIncTms=None, rampPT1Tms=None, xMultiplier=None, yMultiplier=None, yRefType=None): - self.original_tagname_ = None - super(DERCurve, self).__init__() - self.creationTime = creationTime - if CurveData is None: - self.CurveData = [] - else: - self.CurveData = CurveData - self.curveType = curveType - self.rampDecTms = rampDecTms - self.rampIncTms = rampIncTms - self.rampPT1Tms = rampPT1Tms - self.xMultiplier = xMultiplier - self.yMultiplier = yMultiplier - self.yRefType = yRefType - def factory(*args_, **kwargs_): - if DERCurve.subclass: - return DERCurve.subclass(*args_, **kwargs_) - else: - return DERCurve(*args_, **kwargs_) - factory = staticmethod(factory) - def get_creationTime(self): return self.creationTime - def set_creationTime(self, creationTime): self.creationTime = creationTime - def get_CurveData(self): return self.CurveData - def set_CurveData(self, CurveData): self.CurveData = CurveData - def add_CurveData(self, value): self.CurveData.append(value) - def insert_CurveData_at(self, index, value): self.CurveData.insert(index, value) - def replace_CurveData_at(self, index, value): self.CurveData[index] = value - def get_curveType(self): return self.curveType - def set_curveType(self, curveType): self.curveType = curveType - def get_rampDecTms(self): return self.rampDecTms - def set_rampDecTms(self, rampDecTms): self.rampDecTms = rampDecTms - def get_rampIncTms(self): return self.rampIncTms - def set_rampIncTms(self, rampIncTms): self.rampIncTms = rampIncTms - def get_rampPT1Tms(self): return self.rampPT1Tms - def set_rampPT1Tms(self, rampPT1Tms): self.rampPT1Tms = rampPT1Tms - def get_xMultiplier(self): return self.xMultiplier - def set_xMultiplier(self, xMultiplier): self.xMultiplier = xMultiplier - def get_yMultiplier(self): return self.yMultiplier - def set_yMultiplier(self, yMultiplier): self.yMultiplier = yMultiplier - def get_yRefType(self): return self.yRefType - def set_yRefType(self, yRefType): self.yRefType = yRefType - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.creationTime is not None or - self.CurveData or - self.curveType is not None or - self.rampDecTms is not None or - self.rampIncTms is not None or - self.rampPT1Tms is not None or - self.xMultiplier is not None or - self.yMultiplier is not None or - self.yRefType is not None or - super(DERCurve, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCurve', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurve') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCurve', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCurve'): - super(DERCurve, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERCurve') - def exportChildren(self, outfile, level, namespace_='', name_='DERCurve', fromsubclass_=False, pretty_print=True): - super(DERCurve, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.creationTime is not None: - self.creationTime.export(outfile, level, namespace_, name_='creationTime', pretty_print=pretty_print) - for CurveData_ in self.CurveData: - CurveData_.export(outfile, level, namespace_, name_='CurveData', pretty_print=pretty_print) - if self.curveType is not None: - self.curveType.export(outfile, level, namespace_, name_='curveType', pretty_print=pretty_print) - if self.rampDecTms is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srampDecTms>%s%s' % (namespace_, self.gds_format_integer(self.rampDecTms, input_name='rampDecTms'), namespace_, eol_)) - if self.rampIncTms is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srampIncTms>%s%s' % (namespace_, self.gds_format_integer(self.rampIncTms, input_name='rampIncTms'), namespace_, eol_)) - if self.rampPT1Tms is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srampPT1Tms>%s%s' % (namespace_, self.gds_format_integer(self.rampPT1Tms, input_name='rampPT1Tms'), namespace_, eol_)) - if self.xMultiplier is not None: - self.xMultiplier.export(outfile, level, namespace_, name_='xMultiplier', pretty_print=pretty_print) - if self.yMultiplier is not None: - self.yMultiplier.export(outfile, level, namespace_, name_='yMultiplier', pretty_print=pretty_print) - if self.yRefType is not None: - self.yRefType.export(outfile, level, namespace_, name_='yRefType', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERCurve'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERCurve, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERCurve, self).exportLiteralChildren(outfile, level, name_) - if self.creationTime is not None: - showIndent(outfile, level) - outfile.write('creationTime=model_.TimeType(\n') - self.creationTime.exportLiteral(outfile, level, name_='creationTime') - showIndent(outfile, level) - outfile.write('),\n') - showIndent(outfile, level) - outfile.write('CurveData=[\n') - level += 1 - for CurveData_ in self.CurveData: - showIndent(outfile, level) - outfile.write('model_.CurveData(\n') - CurveData_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - if self.curveType is not None: - showIndent(outfile, level) - outfile.write('curveType=model_.DERCurveType(\n') - self.curveType.exportLiteral(outfile, level, name_='curveType') - showIndent(outfile, level) - outfile.write('),\n') - if self.rampDecTms is not None: - showIndent(outfile, level) - outfile.write('rampDecTms=%d,\n' % self.rampDecTms) - if self.rampIncTms is not None: - showIndent(outfile, level) - outfile.write('rampIncTms=%d,\n' % self.rampIncTms) - if self.rampPT1Tms is not None: - showIndent(outfile, level) - outfile.write('rampPT1Tms=%d,\n' % self.rampPT1Tms) - if self.xMultiplier is not None: - showIndent(outfile, level) - outfile.write('xMultiplier=model_.PowerOfTenMultiplierType(\n') - self.xMultiplier.exportLiteral(outfile, level, name_='xMultiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.yMultiplier is not None: - showIndent(outfile, level) - outfile.write('yMultiplier=model_.PowerOfTenMultiplierType(\n') - self.yMultiplier.exportLiteral(outfile, level, name_='yMultiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.yRefType is not None: - showIndent(outfile, level) - outfile.write('yRefType=model_.DERUnitRefType(\n') - self.yRefType.exportLiteral(outfile, level, name_='yRefType') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERCurve, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'creationTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.creationTime = obj_ - obj_.original_tagname_ = 'creationTime' - elif nodeName_ == 'CurveData': - obj_ = CurveData.factory() - obj_.build(child_) - self.CurveData.append(obj_) - obj_.original_tagname_ = 'CurveData' - elif nodeName_ == 'curveType': - obj_ = DERCurveType.factory() - obj_.build(child_) - self.curveType = obj_ - obj_.original_tagname_ = 'curveType' - elif nodeName_ == 'rampDecTms': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'rampDecTms') - self.rampDecTms = ival_ - self.validate_UInt16(self.rampDecTms) # validate type UInt16 - elif nodeName_ == 'rampIncTms': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'rampIncTms') - self.rampIncTms = ival_ - self.validate_UInt16(self.rampIncTms) # validate type UInt16 - elif nodeName_ == 'rampPT1Tms': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'rampPT1Tms') - self.rampPT1Tms = ival_ - self.validate_UInt16(self.rampPT1Tms) # validate type UInt16 - elif nodeName_ == 'xMultiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.xMultiplier = obj_ - obj_.original_tagname_ = 'xMultiplier' - elif nodeName_ == 'yMultiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.yMultiplier = obj_ - obj_.original_tagname_ = 'yMultiplier' - elif nodeName_ == 'yRefType': - obj_ = DERUnitRefType.factory() - obj_.build(child_) - self.yRefType = obj_ - obj_.original_tagname_ = 'yRefType' - super(DERCurve, self).buildChildren(child_, node, nodeName_, True) -# end class DERCurve - - -class DERControlList(SubscribableList): - """A List element to hold DERControl objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, DERControl=None): - self.original_tagname_ = None - super(DERControlList, self).__init__() - if DERControl is None: - self.DERControl = [] - else: - self.DERControl = DERControl - def factory(*args_, **kwargs_): - if DERControlList.subclass: - return DERControlList.subclass(*args_, **kwargs_) - else: - return DERControlList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DERControl(self): return self.DERControl - def set_DERControl(self, DERControl): self.DERControl = DERControl - def add_DERControl(self, value): self.DERControl.append(value) - def insert_DERControl_at(self, index, value): self.DERControl.insert(index, value) - def replace_DERControl_at(self, index, value): self.DERControl[index] = value - def hasContent_(self): - if ( - self.DERControl or - super(DERControlList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERControlList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERControlList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERControlList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERControlList'): - super(DERControlList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERControlList') - def exportChildren(self, outfile, level, namespace_='', name_='DERControlList', fromsubclass_=False, pretty_print=True): - super(DERControlList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for DERControl_ in self.DERControl: - DERControl_.export(outfile, level, namespace_, name_='DERControl', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERControlList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERControlList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERControlList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('DERControl=[\n') - level += 1 - for DERControl_ in self.DERControl: - showIndent(outfile, level) - outfile.write('model_.DERControl(\n') - DERControl_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERControlList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DERControl': - obj_ = DERControl.factory() - obj_.build(child_) - self.DERControl.append(obj_) - obj_.original_tagname_ = 'DERControl' - super(DERControlList, self).buildChildren(child_, node, nodeName_, True) -# end class DERControlList - - -class DERControl(RandomizableEvent): - """Distributed Energy Resource (DER) time/event-based control.""" - subclass = None - superclass = RandomizableEvent - def __init__(self, DERControlBase=None): - self.original_tagname_ = None - super(DERControl, self).__init__() - self.DERControlBase = DERControlBase - def factory(*args_, **kwargs_): - if DERControl.subclass: - return DERControl.subclass(*args_, **kwargs_) - else: - return DERControl(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DERControlBase(self): return self.DERControlBase - def set_DERControlBase(self, DERControlBase): self.DERControlBase = DERControlBase - def hasContent_(self): - if ( - self.DERControlBase is not None or - super(DERControl, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERControl', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERControl') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERControl', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERControl'): - super(DERControl, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERControl') - def exportChildren(self, outfile, level, namespace_='', name_='DERControl', fromsubclass_=False, pretty_print=True): - super(DERControl, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.DERControlBase is not None: - self.DERControlBase.export(outfile, level, namespace_, name_='DERControlBase', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERControl'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERControl, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERControl, self).exportLiteralChildren(outfile, level, name_) - if self.DERControlBase is not None: - showIndent(outfile, level) - outfile.write('DERControlBase=model_.DERControlBase(\n') - self.DERControlBase.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERControl, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DERControlBase': - obj_ = DERControlBase.factory() - obj_.build(child_) - self.DERControlBase = obj_ - obj_.original_tagname_ = 'DERControlBase' - super(DERControl, self).buildChildren(child_, node, nodeName_, True) -# end class DERControl - - -class DERCapability(Resource): - """Distributed energy resource type and nameplate ratings.""" - subclass = None - superclass = Resource - def __init__(self, modesSupported=None, rtgA=None, rtgAh=None, rtgMaxChargeRate=None, rtgMaxDischargeRate=None, rtgMinPF=None, rtgMinPFNeg=None, rtgVA=None, rtgVAr=None, rtgVArNeg=None, rtgW=None, rtgWh=None, type_=None): - self.original_tagname_ = None - super(DERCapability, self).__init__() - self.modesSupported = modesSupported - self.rtgA = rtgA - self.rtgAh = rtgAh - self.rtgMaxChargeRate = rtgMaxChargeRate - self.rtgMaxDischargeRate = rtgMaxDischargeRate - self.rtgMinPF = rtgMinPF - self.rtgMinPFNeg = rtgMinPFNeg - self.rtgVA = rtgVA - self.rtgVAr = rtgVAr - self.rtgVArNeg = rtgVArNeg - self.rtgW = rtgW - self.rtgWh = rtgWh - self.type_ = type_ - def factory(*args_, **kwargs_): - if DERCapability.subclass: - return DERCapability.subclass(*args_, **kwargs_) - else: - return DERCapability(*args_, **kwargs_) - factory = staticmethod(factory) - def get_modesSupported(self): return self.modesSupported - def set_modesSupported(self, modesSupported): self.modesSupported = modesSupported - def get_rtgA(self): return self.rtgA - def set_rtgA(self, rtgA): self.rtgA = rtgA - def get_rtgAh(self): return self.rtgAh - def set_rtgAh(self, rtgAh): self.rtgAh = rtgAh - def get_rtgMaxChargeRate(self): return self.rtgMaxChargeRate - def set_rtgMaxChargeRate(self, rtgMaxChargeRate): self.rtgMaxChargeRate = rtgMaxChargeRate - def get_rtgMaxDischargeRate(self): return self.rtgMaxDischargeRate - def set_rtgMaxDischargeRate(self, rtgMaxDischargeRate): self.rtgMaxDischargeRate = rtgMaxDischargeRate - def get_rtgMinPF(self): return self.rtgMinPF - def set_rtgMinPF(self, rtgMinPF): self.rtgMinPF = rtgMinPF - def get_rtgMinPFNeg(self): return self.rtgMinPFNeg - def set_rtgMinPFNeg(self, rtgMinPFNeg): self.rtgMinPFNeg = rtgMinPFNeg - def get_rtgVA(self): return self.rtgVA - def set_rtgVA(self, rtgVA): self.rtgVA = rtgVA - def get_rtgVAr(self): return self.rtgVAr - def set_rtgVAr(self, rtgVAr): self.rtgVAr = rtgVAr - def get_rtgVArNeg(self): return self.rtgVArNeg - def set_rtgVArNeg(self, rtgVArNeg): self.rtgVArNeg = rtgVArNeg - def get_rtgW(self): return self.rtgW - def set_rtgW(self, rtgW): self.rtgW = rtgW - def get_rtgWh(self): return self.rtgWh - def set_rtgWh(self, rtgWh): self.rtgWh = rtgWh - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def hasContent_(self): - if ( - self.modesSupported is not None or - self.rtgA is not None or - self.rtgAh is not None or - self.rtgMaxChargeRate is not None or - self.rtgMaxDischargeRate is not None or - self.rtgMinPF is not None or - self.rtgMinPFNeg is not None or - self.rtgVA is not None or - self.rtgVAr is not None or - self.rtgVArNeg is not None or - self.rtgW is not None or - self.rtgWh is not None or - self.type_ is not None or - super(DERCapability, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERCapability', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERCapability') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERCapability', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERCapability'): - super(DERCapability, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERCapability') - def exportChildren(self, outfile, level, namespace_='', name_='DERCapability', fromsubclass_=False, pretty_print=True): - super(DERCapability, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.modesSupported is not None: - self.modesSupported.export(outfile, level, namespace_, name_='modesSupported', pretty_print=pretty_print) - if self.rtgA is not None: - self.rtgA.export(outfile, level, namespace_, name_='rtgA', pretty_print=pretty_print) - if self.rtgAh is not None: - self.rtgAh.export(outfile, level, namespace_, name_='rtgAh', pretty_print=pretty_print) - if self.rtgMaxChargeRate is not None: - self.rtgMaxChargeRate.export(outfile, level, namespace_, name_='rtgMaxChargeRate', pretty_print=pretty_print) - if self.rtgMaxDischargeRate is not None: - self.rtgMaxDischargeRate.export(outfile, level, namespace_, name_='rtgMaxDischargeRate', pretty_print=pretty_print) - if self.rtgMinPF is not None: - self.rtgMinPF.export(outfile, level, namespace_, name_='rtgMinPF', pretty_print=pretty_print) - if self.rtgMinPFNeg is not None: - self.rtgMinPFNeg.export(outfile, level, namespace_, name_='rtgMinPFNeg', pretty_print=pretty_print) - if self.rtgVA is not None: - self.rtgVA.export(outfile, level, namespace_, name_='rtgVA', pretty_print=pretty_print) - if self.rtgVAr is not None: - self.rtgVAr.export(outfile, level, namespace_, name_='rtgVAr', pretty_print=pretty_print) - if self.rtgVArNeg is not None: - self.rtgVArNeg.export(outfile, level, namespace_, name_='rtgVArNeg', pretty_print=pretty_print) - if self.rtgW is not None: - self.rtgW.export(outfile, level, namespace_, name_='rtgW', pretty_print=pretty_print) - if self.rtgWh is not None: - self.rtgWh.export(outfile, level, namespace_, name_='rtgWh', pretty_print=pretty_print) - if self.type_ is not None: - self.type_.export(outfile, level, namespace_, name_='type', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERCapability'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERCapability, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERCapability, self).exportLiteralChildren(outfile, level, name_) - if self.modesSupported is not None: - showIndent(outfile, level) - outfile.write('modesSupported=model_.DERControlType(\n') - self.modesSupported.exportLiteral(outfile, level, name_='modesSupported') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgA is not None: - showIndent(outfile, level) - outfile.write('rtgA=model_.CurrentRMS(\n') - self.rtgA.exportLiteral(outfile, level, name_='rtgA') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgAh is not None: - showIndent(outfile, level) - outfile.write('rtgAh=model_.AmpereHour(\n') - self.rtgAh.exportLiteral(outfile, level, name_='rtgAh') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgMaxChargeRate is not None: - showIndent(outfile, level) - outfile.write('rtgMaxChargeRate=model_.ActivePower(\n') - self.rtgMaxChargeRate.exportLiteral(outfile, level, name_='rtgMaxChargeRate') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgMaxDischargeRate is not None: - showIndent(outfile, level) - outfile.write('rtgMaxDischargeRate=model_.ActivePower(\n') - self.rtgMaxDischargeRate.exportLiteral(outfile, level, name_='rtgMaxDischargeRate') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgMinPF is not None: - showIndent(outfile, level) - outfile.write('rtgMinPF=model_.UnsignedFixedPointType(\n') - self.rtgMinPF.exportLiteral(outfile, level, name_='rtgMinPF') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgMinPFNeg is not None: - showIndent(outfile, level) - outfile.write('rtgMinPFNeg=model_.FixedPointType(\n') - self.rtgMinPFNeg.exportLiteral(outfile, level, name_='rtgMinPFNeg') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgVA is not None: - showIndent(outfile, level) - outfile.write('rtgVA=model_.ApparentPower(\n') - self.rtgVA.exportLiteral(outfile, level, name_='rtgVA') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgVAr is not None: - showIndent(outfile, level) - outfile.write('rtgVAr=model_.ReactivePower(\n') - self.rtgVAr.exportLiteral(outfile, level, name_='rtgVAr') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgVArNeg is not None: - showIndent(outfile, level) - outfile.write('rtgVArNeg=model_.ReactivePower(\n') - self.rtgVArNeg.exportLiteral(outfile, level, name_='rtgVArNeg') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgW is not None: - showIndent(outfile, level) - outfile.write('rtgW=model_.ActivePower(\n') - self.rtgW.exportLiteral(outfile, level, name_='rtgW') - showIndent(outfile, level) - outfile.write('),\n') - if self.rtgWh is not None: - showIndent(outfile, level) - outfile.write('rtgWh=model_.WattHour(\n') - self.rtgWh.exportLiteral(outfile, level, name_='rtgWh') - showIndent(outfile, level) - outfile.write('),\n') - if self.type_ is not None: - showIndent(outfile, level) - outfile.write('type_=model_.DERType(\n') - self.type_.exportLiteral(outfile, level, name_='type') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERCapability, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'modesSupported': - obj_ = DERControlType.factory() - obj_.build(child_) - self.modesSupported = obj_ - obj_.original_tagname_ = 'modesSupported' - elif nodeName_ == 'rtgA': - obj_ = CurrentRMS.factory() - obj_.build(child_) - self.rtgA = obj_ - obj_.original_tagname_ = 'rtgA' - elif nodeName_ == 'rtgAh': - obj_ = AmpereHour.factory() - obj_.build(child_) - self.rtgAh = obj_ - obj_.original_tagname_ = 'rtgAh' - elif nodeName_ == 'rtgMaxChargeRate': - obj_ = ActivePower.factory() - obj_.build(child_) - self.rtgMaxChargeRate = obj_ - obj_.original_tagname_ = 'rtgMaxChargeRate' - elif nodeName_ == 'rtgMaxDischargeRate': - obj_ = ActivePower.factory() - obj_.build(child_) - self.rtgMaxDischargeRate = obj_ - obj_.original_tagname_ = 'rtgMaxDischargeRate' - elif nodeName_ == 'rtgMinPF': - obj_ = UnsignedFixedPointType.factory() - obj_.build(child_) - self.rtgMinPF = obj_ - obj_.original_tagname_ = 'rtgMinPF' - elif nodeName_ == 'rtgMinPFNeg': - obj_ = FixedPointType.factory() - obj_.build(child_) - self.rtgMinPFNeg = obj_ - obj_.original_tagname_ = 'rtgMinPFNeg' - elif nodeName_ == 'rtgVA': - obj_ = ApparentPower.factory() - obj_.build(child_) - self.rtgVA = obj_ - obj_.original_tagname_ = 'rtgVA' - elif nodeName_ == 'rtgVAr': - obj_ = ReactivePower.factory() - obj_.build(child_) - self.rtgVAr = obj_ - obj_.original_tagname_ = 'rtgVAr' - elif nodeName_ == 'rtgVArNeg': - obj_ = ReactivePower.factory() - obj_.build(child_) - self.rtgVArNeg = obj_ - obj_.original_tagname_ = 'rtgVArNeg' - elif nodeName_ == 'rtgW': - obj_ = ActivePower.factory() - obj_.build(child_) - self.rtgW = obj_ - obj_.original_tagname_ = 'rtgW' - elif nodeName_ == 'rtgWh': - obj_ = WattHour.factory() - obj_.build(child_) - self.rtgWh = obj_ - obj_.original_tagname_ = 'rtgWh' - elif nodeName_ == 'type': - obj_ = DERType.factory() - obj_.build(child_) - self.type_ = obj_ - obj_.original_tagname_ = 'type' - super(DERCapability, self).buildChildren(child_, node, nodeName_, True) -# end class DERCapability - - -class DERAvailability(SubscribableResource): - """Indicates current reserve generation status""" - subclass = None - superclass = SubscribableResource - def __init__(self, availabilityDuration=None, maxChargeDuration=None, readingTime=None, reserveChargePercent=None, reservePercent=None, statVArAvail=None, statWAvail=None): - self.original_tagname_ = None - super(DERAvailability, self).__init__() - self.availabilityDuration = availabilityDuration - self.maxChargeDuration = maxChargeDuration - self.readingTime = readingTime - self.reserveChargePercent = reserveChargePercent - self.reservePercent = reservePercent - self.statVArAvail = statVArAvail - self.statWAvail = statWAvail - def factory(*args_, **kwargs_): - if DERAvailability.subclass: - return DERAvailability.subclass(*args_, **kwargs_) - else: - return DERAvailability(*args_, **kwargs_) - factory = staticmethod(factory) - def get_availabilityDuration(self): return self.availabilityDuration - def set_availabilityDuration(self, availabilityDuration): self.availabilityDuration = availabilityDuration - def get_maxChargeDuration(self): return self.maxChargeDuration - def set_maxChargeDuration(self, maxChargeDuration): self.maxChargeDuration = maxChargeDuration - def get_readingTime(self): return self.readingTime - def set_readingTime(self, readingTime): self.readingTime = readingTime - def get_reserveChargePercent(self): return self.reserveChargePercent - def set_reserveChargePercent(self, reserveChargePercent): self.reserveChargePercent = reserveChargePercent - def get_reservePercent(self): return self.reservePercent - def set_reservePercent(self, reservePercent): self.reservePercent = reservePercent - def get_statVArAvail(self): return self.statVArAvail - def set_statVArAvail(self, statVArAvail): self.statVArAvail = statVArAvail - def get_statWAvail(self): return self.statWAvail - def set_statWAvail(self, statWAvail): self.statWAvail = statWAvail - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.availabilityDuration is not None or - self.maxChargeDuration is not None or - self.readingTime is not None or - self.reserveChargePercent is not None or - self.reservePercent is not None or - self.statVArAvail is not None or - self.statWAvail is not None or - super(DERAvailability, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERAvailability', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERAvailability') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERAvailability', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERAvailability'): - super(DERAvailability, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERAvailability') - def exportChildren(self, outfile, level, namespace_='', name_='DERAvailability', fromsubclass_=False, pretty_print=True): - super(DERAvailability, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.availabilityDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%savailabilityDuration>%s%s' % (namespace_, self.gds_format_integer(self.availabilityDuration, input_name='availabilityDuration'), namespace_, eol_)) - if self.maxChargeDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smaxChargeDuration>%s%s' % (namespace_, self.gds_format_integer(self.maxChargeDuration, input_name='maxChargeDuration'), namespace_, eol_)) - if self.readingTime is not None: - self.readingTime.export(outfile, level, namespace_, name_='readingTime', pretty_print=pretty_print) - if self.reserveChargePercent is not None: - self.reserveChargePercent.export(outfile, level, namespace_, name_='reserveChargePercent', pretty_print=pretty_print) - if self.reservePercent is not None: - self.reservePercent.export(outfile, level, namespace_, name_='reservePercent', pretty_print=pretty_print) - if self.statVArAvail is not None: - self.statVArAvail.export(outfile, level, namespace_, name_='statVArAvail', pretty_print=pretty_print) - if self.statWAvail is not None: - self.statWAvail.export(outfile, level, namespace_, name_='statWAvail', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERAvailability'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERAvailability, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERAvailability, self).exportLiteralChildren(outfile, level, name_) - if self.availabilityDuration is not None: - showIndent(outfile, level) - outfile.write('availabilityDuration=%d,\n' % self.availabilityDuration) - if self.maxChargeDuration is not None: - showIndent(outfile, level) - outfile.write('maxChargeDuration=%d,\n' % self.maxChargeDuration) - if self.readingTime is not None: - showIndent(outfile, level) - outfile.write('readingTime=model_.TimeType(\n') - self.readingTime.exportLiteral(outfile, level, name_='readingTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.reserveChargePercent is not None: - showIndent(outfile, level) - outfile.write('reserveChargePercent=model_.PerCent(\n') - self.reserveChargePercent.exportLiteral(outfile, level, name_='reserveChargePercent') - showIndent(outfile, level) - outfile.write('),\n') - if self.reservePercent is not None: - showIndent(outfile, level) - outfile.write('reservePercent=model_.PerCent(\n') - self.reservePercent.exportLiteral(outfile, level, name_='reservePercent') - showIndent(outfile, level) - outfile.write('),\n') - if self.statVArAvail is not None: - showIndent(outfile, level) - outfile.write('statVArAvail=model_.ReactivePower(\n') - self.statVArAvail.exportLiteral(outfile, level, name_='statVArAvail') - showIndent(outfile, level) - outfile.write('),\n') - if self.statWAvail is not None: - showIndent(outfile, level) - outfile.write('statWAvail=model_.ActivePower(\n') - self.statWAvail.exportLiteral(outfile, level, name_='statWAvail') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERAvailability, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'availabilityDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'availabilityDuration') - self.availabilityDuration = ival_ - self.validate_UInt32(self.availabilityDuration) # validate type UInt32 - elif nodeName_ == 'maxChargeDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'maxChargeDuration') - self.maxChargeDuration = ival_ - self.validate_UInt32(self.maxChargeDuration) # validate type UInt32 - elif nodeName_ == 'readingTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.readingTime = obj_ - obj_.original_tagname_ = 'readingTime' - elif nodeName_ == 'reserveChargePercent': - obj_ = PerCent.factory() - obj_.build(child_) - self.reserveChargePercent = obj_ - obj_.original_tagname_ = 'reserveChargePercent' - elif nodeName_ == 'reservePercent': - obj_ = PerCent.factory() - obj_.build(child_) - self.reservePercent = obj_ - obj_.original_tagname_ = 'reservePercent' - elif nodeName_ == 'statVArAvail': - obj_ = ReactivePower.factory() - obj_.build(child_) - self.statVArAvail = obj_ - obj_.original_tagname_ = 'statVArAvail' - elif nodeName_ == 'statWAvail': - obj_ = ActivePower.factory() - obj_.build(child_) - self.statWAvail = obj_ - obj_.original_tagname_ = 'statWAvail' - super(DERAvailability, self).buildChildren(child_, node, nodeName_, True) -# end class DERAvailability - - -class DERSettings(SubscribableResource): - """Distributed energy resource settings""" - subclass = None - superclass = SubscribableResource - def __init__(self, setGenConnect=None, setGradW=None, setMaxChargeRate=None, setMaxDischargeRate=None, setMaxVA=None, setMaxVAr=None, setMaxVArNeg=None, setMaxW=None, setMinPF=None, setMinPFNeg=None, setStorConnect=None, setVRef=None, setVRefOfs=None, updatedTime=None): - self.original_tagname_ = None - super(DERSettings, self).__init__() - self.setGenConnect = setGenConnect - self.setGradW = setGradW - self.setMaxChargeRate = setMaxChargeRate - self.setMaxDischargeRate = setMaxDischargeRate - self.setMaxVA = setMaxVA - self.setMaxVAr = setMaxVAr - self.setMaxVArNeg = setMaxVArNeg - self.setMaxW = setMaxW - self.setMinPF = setMinPF - self.setMinPFNeg = setMinPFNeg - self.setStorConnect = setStorConnect - self.setVRef = setVRef - self.setVRefOfs = setVRefOfs - self.updatedTime = updatedTime - def factory(*args_, **kwargs_): - if DERSettings.subclass: - return DERSettings.subclass(*args_, **kwargs_) - else: - return DERSettings(*args_, **kwargs_) - factory = staticmethod(factory) - def get_setGenConnect(self): return self.setGenConnect - def set_setGenConnect(self, setGenConnect): self.setGenConnect = setGenConnect - def get_setGradW(self): return self.setGradW - def set_setGradW(self, setGradW): self.setGradW = setGradW - def get_setMaxChargeRate(self): return self.setMaxChargeRate - def set_setMaxChargeRate(self, setMaxChargeRate): self.setMaxChargeRate = setMaxChargeRate - def get_setMaxDischargeRate(self): return self.setMaxDischargeRate - def set_setMaxDischargeRate(self, setMaxDischargeRate): self.setMaxDischargeRate = setMaxDischargeRate - def get_setMaxVA(self): return self.setMaxVA - def set_setMaxVA(self, setMaxVA): self.setMaxVA = setMaxVA - def get_setMaxVAr(self): return self.setMaxVAr - def set_setMaxVAr(self, setMaxVAr): self.setMaxVAr = setMaxVAr - def get_setMaxVArNeg(self): return self.setMaxVArNeg - def set_setMaxVArNeg(self, setMaxVArNeg): self.setMaxVArNeg = setMaxVArNeg - def get_setMaxW(self): return self.setMaxW - def set_setMaxW(self, setMaxW): self.setMaxW = setMaxW - def get_setMinPF(self): return self.setMinPF - def set_setMinPF(self, setMinPF): self.setMinPF = setMinPF - def get_setMinPFNeg(self): return self.setMinPFNeg - def set_setMinPFNeg(self, setMinPFNeg): self.setMinPFNeg = setMinPFNeg - def get_setStorConnect(self): return self.setStorConnect - def set_setStorConnect(self, setStorConnect): self.setStorConnect = setStorConnect - def get_setVRef(self): return self.setVRef - def set_setVRef(self, setVRef): self.setVRef = setVRef - def get_setVRefOfs(self): return self.setVRefOfs - def set_setVRefOfs(self, setVRefOfs): self.setVRefOfs = setVRefOfs - def get_updatedTime(self): return self.updatedTime - def set_updatedTime(self, updatedTime): self.updatedTime = updatedTime - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.setGenConnect is not None or - self.setGradW is not None or - self.setMaxChargeRate is not None or - self.setMaxDischargeRate is not None or - self.setMaxVA is not None or - self.setMaxVAr is not None or - self.setMaxVArNeg is not None or - self.setMaxW is not None or - self.setMinPF is not None or - self.setMinPFNeg is not None or - self.setStorConnect is not None or - self.setVRef is not None or - self.setVRefOfs is not None or - self.updatedTime is not None or - super(DERSettings, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERSettings', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERSettings') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERSettings', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERSettings'): - super(DERSettings, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERSettings') - def exportChildren(self, outfile, level, namespace_='', name_='DERSettings', fromsubclass_=False, pretty_print=True): - super(DERSettings, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.setGenConnect is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssetGenConnect>%s%s' % (namespace_, self.gds_format_boolean(self.setGenConnect, input_name='setGenConnect'), namespace_, eol_)) - if self.setGradW is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssetGradW>%s%s' % (namespace_, self.gds_format_integer(self.setGradW, input_name='setGradW'), namespace_, eol_)) - if self.setMaxChargeRate is not None: - self.setMaxChargeRate.export(outfile, level, namespace_, name_='setMaxChargeRate', pretty_print=pretty_print) - if self.setMaxDischargeRate is not None: - self.setMaxDischargeRate.export(outfile, level, namespace_, name_='setMaxDischargeRate', pretty_print=pretty_print) - if self.setMaxVA is not None: - self.setMaxVA.export(outfile, level, namespace_, name_='setMaxVA', pretty_print=pretty_print) - if self.setMaxVAr is not None: - self.setMaxVAr.export(outfile, level, namespace_, name_='setMaxVAr', pretty_print=pretty_print) - if self.setMaxVArNeg is not None: - self.setMaxVArNeg.export(outfile, level, namespace_, name_='setMaxVArNeg', pretty_print=pretty_print) - if self.setMaxW is not None: - self.setMaxW.export(outfile, level, namespace_, name_='setMaxW', pretty_print=pretty_print) - if self.setMinPF is not None: - self.setMinPF.export(outfile, level, namespace_, name_='setMinPF', pretty_print=pretty_print) - if self.setMinPFNeg is not None: - self.setMinPFNeg.export(outfile, level, namespace_, name_='setMinPFNeg', pretty_print=pretty_print) - if self.setStorConnect is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssetStorConnect>%s%s' % (namespace_, self.gds_format_boolean(self.setStorConnect, input_name='setStorConnect'), namespace_, eol_)) - if self.setVRef is not None: - self.setVRef.export(outfile, level, namespace_, name_='setVRef', pretty_print=pretty_print) - if self.setVRefOfs is not None: - self.setVRefOfs.export(outfile, level, namespace_, name_='setVRefOfs', pretty_print=pretty_print) - if self.updatedTime is not None: - self.updatedTime.export(outfile, level, namespace_, name_='updatedTime', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERSettings'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERSettings, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERSettings, self).exportLiteralChildren(outfile, level, name_) - if self.setGenConnect is not None: - showIndent(outfile, level) - outfile.write('setGenConnect=%s,\n' % self.setGenConnect) - if self.setGradW is not None: - showIndent(outfile, level) - outfile.write('setGradW=%d,\n' % self.setGradW) - if self.setMaxChargeRate is not None: - showIndent(outfile, level) - outfile.write('setMaxChargeRate=model_.ActivePower(\n') - self.setMaxChargeRate.exportLiteral(outfile, level, name_='setMaxChargeRate') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMaxDischargeRate is not None: - showIndent(outfile, level) - outfile.write('setMaxDischargeRate=model_.ActivePower(\n') - self.setMaxDischargeRate.exportLiteral(outfile, level, name_='setMaxDischargeRate') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMaxVA is not None: - showIndent(outfile, level) - outfile.write('setMaxVA=model_.ApparentPower(\n') - self.setMaxVA.exportLiteral(outfile, level, name_='setMaxVA') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMaxVAr is not None: - showIndent(outfile, level) - outfile.write('setMaxVAr=model_.ReactivePower(\n') - self.setMaxVAr.exportLiteral(outfile, level, name_='setMaxVAr') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMaxVArNeg is not None: - showIndent(outfile, level) - outfile.write('setMaxVArNeg=model_.ReactivePower(\n') - self.setMaxVArNeg.exportLiteral(outfile, level, name_='setMaxVArNeg') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMaxW is not None: - showIndent(outfile, level) - outfile.write('setMaxW=model_.ActivePower(\n') - self.setMaxW.exportLiteral(outfile, level, name_='setMaxW') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMinPF is not None: - showIndent(outfile, level) - outfile.write('setMinPF=model_.UnsignedFixedPointType(\n') - self.setMinPF.exportLiteral(outfile, level, name_='setMinPF') - showIndent(outfile, level) - outfile.write('),\n') - if self.setMinPFNeg is not None: - showIndent(outfile, level) - outfile.write('setMinPFNeg=model_.FixedPointType(\n') - self.setMinPFNeg.exportLiteral(outfile, level, name_='setMinPFNeg') - showIndent(outfile, level) - outfile.write('),\n') - if self.setStorConnect is not None: - showIndent(outfile, level) - outfile.write('setStorConnect=%s,\n' % self.setStorConnect) - if self.setVRef is not None: - showIndent(outfile, level) - outfile.write('setVRef=model_.VoltageRMS(\n') - self.setVRef.exportLiteral(outfile, level, name_='setVRef') - showIndent(outfile, level) - outfile.write('),\n') - if self.setVRefOfs is not None: - showIndent(outfile, level) - outfile.write('setVRefOfs=model_.VoltageRMS(\n') - self.setVRefOfs.exportLiteral(outfile, level, name_='setVRefOfs') - showIndent(outfile, level) - outfile.write('),\n') - if self.updatedTime is not None: - showIndent(outfile, level) - outfile.write('updatedTime=model_.TimeType(\n') - self.updatedTime.exportLiteral(outfile, level, name_='updatedTime') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERSettings, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'setGenConnect': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'setGenConnect') - self.setGenConnect = ival_ - elif nodeName_ == 'setGradW': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'setGradW') - self.setGradW = ival_ - self.validate_UInt16(self.setGradW) # validate type UInt16 - elif nodeName_ == 'setMaxChargeRate': - obj_ = ActivePower.factory() - obj_.build(child_) - self.setMaxChargeRate = obj_ - obj_.original_tagname_ = 'setMaxChargeRate' - elif nodeName_ == 'setMaxDischargeRate': - obj_ = ActivePower.factory() - obj_.build(child_) - self.setMaxDischargeRate = obj_ - obj_.original_tagname_ = 'setMaxDischargeRate' - elif nodeName_ == 'setMaxVA': - obj_ = ApparentPower.factory() - obj_.build(child_) - self.setMaxVA = obj_ - obj_.original_tagname_ = 'setMaxVA' - elif nodeName_ == 'setMaxVAr': - obj_ = ReactivePower.factory() - obj_.build(child_) - self.setMaxVAr = obj_ - obj_.original_tagname_ = 'setMaxVAr' - elif nodeName_ == 'setMaxVArNeg': - obj_ = ReactivePower.factory() - obj_.build(child_) - self.setMaxVArNeg = obj_ - obj_.original_tagname_ = 'setMaxVArNeg' - elif nodeName_ == 'setMaxW': - obj_ = ActivePower.factory() - obj_.build(child_) - self.setMaxW = obj_ - obj_.original_tagname_ = 'setMaxW' - elif nodeName_ == 'setMinPF': - obj_ = UnsignedFixedPointType.factory() - obj_.build(child_) - self.setMinPF = obj_ - obj_.original_tagname_ = 'setMinPF' - elif nodeName_ == 'setMinPFNeg': - obj_ = FixedPointType.factory() - obj_.build(child_) - self.setMinPFNeg = obj_ - obj_.original_tagname_ = 'setMinPFNeg' - elif nodeName_ == 'setStorConnect': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'setStorConnect') - self.setStorConnect = ival_ - elif nodeName_ == 'setVRef': - obj_ = VoltageRMS.factory() - obj_.build(child_) - self.setVRef = obj_ - obj_.original_tagname_ = 'setVRef' - elif nodeName_ == 'setVRefOfs': - obj_ = VoltageRMS.factory() - obj_.build(child_) - self.setVRefOfs = obj_ - obj_.original_tagname_ = 'setVRefOfs' - elif nodeName_ == 'updatedTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.updatedTime = obj_ - obj_.original_tagname_ = 'updatedTime' - super(DERSettings, self).buildChildren(child_, node, nodeName_, True) -# end class DERSettings - - -class DERList(List): - """A List element to hold DER objects.""" - subclass = None - superclass = List - def __init__(self, DER=None): - self.original_tagname_ = None - super(DERList, self).__init__() - if DER is None: - self.DER = [] - else: - self.DER = DER - def factory(*args_, **kwargs_): - if DERList.subclass: - return DERList.subclass(*args_, **kwargs_) - else: - return DERList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DER(self): return self.DER - def set_DER(self, DER): self.DER = DER - def add_DER(self, value): self.DER.append(value) - def insert_DER_at(self, index, value): self.DER.insert(index, value) - def replace_DER_at(self, index, value): self.DER[index] = value - def hasContent_(self): - if ( - self.DER or - super(DERList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DERList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DERList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DERList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DERList'): - super(DERList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DERList') - def exportChildren(self, outfile, level, namespace_='', name_='DERList', fromsubclass_=False, pretty_print=True): - super(DERList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for DER_ in self.DER: - DER_.export(outfile, level, namespace_, name_='DER', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DERList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DERList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DERList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('DER=[\n') - level += 1 - for DER_ in self.DER: - showIndent(outfile, level) - outfile.write('model_.DER(\n') - DER_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DERList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DER': - obj_ = DER.factory() - obj_.build(child_) - self.DER.append(obj_) - obj_.original_tagname_ = 'DER' - super(DERList, self).buildChildren(child_, node, nodeName_, True) -# end class DERList - - -class DER(SubscribableResource): - """Contains links to DER resources.""" - subclass = None - superclass = SubscribableResource - def __init__(self, AssociatedDERProgramListLink=None, AssociatedUsagePointLink=None, CurrentDERProgramLink=None, DERAvailabilityLink=None, DERCapabilityLink=None, DERSettingsLink=None, DERStatusLink=None): - self.original_tagname_ = None - super(DER, self).__init__() - self.AssociatedDERProgramListLink = AssociatedDERProgramListLink - self.AssociatedUsagePointLink = AssociatedUsagePointLink - self.CurrentDERProgramLink = CurrentDERProgramLink - self.DERAvailabilityLink = DERAvailabilityLink - self.DERCapabilityLink = DERCapabilityLink - self.DERSettingsLink = DERSettingsLink - self.DERStatusLink = DERStatusLink - def factory(*args_, **kwargs_): - if DER.subclass: - return DER.subclass(*args_, **kwargs_) - else: - return DER(*args_, **kwargs_) - factory = staticmethod(factory) - def get_AssociatedDERProgramListLink(self): return self.AssociatedDERProgramListLink - def set_AssociatedDERProgramListLink(self, AssociatedDERProgramListLink): self.AssociatedDERProgramListLink = AssociatedDERProgramListLink - def get_AssociatedUsagePointLink(self): return self.AssociatedUsagePointLink - def set_AssociatedUsagePointLink(self, AssociatedUsagePointLink): self.AssociatedUsagePointLink = AssociatedUsagePointLink - def get_CurrentDERProgramLink(self): return self.CurrentDERProgramLink - def set_CurrentDERProgramLink(self, CurrentDERProgramLink): self.CurrentDERProgramLink = CurrentDERProgramLink - def get_DERAvailabilityLink(self): return self.DERAvailabilityLink - def set_DERAvailabilityLink(self, DERAvailabilityLink): self.DERAvailabilityLink = DERAvailabilityLink - def get_DERCapabilityLink(self): return self.DERCapabilityLink - def set_DERCapabilityLink(self, DERCapabilityLink): self.DERCapabilityLink = DERCapabilityLink - def get_DERSettingsLink(self): return self.DERSettingsLink - def set_DERSettingsLink(self, DERSettingsLink): self.DERSettingsLink = DERSettingsLink - def get_DERStatusLink(self): return self.DERStatusLink - def set_DERStatusLink(self, DERStatusLink): self.DERStatusLink = DERStatusLink - def hasContent_(self): - if ( - self.AssociatedDERProgramListLink is not None or - self.AssociatedUsagePointLink is not None or - self.CurrentDERProgramLink is not None or - self.DERAvailabilityLink is not None or - self.DERCapabilityLink is not None or - self.DERSettingsLink is not None or - self.DERStatusLink is not None or - super(DER, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DER', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DER') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DER', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DER'): - super(DER, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DER') - def exportChildren(self, outfile, level, namespace_='', name_='DER', fromsubclass_=False, pretty_print=True): - super(DER, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.AssociatedDERProgramListLink is not None: - self.AssociatedDERProgramListLink.export(outfile, level, namespace_, name_='AssociatedDERProgramListLink', pretty_print=pretty_print) - if self.AssociatedUsagePointLink is not None: - self.AssociatedUsagePointLink.export(outfile, level, namespace_, name_='AssociatedUsagePointLink', pretty_print=pretty_print) - if self.CurrentDERProgramLink is not None: - self.CurrentDERProgramLink.export(outfile, level, namespace_, name_='CurrentDERProgramLink', pretty_print=pretty_print) - if self.DERAvailabilityLink is not None: - self.DERAvailabilityLink.export(outfile, level, namespace_, name_='DERAvailabilityLink', pretty_print=pretty_print) - if self.DERCapabilityLink is not None: - self.DERCapabilityLink.export(outfile, level, namespace_, name_='DERCapabilityLink', pretty_print=pretty_print) - if self.DERSettingsLink is not None: - self.DERSettingsLink.export(outfile, level, namespace_, name_='DERSettingsLink', pretty_print=pretty_print) - if self.DERStatusLink is not None: - self.DERStatusLink.export(outfile, level, namespace_, name_='DERStatusLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DER'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DER, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DER, self).exportLiteralChildren(outfile, level, name_) - if self.AssociatedDERProgramListLink is not None: - showIndent(outfile, level) - outfile.write('AssociatedDERProgramListLink=model_.AssociatedDERProgramListLink(\n') - self.AssociatedDERProgramListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.AssociatedUsagePointLink is not None: - showIndent(outfile, level) - outfile.write('AssociatedUsagePointLink=model_.AssociatedUsagePointLink(\n') - self.AssociatedUsagePointLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.CurrentDERProgramLink is not None: - showIndent(outfile, level) - outfile.write('CurrentDERProgramLink=model_.CurrentDERProgramLink(\n') - self.CurrentDERProgramLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERAvailabilityLink is not None: - showIndent(outfile, level) - outfile.write('DERAvailabilityLink=model_.DERAvailabilityLink(\n') - self.DERAvailabilityLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERCapabilityLink is not None: - showIndent(outfile, level) - outfile.write('DERCapabilityLink=model_.DERCapabilityLink(\n') - self.DERCapabilityLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERSettingsLink is not None: - showIndent(outfile, level) - outfile.write('DERSettingsLink=model_.DERSettingsLink(\n') - self.DERSettingsLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERStatusLink is not None: - showIndent(outfile, level) - outfile.write('DERStatusLink=model_.DERStatusLink(\n') - self.DERStatusLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DER, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'AssociatedDERProgramListLink': - obj_ = AssociatedDERProgramListLink.factory() - obj_.build(child_) - self.AssociatedDERProgramListLink = obj_ - obj_.original_tagname_ = 'AssociatedDERProgramListLink' - elif nodeName_ == 'AssociatedUsagePointLink': - obj_ = AssociatedUsagePointLink.factory() - obj_.build(child_) - self.AssociatedUsagePointLink = obj_ - obj_.original_tagname_ = 'AssociatedUsagePointLink' - elif nodeName_ == 'CurrentDERProgramLink': - obj_ = CurrentDERProgramLink.factory() - obj_.build(child_) - self.CurrentDERProgramLink = obj_ - obj_.original_tagname_ = 'CurrentDERProgramLink' - elif nodeName_ == 'DERAvailabilityLink': - obj_ = DERAvailabilityLink.factory() - obj_.build(child_) - self.DERAvailabilityLink = obj_ - obj_.original_tagname_ = 'DERAvailabilityLink' - elif nodeName_ == 'DERCapabilityLink': - obj_ = DERCapabilityLink.factory() - obj_.build(child_) - self.DERCapabilityLink = obj_ - obj_.original_tagname_ = 'DERCapabilityLink' - elif nodeName_ == 'DERSettingsLink': - obj_ = DERSettingsLink.factory() - obj_.build(child_) - self.DERSettingsLink = obj_ - obj_.original_tagname_ = 'DERSettingsLink' - elif nodeName_ == 'DERStatusLink': - obj_ = DERStatusLink.factory() - obj_.build(child_) - self.DERStatusLink = obj_ - obj_.original_tagname_ = 'DERStatusLink' - super(DER, self).buildChildren(child_, node, nodeName_, True) -# end class DER - - -class DefaultDERControl(SubscribableIdentifiedObject): - """Contains control mode information to be used if no active DERControl - is found.""" - subclass = None - superclass = SubscribableIdentifiedObject - def __init__(self, DERControlBase=None): - self.original_tagname_ = None - super(DefaultDERControl, self).__init__() - self.DERControlBase = DERControlBase - def factory(*args_, **kwargs_): - if DefaultDERControl.subclass: - return DefaultDERControl.subclass(*args_, **kwargs_) - else: - return DefaultDERControl(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DERControlBase(self): return self.DERControlBase - def set_DERControlBase(self, DERControlBase): self.DERControlBase = DERControlBase - def hasContent_(self): - if ( - self.DERControlBase is not None or - super(DefaultDERControl, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DefaultDERControl', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DefaultDERControl') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DefaultDERControl', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DefaultDERControl'): - super(DefaultDERControl, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DefaultDERControl') - def exportChildren(self, outfile, level, namespace_='', name_='DefaultDERControl', fromsubclass_=False, pretty_print=True): - super(DefaultDERControl, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.DERControlBase is not None: - self.DERControlBase.export(outfile, level, namespace_, name_='DERControlBase', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DefaultDERControl'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DefaultDERControl, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DefaultDERControl, self).exportLiteralChildren(outfile, level, name_) - if self.DERControlBase is not None: - showIndent(outfile, level) - outfile.write('DERControlBase=model_.DERControlBase(\n') - self.DERControlBase.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DefaultDERControl, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DERControlBase': - obj_ = DERControlBase.factory() - obj_.build(child_) - self.DERControlBase = obj_ - obj_.original_tagname_ = 'DERControlBase' - super(DefaultDERControl, self).buildChildren(child_, node, nodeName_, True) -# end class DefaultDERControl - - -class FlowReservationResponseList(SubscribableList): - """A List element to hold FlowReservationResponse objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, FlowReservationResponse=None): - self.original_tagname_ = None - super(FlowReservationResponseList, self).__init__() - if FlowReservationResponse is None: - self.FlowReservationResponse = [] - else: - self.FlowReservationResponse = FlowReservationResponse - def factory(*args_, **kwargs_): - if FlowReservationResponseList.subclass: - return FlowReservationResponseList.subclass(*args_, **kwargs_) - else: - return FlowReservationResponseList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_FlowReservationResponse(self): return self.FlowReservationResponse - def set_FlowReservationResponse(self, FlowReservationResponse): self.FlowReservationResponse = FlowReservationResponse - def add_FlowReservationResponse(self, value): self.FlowReservationResponse.append(value) - def insert_FlowReservationResponse_at(self, index, value): self.FlowReservationResponse.insert(index, value) - def replace_FlowReservationResponse_at(self, index, value): self.FlowReservationResponse[index] = value - def hasContent_(self): - if ( - self.FlowReservationResponse or - super(FlowReservationResponseList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowReservationResponseList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationResponseList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowReservationResponseList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowReservationResponseList'): - super(FlowReservationResponseList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationResponseList') - def exportChildren(self, outfile, level, namespace_='', name_='FlowReservationResponseList', fromsubclass_=False, pretty_print=True): - super(FlowReservationResponseList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for FlowReservationResponse_ in self.FlowReservationResponse: - FlowReservationResponse_.export(outfile, level, namespace_, name_='FlowReservationResponse', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FlowReservationResponseList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FlowReservationResponseList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FlowReservationResponseList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('FlowReservationResponse=[\n') - level += 1 - for FlowReservationResponse_ in self.FlowReservationResponse: - showIndent(outfile, level) - outfile.write('model_.FlowReservationResponse(\n') - FlowReservationResponse_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FlowReservationResponseList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'FlowReservationResponse': - obj_ = FlowReservationResponse.factory() - obj_.build(child_) - self.FlowReservationResponse.append(obj_) - obj_.original_tagname_ = 'FlowReservationResponse' - super(FlowReservationResponseList, self).buildChildren(child_, node, nodeName_, True) -# end class FlowReservationResponseList - - -class FlowReservationResponse(Event): - """The server may modify the charging or discharging parameters and - interval to provide a lower aggregated demand at the premises, - or within a larger part of the distribution system.""" - subclass = None - superclass = Event - def __init__(self, energyAvailable=None, powerAvailable=None, subject=None): - self.original_tagname_ = None - super(FlowReservationResponse, self).__init__() - self.energyAvailable = energyAvailable - self.powerAvailable = powerAvailable - self.subject = subject - def factory(*args_, **kwargs_): - if FlowReservationResponse.subclass: - return FlowReservationResponse.subclass(*args_, **kwargs_) - else: - return FlowReservationResponse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_energyAvailable(self): return self.energyAvailable - def set_energyAvailable(self, energyAvailable): self.energyAvailable = energyAvailable - def get_powerAvailable(self): return self.powerAvailable - def set_powerAvailable(self, powerAvailable): self.powerAvailable = powerAvailable - def get_subject(self): return self.subject - def set_subject(self, subject): self.subject = subject - def hasContent_(self): - if ( - self.energyAvailable is not None or - self.powerAvailable is not None or - self.subject is not None or - super(FlowReservationResponse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowReservationResponse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationResponse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowReservationResponse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowReservationResponse'): - super(FlowReservationResponse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationResponse') - def exportChildren(self, outfile, level, namespace_='', name_='FlowReservationResponse', fromsubclass_=False, pretty_print=True): - super(FlowReservationResponse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.energyAvailable is not None: - self.energyAvailable.export(outfile, level, namespace_, name_='energyAvailable', pretty_print=pretty_print) - if self.powerAvailable is not None: - self.powerAvailable.export(outfile, level, namespace_, name_='powerAvailable', pretty_print=pretty_print) - if self.subject is not None: - self.subject.export(outfile, level, namespace_, name_='subject', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FlowReservationResponse'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FlowReservationResponse, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FlowReservationResponse, self).exportLiteralChildren(outfile, level, name_) - if self.energyAvailable is not None: - showIndent(outfile, level) - outfile.write('energyAvailable=model_.RealEnergy(\n') - self.energyAvailable.exportLiteral(outfile, level, name_='energyAvailable') - showIndent(outfile, level) - outfile.write('),\n') - if self.powerAvailable is not None: - showIndent(outfile, level) - outfile.write('powerAvailable=model_.ActivePower(\n') - self.powerAvailable.exportLiteral(outfile, level, name_='powerAvailable') - showIndent(outfile, level) - outfile.write('),\n') - if self.subject is not None: - showIndent(outfile, level) - outfile.write('subject=model_.mRIDType(\n') - self.subject.exportLiteral(outfile, level, name_='subject') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FlowReservationResponse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'energyAvailable': - obj_ = RealEnergy.factory() - obj_.build(child_) - self.energyAvailable = obj_ - obj_.original_tagname_ = 'energyAvailable' - elif nodeName_ == 'powerAvailable': - obj_ = ActivePower.factory() - obj_.build(child_) - self.powerAvailable = obj_ - obj_.original_tagname_ = 'powerAvailable' - elif nodeName_ == 'subject': - obj_ = mRIDType.factory() - obj_.build(child_) - self.subject = obj_ - obj_.original_tagname_ = 'subject' - super(FlowReservationResponse, self).buildChildren(child_, node, nodeName_, True) -# end class FlowReservationResponse - - -class FlowReservationRequestList(List): - """A List element to hold FlowReservationRequest objects.""" - subclass = None - superclass = List - def __init__(self, FlowReservationRequest=None): - self.original_tagname_ = None - super(FlowReservationRequestList, self).__init__() - if FlowReservationRequest is None: - self.FlowReservationRequest = [] - else: - self.FlowReservationRequest = FlowReservationRequest - def factory(*args_, **kwargs_): - if FlowReservationRequestList.subclass: - return FlowReservationRequestList.subclass(*args_, **kwargs_) - else: - return FlowReservationRequestList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_FlowReservationRequest(self): return self.FlowReservationRequest - def set_FlowReservationRequest(self, FlowReservationRequest): self.FlowReservationRequest = FlowReservationRequest - def add_FlowReservationRequest(self, value): self.FlowReservationRequest.append(value) - def insert_FlowReservationRequest_at(self, index, value): self.FlowReservationRequest.insert(index, value) - def replace_FlowReservationRequest_at(self, index, value): self.FlowReservationRequest[index] = value - def hasContent_(self): - if ( - self.FlowReservationRequest or - super(FlowReservationRequestList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowReservationRequestList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationRequestList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowReservationRequestList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowReservationRequestList'): - super(FlowReservationRequestList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationRequestList') - def exportChildren(self, outfile, level, namespace_='', name_='FlowReservationRequestList', fromsubclass_=False, pretty_print=True): - super(FlowReservationRequestList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for FlowReservationRequest_ in self.FlowReservationRequest: - FlowReservationRequest_.export(outfile, level, namespace_, name_='FlowReservationRequest', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FlowReservationRequestList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FlowReservationRequestList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FlowReservationRequestList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('FlowReservationRequest=[\n') - level += 1 - for FlowReservationRequest_ in self.FlowReservationRequest: - showIndent(outfile, level) - outfile.write('model_.FlowReservationRequest(\n') - FlowReservationRequest_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FlowReservationRequestList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'FlowReservationRequest': - obj_ = FlowReservationRequest.factory() - obj_.build(child_) - self.FlowReservationRequest.append(obj_) - obj_.original_tagname_ = 'FlowReservationRequest' - super(FlowReservationRequestList, self).buildChildren(child_, node, nodeName_, True) -# end class FlowReservationRequestList - - -class FlowReservationRequest(IdentifiedObject): - """Used to request flow transactions. Client EndDevices submit a - request for charging or discharging from the server. The server - creates an associated FlowReservationResponse containing the - charging parameters and interval to provide a lower aggregated - demand at the premises, or within a larger part of the - distribution system.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, creationTime=None, durationRequested=None, energyRequested=None, intervalRequested=None, powerRequested=None, RequestStatus=None): - self.original_tagname_ = None - super(FlowReservationRequest, self).__init__() - self.creationTime = creationTime - self.durationRequested = durationRequested - self.energyRequested = energyRequested - self.intervalRequested = intervalRequested - self.powerRequested = powerRequested - self.RequestStatus = RequestStatus - def factory(*args_, **kwargs_): - if FlowReservationRequest.subclass: - return FlowReservationRequest.subclass(*args_, **kwargs_) - else: - return FlowReservationRequest(*args_, **kwargs_) - factory = staticmethod(factory) - def get_creationTime(self): return self.creationTime - def set_creationTime(self, creationTime): self.creationTime = creationTime - def get_durationRequested(self): return self.durationRequested - def set_durationRequested(self, durationRequested): self.durationRequested = durationRequested - def get_energyRequested(self): return self.energyRequested - def set_energyRequested(self, energyRequested): self.energyRequested = energyRequested - def get_intervalRequested(self): return self.intervalRequested - def set_intervalRequested(self, intervalRequested): self.intervalRequested = intervalRequested - def get_powerRequested(self): return self.powerRequested - def set_powerRequested(self, powerRequested): self.powerRequested = powerRequested - def get_RequestStatus(self): return self.RequestStatus - def set_RequestStatus(self, RequestStatus): self.RequestStatus = RequestStatus - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.creationTime is not None or - self.durationRequested is not None or - self.energyRequested is not None or - self.intervalRequested is not None or - self.powerRequested is not None or - self.RequestStatus is not None or - super(FlowReservationRequest, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FlowReservationRequest', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationRequest') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FlowReservationRequest', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FlowReservationRequest'): - super(FlowReservationRequest, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FlowReservationRequest') - def exportChildren(self, outfile, level, namespace_='', name_='FlowReservationRequest', fromsubclass_=False, pretty_print=True): - super(FlowReservationRequest, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.creationTime is not None: - self.creationTime.export(outfile, level, namespace_, name_='creationTime', pretty_print=pretty_print) - if self.durationRequested is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdurationRequested>%s%s' % (namespace_, self.gds_format_integer(self.durationRequested, input_name='durationRequested'), namespace_, eol_)) - if self.energyRequested is not None: - self.energyRequested.export(outfile, level, namespace_, name_='energyRequested', pretty_print=pretty_print) - if self.intervalRequested is not None: - self.intervalRequested.export(outfile, level, namespace_, name_='intervalRequested', pretty_print=pretty_print) - if self.powerRequested is not None: - self.powerRequested.export(outfile, level, namespace_, name_='powerRequested', pretty_print=pretty_print) - if self.RequestStatus is not None: - self.RequestStatus.export(outfile, level, namespace_, name_='RequestStatus', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FlowReservationRequest'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FlowReservationRequest, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FlowReservationRequest, self).exportLiteralChildren(outfile, level, name_) - if self.creationTime is not None: - showIndent(outfile, level) - outfile.write('creationTime=model_.TimeType(\n') - self.creationTime.exportLiteral(outfile, level, name_='creationTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.durationRequested is not None: - showIndent(outfile, level) - outfile.write('durationRequested=%d,\n' % self.durationRequested) - if self.energyRequested is not None: - showIndent(outfile, level) - outfile.write('energyRequested=model_.SignedRealEnergy(\n') - self.energyRequested.exportLiteral(outfile, level, name_='energyRequested') - showIndent(outfile, level) - outfile.write('),\n') - if self.intervalRequested is not None: - showIndent(outfile, level) - outfile.write('intervalRequested=model_.DateTimeInterval(\n') - self.intervalRequested.exportLiteral(outfile, level, name_='intervalRequested') - showIndent(outfile, level) - outfile.write('),\n') - if self.powerRequested is not None: - showIndent(outfile, level) - outfile.write('powerRequested=model_.ActivePower(\n') - self.powerRequested.exportLiteral(outfile, level, name_='powerRequested') - showIndent(outfile, level) - outfile.write('),\n') - if self.RequestStatus is not None: - showIndent(outfile, level) - outfile.write('RequestStatus=model_.RequestStatus(\n') - self.RequestStatus.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FlowReservationRequest, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'creationTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.creationTime = obj_ - obj_.original_tagname_ = 'creationTime' - elif nodeName_ == 'durationRequested': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'durationRequested') - self.durationRequested = ival_ - self.validate_UInt16(self.durationRequested) # validate type UInt16 - elif nodeName_ == 'energyRequested': - obj_ = SignedRealEnergy.factory() - obj_.build(child_) - self.energyRequested = obj_ - obj_.original_tagname_ = 'energyRequested' - elif nodeName_ == 'intervalRequested': - obj_ = DateTimeInterval.factory() - obj_.build(child_) - self.intervalRequested = obj_ - obj_.original_tagname_ = 'intervalRequested' - elif nodeName_ == 'powerRequested': - obj_ = ActivePower.factory() - obj_.build(child_) - self.powerRequested = obj_ - obj_.original_tagname_ = 'powerRequested' - elif nodeName_ == 'RequestStatus': - obj_ = RequestStatus.factory() - obj_.build(child_) - self.RequestStatus = obj_ - obj_.original_tagname_ = 'RequestStatus' - super(FlowReservationRequest, self).buildChildren(child_, node, nodeName_, True) -# end class FlowReservationRequest - - -class AbstractFlowReservation(Event): - """Provides definition of FlowReservation elements in common between - Requests and Responses.""" - subclass = None - superclass = Event - def __init__(self): - self.original_tagname_ = None - super(AbstractFlowReservation, self).__init__() - def factory(*args_, **kwargs_): - if AbstractFlowReservation.subclass: - return AbstractFlowReservation.subclass(*args_, **kwargs_) - else: - return AbstractFlowReservation(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(AbstractFlowReservation, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AbstractFlowReservation', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AbstractFlowReservation') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AbstractFlowReservation', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AbstractFlowReservation'): - super(AbstractFlowReservation, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AbstractFlowReservation') - def exportChildren(self, outfile, level, namespace_='', name_='AbstractFlowReservation', fromsubclass_=False, pretty_print=True): - super(AbstractFlowReservation, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='AbstractFlowReservation'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(AbstractFlowReservation, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(AbstractFlowReservation, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AbstractFlowReservation, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(AbstractFlowReservation, self).buildChildren(child_, node, nodeName_, True) - pass -# end class AbstractFlowReservation - - -class SupplyInterruptionOverrideList(List): - """A List element to hold SupplyInterruptionOverride objects.""" - subclass = None - superclass = List - def __init__(self, SupplyInterruptionOverride=None): - self.original_tagname_ = None - super(SupplyInterruptionOverrideList, self).__init__() - if SupplyInterruptionOverride is None: - self.SupplyInterruptionOverride = [] - else: - self.SupplyInterruptionOverride = SupplyInterruptionOverride - def factory(*args_, **kwargs_): - if SupplyInterruptionOverrideList.subclass: - return SupplyInterruptionOverrideList.subclass(*args_, **kwargs_) - else: - return SupplyInterruptionOverrideList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_SupplyInterruptionOverride(self): return self.SupplyInterruptionOverride - def set_SupplyInterruptionOverride(self, SupplyInterruptionOverride): self.SupplyInterruptionOverride = SupplyInterruptionOverride - def add_SupplyInterruptionOverride(self, value): self.SupplyInterruptionOverride.append(value) - def insert_SupplyInterruptionOverride_at(self, index, value): self.SupplyInterruptionOverride.insert(index, value) - def replace_SupplyInterruptionOverride_at(self, index, value): self.SupplyInterruptionOverride[index] = value - def hasContent_(self): - if ( - self.SupplyInterruptionOverride or - super(SupplyInterruptionOverrideList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SupplyInterruptionOverrideList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SupplyInterruptionOverrideList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SupplyInterruptionOverrideList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SupplyInterruptionOverrideList'): - super(SupplyInterruptionOverrideList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SupplyInterruptionOverrideList') - def exportChildren(self, outfile, level, namespace_='', name_='SupplyInterruptionOverrideList', fromsubclass_=False, pretty_print=True): - super(SupplyInterruptionOverrideList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for SupplyInterruptionOverride_ in self.SupplyInterruptionOverride: - SupplyInterruptionOverride_.export(outfile, level, namespace_, name_='SupplyInterruptionOverride', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='SupplyInterruptionOverrideList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SupplyInterruptionOverrideList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SupplyInterruptionOverrideList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('SupplyInterruptionOverride=[\n') - level += 1 - for SupplyInterruptionOverride_ in self.SupplyInterruptionOverride: - showIndent(outfile, level) - outfile.write('model_.SupplyInterruptionOverride(\n') - SupplyInterruptionOverride_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SupplyInterruptionOverrideList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'SupplyInterruptionOverride': - obj_ = SupplyInterruptionOverride.factory() - obj_.build(child_) - self.SupplyInterruptionOverride.append(obj_) - obj_.original_tagname_ = 'SupplyInterruptionOverride' - super(SupplyInterruptionOverrideList, self).buildChildren(child_, node, nodeName_, True) -# end class SupplyInterruptionOverrideList - - -class SupplyInterruptionOverride(Resource): - """SupplyInterruptionOverride: There may be periods of time when - social, regulatory or other concerns mean that service should - not be interrupted, even when available credit has been - exhausted. Each Prepayment instance links to a List of - SupplyInterruptionOverride instances. Each - SupplyInterruptionOverride defines a contiguous period of time - during which supply SHALL NOT be interrupted.""" - subclass = None - superclass = Resource - def __init__(self, description=None, interval=None): - self.original_tagname_ = None - super(SupplyInterruptionOverride, self).__init__() - self.description = description - self.interval = interval - def factory(*args_, **kwargs_): - if SupplyInterruptionOverride.subclass: - return SupplyInterruptionOverride.subclass(*args_, **kwargs_) - else: - return SupplyInterruptionOverride(*args_, **kwargs_) - factory = staticmethod(factory) - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_interval(self): return self.interval - def set_interval(self, interval): self.interval = interval - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.description is not None or - self.interval is not None or - super(SupplyInterruptionOverride, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SupplyInterruptionOverride', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SupplyInterruptionOverride') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SupplyInterruptionOverride', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SupplyInterruptionOverride'): - super(SupplyInterruptionOverride, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SupplyInterruptionOverride') - def exportChildren(self, outfile, level, namespace_='', name_='SupplyInterruptionOverride', fromsubclass_=False, pretty_print=True): - super(SupplyInterruptionOverride, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.interval is not None: - self.interval.export(outfile, level, namespace_, name_='interval', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='SupplyInterruptionOverride'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SupplyInterruptionOverride, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SupplyInterruptionOverride, self).exportLiteralChildren(outfile, level, name_) - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.interval is not None: - showIndent(outfile, level) - outfile.write('interval=model_.DateTimeInterval(\n') - self.interval.exportLiteral(outfile, level, name_='interval') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SupplyInterruptionOverride, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String32(self.description) # validate type String32 - elif nodeName_ == 'interval': - obj_ = DateTimeInterval.factory() - obj_.build(child_) - self.interval = obj_ - obj_.original_tagname_ = 'interval' - super(SupplyInterruptionOverride, self).buildChildren(child_, node, nodeName_, True) -# end class SupplyInterruptionOverride - - -class PrepayOperationStatus(Resource): - """PrepayOperationStatus describes the status of the service or - commodity being conditionally controlled by the Prepayment - function set.""" - subclass = None - superclass = Resource - def __init__(self, creditTypeChange=None, creditTypeInUse=None, serviceChange=None, serviceStatus=None): - self.original_tagname_ = None - super(PrepayOperationStatus, self).__init__() - self.creditTypeChange = creditTypeChange - self.creditTypeInUse = creditTypeInUse - self.serviceChange = serviceChange - self.serviceStatus = serviceStatus - def factory(*args_, **kwargs_): - if PrepayOperationStatus.subclass: - return PrepayOperationStatus.subclass(*args_, **kwargs_) - else: - return PrepayOperationStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_creditTypeChange(self): return self.creditTypeChange - def set_creditTypeChange(self, creditTypeChange): self.creditTypeChange = creditTypeChange - def get_creditTypeInUse(self): return self.creditTypeInUse - def set_creditTypeInUse(self, creditTypeInUse): self.creditTypeInUse = creditTypeInUse - def get_serviceChange(self): return self.serviceChange - def set_serviceChange(self, serviceChange): self.serviceChange = serviceChange - def get_serviceStatus(self): return self.serviceStatus - def set_serviceStatus(self, serviceStatus): self.serviceStatus = serviceStatus - def hasContent_(self): - if ( - self.creditTypeChange is not None or - self.creditTypeInUse is not None or - self.serviceChange is not None or - self.serviceStatus is not None or - super(PrepayOperationStatus, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrepayOperationStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrepayOperationStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrepayOperationStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrepayOperationStatus'): - super(PrepayOperationStatus, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PrepayOperationStatus') - def exportChildren(self, outfile, level, namespace_='', name_='PrepayOperationStatus', fromsubclass_=False, pretty_print=True): - super(PrepayOperationStatus, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.creditTypeChange is not None: - self.creditTypeChange.export(outfile, level, namespace_, name_='creditTypeChange', pretty_print=pretty_print) - if self.creditTypeInUse is not None: - self.creditTypeInUse.export(outfile, level, namespace_, name_='creditTypeInUse', pretty_print=pretty_print) - if self.serviceChange is not None: - self.serviceChange.export(outfile, level, namespace_, name_='serviceChange', pretty_print=pretty_print) - if self.serviceStatus is not None: - self.serviceStatus.export(outfile, level, namespace_, name_='serviceStatus', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='PrepayOperationStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PrepayOperationStatus, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PrepayOperationStatus, self).exportLiteralChildren(outfile, level, name_) - if self.creditTypeChange is not None: - showIndent(outfile, level) - outfile.write('creditTypeChange=model_.CreditTypeChange(\n') - self.creditTypeChange.exportLiteral(outfile, level, name_='creditTypeChange') - showIndent(outfile, level) - outfile.write('),\n') - if self.creditTypeInUse is not None: - showIndent(outfile, level) - outfile.write('creditTypeInUse=model_.CreditTypeType(\n') - self.creditTypeInUse.exportLiteral(outfile, level, name_='creditTypeInUse') - showIndent(outfile, level) - outfile.write('),\n') - if self.serviceChange is not None: - showIndent(outfile, level) - outfile.write('serviceChange=model_.ServiceChange(\n') - self.serviceChange.exportLiteral(outfile, level, name_='serviceChange') - showIndent(outfile, level) - outfile.write('),\n') - if self.serviceStatus is not None: - showIndent(outfile, level) - outfile.write('serviceStatus=model_.ServiceStatusType(\n') - self.serviceStatus.exportLiteral(outfile, level, name_='serviceStatus') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PrepayOperationStatus, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'creditTypeChange': - obj_ = CreditTypeChange.factory() - obj_.build(child_) - self.creditTypeChange = obj_ - obj_.original_tagname_ = 'creditTypeChange' - elif nodeName_ == 'creditTypeInUse': - obj_ = CreditTypeType.factory() - obj_.build(child_) - self.creditTypeInUse = obj_ - obj_.original_tagname_ = 'creditTypeInUse' - elif nodeName_ == 'serviceChange': - obj_ = ServiceChange.factory() - obj_.build(child_) - self.serviceChange = obj_ - obj_.original_tagname_ = 'serviceChange' - elif nodeName_ == 'serviceStatus': - obj_ = ServiceStatusType.factory() - obj_.build(child_) - self.serviceStatus = obj_ - obj_.original_tagname_ = 'serviceStatus' - super(PrepayOperationStatus, self).buildChildren(child_, node, nodeName_, True) -# end class PrepayOperationStatus - - -class PrepaymentList(SubscribableList): - """A List element to hold Prepayment objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, Prepayment=None): - self.original_tagname_ = None - super(PrepaymentList, self).__init__() - if Prepayment is None: - self.Prepayment = [] - else: - self.Prepayment = Prepayment - def factory(*args_, **kwargs_): - if PrepaymentList.subclass: - return PrepaymentList.subclass(*args_, **kwargs_) - else: - return PrepaymentList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Prepayment(self): return self.Prepayment - def set_Prepayment(self, Prepayment): self.Prepayment = Prepayment - def add_Prepayment(self, value): self.Prepayment.append(value) - def insert_Prepayment_at(self, index, value): self.Prepayment.insert(index, value) - def replace_Prepayment_at(self, index, value): self.Prepayment[index] = value - def hasContent_(self): - if ( - self.Prepayment or - super(PrepaymentList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PrepaymentList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PrepaymentList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PrepaymentList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PrepaymentList'): - super(PrepaymentList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PrepaymentList') - def exportChildren(self, outfile, level, namespace_='', name_='PrepaymentList', fromsubclass_=False, pretty_print=True): - super(PrepaymentList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Prepayment_ in self.Prepayment: - Prepayment_.export(outfile, level, namespace_, name_='Prepayment', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='PrepaymentList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PrepaymentList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PrepaymentList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Prepayment=[\n') - level += 1 - for Prepayment_ in self.Prepayment: - showIndent(outfile, level) - outfile.write('model_.Prepayment(\n') - Prepayment_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PrepaymentList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Prepayment': - obj_ = Prepayment.factory() - obj_.build(child_) - self.Prepayment.append(obj_) - obj_.original_tagname_ = 'Prepayment' - super(PrepaymentList, self).buildChildren(child_, node, nodeName_, True) -# end class PrepaymentList - - -class Prepayment(IdentifiedObject): - """Prepayment (inherited from CIM SDPAccountingFunction)""" - subclass = None - superclass = IdentifiedObject - def __init__(self, AccountBalanceLink=None, ActiveCreditRegisterListLink=None, ActiveSupplyInterruptionOverrideListLink=None, creditExpiryLevel=None, CreditRegisterListLink=None, lowCreditWarningLevel=None, lowEmergencyCreditWarningLevel=None, prepayMode=None, PrepayOperationStatusLink=None, SupplyInterruptionOverrideListLink=None, UsagePoint=None, UsagePointLink=None): - self.original_tagname_ = None - super(Prepayment, self).__init__() - self.AccountBalanceLink = AccountBalanceLink - self.ActiveCreditRegisterListLink = ActiveCreditRegisterListLink - self.ActiveSupplyInterruptionOverrideListLink = ActiveSupplyInterruptionOverrideListLink - self.creditExpiryLevel = creditExpiryLevel - self.CreditRegisterListLink = CreditRegisterListLink - self.lowCreditWarningLevel = lowCreditWarningLevel - self.lowEmergencyCreditWarningLevel = lowEmergencyCreditWarningLevel - self.prepayMode = prepayMode - self.PrepayOperationStatusLink = PrepayOperationStatusLink - self.SupplyInterruptionOverrideListLink = SupplyInterruptionOverrideListLink - if UsagePoint is None: - self.UsagePoint = [] - else: - self.UsagePoint = UsagePoint - self.UsagePointLink = UsagePointLink - def factory(*args_, **kwargs_): - if Prepayment.subclass: - return Prepayment.subclass(*args_, **kwargs_) - else: - return Prepayment(*args_, **kwargs_) - factory = staticmethod(factory) - def get_AccountBalanceLink(self): return self.AccountBalanceLink - def set_AccountBalanceLink(self, AccountBalanceLink): self.AccountBalanceLink = AccountBalanceLink - def get_ActiveCreditRegisterListLink(self): return self.ActiveCreditRegisterListLink - def set_ActiveCreditRegisterListLink(self, ActiveCreditRegisterListLink): self.ActiveCreditRegisterListLink = ActiveCreditRegisterListLink - def get_ActiveSupplyInterruptionOverrideListLink(self): return self.ActiveSupplyInterruptionOverrideListLink - def set_ActiveSupplyInterruptionOverrideListLink(self, ActiveSupplyInterruptionOverrideListLink): self.ActiveSupplyInterruptionOverrideListLink = ActiveSupplyInterruptionOverrideListLink - def get_creditExpiryLevel(self): return self.creditExpiryLevel - def set_creditExpiryLevel(self, creditExpiryLevel): self.creditExpiryLevel = creditExpiryLevel - def get_CreditRegisterListLink(self): return self.CreditRegisterListLink - def set_CreditRegisterListLink(self, CreditRegisterListLink): self.CreditRegisterListLink = CreditRegisterListLink - def get_lowCreditWarningLevel(self): return self.lowCreditWarningLevel - def set_lowCreditWarningLevel(self, lowCreditWarningLevel): self.lowCreditWarningLevel = lowCreditWarningLevel - def get_lowEmergencyCreditWarningLevel(self): return self.lowEmergencyCreditWarningLevel - def set_lowEmergencyCreditWarningLevel(self, lowEmergencyCreditWarningLevel): self.lowEmergencyCreditWarningLevel = lowEmergencyCreditWarningLevel - def get_prepayMode(self): return self.prepayMode - def set_prepayMode(self, prepayMode): self.prepayMode = prepayMode - def get_PrepayOperationStatusLink(self): return self.PrepayOperationStatusLink - def set_PrepayOperationStatusLink(self, PrepayOperationStatusLink): self.PrepayOperationStatusLink = PrepayOperationStatusLink - def get_SupplyInterruptionOverrideListLink(self): return self.SupplyInterruptionOverrideListLink - def set_SupplyInterruptionOverrideListLink(self, SupplyInterruptionOverrideListLink): self.SupplyInterruptionOverrideListLink = SupplyInterruptionOverrideListLink - def get_UsagePoint(self): return self.UsagePoint - def set_UsagePoint(self, UsagePoint): self.UsagePoint = UsagePoint - def add_UsagePoint(self, value): self.UsagePoint.append(value) - def insert_UsagePoint_at(self, index, value): self.UsagePoint.insert(index, value) - def replace_UsagePoint_at(self, index, value): self.UsagePoint[index] = value - def get_UsagePointLink(self): return self.UsagePointLink - def set_UsagePointLink(self, UsagePointLink): self.UsagePointLink = UsagePointLink - def hasContent_(self): - if ( - self.AccountBalanceLink is not None or - self.ActiveCreditRegisterListLink is not None or - self.ActiveSupplyInterruptionOverrideListLink is not None or - self.creditExpiryLevel is not None or - self.CreditRegisterListLink is not None or - self.lowCreditWarningLevel is not None or - self.lowEmergencyCreditWarningLevel is not None or - self.prepayMode is not None or - self.PrepayOperationStatusLink is not None or - self.SupplyInterruptionOverrideListLink is not None or - self.UsagePoint or - self.UsagePointLink is not None or - super(Prepayment, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Prepayment', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Prepayment') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Prepayment', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Prepayment'): - super(Prepayment, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Prepayment') - def exportChildren(self, outfile, level, namespace_='', name_='Prepayment', fromsubclass_=False, pretty_print=True): - super(Prepayment, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.AccountBalanceLink is not None: - self.AccountBalanceLink.export(outfile, level, namespace_, name_='AccountBalanceLink', pretty_print=pretty_print) - if self.ActiveCreditRegisterListLink is not None: - self.ActiveCreditRegisterListLink.export(outfile, level, namespace_, name_='ActiveCreditRegisterListLink', pretty_print=pretty_print) - if self.ActiveSupplyInterruptionOverrideListLink is not None: - self.ActiveSupplyInterruptionOverrideListLink.export(outfile, level, namespace_, name_='ActiveSupplyInterruptionOverrideListLink', pretty_print=pretty_print) - if self.creditExpiryLevel is not None: - self.creditExpiryLevel.export(outfile, level, namespace_, name_='creditExpiryLevel', pretty_print=pretty_print) - if self.CreditRegisterListLink is not None: - self.CreditRegisterListLink.export(outfile, level, namespace_, name_='CreditRegisterListLink', pretty_print=pretty_print) - if self.lowCreditWarningLevel is not None: - self.lowCreditWarningLevel.export(outfile, level, namespace_, name_='lowCreditWarningLevel', pretty_print=pretty_print) - if self.lowEmergencyCreditWarningLevel is not None: - self.lowEmergencyCreditWarningLevel.export(outfile, level, namespace_, name_='lowEmergencyCreditWarningLevel', pretty_print=pretty_print) - if self.prepayMode is not None: - self.prepayMode.export(outfile, level, namespace_, name_='prepayMode', pretty_print=pretty_print) - if self.PrepayOperationStatusLink is not None: - self.PrepayOperationStatusLink.export(outfile, level, namespace_, name_='PrepayOperationStatusLink', pretty_print=pretty_print) - if self.SupplyInterruptionOverrideListLink is not None: - self.SupplyInterruptionOverrideListLink.export(outfile, level, namespace_, name_='SupplyInterruptionOverrideListLink', pretty_print=pretty_print) - for UsagePoint_ in self.UsagePoint: - UsagePoint_.export(outfile, level, namespace_, name_='UsagePoint', pretty_print=pretty_print) - if self.UsagePointLink is not None: - self.UsagePointLink.export(outfile, level, namespace_, name_='UsagePointLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='Prepayment'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Prepayment, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Prepayment, self).exportLiteralChildren(outfile, level, name_) - if self.AccountBalanceLink is not None: - showIndent(outfile, level) - outfile.write('AccountBalanceLink=model_.AccountBalanceLink(\n') - self.AccountBalanceLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ActiveCreditRegisterListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveCreditRegisterListLink=model_.ActiveCreditRegisterListLink(\n') - self.ActiveCreditRegisterListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ActiveSupplyInterruptionOverrideListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveSupplyInterruptionOverrideListLink=model_.ActiveSupplyInterruptionOverrideListLink(\n') - self.ActiveSupplyInterruptionOverrideListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.creditExpiryLevel is not None: - showIndent(outfile, level) - outfile.write('creditExpiryLevel=model_.AccountingUnit(\n') - self.creditExpiryLevel.exportLiteral(outfile, level, name_='creditExpiryLevel') - showIndent(outfile, level) - outfile.write('),\n') - if self.CreditRegisterListLink is not None: - showIndent(outfile, level) - outfile.write('CreditRegisterListLink=model_.CreditRegisterListLink(\n') - self.CreditRegisterListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.lowCreditWarningLevel is not None: - showIndent(outfile, level) - outfile.write('lowCreditWarningLevel=model_.AccountingUnit(\n') - self.lowCreditWarningLevel.exportLiteral(outfile, level, name_='lowCreditWarningLevel') - showIndent(outfile, level) - outfile.write('),\n') - if self.lowEmergencyCreditWarningLevel is not None: - showIndent(outfile, level) - outfile.write('lowEmergencyCreditWarningLevel=model_.AccountingUnit(\n') - self.lowEmergencyCreditWarningLevel.exportLiteral(outfile, level, name_='lowEmergencyCreditWarningLevel') - showIndent(outfile, level) - outfile.write('),\n') - if self.prepayMode is not None: - showIndent(outfile, level) - outfile.write('prepayMode=model_.PrepayModeType(\n') - self.prepayMode.exportLiteral(outfile, level, name_='prepayMode') - showIndent(outfile, level) - outfile.write('),\n') - if self.PrepayOperationStatusLink is not None: - showIndent(outfile, level) - outfile.write('PrepayOperationStatusLink=model_.PrepayOperationStatusLink(\n') - self.PrepayOperationStatusLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.SupplyInterruptionOverrideListLink is not None: - showIndent(outfile, level) - outfile.write('SupplyInterruptionOverrideListLink=model_.SupplyInterruptionOverrideListLink(\n') - self.SupplyInterruptionOverrideListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - showIndent(outfile, level) - outfile.write('UsagePoint=[\n') - level += 1 - for UsagePoint_ in self.UsagePoint: - showIndent(outfile, level) - outfile.write('model_.UsagePoint(\n') - UsagePoint_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - if self.UsagePointLink is not None: - showIndent(outfile, level) - outfile.write('UsagePointLink=model_.UsagePointLink(\n') - self.UsagePointLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Prepayment, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'AccountBalanceLink': - obj_ = AccountBalanceLink.factory() - obj_.build(child_) - self.AccountBalanceLink = obj_ - obj_.original_tagname_ = 'AccountBalanceLink' - elif nodeName_ == 'ActiveCreditRegisterListLink': - obj_ = ActiveCreditRegisterListLink.factory() - obj_.build(child_) - self.ActiveCreditRegisterListLink = obj_ - obj_.original_tagname_ = 'ActiveCreditRegisterListLink' - elif nodeName_ == 'ActiveSupplyInterruptionOverrideListLink': - obj_ = ActiveSupplyInterruptionOverrideListLink.factory() - obj_.build(child_) - self.ActiveSupplyInterruptionOverrideListLink = obj_ - obj_.original_tagname_ = 'ActiveSupplyInterruptionOverrideListLink' - elif nodeName_ == 'creditExpiryLevel': - obj_ = AccountingUnit.factory() - obj_.build(child_) - self.creditExpiryLevel = obj_ - obj_.original_tagname_ = 'creditExpiryLevel' - elif nodeName_ == 'CreditRegisterListLink': - obj_ = CreditRegisterListLink.factory() - obj_.build(child_) - self.CreditRegisterListLink = obj_ - obj_.original_tagname_ = 'CreditRegisterListLink' - elif nodeName_ == 'lowCreditWarningLevel': - obj_ = AccountingUnit.factory() - obj_.build(child_) - self.lowCreditWarningLevel = obj_ - obj_.original_tagname_ = 'lowCreditWarningLevel' - elif nodeName_ == 'lowEmergencyCreditWarningLevel': - obj_ = AccountingUnit.factory() - obj_.build(child_) - self.lowEmergencyCreditWarningLevel = obj_ - obj_.original_tagname_ = 'lowEmergencyCreditWarningLevel' - elif nodeName_ == 'prepayMode': - obj_ = PrepayModeType.factory() - obj_.build(child_) - self.prepayMode = obj_ - obj_.original_tagname_ = 'prepayMode' - elif nodeName_ == 'PrepayOperationStatusLink': - obj_ = PrepayOperationStatusLink.factory() - obj_.build(child_) - self.PrepayOperationStatusLink = obj_ - obj_.original_tagname_ = 'PrepayOperationStatusLink' - elif nodeName_ == 'SupplyInterruptionOverrideListLink': - obj_ = SupplyInterruptionOverrideListLink.factory() - obj_.build(child_) - self.SupplyInterruptionOverrideListLink = obj_ - obj_.original_tagname_ = 'SupplyInterruptionOverrideListLink' - elif nodeName_ == 'UsagePoint': - obj_ = UsagePoint.factory() - obj_.build(child_) - self.UsagePoint.append(obj_) - obj_.original_tagname_ = 'UsagePoint' - elif nodeName_ == 'UsagePointLink': - obj_ = UsagePointLink.factory() - obj_.build(child_) - self.UsagePointLink = obj_ - obj_.original_tagname_ = 'UsagePointLink' - super(Prepayment, self).buildChildren(child_, node, nodeName_, True) -# end class Prepayment - - -class CreditRegisterList(List): - """A List element to hold CreditRegister objects.""" - subclass = None - superclass = List - def __init__(self, CreditRegister=None): - self.original_tagname_ = None - super(CreditRegisterList, self).__init__() - if CreditRegister is None: - self.CreditRegister = [] - else: - self.CreditRegister = CreditRegister - def factory(*args_, **kwargs_): - if CreditRegisterList.subclass: - return CreditRegisterList.subclass(*args_, **kwargs_) - else: - return CreditRegisterList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_CreditRegister(self): return self.CreditRegister - def set_CreditRegister(self, CreditRegister): self.CreditRegister = CreditRegister - def add_CreditRegister(self, value): self.CreditRegister.append(value) - def insert_CreditRegister_at(self, index, value): self.CreditRegister.insert(index, value) - def replace_CreditRegister_at(self, index, value): self.CreditRegister[index] = value - def hasContent_(self): - if ( - self.CreditRegister or - super(CreditRegisterList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CreditRegisterList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CreditRegisterList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CreditRegisterList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CreditRegisterList'): - super(CreditRegisterList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CreditRegisterList') - def exportChildren(self, outfile, level, namespace_='', name_='CreditRegisterList', fromsubclass_=False, pretty_print=True): - super(CreditRegisterList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for CreditRegister_ in self.CreditRegister: - CreditRegister_.export(outfile, level, namespace_, name_='CreditRegister', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CreditRegisterList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CreditRegisterList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CreditRegisterList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('CreditRegister=[\n') - level += 1 - for CreditRegister_ in self.CreditRegister: - showIndent(outfile, level) - outfile.write('model_.CreditRegister(\n') - CreditRegister_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CreditRegisterList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'CreditRegister': - obj_ = CreditRegister.factory() - obj_.build(child_) - self.CreditRegister.append(obj_) - obj_.original_tagname_ = 'CreditRegister' - super(CreditRegisterList, self).buildChildren(child_, node, nodeName_, True) -# end class CreditRegisterList - - -class CreditRegister(IdentifiedObject): - """CreditRegister instances define a credit-modifying transaction. - Typically this would be a credit-adding transaction, but may be - a subtracting transaction (perhaps in response to an out-of-band - debt signal).""" - subclass = None - superclass = IdentifiedObject - def __init__(self, creditAmount=None, creditType=None, effectiveTime=None, token=None): - self.original_tagname_ = None - super(CreditRegister, self).__init__() - self.creditAmount = creditAmount - self.creditType = creditType - self.effectiveTime = effectiveTime - self.token = token - def factory(*args_, **kwargs_): - if CreditRegister.subclass: - return CreditRegister.subclass(*args_, **kwargs_) - else: - return CreditRegister(*args_, **kwargs_) - factory = staticmethod(factory) - def get_creditAmount(self): return self.creditAmount - def set_creditAmount(self, creditAmount): self.creditAmount = creditAmount - def get_creditType(self): return self.creditType - def set_creditType(self, creditType): self.creditType = creditType - def get_effectiveTime(self): return self.effectiveTime - def set_effectiveTime(self, effectiveTime): self.effectiveTime = effectiveTime - def get_token(self): return self.token - def set_token(self, token): self.token = token - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.creditAmount is not None or - self.creditType is not None or - self.effectiveTime is not None or - self.token is not None or - super(CreditRegister, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CreditRegister', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CreditRegister') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CreditRegister', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CreditRegister'): - super(CreditRegister, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CreditRegister') - def exportChildren(self, outfile, level, namespace_='', name_='CreditRegister', fromsubclass_=False, pretty_print=True): - super(CreditRegister, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.creditAmount is not None: - self.creditAmount.export(outfile, level, namespace_, name_='creditAmount', pretty_print=pretty_print) - if self.creditType is not None: - self.creditType.export(outfile, level, namespace_, name_='creditType', pretty_print=pretty_print) - if self.effectiveTime is not None: - self.effectiveTime.export(outfile, level, namespace_, name_='effectiveTime', pretty_print=pretty_print) - if self.token is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%stoken>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.token).encode(ExternalEncoding), input_name='token'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='CreditRegister'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CreditRegister, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CreditRegister, self).exportLiteralChildren(outfile, level, name_) - if self.creditAmount is not None: - showIndent(outfile, level) - outfile.write('creditAmount=model_.AccountingUnit(\n') - self.creditAmount.exportLiteral(outfile, level, name_='creditAmount') - showIndent(outfile, level) - outfile.write('),\n') - if self.creditType is not None: - showIndent(outfile, level) - outfile.write('creditType=model_.CreditTypeType(\n') - self.creditType.exportLiteral(outfile, level, name_='creditType') - showIndent(outfile, level) - outfile.write('),\n') - if self.effectiveTime is not None: - showIndent(outfile, level) - outfile.write('effectiveTime=model_.TimeType(\n') - self.effectiveTime.exportLiteral(outfile, level, name_='effectiveTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.token is not None: - showIndent(outfile, level) - outfile.write('token=%s,\n' % quote_python(self.token).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CreditRegister, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'creditAmount': - obj_ = AccountingUnit.factory() - obj_.build(child_) - self.creditAmount = obj_ - obj_.original_tagname_ = 'creditAmount' - elif nodeName_ == 'creditType': - obj_ = CreditTypeType.factory() - obj_.build(child_) - self.creditType = obj_ - obj_.original_tagname_ = 'creditType' - elif nodeName_ == 'effectiveTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.effectiveTime = obj_ - obj_.original_tagname_ = 'effectiveTime' - elif nodeName_ == 'token': - token_ = child_.text - token_ = self.gds_validate_string(token_, node, 'token') - self.token = token_ - self.validate_String32(self.token) # validate type String32 - super(CreditRegister, self).buildChildren(child_, node, nodeName_, True) -# end class CreditRegister - - -class AccountBalance(Resource): - """AccountBalance contains the regular credit and emergency credit - balance for this given service or commodity prepay instance. It - may also contain status information concerning the balance data.""" - subclass = None - superclass = Resource - def __init__(self, availableCredit=None, creditStatus=None, emergencyCredit=None, emergencyCreditStatus=None): - self.original_tagname_ = None - super(AccountBalance, self).__init__() - self.availableCredit = availableCredit - self.creditStatus = creditStatus - self.emergencyCredit = emergencyCredit - self.emergencyCreditStatus = emergencyCreditStatus - def factory(*args_, **kwargs_): - if AccountBalance.subclass: - return AccountBalance.subclass(*args_, **kwargs_) - else: - return AccountBalance(*args_, **kwargs_) - factory = staticmethod(factory) - def get_availableCredit(self): return self.availableCredit - def set_availableCredit(self, availableCredit): self.availableCredit = availableCredit - def get_creditStatus(self): return self.creditStatus - def set_creditStatus(self, creditStatus): self.creditStatus = creditStatus - def get_emergencyCredit(self): return self.emergencyCredit - def set_emergencyCredit(self, emergencyCredit): self.emergencyCredit = emergencyCredit - def get_emergencyCreditStatus(self): return self.emergencyCreditStatus - def set_emergencyCreditStatus(self, emergencyCreditStatus): self.emergencyCreditStatus = emergencyCreditStatus - def hasContent_(self): - if ( - self.availableCredit is not None or - self.creditStatus is not None or - self.emergencyCredit is not None or - self.emergencyCreditStatus is not None or - super(AccountBalance, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AccountBalance', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AccountBalance') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AccountBalance', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AccountBalance'): - super(AccountBalance, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AccountBalance') - def exportChildren(self, outfile, level, namespace_='', name_='AccountBalance', fromsubclass_=False, pretty_print=True): - super(AccountBalance, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.availableCredit is not None: - self.availableCredit.export(outfile, level, namespace_, name_='availableCredit', pretty_print=pretty_print) - if self.creditStatus is not None: - self.creditStatus.export(outfile, level, namespace_, name_='creditStatus', pretty_print=pretty_print) - if self.emergencyCredit is not None: - self.emergencyCredit.export(outfile, level, namespace_, name_='emergencyCredit', pretty_print=pretty_print) - if self.emergencyCreditStatus is not None: - self.emergencyCreditStatus.export(outfile, level, namespace_, name_='emergencyCreditStatus', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='AccountBalance'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(AccountBalance, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(AccountBalance, self).exportLiteralChildren(outfile, level, name_) - if self.availableCredit is not None: - showIndent(outfile, level) - outfile.write('availableCredit=model_.AccountingUnit(\n') - self.availableCredit.exportLiteral(outfile, level, name_='availableCredit') - showIndent(outfile, level) - outfile.write('),\n') - if self.creditStatus is not None: - showIndent(outfile, level) - outfile.write('creditStatus=model_.CreditStatusType(\n') - self.creditStatus.exportLiteral(outfile, level, name_='creditStatus') - showIndent(outfile, level) - outfile.write('),\n') - if self.emergencyCredit is not None: - showIndent(outfile, level) - outfile.write('emergencyCredit=model_.AccountingUnit(\n') - self.emergencyCredit.exportLiteral(outfile, level, name_='emergencyCredit') - showIndent(outfile, level) - outfile.write('),\n') - if self.emergencyCreditStatus is not None: - showIndent(outfile, level) - outfile.write('emergencyCreditStatus=model_.CreditStatusType(\n') - self.emergencyCreditStatus.exportLiteral(outfile, level, name_='emergencyCreditStatus') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AccountBalance, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'availableCredit': - obj_ = AccountingUnit.factory() - obj_.build(child_) - self.availableCredit = obj_ - obj_.original_tagname_ = 'availableCredit' - elif nodeName_ == 'creditStatus': - obj_ = CreditStatusType.factory() - obj_.build(child_) - self.creditStatus = obj_ - obj_.original_tagname_ = 'creditStatus' - elif nodeName_ == 'emergencyCredit': - obj_ = AccountingUnit.factory() - obj_.build(child_) - self.emergencyCredit = obj_ - obj_.original_tagname_ = 'emergencyCredit' - elif nodeName_ == 'emergencyCreditStatus': - obj_ = CreditStatusType.factory() - obj_.build(child_) - self.emergencyCreditStatus = obj_ - obj_.original_tagname_ = 'emergencyCreditStatus' - super(AccountBalance, self).buildChildren(child_, node, nodeName_, True) -# end class AccountBalance - - -class ServiceSupplierList(List): - """A List element to hold ServiceSupplier objects.""" - subclass = None - superclass = List - def __init__(self, ServiceSupplier=None): - self.original_tagname_ = None - super(ServiceSupplierList, self).__init__() - if ServiceSupplier is None: - self.ServiceSupplier = [] - else: - self.ServiceSupplier = ServiceSupplier - def factory(*args_, **kwargs_): - if ServiceSupplierList.subclass: - return ServiceSupplierList.subclass(*args_, **kwargs_) - else: - return ServiceSupplierList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ServiceSupplier(self): return self.ServiceSupplier - def set_ServiceSupplier(self, ServiceSupplier): self.ServiceSupplier = ServiceSupplier - def add_ServiceSupplier(self, value): self.ServiceSupplier.append(value) - def insert_ServiceSupplier_at(self, index, value): self.ServiceSupplier.insert(index, value) - def replace_ServiceSupplier_at(self, index, value): self.ServiceSupplier[index] = value - def hasContent_(self): - if ( - self.ServiceSupplier or - super(ServiceSupplierList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ServiceSupplierList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceSupplierList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ServiceSupplierList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ServiceSupplierList'): - super(ServiceSupplierList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceSupplierList') - def exportChildren(self, outfile, level, namespace_='', name_='ServiceSupplierList', fromsubclass_=False, pretty_print=True): - super(ServiceSupplierList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for ServiceSupplier_ in self.ServiceSupplier: - ServiceSupplier_.export(outfile, level, namespace_, name_='ServiceSupplier', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ServiceSupplierList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ServiceSupplierList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ServiceSupplierList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('ServiceSupplier=[\n') - level += 1 - for ServiceSupplier_ in self.ServiceSupplier: - showIndent(outfile, level) - outfile.write('model_.ServiceSupplier(\n') - ServiceSupplier_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ServiceSupplierList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ServiceSupplier': - obj_ = ServiceSupplier.factory() - obj_.build(child_) - self.ServiceSupplier.append(obj_) - obj_.original_tagname_ = 'ServiceSupplier' - super(ServiceSupplierList, self).buildChildren(child_, node, nodeName_, True) -# end class ServiceSupplierList - - -class ServiceSupplier(IdentifiedObject): - """Organisation that provides services to Customers.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, email=None, phone=None, providerID=None, web=None): - self.original_tagname_ = None - super(ServiceSupplier, self).__init__() - self.email = email - self.phone = phone - self.providerID = providerID - self.web = web - def factory(*args_, **kwargs_): - if ServiceSupplier.subclass: - return ServiceSupplier.subclass(*args_, **kwargs_) - else: - return ServiceSupplier(*args_, **kwargs_) - factory = staticmethod(factory) - def get_email(self): return self.email - def set_email(self, email): self.email = email - def get_phone(self): return self.phone - def set_phone(self, phone): self.phone = phone - def get_providerID(self): return self.providerID - def set_providerID(self, providerID): self.providerID = providerID - def get_web(self): return self.web - def set_web(self, web): self.web = web - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def validate_String20(self, value): - # Validate type String20, a restriction on xs:string. - pass - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_String42(self, value): - # Validate type String42, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.email is not None or - self.phone is not None or - self.providerID is not None or - self.web is not None or - super(ServiceSupplier, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ServiceSupplier', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceSupplier') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ServiceSupplier', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ServiceSupplier'): - super(ServiceSupplier, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ServiceSupplier') - def exportChildren(self, outfile, level, namespace_='', name_='ServiceSupplier', fromsubclass_=False, pretty_print=True): - super(ServiceSupplier, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.email is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%semail>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.email).encode(ExternalEncoding), input_name='email'), namespace_, eol_)) - if self.phone is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sphone>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.phone).encode(ExternalEncoding), input_name='phone'), namespace_, eol_)) - if self.providerID is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sproviderID>%s%s' % (namespace_, self.gds_format_integer(self.providerID, input_name='providerID'), namespace_, eol_)) - if self.web is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sweb>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.web).encode(ExternalEncoding), input_name='web'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ServiceSupplier'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ServiceSupplier, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ServiceSupplier, self).exportLiteralChildren(outfile, level, name_) - if self.email is not None: - showIndent(outfile, level) - outfile.write('email=%s,\n' % quote_python(self.email).encode(ExternalEncoding)) - if self.phone is not None: - showIndent(outfile, level) - outfile.write('phone=%s,\n' % quote_python(self.phone).encode(ExternalEncoding)) - if self.providerID is not None: - showIndent(outfile, level) - outfile.write('providerID=%d,\n' % self.providerID) - if self.web is not None: - showIndent(outfile, level) - outfile.write('web=%s,\n' % quote_python(self.web).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ServiceSupplier, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'email': - email_ = child_.text - email_ = self.gds_validate_string(email_, node, 'email') - self.email = email_ - self.validate_String32(self.email) # validate type String32 - elif nodeName_ == 'phone': - phone_ = child_.text - phone_ = self.gds_validate_string(phone_, node, 'phone') - self.phone = phone_ - self.validate_String20(self.phone) # validate type String20 - elif nodeName_ == 'providerID': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'providerID') - self.providerID = ival_ - self.validate_UInt32(self.providerID) # validate type UInt32 - elif nodeName_ == 'web': - web_ = child_.text - web_ = self.gds_validate_string(web_, node, 'web') - self.web = web_ - self.validate_String42(self.web) # validate type String42 - super(ServiceSupplier, self).buildChildren(child_, node, nodeName_, True) -# end class ServiceSupplier - - -class TargetReadingList(List): - """A List element to hold TargetReading objects.""" - subclass = None - superclass = List - def __init__(self, TargetReading=None): - self.original_tagname_ = None - super(TargetReadingList, self).__init__() - if TargetReading is None: - self.TargetReading = [] - else: - self.TargetReading = TargetReading - def factory(*args_, **kwargs_): - if TargetReadingList.subclass: - return TargetReadingList.subclass(*args_, **kwargs_) - else: - return TargetReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_TargetReading(self): return self.TargetReading - def set_TargetReading(self, TargetReading): self.TargetReading = TargetReading - def add_TargetReading(self, value): self.TargetReading.append(value) - def insert_TargetReading_at(self, index, value): self.TargetReading.insert(index, value) - def replace_TargetReading_at(self, index, value): self.TargetReading[index] = value - def hasContent_(self): - if ( - self.TargetReading or - super(TargetReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TargetReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TargetReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TargetReadingList'): - super(TargetReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='TargetReadingList', fromsubclass_=False, pretty_print=True): - super(TargetReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for TargetReading_ in self.TargetReading: - TargetReading_.export(outfile, level, namespace_, name_='TargetReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TargetReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TargetReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TargetReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('TargetReading=[\n') - level += 1 - for TargetReading_ in self.TargetReading: - showIndent(outfile, level) - outfile.write('model_.TargetReading(\n') - TargetReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TargetReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'TargetReading': - obj_ = TargetReading.factory() - obj_.build(child_) - self.TargetReading.append(obj_) - obj_.original_tagname_ = 'TargetReading' - super(TargetReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class TargetReadingList - - -class ProjectionReadingList(List): - """A List element to hold ProjectionReading objects.""" - subclass = None - superclass = List - def __init__(self, ProjectionReading=None): - self.original_tagname_ = None - super(ProjectionReadingList, self).__init__() - if ProjectionReading is None: - self.ProjectionReading = [] - else: - self.ProjectionReading = ProjectionReading - def factory(*args_, **kwargs_): - if ProjectionReadingList.subclass: - return ProjectionReadingList.subclass(*args_, **kwargs_) - else: - return ProjectionReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ProjectionReading(self): return self.ProjectionReading - def set_ProjectionReading(self, ProjectionReading): self.ProjectionReading = ProjectionReading - def add_ProjectionReading(self, value): self.ProjectionReading.append(value) - def insert_ProjectionReading_at(self, index, value): self.ProjectionReading.insert(index, value) - def replace_ProjectionReading_at(self, index, value): self.ProjectionReading[index] = value - def hasContent_(self): - if ( - self.ProjectionReading or - super(ProjectionReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ProjectionReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ProjectionReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ProjectionReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ProjectionReadingList'): - super(ProjectionReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ProjectionReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='ProjectionReadingList', fromsubclass_=False, pretty_print=True): - super(ProjectionReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for ProjectionReading_ in self.ProjectionReading: - ProjectionReading_.export(outfile, level, namespace_, name_='ProjectionReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ProjectionReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ProjectionReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ProjectionReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('ProjectionReading=[\n') - level += 1 - for ProjectionReading_ in self.ProjectionReading: - showIndent(outfile, level) - outfile.write('model_.ProjectionReading(\n') - ProjectionReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ProjectionReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ProjectionReading': - obj_ = ProjectionReading.factory() - obj_.build(child_) - self.ProjectionReading.append(obj_) - obj_.original_tagname_ = 'ProjectionReading' - super(ProjectionReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class ProjectionReadingList - - -class HistoricalReadingList(List): - """A List element to hold HistoricalReading objects.""" - subclass = None - superclass = List - def __init__(self, HistoricalReading=None): - self.original_tagname_ = None - super(HistoricalReadingList, self).__init__() - if HistoricalReading is None: - self.HistoricalReading = [] - else: - self.HistoricalReading = HistoricalReading - def factory(*args_, **kwargs_): - if HistoricalReadingList.subclass: - return HistoricalReadingList.subclass(*args_, **kwargs_) - else: - return HistoricalReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_HistoricalReading(self): return self.HistoricalReading - def set_HistoricalReading(self, HistoricalReading): self.HistoricalReading = HistoricalReading - def add_HistoricalReading(self, value): self.HistoricalReading.append(value) - def insert_HistoricalReading_at(self, index, value): self.HistoricalReading.insert(index, value) - def replace_HistoricalReading_at(self, index, value): self.HistoricalReading[index] = value - def hasContent_(self): - if ( - self.HistoricalReading or - super(HistoricalReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HistoricalReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HistoricalReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HistoricalReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HistoricalReadingList'): - super(HistoricalReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='HistoricalReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='HistoricalReadingList', fromsubclass_=False, pretty_print=True): - super(HistoricalReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for HistoricalReading_ in self.HistoricalReading: - HistoricalReading_.export(outfile, level, namespace_, name_='HistoricalReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='HistoricalReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(HistoricalReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(HistoricalReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('HistoricalReading=[\n') - level += 1 - for HistoricalReading_ in self.HistoricalReading: - showIndent(outfile, level) - outfile.write('model_.HistoricalReading(\n') - HistoricalReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(HistoricalReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'HistoricalReading': - obj_ = HistoricalReading.factory() - obj_.build(child_) - self.HistoricalReading.append(obj_) - obj_.original_tagname_ = 'HistoricalReading' - super(HistoricalReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class HistoricalReadingList - - -class CustomerAgreementList(SubscribableList): - """A List element to hold CustomerAgreement objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, CustomerAgreement=None): - self.original_tagname_ = None - super(CustomerAgreementList, self).__init__() - if CustomerAgreement is None: - self.CustomerAgreement = [] - else: - self.CustomerAgreement = CustomerAgreement - def factory(*args_, **kwargs_): - if CustomerAgreementList.subclass: - return CustomerAgreementList.subclass(*args_, **kwargs_) - else: - return CustomerAgreementList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_CustomerAgreement(self): return self.CustomerAgreement - def set_CustomerAgreement(self, CustomerAgreement): self.CustomerAgreement = CustomerAgreement - def add_CustomerAgreement(self, value): self.CustomerAgreement.append(value) - def insert_CustomerAgreement_at(self, index, value): self.CustomerAgreement.insert(index, value) - def replace_CustomerAgreement_at(self, index, value): self.CustomerAgreement[index] = value - def hasContent_(self): - if ( - self.CustomerAgreement or - super(CustomerAgreementList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAgreementList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAgreementList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAgreementList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAgreementList'): - super(CustomerAgreementList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAgreementList') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAgreementList', fromsubclass_=False, pretty_print=True): - super(CustomerAgreementList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for CustomerAgreement_ in self.CustomerAgreement: - CustomerAgreement_.export(outfile, level, namespace_, name_='CustomerAgreement', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CustomerAgreementList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAgreementList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAgreementList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('CustomerAgreement=[\n') - level += 1 - for CustomerAgreement_ in self.CustomerAgreement: - showIndent(outfile, level) - outfile.write('model_.CustomerAgreement(\n') - CustomerAgreement_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAgreementList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'CustomerAgreement': - obj_ = CustomerAgreement.factory() - obj_.build(child_) - self.CustomerAgreement.append(obj_) - obj_.original_tagname_ = 'CustomerAgreement' - super(CustomerAgreementList, self).buildChildren(child_, node, nodeName_, True) -# end class CustomerAgreementList - - -class CustomerAgreement(IdentifiedObject): - """Agreement between the customer and the service supplier to pay for - service at a specific service location. It records certain - billing information about the type of service provided at the - service location and is used during charge creation to determine - the type of service.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, ActiveBillingPeriodListLink=None, ActiveProjectionReadingListLink=None, ActiveTargetReadingListLink=None, BillingPeriodListLink=None, HistoricalReadingListLink=None, PrepaymentLink=None, ProjectionReadingListLink=None, serviceAccount=None, serviceLocation=None, TargetReadingListLink=None, TariffProfileLink=None, UsagePointLink=None): - self.original_tagname_ = None - super(CustomerAgreement, self).__init__() - self.ActiveBillingPeriodListLink = ActiveBillingPeriodListLink - self.ActiveProjectionReadingListLink = ActiveProjectionReadingListLink - self.ActiveTargetReadingListLink = ActiveTargetReadingListLink - self.BillingPeriodListLink = BillingPeriodListLink - self.HistoricalReadingListLink = HistoricalReadingListLink - self.PrepaymentLink = PrepaymentLink - self.ProjectionReadingListLink = ProjectionReadingListLink - self.serviceAccount = serviceAccount - self.serviceLocation = serviceLocation - self.TargetReadingListLink = TargetReadingListLink - self.TariffProfileLink = TariffProfileLink - self.UsagePointLink = UsagePointLink - def factory(*args_, **kwargs_): - if CustomerAgreement.subclass: - return CustomerAgreement.subclass(*args_, **kwargs_) - else: - return CustomerAgreement(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ActiveBillingPeriodListLink(self): return self.ActiveBillingPeriodListLink - def set_ActiveBillingPeriodListLink(self, ActiveBillingPeriodListLink): self.ActiveBillingPeriodListLink = ActiveBillingPeriodListLink - def get_ActiveProjectionReadingListLink(self): return self.ActiveProjectionReadingListLink - def set_ActiveProjectionReadingListLink(self, ActiveProjectionReadingListLink): self.ActiveProjectionReadingListLink = ActiveProjectionReadingListLink - def get_ActiveTargetReadingListLink(self): return self.ActiveTargetReadingListLink - def set_ActiveTargetReadingListLink(self, ActiveTargetReadingListLink): self.ActiveTargetReadingListLink = ActiveTargetReadingListLink - def get_BillingPeriodListLink(self): return self.BillingPeriodListLink - def set_BillingPeriodListLink(self, BillingPeriodListLink): self.BillingPeriodListLink = BillingPeriodListLink - def get_HistoricalReadingListLink(self): return self.HistoricalReadingListLink - def set_HistoricalReadingListLink(self, HistoricalReadingListLink): self.HistoricalReadingListLink = HistoricalReadingListLink - def get_PrepaymentLink(self): return self.PrepaymentLink - def set_PrepaymentLink(self, PrepaymentLink): self.PrepaymentLink = PrepaymentLink - def get_ProjectionReadingListLink(self): return self.ProjectionReadingListLink - def set_ProjectionReadingListLink(self, ProjectionReadingListLink): self.ProjectionReadingListLink = ProjectionReadingListLink - def get_serviceAccount(self): return self.serviceAccount - def set_serviceAccount(self, serviceAccount): self.serviceAccount = serviceAccount - def get_serviceLocation(self): return self.serviceLocation - def set_serviceLocation(self, serviceLocation): self.serviceLocation = serviceLocation - def get_TargetReadingListLink(self): return self.TargetReadingListLink - def set_TargetReadingListLink(self, TargetReadingListLink): self.TargetReadingListLink = TargetReadingListLink - def get_TariffProfileLink(self): return self.TariffProfileLink - def set_TariffProfileLink(self, TariffProfileLink): self.TariffProfileLink = TariffProfileLink - def get_UsagePointLink(self): return self.UsagePointLink - def set_UsagePointLink(self, UsagePointLink): self.UsagePointLink = UsagePointLink - def validate_String42(self, value): - # Validate type String42, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.ActiveBillingPeriodListLink is not None or - self.ActiveProjectionReadingListLink is not None or - self.ActiveTargetReadingListLink is not None or - self.BillingPeriodListLink is not None or - self.HistoricalReadingListLink is not None or - self.PrepaymentLink is not None or - self.ProjectionReadingListLink is not None or - self.serviceAccount is not None or - self.serviceLocation is not None or - self.TargetReadingListLink is not None or - self.TariffProfileLink is not None or - self.UsagePointLink is not None or - super(CustomerAgreement, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAgreement', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAgreement') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAgreement', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAgreement'): - super(CustomerAgreement, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAgreement') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAgreement', fromsubclass_=False, pretty_print=True): - super(CustomerAgreement, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ActiveBillingPeriodListLink is not None: - self.ActiveBillingPeriodListLink.export(outfile, level, namespace_, name_='ActiveBillingPeriodListLink', pretty_print=pretty_print) - if self.ActiveProjectionReadingListLink is not None: - self.ActiveProjectionReadingListLink.export(outfile, level, namespace_, name_='ActiveProjectionReadingListLink', pretty_print=pretty_print) - if self.ActiveTargetReadingListLink is not None: - self.ActiveTargetReadingListLink.export(outfile, level, namespace_, name_='ActiveTargetReadingListLink', pretty_print=pretty_print) - if self.BillingPeriodListLink is not None: - self.BillingPeriodListLink.export(outfile, level, namespace_, name_='BillingPeriodListLink', pretty_print=pretty_print) - if self.HistoricalReadingListLink is not None: - self.HistoricalReadingListLink.export(outfile, level, namespace_, name_='HistoricalReadingListLink', pretty_print=pretty_print) - if self.PrepaymentLink is not None: - self.PrepaymentLink.export(outfile, level, namespace_, name_='PrepaymentLink', pretty_print=pretty_print) - if self.ProjectionReadingListLink is not None: - self.ProjectionReadingListLink.export(outfile, level, namespace_, name_='ProjectionReadingListLink', pretty_print=pretty_print) - if self.serviceAccount is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sserviceAccount>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.serviceAccount).encode(ExternalEncoding), input_name='serviceAccount'), namespace_, eol_)) - if self.serviceLocation is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sserviceLocation>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.serviceLocation).encode(ExternalEncoding), input_name='serviceLocation'), namespace_, eol_)) - if self.TargetReadingListLink is not None: - self.TargetReadingListLink.export(outfile, level, namespace_, name_='TargetReadingListLink', pretty_print=pretty_print) - if self.TariffProfileLink is not None: - self.TariffProfileLink.export(outfile, level, namespace_, name_='TariffProfileLink', pretty_print=pretty_print) - if self.UsagePointLink is not None: - self.UsagePointLink.export(outfile, level, namespace_, name_='UsagePointLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CustomerAgreement'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAgreement, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAgreement, self).exportLiteralChildren(outfile, level, name_) - if self.ActiveBillingPeriodListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveBillingPeriodListLink=model_.ActiveBillingPeriodListLink(\n') - self.ActiveBillingPeriodListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ActiveProjectionReadingListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveProjectionReadingListLink=model_.ActiveProjectionReadingListLink(\n') - self.ActiveProjectionReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ActiveTargetReadingListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveTargetReadingListLink=model_.ActiveTargetReadingListLink(\n') - self.ActiveTargetReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.BillingPeriodListLink is not None: - showIndent(outfile, level) - outfile.write('BillingPeriodListLink=model_.BillingPeriodListLink(\n') - self.BillingPeriodListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.HistoricalReadingListLink is not None: - showIndent(outfile, level) - outfile.write('HistoricalReadingListLink=model_.HistoricalReadingListLink(\n') - self.HistoricalReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.PrepaymentLink is not None: - showIndent(outfile, level) - outfile.write('PrepaymentLink=model_.PrepaymentLink(\n') - self.PrepaymentLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ProjectionReadingListLink is not None: - showIndent(outfile, level) - outfile.write('ProjectionReadingListLink=model_.ProjectionReadingListLink(\n') - self.ProjectionReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.serviceAccount is not None: - showIndent(outfile, level) - outfile.write('serviceAccount=%s,\n' % quote_python(self.serviceAccount).encode(ExternalEncoding)) - if self.serviceLocation is not None: - showIndent(outfile, level) - outfile.write('serviceLocation=%s,\n' % quote_python(self.serviceLocation).encode(ExternalEncoding)) - if self.TargetReadingListLink is not None: - showIndent(outfile, level) - outfile.write('TargetReadingListLink=model_.TargetReadingListLink(\n') - self.TargetReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.TariffProfileLink is not None: - showIndent(outfile, level) - outfile.write('TariffProfileLink=model_.TariffProfileLink(\n') - self.TariffProfileLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.UsagePointLink is not None: - showIndent(outfile, level) - outfile.write('UsagePointLink=model_.UsagePointLink(\n') - self.UsagePointLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAgreement, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ActiveBillingPeriodListLink': - obj_ = ActiveBillingPeriodListLink.factory() - obj_.build(child_) - self.ActiveBillingPeriodListLink = obj_ - obj_.original_tagname_ = 'ActiveBillingPeriodListLink' - elif nodeName_ == 'ActiveProjectionReadingListLink': - obj_ = ActiveProjectionReadingListLink.factory() - obj_.build(child_) - self.ActiveProjectionReadingListLink = obj_ - obj_.original_tagname_ = 'ActiveProjectionReadingListLink' - elif nodeName_ == 'ActiveTargetReadingListLink': - obj_ = ActiveTargetReadingListLink.factory() - obj_.build(child_) - self.ActiveTargetReadingListLink = obj_ - obj_.original_tagname_ = 'ActiveTargetReadingListLink' - elif nodeName_ == 'BillingPeriodListLink': - obj_ = BillingPeriodListLink.factory() - obj_.build(child_) - self.BillingPeriodListLink = obj_ - obj_.original_tagname_ = 'BillingPeriodListLink' - elif nodeName_ == 'HistoricalReadingListLink': - obj_ = HistoricalReadingListLink.factory() - obj_.build(child_) - self.HistoricalReadingListLink = obj_ - obj_.original_tagname_ = 'HistoricalReadingListLink' - elif nodeName_ == 'PrepaymentLink': - obj_ = PrepaymentLink.factory() - obj_.build(child_) - self.PrepaymentLink = obj_ - obj_.original_tagname_ = 'PrepaymentLink' - elif nodeName_ == 'ProjectionReadingListLink': - obj_ = ProjectionReadingListLink.factory() - obj_.build(child_) - self.ProjectionReadingListLink = obj_ - obj_.original_tagname_ = 'ProjectionReadingListLink' - elif nodeName_ == 'serviceAccount': - serviceAccount_ = child_.text - serviceAccount_ = self.gds_validate_string(serviceAccount_, node, 'serviceAccount') - self.serviceAccount = serviceAccount_ - self.validate_String42(self.serviceAccount) # validate type String42 - elif nodeName_ == 'serviceLocation': - serviceLocation_ = child_.text - serviceLocation_ = self.gds_validate_string(serviceLocation_, node, 'serviceLocation') - self.serviceLocation = serviceLocation_ - self.validate_String42(self.serviceLocation) # validate type String42 - elif nodeName_ == 'TargetReadingListLink': - obj_ = TargetReadingListLink.factory() - obj_.build(child_) - self.TargetReadingListLink = obj_ - obj_.original_tagname_ = 'TargetReadingListLink' - elif nodeName_ == 'TariffProfileLink': - obj_ = TariffProfileLink.factory() - obj_.build(child_) - self.TariffProfileLink = obj_ - obj_.original_tagname_ = 'TariffProfileLink' - elif nodeName_ == 'UsagePointLink': - obj_ = UsagePointLink.factory() - obj_.build(child_) - self.UsagePointLink = obj_ - obj_.original_tagname_ = 'UsagePointLink' - super(CustomerAgreement, self).buildChildren(child_, node, nodeName_, True) -# end class CustomerAgreement - - -class CustomerAccountList(SubscribableList): - """A List element to hold CustomerAccount objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, CustomerAccount=None): - self.original_tagname_ = None - super(CustomerAccountList, self).__init__() - if CustomerAccount is None: - self.CustomerAccount = [] - else: - self.CustomerAccount = CustomerAccount - def factory(*args_, **kwargs_): - if CustomerAccountList.subclass: - return CustomerAccountList.subclass(*args_, **kwargs_) - else: - return CustomerAccountList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_CustomerAccount(self): return self.CustomerAccount - def set_CustomerAccount(self, CustomerAccount): self.CustomerAccount = CustomerAccount - def add_CustomerAccount(self, value): self.CustomerAccount.append(value) - def insert_CustomerAccount_at(self, index, value): self.CustomerAccount.insert(index, value) - def replace_CustomerAccount_at(self, index, value): self.CustomerAccount[index] = value - def hasContent_(self): - if ( - self.CustomerAccount or - super(CustomerAccountList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAccountList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccountList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAccountList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAccountList'): - super(CustomerAccountList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccountList') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAccountList', fromsubclass_=False, pretty_print=True): - super(CustomerAccountList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for CustomerAccount_ in self.CustomerAccount: - CustomerAccount_.export(outfile, level, namespace_, name_='CustomerAccount', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CustomerAccountList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAccountList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAccountList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('CustomerAccount=[\n') - level += 1 - for CustomerAccount_ in self.CustomerAccount: - showIndent(outfile, level) - outfile.write('model_.CustomerAccount(\n') - CustomerAccount_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAccountList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'CustomerAccount': - obj_ = CustomerAccount.factory() - obj_.build(child_) - self.CustomerAccount.append(obj_) - obj_.original_tagname_ = 'CustomerAccount' - super(CustomerAccountList, self).buildChildren(child_, node, nodeName_, True) -# end class CustomerAccountList - - -class CustomerAccount(IdentifiedObject): - """Assignment of a group of products and services purchased by the - Customer through a CustomerAgreement, used as a mechanism for - customer billing and payment. It contains common information - from the various types of CustomerAgreements to create billings - (invoices) for a Customer and receive payment.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, currency=None, customerAccount=None, CustomerAgreementListLink=None, customerName=None, pricePowerOfTenMultiplier=None, ServiceSupplierLink=None): - self.original_tagname_ = None - super(CustomerAccount, self).__init__() - self.currency = currency - self.customerAccount = customerAccount - self.CustomerAgreementListLink = CustomerAgreementListLink - self.customerName = customerName - self.pricePowerOfTenMultiplier = pricePowerOfTenMultiplier - self.ServiceSupplierLink = ServiceSupplierLink - def factory(*args_, **kwargs_): - if CustomerAccount.subclass: - return CustomerAccount.subclass(*args_, **kwargs_) - else: - return CustomerAccount(*args_, **kwargs_) - factory = staticmethod(factory) - def get_currency(self): return self.currency - def set_currency(self, currency): self.currency = currency - def get_customerAccount(self): return self.customerAccount - def set_customerAccount(self, customerAccount): self.customerAccount = customerAccount - def get_CustomerAgreementListLink(self): return self.CustomerAgreementListLink - def set_CustomerAgreementListLink(self, CustomerAgreementListLink): self.CustomerAgreementListLink = CustomerAgreementListLink - def get_customerName(self): return self.customerName - def set_customerName(self, customerName): self.customerName = customerName - def get_pricePowerOfTenMultiplier(self): return self.pricePowerOfTenMultiplier - def set_pricePowerOfTenMultiplier(self, pricePowerOfTenMultiplier): self.pricePowerOfTenMultiplier = pricePowerOfTenMultiplier - def get_ServiceSupplierLink(self): return self.ServiceSupplierLink - def set_ServiceSupplierLink(self, ServiceSupplierLink): self.ServiceSupplierLink = ServiceSupplierLink - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def validate_String42(self, value): - # Validate type String42, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.currency is not None or - self.customerAccount is not None or - self.CustomerAgreementListLink is not None or - self.customerName is not None or - self.pricePowerOfTenMultiplier is not None or - self.ServiceSupplierLink is not None or - super(CustomerAccount, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='CustomerAccount', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccount') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='CustomerAccount', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='CustomerAccount'): - super(CustomerAccount, self).exportAttributes(outfile, level, already_processed, namespace_, name_='CustomerAccount') - def exportChildren(self, outfile, level, namespace_='', name_='CustomerAccount', fromsubclass_=False, pretty_print=True): - super(CustomerAccount, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.currency is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scurrency>%s%s' % (namespace_, self.gds_format_integer(self.currency, input_name='currency'), namespace_, eol_)) - if self.customerAccount is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scustomerAccount>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.customerAccount).encode(ExternalEncoding), input_name='customerAccount'), namespace_, eol_)) - if self.CustomerAgreementListLink is not None: - self.CustomerAgreementListLink.export(outfile, level, namespace_, name_='CustomerAgreementListLink', pretty_print=pretty_print) - if self.customerName is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%scustomerName>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.customerName).encode(ExternalEncoding), input_name='customerName'), namespace_, eol_)) - if self.pricePowerOfTenMultiplier is not None: - self.pricePowerOfTenMultiplier.export(outfile, level, namespace_, name_='pricePowerOfTenMultiplier', pretty_print=pretty_print) - if self.ServiceSupplierLink is not None: - self.ServiceSupplierLink.export(outfile, level, namespace_, name_='ServiceSupplierLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='CustomerAccount'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(CustomerAccount, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(CustomerAccount, self).exportLiteralChildren(outfile, level, name_) - if self.currency is not None: - showIndent(outfile, level) - outfile.write('currency=%d,\n' % self.currency) - if self.customerAccount is not None: - showIndent(outfile, level) - outfile.write('customerAccount=%s,\n' % quote_python(self.customerAccount).encode(ExternalEncoding)) - if self.CustomerAgreementListLink is not None: - showIndent(outfile, level) - outfile.write('CustomerAgreementListLink=model_.CustomerAgreementListLink(\n') - self.CustomerAgreementListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.customerName is not None: - showIndent(outfile, level) - outfile.write('customerName=%s,\n' % quote_python(self.customerName).encode(ExternalEncoding)) - if self.pricePowerOfTenMultiplier is not None: - showIndent(outfile, level) - outfile.write('pricePowerOfTenMultiplier=model_.PowerOfTenMultiplierType(\n') - self.pricePowerOfTenMultiplier.exportLiteral(outfile, level, name_='pricePowerOfTenMultiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.ServiceSupplierLink is not None: - showIndent(outfile, level) - outfile.write('ServiceSupplierLink=model_.ServiceSupplierLink(\n') - self.ServiceSupplierLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(CustomerAccount, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'currency': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'currency') - self.currency = ival_ - self.validate_UInt16(self.currency) # validate type UInt16 - elif nodeName_ == 'customerAccount': - customerAccount_ = child_.text - customerAccount_ = self.gds_validate_string(customerAccount_, node, 'customerAccount') - self.customerAccount = customerAccount_ - self.validate_String42(self.customerAccount) # validate type String42 - elif nodeName_ == 'CustomerAgreementListLink': - obj_ = CustomerAgreementListLink.factory() - obj_.build(child_) - self.CustomerAgreementListLink = obj_ - obj_.original_tagname_ = 'CustomerAgreementListLink' - elif nodeName_ == 'customerName': - customerName_ = child_.text - customerName_ = self.gds_validate_string(customerName_, node, 'customerName') - self.customerName = customerName_ - self.validate_String42(self.customerName) # validate type String42 - elif nodeName_ == 'pricePowerOfTenMultiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.pricePowerOfTenMultiplier = obj_ - obj_.original_tagname_ = 'pricePowerOfTenMultiplier' - elif nodeName_ == 'ServiceSupplierLink': - obj_ = ServiceSupplierLink.factory() - obj_.build(child_) - self.ServiceSupplierLink = obj_ - obj_.original_tagname_ = 'ServiceSupplierLink' - super(CustomerAccount, self).buildChildren(child_, node, nodeName_, True) -# end class CustomerAccount - - -class BillingReadingSetList(SubscribableList): - """A List element to hold BillingReadingSet objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, BillingReadingSet=None): - self.original_tagname_ = None - super(BillingReadingSetList, self).__init__() - if BillingReadingSet is None: - self.BillingReadingSet = [] - else: - self.BillingReadingSet = BillingReadingSet - def factory(*args_, **kwargs_): - if BillingReadingSetList.subclass: - return BillingReadingSetList.subclass(*args_, **kwargs_) - else: - return BillingReadingSetList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_BillingReadingSet(self): return self.BillingReadingSet - def set_BillingReadingSet(self, BillingReadingSet): self.BillingReadingSet = BillingReadingSet - def add_BillingReadingSet(self, value): self.BillingReadingSet.append(value) - def insert_BillingReadingSet_at(self, index, value): self.BillingReadingSet.insert(index, value) - def replace_BillingReadingSet_at(self, index, value): self.BillingReadingSet[index] = value - def hasContent_(self): - if ( - self.BillingReadingSet or - super(BillingReadingSetList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingReadingSetList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingSetList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingReadingSetList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingReadingSetList'): - super(BillingReadingSetList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingSetList') - def exportChildren(self, outfile, level, namespace_='', name_='BillingReadingSetList', fromsubclass_=False, pretty_print=True): - super(BillingReadingSetList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for BillingReadingSet_ in self.BillingReadingSet: - BillingReadingSet_.export(outfile, level, namespace_, name_='BillingReadingSet', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingReadingSetList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingReadingSetList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingReadingSetList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('BillingReadingSet=[\n') - level += 1 - for BillingReadingSet_ in self.BillingReadingSet: - showIndent(outfile, level) - outfile.write('model_.BillingReadingSet(\n') - BillingReadingSet_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingReadingSetList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'BillingReadingSet': - obj_ = BillingReadingSet.factory() - obj_.build(child_) - self.BillingReadingSet.append(obj_) - obj_.original_tagname_ = 'BillingReadingSet' - super(BillingReadingSetList, self).buildChildren(child_, node, nodeName_, True) -# end class BillingReadingSetList - - -class BillingReadingList(List): - """A List element to hold BillingReading objects.""" - subclass = None - superclass = List - def __init__(self, BillingReading=None): - self.original_tagname_ = None - super(BillingReadingList, self).__init__() - if BillingReading is None: - self.BillingReading = [] - else: - self.BillingReading = BillingReading - def factory(*args_, **kwargs_): - if BillingReadingList.subclass: - return BillingReadingList.subclass(*args_, **kwargs_) - else: - return BillingReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_BillingReading(self): return self.BillingReading - def set_BillingReading(self, BillingReading): self.BillingReading = BillingReading - def add_BillingReading(self, value): self.BillingReading.append(value) - def insert_BillingReading_at(self, index, value): self.BillingReading.insert(index, value) - def replace_BillingReading_at(self, index, value): self.BillingReading[index] = value - def hasContent_(self): - if ( - self.BillingReading or - super(BillingReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingReadingList'): - super(BillingReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='BillingReadingList', fromsubclass_=False, pretty_print=True): - super(BillingReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for BillingReading_ in self.BillingReading: - BillingReading_.export(outfile, level, namespace_, name_='BillingReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('BillingReading=[\n') - level += 1 - for BillingReading_ in self.BillingReading: - showIndent(outfile, level) - outfile.write('model_.BillingReading(\n') - BillingReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'BillingReading': - obj_ = BillingReading.factory() - obj_.build(child_) - self.BillingReading.append(obj_) - obj_.original_tagname_ = 'BillingReading' - super(BillingReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class BillingReadingList - - -class BillingReading(ReadingBase): - """Data captured at regular intervals of time. Interval data could be - captured as incremental data, absolute data, or relative data. - The source for the data is usually a tariff quantity or an - engineering quantity. Data is typically captured in time-tagged, - uniform, fixed-length intervals of 5 min, 10 min, 15 min, 30 - min, or 60 min. However, consumption aggregations can also be - represented with this class.""" - subclass = None - superclass = ReadingBase - def __init__(self, Charge=None): - self.original_tagname_ = None - super(BillingReading, self).__init__() - if Charge is None: - self.Charge = [] - else: - self.Charge = Charge - def factory(*args_, **kwargs_): - if BillingReading.subclass: - return BillingReading.subclass(*args_, **kwargs_) - else: - return BillingReading(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Charge(self): return self.Charge - def set_Charge(self, Charge): self.Charge = Charge - def add_Charge(self, value): self.Charge.append(value) - def insert_Charge_at(self, index, value): self.Charge.insert(index, value) - def replace_Charge_at(self, index, value): self.Charge[index] = value - def hasContent_(self): - if ( - self.Charge or - super(BillingReading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingReading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingReading', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingReading'): - super(BillingReading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReading') - def exportChildren(self, outfile, level, namespace_='', name_='BillingReading', fromsubclass_=False, pretty_print=True): - super(BillingReading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Charge_ in self.Charge: - Charge_.export(outfile, level, namespace_, name_='Charge', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingReading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingReading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingReading, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Charge=[\n') - level += 1 - for Charge_ in self.Charge: - showIndent(outfile, level) - outfile.write('model_.Charge(\n') - Charge_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingReading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Charge': - obj_ = Charge.factory() - obj_.build(child_) - self.Charge.append(obj_) - obj_.original_tagname_ = 'Charge' - super(BillingReading, self).buildChildren(child_, node, nodeName_, True) -# end class BillingReading - - -class BillingPeriodList(SubscribableList): - """A List element to hold BillingPeriod objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, BillingPeriod=None): - self.original_tagname_ = None - super(BillingPeriodList, self).__init__() - if BillingPeriod is None: - self.BillingPeriod = [] - else: - self.BillingPeriod = BillingPeriod - def factory(*args_, **kwargs_): - if BillingPeriodList.subclass: - return BillingPeriodList.subclass(*args_, **kwargs_) - else: - return BillingPeriodList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_BillingPeriod(self): return self.BillingPeriod - def set_BillingPeriod(self, BillingPeriod): self.BillingPeriod = BillingPeriod - def add_BillingPeriod(self, value): self.BillingPeriod.append(value) - def insert_BillingPeriod_at(self, index, value): self.BillingPeriod.insert(index, value) - def replace_BillingPeriod_at(self, index, value): self.BillingPeriod[index] = value - def hasContent_(self): - if ( - self.BillingPeriod or - super(BillingPeriodList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingPeriodList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingPeriodList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingPeriodList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingPeriodList'): - super(BillingPeriodList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingPeriodList') - def exportChildren(self, outfile, level, namespace_='', name_='BillingPeriodList', fromsubclass_=False, pretty_print=True): - super(BillingPeriodList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for BillingPeriod_ in self.BillingPeriod: - BillingPeriod_.export(outfile, level, namespace_, name_='BillingPeriod', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingPeriodList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingPeriodList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingPeriodList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('BillingPeriod=[\n') - level += 1 - for BillingPeriod_ in self.BillingPeriod: - showIndent(outfile, level) - outfile.write('model_.BillingPeriod(\n') - BillingPeriod_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingPeriodList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'BillingPeriod': - obj_ = BillingPeriod.factory() - obj_.build(child_) - self.BillingPeriod.append(obj_) - obj_.original_tagname_ = 'BillingPeriod' - super(BillingPeriodList, self).buildChildren(child_, node, nodeName_, True) -# end class BillingPeriodList - - -class BillingPeriod(Resource): - """A Billing Period relates to the period of time on which a customer - is billed. As an example the billing period interval for a - particular customer might be 31 days starting on July 1, 2011. - The start date and interval can change on each billing period. - There may also be multiple billing periods related to a customer - agreement to support different tariff structures.""" - subclass = None - superclass = Resource - def __init__(self, billLastPeriod=None, billToDate=None, interval=None, statusTimeStamp=None): - self.original_tagname_ = None - super(BillingPeriod, self).__init__() - self.billLastPeriod = billLastPeriod - self.billToDate = billToDate - self.interval = interval - self.statusTimeStamp = statusTimeStamp - def factory(*args_, **kwargs_): - if BillingPeriod.subclass: - return BillingPeriod.subclass(*args_, **kwargs_) - else: - return BillingPeriod(*args_, **kwargs_) - factory = staticmethod(factory) - def get_billLastPeriod(self): return self.billLastPeriod - def set_billLastPeriod(self, billLastPeriod): self.billLastPeriod = billLastPeriod - def get_billToDate(self): return self.billToDate - def set_billToDate(self, billToDate): self.billToDate = billToDate - def get_interval(self): return self.interval - def set_interval(self, interval): self.interval = interval - def get_statusTimeStamp(self): return self.statusTimeStamp - def set_statusTimeStamp(self, statusTimeStamp): self.statusTimeStamp = statusTimeStamp - def validate_Int48(self, value): - # Validate type Int48, a restriction on xs:long. - pass - def hasContent_(self): - if ( - self.billLastPeriod is not None or - self.billToDate is not None or - self.interval is not None or - self.statusTimeStamp is not None or - super(BillingPeriod, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingPeriod', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingPeriod') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingPeriod', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingPeriod'): - super(BillingPeriod, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingPeriod') - def exportChildren(self, outfile, level, namespace_='', name_='BillingPeriod', fromsubclass_=False, pretty_print=True): - super(BillingPeriod, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.billLastPeriod is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sbillLastPeriod>%s%s' % (namespace_, self.gds_format_integer(self.billLastPeriod, input_name='billLastPeriod'), namespace_, eol_)) - if self.billToDate is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sbillToDate>%s%s' % (namespace_, self.gds_format_integer(self.billToDate, input_name='billToDate'), namespace_, eol_)) - if self.interval is not None: - self.interval.export(outfile, level, namespace_, name_='interval', pretty_print=pretty_print) - if self.statusTimeStamp is not None: - self.statusTimeStamp.export(outfile, level, namespace_, name_='statusTimeStamp', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingPeriod'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingPeriod, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingPeriod, self).exportLiteralChildren(outfile, level, name_) - if self.billLastPeriod is not None: - showIndent(outfile, level) - outfile.write('billLastPeriod=%d,\n' % self.billLastPeriod) - if self.billToDate is not None: - showIndent(outfile, level) - outfile.write('billToDate=%d,\n' % self.billToDate) - if self.interval is not None: - showIndent(outfile, level) - outfile.write('interval=model_.DateTimeInterval(\n') - self.interval.exportLiteral(outfile, level, name_='interval') - showIndent(outfile, level) - outfile.write('),\n') - if self.statusTimeStamp is not None: - showIndent(outfile, level) - outfile.write('statusTimeStamp=model_.TimeType(\n') - self.statusTimeStamp.exportLiteral(outfile, level, name_='statusTimeStamp') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingPeriod, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'billLastPeriod': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'billLastPeriod') - self.billLastPeriod = ival_ - self.validate_Int48(self.billLastPeriod) # validate type Int48 - elif nodeName_ == 'billToDate': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'billToDate') - self.billToDate = ival_ - self.validate_Int48(self.billToDate) # validate type Int48 - elif nodeName_ == 'interval': - obj_ = DateTimeInterval.factory() - obj_.build(child_) - self.interval = obj_ - obj_.original_tagname_ = 'interval' - elif nodeName_ == 'statusTimeStamp': - obj_ = TimeType.factory() - obj_.build(child_) - self.statusTimeStamp = obj_ - obj_.original_tagname_ = 'statusTimeStamp' - super(BillingPeriod, self).buildChildren(child_, node, nodeName_, True) -# end class BillingPeriod - - -class TextMessageList(SubscribableList): - """A List element to hold TextMessage objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, TextMessage=None): - self.original_tagname_ = None - super(TextMessageList, self).__init__() - if TextMessage is None: - self.TextMessage = [] - else: - self.TextMessage = TextMessage - def factory(*args_, **kwargs_): - if TextMessageList.subclass: - return TextMessageList.subclass(*args_, **kwargs_) - else: - return TextMessageList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_TextMessage(self): return self.TextMessage - def set_TextMessage(self, TextMessage): self.TextMessage = TextMessage - def add_TextMessage(self, value): self.TextMessage.append(value) - def insert_TextMessage_at(self, index, value): self.TextMessage.insert(index, value) - def replace_TextMessage_at(self, index, value): self.TextMessage[index] = value - def hasContent_(self): - if ( - self.TextMessage or - super(TextMessageList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TextMessageList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TextMessageList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TextMessageList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TextMessageList'): - super(TextMessageList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TextMessageList') - def exportChildren(self, outfile, level, namespace_='', name_='TextMessageList', fromsubclass_=False, pretty_print=True): - super(TextMessageList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for TextMessage_ in self.TextMessage: - TextMessage_.export(outfile, level, namespace_, name_='TextMessage', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TextMessageList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TextMessageList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TextMessageList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('TextMessage=[\n') - level += 1 - for TextMessage_ in self.TextMessage: - showIndent(outfile, level) - outfile.write('model_.TextMessage(\n') - TextMessage_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TextMessageList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'TextMessage': - obj_ = TextMessage.factory() - obj_.build(child_) - self.TextMessage.append(obj_) - obj_.original_tagname_ = 'TextMessage' - super(TextMessageList, self).buildChildren(child_, node, nodeName_, True) -# end class TextMessageList - - -class TextMessage(Event): - """Text message such as a notification.""" - subclass = None - superclass = Event - def __init__(self, originator=None, priority=None, textMessage=None): - self.original_tagname_ = None - super(TextMessage, self).__init__() - self.originator = originator - self.priority = priority - self.textMessage = textMessage - def factory(*args_, **kwargs_): - if TextMessage.subclass: - return TextMessage.subclass(*args_, **kwargs_) - else: - return TextMessage(*args_, **kwargs_) - factory = staticmethod(factory) - def get_originator(self): return self.originator - def set_originator(self, originator): self.originator = originator - def get_priority(self): return self.priority - def set_priority(self, priority): self.priority = priority - def get_textMessage(self): return self.textMessage - def set_textMessage(self, textMessage): self.textMessage = textMessage - def validate_String20(self, value): - # Validate type String20, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.originator is not None or - self.priority is not None or - self.textMessage is not None or - super(TextMessage, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TextMessage', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TextMessage') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TextMessage', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TextMessage'): - super(TextMessage, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TextMessage') - def exportChildren(self, outfile, level, namespace_='', name_='TextMessage', fromsubclass_=False, pretty_print=True): - super(TextMessage, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.originator is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%soriginator>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.originator).encode(ExternalEncoding), input_name='originator'), namespace_, eol_)) - if self.priority is not None: - self.priority.export(outfile, level, namespace_, name_='priority', pretty_print=pretty_print) - if self.textMessage is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%stextMessage>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.textMessage).encode(ExternalEncoding), input_name='textMessage'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='TextMessage'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TextMessage, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TextMessage, self).exportLiteralChildren(outfile, level, name_) - if self.originator is not None: - showIndent(outfile, level) - outfile.write('originator=%s,\n' % quote_python(self.originator).encode(ExternalEncoding)) - if self.priority is not None: - showIndent(outfile, level) - outfile.write('priority=model_.PriorityType(\n') - self.priority.exportLiteral(outfile, level, name_='priority') - showIndent(outfile, level) - outfile.write('),\n') - if self.textMessage is not None: - showIndent(outfile, level) - outfile.write('textMessage=%s,\n' % quote_python(self.textMessage).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TextMessage, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'originator': - originator_ = child_.text - originator_ = self.gds_validate_string(originator_, node, 'originator') - self.originator = originator_ - self.validate_String20(self.originator) # validate type String20 - elif nodeName_ == 'priority': - obj_ = PriorityType.factory() - obj_.build(child_) - self.priority = obj_ - obj_.original_tagname_ = 'priority' - elif nodeName_ == 'textMessage': - textMessage_ = child_.text - textMessage_ = self.gds_validate_string(textMessage_, node, 'textMessage') - self.textMessage = textMessage_ - super(TextMessage, self).buildChildren(child_, node, nodeName_, True) -# end class TextMessage - - -class MessagingProgramList(SubscribableList): - """A List element to hold MessagingProgram objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, MessagingProgram=None): - self.original_tagname_ = None - super(MessagingProgramList, self).__init__() - if MessagingProgram is None: - self.MessagingProgram = [] - else: - self.MessagingProgram = MessagingProgram - def factory(*args_, **kwargs_): - if MessagingProgramList.subclass: - return MessagingProgramList.subclass(*args_, **kwargs_) - else: - return MessagingProgramList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_MessagingProgram(self): return self.MessagingProgram - def set_MessagingProgram(self, MessagingProgram): self.MessagingProgram = MessagingProgram - def add_MessagingProgram(self, value): self.MessagingProgram.append(value) - def insert_MessagingProgram_at(self, index, value): self.MessagingProgram.insert(index, value) - def replace_MessagingProgram_at(self, index, value): self.MessagingProgram[index] = value - def hasContent_(self): - if ( - self.MessagingProgram or - super(MessagingProgramList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MessagingProgramList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MessagingProgramList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MessagingProgramList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MessagingProgramList'): - super(MessagingProgramList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MessagingProgramList') - def exportChildren(self, outfile, level, namespace_='', name_='MessagingProgramList', fromsubclass_=False, pretty_print=True): - super(MessagingProgramList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for MessagingProgram_ in self.MessagingProgram: - MessagingProgram_.export(outfile, level, namespace_, name_='MessagingProgram', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MessagingProgramList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MessagingProgramList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MessagingProgramList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('MessagingProgram=[\n') - level += 1 - for MessagingProgram_ in self.MessagingProgram: - showIndent(outfile, level) - outfile.write('model_.MessagingProgram(\n') - MessagingProgram_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MessagingProgramList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'MessagingProgram': - obj_ = MessagingProgram.factory() - obj_.build(child_) - self.MessagingProgram.append(obj_) - obj_.original_tagname_ = 'MessagingProgram' - super(MessagingProgramList, self).buildChildren(child_, node, nodeName_, True) -# end class MessagingProgramList - - -class MessagingProgram(SubscribableIdentifiedObject): - """Provides a container for collections of text messages.""" - subclass = None - superclass = SubscribableIdentifiedObject - def __init__(self, ActiveTextMessageListLink=None, locale=None, primacy=None, TextMessageListLink=None): - self.original_tagname_ = None - super(MessagingProgram, self).__init__() - self.ActiveTextMessageListLink = ActiveTextMessageListLink - self.locale = locale - self.primacy = primacy - self.TextMessageListLink = TextMessageListLink - def factory(*args_, **kwargs_): - if MessagingProgram.subclass: - return MessagingProgram.subclass(*args_, **kwargs_) - else: - return MessagingProgram(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ActiveTextMessageListLink(self): return self.ActiveTextMessageListLink - def set_ActiveTextMessageListLink(self, ActiveTextMessageListLink): self.ActiveTextMessageListLink = ActiveTextMessageListLink - def get_locale(self): return self.locale - def set_locale(self, locale): self.locale = locale - def get_primacy(self): return self.primacy - def set_primacy(self, primacy): self.primacy = primacy - def get_TextMessageListLink(self): return self.TextMessageListLink - def set_TextMessageListLink(self, TextMessageListLink): self.TextMessageListLink = TextMessageListLink - def hasContent_(self): - if ( - self.ActiveTextMessageListLink is not None or - self.locale is not None or - self.primacy is not None or - self.TextMessageListLink is not None or - super(MessagingProgram, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MessagingProgram', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MessagingProgram') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MessagingProgram', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MessagingProgram'): - super(MessagingProgram, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MessagingProgram') - def exportChildren(self, outfile, level, namespace_='', name_='MessagingProgram', fromsubclass_=False, pretty_print=True): - super(MessagingProgram, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ActiveTextMessageListLink is not None: - self.ActiveTextMessageListLink.export(outfile, level, namespace_, name_='ActiveTextMessageListLink', pretty_print=pretty_print) - if self.locale is not None: - self.locale.export(outfile, level, namespace_, name_='locale', pretty_print=pretty_print) - if self.primacy is not None: - self.primacy.export(outfile, level, namespace_, name_='primacy', pretty_print=pretty_print) - if self.TextMessageListLink is not None: - self.TextMessageListLink.export(outfile, level, namespace_, name_='TextMessageListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MessagingProgram'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MessagingProgram, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MessagingProgram, self).exportLiteralChildren(outfile, level, name_) - if self.ActiveTextMessageListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveTextMessageListLink=model_.ActiveTextMessageListLink(\n') - self.ActiveTextMessageListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.locale is not None: - showIndent(outfile, level) - outfile.write('locale=model_.LocaleType(\n') - self.locale.exportLiteral(outfile, level, name_='locale') - showIndent(outfile, level) - outfile.write('),\n') - if self.primacy is not None: - showIndent(outfile, level) - outfile.write('primacy=model_.PrimacyType(\n') - self.primacy.exportLiteral(outfile, level, name_='primacy') - showIndent(outfile, level) - outfile.write('),\n') - if self.TextMessageListLink is not None: - showIndent(outfile, level) - outfile.write('TextMessageListLink=model_.TextMessageListLink(\n') - self.TextMessageListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MessagingProgram, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ActiveTextMessageListLink': - obj_ = ActiveTextMessageListLink.factory() - obj_.build(child_) - self.ActiveTextMessageListLink = obj_ - obj_.original_tagname_ = 'ActiveTextMessageListLink' - elif nodeName_ == 'locale': - obj_ = LocaleType.factory() - obj_.build(child_) - self.locale = obj_ - obj_.original_tagname_ = 'locale' - elif nodeName_ == 'primacy': - obj_ = PrimacyType.factory() - obj_.build(child_) - self.primacy = obj_ - obj_.original_tagname_ = 'primacy' - elif nodeName_ == 'TextMessageListLink': - obj_ = TextMessageListLink.factory() - obj_.build(child_) - self.TextMessageListLink = obj_ - obj_.original_tagname_ = 'TextMessageListLink' - super(MessagingProgram, self).buildChildren(child_, node, nodeName_, True) -# end class MessagingProgram - - -class TimeTariffIntervalList(SubscribableList): - """A List element to hold TimeTariffInterval objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, TimeTariffInterval=None): - self.original_tagname_ = None - super(TimeTariffIntervalList, self).__init__() - if TimeTariffInterval is None: - self.TimeTariffInterval = [] - else: - self.TimeTariffInterval = TimeTariffInterval - def factory(*args_, **kwargs_): - if TimeTariffIntervalList.subclass: - return TimeTariffIntervalList.subclass(*args_, **kwargs_) - else: - return TimeTariffIntervalList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_TimeTariffInterval(self): return self.TimeTariffInterval - def set_TimeTariffInterval(self, TimeTariffInterval): self.TimeTariffInterval = TimeTariffInterval - def add_TimeTariffInterval(self, value): self.TimeTariffInterval.append(value) - def insert_TimeTariffInterval_at(self, index, value): self.TimeTariffInterval.insert(index, value) - def replace_TimeTariffInterval_at(self, index, value): self.TimeTariffInterval[index] = value - def hasContent_(self): - if ( - self.TimeTariffInterval or - super(TimeTariffIntervalList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeTariffIntervalList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeTariffIntervalList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeTariffIntervalList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeTariffIntervalList'): - super(TimeTariffIntervalList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TimeTariffIntervalList') - def exportChildren(self, outfile, level, namespace_='', name_='TimeTariffIntervalList', fromsubclass_=False, pretty_print=True): - super(TimeTariffIntervalList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for TimeTariffInterval_ in self.TimeTariffInterval: - TimeTariffInterval_.export(outfile, level, namespace_, name_='TimeTariffInterval', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TimeTariffIntervalList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TimeTariffIntervalList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TimeTariffIntervalList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('TimeTariffInterval=[\n') - level += 1 - for TimeTariffInterval_ in self.TimeTariffInterval: - showIndent(outfile, level) - outfile.write('model_.TimeTariffInterval(\n') - TimeTariffInterval_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TimeTariffIntervalList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'TimeTariffInterval': - obj_ = TimeTariffInterval.factory() - obj_.build(child_) - self.TimeTariffInterval.append(obj_) - obj_.original_tagname_ = 'TimeTariffInterval' - super(TimeTariffIntervalList, self).buildChildren(child_, node, nodeName_, True) -# end class TimeTariffIntervalList - - -class TimeTariffInterval(RandomizableEvent): - """Describes the time-differentiated portion of the RateComponent, if - applicable, and provides the ability to specify multiple time - intervals, each with its own consumption-based components and - other attributes.""" - subclass = None - superclass = RandomizableEvent - def __init__(self, ConsumptionTariffIntervalListLink=None, touTier=None): - self.original_tagname_ = None - super(TimeTariffInterval, self).__init__() - self.ConsumptionTariffIntervalListLink = ConsumptionTariffIntervalListLink - self.touTier = touTier - def factory(*args_, **kwargs_): - if TimeTariffInterval.subclass: - return TimeTariffInterval.subclass(*args_, **kwargs_) - else: - return TimeTariffInterval(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ConsumptionTariffIntervalListLink(self): return self.ConsumptionTariffIntervalListLink - def set_ConsumptionTariffIntervalListLink(self, ConsumptionTariffIntervalListLink): self.ConsumptionTariffIntervalListLink = ConsumptionTariffIntervalListLink - def get_touTier(self): return self.touTier - def set_touTier(self, touTier): self.touTier = touTier - def hasContent_(self): - if ( - self.ConsumptionTariffIntervalListLink is not None or - self.touTier is not None or - super(TimeTariffInterval, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TimeTariffInterval', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TimeTariffInterval') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TimeTariffInterval', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TimeTariffInterval'): - super(TimeTariffInterval, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TimeTariffInterval') - def exportChildren(self, outfile, level, namespace_='', name_='TimeTariffInterval', fromsubclass_=False, pretty_print=True): - super(TimeTariffInterval, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ConsumptionTariffIntervalListLink is not None: - self.ConsumptionTariffIntervalListLink.export(outfile, level, namespace_, name_='ConsumptionTariffIntervalListLink', pretty_print=pretty_print) - if self.touTier is not None: - self.touTier.export(outfile, level, namespace_, name_='touTier', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TimeTariffInterval'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TimeTariffInterval, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TimeTariffInterval, self).exportLiteralChildren(outfile, level, name_) - if self.ConsumptionTariffIntervalListLink is not None: - showIndent(outfile, level) - outfile.write('ConsumptionTariffIntervalListLink=model_.ConsumptionTariffIntervalListLink(\n') - self.ConsumptionTariffIntervalListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.touTier is not None: - showIndent(outfile, level) - outfile.write('touTier=model_.TOUType(\n') - self.touTier.exportLiteral(outfile, level, name_='touTier') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TimeTariffInterval, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ConsumptionTariffIntervalListLink': - obj_ = ConsumptionTariffIntervalListLink.factory() - obj_.build(child_) - self.ConsumptionTariffIntervalListLink = obj_ - obj_.original_tagname_ = 'ConsumptionTariffIntervalListLink' - elif nodeName_ == 'touTier': - obj_ = TOUType.factory() - obj_.build(child_) - self.touTier = obj_ - obj_.original_tagname_ = 'touTier' - super(TimeTariffInterval, self).buildChildren(child_, node, nodeName_, True) -# end class TimeTariffInterval - - -class TariffProfileList(SubscribableList): - """A List element to hold TariffProfile objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, TariffProfile=None): - self.original_tagname_ = None - super(TariffProfileList, self).__init__() - if TariffProfile is None: - self.TariffProfile = [] - else: - self.TariffProfile = TariffProfile - def factory(*args_, **kwargs_): - if TariffProfileList.subclass: - return TariffProfileList.subclass(*args_, **kwargs_) - else: - return TariffProfileList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_TariffProfile(self): return self.TariffProfile - def set_TariffProfile(self, TariffProfile): self.TariffProfile = TariffProfile - def add_TariffProfile(self, value): self.TariffProfile.append(value) - def insert_TariffProfile_at(self, index, value): self.TariffProfile.insert(index, value) - def replace_TariffProfile_at(self, index, value): self.TariffProfile[index] = value - def hasContent_(self): - if ( - self.TariffProfile or - super(TariffProfileList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TariffProfileList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfileList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TariffProfileList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TariffProfileList'): - super(TariffProfileList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfileList') - def exportChildren(self, outfile, level, namespace_='', name_='TariffProfileList', fromsubclass_=False, pretty_print=True): - super(TariffProfileList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for TariffProfile_ in self.TariffProfile: - TariffProfile_.export(outfile, level, namespace_, name_='TariffProfile', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TariffProfileList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TariffProfileList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TariffProfileList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('TariffProfile=[\n') - level += 1 - for TariffProfile_ in self.TariffProfile: - showIndent(outfile, level) - outfile.write('model_.TariffProfile(\n') - TariffProfile_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TariffProfileList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'TariffProfile': - obj_ = TariffProfile.factory() - obj_.build(child_) - self.TariffProfile.append(obj_) - obj_.original_tagname_ = 'TariffProfile' - super(TariffProfileList, self).buildChildren(child_, node, nodeName_, True) -# end class TariffProfileList - - -class TariffProfile(IdentifiedObject): - """A schedule of charges; structure that allows the definition of - tariff structures such as step (block) and time of use (tier) - when used in conjunction with TimeTariffInterval and - ConsumptionTariffInterval.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, currency=None, pricePowerOfTenMultiplier=None, primacy=None, rateCode=None, RateComponentListLink=None, serviceCategoryKind=None): - self.original_tagname_ = None - super(TariffProfile, self).__init__() - self.currency = currency - self.pricePowerOfTenMultiplier = pricePowerOfTenMultiplier - self.primacy = primacy - self.rateCode = rateCode - self.RateComponentListLink = RateComponentListLink - self.serviceCategoryKind = serviceCategoryKind - def factory(*args_, **kwargs_): - if TariffProfile.subclass: - return TariffProfile.subclass(*args_, **kwargs_) - else: - return TariffProfile(*args_, **kwargs_) - factory = staticmethod(factory) - def get_currency(self): return self.currency - def set_currency(self, currency): self.currency = currency - def get_pricePowerOfTenMultiplier(self): return self.pricePowerOfTenMultiplier - def set_pricePowerOfTenMultiplier(self, pricePowerOfTenMultiplier): self.pricePowerOfTenMultiplier = pricePowerOfTenMultiplier - def get_primacy(self): return self.primacy - def set_primacy(self, primacy): self.primacy = primacy - def get_rateCode(self): return self.rateCode - def set_rateCode(self, rateCode): self.rateCode = rateCode - def get_RateComponentListLink(self): return self.RateComponentListLink - def set_RateComponentListLink(self, RateComponentListLink): self.RateComponentListLink = RateComponentListLink - def get_serviceCategoryKind(self): return self.serviceCategoryKind - def set_serviceCategoryKind(self, serviceCategoryKind): self.serviceCategoryKind = serviceCategoryKind - def validate_String20(self, value): - # Validate type String20, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.currency is not None or - self.pricePowerOfTenMultiplier is not None or - self.primacy is not None or - self.rateCode is not None or - self.RateComponentListLink is not None or - self.serviceCategoryKind is not None or - super(TariffProfile, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TariffProfile', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfile') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TariffProfile', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TariffProfile'): - super(TariffProfile, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TariffProfile') - def exportChildren(self, outfile, level, namespace_='', name_='TariffProfile', fromsubclass_=False, pretty_print=True): - super(TariffProfile, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.currency is not None: - self.currency.export(outfile, level, namespace_, name_='currency', pretty_print=pretty_print) - if self.pricePowerOfTenMultiplier is not None: - self.pricePowerOfTenMultiplier.export(outfile, level, namespace_, name_='pricePowerOfTenMultiplier', pretty_print=pretty_print) - if self.primacy is not None: - self.primacy.export(outfile, level, namespace_, name_='primacy', pretty_print=pretty_print) - if self.rateCode is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srateCode>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.rateCode).encode(ExternalEncoding), input_name='rateCode'), namespace_, eol_)) - if self.RateComponentListLink is not None: - self.RateComponentListLink.export(outfile, level, namespace_, name_='RateComponentListLink', pretty_print=pretty_print) - if self.serviceCategoryKind is not None: - self.serviceCategoryKind.export(outfile, level, namespace_, name_='serviceCategoryKind', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='TariffProfile'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TariffProfile, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TariffProfile, self).exportLiteralChildren(outfile, level, name_) - if self.currency is not None: - showIndent(outfile, level) - outfile.write('currency=model_.CurrencyCode(\n') - self.currency.exportLiteral(outfile, level, name_='currency') - showIndent(outfile, level) - outfile.write('),\n') - if self.pricePowerOfTenMultiplier is not None: - showIndent(outfile, level) - outfile.write('pricePowerOfTenMultiplier=model_.PowerOfTenMultiplierType(\n') - self.pricePowerOfTenMultiplier.exportLiteral(outfile, level, name_='pricePowerOfTenMultiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.primacy is not None: - showIndent(outfile, level) - outfile.write('primacy=model_.PrimacyType(\n') - self.primacy.exportLiteral(outfile, level, name_='primacy') - showIndent(outfile, level) - outfile.write('),\n') - if self.rateCode is not None: - showIndent(outfile, level) - outfile.write('rateCode=%s,\n' % quote_python(self.rateCode).encode(ExternalEncoding)) - if self.RateComponentListLink is not None: - showIndent(outfile, level) - outfile.write('RateComponentListLink=model_.RateComponentListLink(\n') - self.RateComponentListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.serviceCategoryKind is not None: - showIndent(outfile, level) - outfile.write('serviceCategoryKind=model_.ServiceKind(\n') - self.serviceCategoryKind.exportLiteral(outfile, level, name_='serviceCategoryKind') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TariffProfile, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'currency': - obj_ = CurrencyCode.factory() - obj_.build(child_) - self.currency = obj_ - obj_.original_tagname_ = 'currency' - elif nodeName_ == 'pricePowerOfTenMultiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.pricePowerOfTenMultiplier = obj_ - obj_.original_tagname_ = 'pricePowerOfTenMultiplier' - elif nodeName_ == 'primacy': - obj_ = PrimacyType.factory() - obj_.build(child_) - self.primacy = obj_ - obj_.original_tagname_ = 'primacy' - elif nodeName_ == 'rateCode': - rateCode_ = child_.text - rateCode_ = self.gds_validate_string(rateCode_, node, 'rateCode') - self.rateCode = rateCode_ - self.validate_String20(self.rateCode) # validate type String20 - elif nodeName_ == 'RateComponentListLink': - obj_ = RateComponentListLink.factory() - obj_.build(child_) - self.RateComponentListLink = obj_ - obj_.original_tagname_ = 'RateComponentListLink' - elif nodeName_ == 'serviceCategoryKind': - obj_ = ServiceKind.factory() - obj_.build(child_) - self.serviceCategoryKind = obj_ - obj_.original_tagname_ = 'serviceCategoryKind' - super(TariffProfile, self).buildChildren(child_, node, nodeName_, True) -# end class TariffProfile - - -class RateComponentList(List): - """A List element to hold RateComponent objects.""" - subclass = None - superclass = List - def __init__(self, RateComponent=None): - self.original_tagname_ = None - super(RateComponentList, self).__init__() - if RateComponent is None: - self.RateComponent = [] - else: - self.RateComponent = RateComponent - def factory(*args_, **kwargs_): - if RateComponentList.subclass: - return RateComponentList.subclass(*args_, **kwargs_) - else: - return RateComponentList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_RateComponent(self): return self.RateComponent - def set_RateComponent(self, RateComponent): self.RateComponent = RateComponent - def add_RateComponent(self, value): self.RateComponent.append(value) - def insert_RateComponent_at(self, index, value): self.RateComponent.insert(index, value) - def replace_RateComponent_at(self, index, value): self.RateComponent[index] = value - def hasContent_(self): - if ( - self.RateComponent or - super(RateComponentList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RateComponentList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponentList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RateComponentList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RateComponentList'): - super(RateComponentList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponentList') - def exportChildren(self, outfile, level, namespace_='', name_='RateComponentList', fromsubclass_=False, pretty_print=True): - super(RateComponentList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for RateComponent_ in self.RateComponent: - RateComponent_.export(outfile, level, namespace_, name_='RateComponent', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RateComponentList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RateComponentList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RateComponentList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('RateComponent=[\n') - level += 1 - for RateComponent_ in self.RateComponent: - showIndent(outfile, level) - outfile.write('model_.RateComponent(\n') - RateComponent_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RateComponentList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'RateComponent': - obj_ = RateComponent.factory() - obj_.build(child_) - self.RateComponent.append(obj_) - obj_.original_tagname_ = 'RateComponent' - super(RateComponentList, self).buildChildren(child_, node, nodeName_, True) -# end class RateComponentList - - -class RateComponent(IdentifiedObject): - """Specifies the applicable charges for a single component of the rate, - which could be generation price or consumption price, for - example.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, ActiveTimeTariffIntervalListLink=None, flowRateEndLimit=None, flowRateStartLimit=None, ReadingTypeLink=None, roleFlags=None, TimeTariffIntervalListLink=None): - self.original_tagname_ = None - super(RateComponent, self).__init__() - self.ActiveTimeTariffIntervalListLink = ActiveTimeTariffIntervalListLink - self.flowRateEndLimit = flowRateEndLimit - self.flowRateStartLimit = flowRateStartLimit - self.ReadingTypeLink = ReadingTypeLink - self.roleFlags = roleFlags - self.TimeTariffIntervalListLink = TimeTariffIntervalListLink - def factory(*args_, **kwargs_): - if RateComponent.subclass: - return RateComponent.subclass(*args_, **kwargs_) - else: - return RateComponent(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ActiveTimeTariffIntervalListLink(self): return self.ActiveTimeTariffIntervalListLink - def set_ActiveTimeTariffIntervalListLink(self, ActiveTimeTariffIntervalListLink): self.ActiveTimeTariffIntervalListLink = ActiveTimeTariffIntervalListLink - def get_flowRateEndLimit(self): return self.flowRateEndLimit - def set_flowRateEndLimit(self, flowRateEndLimit): self.flowRateEndLimit = flowRateEndLimit - def get_flowRateStartLimit(self): return self.flowRateStartLimit - def set_flowRateStartLimit(self, flowRateStartLimit): self.flowRateStartLimit = flowRateStartLimit - def get_ReadingTypeLink(self): return self.ReadingTypeLink - def set_ReadingTypeLink(self, ReadingTypeLink): self.ReadingTypeLink = ReadingTypeLink - def get_roleFlags(self): return self.roleFlags - def set_roleFlags(self, roleFlags): self.roleFlags = roleFlags - def get_TimeTariffIntervalListLink(self): return self.TimeTariffIntervalListLink - def set_TimeTariffIntervalListLink(self, TimeTariffIntervalListLink): self.TimeTariffIntervalListLink = TimeTariffIntervalListLink - def hasContent_(self): - if ( - self.ActiveTimeTariffIntervalListLink is not None or - self.flowRateEndLimit is not None or - self.flowRateStartLimit is not None or - self.ReadingTypeLink is not None or - self.roleFlags is not None or - self.TimeTariffIntervalListLink is not None or - super(RateComponent, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RateComponent', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponent') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RateComponent', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RateComponent'): - super(RateComponent, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RateComponent') - def exportChildren(self, outfile, level, namespace_='', name_='RateComponent', fromsubclass_=False, pretty_print=True): - super(RateComponent, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ActiveTimeTariffIntervalListLink is not None: - self.ActiveTimeTariffIntervalListLink.export(outfile, level, namespace_, name_='ActiveTimeTariffIntervalListLink', pretty_print=pretty_print) - if self.flowRateEndLimit is not None: - self.flowRateEndLimit.export(outfile, level, namespace_, name_='flowRateEndLimit', pretty_print=pretty_print) - if self.flowRateStartLimit is not None: - self.flowRateStartLimit.export(outfile, level, namespace_, name_='flowRateStartLimit', pretty_print=pretty_print) - if self.ReadingTypeLink is not None: - self.ReadingTypeLink.export(outfile, level, namespace_, name_='ReadingTypeLink', pretty_print=pretty_print) - if self.roleFlags is not None: - self.roleFlags.export(outfile, level, namespace_, name_='roleFlags', pretty_print=pretty_print) - if self.TimeTariffIntervalListLink is not None: - self.TimeTariffIntervalListLink.export(outfile, level, namespace_, name_='TimeTariffIntervalListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RateComponent'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RateComponent, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RateComponent, self).exportLiteralChildren(outfile, level, name_) - if self.ActiveTimeTariffIntervalListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveTimeTariffIntervalListLink=model_.ActiveTimeTariffIntervalListLink(\n') - self.ActiveTimeTariffIntervalListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.flowRateEndLimit is not None: - showIndent(outfile, level) - outfile.write('flowRateEndLimit=model_.UnitValueType(\n') - self.flowRateEndLimit.exportLiteral(outfile, level, name_='flowRateEndLimit') - showIndent(outfile, level) - outfile.write('),\n') - if self.flowRateStartLimit is not None: - showIndent(outfile, level) - outfile.write('flowRateStartLimit=model_.UnitValueType(\n') - self.flowRateStartLimit.exportLiteral(outfile, level, name_='flowRateStartLimit') - showIndent(outfile, level) - outfile.write('),\n') - if self.ReadingTypeLink is not None: - showIndent(outfile, level) - outfile.write('ReadingTypeLink=model_.ReadingTypeLink(\n') - self.ReadingTypeLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.roleFlags is not None: - showIndent(outfile, level) - outfile.write('roleFlags=model_.RoleFlagsType(\n') - self.roleFlags.exportLiteral(outfile, level, name_='roleFlags') - showIndent(outfile, level) - outfile.write('),\n') - if self.TimeTariffIntervalListLink is not None: - showIndent(outfile, level) - outfile.write('TimeTariffIntervalListLink=model_.TimeTariffIntervalListLink(\n') - self.TimeTariffIntervalListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RateComponent, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ActiveTimeTariffIntervalListLink': - obj_ = ActiveTimeTariffIntervalListLink.factory() - obj_.build(child_) - self.ActiveTimeTariffIntervalListLink = obj_ - obj_.original_tagname_ = 'ActiveTimeTariffIntervalListLink' - elif nodeName_ == 'flowRateEndLimit': - obj_ = UnitValueType.factory() - obj_.build(child_) - self.flowRateEndLimit = obj_ - obj_.original_tagname_ = 'flowRateEndLimit' - elif nodeName_ == 'flowRateStartLimit': - obj_ = UnitValueType.factory() - obj_.build(child_) - self.flowRateStartLimit = obj_ - obj_.original_tagname_ = 'flowRateStartLimit' - elif nodeName_ == 'ReadingTypeLink': - obj_ = ReadingTypeLink.factory() - obj_.build(child_) - self.ReadingTypeLink = obj_ - obj_.original_tagname_ = 'ReadingTypeLink' - elif nodeName_ == 'roleFlags': - obj_ = RoleFlagsType.factory() - obj_.build(child_) - self.roleFlags = obj_ - obj_.original_tagname_ = 'roleFlags' - elif nodeName_ == 'TimeTariffIntervalListLink': - obj_ = TimeTariffIntervalListLink.factory() - obj_.build(child_) - self.TimeTariffIntervalListLink = obj_ - obj_.original_tagname_ = 'TimeTariffIntervalListLink' - super(RateComponent, self).buildChildren(child_, node, nodeName_, True) -# end class RateComponent - - -class ConsumptionTariffIntervalList(List): - """A List element to hold ConsumptionTariffInterval objects.""" - subclass = None - superclass = List - def __init__(self, ConsumptionTariffInterval=None): - self.original_tagname_ = None - super(ConsumptionTariffIntervalList, self).__init__() - if ConsumptionTariffInterval is None: - self.ConsumptionTariffInterval = [] - else: - self.ConsumptionTariffInterval = ConsumptionTariffInterval - def factory(*args_, **kwargs_): - if ConsumptionTariffIntervalList.subclass: - return ConsumptionTariffIntervalList.subclass(*args_, **kwargs_) - else: - return ConsumptionTariffIntervalList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ConsumptionTariffInterval(self): return self.ConsumptionTariffInterval - def set_ConsumptionTariffInterval(self, ConsumptionTariffInterval): self.ConsumptionTariffInterval = ConsumptionTariffInterval - def add_ConsumptionTariffInterval(self, value): self.ConsumptionTariffInterval.append(value) - def insert_ConsumptionTariffInterval_at(self, index, value): self.ConsumptionTariffInterval.insert(index, value) - def replace_ConsumptionTariffInterval_at(self, index, value): self.ConsumptionTariffInterval[index] = value - def hasContent_(self): - if ( - self.ConsumptionTariffInterval or - super(ConsumptionTariffIntervalList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConsumptionTariffIntervalList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionTariffIntervalList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConsumptionTariffIntervalList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConsumptionTariffIntervalList'): - super(ConsumptionTariffIntervalList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionTariffIntervalList') - def exportChildren(self, outfile, level, namespace_='', name_='ConsumptionTariffIntervalList', fromsubclass_=False, pretty_print=True): - super(ConsumptionTariffIntervalList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for ConsumptionTariffInterval_ in self.ConsumptionTariffInterval: - ConsumptionTariffInterval_.export(outfile, level, namespace_, name_='ConsumptionTariffInterval', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ConsumptionTariffIntervalList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ConsumptionTariffIntervalList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ConsumptionTariffIntervalList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('ConsumptionTariffInterval=[\n') - level += 1 - for ConsumptionTariffInterval_ in self.ConsumptionTariffInterval: - showIndent(outfile, level) - outfile.write('model_.ConsumptionTariffInterval(\n') - ConsumptionTariffInterval_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ConsumptionTariffIntervalList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ConsumptionTariffInterval': - obj_ = ConsumptionTariffInterval.factory() - obj_.build(child_) - self.ConsumptionTariffInterval.append(obj_) - obj_.original_tagname_ = 'ConsumptionTariffInterval' - super(ConsumptionTariffIntervalList, self).buildChildren(child_, node, nodeName_, True) -# end class ConsumptionTariffIntervalList - - -class ConsumptionTariffInterval(Resource): - """One of a sequence of thresholds defined in terms of consumption - quantity of a service such as electricity, water, gas, etc. It - defines the steps or blocks in a step tariff structure, where - startValue simultaneously defines the entry value of this step - and the closing value of the previous step. Where consumption is - greater than startValue, it falls within this block and where - consumption is less than or equal to startValue, it falls within - one of the previous blocks.""" - subclass = None - superclass = Resource - def __init__(self, consumptionBlock=None, EnvironmentalCost=None, price=None, startValue=None): - self.original_tagname_ = None - super(ConsumptionTariffInterval, self).__init__() - self.consumptionBlock = consumptionBlock - if EnvironmentalCost is None: - self.EnvironmentalCost = [] - else: - self.EnvironmentalCost = EnvironmentalCost - self.price = price - self.startValue = startValue - def factory(*args_, **kwargs_): - if ConsumptionTariffInterval.subclass: - return ConsumptionTariffInterval.subclass(*args_, **kwargs_) - else: - return ConsumptionTariffInterval(*args_, **kwargs_) - factory = staticmethod(factory) - def get_consumptionBlock(self): return self.consumptionBlock - def set_consumptionBlock(self, consumptionBlock): self.consumptionBlock = consumptionBlock - def get_EnvironmentalCost(self): return self.EnvironmentalCost - def set_EnvironmentalCost(self, EnvironmentalCost): self.EnvironmentalCost = EnvironmentalCost - def add_EnvironmentalCost(self, value): self.EnvironmentalCost.append(value) - def insert_EnvironmentalCost_at(self, index, value): self.EnvironmentalCost.insert(index, value) - def replace_EnvironmentalCost_at(self, index, value): self.EnvironmentalCost[index] = value - def get_price(self): return self.price - def set_price(self, price): self.price = price - def get_startValue(self): return self.startValue - def set_startValue(self, startValue): self.startValue = startValue - def validate_Int32(self, value): - # Validate type Int32, a restriction on xs:int. - pass - def validate_UInt48(self, value): - # Validate type UInt48, a restriction on xs:unsignedLong. - pass - def hasContent_(self): - if ( - self.consumptionBlock is not None or - self.EnvironmentalCost or - self.price is not None or - self.startValue is not None or - super(ConsumptionTariffInterval, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ConsumptionTariffInterval', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionTariffInterval') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ConsumptionTariffInterval', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ConsumptionTariffInterval'): - super(ConsumptionTariffInterval, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ConsumptionTariffInterval') - def exportChildren(self, outfile, level, namespace_='', name_='ConsumptionTariffInterval', fromsubclass_=False, pretty_print=True): - super(ConsumptionTariffInterval, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.consumptionBlock is not None: - self.consumptionBlock.export(outfile, level, namespace_, name_='consumptionBlock', pretty_print=pretty_print) - for EnvironmentalCost_ in self.EnvironmentalCost: - EnvironmentalCost_.export(outfile, level, namespace_, name_='EnvironmentalCost', pretty_print=pretty_print) - if self.price is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sprice>%s%s' % (namespace_, self.gds_format_integer(self.price, input_name='price'), namespace_, eol_)) - if self.startValue is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sstartValue>%s%s' % (namespace_, self.gds_format_integer(self.startValue, input_name='startValue'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='ConsumptionTariffInterval'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ConsumptionTariffInterval, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ConsumptionTariffInterval, self).exportLiteralChildren(outfile, level, name_) - if self.consumptionBlock is not None: - showIndent(outfile, level) - outfile.write('consumptionBlock=model_.ConsumptionBlockType(\n') - self.consumptionBlock.exportLiteral(outfile, level, name_='consumptionBlock') - showIndent(outfile, level) - outfile.write('),\n') - showIndent(outfile, level) - outfile.write('EnvironmentalCost=[\n') - level += 1 - for EnvironmentalCost_ in self.EnvironmentalCost: - showIndent(outfile, level) - outfile.write('model_.EnvironmentalCost(\n') - EnvironmentalCost_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - if self.price is not None: - showIndent(outfile, level) - outfile.write('price=%d,\n' % self.price) - if self.startValue is not None: - showIndent(outfile, level) - outfile.write('startValue=%d,\n' % self.startValue) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ConsumptionTariffInterval, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'consumptionBlock': - obj_ = ConsumptionBlockType.factory() - obj_.build(child_) - self.consumptionBlock = obj_ - obj_.original_tagname_ = 'consumptionBlock' - elif nodeName_ == 'EnvironmentalCost': - obj_ = EnvironmentalCost.factory() - obj_.build(child_) - self.EnvironmentalCost.append(obj_) - obj_.original_tagname_ = 'EnvironmentalCost' - elif nodeName_ == 'price': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'price') - self.price = ival_ - self.validate_Int32(self.price) # validate type Int32 - elif nodeName_ == 'startValue': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'startValue') - self.startValue = ival_ - self.validate_UInt48(self.startValue) # validate type UInt48 - super(ConsumptionTariffInterval, self).buildChildren(child_, node, nodeName_, True) -# end class ConsumptionTariffInterval - - -class UsagePointList(SubscribableList): - """A List element to hold UsagePoint objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, UsagePoint=None): - self.original_tagname_ = None - super(UsagePointList, self).__init__() - if UsagePoint is None: - self.UsagePoint = [] - else: - self.UsagePoint = UsagePoint - def factory(*args_, **kwargs_): - if UsagePointList.subclass: - return UsagePointList.subclass(*args_, **kwargs_) - else: - return UsagePointList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_UsagePoint(self): return self.UsagePoint - def set_UsagePoint(self, UsagePoint): self.UsagePoint = UsagePoint - def add_UsagePoint(self, value): self.UsagePoint.append(value) - def insert_UsagePoint_at(self, index, value): self.UsagePoint.insert(index, value) - def replace_UsagePoint_at(self, index, value): self.UsagePoint[index] = value - def hasContent_(self): - if ( - self.UsagePoint or - super(UsagePointList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UsagePointList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UsagePointList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UsagePointList'): - super(UsagePointList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointList') - def exportChildren(self, outfile, level, namespace_='', name_='UsagePointList', fromsubclass_=False, pretty_print=True): - super(UsagePointList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for UsagePoint_ in self.UsagePoint: - UsagePoint_.export(outfile, level, namespace_, name_='UsagePoint', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='UsagePointList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(UsagePointList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(UsagePointList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('UsagePoint=[\n') - level += 1 - for UsagePoint_ in self.UsagePoint: - showIndent(outfile, level) - outfile.write('model_.UsagePoint(\n') - UsagePoint_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(UsagePointList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'UsagePoint': - obj_ = UsagePoint.factory() - obj_.build(child_) - self.UsagePoint.append(obj_) - obj_.original_tagname_ = 'UsagePoint' - super(UsagePointList, self).buildChildren(child_, node, nodeName_, True) -# end class UsagePointList - - -class ReadingType(Resource): - """Type of data conveyed by a specific Reading. See IEC 61968 Part 9 - Annex C for full definitions of these values.""" - subclass = None - superclass = Resource - def __init__(self, accumulationBehaviour=None, calorificValue=None, commodity=None, conversionFactor=None, dataQualifier=None, flowDirection=None, intervalLength=None, kind=None, maxNumberOfIntervals=None, numberOfConsumptionBlocks=None, numberOfTouTiers=None, phase=None, powerOfTenMultiplier=None, subIntervalLength=None, supplyLimit=None, tieredConsumptionBlocks=None, uom=None): - self.original_tagname_ = None - super(ReadingType, self).__init__() - self.accumulationBehaviour = accumulationBehaviour - self.calorificValue = calorificValue - self.commodity = commodity - self.conversionFactor = conversionFactor - self.dataQualifier = dataQualifier - self.flowDirection = flowDirection - self.intervalLength = intervalLength - self.kind = kind - self.maxNumberOfIntervals = maxNumberOfIntervals - self.numberOfConsumptionBlocks = numberOfConsumptionBlocks - self.numberOfTouTiers = numberOfTouTiers - self.phase = phase - self.powerOfTenMultiplier = powerOfTenMultiplier - self.subIntervalLength = subIntervalLength - self.supplyLimit = supplyLimit - self.tieredConsumptionBlocks = tieredConsumptionBlocks - self.uom = uom - def factory(*args_, **kwargs_): - if ReadingType.subclass: - return ReadingType.subclass(*args_, **kwargs_) - else: - return ReadingType(*args_, **kwargs_) - factory = staticmethod(factory) - def get_accumulationBehaviour(self): return self.accumulationBehaviour - def set_accumulationBehaviour(self, accumulationBehaviour): self.accumulationBehaviour = accumulationBehaviour - def get_calorificValue(self): return self.calorificValue - def set_calorificValue(self, calorificValue): self.calorificValue = calorificValue - def get_commodity(self): return self.commodity - def set_commodity(self, commodity): self.commodity = commodity - def get_conversionFactor(self): return self.conversionFactor - def set_conversionFactor(self, conversionFactor): self.conversionFactor = conversionFactor - def get_dataQualifier(self): return self.dataQualifier - def set_dataQualifier(self, dataQualifier): self.dataQualifier = dataQualifier - def get_flowDirection(self): return self.flowDirection - def set_flowDirection(self, flowDirection): self.flowDirection = flowDirection - def get_intervalLength(self): return self.intervalLength - def set_intervalLength(self, intervalLength): self.intervalLength = intervalLength - def get_kind(self): return self.kind - def set_kind(self, kind): self.kind = kind - def get_maxNumberOfIntervals(self): return self.maxNumberOfIntervals - def set_maxNumberOfIntervals(self, maxNumberOfIntervals): self.maxNumberOfIntervals = maxNumberOfIntervals - def get_numberOfConsumptionBlocks(self): return self.numberOfConsumptionBlocks - def set_numberOfConsumptionBlocks(self, numberOfConsumptionBlocks): self.numberOfConsumptionBlocks = numberOfConsumptionBlocks - def get_numberOfTouTiers(self): return self.numberOfTouTiers - def set_numberOfTouTiers(self, numberOfTouTiers): self.numberOfTouTiers = numberOfTouTiers - def get_phase(self): return self.phase - def set_phase(self, phase): self.phase = phase - def get_powerOfTenMultiplier(self): return self.powerOfTenMultiplier - def set_powerOfTenMultiplier(self, powerOfTenMultiplier): self.powerOfTenMultiplier = powerOfTenMultiplier - def get_subIntervalLength(self): return self.subIntervalLength - def set_subIntervalLength(self, subIntervalLength): self.subIntervalLength = subIntervalLength - def get_supplyLimit(self): return self.supplyLimit - def set_supplyLimit(self, supplyLimit): self.supplyLimit = supplyLimit - def get_tieredConsumptionBlocks(self): return self.tieredConsumptionBlocks - def set_tieredConsumptionBlocks(self, tieredConsumptionBlocks): self.tieredConsumptionBlocks = tieredConsumptionBlocks - def get_uom(self): return self.uom - def set_uom(self, uom): self.uom = uom - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt48(self, value): - # Validate type UInt48, a restriction on xs:unsignedLong. - pass - def hasContent_(self): - if ( - self.accumulationBehaviour is not None or - self.calorificValue is not None or - self.commodity is not None or - self.conversionFactor is not None or - self.dataQualifier is not None or - self.flowDirection is not None or - self.intervalLength is not None or - self.kind is not None or - self.maxNumberOfIntervals is not None or - self.numberOfConsumptionBlocks is not None or - self.numberOfTouTiers is not None or - self.phase is not None or - self.powerOfTenMultiplier is not None or - self.subIntervalLength is not None or - self.supplyLimit is not None or - self.tieredConsumptionBlocks is not None or - self.uom is not None or - super(ReadingType, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingType', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingType') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingType', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingType'): - super(ReadingType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingType') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingType', fromsubclass_=False, pretty_print=True): - super(ReadingType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.accumulationBehaviour is not None: - self.accumulationBehaviour.export(outfile, level, namespace_, name_='accumulationBehaviour', pretty_print=pretty_print) - if self.calorificValue is not None: - self.calorificValue.export(outfile, level, namespace_, name_='calorificValue', pretty_print=pretty_print) - if self.commodity is not None: - self.commodity.export(outfile, level, namespace_, name_='commodity', pretty_print=pretty_print) - if self.conversionFactor is not None: - self.conversionFactor.export(outfile, level, namespace_, name_='conversionFactor', pretty_print=pretty_print) - if self.dataQualifier is not None: - self.dataQualifier.export(outfile, level, namespace_, name_='dataQualifier', pretty_print=pretty_print) - if self.flowDirection is not None: - self.flowDirection.export(outfile, level, namespace_, name_='flowDirection', pretty_print=pretty_print) - if self.intervalLength is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sintervalLength>%s%s' % (namespace_, self.gds_format_integer(self.intervalLength, input_name='intervalLength'), namespace_, eol_)) - if self.kind is not None: - self.kind.export(outfile, level, namespace_, name_='kind', pretty_print=pretty_print) - if self.maxNumberOfIntervals is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smaxNumberOfIntervals>%s%s' % (namespace_, self.gds_format_integer(self.maxNumberOfIntervals, input_name='maxNumberOfIntervals'), namespace_, eol_)) - if self.numberOfConsumptionBlocks is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snumberOfConsumptionBlocks>%s%s' % (namespace_, self.gds_format_integer(self.numberOfConsumptionBlocks, input_name='numberOfConsumptionBlocks'), namespace_, eol_)) - if self.numberOfTouTiers is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snumberOfTouTiers>%s%s' % (namespace_, self.gds_format_integer(self.numberOfTouTiers, input_name='numberOfTouTiers'), namespace_, eol_)) - if self.phase is not None: - self.phase.export(outfile, level, namespace_, name_='phase', pretty_print=pretty_print) - if self.powerOfTenMultiplier is not None: - self.powerOfTenMultiplier.export(outfile, level, namespace_, name_='powerOfTenMultiplier', pretty_print=pretty_print) - if self.subIntervalLength is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssubIntervalLength>%s%s' % (namespace_, self.gds_format_integer(self.subIntervalLength, input_name='subIntervalLength'), namespace_, eol_)) - if self.supplyLimit is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssupplyLimit>%s%s' % (namespace_, self.gds_format_integer(self.supplyLimit, input_name='supplyLimit'), namespace_, eol_)) - if self.tieredConsumptionBlocks is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%stieredConsumptionBlocks>%s%s' % (namespace_, self.gds_format_boolean(self.tieredConsumptionBlocks, input_name='tieredConsumptionBlocks'), namespace_, eol_)) - if self.uom is not None: - self.uom.export(outfile, level, namespace_, name_='uom', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ReadingType'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingType, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingType, self).exportLiteralChildren(outfile, level, name_) - if self.accumulationBehaviour is not None: - showIndent(outfile, level) - outfile.write('accumulationBehaviour=model_.AccumulationBehaviourType(\n') - self.accumulationBehaviour.exportLiteral(outfile, level, name_='accumulationBehaviour') - showIndent(outfile, level) - outfile.write('),\n') - if self.calorificValue is not None: - showIndent(outfile, level) - outfile.write('calorificValue=model_.UnitValueType(\n') - self.calorificValue.exportLiteral(outfile, level, name_='calorificValue') - showIndent(outfile, level) - outfile.write('),\n') - if self.commodity is not None: - showIndent(outfile, level) - outfile.write('commodity=model_.CommodityType(\n') - self.commodity.exportLiteral(outfile, level, name_='commodity') - showIndent(outfile, level) - outfile.write('),\n') - if self.conversionFactor is not None: - showIndent(outfile, level) - outfile.write('conversionFactor=model_.UnitValueType(\n') - self.conversionFactor.exportLiteral(outfile, level, name_='conversionFactor') - showIndent(outfile, level) - outfile.write('),\n') - if self.dataQualifier is not None: - showIndent(outfile, level) - outfile.write('dataQualifier=model_.DataQualifierType(\n') - self.dataQualifier.exportLiteral(outfile, level, name_='dataQualifier') - showIndent(outfile, level) - outfile.write('),\n') - if self.flowDirection is not None: - showIndent(outfile, level) - outfile.write('flowDirection=model_.FlowDirectionType(\n') - self.flowDirection.exportLiteral(outfile, level, name_='flowDirection') - showIndent(outfile, level) - outfile.write('),\n') - if self.intervalLength is not None: - showIndent(outfile, level) - outfile.write('intervalLength=%d,\n' % self.intervalLength) - if self.kind is not None: - showIndent(outfile, level) - outfile.write('kind=model_.KindType(\n') - self.kind.exportLiteral(outfile, level, name_='kind') - showIndent(outfile, level) - outfile.write('),\n') - if self.maxNumberOfIntervals is not None: - showIndent(outfile, level) - outfile.write('maxNumberOfIntervals=%d,\n' % self.maxNumberOfIntervals) - if self.numberOfConsumptionBlocks is not None: - showIndent(outfile, level) - outfile.write('numberOfConsumptionBlocks=%d,\n' % self.numberOfConsumptionBlocks) - if self.numberOfTouTiers is not None: - showIndent(outfile, level) - outfile.write('numberOfTouTiers=%d,\n' % self.numberOfTouTiers) - if self.phase is not None: - showIndent(outfile, level) - outfile.write('phase=model_.PhaseCode(\n') - self.phase.exportLiteral(outfile, level, name_='phase') - showIndent(outfile, level) - outfile.write('),\n') - if self.powerOfTenMultiplier is not None: - showIndent(outfile, level) - outfile.write('powerOfTenMultiplier=model_.PowerOfTenMultiplierType(\n') - self.powerOfTenMultiplier.exportLiteral(outfile, level, name_='powerOfTenMultiplier') - showIndent(outfile, level) - outfile.write('),\n') - if self.subIntervalLength is not None: - showIndent(outfile, level) - outfile.write('subIntervalLength=%d,\n' % self.subIntervalLength) - if self.supplyLimit is not None: - showIndent(outfile, level) - outfile.write('supplyLimit=%d,\n' % self.supplyLimit) - if self.tieredConsumptionBlocks is not None: - showIndent(outfile, level) - outfile.write('tieredConsumptionBlocks=%s,\n' % self.tieredConsumptionBlocks) - if self.uom is not None: - showIndent(outfile, level) - outfile.write('uom=model_.UomType(\n') - self.uom.exportLiteral(outfile, level, name_='uom') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingType, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'accumulationBehaviour': - obj_ = AccumulationBehaviourType.factory() - obj_.build(child_) - self.accumulationBehaviour = obj_ - obj_.original_tagname_ = 'accumulationBehaviour' - elif nodeName_ == 'calorificValue': - obj_ = UnitValueType.factory() - obj_.build(child_) - self.calorificValue = obj_ - obj_.original_tagname_ = 'calorificValue' - elif nodeName_ == 'commodity': - obj_ = CommodityType.factory() - obj_.build(child_) - self.commodity = obj_ - obj_.original_tagname_ = 'commodity' - elif nodeName_ == 'conversionFactor': - obj_ = UnitValueType.factory() - obj_.build(child_) - self.conversionFactor = obj_ - obj_.original_tagname_ = 'conversionFactor' - elif nodeName_ == 'dataQualifier': - obj_ = DataQualifierType.factory() - obj_.build(child_) - self.dataQualifier = obj_ - obj_.original_tagname_ = 'dataQualifier' - elif nodeName_ == 'flowDirection': - obj_ = FlowDirectionType.factory() - obj_.build(child_) - self.flowDirection = obj_ - obj_.original_tagname_ = 'flowDirection' - elif nodeName_ == 'intervalLength': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'intervalLength') - self.intervalLength = ival_ - self.validate_UInt32(self.intervalLength) # validate type UInt32 - elif nodeName_ == 'kind': - obj_ = KindType.factory() - obj_.build(child_) - self.kind = obj_ - obj_.original_tagname_ = 'kind' - elif nodeName_ == 'maxNumberOfIntervals': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'maxNumberOfIntervals') - self.maxNumberOfIntervals = ival_ - self.validate_UInt8(self.maxNumberOfIntervals) # validate type UInt8 - elif nodeName_ == 'numberOfConsumptionBlocks': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'numberOfConsumptionBlocks') - self.numberOfConsumptionBlocks = ival_ - self.validate_UInt8(self.numberOfConsumptionBlocks) # validate type UInt8 - elif nodeName_ == 'numberOfTouTiers': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'numberOfTouTiers') - self.numberOfTouTiers = ival_ - self.validate_UInt8(self.numberOfTouTiers) # validate type UInt8 - elif nodeName_ == 'phase': - obj_ = PhaseCode.factory() - obj_.build(child_) - self.phase = obj_ - obj_.original_tagname_ = 'phase' - elif nodeName_ == 'powerOfTenMultiplier': - obj_ = PowerOfTenMultiplierType.factory() - obj_.build(child_) - self.powerOfTenMultiplier = obj_ - obj_.original_tagname_ = 'powerOfTenMultiplier' - elif nodeName_ == 'subIntervalLength': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'subIntervalLength') - self.subIntervalLength = ival_ - self.validate_UInt32(self.subIntervalLength) # validate type UInt32 - elif nodeName_ == 'supplyLimit': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'supplyLimit') - self.supplyLimit = ival_ - self.validate_UInt48(self.supplyLimit) # validate type UInt48 - elif nodeName_ == 'tieredConsumptionBlocks': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'tieredConsumptionBlocks') - self.tieredConsumptionBlocks = ival_ - elif nodeName_ == 'uom': - obj_ = UomType.factory() - obj_.build(child_) - self.uom = obj_ - obj_.original_tagname_ = 'uom' - super(ReadingType, self).buildChildren(child_, node, nodeName_, True) -# end class ReadingType - - -class ReadingSetList(SubscribableList): - """A List element to hold ReadingSet objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, ReadingSet=None): - self.original_tagname_ = None - super(ReadingSetList, self).__init__() - if ReadingSet is None: - self.ReadingSet = [] - else: - self.ReadingSet = ReadingSet - def factory(*args_, **kwargs_): - if ReadingSetList.subclass: - return ReadingSetList.subclass(*args_, **kwargs_) - else: - return ReadingSetList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ReadingSet(self): return self.ReadingSet - def set_ReadingSet(self, ReadingSet): self.ReadingSet = ReadingSet - def add_ReadingSet(self, value): self.ReadingSet.append(value) - def insert_ReadingSet_at(self, index, value): self.ReadingSet.insert(index, value) - def replace_ReadingSet_at(self, index, value): self.ReadingSet[index] = value - def hasContent_(self): - if ( - self.ReadingSet or - super(ReadingSetList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingSetList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSetList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingSetList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingSetList'): - super(ReadingSetList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSetList') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingSetList', fromsubclass_=False, pretty_print=True): - super(ReadingSetList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for ReadingSet_ in self.ReadingSet: - ReadingSet_.export(outfile, level, namespace_, name_='ReadingSet', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ReadingSetList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingSetList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingSetList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('ReadingSet=[\n') - level += 1 - for ReadingSet_ in self.ReadingSet: - showIndent(outfile, level) - outfile.write('model_.ReadingSet(\n') - ReadingSet_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingSetList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ReadingSet': - obj_ = ReadingSet.factory() - obj_.build(child_) - self.ReadingSet.append(obj_) - obj_.original_tagname_ = 'ReadingSet' - super(ReadingSetList, self).buildChildren(child_, node, nodeName_, True) -# end class ReadingSetList - - -class ReadingList(SubscribableList): - """A List element to hold Reading objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, Reading=None): - self.original_tagname_ = None - super(ReadingList, self).__init__() - if Reading is None: - self.Reading = [] - else: - self.Reading = Reading - def factory(*args_, **kwargs_): - if ReadingList.subclass: - return ReadingList.subclass(*args_, **kwargs_) - else: - return ReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Reading(self): return self.Reading - def set_Reading(self, Reading): self.Reading = Reading - def add_Reading(self, value): self.Reading.append(value) - def insert_Reading_at(self, index, value): self.Reading.insert(index, value) - def replace_Reading_at(self, index, value): self.Reading[index] = value - def hasContent_(self): - if ( - self.Reading or - super(ReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingList'): - super(ReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingList', fromsubclass_=False, pretty_print=True): - super(ReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Reading_ in self.Reading: - Reading_.export(outfile, level, namespace_, name_='Reading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Reading=[\n') - level += 1 - for Reading_ in self.Reading: - showIndent(outfile, level) - outfile.write('model_.Reading(\n') - Reading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Reading': - obj_ = Reading.factory() - obj_.build(child_) - self.Reading.append(obj_) - obj_.original_tagname_ = 'Reading' - super(ReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class ReadingList - - -class Reading(ReadingBase): - """Specific value measured by a meter or other asset.Indicates whether - or not subscriptions are supported for this resource, and - whether or not conditional (thresholds) are supported. If not - specified, is "not subscribable" (0).""" - subclass = None - superclass = ReadingBase - def __init__(self, subscribable='0', localID=None): - self.original_tagname_ = None - super(Reading, self).__init__() - self.subscribable = _cast(None, subscribable) - self.localID = localID - def factory(*args_, **kwargs_): - if Reading.subclass: - return Reading.subclass(*args_, **kwargs_) - else: - return Reading(*args_, **kwargs_) - factory = staticmethod(factory) - def get_localID(self): return self.localID - def set_localID(self, localID): self.localID = localID - def get_subscribable(self): return self.subscribable - def set_subscribable(self, subscribable): self.subscribable = subscribable - def validate_HexBinary16(self, value): - # Validate type HexBinary16, a restriction on xs:hexBinary. - pass - def validate_SubscribableType(self, value): - # Validate type SubscribableType, a restriction on UInt8. - pass - def hasContent_(self): - if ( - self.localID is not None or - super(Reading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Reading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Reading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Reading', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Reading'): - super(Reading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Reading') - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - outfile.write(' subscribable=%s' % (quote_attrib(self.subscribable), )) - def exportChildren(self, outfile, level, namespace_='', name_='Reading', fromsubclass_=False, pretty_print=True): - super(Reading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.localID is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slocalID>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.localID).encode(ExternalEncoding), input_name='localID'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Reading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - showIndent(outfile, level) - outfile.write('subscribable=%d,\n' % (self.subscribable,)) - super(Reading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Reading, self).exportLiteralChildren(outfile, level, name_) - if self.localID is not None: - showIndent(outfile, level) - outfile.write('localID=%s,\n' % quote_python(self.localID).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('subscribable', node) - if value is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - self.subscribable = value - self.validate_SubscribableType(self.subscribable) # validate type SubscribableType - super(Reading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'localID': - localID_ = child_.text - localID_ = self.gds_validate_string(localID_, node, 'localID') - self.localID = localID_ - self.validate_HexBinary16(self.localID) # validate type HexBinary16 - super(Reading, self).buildChildren(child_, node, nodeName_, True) -# end class Reading - - -class MeterReadingList(SubscribableList): - """A List element to hold MeterReading objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, MeterReading=None): - self.original_tagname_ = None - super(MeterReadingList, self).__init__() - if MeterReading is None: - self.MeterReading = [] - else: - self.MeterReading = MeterReading - def factory(*args_, **kwargs_): - if MeterReadingList.subclass: - return MeterReadingList.subclass(*args_, **kwargs_) - else: - return MeterReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_MeterReading(self): return self.MeterReading - def set_MeterReading(self, MeterReading): self.MeterReading = MeterReading - def add_MeterReading(self, value): self.MeterReading.append(value) - def insert_MeterReading_at(self, index, value): self.MeterReading.insert(index, value) - def replace_MeterReading_at(self, index, value): self.MeterReading[index] = value - def hasContent_(self): - if ( - self.MeterReading or - super(MeterReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MeterReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MeterReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MeterReadingList'): - super(MeterReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='MeterReadingList', fromsubclass_=False, pretty_print=True): - super(MeterReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for MeterReading_ in self.MeterReading: - MeterReading_.export(outfile, level, namespace_, name_='MeterReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MeterReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MeterReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MeterReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('MeterReading=[\n') - level += 1 - for MeterReading_ in self.MeterReading: - showIndent(outfile, level) - outfile.write('model_.MeterReading(\n') - MeterReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MeterReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'MeterReading': - obj_ = MeterReading.factory() - obj_.build(child_) - self.MeterReading.append(obj_) - obj_.original_tagname_ = 'MeterReading' - super(MeterReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class MeterReadingList - - -class LoadShedAvailability(Resource): - """Indicates current consumption status and ability to shed load.""" - subclass = None - superclass = Resource - def __init__(self, availabilityDuration=None, DemandResponseProgramLink=None, sheddablePercent=None, sheddablePower=None): - self.original_tagname_ = None - super(LoadShedAvailability, self).__init__() - self.availabilityDuration = availabilityDuration - self.DemandResponseProgramLink = DemandResponseProgramLink - self.sheddablePercent = sheddablePercent - self.sheddablePower = sheddablePower - def factory(*args_, **kwargs_): - if LoadShedAvailability.subclass: - return LoadShedAvailability.subclass(*args_, **kwargs_) - else: - return LoadShedAvailability(*args_, **kwargs_) - factory = staticmethod(factory) - def get_availabilityDuration(self): return self.availabilityDuration - def set_availabilityDuration(self, availabilityDuration): self.availabilityDuration = availabilityDuration - def get_DemandResponseProgramLink(self): return self.DemandResponseProgramLink - def set_DemandResponseProgramLink(self, DemandResponseProgramLink): self.DemandResponseProgramLink = DemandResponseProgramLink - def get_sheddablePercent(self): return self.sheddablePercent - def set_sheddablePercent(self, sheddablePercent): self.sheddablePercent = sheddablePercent - def get_sheddablePower(self): return self.sheddablePower - def set_sheddablePower(self, sheddablePower): self.sheddablePower = sheddablePower - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.availabilityDuration is not None or - self.DemandResponseProgramLink is not None or - self.sheddablePercent is not None or - self.sheddablePower is not None or - super(LoadShedAvailability, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LoadShedAvailability', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LoadShedAvailability') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LoadShedAvailability', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LoadShedAvailability'): - super(LoadShedAvailability, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LoadShedAvailability') - def exportChildren(self, outfile, level, namespace_='', name_='LoadShedAvailability', fromsubclass_=False, pretty_print=True): - super(LoadShedAvailability, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.availabilityDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%savailabilityDuration>%s%s' % (namespace_, self.gds_format_integer(self.availabilityDuration, input_name='availabilityDuration'), namespace_, eol_)) - if self.DemandResponseProgramLink is not None: - self.DemandResponseProgramLink.export(outfile, level, namespace_, name_='DemandResponseProgramLink', pretty_print=pretty_print) - if self.sheddablePercent is not None: - self.sheddablePercent.export(outfile, level, namespace_, name_='sheddablePercent', pretty_print=pretty_print) - if self.sheddablePower is not None: - self.sheddablePower.export(outfile, level, namespace_, name_='sheddablePower', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='LoadShedAvailability'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LoadShedAvailability, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LoadShedAvailability, self).exportLiteralChildren(outfile, level, name_) - if self.availabilityDuration is not None: - showIndent(outfile, level) - outfile.write('availabilityDuration=%d,\n' % self.availabilityDuration) - if self.DemandResponseProgramLink is not None: - showIndent(outfile, level) - outfile.write('DemandResponseProgramLink=model_.DemandResponseProgramLink(\n') - self.DemandResponseProgramLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.sheddablePercent is not None: - showIndent(outfile, level) - outfile.write('sheddablePercent=model_.PerCent(\n') - self.sheddablePercent.exportLiteral(outfile, level, name_='sheddablePercent') - showIndent(outfile, level) - outfile.write('),\n') - if self.sheddablePower is not None: - showIndent(outfile, level) - outfile.write('sheddablePower=model_.ActivePower(\n') - self.sheddablePower.exportLiteral(outfile, level, name_='sheddablePower') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LoadShedAvailability, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'availabilityDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'availabilityDuration') - self.availabilityDuration = ival_ - self.validate_UInt32(self.availabilityDuration) # validate type UInt32 - elif nodeName_ == 'DemandResponseProgramLink': - obj_ = DemandResponseProgramLink.factory() - obj_.build(child_) - self.DemandResponseProgramLink = obj_ - obj_.original_tagname_ = 'DemandResponseProgramLink' - elif nodeName_ == 'sheddablePercent': - obj_ = PerCent.factory() - obj_.build(child_) - self.sheddablePercent = obj_ - obj_.original_tagname_ = 'sheddablePercent' - elif nodeName_ == 'sheddablePower': - obj_ = ActivePower.factory() - obj_.build(child_) - self.sheddablePower = obj_ - obj_.original_tagname_ = 'sheddablePower' - super(LoadShedAvailability, self).buildChildren(child_, node, nodeName_, True) -# end class LoadShedAvailability - - -class EndDeviceControlList(SubscribableList): - """A List element to hold EndDeviceControl objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, EndDeviceControl=None): - self.original_tagname_ = None - super(EndDeviceControlList, self).__init__() - if EndDeviceControl is None: - self.EndDeviceControl = [] - else: - self.EndDeviceControl = EndDeviceControl - def factory(*args_, **kwargs_): - if EndDeviceControlList.subclass: - return EndDeviceControlList.subclass(*args_, **kwargs_) - else: - return EndDeviceControlList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_EndDeviceControl(self): return self.EndDeviceControl - def set_EndDeviceControl(self, EndDeviceControl): self.EndDeviceControl = EndDeviceControl - def add_EndDeviceControl(self, value): self.EndDeviceControl.append(value) - def insert_EndDeviceControl_at(self, index, value): self.EndDeviceControl.insert(index, value) - def replace_EndDeviceControl_at(self, index, value): self.EndDeviceControl[index] = value - def hasContent_(self): - if ( - self.EndDeviceControl or - super(EndDeviceControlList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDeviceControlList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceControlList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDeviceControlList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDeviceControlList'): - super(EndDeviceControlList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceControlList') - def exportChildren(self, outfile, level, namespace_='', name_='EndDeviceControlList', fromsubclass_=False, pretty_print=True): - super(EndDeviceControlList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for EndDeviceControl_ in self.EndDeviceControl: - EndDeviceControl_.export(outfile, level, namespace_, name_='EndDeviceControl', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='EndDeviceControlList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDeviceControlList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDeviceControlList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('EndDeviceControl=[\n') - level += 1 - for EndDeviceControl_ in self.EndDeviceControl: - showIndent(outfile, level) - outfile.write('model_.EndDeviceControl(\n') - EndDeviceControl_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDeviceControlList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'EndDeviceControl': - obj_ = EndDeviceControl.factory() - obj_.build(child_) - self.EndDeviceControl.append(obj_) - obj_.original_tagname_ = 'EndDeviceControl' - super(EndDeviceControlList, self).buildChildren(child_, node, nodeName_, True) -# end class EndDeviceControlList - - -class EndDeviceControl(RandomizableEvent): - """Instructs an EndDevice to perform a specified action.""" - subclass = None - superclass = RandomizableEvent - def __init__(self, ApplianceLoadReduction=None, deviceCategory=None, drProgramMandatory=None, DutyCycle=None, loadShiftForward=None, Offset=None, overrideDuration=None, SetPoint=None, TargetReduction=None): - self.original_tagname_ = None - super(EndDeviceControl, self).__init__() - self.ApplianceLoadReduction = ApplianceLoadReduction - self.deviceCategory = deviceCategory - self.drProgramMandatory = drProgramMandatory - self.DutyCycle = DutyCycle - self.loadShiftForward = loadShiftForward - self.Offset = Offset - self.overrideDuration = overrideDuration - self.SetPoint = SetPoint - self.TargetReduction = TargetReduction - def factory(*args_, **kwargs_): - if EndDeviceControl.subclass: - return EndDeviceControl.subclass(*args_, **kwargs_) - else: - return EndDeviceControl(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ApplianceLoadReduction(self): return self.ApplianceLoadReduction - def set_ApplianceLoadReduction(self, ApplianceLoadReduction): self.ApplianceLoadReduction = ApplianceLoadReduction - def get_deviceCategory(self): return self.deviceCategory - def set_deviceCategory(self, deviceCategory): self.deviceCategory = deviceCategory - def get_drProgramMandatory(self): return self.drProgramMandatory - def set_drProgramMandatory(self, drProgramMandatory): self.drProgramMandatory = drProgramMandatory - def get_DutyCycle(self): return self.DutyCycle - def set_DutyCycle(self, DutyCycle): self.DutyCycle = DutyCycle - def get_loadShiftForward(self): return self.loadShiftForward - def set_loadShiftForward(self, loadShiftForward): self.loadShiftForward = loadShiftForward - def get_Offset(self): return self.Offset - def set_Offset(self, Offset): self.Offset = Offset - def get_overrideDuration(self): return self.overrideDuration - def set_overrideDuration(self, overrideDuration): self.overrideDuration = overrideDuration - def get_SetPoint(self): return self.SetPoint - def set_SetPoint(self, SetPoint): self.SetPoint = SetPoint - def get_TargetReduction(self): return self.TargetReduction - def set_TargetReduction(self, TargetReduction): self.TargetReduction = TargetReduction - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.ApplianceLoadReduction is not None or - self.deviceCategory is not None or - self.drProgramMandatory is not None or - self.DutyCycle is not None or - self.loadShiftForward is not None or - self.Offset is not None or - self.overrideDuration is not None or - self.SetPoint is not None or - self.TargetReduction is not None or - super(EndDeviceControl, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDeviceControl', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceControl') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDeviceControl', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDeviceControl'): - super(EndDeviceControl, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceControl') - def exportChildren(self, outfile, level, namespace_='', name_='EndDeviceControl', fromsubclass_=False, pretty_print=True): - super(EndDeviceControl, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ApplianceLoadReduction is not None: - self.ApplianceLoadReduction.export(outfile, level, namespace_, name_='ApplianceLoadReduction', pretty_print=pretty_print) - if self.deviceCategory is not None: - self.deviceCategory.export(outfile, level, namespace_, name_='deviceCategory', pretty_print=pretty_print) - if self.drProgramMandatory is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdrProgramMandatory>%s%s' % (namespace_, self.gds_format_boolean(self.drProgramMandatory, input_name='drProgramMandatory'), namespace_, eol_)) - if self.DutyCycle is not None: - self.DutyCycle.export(outfile, level, namespace_, name_='DutyCycle', pretty_print=pretty_print) - if self.loadShiftForward is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sloadShiftForward>%s%s' % (namespace_, self.gds_format_boolean(self.loadShiftForward, input_name='loadShiftForward'), namespace_, eol_)) - if self.Offset is not None: - self.Offset.export(outfile, level, namespace_, name_='Offset', pretty_print=pretty_print) - if self.overrideDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%soverrideDuration>%s%s' % (namespace_, self.gds_format_integer(self.overrideDuration, input_name='overrideDuration'), namespace_, eol_)) - if self.SetPoint is not None: - self.SetPoint.export(outfile, level, namespace_, name_='SetPoint', pretty_print=pretty_print) - if self.TargetReduction is not None: - self.TargetReduction.export(outfile, level, namespace_, name_='TargetReduction', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='EndDeviceControl'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDeviceControl, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDeviceControl, self).exportLiteralChildren(outfile, level, name_) - if self.ApplianceLoadReduction is not None: - showIndent(outfile, level) - outfile.write('ApplianceLoadReduction=model_.ApplianceLoadReduction(\n') - self.ApplianceLoadReduction.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.deviceCategory is not None: - showIndent(outfile, level) - outfile.write('deviceCategory=model_.DeviceCategoryType(\n') - self.deviceCategory.exportLiteral(outfile, level, name_='deviceCategory') - showIndent(outfile, level) - outfile.write('),\n') - if self.drProgramMandatory is not None: - showIndent(outfile, level) - outfile.write('drProgramMandatory=%s,\n' % self.drProgramMandatory) - if self.DutyCycle is not None: - showIndent(outfile, level) - outfile.write('DutyCycle=model_.DutyCycle(\n') - self.DutyCycle.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.loadShiftForward is not None: - showIndent(outfile, level) - outfile.write('loadShiftForward=%s,\n' % self.loadShiftForward) - if self.Offset is not None: - showIndent(outfile, level) - outfile.write('Offset=model_.Offset(\n') - self.Offset.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.overrideDuration is not None: - showIndent(outfile, level) - outfile.write('overrideDuration=%d,\n' % self.overrideDuration) - if self.SetPoint is not None: - showIndent(outfile, level) - outfile.write('SetPoint=model_.SetPoint(\n') - self.SetPoint.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.TargetReduction is not None: - showIndent(outfile, level) - outfile.write('TargetReduction=model_.TargetReduction(\n') - self.TargetReduction.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDeviceControl, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ApplianceLoadReduction': - obj_ = ApplianceLoadReduction.factory() - obj_.build(child_) - self.ApplianceLoadReduction = obj_ - obj_.original_tagname_ = 'ApplianceLoadReduction' - elif nodeName_ == 'deviceCategory': - obj_ = DeviceCategoryType.factory() - obj_.build(child_) - self.deviceCategory = obj_ - obj_.original_tagname_ = 'deviceCategory' - elif nodeName_ == 'drProgramMandatory': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'drProgramMandatory') - self.drProgramMandatory = ival_ - elif nodeName_ == 'DutyCycle': - obj_ = DutyCycle.factory() - obj_.build(child_) - self.DutyCycle = obj_ - obj_.original_tagname_ = 'DutyCycle' - elif nodeName_ == 'loadShiftForward': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'loadShiftForward') - self.loadShiftForward = ival_ - elif nodeName_ == 'Offset': - obj_ = Offset.factory() - obj_.build(child_) - self.Offset = obj_ - obj_.original_tagname_ = 'Offset' - elif nodeName_ == 'overrideDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'overrideDuration') - self.overrideDuration = ival_ - self.validate_UInt16(self.overrideDuration) # validate type UInt16 - elif nodeName_ == 'SetPoint': - obj_ = SetPoint.factory() - obj_.build(child_) - self.SetPoint = obj_ - obj_.original_tagname_ = 'SetPoint' - elif nodeName_ == 'TargetReduction': - obj_ = TargetReduction.factory() - obj_.build(child_) - self.TargetReduction = obj_ - obj_.original_tagname_ = 'TargetReduction' - super(EndDeviceControl, self).buildChildren(child_, node, nodeName_, True) -# end class EndDeviceControl - - -class DemandResponseProgramList(SubscribableList): - """A List element to hold DemandResponseProgram objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, DemandResponseProgram=None): - self.original_tagname_ = None - super(DemandResponseProgramList, self).__init__() - if DemandResponseProgram is None: - self.DemandResponseProgram = [] - else: - self.DemandResponseProgram = DemandResponseProgram - def factory(*args_, **kwargs_): - if DemandResponseProgramList.subclass: - return DemandResponseProgramList.subclass(*args_, **kwargs_) - else: - return DemandResponseProgramList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DemandResponseProgram(self): return self.DemandResponseProgram - def set_DemandResponseProgram(self, DemandResponseProgram): self.DemandResponseProgram = DemandResponseProgram - def add_DemandResponseProgram(self, value): self.DemandResponseProgram.append(value) - def insert_DemandResponseProgram_at(self, index, value): self.DemandResponseProgram.insert(index, value) - def replace_DemandResponseProgram_at(self, index, value): self.DemandResponseProgram[index] = value - def hasContent_(self): - if ( - self.DemandResponseProgram or - super(DemandResponseProgramList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DemandResponseProgramList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgramList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DemandResponseProgramList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DemandResponseProgramList'): - super(DemandResponseProgramList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgramList') - def exportChildren(self, outfile, level, namespace_='', name_='DemandResponseProgramList', fromsubclass_=False, pretty_print=True): - super(DemandResponseProgramList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for DemandResponseProgram_ in self.DemandResponseProgram: - DemandResponseProgram_.export(outfile, level, namespace_, name_='DemandResponseProgram', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DemandResponseProgramList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DemandResponseProgramList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DemandResponseProgramList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('DemandResponseProgram=[\n') - level += 1 - for DemandResponseProgram_ in self.DemandResponseProgram: - showIndent(outfile, level) - outfile.write('model_.DemandResponseProgram(\n') - DemandResponseProgram_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DemandResponseProgramList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DemandResponseProgram': - obj_ = DemandResponseProgram.factory() - obj_.build(child_) - self.DemandResponseProgram.append(obj_) - obj_.original_tagname_ = 'DemandResponseProgram' - super(DemandResponseProgramList, self).buildChildren(child_, node, nodeName_, True) -# end class DemandResponseProgramList - - -class DemandResponseProgram(IdentifiedObject): - """Demand response program.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, ActiveEndDeviceControlListLink=None, availabilityUpdatePercentChangeThreshold=None, availabilityUpdatePowerChangeThreshold=None, EndDeviceControlListLink=None, primacy=None): - self.original_tagname_ = None - super(DemandResponseProgram, self).__init__() - self.ActiveEndDeviceControlListLink = ActiveEndDeviceControlListLink - self.availabilityUpdatePercentChangeThreshold = availabilityUpdatePercentChangeThreshold - self.availabilityUpdatePowerChangeThreshold = availabilityUpdatePowerChangeThreshold - self.EndDeviceControlListLink = EndDeviceControlListLink - self.primacy = primacy - def factory(*args_, **kwargs_): - if DemandResponseProgram.subclass: - return DemandResponseProgram.subclass(*args_, **kwargs_) - else: - return DemandResponseProgram(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ActiveEndDeviceControlListLink(self): return self.ActiveEndDeviceControlListLink - def set_ActiveEndDeviceControlListLink(self, ActiveEndDeviceControlListLink): self.ActiveEndDeviceControlListLink = ActiveEndDeviceControlListLink - def get_availabilityUpdatePercentChangeThreshold(self): return self.availabilityUpdatePercentChangeThreshold - def set_availabilityUpdatePercentChangeThreshold(self, availabilityUpdatePercentChangeThreshold): self.availabilityUpdatePercentChangeThreshold = availabilityUpdatePercentChangeThreshold - def get_availabilityUpdatePowerChangeThreshold(self): return self.availabilityUpdatePowerChangeThreshold - def set_availabilityUpdatePowerChangeThreshold(self, availabilityUpdatePowerChangeThreshold): self.availabilityUpdatePowerChangeThreshold = availabilityUpdatePowerChangeThreshold - def get_EndDeviceControlListLink(self): return self.EndDeviceControlListLink - def set_EndDeviceControlListLink(self, EndDeviceControlListLink): self.EndDeviceControlListLink = EndDeviceControlListLink - def get_primacy(self): return self.primacy - def set_primacy(self, primacy): self.primacy = primacy - def hasContent_(self): - if ( - self.ActiveEndDeviceControlListLink is not None or - self.availabilityUpdatePercentChangeThreshold is not None or - self.availabilityUpdatePowerChangeThreshold is not None or - self.EndDeviceControlListLink is not None or - self.primacy is not None or - super(DemandResponseProgram, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DemandResponseProgram', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgram') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DemandResponseProgram', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DemandResponseProgram'): - super(DemandResponseProgram, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DemandResponseProgram') - def exportChildren(self, outfile, level, namespace_='', name_='DemandResponseProgram', fromsubclass_=False, pretty_print=True): - super(DemandResponseProgram, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ActiveEndDeviceControlListLink is not None: - self.ActiveEndDeviceControlListLink.export(outfile, level, namespace_, name_='ActiveEndDeviceControlListLink', pretty_print=pretty_print) - if self.availabilityUpdatePercentChangeThreshold is not None: - self.availabilityUpdatePercentChangeThreshold.export(outfile, level, namespace_, name_='availabilityUpdatePercentChangeThreshold', pretty_print=pretty_print) - if self.availabilityUpdatePowerChangeThreshold is not None: - self.availabilityUpdatePowerChangeThreshold.export(outfile, level, namespace_, name_='availabilityUpdatePowerChangeThreshold', pretty_print=pretty_print) - if self.EndDeviceControlListLink is not None: - self.EndDeviceControlListLink.export(outfile, level, namespace_, name_='EndDeviceControlListLink', pretty_print=pretty_print) - if self.primacy is not None: - self.primacy.export(outfile, level, namespace_, name_='primacy', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DemandResponseProgram'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DemandResponseProgram, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DemandResponseProgram, self).exportLiteralChildren(outfile, level, name_) - if self.ActiveEndDeviceControlListLink is not None: - showIndent(outfile, level) - outfile.write('ActiveEndDeviceControlListLink=model_.ActiveEndDeviceControlListLink(\n') - self.ActiveEndDeviceControlListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.availabilityUpdatePercentChangeThreshold is not None: - showIndent(outfile, level) - outfile.write('availabilityUpdatePercentChangeThreshold=model_.PerCent(\n') - self.availabilityUpdatePercentChangeThreshold.exportLiteral(outfile, level, name_='availabilityUpdatePercentChangeThreshold') - showIndent(outfile, level) - outfile.write('),\n') - if self.availabilityUpdatePowerChangeThreshold is not None: - showIndent(outfile, level) - outfile.write('availabilityUpdatePowerChangeThreshold=model_.ActivePower(\n') - self.availabilityUpdatePowerChangeThreshold.exportLiteral(outfile, level, name_='availabilityUpdatePowerChangeThreshold') - showIndent(outfile, level) - outfile.write('),\n') - if self.EndDeviceControlListLink is not None: - showIndent(outfile, level) - outfile.write('EndDeviceControlListLink=model_.EndDeviceControlListLink(\n') - self.EndDeviceControlListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.primacy is not None: - showIndent(outfile, level) - outfile.write('primacy=model_.PrimacyType(\n') - self.primacy.exportLiteral(outfile, level, name_='primacy') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DemandResponseProgram, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ActiveEndDeviceControlListLink': - obj_ = ActiveEndDeviceControlListLink.factory() - obj_.build(child_) - self.ActiveEndDeviceControlListLink = obj_ - obj_.original_tagname_ = 'ActiveEndDeviceControlListLink' - elif nodeName_ == 'availabilityUpdatePercentChangeThreshold': - obj_ = PerCent.factory() - obj_.build(child_) - self.availabilityUpdatePercentChangeThreshold = obj_ - obj_.original_tagname_ = 'availabilityUpdatePercentChangeThreshold' - elif nodeName_ == 'availabilityUpdatePowerChangeThreshold': - obj_ = ActivePower.factory() - obj_.build(child_) - self.availabilityUpdatePowerChangeThreshold = obj_ - obj_.original_tagname_ = 'availabilityUpdatePowerChangeThreshold' - elif nodeName_ == 'EndDeviceControlListLink': - obj_ = EndDeviceControlListLink.factory() - obj_.build(child_) - self.EndDeviceControlListLink = obj_ - obj_.original_tagname_ = 'EndDeviceControlListLink' - elif nodeName_ == 'primacy': - obj_ = PrimacyType.factory() - obj_.build(child_) - self.primacy = obj_ - obj_.original_tagname_ = 'primacy' - super(DemandResponseProgram, self).buildChildren(child_, node, nodeName_, True) -# end class DemandResponseProgram - - -class FileStatus(Resource): - """This object provides status of device file load and activation - operations.""" - subclass = None - superclass = Resource - def __init__(self, activateTime=None, FileLink=None, loadPercent=None, nextRequestAttempt=None, request503Count=None, requestFailCount=None, status=None, statusTime=None): - self.original_tagname_ = None - super(FileStatus, self).__init__() - self.activateTime = activateTime - self.FileLink = FileLink - self.loadPercent = loadPercent - self.nextRequestAttempt = nextRequestAttempt - self.request503Count = request503Count - self.requestFailCount = requestFailCount - self.status = status - self.statusTime = statusTime - def factory(*args_, **kwargs_): - if FileStatus.subclass: - return FileStatus.subclass(*args_, **kwargs_) - else: - return FileStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_activateTime(self): return self.activateTime - def set_activateTime(self, activateTime): self.activateTime = activateTime - def get_FileLink(self): return self.FileLink - def set_FileLink(self, FileLink): self.FileLink = FileLink - def get_loadPercent(self): return self.loadPercent - def set_loadPercent(self, loadPercent): self.loadPercent = loadPercent - def get_nextRequestAttempt(self): return self.nextRequestAttempt - def set_nextRequestAttempt(self, nextRequestAttempt): self.nextRequestAttempt = nextRequestAttempt - def get_request503Count(self): return self.request503Count - def set_request503Count(self, request503Count): self.request503Count = request503Count - def get_requestFailCount(self): return self.requestFailCount - def set_requestFailCount(self, requestFailCount): self.requestFailCount = requestFailCount - def get_status(self): return self.status - def set_status(self, status): self.status = status - def get_statusTime(self): return self.statusTime - def set_statusTime(self, statusTime): self.statusTime = statusTime - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.activateTime is not None or - self.FileLink is not None or - self.loadPercent is not None or - self.nextRequestAttempt is not None or - self.request503Count is not None or - self.requestFailCount is not None or - self.status is not None or - self.statusTime is not None or - super(FileStatus, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FileStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FileStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FileStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FileStatus'): - super(FileStatus, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FileStatus') - def exportChildren(self, outfile, level, namespace_='', name_='FileStatus', fromsubclass_=False, pretty_print=True): - super(FileStatus, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.activateTime is not None: - self.activateTime.export(outfile, level, namespace_, name_='activateTime', pretty_print=pretty_print) - if self.FileLink is not None: - self.FileLink.export(outfile, level, namespace_, name_='FileLink', pretty_print=pretty_print) - if self.loadPercent is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sloadPercent>%s%s' % (namespace_, self.gds_format_integer(self.loadPercent, input_name='loadPercent'), namespace_, eol_)) - if self.nextRequestAttempt is not None: - self.nextRequestAttempt.export(outfile, level, namespace_, name_='nextRequestAttempt', pretty_print=pretty_print) - if self.request503Count is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srequest503Count>%s%s' % (namespace_, self.gds_format_integer(self.request503Count, input_name='request503Count'), namespace_, eol_)) - if self.requestFailCount is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srequestFailCount>%s%s' % (namespace_, self.gds_format_integer(self.requestFailCount, input_name='requestFailCount'), namespace_, eol_)) - if self.status is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sstatus>%s%s' % (namespace_, self.gds_format_integer(self.status, input_name='status'), namespace_, eol_)) - if self.statusTime is not None: - self.statusTime.export(outfile, level, namespace_, name_='statusTime', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FileStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FileStatus, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FileStatus, self).exportLiteralChildren(outfile, level, name_) - if self.activateTime is not None: - showIndent(outfile, level) - outfile.write('activateTime=model_.TimeType(\n') - self.activateTime.exportLiteral(outfile, level, name_='activateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.FileLink is not None: - showIndent(outfile, level) - outfile.write('FileLink=model_.FileLink(\n') - self.FileLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.loadPercent is not None: - showIndent(outfile, level) - outfile.write('loadPercent=%d,\n' % self.loadPercent) - if self.nextRequestAttempt is not None: - showIndent(outfile, level) - outfile.write('nextRequestAttempt=model_.TimeType(\n') - self.nextRequestAttempt.exportLiteral(outfile, level, name_='nextRequestAttempt') - showIndent(outfile, level) - outfile.write('),\n') - if self.request503Count is not None: - showIndent(outfile, level) - outfile.write('request503Count=%d,\n' % self.request503Count) - if self.requestFailCount is not None: - showIndent(outfile, level) - outfile.write('requestFailCount=%d,\n' % self.requestFailCount) - if self.status is not None: - showIndent(outfile, level) - outfile.write('status=%d,\n' % self.status) - if self.statusTime is not None: - showIndent(outfile, level) - outfile.write('statusTime=model_.TimeType(\n') - self.statusTime.exportLiteral(outfile, level, name_='statusTime') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FileStatus, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'activateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.activateTime = obj_ - obj_.original_tagname_ = 'activateTime' - elif nodeName_ == 'FileLink': - obj_ = FileLink.factory() - obj_.build(child_) - self.FileLink = obj_ - obj_.original_tagname_ = 'FileLink' - elif nodeName_ == 'loadPercent': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'loadPercent') - self.loadPercent = ival_ - self.validate_UInt8(self.loadPercent) # validate type UInt8 - elif nodeName_ == 'nextRequestAttempt': - obj_ = TimeType.factory() - obj_.build(child_) - self.nextRequestAttempt = obj_ - obj_.original_tagname_ = 'nextRequestAttempt' - elif nodeName_ == 'request503Count': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'request503Count') - self.request503Count = ival_ - self.validate_UInt16(self.request503Count) # validate type UInt16 - elif nodeName_ == 'requestFailCount': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'requestFailCount') - self.requestFailCount = ival_ - self.validate_UInt16(self.requestFailCount) # validate type UInt16 - elif nodeName_ == 'status': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'status') - self.status = ival_ - self.validate_UInt8(self.status) # validate type UInt8 - elif nodeName_ == 'statusTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.statusTime = obj_ - obj_.original_tagname_ = 'statusTime' - super(FileStatus, self).buildChildren(child_, node, nodeName_, True) -# end class FileStatus - - -class FileList(List): - """A List element to hold File objects.""" - subclass = None - superclass = List - def __init__(self, File=None): - self.original_tagname_ = None - super(FileList, self).__init__() - if File is None: - self.File = [] - else: - self.File = File - def factory(*args_, **kwargs_): - if FileList.subclass: - return FileList.subclass(*args_, **kwargs_) - else: - return FileList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_File(self): return self.File - def set_File(self, File): self.File = File - def add_File(self, value): self.File.append(value) - def insert_File_at(self, index, value): self.File.insert(index, value) - def replace_File_at(self, index, value): self.File[index] = value - def hasContent_(self): - if ( - self.File or - super(FileList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FileList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FileList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FileList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FileList'): - super(FileList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FileList') - def exportChildren(self, outfile, level, namespace_='', name_='FileList', fromsubclass_=False, pretty_print=True): - super(FileList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for File_ in self.File: - File_.export(outfile, level, namespace_, name_='File', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FileList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FileList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FileList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('File=[\n') - level += 1 - for File_ in self.File: - showIndent(outfile, level) - outfile.write('model_.File(\n') - File_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FileList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'File': - obj_ = File.factory() - obj_.build(child_) - self.File.append(obj_) - obj_.original_tagname_ = 'File' - super(FileList, self).buildChildren(child_, node, nodeName_, True) -# end class FileList - - -class File(Resource): - """This resource contains various meta-data describing a file's - characteristics. The meta-data provides general file information - and also is used to support filtered queries of file lists""" - subclass = None - superclass = Resource - def __init__(self, activateTime=None, fileURI=None, lFDI=None, mfHwVer=None, mfID=None, mfModel=None, mfSerNum=None, mfVer=None, size=None, type_=None): - self.original_tagname_ = None - super(File, self).__init__() - self.activateTime = activateTime - self.fileURI = fileURI - self.lFDI = lFDI - self.mfHwVer = mfHwVer - self.mfID = mfID - self.mfModel = mfModel - self.mfSerNum = mfSerNum - self.mfVer = mfVer - self.size = size - self.type_ = type_ - def factory(*args_, **kwargs_): - if File.subclass: - return File.subclass(*args_, **kwargs_) - else: - return File(*args_, **kwargs_) - factory = staticmethod(factory) - def get_activateTime(self): return self.activateTime - def set_activateTime(self, activateTime): self.activateTime = activateTime - def get_fileURI(self): return self.fileURI - def set_fileURI(self, fileURI): self.fileURI = fileURI - def get_lFDI(self): return self.lFDI - def set_lFDI(self, lFDI): self.lFDI = lFDI - def get_mfHwVer(self): return self.mfHwVer - def set_mfHwVer(self, mfHwVer): self.mfHwVer = mfHwVer - def get_mfID(self): return self.mfID - def set_mfID(self, mfID): self.mfID = mfID - def get_mfModel(self): return self.mfModel - def set_mfModel(self, mfModel): self.mfModel = mfModel - def get_mfSerNum(self): return self.mfSerNum - def set_mfSerNum(self, mfSerNum): self.mfSerNum = mfSerNum - def get_mfVer(self): return self.mfVer - def set_mfVer(self, mfVer): self.mfVer = mfVer - def get_size(self): return self.size - def set_size(self, size): self.size = size - def get_type(self): return self.type_ - def set_type(self, type_): self.type_ = type_ - def validate_HexBinary160(self, value): - # Validate type HexBinary160, a restriction on xs:hexBinary. - pass - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def validate_String16(self, value): - # Validate type String16, a restriction on xs:string. - pass - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_HexBinary16(self, value): - # Validate type HexBinary16, a restriction on xs:hexBinary. - pass - def hasContent_(self): - if ( - self.activateTime is not None or - self.fileURI is not None or - self.lFDI is not None or - self.mfHwVer is not None or - self.mfID is not None or - self.mfModel is not None or - self.mfSerNum is not None or - self.mfVer is not None or - self.size is not None or - self.type_ is not None or - super(File, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='File', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='File') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='File', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='File'): - super(File, self).exportAttributes(outfile, level, already_processed, namespace_, name_='File') - def exportChildren(self, outfile, level, namespace_='', name_='File', fromsubclass_=False, pretty_print=True): - super(File, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.activateTime is not None: - self.activateTime.export(outfile, level, namespace_, name_='activateTime', pretty_print=pretty_print) - if self.fileURI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sfileURI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.fileURI).encode(ExternalEncoding), input_name='fileURI'), namespace_, eol_)) - if self.lFDI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slFDI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.lFDI).encode(ExternalEncoding), input_name='lFDI'), namespace_, eol_)) - if self.mfHwVer is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfHwVer>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfHwVer).encode(ExternalEncoding), input_name='mfHwVer'), namespace_, eol_)) - if self.mfID is not None: - self.mfID.export(outfile, level, namespace_, name_='mfID', pretty_print=pretty_print) - if self.mfModel is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfModel>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfModel).encode(ExternalEncoding), input_name='mfModel'), namespace_, eol_)) - if self.mfSerNum is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfSerNum>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfSerNum).encode(ExternalEncoding), input_name='mfSerNum'), namespace_, eol_)) - if self.mfVer is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfVer>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfVer).encode(ExternalEncoding), input_name='mfVer'), namespace_, eol_)) - if self.size is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssize>%s%s' % (namespace_, self.gds_format_integer(self.size, input_name='size'), namespace_, eol_)) - if self.type_ is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%stype>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.type_).encode(ExternalEncoding), input_name='type'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='File'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(File, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(File, self).exportLiteralChildren(outfile, level, name_) - if self.activateTime is not None: - showIndent(outfile, level) - outfile.write('activateTime=model_.TimeType(\n') - self.activateTime.exportLiteral(outfile, level, name_='activateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.fileURI is not None: - showIndent(outfile, level) - outfile.write('fileURI=%s,\n' % quote_python(self.fileURI).encode(ExternalEncoding)) - if self.lFDI is not None: - showIndent(outfile, level) - outfile.write('lFDI=%s,\n' % quote_python(self.lFDI).encode(ExternalEncoding)) - if self.mfHwVer is not None: - showIndent(outfile, level) - outfile.write('mfHwVer=%s,\n' % quote_python(self.mfHwVer).encode(ExternalEncoding)) - if self.mfID is not None: - showIndent(outfile, level) - outfile.write('mfID=model_.PENType(\n') - self.mfID.exportLiteral(outfile, level, name_='mfID') - showIndent(outfile, level) - outfile.write('),\n') - if self.mfModel is not None: - showIndent(outfile, level) - outfile.write('mfModel=%s,\n' % quote_python(self.mfModel).encode(ExternalEncoding)) - if self.mfSerNum is not None: - showIndent(outfile, level) - outfile.write('mfSerNum=%s,\n' % quote_python(self.mfSerNum).encode(ExternalEncoding)) - if self.mfVer is not None: - showIndent(outfile, level) - outfile.write('mfVer=%s,\n' % quote_python(self.mfVer).encode(ExternalEncoding)) - if self.size is not None: - showIndent(outfile, level) - outfile.write('size=%d,\n' % self.size) - if self.type_ is not None: - showIndent(outfile, level) - outfile.write('type_=%s,\n' % quote_python(self.type_).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(File, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'activateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.activateTime = obj_ - obj_.original_tagname_ = 'activateTime' - elif nodeName_ == 'fileURI': - fileURI_ = child_.text - fileURI_ = self.gds_validate_string(fileURI_, node, 'fileURI') - self.fileURI = fileURI_ - elif nodeName_ == 'lFDI': - lFDI_ = child_.text - lFDI_ = self.gds_validate_string(lFDI_, node, 'lFDI') - self.lFDI = lFDI_ - self.validate_HexBinary160(self.lFDI) # validate type HexBinary160 - elif nodeName_ == 'mfHwVer': - mfHwVer_ = child_.text - mfHwVer_ = self.gds_validate_string(mfHwVer_, node, 'mfHwVer') - self.mfHwVer = mfHwVer_ - self.validate_String32(self.mfHwVer) # validate type String32 - elif nodeName_ == 'mfID': - obj_ = PENType.factory() - obj_.build(child_) - self.mfID = obj_ - obj_.original_tagname_ = 'mfID' - elif nodeName_ == 'mfModel': - mfModel_ = child_.text - mfModel_ = self.gds_validate_string(mfModel_, node, 'mfModel') - self.mfModel = mfModel_ - self.validate_String32(self.mfModel) # validate type String32 - elif nodeName_ == 'mfSerNum': - mfSerNum_ = child_.text - mfSerNum_ = self.gds_validate_string(mfSerNum_, node, 'mfSerNum') - self.mfSerNum = mfSerNum_ - self.validate_String32(self.mfSerNum) # validate type String32 - elif nodeName_ == 'mfVer': - mfVer_ = child_.text - mfVer_ = self.gds_validate_string(mfVer_, node, 'mfVer') - self.mfVer = mfVer_ - self.validate_String16(self.mfVer) # validate type String16 - elif nodeName_ == 'size': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'size') - self.size = ival_ - self.validate_UInt32(self.size) # validate type UInt32 - elif nodeName_ == 'type': - type_ = child_.text - type_ = self.gds_validate_string(type_, node, 'type') - self.type_ = type_ - self.validate_HexBinary16(self.type_) # validate type HexBinary16 - super(File, self).buildChildren(child_, node, nodeName_, True) -# end class File - - -class PriceResponseCfgList(List): - """A List element to hold PriceResponseCfg objects.""" - subclass = None - superclass = List - def __init__(self, PriceResponseCfg=None): - self.original_tagname_ = None - super(PriceResponseCfgList, self).__init__() - if PriceResponseCfg is None: - self.PriceResponseCfg = [] - else: - self.PriceResponseCfg = PriceResponseCfg - def factory(*args_, **kwargs_): - if PriceResponseCfgList.subclass: - return PriceResponseCfgList.subclass(*args_, **kwargs_) - else: - return PriceResponseCfgList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_PriceResponseCfg(self): return self.PriceResponseCfg - def set_PriceResponseCfg(self, PriceResponseCfg): self.PriceResponseCfg = PriceResponseCfg - def add_PriceResponseCfg(self, value): self.PriceResponseCfg.append(value) - def insert_PriceResponseCfg_at(self, index, value): self.PriceResponseCfg.insert(index, value) - def replace_PriceResponseCfg_at(self, index, value): self.PriceResponseCfg[index] = value - def hasContent_(self): - if ( - self.PriceResponseCfg or - super(PriceResponseCfgList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PriceResponseCfgList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponseCfgList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PriceResponseCfgList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PriceResponseCfgList'): - super(PriceResponseCfgList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponseCfgList') - def exportChildren(self, outfile, level, namespace_='', name_='PriceResponseCfgList', fromsubclass_=False, pretty_print=True): - super(PriceResponseCfgList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for PriceResponseCfg_ in self.PriceResponseCfg: - PriceResponseCfg_.export(outfile, level, namespace_, name_='PriceResponseCfg', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='PriceResponseCfgList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PriceResponseCfgList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PriceResponseCfgList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('PriceResponseCfg=[\n') - level += 1 - for PriceResponseCfg_ in self.PriceResponseCfg: - showIndent(outfile, level) - outfile.write('model_.PriceResponseCfg(\n') - PriceResponseCfg_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PriceResponseCfgList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'PriceResponseCfg': - obj_ = PriceResponseCfg.factory() - obj_.build(child_) - self.PriceResponseCfg.append(obj_) - obj_.original_tagname_ = 'PriceResponseCfg' - super(PriceResponseCfgList, self).buildChildren(child_, node, nodeName_, True) -# end class PriceResponseCfgList - - -class PriceResponseCfg(Resource): - """Configuration data that specifies how price responsive devices - SHOULD respond to price changes while acting upon a given - RateComponent.""" - subclass = None - superclass = Resource - def __init__(self, consumeThreshold=None, maxReductionThreshold=None, RateComponentLink=None): - self.original_tagname_ = None - super(PriceResponseCfg, self).__init__() - self.consumeThreshold = consumeThreshold - self.maxReductionThreshold = maxReductionThreshold - self.RateComponentLink = RateComponentLink - def factory(*args_, **kwargs_): - if PriceResponseCfg.subclass: - return PriceResponseCfg.subclass(*args_, **kwargs_) - else: - return PriceResponseCfg(*args_, **kwargs_) - factory = staticmethod(factory) - def get_consumeThreshold(self): return self.consumeThreshold - def set_consumeThreshold(self, consumeThreshold): self.consumeThreshold = consumeThreshold - def get_maxReductionThreshold(self): return self.maxReductionThreshold - def set_maxReductionThreshold(self, maxReductionThreshold): self.maxReductionThreshold = maxReductionThreshold - def get_RateComponentLink(self): return self.RateComponentLink - def set_RateComponentLink(self, RateComponentLink): self.RateComponentLink = RateComponentLink - def validate_Int32(self, value): - # Validate type Int32, a restriction on xs:int. - pass - def hasContent_(self): - if ( - self.consumeThreshold is not None or - self.maxReductionThreshold is not None or - self.RateComponentLink is not None or - super(PriceResponseCfg, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PriceResponseCfg', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponseCfg') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PriceResponseCfg', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PriceResponseCfg'): - super(PriceResponseCfg, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponseCfg') - def exportChildren(self, outfile, level, namespace_='', name_='PriceResponseCfg', fromsubclass_=False, pretty_print=True): - super(PriceResponseCfg, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.consumeThreshold is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sconsumeThreshold>%s%s' % (namespace_, self.gds_format_integer(self.consumeThreshold, input_name='consumeThreshold'), namespace_, eol_)) - if self.maxReductionThreshold is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smaxReductionThreshold>%s%s' % (namespace_, self.gds_format_integer(self.maxReductionThreshold, input_name='maxReductionThreshold'), namespace_, eol_)) - if self.RateComponentLink is not None: - self.RateComponentLink.export(outfile, level, namespace_, name_='RateComponentLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='PriceResponseCfg'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PriceResponseCfg, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PriceResponseCfg, self).exportLiteralChildren(outfile, level, name_) - if self.consumeThreshold is not None: - showIndent(outfile, level) - outfile.write('consumeThreshold=%d,\n' % self.consumeThreshold) - if self.maxReductionThreshold is not None: - showIndent(outfile, level) - outfile.write('maxReductionThreshold=%d,\n' % self.maxReductionThreshold) - if self.RateComponentLink is not None: - showIndent(outfile, level) - outfile.write('RateComponentLink=model_.RateComponentLink(\n') - self.RateComponentLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PriceResponseCfg, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'consumeThreshold': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'consumeThreshold') - self.consumeThreshold = ival_ - self.validate_Int32(self.consumeThreshold) # validate type Int32 - elif nodeName_ == 'maxReductionThreshold': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'maxReductionThreshold') - self.maxReductionThreshold = ival_ - self.validate_Int32(self.maxReductionThreshold) # validate type Int32 - elif nodeName_ == 'RateComponentLink': - obj_ = RateComponentLink.factory() - obj_.build(child_) - self.RateComponentLink = obj_ - obj_.original_tagname_ = 'RateComponentLink' - super(PriceResponseCfg, self).buildChildren(child_, node, nodeName_, True) -# end class PriceResponseCfg - - -class Configuration(SubscribableResource): - """This resource contains various settings to control the operation of - the device""" - subclass = None - superclass = SubscribableResource - def __init__(self, currentLocale=None, PowerConfiguration=None, PriceResponseCfgListLink=None, TimeConfiguration=None, userDeviceName=None): - self.original_tagname_ = None - super(Configuration, self).__init__() - self.currentLocale = currentLocale - self.PowerConfiguration = PowerConfiguration - self.PriceResponseCfgListLink = PriceResponseCfgListLink - self.TimeConfiguration = TimeConfiguration - self.userDeviceName = userDeviceName - def factory(*args_, **kwargs_): - if Configuration.subclass: - return Configuration.subclass(*args_, **kwargs_) - else: - return Configuration(*args_, **kwargs_) - factory = staticmethod(factory) - def get_currentLocale(self): return self.currentLocale - def set_currentLocale(self, currentLocale): self.currentLocale = currentLocale - def get_PowerConfiguration(self): return self.PowerConfiguration - def set_PowerConfiguration(self, PowerConfiguration): self.PowerConfiguration = PowerConfiguration - def get_PriceResponseCfgListLink(self): return self.PriceResponseCfgListLink - def set_PriceResponseCfgListLink(self, PriceResponseCfgListLink): self.PriceResponseCfgListLink = PriceResponseCfgListLink - def get_TimeConfiguration(self): return self.TimeConfiguration - def set_TimeConfiguration(self, TimeConfiguration): self.TimeConfiguration = TimeConfiguration - def get_userDeviceName(self): return self.userDeviceName - def set_userDeviceName(self, userDeviceName): self.userDeviceName = userDeviceName - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.currentLocale is not None or - self.PowerConfiguration is not None or - self.PriceResponseCfgListLink is not None or - self.TimeConfiguration is not None or - self.userDeviceName is not None or - super(Configuration, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Configuration', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Configuration') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Configuration', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Configuration'): - super(Configuration, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Configuration') - def exportChildren(self, outfile, level, namespace_='', name_='Configuration', fromsubclass_=False, pretty_print=True): - super(Configuration, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.currentLocale is not None: - self.currentLocale.export(outfile, level, namespace_, name_='currentLocale', pretty_print=pretty_print) - if self.PowerConfiguration is not None: - self.PowerConfiguration.export(outfile, level, namespace_, name_='PowerConfiguration', pretty_print=pretty_print) - if self.PriceResponseCfgListLink is not None: - self.PriceResponseCfgListLink.export(outfile, level, namespace_, name_='PriceResponseCfgListLink', pretty_print=pretty_print) - if self.TimeConfiguration is not None: - self.TimeConfiguration.export(outfile, level, namespace_, name_='TimeConfiguration', pretty_print=pretty_print) - if self.userDeviceName is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%suserDeviceName>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.userDeviceName).encode(ExternalEncoding), input_name='userDeviceName'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Configuration'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Configuration, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Configuration, self).exportLiteralChildren(outfile, level, name_) - if self.currentLocale is not None: - showIndent(outfile, level) - outfile.write('currentLocale=model_.LocaleType(\n') - self.currentLocale.exportLiteral(outfile, level, name_='currentLocale') - showIndent(outfile, level) - outfile.write('),\n') - if self.PowerConfiguration is not None: - showIndent(outfile, level) - outfile.write('PowerConfiguration=model_.PowerConfiguration(\n') - self.PowerConfiguration.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.PriceResponseCfgListLink is not None: - showIndent(outfile, level) - outfile.write('PriceResponseCfgListLink=model_.PriceResponseCfgListLink(\n') - self.PriceResponseCfgListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.TimeConfiguration is not None: - showIndent(outfile, level) - outfile.write('TimeConfiguration=model_.TimeConfiguration(\n') - self.TimeConfiguration.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.userDeviceName is not None: - showIndent(outfile, level) - outfile.write('userDeviceName=%s,\n' % quote_python(self.userDeviceName).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Configuration, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'currentLocale': - obj_ = LocaleType.factory() - obj_.build(child_) - self.currentLocale = obj_ - obj_.original_tagname_ = 'currentLocale' - elif nodeName_ == 'PowerConfiguration': - obj_ = PowerConfiguration.factory() - obj_.build(child_) - self.PowerConfiguration = obj_ - obj_.original_tagname_ = 'PowerConfiguration' - elif nodeName_ == 'PriceResponseCfgListLink': - obj_ = PriceResponseCfgListLink.factory() - obj_.build(child_) - self.PriceResponseCfgListLink = obj_ - obj_.original_tagname_ = 'PriceResponseCfgListLink' - elif nodeName_ == 'TimeConfiguration': - obj_ = TimeConfiguration.factory() - obj_.build(child_) - self.TimeConfiguration = obj_ - obj_.original_tagname_ = 'TimeConfiguration' - elif nodeName_ == 'userDeviceName': - userDeviceName_ = child_.text - userDeviceName_ = self.gds_validate_string(userDeviceName_, node, 'userDeviceName') - self.userDeviceName = userDeviceName_ - self.validate_String32(self.userDeviceName) # validate type String32 - super(Configuration, self).buildChildren(child_, node, nodeName_, True) -# end class Configuration - - -class LogEventList(SubscribableList): - """A List element to hold LogEvent objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, LogEvent=None): - self.original_tagname_ = None - super(LogEventList, self).__init__() - if LogEvent is None: - self.LogEvent = [] - else: - self.LogEvent = LogEvent - def factory(*args_, **kwargs_): - if LogEventList.subclass: - return LogEventList.subclass(*args_, **kwargs_) - else: - return LogEventList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_LogEvent(self): return self.LogEvent - def set_LogEvent(self, LogEvent): self.LogEvent = LogEvent - def add_LogEvent(self, value): self.LogEvent.append(value) - def insert_LogEvent_at(self, index, value): self.LogEvent.insert(index, value) - def replace_LogEvent_at(self, index, value): self.LogEvent[index] = value - def hasContent_(self): - if ( - self.LogEvent or - super(LogEventList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LogEventList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LogEventList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LogEventList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LogEventList'): - super(LogEventList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LogEventList') - def exportChildren(self, outfile, level, namespace_='', name_='LogEventList', fromsubclass_=False, pretty_print=True): - super(LogEventList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for LogEvent_ in self.LogEvent: - LogEvent_.export(outfile, level, namespace_, name_='LogEvent', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='LogEventList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LogEventList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LogEventList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('LogEvent=[\n') - level += 1 - for LogEvent_ in self.LogEvent: - showIndent(outfile, level) - outfile.write('model_.LogEvent(\n') - LogEvent_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LogEventList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'LogEvent': - obj_ = LogEvent.factory() - obj_.build(child_) - self.LogEvent.append(obj_) - obj_.original_tagname_ = 'LogEvent' - super(LogEventList, self).buildChildren(child_, node, nodeName_, True) -# end class LogEventList - - -class LogEvent(Resource): - """A time stamped instance of a significant event detected by the - device.""" - subclass = None - superclass = Resource - def __init__(self, createdDateTime=None, extendedData=None, functionSet=None, logEventCode=None, logEventID=None, logEventPEN=None, profileID=None): - self.original_tagname_ = None - super(LogEvent, self).__init__() - self.createdDateTime = createdDateTime - self.extendedData = extendedData - self.functionSet = functionSet - self.logEventCode = logEventCode - self.logEventID = logEventID - self.logEventPEN = logEventPEN - self.profileID = profileID - def factory(*args_, **kwargs_): - if LogEvent.subclass: - return LogEvent.subclass(*args_, **kwargs_) - else: - return LogEvent(*args_, **kwargs_) - factory = staticmethod(factory) - def get_createdDateTime(self): return self.createdDateTime - def set_createdDateTime(self, createdDateTime): self.createdDateTime = createdDateTime - def get_extendedData(self): return self.extendedData - def set_extendedData(self, extendedData): self.extendedData = extendedData - def get_functionSet(self): return self.functionSet - def set_functionSet(self, functionSet): self.functionSet = functionSet - def get_logEventCode(self): return self.logEventCode - def set_logEventCode(self, logEventCode): self.logEventCode = logEventCode - def get_logEventID(self): return self.logEventID - def set_logEventID(self, logEventID): self.logEventID = logEventID - def get_logEventPEN(self): return self.logEventPEN - def set_logEventPEN(self, logEventPEN): self.logEventPEN = logEventPEN - def get_profileID(self): return self.profileID - def set_profileID(self, profileID): self.profileID = profileID - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.createdDateTime is not None or - self.extendedData is not None or - self.functionSet is not None or - self.logEventCode is not None or - self.logEventID is not None or - self.logEventPEN is not None or - self.profileID is not None or - super(LogEvent, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LogEvent', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LogEvent') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LogEvent', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LogEvent'): - super(LogEvent, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LogEvent') - def exportChildren(self, outfile, level, namespace_='', name_='LogEvent', fromsubclass_=False, pretty_print=True): - super(LogEvent, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.createdDateTime is not None: - self.createdDateTime.export(outfile, level, namespace_, name_='createdDateTime', pretty_print=pretty_print) - if self.extendedData is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sextendedData>%s%s' % (namespace_, self.gds_format_integer(self.extendedData, input_name='extendedData'), namespace_, eol_)) - if self.functionSet is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sfunctionSet>%s%s' % (namespace_, self.gds_format_integer(self.functionSet, input_name='functionSet'), namespace_, eol_)) - if self.logEventCode is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slogEventCode>%s%s' % (namespace_, self.gds_format_integer(self.logEventCode, input_name='logEventCode'), namespace_, eol_)) - if self.logEventID is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slogEventID>%s%s' % (namespace_, self.gds_format_integer(self.logEventID, input_name='logEventID'), namespace_, eol_)) - if self.logEventPEN is not None: - self.logEventPEN.export(outfile, level, namespace_, name_='logEventPEN', pretty_print=pretty_print) - if self.profileID is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sprofileID>%s%s' % (namespace_, self.gds_format_integer(self.profileID, input_name='profileID'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='LogEvent'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LogEvent, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LogEvent, self).exportLiteralChildren(outfile, level, name_) - if self.createdDateTime is not None: - showIndent(outfile, level) - outfile.write('createdDateTime=model_.TimeType(\n') - self.createdDateTime.exportLiteral(outfile, level, name_='createdDateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.extendedData is not None: - showIndent(outfile, level) - outfile.write('extendedData=%d,\n' % self.extendedData) - if self.functionSet is not None: - showIndent(outfile, level) - outfile.write('functionSet=%d,\n' % self.functionSet) - if self.logEventCode is not None: - showIndent(outfile, level) - outfile.write('logEventCode=%d,\n' % self.logEventCode) - if self.logEventID is not None: - showIndent(outfile, level) - outfile.write('logEventID=%d,\n' % self.logEventID) - if self.logEventPEN is not None: - showIndent(outfile, level) - outfile.write('logEventPEN=model_.PENType(\n') - self.logEventPEN.exportLiteral(outfile, level, name_='logEventPEN') - showIndent(outfile, level) - outfile.write('),\n') - if self.profileID is not None: - showIndent(outfile, level) - outfile.write('profileID=%d,\n' % self.profileID) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LogEvent, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'createdDateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.createdDateTime = obj_ - obj_.original_tagname_ = 'createdDateTime' - elif nodeName_ == 'extendedData': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'extendedData') - self.extendedData = ival_ - self.validate_UInt32(self.extendedData) # validate type UInt32 - elif nodeName_ == 'functionSet': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'functionSet') - self.functionSet = ival_ - self.validate_UInt8(self.functionSet) # validate type UInt8 - elif nodeName_ == 'logEventCode': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'logEventCode') - self.logEventCode = ival_ - self.validate_UInt8(self.logEventCode) # validate type UInt8 - elif nodeName_ == 'logEventID': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'logEventID') - self.logEventID = ival_ - self.validate_UInt16(self.logEventID) # validate type UInt16 - elif nodeName_ == 'logEventPEN': - obj_ = PENType.factory() - obj_.build(child_) - self.logEventPEN = obj_ - obj_.original_tagname_ = 'logEventPEN' - elif nodeName_ == 'profileID': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'profileID') - self.profileID = ival_ - self.validate_UInt8(self.profileID) # validate type UInt8 - super(LogEvent, self).buildChildren(child_, node, nodeName_, True) -# end class LogEvent - - -class RPLSourceRoutesList(List): - """List or RPL source routes if the hosting device is the DODAGroot""" - subclass = None - superclass = List - def __init__(self, RPLSourceRoutes=None): - self.original_tagname_ = None - super(RPLSourceRoutesList, self).__init__() - if RPLSourceRoutes is None: - self.RPLSourceRoutes = [] - else: - self.RPLSourceRoutes = RPLSourceRoutes - def factory(*args_, **kwargs_): - if RPLSourceRoutesList.subclass: - return RPLSourceRoutesList.subclass(*args_, **kwargs_) - else: - return RPLSourceRoutesList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_RPLSourceRoutes(self): return self.RPLSourceRoutes - def set_RPLSourceRoutes(self, RPLSourceRoutes): self.RPLSourceRoutes = RPLSourceRoutes - def add_RPLSourceRoutes(self, value): self.RPLSourceRoutes.append(value) - def insert_RPLSourceRoutes_at(self, index, value): self.RPLSourceRoutes.insert(index, value) - def replace_RPLSourceRoutes_at(self, index, value): self.RPLSourceRoutes[index] = value - def hasContent_(self): - if ( - self.RPLSourceRoutes or - super(RPLSourceRoutesList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RPLSourceRoutesList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RPLSourceRoutesList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RPLSourceRoutesList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RPLSourceRoutesList'): - super(RPLSourceRoutesList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RPLSourceRoutesList') - def exportChildren(self, outfile, level, namespace_='', name_='RPLSourceRoutesList', fromsubclass_=False, pretty_print=True): - super(RPLSourceRoutesList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for RPLSourceRoutes_ in self.RPLSourceRoutes: - RPLSourceRoutes_.export(outfile, level, namespace_, name_='RPLSourceRoutes', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RPLSourceRoutesList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RPLSourceRoutesList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RPLSourceRoutesList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('RPLSourceRoutes=[\n') - level += 1 - for RPLSourceRoutes_ in self.RPLSourceRoutes: - showIndent(outfile, level) - outfile.write('model_.RPLSourceRoutes(\n') - RPLSourceRoutes_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RPLSourceRoutesList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'RPLSourceRoutes': - obj_ = RPLSourceRoutes.factory() - obj_.build(child_) - self.RPLSourceRoutes.append(obj_) - obj_.original_tagname_ = 'RPLSourceRoutes' - super(RPLSourceRoutesList, self).buildChildren(child_, node, nodeName_, True) -# end class RPLSourceRoutesList - - -class RPLSourceRoutes(Resource): - """A RPL source routes object.""" - subclass = None - superclass = Resource - def __init__(self, DestAddress=None, SourceRoute=None): - self.original_tagname_ = None - super(RPLSourceRoutes, self).__init__() - self.DestAddress = DestAddress - self.SourceRoute = SourceRoute - def factory(*args_, **kwargs_): - if RPLSourceRoutes.subclass: - return RPLSourceRoutes.subclass(*args_, **kwargs_) - else: - return RPLSourceRoutes(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DestAddress(self): return self.DestAddress - def set_DestAddress(self, DestAddress): self.DestAddress = DestAddress - def get_SourceRoute(self): return self.SourceRoute - def set_SourceRoute(self, SourceRoute): self.SourceRoute = SourceRoute - def validate_HexBinary128(self, value): - # Validate type HexBinary128, a restriction on xs:hexBinary. - pass - def hasContent_(self): - if ( - self.DestAddress is not None or - self.SourceRoute is not None or - super(RPLSourceRoutes, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RPLSourceRoutes', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RPLSourceRoutes') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RPLSourceRoutes', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RPLSourceRoutes'): - super(RPLSourceRoutes, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RPLSourceRoutes') - def exportChildren(self, outfile, level, namespace_='', name_='RPLSourceRoutes', fromsubclass_=False, pretty_print=True): - super(RPLSourceRoutes, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.DestAddress is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sDestAddress>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.DestAddress).encode(ExternalEncoding), input_name='DestAddress'), namespace_, eol_)) - if self.SourceRoute is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sSourceRoute>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.SourceRoute).encode(ExternalEncoding), input_name='SourceRoute'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='RPLSourceRoutes'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RPLSourceRoutes, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RPLSourceRoutes, self).exportLiteralChildren(outfile, level, name_) - if self.DestAddress is not None: - showIndent(outfile, level) - outfile.write('DestAddress=%s,\n' % quote_python(self.DestAddress).encode(ExternalEncoding)) - if self.SourceRoute is not None: - showIndent(outfile, level) - outfile.write('SourceRoute=%s,\n' % quote_python(self.SourceRoute).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RPLSourceRoutes, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DestAddress': - DestAddress_ = child_.text - DestAddress_ = self.gds_validate_string(DestAddress_, node, 'DestAddress') - self.DestAddress = DestAddress_ - self.validate_HexBinary128(self.DestAddress) # validate type HexBinary128 - elif nodeName_ == 'SourceRoute': - SourceRoute_ = child_.text - SourceRoute_ = self.gds_validate_string(SourceRoute_, node, 'SourceRoute') - self.SourceRoute = SourceRoute_ - self.validate_HexBinary128(self.SourceRoute) # validate type HexBinary128 - super(RPLSourceRoutes, self).buildChildren(child_, node, nodeName_, True) -# end class RPLSourceRoutes - - -class RPLInstanceList(List): - """List of RPLInstances associated with the IPinterface.""" - subclass = None - superclass = List - def __init__(self, RPLInstance=None): - self.original_tagname_ = None - super(RPLInstanceList, self).__init__() - if RPLInstance is None: - self.RPLInstance = [] - else: - self.RPLInstance = RPLInstance - def factory(*args_, **kwargs_): - if RPLInstanceList.subclass: - return RPLInstanceList.subclass(*args_, **kwargs_) - else: - return RPLInstanceList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_RPLInstance(self): return self.RPLInstance - def set_RPLInstance(self, RPLInstance): self.RPLInstance = RPLInstance - def add_RPLInstance(self, value): self.RPLInstance.append(value) - def insert_RPLInstance_at(self, index, value): self.RPLInstance.insert(index, value) - def replace_RPLInstance_at(self, index, value): self.RPLInstance[index] = value - def hasContent_(self): - if ( - self.RPLInstance or - super(RPLInstanceList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RPLInstanceList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RPLInstanceList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RPLInstanceList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RPLInstanceList'): - super(RPLInstanceList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RPLInstanceList') - def exportChildren(self, outfile, level, namespace_='', name_='RPLInstanceList', fromsubclass_=False, pretty_print=True): - super(RPLInstanceList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for RPLInstance_ in self.RPLInstance: - RPLInstance_.export(outfile, level, namespace_, name_='RPLInstance', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='RPLInstanceList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RPLInstanceList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RPLInstanceList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('RPLInstance=[\n') - level += 1 - for RPLInstance_ in self.RPLInstance: - showIndent(outfile, level) - outfile.write('model_.RPLInstance(\n') - RPLInstance_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RPLInstanceList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'RPLInstance': - obj_ = RPLInstance.factory() - obj_.build(child_) - self.RPLInstance.append(obj_) - obj_.original_tagname_ = 'RPLInstance' - super(RPLInstanceList, self).buildChildren(child_, node, nodeName_, True) -# end class RPLInstanceList - - -class RPLInstance(Resource): - """Specific RPLInstance resource. This resource may be thought of as - network status information for a specific RPL instance - associated with IPInterface.""" - subclass = None - superclass = Resource - def __init__(self, DODAGid=None, DODAGroot=None, flags=None, groundedFlag=None, MOP=None, PRF=None, rank=None, RPLInstanceID=None, RPLSourceRoutesListLink=None, versionNumber=None): - self.original_tagname_ = None - super(RPLInstance, self).__init__() - self.DODAGid = DODAGid - self.DODAGroot = DODAGroot - self.flags = flags - self.groundedFlag = groundedFlag - self.MOP = MOP - self.PRF = PRF - self.rank = rank - self.RPLInstanceID = RPLInstanceID - self.RPLSourceRoutesListLink = RPLSourceRoutesListLink - self.versionNumber = versionNumber - def factory(*args_, **kwargs_): - if RPLInstance.subclass: - return RPLInstance.subclass(*args_, **kwargs_) - else: - return RPLInstance(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DODAGid(self): return self.DODAGid - def set_DODAGid(self, DODAGid): self.DODAGid = DODAGid - def get_DODAGroot(self): return self.DODAGroot - def set_DODAGroot(self, DODAGroot): self.DODAGroot = DODAGroot - def get_flags(self): return self.flags - def set_flags(self, flags): self.flags = flags - def get_groundedFlag(self): return self.groundedFlag - def set_groundedFlag(self, groundedFlag): self.groundedFlag = groundedFlag - def get_MOP(self): return self.MOP - def set_MOP(self, MOP): self.MOP = MOP - def get_PRF(self): return self.PRF - def set_PRF(self, PRF): self.PRF = PRF - def get_rank(self): return self.rank - def set_rank(self, rank): self.rank = rank - def get_RPLInstanceID(self): return self.RPLInstanceID - def set_RPLInstanceID(self, RPLInstanceID): self.RPLInstanceID = RPLInstanceID - def get_RPLSourceRoutesListLink(self): return self.RPLSourceRoutesListLink - def set_RPLSourceRoutesListLink(self, RPLSourceRoutesListLink): self.RPLSourceRoutesListLink = RPLSourceRoutesListLink - def get_versionNumber(self): return self.versionNumber - def set_versionNumber(self, versionNumber): self.versionNumber = versionNumber - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.DODAGid is not None or - self.DODAGroot is not None or - self.flags is not None or - self.groundedFlag is not None or - self.MOP is not None or - self.PRF is not None or - self.rank is not None or - self.RPLInstanceID is not None or - self.RPLSourceRoutesListLink is not None or - self.versionNumber is not None or - super(RPLInstance, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='RPLInstance', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='RPLInstance') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='RPLInstance', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='RPLInstance'): - super(RPLInstance, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RPLInstance') - def exportChildren(self, outfile, level, namespace_='', name_='RPLInstance', fromsubclass_=False, pretty_print=True): - super(RPLInstance, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.DODAGid is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sDODAGid>%s%s' % (namespace_, self.gds_format_integer(self.DODAGid, input_name='DODAGid'), namespace_, eol_)) - if self.DODAGroot is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sDODAGroot>%s%s' % (namespace_, self.gds_format_boolean(self.DODAGroot, input_name='DODAGroot'), namespace_, eol_)) - if self.flags is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sflags>%s%s' % (namespace_, self.gds_format_integer(self.flags, input_name='flags'), namespace_, eol_)) - if self.groundedFlag is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sgroundedFlag>%s%s' % (namespace_, self.gds_format_boolean(self.groundedFlag, input_name='groundedFlag'), namespace_, eol_)) - if self.MOP is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sMOP>%s%s' % (namespace_, self.gds_format_integer(self.MOP, input_name='MOP'), namespace_, eol_)) - if self.PRF is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sPRF>%s%s' % (namespace_, self.gds_format_integer(self.PRF, input_name='PRF'), namespace_, eol_)) - if self.rank is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%srank>%s%s' % (namespace_, self.gds_format_integer(self.rank, input_name='rank'), namespace_, eol_)) - if self.RPLInstanceID is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sRPLInstanceID>%s%s' % (namespace_, self.gds_format_integer(self.RPLInstanceID, input_name='RPLInstanceID'), namespace_, eol_)) - if self.RPLSourceRoutesListLink is not None: - self.RPLSourceRoutesListLink.export(outfile, level, namespace_, name_='RPLSourceRoutesListLink', pretty_print=pretty_print) - if self.versionNumber is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sversionNumber>%s%s' % (namespace_, self.gds_format_integer(self.versionNumber, input_name='versionNumber'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='RPLInstance'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(RPLInstance, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(RPLInstance, self).exportLiteralChildren(outfile, level, name_) - if self.DODAGid is not None: - showIndent(outfile, level) - outfile.write('DODAGid=%d,\n' % self.DODAGid) - if self.DODAGroot is not None: - showIndent(outfile, level) - outfile.write('DODAGroot=%s,\n' % self.DODAGroot) - if self.flags is not None: - showIndent(outfile, level) - outfile.write('flags=%d,\n' % self.flags) - if self.groundedFlag is not None: - showIndent(outfile, level) - outfile.write('groundedFlag=%s,\n' % self.groundedFlag) - if self.MOP is not None: - showIndent(outfile, level) - outfile.write('MOP=%d,\n' % self.MOP) - if self.PRF is not None: - showIndent(outfile, level) - outfile.write('PRF=%d,\n' % self.PRF) - if self.rank is not None: - showIndent(outfile, level) - outfile.write('rank=%d,\n' % self.rank) - if self.RPLInstanceID is not None: - showIndent(outfile, level) - outfile.write('RPLInstanceID=%d,\n' % self.RPLInstanceID) - if self.RPLSourceRoutesListLink is not None: - showIndent(outfile, level) - outfile.write('RPLSourceRoutesListLink=model_.RPLSourceRoutesListLink(\n') - self.RPLSourceRoutesListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.versionNumber is not None: - showIndent(outfile, level) - outfile.write('versionNumber=%d,\n' % self.versionNumber) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(RPLInstance, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DODAGid': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'DODAGid') - self.DODAGid = ival_ - self.validate_UInt8(self.DODAGid) # validate type UInt8 - elif nodeName_ == 'DODAGroot': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'DODAGroot') - self.DODAGroot = ival_ - elif nodeName_ == 'flags': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'flags') - self.flags = ival_ - self.validate_UInt8(self.flags) # validate type UInt8 - elif nodeName_ == 'groundedFlag': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'groundedFlag') - self.groundedFlag = ival_ - elif nodeName_ == 'MOP': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'MOP') - self.MOP = ival_ - self.validate_UInt8(self.MOP) # validate type UInt8 - elif nodeName_ == 'PRF': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'PRF') - self.PRF = ival_ - self.validate_UInt8(self.PRF) # validate type UInt8 - elif nodeName_ == 'rank': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'rank') - self.rank = ival_ - self.validate_UInt16(self.rank) # validate type UInt16 - elif nodeName_ == 'RPLInstanceID': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'RPLInstanceID') - self.RPLInstanceID = ival_ - self.validate_UInt8(self.RPLInstanceID) # validate type UInt8 - elif nodeName_ == 'RPLSourceRoutesListLink': - obj_ = RPLSourceRoutesListLink.factory() - obj_.build(child_) - self.RPLSourceRoutesListLink = obj_ - obj_.original_tagname_ = 'RPLSourceRoutesListLink' - elif nodeName_ == 'versionNumber': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'versionNumber') - self.versionNumber = ival_ - self.validate_UInt8(self.versionNumber) # validate type UInt8 - super(RPLInstance, self).buildChildren(child_, node, nodeName_, True) -# end class RPLInstance - - -class NeighborList(List): - """List of 15.4 neighbors.""" - subclass = None - superclass = List - def __init__(self, Neighbor=None): - self.original_tagname_ = None - super(NeighborList, self).__init__() - if Neighbor is None: - self.Neighbor = [] - else: - self.Neighbor = Neighbor - def factory(*args_, **kwargs_): - if NeighborList.subclass: - return NeighborList.subclass(*args_, **kwargs_) - else: - return NeighborList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Neighbor(self): return self.Neighbor - def set_Neighbor(self, Neighbor): self.Neighbor = Neighbor - def add_Neighbor(self, value): self.Neighbor.append(value) - def insert_Neighbor_at(self, index, value): self.Neighbor.insert(index, value) - def replace_Neighbor_at(self, index, value): self.Neighbor[index] = value - def hasContent_(self): - if ( - self.Neighbor or - super(NeighborList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='NeighborList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='NeighborList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='NeighborList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NeighborList'): - super(NeighborList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NeighborList') - def exportChildren(self, outfile, level, namespace_='', name_='NeighborList', fromsubclass_=False, pretty_print=True): - super(NeighborList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Neighbor_ in self.Neighbor: - Neighbor_.export(outfile, level, namespace_, name_='Neighbor', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='NeighborList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(NeighborList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(NeighborList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Neighbor=[\n') - level += 1 - for Neighbor_ in self.Neighbor: - showIndent(outfile, level) - outfile.write('model_.Neighbor(\n') - Neighbor_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(NeighborList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Neighbor': - obj_ = Neighbor.factory() - obj_.build(child_) - self.Neighbor.append(obj_) - obj_.original_tagname_ = 'Neighbor' - super(NeighborList, self).buildChildren(child_, node, nodeName_, True) -# end class NeighborList - - -class Neighbor(Resource): - """Contains 802.15.4 link layer specific attributes.""" - subclass = None - superclass = Resource - def __init__(self, isChild=None, linkQuality=None, shortAddress=None): - self.original_tagname_ = None - super(Neighbor, self).__init__() - self.isChild = isChild - self.linkQuality = linkQuality - self.shortAddress = shortAddress - def factory(*args_, **kwargs_): - if Neighbor.subclass: - return Neighbor.subclass(*args_, **kwargs_) - else: - return Neighbor(*args_, **kwargs_) - factory = staticmethod(factory) - def get_isChild(self): return self.isChild - def set_isChild(self, isChild): self.isChild = isChild - def get_linkQuality(self): return self.linkQuality - def set_linkQuality(self, linkQuality): self.linkQuality = linkQuality - def get_shortAddress(self): return self.shortAddress - def set_shortAddress(self, shortAddress): self.shortAddress = shortAddress - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.isChild is not None or - self.linkQuality is not None or - self.shortAddress is not None or - super(Neighbor, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Neighbor', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Neighbor') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Neighbor', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Neighbor'): - super(Neighbor, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Neighbor') - def exportChildren(self, outfile, level, namespace_='', name_='Neighbor', fromsubclass_=False, pretty_print=True): - super(Neighbor, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.isChild is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sisChild>%s%s' % (namespace_, self.gds_format_boolean(self.isChild, input_name='isChild'), namespace_, eol_)) - if self.linkQuality is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slinkQuality>%s%s' % (namespace_, self.gds_format_integer(self.linkQuality, input_name='linkQuality'), namespace_, eol_)) - if self.shortAddress is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sshortAddress>%s%s' % (namespace_, self.gds_format_integer(self.shortAddress, input_name='shortAddress'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Neighbor'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Neighbor, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Neighbor, self).exportLiteralChildren(outfile, level, name_) - if self.isChild is not None: - showIndent(outfile, level) - outfile.write('isChild=%s,\n' % self.isChild) - if self.linkQuality is not None: - showIndent(outfile, level) - outfile.write('linkQuality=%d,\n' % self.linkQuality) - if self.shortAddress is not None: - showIndent(outfile, level) - outfile.write('shortAddress=%d,\n' % self.shortAddress) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Neighbor, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'isChild': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'isChild') - self.isChild = ival_ - elif nodeName_ == 'linkQuality': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'linkQuality') - self.linkQuality = ival_ - self.validate_UInt8(self.linkQuality) # validate type UInt8 - elif nodeName_ == 'shortAddress': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'shortAddress') - self.shortAddress = ival_ - self.validate_UInt16(self.shortAddress) # validate type UInt16 - super(Neighbor, self).buildChildren(child_, node, nodeName_, True) -# end class Neighbor - - -class LLInterfaceList(List): - """List of LLInterface instances.""" - subclass = None - superclass = List - def __init__(self, LLInterface=None): - self.original_tagname_ = None - super(LLInterfaceList, self).__init__() - if LLInterface is None: - self.LLInterface = [] - else: - self.LLInterface = LLInterface - def factory(*args_, **kwargs_): - if LLInterfaceList.subclass: - return LLInterfaceList.subclass(*args_, **kwargs_) - else: - return LLInterfaceList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_LLInterface(self): return self.LLInterface - def set_LLInterface(self, LLInterface): self.LLInterface = LLInterface - def add_LLInterface(self, value): self.LLInterface.append(value) - def insert_LLInterface_at(self, index, value): self.LLInterface.insert(index, value) - def replace_LLInterface_at(self, index, value): self.LLInterface[index] = value - def hasContent_(self): - if ( - self.LLInterface or - super(LLInterfaceList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LLInterfaceList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LLInterfaceList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LLInterfaceList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LLInterfaceList'): - super(LLInterfaceList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LLInterfaceList') - def exportChildren(self, outfile, level, namespace_='', name_='LLInterfaceList', fromsubclass_=False, pretty_print=True): - super(LLInterfaceList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for LLInterface_ in self.LLInterface: - LLInterface_.export(outfile, level, namespace_, name_='LLInterface', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='LLInterfaceList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LLInterfaceList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LLInterfaceList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('LLInterface=[\n') - level += 1 - for LLInterface_ in self.LLInterface: - showIndent(outfile, level) - outfile.write('model_.LLInterface(\n') - LLInterface_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LLInterfaceList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'LLInterface': - obj_ = LLInterface.factory() - obj_.build(child_) - self.LLInterface.append(obj_) - obj_.original_tagname_ = 'LLInterface' - super(LLInterfaceList, self).buildChildren(child_, node, nodeName_, True) -# end class LLInterfaceList - - -class LLInterface(Resource): - """A link-layer interface object.""" - subclass = None - superclass = Resource - def __init__(self, CRCerrors=None, EUI64=None, IEEE_802_15_4=None, linkLayerType=None, LLAckNotRx=None, LLCSMAFail=None, LLFramesDropRx=None, LLFramesDropTx=None, LLFramesRx=None, LLFramesTx=None, LLMediaAccessFail=None, LLOctetsRx=None, LLOctetsTx=None, LLRetryCount=None, LLSecurityErrorRx=None, loWPAN=None): - self.original_tagname_ = None - super(LLInterface, self).__init__() - self.CRCerrors = CRCerrors - self.EUI64 = EUI64 - self.IEEE_802_15_4 = IEEE_802_15_4 - self.linkLayerType = linkLayerType - self.LLAckNotRx = LLAckNotRx - self.LLCSMAFail = LLCSMAFail - self.LLFramesDropRx = LLFramesDropRx - self.LLFramesDropTx = LLFramesDropTx - self.LLFramesRx = LLFramesRx - self.LLFramesTx = LLFramesTx - self.LLMediaAccessFail = LLMediaAccessFail - self.LLOctetsRx = LLOctetsRx - self.LLOctetsTx = LLOctetsTx - self.LLRetryCount = LLRetryCount - self.LLSecurityErrorRx = LLSecurityErrorRx - self.loWPAN = loWPAN - def factory(*args_, **kwargs_): - if LLInterface.subclass: - return LLInterface.subclass(*args_, **kwargs_) - else: - return LLInterface(*args_, **kwargs_) - factory = staticmethod(factory) - def get_CRCerrors(self): return self.CRCerrors - def set_CRCerrors(self, CRCerrors): self.CRCerrors = CRCerrors - def get_EUI64(self): return self.EUI64 - def set_EUI64(self, EUI64): self.EUI64 = EUI64 - def get_IEEE_802_15_4(self): return self.IEEE_802_15_4 - def set_IEEE_802_15_4(self, IEEE_802_15_4): self.IEEE_802_15_4 = IEEE_802_15_4 - def get_linkLayerType(self): return self.linkLayerType - def set_linkLayerType(self, linkLayerType): self.linkLayerType = linkLayerType - def get_LLAckNotRx(self): return self.LLAckNotRx - def set_LLAckNotRx(self, LLAckNotRx): self.LLAckNotRx = LLAckNotRx - def get_LLCSMAFail(self): return self.LLCSMAFail - def set_LLCSMAFail(self, LLCSMAFail): self.LLCSMAFail = LLCSMAFail - def get_LLFramesDropRx(self): return self.LLFramesDropRx - def set_LLFramesDropRx(self, LLFramesDropRx): self.LLFramesDropRx = LLFramesDropRx - def get_LLFramesDropTx(self): return self.LLFramesDropTx - def set_LLFramesDropTx(self, LLFramesDropTx): self.LLFramesDropTx = LLFramesDropTx - def get_LLFramesRx(self): return self.LLFramesRx - def set_LLFramesRx(self, LLFramesRx): self.LLFramesRx = LLFramesRx - def get_LLFramesTx(self): return self.LLFramesTx - def set_LLFramesTx(self, LLFramesTx): self.LLFramesTx = LLFramesTx - def get_LLMediaAccessFail(self): return self.LLMediaAccessFail - def set_LLMediaAccessFail(self, LLMediaAccessFail): self.LLMediaAccessFail = LLMediaAccessFail - def get_LLOctetsRx(self): return self.LLOctetsRx - def set_LLOctetsRx(self, LLOctetsRx): self.LLOctetsRx = LLOctetsRx - def get_LLOctetsTx(self): return self.LLOctetsTx - def set_LLOctetsTx(self, LLOctetsTx): self.LLOctetsTx = LLOctetsTx - def get_LLRetryCount(self): return self.LLRetryCount - def set_LLRetryCount(self, LLRetryCount): self.LLRetryCount = LLRetryCount - def get_LLSecurityErrorRx(self): return self.LLSecurityErrorRx - def set_LLSecurityErrorRx(self, LLSecurityErrorRx): self.LLSecurityErrorRx = LLSecurityErrorRx - def get_loWPAN(self): return self.loWPAN - def set_loWPAN(self, loWPAN): self.loWPAN = loWPAN - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_HexBinary64(self, value): - # Validate type HexBinary64, a restriction on xs:hexBinary. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.CRCerrors is not None or - self.EUI64 is not None or - self.IEEE_802_15_4 is not None or - self.linkLayerType is not None or - self.LLAckNotRx is not None or - self.LLCSMAFail is not None or - self.LLFramesDropRx is not None or - self.LLFramesDropTx is not None or - self.LLFramesRx is not None or - self.LLFramesTx is not None or - self.LLMediaAccessFail is not None or - self.LLOctetsRx is not None or - self.LLOctetsTx is not None or - self.LLRetryCount is not None or - self.LLSecurityErrorRx is not None or - self.loWPAN is not None or - super(LLInterface, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='LLInterface', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='LLInterface') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='LLInterface', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='LLInterface'): - super(LLInterface, self).exportAttributes(outfile, level, already_processed, namespace_, name_='LLInterface') - def exportChildren(self, outfile, level, namespace_='', name_='LLInterface', fromsubclass_=False, pretty_print=True): - super(LLInterface, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.CRCerrors is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sCRCerrors>%s%s' % (namespace_, self.gds_format_integer(self.CRCerrors, input_name='CRCerrors'), namespace_, eol_)) - if self.EUI64 is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sEUI64>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.EUI64).encode(ExternalEncoding), input_name='EUI64'), namespace_, eol_)) - if self.IEEE_802_15_4 is not None: - self.IEEE_802_15_4.export(outfile, level, namespace_, name_='IEEE_802_15_4', pretty_print=pretty_print) - if self.linkLayerType is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slinkLayerType>%s%s' % (namespace_, self.gds_format_integer(self.linkLayerType, input_name='linkLayerType'), namespace_, eol_)) - if self.LLAckNotRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLAckNotRx>%s%s' % (namespace_, self.gds_format_integer(self.LLAckNotRx, input_name='LLAckNotRx'), namespace_, eol_)) - if self.LLCSMAFail is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLCSMAFail>%s%s' % (namespace_, self.gds_format_integer(self.LLCSMAFail, input_name='LLCSMAFail'), namespace_, eol_)) - if self.LLFramesDropRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLFramesDropRx>%s%s' % (namespace_, self.gds_format_integer(self.LLFramesDropRx, input_name='LLFramesDropRx'), namespace_, eol_)) - if self.LLFramesDropTx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLFramesDropTx>%s%s' % (namespace_, self.gds_format_integer(self.LLFramesDropTx, input_name='LLFramesDropTx'), namespace_, eol_)) - if self.LLFramesRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLFramesRx>%s%s' % (namespace_, self.gds_format_integer(self.LLFramesRx, input_name='LLFramesRx'), namespace_, eol_)) - if self.LLFramesTx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLFramesTx>%s%s' % (namespace_, self.gds_format_integer(self.LLFramesTx, input_name='LLFramesTx'), namespace_, eol_)) - if self.LLMediaAccessFail is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLMediaAccessFail>%s%s' % (namespace_, self.gds_format_integer(self.LLMediaAccessFail, input_name='LLMediaAccessFail'), namespace_, eol_)) - if self.LLOctetsRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLOctetsRx>%s%s' % (namespace_, self.gds_format_integer(self.LLOctetsRx, input_name='LLOctetsRx'), namespace_, eol_)) - if self.LLOctetsTx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLOctetsTx>%s%s' % (namespace_, self.gds_format_integer(self.LLOctetsTx, input_name='LLOctetsTx'), namespace_, eol_)) - if self.LLRetryCount is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLRetryCount>%s%s' % (namespace_, self.gds_format_integer(self.LLRetryCount, input_name='LLRetryCount'), namespace_, eol_)) - if self.LLSecurityErrorRx is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sLLSecurityErrorRx>%s%s' % (namespace_, self.gds_format_integer(self.LLSecurityErrorRx, input_name='LLSecurityErrorRx'), namespace_, eol_)) - if self.loWPAN is not None: - self.loWPAN.export(outfile, level, namespace_, name_='loWPAN', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='LLInterface'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(LLInterface, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(LLInterface, self).exportLiteralChildren(outfile, level, name_) - if self.CRCerrors is not None: - showIndent(outfile, level) - outfile.write('CRCerrors=%d,\n' % self.CRCerrors) - if self.EUI64 is not None: - showIndent(outfile, level) - outfile.write('EUI64=%s,\n' % quote_python(self.EUI64).encode(ExternalEncoding)) - if self.IEEE_802_15_4 is not None: - showIndent(outfile, level) - outfile.write('IEEE_802_15_4=model_.IEEE_802_15_4(\n') - self.IEEE_802_15_4.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.linkLayerType is not None: - showIndent(outfile, level) - outfile.write('linkLayerType=%d,\n' % self.linkLayerType) - if self.LLAckNotRx is not None: - showIndent(outfile, level) - outfile.write('LLAckNotRx=%d,\n' % self.LLAckNotRx) - if self.LLCSMAFail is not None: - showIndent(outfile, level) - outfile.write('LLCSMAFail=%d,\n' % self.LLCSMAFail) - if self.LLFramesDropRx is not None: - showIndent(outfile, level) - outfile.write('LLFramesDropRx=%d,\n' % self.LLFramesDropRx) - if self.LLFramesDropTx is not None: - showIndent(outfile, level) - outfile.write('LLFramesDropTx=%d,\n' % self.LLFramesDropTx) - if self.LLFramesRx is not None: - showIndent(outfile, level) - outfile.write('LLFramesRx=%d,\n' % self.LLFramesRx) - if self.LLFramesTx is not None: - showIndent(outfile, level) - outfile.write('LLFramesTx=%d,\n' % self.LLFramesTx) - if self.LLMediaAccessFail is not None: - showIndent(outfile, level) - outfile.write('LLMediaAccessFail=%d,\n' % self.LLMediaAccessFail) - if self.LLOctetsRx is not None: - showIndent(outfile, level) - outfile.write('LLOctetsRx=%d,\n' % self.LLOctetsRx) - if self.LLOctetsTx is not None: - showIndent(outfile, level) - outfile.write('LLOctetsTx=%d,\n' % self.LLOctetsTx) - if self.LLRetryCount is not None: - showIndent(outfile, level) - outfile.write('LLRetryCount=%d,\n' % self.LLRetryCount) - if self.LLSecurityErrorRx is not None: - showIndent(outfile, level) - outfile.write('LLSecurityErrorRx=%d,\n' % self.LLSecurityErrorRx) - if self.loWPAN is not None: - showIndent(outfile, level) - outfile.write('loWPAN=model_.loWPAN(\n') - self.loWPAN.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(LLInterface, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'CRCerrors': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'CRCerrors') - self.CRCerrors = ival_ - self.validate_UInt32(self.CRCerrors) # validate type UInt32 - elif nodeName_ == 'EUI64': - EUI64_ = child_.text - EUI64_ = self.gds_validate_string(EUI64_, node, 'EUI64') - self.EUI64 = EUI64_ - self.validate_HexBinary64(self.EUI64) # validate type HexBinary64 - elif nodeName_ == 'IEEE_802_15_4': - obj_ = IEEE_802_15_4.factory() - obj_.build(child_) - self.IEEE_802_15_4 = obj_ - obj_.original_tagname_ = 'IEEE_802_15_4' - elif nodeName_ == 'linkLayerType': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'linkLayerType') - self.linkLayerType = ival_ - self.validate_UInt8(self.linkLayerType) # validate type UInt8 - elif nodeName_ == 'LLAckNotRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLAckNotRx') - self.LLAckNotRx = ival_ - self.validate_UInt32(self.LLAckNotRx) # validate type UInt32 - elif nodeName_ == 'LLCSMAFail': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLCSMAFail') - self.LLCSMAFail = ival_ - self.validate_UInt32(self.LLCSMAFail) # validate type UInt32 - elif nodeName_ == 'LLFramesDropRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLFramesDropRx') - self.LLFramesDropRx = ival_ - self.validate_UInt32(self.LLFramesDropRx) # validate type UInt32 - elif nodeName_ == 'LLFramesDropTx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLFramesDropTx') - self.LLFramesDropTx = ival_ - self.validate_UInt32(self.LLFramesDropTx) # validate type UInt32 - elif nodeName_ == 'LLFramesRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLFramesRx') - self.LLFramesRx = ival_ - self.validate_UInt32(self.LLFramesRx) # validate type UInt32 - elif nodeName_ == 'LLFramesTx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLFramesTx') - self.LLFramesTx = ival_ - self.validate_UInt32(self.LLFramesTx) # validate type UInt32 - elif nodeName_ == 'LLMediaAccessFail': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLMediaAccessFail') - self.LLMediaAccessFail = ival_ - self.validate_UInt32(self.LLMediaAccessFail) # validate type UInt32 - elif nodeName_ == 'LLOctetsRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLOctetsRx') - self.LLOctetsRx = ival_ - self.validate_UInt32(self.LLOctetsRx) # validate type UInt32 - elif nodeName_ == 'LLOctetsTx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLOctetsTx') - self.LLOctetsTx = ival_ - self.validate_UInt32(self.LLOctetsTx) # validate type UInt32 - elif nodeName_ == 'LLRetryCount': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLRetryCount') - self.LLRetryCount = ival_ - self.validate_UInt32(self.LLRetryCount) # validate type UInt32 - elif nodeName_ == 'LLSecurityErrorRx': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'LLSecurityErrorRx') - self.LLSecurityErrorRx = ival_ - self.validate_UInt32(self.LLSecurityErrorRx) # validate type UInt32 - elif nodeName_ == 'loWPAN': - obj_ = loWPAN.factory() - obj_.build(child_) - self.loWPAN = obj_ - obj_.original_tagname_ = 'loWPAN' - super(LLInterface, self).buildChildren(child_, node, nodeName_, True) -# end class LLInterface - - -class IPInterfaceList(List): - """List of IPInterface instances.""" - subclass = None - superclass = List - def __init__(self, IPInterface=None): - self.original_tagname_ = None - super(IPInterfaceList, self).__init__() - if IPInterface is None: - self.IPInterface = [] - else: - self.IPInterface = IPInterface - def factory(*args_, **kwargs_): - if IPInterfaceList.subclass: - return IPInterfaceList.subclass(*args_, **kwargs_) - else: - return IPInterfaceList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_IPInterface(self): return self.IPInterface - def set_IPInterface(self, IPInterface): self.IPInterface = IPInterface - def add_IPInterface(self, value): self.IPInterface.append(value) - def insert_IPInterface_at(self, index, value): self.IPInterface.insert(index, value) - def replace_IPInterface_at(self, index, value): self.IPInterface[index] = value - def hasContent_(self): - if ( - self.IPInterface or - super(IPInterfaceList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IPInterfaceList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IPInterfaceList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IPInterfaceList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IPInterfaceList'): - super(IPInterfaceList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IPInterfaceList') - def exportChildren(self, outfile, level, namespace_='', name_='IPInterfaceList', fromsubclass_=False, pretty_print=True): - super(IPInterfaceList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for IPInterface_ in self.IPInterface: - IPInterface_.export(outfile, level, namespace_, name_='IPInterface', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='IPInterfaceList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IPInterfaceList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IPInterfaceList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('IPInterface=[\n') - level += 1 - for IPInterface_ in self.IPInterface: - showIndent(outfile, level) - outfile.write('model_.IPInterface(\n') - IPInterface_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IPInterfaceList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'IPInterface': - obj_ = IPInterface.factory() - obj_.build(child_) - self.IPInterface.append(obj_) - obj_.original_tagname_ = 'IPInterface' - super(IPInterfaceList, self).buildChildren(child_, node, nodeName_, True) -# end class IPInterfaceList - - -class IPInterface(Resource): - """Specific IPInterface resource. This resource may be thought of as - network status information for a specific network (IP) layer - interface.""" - subclass = None - superclass = Resource - def __init__(self, ifDescr=None, ifHighSpeed=None, ifInBroadcastPkts=None, ifIndex=None, ifInDiscards=None, ifInErrors=None, ifInMulticastPkts=None, ifInOctets=None, ifInUcastPkts=None, ifInUnknownProtos=None, ifMtu=None, ifName=None, ifOperStatus=None, ifOutBroadcastPkts=None, ifOutDiscards=None, ifOutErrors=None, ifOutMulticastPkts=None, ifOutOctets=None, ifOutUcastPkts=None, ifPromiscuousMode=None, ifSpeed=None, ifType=None, IPAddrListLink=None, lastResetTime=None, lastUpdatedTime=None, LLInterfaceListLink=None): - self.original_tagname_ = None - super(IPInterface, self).__init__() - self.ifDescr = ifDescr - self.ifHighSpeed = ifHighSpeed - self.ifInBroadcastPkts = ifInBroadcastPkts - self.ifIndex = ifIndex - self.ifInDiscards = ifInDiscards - self.ifInErrors = ifInErrors - self.ifInMulticastPkts = ifInMulticastPkts - self.ifInOctets = ifInOctets - self.ifInUcastPkts = ifInUcastPkts - self.ifInUnknownProtos = ifInUnknownProtos - self.ifMtu = ifMtu - self.ifName = ifName - self.ifOperStatus = ifOperStatus - self.ifOutBroadcastPkts = ifOutBroadcastPkts - self.ifOutDiscards = ifOutDiscards - self.ifOutErrors = ifOutErrors - self.ifOutMulticastPkts = ifOutMulticastPkts - self.ifOutOctets = ifOutOctets - self.ifOutUcastPkts = ifOutUcastPkts - self.ifPromiscuousMode = ifPromiscuousMode - self.ifSpeed = ifSpeed - self.ifType = ifType - self.IPAddrListLink = IPAddrListLink - self.lastResetTime = lastResetTime - self.lastUpdatedTime = lastUpdatedTime - self.LLInterfaceListLink = LLInterfaceListLink - def factory(*args_, **kwargs_): - if IPInterface.subclass: - return IPInterface.subclass(*args_, **kwargs_) - else: - return IPInterface(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ifDescr(self): return self.ifDescr - def set_ifDescr(self, ifDescr): self.ifDescr = ifDescr - def get_ifHighSpeed(self): return self.ifHighSpeed - def set_ifHighSpeed(self, ifHighSpeed): self.ifHighSpeed = ifHighSpeed - def get_ifInBroadcastPkts(self): return self.ifInBroadcastPkts - def set_ifInBroadcastPkts(self, ifInBroadcastPkts): self.ifInBroadcastPkts = ifInBroadcastPkts - def get_ifIndex(self): return self.ifIndex - def set_ifIndex(self, ifIndex): self.ifIndex = ifIndex - def get_ifInDiscards(self): return self.ifInDiscards - def set_ifInDiscards(self, ifInDiscards): self.ifInDiscards = ifInDiscards - def get_ifInErrors(self): return self.ifInErrors - def set_ifInErrors(self, ifInErrors): self.ifInErrors = ifInErrors - def get_ifInMulticastPkts(self): return self.ifInMulticastPkts - def set_ifInMulticastPkts(self, ifInMulticastPkts): self.ifInMulticastPkts = ifInMulticastPkts - def get_ifInOctets(self): return self.ifInOctets - def set_ifInOctets(self, ifInOctets): self.ifInOctets = ifInOctets - def get_ifInUcastPkts(self): return self.ifInUcastPkts - def set_ifInUcastPkts(self, ifInUcastPkts): self.ifInUcastPkts = ifInUcastPkts - def get_ifInUnknownProtos(self): return self.ifInUnknownProtos - def set_ifInUnknownProtos(self, ifInUnknownProtos): self.ifInUnknownProtos = ifInUnknownProtos - def get_ifMtu(self): return self.ifMtu - def set_ifMtu(self, ifMtu): self.ifMtu = ifMtu - def get_ifName(self): return self.ifName - def set_ifName(self, ifName): self.ifName = ifName - def get_ifOperStatus(self): return self.ifOperStatus - def set_ifOperStatus(self, ifOperStatus): self.ifOperStatus = ifOperStatus - def get_ifOutBroadcastPkts(self): return self.ifOutBroadcastPkts - def set_ifOutBroadcastPkts(self, ifOutBroadcastPkts): self.ifOutBroadcastPkts = ifOutBroadcastPkts - def get_ifOutDiscards(self): return self.ifOutDiscards - def set_ifOutDiscards(self, ifOutDiscards): self.ifOutDiscards = ifOutDiscards - def get_ifOutErrors(self): return self.ifOutErrors - def set_ifOutErrors(self, ifOutErrors): self.ifOutErrors = ifOutErrors - def get_ifOutMulticastPkts(self): return self.ifOutMulticastPkts - def set_ifOutMulticastPkts(self, ifOutMulticastPkts): self.ifOutMulticastPkts = ifOutMulticastPkts - def get_ifOutOctets(self): return self.ifOutOctets - def set_ifOutOctets(self, ifOutOctets): self.ifOutOctets = ifOutOctets - def get_ifOutUcastPkts(self): return self.ifOutUcastPkts - def set_ifOutUcastPkts(self, ifOutUcastPkts): self.ifOutUcastPkts = ifOutUcastPkts - def get_ifPromiscuousMode(self): return self.ifPromiscuousMode - def set_ifPromiscuousMode(self, ifPromiscuousMode): self.ifPromiscuousMode = ifPromiscuousMode - def get_ifSpeed(self): return self.ifSpeed - def set_ifSpeed(self, ifSpeed): self.ifSpeed = ifSpeed - def get_ifType(self): return self.ifType - def set_ifType(self, ifType): self.ifType = ifType - def get_IPAddrListLink(self): return self.IPAddrListLink - def set_IPAddrListLink(self, IPAddrListLink): self.IPAddrListLink = IPAddrListLink - def get_lastResetTime(self): return self.lastResetTime - def set_lastResetTime(self, lastResetTime): self.lastResetTime = lastResetTime - def get_lastUpdatedTime(self): return self.lastUpdatedTime - def set_lastUpdatedTime(self, lastUpdatedTime): self.lastUpdatedTime = lastUpdatedTime - def get_LLInterfaceListLink(self): return self.LLInterfaceListLink - def set_LLInterfaceListLink(self, LLInterfaceListLink): self.LLInterfaceListLink = LLInterfaceListLink - def validate_String192(self, value): - # Validate type String192, a restriction on xs:string. - pass - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def validate_String16(self, value): - # Validate type String16, a restriction on xs:string. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def validate_Int64(self, value): - # Validate type Int64, a restriction on xs:long. - pass - def hasContent_(self): - if ( - self.ifDescr is not None or - self.ifHighSpeed is not None or - self.ifInBroadcastPkts is not None or - self.ifIndex is not None or - self.ifInDiscards is not None or - self.ifInErrors is not None or - self.ifInMulticastPkts is not None or - self.ifInOctets is not None or - self.ifInUcastPkts is not None or - self.ifInUnknownProtos is not None or - self.ifMtu is not None or - self.ifName is not None or - self.ifOperStatus is not None or - self.ifOutBroadcastPkts is not None or - self.ifOutDiscards is not None or - self.ifOutErrors is not None or - self.ifOutMulticastPkts is not None or - self.ifOutOctets is not None or - self.ifOutUcastPkts is not None or - self.ifPromiscuousMode is not None or - self.ifSpeed is not None or - self.ifType is not None or - self.IPAddrListLink is not None or - self.lastResetTime is not None or - self.lastUpdatedTime is not None or - self.LLInterfaceListLink is not None or - super(IPInterface, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IPInterface', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IPInterface') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IPInterface', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IPInterface'): - super(IPInterface, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IPInterface') - def exportChildren(self, outfile, level, namespace_='', name_='IPInterface', fromsubclass_=False, pretty_print=True): - super(IPInterface, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ifDescr is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifDescr>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ifDescr).encode(ExternalEncoding), input_name='ifDescr'), namespace_, eol_)) - if self.ifHighSpeed is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifHighSpeed>%s%s' % (namespace_, self.gds_format_integer(self.ifHighSpeed, input_name='ifHighSpeed'), namespace_, eol_)) - if self.ifInBroadcastPkts is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInBroadcastPkts>%s%s' % (namespace_, self.gds_format_integer(self.ifInBroadcastPkts, input_name='ifInBroadcastPkts'), namespace_, eol_)) - if self.ifIndex is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifIndex>%s%s' % (namespace_, self.gds_format_integer(self.ifIndex, input_name='ifIndex'), namespace_, eol_)) - if self.ifInDiscards is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInDiscards>%s%s' % (namespace_, self.gds_format_integer(self.ifInDiscards, input_name='ifInDiscards'), namespace_, eol_)) - if self.ifInErrors is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInErrors>%s%s' % (namespace_, self.gds_format_integer(self.ifInErrors, input_name='ifInErrors'), namespace_, eol_)) - if self.ifInMulticastPkts is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInMulticastPkts>%s%s' % (namespace_, self.gds_format_integer(self.ifInMulticastPkts, input_name='ifInMulticastPkts'), namespace_, eol_)) - if self.ifInOctets is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInOctets>%s%s' % (namespace_, self.gds_format_integer(self.ifInOctets, input_name='ifInOctets'), namespace_, eol_)) - if self.ifInUcastPkts is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInUcastPkts>%s%s' % (namespace_, self.gds_format_integer(self.ifInUcastPkts, input_name='ifInUcastPkts'), namespace_, eol_)) - if self.ifInUnknownProtos is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifInUnknownProtos>%s%s' % (namespace_, self.gds_format_integer(self.ifInUnknownProtos, input_name='ifInUnknownProtos'), namespace_, eol_)) - if self.ifMtu is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifMtu>%s%s' % (namespace_, self.gds_format_integer(self.ifMtu, input_name='ifMtu'), namespace_, eol_)) - if self.ifName is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifName>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.ifName).encode(ExternalEncoding), input_name='ifName'), namespace_, eol_)) - if self.ifOperStatus is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOperStatus>%s%s' % (namespace_, self.gds_format_integer(self.ifOperStatus, input_name='ifOperStatus'), namespace_, eol_)) - if self.ifOutBroadcastPkts is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOutBroadcastPkts>%s%s' % (namespace_, self.gds_format_integer(self.ifOutBroadcastPkts, input_name='ifOutBroadcastPkts'), namespace_, eol_)) - if self.ifOutDiscards is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOutDiscards>%s%s' % (namespace_, self.gds_format_integer(self.ifOutDiscards, input_name='ifOutDiscards'), namespace_, eol_)) - if self.ifOutErrors is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOutErrors>%s%s' % (namespace_, self.gds_format_integer(self.ifOutErrors, input_name='ifOutErrors'), namespace_, eol_)) - if self.ifOutMulticastPkts is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOutMulticastPkts>%s%s' % (namespace_, self.gds_format_integer(self.ifOutMulticastPkts, input_name='ifOutMulticastPkts'), namespace_, eol_)) - if self.ifOutOctets is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOutOctets>%s%s' % (namespace_, self.gds_format_integer(self.ifOutOctets, input_name='ifOutOctets'), namespace_, eol_)) - if self.ifOutUcastPkts is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifOutUcastPkts>%s%s' % (namespace_, self.gds_format_integer(self.ifOutUcastPkts, input_name='ifOutUcastPkts'), namespace_, eol_)) - if self.ifPromiscuousMode is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifPromiscuousMode>%s%s' % (namespace_, self.gds_format_boolean(self.ifPromiscuousMode, input_name='ifPromiscuousMode'), namespace_, eol_)) - if self.ifSpeed is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifSpeed>%s%s' % (namespace_, self.gds_format_integer(self.ifSpeed, input_name='ifSpeed'), namespace_, eol_)) - if self.ifType is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sifType>%s%s' % (namespace_, self.gds_format_integer(self.ifType, input_name='ifType'), namespace_, eol_)) - if self.IPAddrListLink is not None: - self.IPAddrListLink.export(outfile, level, namespace_, name_='IPAddrListLink', pretty_print=pretty_print) - if self.lastResetTime is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slastResetTime>%s%s' % (namespace_, self.gds_format_integer(self.lastResetTime, input_name='lastResetTime'), namespace_, eol_)) - if self.lastUpdatedTime is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slastUpdatedTime>%s%s' % (namespace_, self.gds_format_integer(self.lastUpdatedTime, input_name='lastUpdatedTime'), namespace_, eol_)) - if self.LLInterfaceListLink is not None: - self.LLInterfaceListLink.export(outfile, level, namespace_, name_='LLInterfaceListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='IPInterface'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IPInterface, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IPInterface, self).exportLiteralChildren(outfile, level, name_) - if self.ifDescr is not None: - showIndent(outfile, level) - outfile.write('ifDescr=%s,\n' % quote_python(self.ifDescr).encode(ExternalEncoding)) - if self.ifHighSpeed is not None: - showIndent(outfile, level) - outfile.write('ifHighSpeed=%d,\n' % self.ifHighSpeed) - if self.ifInBroadcastPkts is not None: - showIndent(outfile, level) - outfile.write('ifInBroadcastPkts=%d,\n' % self.ifInBroadcastPkts) - if self.ifIndex is not None: - showIndent(outfile, level) - outfile.write('ifIndex=%d,\n' % self.ifIndex) - if self.ifInDiscards is not None: - showIndent(outfile, level) - outfile.write('ifInDiscards=%d,\n' % self.ifInDiscards) - if self.ifInErrors is not None: - showIndent(outfile, level) - outfile.write('ifInErrors=%d,\n' % self.ifInErrors) - if self.ifInMulticastPkts is not None: - showIndent(outfile, level) - outfile.write('ifInMulticastPkts=%d,\n' % self.ifInMulticastPkts) - if self.ifInOctets is not None: - showIndent(outfile, level) - outfile.write('ifInOctets=%d,\n' % self.ifInOctets) - if self.ifInUcastPkts is not None: - showIndent(outfile, level) - outfile.write('ifInUcastPkts=%d,\n' % self.ifInUcastPkts) - if self.ifInUnknownProtos is not None: - showIndent(outfile, level) - outfile.write('ifInUnknownProtos=%d,\n' % self.ifInUnknownProtos) - if self.ifMtu is not None: - showIndent(outfile, level) - outfile.write('ifMtu=%d,\n' % self.ifMtu) - if self.ifName is not None: - showIndent(outfile, level) - outfile.write('ifName=%s,\n' % quote_python(self.ifName).encode(ExternalEncoding)) - if self.ifOperStatus is not None: - showIndent(outfile, level) - outfile.write('ifOperStatus=%d,\n' % self.ifOperStatus) - if self.ifOutBroadcastPkts is not None: - showIndent(outfile, level) - outfile.write('ifOutBroadcastPkts=%d,\n' % self.ifOutBroadcastPkts) - if self.ifOutDiscards is not None: - showIndent(outfile, level) - outfile.write('ifOutDiscards=%d,\n' % self.ifOutDiscards) - if self.ifOutErrors is not None: - showIndent(outfile, level) - outfile.write('ifOutErrors=%d,\n' % self.ifOutErrors) - if self.ifOutMulticastPkts is not None: - showIndent(outfile, level) - outfile.write('ifOutMulticastPkts=%d,\n' % self.ifOutMulticastPkts) - if self.ifOutOctets is not None: - showIndent(outfile, level) - outfile.write('ifOutOctets=%d,\n' % self.ifOutOctets) - if self.ifOutUcastPkts is not None: - showIndent(outfile, level) - outfile.write('ifOutUcastPkts=%d,\n' % self.ifOutUcastPkts) - if self.ifPromiscuousMode is not None: - showIndent(outfile, level) - outfile.write('ifPromiscuousMode=%s,\n' % self.ifPromiscuousMode) - if self.ifSpeed is not None: - showIndent(outfile, level) - outfile.write('ifSpeed=%d,\n' % self.ifSpeed) - if self.ifType is not None: - showIndent(outfile, level) - outfile.write('ifType=%d,\n' % self.ifType) - if self.IPAddrListLink is not None: - showIndent(outfile, level) - outfile.write('IPAddrListLink=model_.IPAddrListLink(\n') - self.IPAddrListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.lastResetTime is not None: - showIndent(outfile, level) - outfile.write('lastResetTime=%d,\n' % self.lastResetTime) - if self.lastUpdatedTime is not None: - showIndent(outfile, level) - outfile.write('lastUpdatedTime=%d,\n' % self.lastUpdatedTime) - if self.LLInterfaceListLink is not None: - showIndent(outfile, level) - outfile.write('LLInterfaceListLink=model_.LLInterfaceListLink(\n') - self.LLInterfaceListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IPInterface, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ifDescr': - ifDescr_ = child_.text - ifDescr_ = self.gds_validate_string(ifDescr_, node, 'ifDescr') - self.ifDescr = ifDescr_ - self.validate_String192(self.ifDescr) # validate type String192 - elif nodeName_ == 'ifHighSpeed': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifHighSpeed') - self.ifHighSpeed = ival_ - self.validate_UInt32(self.ifHighSpeed) # validate type UInt32 - elif nodeName_ == 'ifInBroadcastPkts': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInBroadcastPkts') - self.ifInBroadcastPkts = ival_ - self.validate_UInt32(self.ifInBroadcastPkts) # validate type UInt32 - elif nodeName_ == 'ifIndex': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifIndex') - self.ifIndex = ival_ - self.validate_UInt32(self.ifIndex) # validate type UInt32 - elif nodeName_ == 'ifInDiscards': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInDiscards') - self.ifInDiscards = ival_ - self.validate_UInt32(self.ifInDiscards) # validate type UInt32 - elif nodeName_ == 'ifInErrors': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInErrors') - self.ifInErrors = ival_ - self.validate_UInt32(self.ifInErrors) # validate type UInt32 - elif nodeName_ == 'ifInMulticastPkts': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInMulticastPkts') - self.ifInMulticastPkts = ival_ - self.validate_UInt32(self.ifInMulticastPkts) # validate type UInt32 - elif nodeName_ == 'ifInOctets': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInOctets') - self.ifInOctets = ival_ - self.validate_UInt32(self.ifInOctets) # validate type UInt32 - elif nodeName_ == 'ifInUcastPkts': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInUcastPkts') - self.ifInUcastPkts = ival_ - self.validate_UInt32(self.ifInUcastPkts) # validate type UInt32 - elif nodeName_ == 'ifInUnknownProtos': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifInUnknownProtos') - self.ifInUnknownProtos = ival_ - self.validate_UInt32(self.ifInUnknownProtos) # validate type UInt32 - elif nodeName_ == 'ifMtu': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifMtu') - self.ifMtu = ival_ - self.validate_UInt32(self.ifMtu) # validate type UInt32 - elif nodeName_ == 'ifName': - ifName_ = child_.text - ifName_ = self.gds_validate_string(ifName_, node, 'ifName') - self.ifName = ifName_ - self.validate_String16(self.ifName) # validate type String16 - elif nodeName_ == 'ifOperStatus': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOperStatus') - self.ifOperStatus = ival_ - self.validate_UInt8(self.ifOperStatus) # validate type UInt8 - elif nodeName_ == 'ifOutBroadcastPkts': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOutBroadcastPkts') - self.ifOutBroadcastPkts = ival_ - self.validate_UInt32(self.ifOutBroadcastPkts) # validate type UInt32 - elif nodeName_ == 'ifOutDiscards': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOutDiscards') - self.ifOutDiscards = ival_ - self.validate_UInt32(self.ifOutDiscards) # validate type UInt32 - elif nodeName_ == 'ifOutErrors': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOutErrors') - self.ifOutErrors = ival_ - self.validate_UInt32(self.ifOutErrors) # validate type UInt32 - elif nodeName_ == 'ifOutMulticastPkts': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOutMulticastPkts') - self.ifOutMulticastPkts = ival_ - self.validate_UInt32(self.ifOutMulticastPkts) # validate type UInt32 - elif nodeName_ == 'ifOutOctets': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOutOctets') - self.ifOutOctets = ival_ - self.validate_UInt32(self.ifOutOctets) # validate type UInt32 - elif nodeName_ == 'ifOutUcastPkts': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifOutUcastPkts') - self.ifOutUcastPkts = ival_ - self.validate_UInt32(self.ifOutUcastPkts) # validate type UInt32 - elif nodeName_ == 'ifPromiscuousMode': - sval_ = child_.text - if sval_ in ('true', '1'): - ival_ = True - elif sval_ in ('false', '0'): - ival_ = False - else: - raise_parse_error(child_, 'requires boolean') - ival_ = self.gds_validate_boolean(ival_, node, 'ifPromiscuousMode') - self.ifPromiscuousMode = ival_ - elif nodeName_ == 'ifSpeed': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifSpeed') - self.ifSpeed = ival_ - self.validate_UInt32(self.ifSpeed) # validate type UInt32 - elif nodeName_ == 'ifType': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'ifType') - self.ifType = ival_ - self.validate_UInt16(self.ifType) # validate type UInt16 - elif nodeName_ == 'IPAddrListLink': - obj_ = IPAddrListLink.factory() - obj_.build(child_) - self.IPAddrListLink = obj_ - obj_.original_tagname_ = 'IPAddrListLink' - elif nodeName_ == 'lastResetTime': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'lastResetTime') - self.lastResetTime = ival_ - self.validate_Int64(self.lastResetTime) # validate type Int64 - elif nodeName_ == 'lastUpdatedTime': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'lastUpdatedTime') - self.lastUpdatedTime = ival_ - self.validate_Int64(self.lastUpdatedTime) # validate type Int64 - elif nodeName_ == 'LLInterfaceListLink': - obj_ = LLInterfaceListLink.factory() - obj_.build(child_) - self.LLInterfaceListLink = obj_ - obj_.original_tagname_ = 'LLInterfaceListLink' - super(IPInterface, self).buildChildren(child_, node, nodeName_, True) -# end class IPInterface - - -class IPAddrList(List): - """List of IPAddr instances.""" - subclass = None - superclass = List - def __init__(self, IPAddr=None): - self.original_tagname_ = None - super(IPAddrList, self).__init__() - if IPAddr is None: - self.IPAddr = [] - else: - self.IPAddr = IPAddr - def factory(*args_, **kwargs_): - if IPAddrList.subclass: - return IPAddrList.subclass(*args_, **kwargs_) - else: - return IPAddrList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_IPAddr(self): return self.IPAddr - def set_IPAddr(self, IPAddr): self.IPAddr = IPAddr - def add_IPAddr(self, value): self.IPAddr.append(value) - def insert_IPAddr_at(self, index, value): self.IPAddr.insert(index, value) - def replace_IPAddr_at(self, index, value): self.IPAddr[index] = value - def hasContent_(self): - if ( - self.IPAddr or - super(IPAddrList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IPAddrList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IPAddrList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IPAddrList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IPAddrList'): - super(IPAddrList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IPAddrList') - def exportChildren(self, outfile, level, namespace_='', name_='IPAddrList', fromsubclass_=False, pretty_print=True): - super(IPAddrList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for IPAddr_ in self.IPAddr: - IPAddr_.export(outfile, level, namespace_, name_='IPAddr', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='IPAddrList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IPAddrList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IPAddrList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('IPAddr=[\n') - level += 1 - for IPAddr_ in self.IPAddr: - showIndent(outfile, level) - outfile.write('model_.IPAddr(\n') - IPAddr_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IPAddrList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'IPAddr': - obj_ = IPAddr.factory() - obj_.build(child_) - self.IPAddr.append(obj_) - obj_.original_tagname_ = 'IPAddr' - super(IPAddrList, self).buildChildren(child_, node, nodeName_, True) -# end class IPAddrList - - -class IPAddr(Resource): - """An Internet Protocol address object.""" - subclass = None - superclass = Resource - def __init__(self, address=None, RPLInstanceListLink=None): - self.original_tagname_ = None - super(IPAddr, self).__init__() - self.address = address - self.RPLInstanceListLink = RPLInstanceListLink - def factory(*args_, **kwargs_): - if IPAddr.subclass: - return IPAddr.subclass(*args_, **kwargs_) - else: - return IPAddr(*args_, **kwargs_) - factory = staticmethod(factory) - def get_address(self): return self.address - def set_address(self, address): self.address = address - def get_RPLInstanceListLink(self): return self.RPLInstanceListLink - def set_RPLInstanceListLink(self, RPLInstanceListLink): self.RPLInstanceListLink = RPLInstanceListLink - def validate_HexBinary128(self, value): - # Validate type HexBinary128, a restriction on xs:hexBinary. - pass - def hasContent_(self): - if ( - self.address is not None or - self.RPLInstanceListLink is not None or - super(IPAddr, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='IPAddr', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='IPAddr') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='IPAddr', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IPAddr'): - super(IPAddr, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IPAddr') - def exportChildren(self, outfile, level, namespace_='', name_='IPAddr', fromsubclass_=False, pretty_print=True): - super(IPAddr, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.address is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%saddress>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.address).encode(ExternalEncoding), input_name='address'), namespace_, eol_)) - if self.RPLInstanceListLink is not None: - self.RPLInstanceListLink.export(outfile, level, namespace_, name_='RPLInstanceListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='IPAddr'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(IPAddr, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(IPAddr, self).exportLiteralChildren(outfile, level, name_) - if self.address is not None: - showIndent(outfile, level) - outfile.write('address=%s,\n' % quote_python(self.address).encode(ExternalEncoding)) - if self.RPLInstanceListLink is not None: - showIndent(outfile, level) - outfile.write('RPLInstanceListLink=model_.RPLInstanceListLink(\n') - self.RPLInstanceListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(IPAddr, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'address': - address_ = child_.text - address_ = self.gds_validate_string(address_, node, 'address') - self.address = address_ - self.validate_HexBinary128(self.address) # validate type HexBinary128 - elif nodeName_ == 'RPLInstanceListLink': - obj_ = RPLInstanceListLink.factory() - obj_.build(child_) - self.RPLInstanceListLink = obj_ - obj_.original_tagname_ = 'RPLInstanceListLink' - super(IPAddr, self).buildChildren(child_, node, nodeName_, True) -# end class IPAddr - - -class PowerStatus(Resource): - """Contains the status of the device's power sources""" - subclass = None - superclass = Resource - def __init__(self, batteryStatus=None, changedTime=None, currentPowerSource=None, estimatedChargeRemaining=None, estimatedTimeRemaining=None, PEVInfo=None, sessionTimeOnBattery=None, totalTimeOnBattery=None): - self.original_tagname_ = None - super(PowerStatus, self).__init__() - self.batteryStatus = batteryStatus - self.changedTime = changedTime - self.currentPowerSource = currentPowerSource - self.estimatedChargeRemaining = estimatedChargeRemaining - self.estimatedTimeRemaining = estimatedTimeRemaining - self.PEVInfo = PEVInfo - self.sessionTimeOnBattery = sessionTimeOnBattery - self.totalTimeOnBattery = totalTimeOnBattery - def factory(*args_, **kwargs_): - if PowerStatus.subclass: - return PowerStatus.subclass(*args_, **kwargs_) - else: - return PowerStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_batteryStatus(self): return self.batteryStatus - def set_batteryStatus(self, batteryStatus): self.batteryStatus = batteryStatus - def get_changedTime(self): return self.changedTime - def set_changedTime(self, changedTime): self.changedTime = changedTime - def get_currentPowerSource(self): return self.currentPowerSource - def set_currentPowerSource(self, currentPowerSource): self.currentPowerSource = currentPowerSource - def get_estimatedChargeRemaining(self): return self.estimatedChargeRemaining - def set_estimatedChargeRemaining(self, estimatedChargeRemaining): self.estimatedChargeRemaining = estimatedChargeRemaining - def get_estimatedTimeRemaining(self): return self.estimatedTimeRemaining - def set_estimatedTimeRemaining(self, estimatedTimeRemaining): self.estimatedTimeRemaining = estimatedTimeRemaining - def get_PEVInfo(self): return self.PEVInfo - def set_PEVInfo(self, PEVInfo): self.PEVInfo = PEVInfo - def get_sessionTimeOnBattery(self): return self.sessionTimeOnBattery - def set_sessionTimeOnBattery(self, sessionTimeOnBattery): self.sessionTimeOnBattery = sessionTimeOnBattery - def get_totalTimeOnBattery(self): return self.totalTimeOnBattery - def set_totalTimeOnBattery(self, totalTimeOnBattery): self.totalTimeOnBattery = totalTimeOnBattery - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.batteryStatus is not None or - self.changedTime is not None or - self.currentPowerSource is not None or - self.estimatedChargeRemaining is not None or - self.estimatedTimeRemaining is not None or - self.PEVInfo is not None or - self.sessionTimeOnBattery is not None or - self.totalTimeOnBattery is not None or - super(PowerStatus, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PowerStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PowerStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PowerStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PowerStatus'): - super(PowerStatus, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PowerStatus') - def exportChildren(self, outfile, level, namespace_='', name_='PowerStatus', fromsubclass_=False, pretty_print=True): - super(PowerStatus, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.batteryStatus is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sbatteryStatus>%s%s' % (namespace_, self.gds_format_integer(self.batteryStatus, input_name='batteryStatus'), namespace_, eol_)) - if self.changedTime is not None: - self.changedTime.export(outfile, level, namespace_, name_='changedTime', pretty_print=pretty_print) - if self.currentPowerSource is not None: - self.currentPowerSource.export(outfile, level, namespace_, name_='currentPowerSource', pretty_print=pretty_print) - if self.estimatedChargeRemaining is not None: - self.estimatedChargeRemaining.export(outfile, level, namespace_, name_='estimatedChargeRemaining', pretty_print=pretty_print) - if self.estimatedTimeRemaining is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sestimatedTimeRemaining>%s%s' % (namespace_, self.gds_format_integer(self.estimatedTimeRemaining, input_name='estimatedTimeRemaining'), namespace_, eol_)) - if self.PEVInfo is not None: - self.PEVInfo.export(outfile, level, namespace_, name_='PEVInfo', pretty_print=pretty_print) - if self.sessionTimeOnBattery is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssessionTimeOnBattery>%s%s' % (namespace_, self.gds_format_integer(self.sessionTimeOnBattery, input_name='sessionTimeOnBattery'), namespace_, eol_)) - if self.totalTimeOnBattery is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%stotalTimeOnBattery>%s%s' % (namespace_, self.gds_format_integer(self.totalTimeOnBattery, input_name='totalTimeOnBattery'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='PowerStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PowerStatus, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PowerStatus, self).exportLiteralChildren(outfile, level, name_) - if self.batteryStatus is not None: - showIndent(outfile, level) - outfile.write('batteryStatus=%d,\n' % self.batteryStatus) - if self.changedTime is not None: - showIndent(outfile, level) - outfile.write('changedTime=model_.TimeType(\n') - self.changedTime.exportLiteral(outfile, level, name_='changedTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.currentPowerSource is not None: - showIndent(outfile, level) - outfile.write('currentPowerSource=model_.PowerSourceType(\n') - self.currentPowerSource.exportLiteral(outfile, level, name_='currentPowerSource') - showIndent(outfile, level) - outfile.write('),\n') - if self.estimatedChargeRemaining is not None: - showIndent(outfile, level) - outfile.write('estimatedChargeRemaining=model_.PerCent(\n') - self.estimatedChargeRemaining.exportLiteral(outfile, level, name_='estimatedChargeRemaining') - showIndent(outfile, level) - outfile.write('),\n') - if self.estimatedTimeRemaining is not None: - showIndent(outfile, level) - outfile.write('estimatedTimeRemaining=%d,\n' % self.estimatedTimeRemaining) - if self.PEVInfo is not None: - showIndent(outfile, level) - outfile.write('PEVInfo=model_.PEVInfo(\n') - self.PEVInfo.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.sessionTimeOnBattery is not None: - showIndent(outfile, level) - outfile.write('sessionTimeOnBattery=%d,\n' % self.sessionTimeOnBattery) - if self.totalTimeOnBattery is not None: - showIndent(outfile, level) - outfile.write('totalTimeOnBattery=%d,\n' % self.totalTimeOnBattery) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PowerStatus, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'batteryStatus': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'batteryStatus') - self.batteryStatus = ival_ - self.validate_UInt8(self.batteryStatus) # validate type UInt8 - elif nodeName_ == 'changedTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.changedTime = obj_ - obj_.original_tagname_ = 'changedTime' - elif nodeName_ == 'currentPowerSource': - obj_ = PowerSourceType.factory() - obj_.build(child_) - self.currentPowerSource = obj_ - obj_.original_tagname_ = 'currentPowerSource' - elif nodeName_ == 'estimatedChargeRemaining': - obj_ = PerCent.factory() - obj_.build(child_) - self.estimatedChargeRemaining = obj_ - obj_.original_tagname_ = 'estimatedChargeRemaining' - elif nodeName_ == 'estimatedTimeRemaining': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'estimatedTimeRemaining') - self.estimatedTimeRemaining = ival_ - self.validate_UInt32(self.estimatedTimeRemaining) # validate type UInt32 - elif nodeName_ == 'PEVInfo': - obj_ = PEVInfo.factory() - obj_.build(child_) - self.PEVInfo = obj_ - obj_.original_tagname_ = 'PEVInfo' - elif nodeName_ == 'sessionTimeOnBattery': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'sessionTimeOnBattery') - self.sessionTimeOnBattery = ival_ - self.validate_UInt32(self.sessionTimeOnBattery) # validate type UInt32 - elif nodeName_ == 'totalTimeOnBattery': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'totalTimeOnBattery') - self.totalTimeOnBattery = ival_ - self.validate_UInt32(self.totalTimeOnBattery) # validate type UInt32 - super(PowerStatus, self).buildChildren(child_, node, nodeName_, True) -# end class PowerStatus - - -class SupportedLocaleList(List): - """A List element to hold SupportedLocale objects.""" - subclass = None - superclass = List - def __init__(self, SupportedLocale=None): - self.original_tagname_ = None - super(SupportedLocaleList, self).__init__() - if SupportedLocale is None: - self.SupportedLocale = [] - else: - self.SupportedLocale = SupportedLocale - def factory(*args_, **kwargs_): - if SupportedLocaleList.subclass: - return SupportedLocaleList.subclass(*args_, **kwargs_) - else: - return SupportedLocaleList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_SupportedLocale(self): return self.SupportedLocale - def set_SupportedLocale(self, SupportedLocale): self.SupportedLocale = SupportedLocale - def add_SupportedLocale(self, value): self.SupportedLocale.append(value) - def insert_SupportedLocale_at(self, index, value): self.SupportedLocale.insert(index, value) - def replace_SupportedLocale_at(self, index, value): self.SupportedLocale[index] = value - def hasContent_(self): - if ( - self.SupportedLocale or - super(SupportedLocaleList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SupportedLocaleList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SupportedLocaleList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SupportedLocaleList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SupportedLocaleList'): - super(SupportedLocaleList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SupportedLocaleList') - def exportChildren(self, outfile, level, namespace_='', name_='SupportedLocaleList', fromsubclass_=False, pretty_print=True): - super(SupportedLocaleList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for SupportedLocale_ in self.SupportedLocale: - SupportedLocale_.export(outfile, level, namespace_, name_='SupportedLocale', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='SupportedLocaleList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SupportedLocaleList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SupportedLocaleList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('SupportedLocale=[\n') - level += 1 - for SupportedLocale_ in self.SupportedLocale: - showIndent(outfile, level) - outfile.write('model_.SupportedLocale(\n') - SupportedLocale_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SupportedLocaleList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'SupportedLocale': - obj_ = SupportedLocale.factory() - obj_.build(child_) - self.SupportedLocale.append(obj_) - obj_.original_tagname_ = 'SupportedLocale' - super(SupportedLocaleList, self).buildChildren(child_, node, nodeName_, True) -# end class SupportedLocaleList - - -class SupportedLocale(Resource): - """Specifies a locale that is supported""" - subclass = None - superclass = Resource - def __init__(self, locale=None): - self.original_tagname_ = None - super(SupportedLocale, self).__init__() - self.locale = locale - def factory(*args_, **kwargs_): - if SupportedLocale.subclass: - return SupportedLocale.subclass(*args_, **kwargs_) - else: - return SupportedLocale(*args_, **kwargs_) - factory = staticmethod(factory) - def get_locale(self): return self.locale - def set_locale(self, locale): self.locale = locale - def hasContent_(self): - if ( - self.locale is not None or - super(SupportedLocale, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SupportedLocale', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SupportedLocale') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SupportedLocale', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SupportedLocale'): - super(SupportedLocale, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SupportedLocale') - def exportChildren(self, outfile, level, namespace_='', name_='SupportedLocale', fromsubclass_=False, pretty_print=True): - super(SupportedLocale, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.locale is not None: - self.locale.export(outfile, level, namespace_, name_='locale', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='SupportedLocale'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SupportedLocale, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SupportedLocale, self).exportLiteralChildren(outfile, level, name_) - if self.locale is not None: - showIndent(outfile, level) - outfile.write('locale=model_.LocaleType(\n') - self.locale.exportLiteral(outfile, level, name_='locale') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SupportedLocale, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'locale': - obj_ = LocaleType.factory() - obj_.build(child_) - self.locale = obj_ - obj_.original_tagname_ = 'locale' - super(SupportedLocale, self).buildChildren(child_, node, nodeName_, True) -# end class SupportedLocale - - -class DeviceInformation(Resource): - """Contains identification and other information about the device that - changes very infrequently, typically only when updates are - applied, if ever.""" - subclass = None - superclass = Resource - def __init__(self, DRLCCapabilities=None, functionsImplemented=None, lFDI=None, mfDate=None, mfHwVer=None, mfID=None, mfInfo=None, mfModel=None, mfSerNum=None, primaryPower=None, secondaryPower=None, SupportedLocaleListLink=None, swActTime=None, swVer=None): - self.original_tagname_ = None - super(DeviceInformation, self).__init__() - self.DRLCCapabilities = DRLCCapabilities - self.functionsImplemented = functionsImplemented - self.lFDI = lFDI - self.mfDate = mfDate - self.mfHwVer = mfHwVer - self.mfID = mfID - self.mfInfo = mfInfo - self.mfModel = mfModel - self.mfSerNum = mfSerNum - self.primaryPower = primaryPower - self.secondaryPower = secondaryPower - self.SupportedLocaleListLink = SupportedLocaleListLink - self.swActTime = swActTime - self.swVer = swVer - def factory(*args_, **kwargs_): - if DeviceInformation.subclass: - return DeviceInformation.subclass(*args_, **kwargs_) - else: - return DeviceInformation(*args_, **kwargs_) - factory = staticmethod(factory) - def get_DRLCCapabilities(self): return self.DRLCCapabilities - def set_DRLCCapabilities(self, DRLCCapabilities): self.DRLCCapabilities = DRLCCapabilities - def get_functionsImplemented(self): return self.functionsImplemented - def set_functionsImplemented(self, functionsImplemented): self.functionsImplemented = functionsImplemented - def get_lFDI(self): return self.lFDI - def set_lFDI(self, lFDI): self.lFDI = lFDI - def get_mfDate(self): return self.mfDate - def set_mfDate(self, mfDate): self.mfDate = mfDate - def get_mfHwVer(self): return self.mfHwVer - def set_mfHwVer(self, mfHwVer): self.mfHwVer = mfHwVer - def get_mfID(self): return self.mfID - def set_mfID(self, mfID): self.mfID = mfID - def get_mfInfo(self): return self.mfInfo - def set_mfInfo(self, mfInfo): self.mfInfo = mfInfo - def get_mfModel(self): return self.mfModel - def set_mfModel(self, mfModel): self.mfModel = mfModel - def get_mfSerNum(self): return self.mfSerNum - def set_mfSerNum(self, mfSerNum): self.mfSerNum = mfSerNum - def get_primaryPower(self): return self.primaryPower - def set_primaryPower(self, primaryPower): self.primaryPower = primaryPower - def get_secondaryPower(self): return self.secondaryPower - def set_secondaryPower(self, secondaryPower): self.secondaryPower = secondaryPower - def get_SupportedLocaleListLink(self): return self.SupportedLocaleListLink - def set_SupportedLocaleListLink(self, SupportedLocaleListLink): self.SupportedLocaleListLink = SupportedLocaleListLink - def get_swActTime(self): return self.swActTime - def set_swActTime(self, swActTime): self.swActTime = swActTime - def get_swVer(self): return self.swVer - def set_swVer(self, swVer): self.swVer = swVer - def validate_HexBinary64(self, value): - # Validate type HexBinary64, a restriction on xs:hexBinary. - pass - def validate_HexBinary160(self, value): - # Validate type HexBinary160, a restriction on xs:hexBinary. - pass - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def hasContent_(self): - if ( - self.DRLCCapabilities is not None or - self.functionsImplemented is not None or - self.lFDI is not None or - self.mfDate is not None or - self.mfHwVer is not None or - self.mfID is not None or - self.mfInfo is not None or - self.mfModel is not None or - self.mfSerNum is not None or - self.primaryPower is not None or - self.secondaryPower is not None or - self.SupportedLocaleListLink is not None or - self.swActTime is not None or - self.swVer is not None or - super(DeviceInformation, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceInformation', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceInformation') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceInformation', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceInformation'): - super(DeviceInformation, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceInformation') - def exportChildren(self, outfile, level, namespace_='', name_='DeviceInformation', fromsubclass_=False, pretty_print=True): - super(DeviceInformation, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.DRLCCapabilities is not None: - self.DRLCCapabilities.export(outfile, level, namespace_, name_='DRLCCapabilities', pretty_print=pretty_print) - if self.functionsImplemented is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sfunctionsImplemented>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.functionsImplemented).encode(ExternalEncoding), input_name='functionsImplemented'), namespace_, eol_)) - if self.lFDI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slFDI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.lFDI).encode(ExternalEncoding), input_name='lFDI'), namespace_, eol_)) - if self.mfDate is not None: - self.mfDate.export(outfile, level, namespace_, name_='mfDate', pretty_print=pretty_print) - if self.mfHwVer is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfHwVer>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfHwVer).encode(ExternalEncoding), input_name='mfHwVer'), namespace_, eol_)) - if self.mfID is not None: - self.mfID.export(outfile, level, namespace_, name_='mfID', pretty_print=pretty_print) - if self.mfInfo is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfInfo>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfInfo).encode(ExternalEncoding), input_name='mfInfo'), namespace_, eol_)) - if self.mfModel is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfModel>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfModel).encode(ExternalEncoding), input_name='mfModel'), namespace_, eol_)) - if self.mfSerNum is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%smfSerNum>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.mfSerNum).encode(ExternalEncoding), input_name='mfSerNum'), namespace_, eol_)) - if self.primaryPower is not None: - self.primaryPower.export(outfile, level, namespace_, name_='primaryPower', pretty_print=pretty_print) - if self.secondaryPower is not None: - self.secondaryPower.export(outfile, level, namespace_, name_='secondaryPower', pretty_print=pretty_print) - if self.SupportedLocaleListLink is not None: - self.SupportedLocaleListLink.export(outfile, level, namespace_, name_='SupportedLocaleListLink', pretty_print=pretty_print) - if self.swActTime is not None: - self.swActTime.export(outfile, level, namespace_, name_='swActTime', pretty_print=pretty_print) - if self.swVer is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sswVer>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.swVer).encode(ExternalEncoding), input_name='swVer'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='DeviceInformation'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DeviceInformation, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DeviceInformation, self).exportLiteralChildren(outfile, level, name_) - if self.DRLCCapabilities is not None: - showIndent(outfile, level) - outfile.write('DRLCCapabilities=model_.DRLCCapabilities(\n') - self.DRLCCapabilities.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.functionsImplemented is not None: - showIndent(outfile, level) - outfile.write('functionsImplemented=%s,\n' % quote_python(self.functionsImplemented).encode(ExternalEncoding)) - if self.lFDI is not None: - showIndent(outfile, level) - outfile.write('lFDI=%s,\n' % quote_python(self.lFDI).encode(ExternalEncoding)) - if self.mfDate is not None: - showIndent(outfile, level) - outfile.write('mfDate=model_.TimeType(\n') - self.mfDate.exportLiteral(outfile, level, name_='mfDate') - showIndent(outfile, level) - outfile.write('),\n') - if self.mfHwVer is not None: - showIndent(outfile, level) - outfile.write('mfHwVer=%s,\n' % quote_python(self.mfHwVer).encode(ExternalEncoding)) - if self.mfID is not None: - showIndent(outfile, level) - outfile.write('mfID=model_.PENType(\n') - self.mfID.exportLiteral(outfile, level, name_='mfID') - showIndent(outfile, level) - outfile.write('),\n') - if self.mfInfo is not None: - showIndent(outfile, level) - outfile.write('mfInfo=%s,\n' % quote_python(self.mfInfo).encode(ExternalEncoding)) - if self.mfModel is not None: - showIndent(outfile, level) - outfile.write('mfModel=%s,\n' % quote_python(self.mfModel).encode(ExternalEncoding)) - if self.mfSerNum is not None: - showIndent(outfile, level) - outfile.write('mfSerNum=%s,\n' % quote_python(self.mfSerNum).encode(ExternalEncoding)) - if self.primaryPower is not None: - showIndent(outfile, level) - outfile.write('primaryPower=model_.PowerSourceType(\n') - self.primaryPower.exportLiteral(outfile, level, name_='primaryPower') - showIndent(outfile, level) - outfile.write('),\n') - if self.secondaryPower is not None: - showIndent(outfile, level) - outfile.write('secondaryPower=model_.PowerSourceType(\n') - self.secondaryPower.exportLiteral(outfile, level, name_='secondaryPower') - showIndent(outfile, level) - outfile.write('),\n') - if self.SupportedLocaleListLink is not None: - showIndent(outfile, level) - outfile.write('SupportedLocaleListLink=model_.SupportedLocaleListLink(\n') - self.SupportedLocaleListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.swActTime is not None: - showIndent(outfile, level) - outfile.write('swActTime=model_.TimeType(\n') - self.swActTime.exportLiteral(outfile, level, name_='swActTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.swVer is not None: - showIndent(outfile, level) - outfile.write('swVer=%s,\n' % quote_python(self.swVer).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DeviceInformation, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'DRLCCapabilities': - obj_ = DRLCCapabilities.factory() - obj_.build(child_) - self.DRLCCapabilities = obj_ - obj_.original_tagname_ = 'DRLCCapabilities' - elif nodeName_ == 'functionsImplemented': - functionsImplemented_ = child_.text - functionsImplemented_ = self.gds_validate_string(functionsImplemented_, node, 'functionsImplemented') - self.functionsImplemented = functionsImplemented_ - self.validate_HexBinary64(self.functionsImplemented) # validate type HexBinary64 - elif nodeName_ == 'lFDI': - lFDI_ = child_.text - lFDI_ = self.gds_validate_string(lFDI_, node, 'lFDI') - self.lFDI = lFDI_ - self.validate_HexBinary160(self.lFDI) # validate type HexBinary160 - elif nodeName_ == 'mfDate': - obj_ = TimeType.factory() - obj_.build(child_) - self.mfDate = obj_ - obj_.original_tagname_ = 'mfDate' - elif nodeName_ == 'mfHwVer': - mfHwVer_ = child_.text - mfHwVer_ = self.gds_validate_string(mfHwVer_, node, 'mfHwVer') - self.mfHwVer = mfHwVer_ - self.validate_String32(self.mfHwVer) # validate type String32 - elif nodeName_ == 'mfID': - obj_ = PENType.factory() - obj_.build(child_) - self.mfID = obj_ - obj_.original_tagname_ = 'mfID' - elif nodeName_ == 'mfInfo': - mfInfo_ = child_.text - mfInfo_ = self.gds_validate_string(mfInfo_, node, 'mfInfo') - self.mfInfo = mfInfo_ - self.validate_String32(self.mfInfo) # validate type String32 - elif nodeName_ == 'mfModel': - mfModel_ = child_.text - mfModel_ = self.gds_validate_string(mfModel_, node, 'mfModel') - self.mfModel = mfModel_ - self.validate_String32(self.mfModel) # validate type String32 - elif nodeName_ == 'mfSerNum': - mfSerNum_ = child_.text - mfSerNum_ = self.gds_validate_string(mfSerNum_, node, 'mfSerNum') - self.mfSerNum = mfSerNum_ - self.validate_String32(self.mfSerNum) # validate type String32 - elif nodeName_ == 'primaryPower': - obj_ = PowerSourceType.factory() - obj_.build(child_) - self.primaryPower = obj_ - obj_.original_tagname_ = 'primaryPower' - elif nodeName_ == 'secondaryPower': - obj_ = PowerSourceType.factory() - obj_.build(child_) - self.secondaryPower = obj_ - obj_.original_tagname_ = 'secondaryPower' - elif nodeName_ == 'SupportedLocaleListLink': - obj_ = SupportedLocaleListLink.factory() - obj_.build(child_) - self.SupportedLocaleListLink = obj_ - obj_.original_tagname_ = 'SupportedLocaleListLink' - elif nodeName_ == 'swActTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.swActTime = obj_ - obj_.original_tagname_ = 'swActTime' - elif nodeName_ == 'swVer': - swVer_ = child_.text - swVer_ = self.gds_validate_string(swVer_, node, 'swVer') - self.swVer = swVer_ - self.validate_String32(self.swVer) # validate type String32 - super(DeviceInformation, self).buildChildren(child_, node, nodeName_, True) -# end class DeviceInformation - - -class Time(Resource): - """Contains the representation of time, constantly updated.""" - subclass = None - superclass = Resource - def __init__(self, currentTime=None, dstEndTime=None, dstOffset=None, dstStartTime=None, localTime=None, quality=None, tzOffset=None): - self.original_tagname_ = None - super(Time, self).__init__() - self.currentTime = currentTime - self.dstEndTime = dstEndTime - self.dstOffset = dstOffset - self.dstStartTime = dstStartTime - self.localTime = localTime - self.quality = quality - self.tzOffset = tzOffset - def factory(*args_, **kwargs_): - if Time.subclass: - return Time.subclass(*args_, **kwargs_) - else: - return Time(*args_, **kwargs_) - factory = staticmethod(factory) - def get_currentTime(self): return self.currentTime - def set_currentTime(self, currentTime): self.currentTime = currentTime - def get_dstEndTime(self): return self.dstEndTime - def set_dstEndTime(self, dstEndTime): self.dstEndTime = dstEndTime - def get_dstOffset(self): return self.dstOffset - def set_dstOffset(self, dstOffset): self.dstOffset = dstOffset - def get_dstStartTime(self): return self.dstStartTime - def set_dstStartTime(self, dstStartTime): self.dstStartTime = dstStartTime - def get_localTime(self): return self.localTime - def set_localTime(self, localTime): self.localTime = localTime - def get_quality(self): return self.quality - def set_quality(self, quality): self.quality = quality - def get_tzOffset(self): return self.tzOffset - def set_tzOffset(self, tzOffset): self.tzOffset = tzOffset - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.currentTime is not None or - self.dstEndTime is not None or - self.dstOffset is not None or - self.dstStartTime is not None or - self.localTime is not None or - self.quality is not None or - self.tzOffset is not None or - super(Time, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Time', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Time') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Time', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Time'): - super(Time, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Time') - def exportChildren(self, outfile, level, namespace_='', name_='Time', fromsubclass_=False, pretty_print=True): - super(Time, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.currentTime is not None: - self.currentTime.export(outfile, level, namespace_, name_='currentTime', pretty_print=pretty_print) - if self.dstEndTime is not None: - self.dstEndTime.export(outfile, level, namespace_, name_='dstEndTime', pretty_print=pretty_print) - if self.dstOffset is not None: - self.dstOffset.export(outfile, level, namespace_, name_='dstOffset', pretty_print=pretty_print) - if self.dstStartTime is not None: - self.dstStartTime.export(outfile, level, namespace_, name_='dstStartTime', pretty_print=pretty_print) - if self.localTime is not None: - self.localTime.export(outfile, level, namespace_, name_='localTime', pretty_print=pretty_print) - if self.quality is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%squality>%s%s' % (namespace_, self.gds_format_integer(self.quality, input_name='quality'), namespace_, eol_)) - if self.tzOffset is not None: - self.tzOffset.export(outfile, level, namespace_, name_='tzOffset', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='Time'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Time, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Time, self).exportLiteralChildren(outfile, level, name_) - if self.currentTime is not None: - showIndent(outfile, level) - outfile.write('currentTime=model_.TimeType(\n') - self.currentTime.exportLiteral(outfile, level, name_='currentTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.dstEndTime is not None: - showIndent(outfile, level) - outfile.write('dstEndTime=model_.TimeType(\n') - self.dstEndTime.exportLiteral(outfile, level, name_='dstEndTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.dstOffset is not None: - showIndent(outfile, level) - outfile.write('dstOffset=model_.TimeOffsetType(\n') - self.dstOffset.exportLiteral(outfile, level, name_='dstOffset') - showIndent(outfile, level) - outfile.write('),\n') - if self.dstStartTime is not None: - showIndent(outfile, level) - outfile.write('dstStartTime=model_.TimeType(\n') - self.dstStartTime.exportLiteral(outfile, level, name_='dstStartTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.localTime is not None: - showIndent(outfile, level) - outfile.write('localTime=model_.TimeType(\n') - self.localTime.exportLiteral(outfile, level, name_='localTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.quality is not None: - showIndent(outfile, level) - outfile.write('quality=%d,\n' % self.quality) - if self.tzOffset is not None: - showIndent(outfile, level) - outfile.write('tzOffset=model_.TimeOffsetType(\n') - self.tzOffset.exportLiteral(outfile, level, name_='tzOffset') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Time, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'currentTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.currentTime = obj_ - obj_.original_tagname_ = 'currentTime' - elif nodeName_ == 'dstEndTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dstEndTime = obj_ - obj_.original_tagname_ = 'dstEndTime' - elif nodeName_ == 'dstOffset': - obj_ = TimeOffsetType.factory() - obj_.build(child_) - self.dstOffset = obj_ - obj_.original_tagname_ = 'dstOffset' - elif nodeName_ == 'dstStartTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.dstStartTime = obj_ - obj_.original_tagname_ = 'dstStartTime' - elif nodeName_ == 'localTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.localTime = obj_ - obj_.original_tagname_ = 'localTime' - elif nodeName_ == 'quality': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'quality') - self.quality = ival_ - self.validate_UInt8(self.quality) # validate type UInt8 - elif nodeName_ == 'tzOffset': - obj_ = TimeOffsetType.factory() - obj_.build(child_) - self.tzOffset = obj_ - obj_.original_tagname_ = 'tzOffset' - super(Time, self).buildChildren(child_, node, nodeName_, True) -# end class Time - - -class ResponseSetList(List): - """A List element to hold ResponseSet objects.""" - subclass = None - superclass = List - def __init__(self, ResponseSet=None): - self.original_tagname_ = None - super(ResponseSetList, self).__init__() - if ResponseSet is None: - self.ResponseSet = [] - else: - self.ResponseSet = ResponseSet - def factory(*args_, **kwargs_): - if ResponseSetList.subclass: - return ResponseSetList.subclass(*args_, **kwargs_) - else: - return ResponseSetList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ResponseSet(self): return self.ResponseSet - def set_ResponseSet(self, ResponseSet): self.ResponseSet = ResponseSet - def add_ResponseSet(self, value): self.ResponseSet.append(value) - def insert_ResponseSet_at(self, index, value): self.ResponseSet.insert(index, value) - def replace_ResponseSet_at(self, index, value): self.ResponseSet[index] = value - def hasContent_(self): - if ( - self.ResponseSet or - super(ResponseSetList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ResponseSetList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseSetList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ResponseSetList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ResponseSetList'): - super(ResponseSetList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseSetList') - def exportChildren(self, outfile, level, namespace_='', name_='ResponseSetList', fromsubclass_=False, pretty_print=True): - super(ResponseSetList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for ResponseSet_ in self.ResponseSet: - ResponseSet_.export(outfile, level, namespace_, name_='ResponseSet', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ResponseSetList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ResponseSetList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ResponseSetList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('ResponseSet=[\n') - level += 1 - for ResponseSet_ in self.ResponseSet: - showIndent(outfile, level) - outfile.write('model_.ResponseSet(\n') - ResponseSet_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ResponseSetList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ResponseSet': - obj_ = ResponseSet.factory() - obj_.build(child_) - self.ResponseSet.append(obj_) - obj_.original_tagname_ = 'ResponseSet' - super(ResponseSetList, self).buildChildren(child_, node, nodeName_, True) -# end class ResponseSetList - - -class ResponseSet(IdentifiedObject): - """A container for a ResponseList.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, ResponseListLink=None): - self.original_tagname_ = None - super(ResponseSet, self).__init__() - self.ResponseListLink = ResponseListLink - def factory(*args_, **kwargs_): - if ResponseSet.subclass: - return ResponseSet.subclass(*args_, **kwargs_) - else: - return ResponseSet(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ResponseListLink(self): return self.ResponseListLink - def set_ResponseListLink(self, ResponseListLink): self.ResponseListLink = ResponseListLink - def hasContent_(self): - if ( - self.ResponseListLink is not None or - super(ResponseSet, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ResponseSet', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseSet') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ResponseSet', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ResponseSet'): - super(ResponseSet, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseSet') - def exportChildren(self, outfile, level, namespace_='', name_='ResponseSet', fromsubclass_=False, pretty_print=True): - super(ResponseSet, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ResponseListLink is not None: - self.ResponseListLink.export(outfile, level, namespace_, name_='ResponseListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ResponseSet'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ResponseSet, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ResponseSet, self).exportLiteralChildren(outfile, level, name_) - if self.ResponseListLink is not None: - showIndent(outfile, level) - outfile.write('ResponseListLink=model_.ResponseListLink(\n') - self.ResponseListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ResponseSet, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ResponseListLink': - obj_ = ResponseListLink.factory() - obj_.build(child_) - self.ResponseListLink = obj_ - obj_.original_tagname_ = 'ResponseListLink' - super(ResponseSet, self).buildChildren(child_, node, nodeName_, True) -# end class ResponseSet - - -class ResponseList(List): - """A List element to hold Response objects.""" - subclass = None - superclass = List - def __init__(self, Response=None): - self.original_tagname_ = None - super(ResponseList, self).__init__() - if Response is None: - self.Response = [] - else: - self.Response = Response - def factory(*args_, **kwargs_): - if ResponseList.subclass: - return ResponseList.subclass(*args_, **kwargs_) - else: - return ResponseList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Response(self): return self.Response - def set_Response(self, Response): self.Response = Response - def add_Response(self, value): self.Response.append(value) - def insert_Response_at(self, index, value): self.Response.insert(index, value) - def replace_Response_at(self, index, value): self.Response[index] = value - def hasContent_(self): - if ( - self.Response or - super(ResponseList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ResponseList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ResponseList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ResponseList'): - super(ResponseList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ResponseList') - def exportChildren(self, outfile, level, namespace_='', name_='ResponseList', fromsubclass_=False, pretty_print=True): - super(ResponseList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Response_ in self.Response: - Response_.export(outfile, level, namespace_, name_='Response', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ResponseList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ResponseList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ResponseList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Response=[\n') - level += 1 - for Response_ in self.Response: - showIndent(outfile, level) - outfile.write('model_.Response(\n') - Response_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ResponseList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Response': - class_obj_ = self.get_class_obj_(child_, Response) - obj_ = class_obj_.factory() - obj_.build(child_) - self.Response.append(obj_) - obj_.original_tagname_ = 'Response' - super(ResponseList, self).buildChildren(child_, node, nodeName_, True) -# end class ResponseList - - -class Response(Resource): - """The Response object is the generic response data repository for - functions which do not have additional specific data (e.g. DRLC - has additional data fields (SetPoint) where Price and Text event - do not).""" - subclass = None - superclass = Resource - def __init__(self, createdDateTime=None, endDeviceLFDI=None, status=None, subject=None): - self.original_tagname_ = None - super(Response, self).__init__() - self.createdDateTime = createdDateTime - self.endDeviceLFDI = endDeviceLFDI - self.status = status - self.subject = subject - def factory(*args_, **kwargs_): - if Response.subclass: - return Response.subclass(*args_, **kwargs_) - else: - return Response(*args_, **kwargs_) - factory = staticmethod(factory) - def get_createdDateTime(self): return self.createdDateTime - def set_createdDateTime(self, createdDateTime): self.createdDateTime = createdDateTime - def get_endDeviceLFDI(self): return self.endDeviceLFDI - def set_endDeviceLFDI(self, endDeviceLFDI): self.endDeviceLFDI = endDeviceLFDI - def get_status(self): return self.status - def set_status(self, status): self.status = status - def get_subject(self): return self.subject - def set_subject(self, subject): self.subject = subject - def validate_HexBinary160(self, value): - # Validate type HexBinary160, a restriction on xs:hexBinary. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.createdDateTime is not None or - self.endDeviceLFDI is not None or - self.status is not None or - self.subject is not None or - super(Response, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Response', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Response') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Response', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Response'): - super(Response, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Response') - def exportChildren(self, outfile, level, namespace_='', name_='Response', fromsubclass_=False, pretty_print=True): - super(Response, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.createdDateTime is not None: - self.createdDateTime.export(outfile, level, namespace_, name_='createdDateTime', pretty_print=pretty_print) - if self.endDeviceLFDI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sendDeviceLFDI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.endDeviceLFDI).encode(ExternalEncoding), input_name='endDeviceLFDI'), namespace_, eol_)) - if self.status is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sstatus>%s%s' % (namespace_, self.gds_format_integer(self.status, input_name='status'), namespace_, eol_)) - if self.subject is not None: - self.subject.export(outfile, level, namespace_, name_='subject', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='Response'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Response, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Response, self).exportLiteralChildren(outfile, level, name_) - if self.createdDateTime is not None: - showIndent(outfile, level) - outfile.write('createdDateTime=model_.TimeType(\n') - self.createdDateTime.exportLiteral(outfile, level, name_='createdDateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.endDeviceLFDI is not None: - showIndent(outfile, level) - outfile.write('endDeviceLFDI=%s,\n' % quote_python(self.endDeviceLFDI).encode(ExternalEncoding)) - if self.status is not None: - showIndent(outfile, level) - outfile.write('status=%d,\n' % self.status) - if self.subject is not None: - showIndent(outfile, level) - outfile.write('subject=model_.mRIDType(\n') - self.subject.exportLiteral(outfile, level, name_='subject') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Response, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'createdDateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.createdDateTime = obj_ - obj_.original_tagname_ = 'createdDateTime' - elif nodeName_ == 'endDeviceLFDI': - endDeviceLFDI_ = child_.text - endDeviceLFDI_ = self.gds_validate_string(endDeviceLFDI_, node, 'endDeviceLFDI') - self.endDeviceLFDI = endDeviceLFDI_ - self.validate_HexBinary160(self.endDeviceLFDI) # validate type HexBinary160 - elif nodeName_ == 'status': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'status') - self.status = ival_ - self.validate_UInt8(self.status) # validate type UInt8 - elif nodeName_ == 'subject': - obj_ = mRIDType.factory() - obj_.build(child_) - self.subject = obj_ - obj_.original_tagname_ = 'subject' - super(Response, self).buildChildren(child_, node, nodeName_, True) -# end class Response - - -class PriceResponse(Response): - """A response related to a price message.""" - subclass = None - superclass = Response - def __init__(self): - self.original_tagname_ = None - super(PriceResponse, self).__init__() - def factory(*args_, **kwargs_): - if PriceResponse.subclass: - return PriceResponse.subclass(*args_, **kwargs_) - else: - return PriceResponse(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(PriceResponse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='PriceResponse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='PriceResponse', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='PriceResponse'): - super(PriceResponse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='PriceResponse') - def exportChildren(self, outfile, level, namespace_='', name_='PriceResponse', fromsubclass_=False, pretty_print=True): - super(PriceResponse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='PriceResponse'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(PriceResponse, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(PriceResponse, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(PriceResponse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(PriceResponse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class PriceResponse - - -class DrResponse(Response): - """A response to a Demand Response Load Control (EndDeviceControl) - message.""" - subclass = None - superclass = Response - def __init__(self, ApplianceLoadReduction=None, AppliedTargetReduction=None, DutyCycle=None, Offset=None, overrideDuration=None, SetPoint=None): - self.original_tagname_ = None - super(DrResponse, self).__init__() - self.ApplianceLoadReduction = ApplianceLoadReduction - self.AppliedTargetReduction = AppliedTargetReduction - self.DutyCycle = DutyCycle - self.Offset = Offset - self.overrideDuration = overrideDuration - self.SetPoint = SetPoint - def factory(*args_, **kwargs_): - if DrResponse.subclass: - return DrResponse.subclass(*args_, **kwargs_) - else: - return DrResponse(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ApplianceLoadReduction(self): return self.ApplianceLoadReduction - def set_ApplianceLoadReduction(self, ApplianceLoadReduction): self.ApplianceLoadReduction = ApplianceLoadReduction - def get_AppliedTargetReduction(self): return self.AppliedTargetReduction - def set_AppliedTargetReduction(self, AppliedTargetReduction): self.AppliedTargetReduction = AppliedTargetReduction - def get_DutyCycle(self): return self.DutyCycle - def set_DutyCycle(self, DutyCycle): self.DutyCycle = DutyCycle - def get_Offset(self): return self.Offset - def set_Offset(self, Offset): self.Offset = Offset - def get_overrideDuration(self): return self.overrideDuration - def set_overrideDuration(self, overrideDuration): self.overrideDuration = overrideDuration - def get_SetPoint(self): return self.SetPoint - def set_SetPoint(self, SetPoint): self.SetPoint = SetPoint - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.ApplianceLoadReduction is not None or - self.AppliedTargetReduction is not None or - self.DutyCycle is not None or - self.Offset is not None or - self.overrideDuration is not None or - self.SetPoint is not None or - super(DrResponse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DrResponse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DrResponse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DrResponse', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DrResponse'): - super(DrResponse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DrResponse') - def exportChildren(self, outfile, level, namespace_='', name_='DrResponse', fromsubclass_=False, pretty_print=True): - super(DrResponse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ApplianceLoadReduction is not None: - self.ApplianceLoadReduction.export(outfile, level, namespace_, name_='ApplianceLoadReduction', pretty_print=pretty_print) - if self.AppliedTargetReduction is not None: - self.AppliedTargetReduction.export(outfile, level, namespace_, name_='AppliedTargetReduction', pretty_print=pretty_print) - if self.DutyCycle is not None: - self.DutyCycle.export(outfile, level, namespace_, name_='DutyCycle', pretty_print=pretty_print) - if self.Offset is not None: - self.Offset.export(outfile, level, namespace_, name_='Offset', pretty_print=pretty_print) - if self.overrideDuration is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%soverrideDuration>%s%s' % (namespace_, self.gds_format_integer(self.overrideDuration, input_name='overrideDuration'), namespace_, eol_)) - if self.SetPoint is not None: - self.SetPoint.export(outfile, level, namespace_, name_='SetPoint', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DrResponse'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DrResponse, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DrResponse, self).exportLiteralChildren(outfile, level, name_) - if self.ApplianceLoadReduction is not None: - showIndent(outfile, level) - outfile.write('ApplianceLoadReduction=model_.ApplianceLoadReduction(\n') - self.ApplianceLoadReduction.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.AppliedTargetReduction is not None: - showIndent(outfile, level) - outfile.write('AppliedTargetReduction=model_.AppliedTargetReduction(\n') - self.AppliedTargetReduction.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DutyCycle is not None: - showIndent(outfile, level) - outfile.write('DutyCycle=model_.DutyCycle(\n') - self.DutyCycle.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.Offset is not None: - showIndent(outfile, level) - outfile.write('Offset=model_.Offset(\n') - self.Offset.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.overrideDuration is not None: - showIndent(outfile, level) - outfile.write('overrideDuration=%d,\n' % self.overrideDuration) - if self.SetPoint is not None: - showIndent(outfile, level) - outfile.write('SetPoint=model_.SetPoint(\n') - self.SetPoint.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DrResponse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ApplianceLoadReduction': - obj_ = ApplianceLoadReduction.factory() - obj_.build(child_) - self.ApplianceLoadReduction = obj_ - obj_.original_tagname_ = 'ApplianceLoadReduction' - elif nodeName_ == 'AppliedTargetReduction': - obj_ = AppliedTargetReduction.factory() - obj_.build(child_) - self.AppliedTargetReduction = obj_ - obj_.original_tagname_ = 'AppliedTargetReduction' - elif nodeName_ == 'DutyCycle': - obj_ = DutyCycle.factory() - obj_.build(child_) - self.DutyCycle = obj_ - obj_.original_tagname_ = 'DutyCycle' - elif nodeName_ == 'Offset': - obj_ = Offset.factory() - obj_.build(child_) - self.Offset = obj_ - obj_.original_tagname_ = 'Offset' - elif nodeName_ == 'overrideDuration': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'overrideDuration') - self.overrideDuration = ival_ - self.validate_UInt16(self.overrideDuration) # validate type UInt16 - elif nodeName_ == 'SetPoint': - obj_ = SetPoint.factory() - obj_.build(child_) - self.SetPoint = obj_ - obj_.original_tagname_ = 'SetPoint' - super(DrResponse, self).buildChildren(child_, node, nodeName_, True) -# end class DrResponse - - -class NotificationList(List): - """A List element to hold Notification objects.""" - subclass = None - superclass = List - def __init__(self, Notification=None): - self.original_tagname_ = None - super(NotificationList, self).__init__() - if Notification is None: - self.Notification = [] - else: - self.Notification = Notification - def factory(*args_, **kwargs_): - if NotificationList.subclass: - return NotificationList.subclass(*args_, **kwargs_) - else: - return NotificationList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Notification(self): return self.Notification - def set_Notification(self, Notification): self.Notification = Notification - def add_Notification(self, value): self.Notification.append(value) - def insert_Notification_at(self, index, value): self.Notification.insert(index, value) - def replace_Notification_at(self, index, value): self.Notification[index] = value - def hasContent_(self): - if ( - self.Notification or - super(NotificationList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='NotificationList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='NotificationList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='NotificationList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='NotificationList'): - super(NotificationList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NotificationList') - def exportChildren(self, outfile, level, namespace_='', name_='NotificationList', fromsubclass_=False, pretty_print=True): - super(NotificationList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Notification_ in self.Notification: - Notification_.export(outfile, level, namespace_, name_='Notification', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='NotificationList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(NotificationList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(NotificationList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Notification=[\n') - level += 1 - for Notification_ in self.Notification: - showIndent(outfile, level) - outfile.write('model_.Notification(\n') - Notification_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(NotificationList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Notification': - obj_ = Notification.factory() - obj_.build(child_) - self.Notification.append(obj_) - obj_.original_tagname_ = 'Notification' - super(NotificationList, self).buildChildren(child_, node, nodeName_, True) -# end class NotificationList - - -class SubscriptionList(List): - """A List element to hold Subscription objects.""" - subclass = None - superclass = List - def __init__(self, Subscription=None): - self.original_tagname_ = None - super(SubscriptionList, self).__init__() - if Subscription is None: - self.Subscription = [] - else: - self.Subscription = Subscription - def factory(*args_, **kwargs_): - if SubscriptionList.subclass: - return SubscriptionList.subclass(*args_, **kwargs_) - else: - return SubscriptionList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Subscription(self): return self.Subscription - def set_Subscription(self, Subscription): self.Subscription = Subscription - def add_Subscription(self, value): self.Subscription.append(value) - def insert_Subscription_at(self, index, value): self.Subscription.insert(index, value) - def replace_Subscription_at(self, index, value): self.Subscription[index] = value - def hasContent_(self): - if ( - self.Subscription or - super(SubscriptionList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubscriptionList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubscriptionList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubscriptionList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubscriptionList'): - super(SubscriptionList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SubscriptionList') - def exportChildren(self, outfile, level, namespace_='', name_='SubscriptionList', fromsubclass_=False, pretty_print=True): - super(SubscriptionList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Subscription_ in self.Subscription: - Subscription_.export(outfile, level, namespace_, name_='Subscription', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='SubscriptionList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SubscriptionList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SubscriptionList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Subscription=[\n') - level += 1 - for Subscription_ in self.Subscription: - showIndent(outfile, level) - outfile.write('model_.Subscription(\n') - Subscription_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SubscriptionList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Subscription': - obj_ = Subscription.factory() - obj_.build(child_) - self.Subscription.append(obj_) - obj_.original_tagname_ = 'Subscription' - super(SubscriptionList, self).buildChildren(child_, node, nodeName_, True) -# end class SubscriptionList - - -class SubscriptionBase(Resource): - """Holds the information related to a client subscription to receive - updates to a resource automatically. The actual resources may be - passed in the Notification by specifying a specific xsi:type for - the Resource and passing the full representation.""" - subclass = None - superclass = Resource - def __init__(self, subscribedResource=None): - self.original_tagname_ = None - super(SubscriptionBase, self).__init__() - self.subscribedResource = subscribedResource - def factory(*args_, **kwargs_): - if SubscriptionBase.subclass: - return SubscriptionBase.subclass(*args_, **kwargs_) - else: - return SubscriptionBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_subscribedResource(self): return self.subscribedResource - def set_subscribedResource(self, subscribedResource): self.subscribedResource = subscribedResource - def hasContent_(self): - if ( - self.subscribedResource is not None or - super(SubscriptionBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SubscriptionBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SubscriptionBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SubscriptionBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SubscriptionBase'): - super(SubscriptionBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SubscriptionBase') - def exportChildren(self, outfile, level, namespace_='', name_='SubscriptionBase', fromsubclass_=False, pretty_print=True): - super(SubscriptionBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.subscribedResource is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssubscribedResource>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.subscribedResource).encode(ExternalEncoding), input_name='subscribedResource'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='SubscriptionBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SubscriptionBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SubscriptionBase, self).exportLiteralChildren(outfile, level, name_) - if self.subscribedResource is not None: - showIndent(outfile, level) - outfile.write('subscribedResource=%s,\n' % quote_python(self.subscribedResource).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SubscriptionBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'subscribedResource': - subscribedResource_ = child_.text - subscribedResource_ = self.gds_validate_string(subscribedResource_, node, 'subscribedResource') - self.subscribedResource = subscribedResource_ - super(SubscriptionBase, self).buildChildren(child_, node, nodeName_, True) -# end class SubscriptionBase - - -class FunctionSetAssignmentsList(SubscribableList): - """A List element to hold FunctionSetAssignments objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, FunctionSetAssignments=None): - self.original_tagname_ = None - super(FunctionSetAssignmentsList, self).__init__() - if FunctionSetAssignments is None: - self.FunctionSetAssignments = [] - else: - self.FunctionSetAssignments = FunctionSetAssignments - def factory(*args_, **kwargs_): - if FunctionSetAssignmentsList.subclass: - return FunctionSetAssignmentsList.subclass(*args_, **kwargs_) - else: - return FunctionSetAssignmentsList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_FunctionSetAssignments(self): return self.FunctionSetAssignments - def set_FunctionSetAssignments(self, FunctionSetAssignments): self.FunctionSetAssignments = FunctionSetAssignments - def add_FunctionSetAssignments(self, value): self.FunctionSetAssignments.append(value) - def insert_FunctionSetAssignments_at(self, index, value): self.FunctionSetAssignments.insert(index, value) - def replace_FunctionSetAssignments_at(self, index, value): self.FunctionSetAssignments[index] = value - def hasContent_(self): - if ( - self.FunctionSetAssignments or - super(FunctionSetAssignmentsList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FunctionSetAssignmentsList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignmentsList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FunctionSetAssignmentsList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FunctionSetAssignmentsList'): - super(FunctionSetAssignmentsList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignmentsList') - def exportChildren(self, outfile, level, namespace_='', name_='FunctionSetAssignmentsList', fromsubclass_=False, pretty_print=True): - super(FunctionSetAssignmentsList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for FunctionSetAssignments_ in self.FunctionSetAssignments: - FunctionSetAssignments_.export(outfile, level, namespace_, name_='FunctionSetAssignments', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FunctionSetAssignmentsList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FunctionSetAssignmentsList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FunctionSetAssignmentsList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('FunctionSetAssignments=[\n') - level += 1 - for FunctionSetAssignments_ in self.FunctionSetAssignments: - showIndent(outfile, level) - outfile.write('model_.FunctionSetAssignments(\n') - FunctionSetAssignments_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FunctionSetAssignmentsList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'FunctionSetAssignments': - obj_ = FunctionSetAssignments.factory() - obj_.build(child_) - self.FunctionSetAssignments.append(obj_) - obj_.original_tagname_ = 'FunctionSetAssignments' - super(FunctionSetAssignmentsList, self).buildChildren(child_, node, nodeName_, True) -# end class FunctionSetAssignmentsList - - -class FunctionSetAssignmentsBase(Resource): - """Defines a collection of function set instances that are to be used - by one or more devices as indicated by the EndDevice object(s) - of the server.""" - subclass = None - superclass = Resource - def __init__(self, CustomerAccountListLink=None, DemandResponseProgramListLink=None, DERProgramListLink=None, FileListLink=None, MessagingProgramListLink=None, PrepaymentListLink=None, ResponseSetListLink=None, TariffProfileListLink=None, TimeLink=None, UsagePointListLink=None): - self.original_tagname_ = None - super(FunctionSetAssignmentsBase, self).__init__() - self.CustomerAccountListLink = CustomerAccountListLink - self.DemandResponseProgramListLink = DemandResponseProgramListLink - self.DERProgramListLink = DERProgramListLink - self.FileListLink = FileListLink - self.MessagingProgramListLink = MessagingProgramListLink - self.PrepaymentListLink = PrepaymentListLink - self.ResponseSetListLink = ResponseSetListLink - self.TariffProfileListLink = TariffProfileListLink - self.TimeLink = TimeLink - self.UsagePointListLink = UsagePointListLink - def factory(*args_, **kwargs_): - if FunctionSetAssignmentsBase.subclass: - return FunctionSetAssignmentsBase.subclass(*args_, **kwargs_) - else: - return FunctionSetAssignmentsBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_CustomerAccountListLink(self): return self.CustomerAccountListLink - def set_CustomerAccountListLink(self, CustomerAccountListLink): self.CustomerAccountListLink = CustomerAccountListLink - def get_DemandResponseProgramListLink(self): return self.DemandResponseProgramListLink - def set_DemandResponseProgramListLink(self, DemandResponseProgramListLink): self.DemandResponseProgramListLink = DemandResponseProgramListLink - def get_DERProgramListLink(self): return self.DERProgramListLink - def set_DERProgramListLink(self, DERProgramListLink): self.DERProgramListLink = DERProgramListLink - def get_FileListLink(self): return self.FileListLink - def set_FileListLink(self, FileListLink): self.FileListLink = FileListLink - def get_MessagingProgramListLink(self): return self.MessagingProgramListLink - def set_MessagingProgramListLink(self, MessagingProgramListLink): self.MessagingProgramListLink = MessagingProgramListLink - def get_PrepaymentListLink(self): return self.PrepaymentListLink - def set_PrepaymentListLink(self, PrepaymentListLink): self.PrepaymentListLink = PrepaymentListLink - def get_ResponseSetListLink(self): return self.ResponseSetListLink - def set_ResponseSetListLink(self, ResponseSetListLink): self.ResponseSetListLink = ResponseSetListLink - def get_TariffProfileListLink(self): return self.TariffProfileListLink - def set_TariffProfileListLink(self, TariffProfileListLink): self.TariffProfileListLink = TariffProfileListLink - def get_TimeLink(self): return self.TimeLink - def set_TimeLink(self, TimeLink): self.TimeLink = TimeLink - def get_UsagePointListLink(self): return self.UsagePointListLink - def set_UsagePointListLink(self, UsagePointListLink): self.UsagePointListLink = UsagePointListLink - def hasContent_(self): - if ( - self.CustomerAccountListLink is not None or - self.DemandResponseProgramListLink is not None or - self.DERProgramListLink is not None or - self.FileListLink is not None or - self.MessagingProgramListLink is not None or - self.PrepaymentListLink is not None or - self.ResponseSetListLink is not None or - self.TariffProfileListLink is not None or - self.TimeLink is not None or - self.UsagePointListLink is not None or - super(FunctionSetAssignmentsBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FunctionSetAssignmentsBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignmentsBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FunctionSetAssignmentsBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FunctionSetAssignmentsBase'): - super(FunctionSetAssignmentsBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignmentsBase') - def exportChildren(self, outfile, level, namespace_='', name_='FunctionSetAssignmentsBase', fromsubclass_=False, pretty_print=True): - super(FunctionSetAssignmentsBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.CustomerAccountListLink is not None: - self.CustomerAccountListLink.export(outfile, level, namespace_, name_='CustomerAccountListLink', pretty_print=pretty_print) - if self.DemandResponseProgramListLink is not None: - self.DemandResponseProgramListLink.export(outfile, level, namespace_, name_='DemandResponseProgramListLink', pretty_print=pretty_print) - if self.DERProgramListLink is not None: - self.DERProgramListLink.export(outfile, level, namespace_, name_='DERProgramListLink', pretty_print=pretty_print) - if self.FileListLink is not None: - self.FileListLink.export(outfile, level, namespace_, name_='FileListLink', pretty_print=pretty_print) - if self.MessagingProgramListLink is not None: - self.MessagingProgramListLink.export(outfile, level, namespace_, name_='MessagingProgramListLink', pretty_print=pretty_print) - if self.PrepaymentListLink is not None: - self.PrepaymentListLink.export(outfile, level, namespace_, name_='PrepaymentListLink', pretty_print=pretty_print) - if self.ResponseSetListLink is not None: - self.ResponseSetListLink.export(outfile, level, namespace_, name_='ResponseSetListLink', pretty_print=pretty_print) - if self.TariffProfileListLink is not None: - self.TariffProfileListLink.export(outfile, level, namespace_, name_='TariffProfileListLink', pretty_print=pretty_print) - if self.TimeLink is not None: - self.TimeLink.export(outfile, level, namespace_, name_='TimeLink', pretty_print=pretty_print) - if self.UsagePointListLink is not None: - self.UsagePointListLink.export(outfile, level, namespace_, name_='UsagePointListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FunctionSetAssignmentsBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(FunctionSetAssignmentsBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FunctionSetAssignmentsBase, self).exportLiteralChildren(outfile, level, name_) - if self.CustomerAccountListLink is not None: - showIndent(outfile, level) - outfile.write('CustomerAccountListLink=model_.CustomerAccountListLink(\n') - self.CustomerAccountListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DemandResponseProgramListLink is not None: - showIndent(outfile, level) - outfile.write('DemandResponseProgramListLink=model_.DemandResponseProgramListLink(\n') - self.DemandResponseProgramListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERProgramListLink is not None: - showIndent(outfile, level) - outfile.write('DERProgramListLink=model_.DERProgramListLink(\n') - self.DERProgramListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.FileListLink is not None: - showIndent(outfile, level) - outfile.write('FileListLink=model_.FileListLink(\n') - self.FileListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.MessagingProgramListLink is not None: - showIndent(outfile, level) - outfile.write('MessagingProgramListLink=model_.MessagingProgramListLink(\n') - self.MessagingProgramListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.PrepaymentListLink is not None: - showIndent(outfile, level) - outfile.write('PrepaymentListLink=model_.PrepaymentListLink(\n') - self.PrepaymentListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ResponseSetListLink is not None: - showIndent(outfile, level) - outfile.write('ResponseSetListLink=model_.ResponseSetListLink(\n') - self.ResponseSetListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.TariffProfileListLink is not None: - showIndent(outfile, level) - outfile.write('TariffProfileListLink=model_.TariffProfileListLink(\n') - self.TariffProfileListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.TimeLink is not None: - showIndent(outfile, level) - outfile.write('TimeLink=model_.TimeLink(\n') - self.TimeLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.UsagePointListLink is not None: - showIndent(outfile, level) - outfile.write('UsagePointListLink=model_.UsagePointListLink(\n') - self.UsagePointListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(FunctionSetAssignmentsBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'CustomerAccountListLink': - obj_ = CustomerAccountListLink.factory() - obj_.build(child_) - self.CustomerAccountListLink = obj_ - obj_.original_tagname_ = 'CustomerAccountListLink' - elif nodeName_ == 'DemandResponseProgramListLink': - obj_ = DemandResponseProgramListLink.factory() - obj_.build(child_) - self.DemandResponseProgramListLink = obj_ - obj_.original_tagname_ = 'DemandResponseProgramListLink' - elif nodeName_ == 'DERProgramListLink': - obj_ = DERProgramListLink.factory() - obj_.build(child_) - self.DERProgramListLink = obj_ - obj_.original_tagname_ = 'DERProgramListLink' - elif nodeName_ == 'FileListLink': - obj_ = FileListLink.factory() - obj_.build(child_) - self.FileListLink = obj_ - obj_.original_tagname_ = 'FileListLink' - elif nodeName_ == 'MessagingProgramListLink': - obj_ = MessagingProgramListLink.factory() - obj_.build(child_) - self.MessagingProgramListLink = obj_ - obj_.original_tagname_ = 'MessagingProgramListLink' - elif nodeName_ == 'PrepaymentListLink': - obj_ = PrepaymentListLink.factory() - obj_.build(child_) - self.PrepaymentListLink = obj_ - obj_.original_tagname_ = 'PrepaymentListLink' - elif nodeName_ == 'ResponseSetListLink': - obj_ = ResponseSetListLink.factory() - obj_.build(child_) - self.ResponseSetListLink = obj_ - obj_.original_tagname_ = 'ResponseSetListLink' - elif nodeName_ == 'TariffProfileListLink': - obj_ = TariffProfileListLink.factory() - obj_.build(child_) - self.TariffProfileListLink = obj_ - obj_.original_tagname_ = 'TariffProfileListLink' - elif nodeName_ == 'TimeLink': - obj_ = TimeLink.factory() - obj_.build(child_) - self.TimeLink = obj_ - obj_.original_tagname_ = 'TimeLink' - elif nodeName_ == 'UsagePointListLink': - obj_ = UsagePointListLink.factory() - obj_.build(child_) - self.UsagePointListLink = obj_ - obj_.original_tagname_ = 'UsagePointListLink' - super(FunctionSetAssignmentsBase, self).buildChildren(child_, node, nodeName_, True) -# end class FunctionSetAssignmentsBase - - -class Registration(Resource): - """Registration represents an authorization to access the resources on - a host.""" - subclass = None - superclass = Resource - def __init__(self, dateTimeRegistered=None, pIN=None): - self.original_tagname_ = None - super(Registration, self).__init__() - self.dateTimeRegistered = dateTimeRegistered - self.pIN = pIN - def factory(*args_, **kwargs_): - if Registration.subclass: - return Registration.subclass(*args_, **kwargs_) - else: - return Registration(*args_, **kwargs_) - factory = staticmethod(factory) - def get_dateTimeRegistered(self): return self.dateTimeRegistered - def set_dateTimeRegistered(self, dateTimeRegistered): self.dateTimeRegistered = dateTimeRegistered - def get_pIN(self): return self.pIN - def set_pIN(self, pIN): self.pIN = pIN - def hasContent_(self): - if ( - self.dateTimeRegistered is not None or - self.pIN is not None or - super(Registration, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Registration', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Registration') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Registration', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Registration'): - super(Registration, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Registration') - def exportChildren(self, outfile, level, namespace_='', name_='Registration', fromsubclass_=False, pretty_print=True): - super(Registration, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.dateTimeRegistered is not None: - self.dateTimeRegistered.export(outfile, level, namespace_, name_='dateTimeRegistered', pretty_print=pretty_print) - if self.pIN is not None: - self.pIN.export(outfile, level, namespace_, name_='pIN', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='Registration'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Registration, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Registration, self).exportLiteralChildren(outfile, level, name_) - if self.dateTimeRegistered is not None: - showIndent(outfile, level) - outfile.write('dateTimeRegistered=model_.TimeType(\n') - self.dateTimeRegistered.exportLiteral(outfile, level, name_='dateTimeRegistered') - showIndent(outfile, level) - outfile.write('),\n') - if self.pIN is not None: - showIndent(outfile, level) - outfile.write('pIN=model_.PINType(\n') - self.pIN.exportLiteral(outfile, level, name_='pIN') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Registration, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'dateTimeRegistered': - obj_ = TimeType.factory() - obj_.build(child_) - self.dateTimeRegistered = obj_ - obj_.original_tagname_ = 'dateTimeRegistered' - elif nodeName_ == 'pIN': - obj_ = PINType.factory() - obj_.build(child_) - self.pIN = obj_ - obj_.original_tagname_ = 'pIN' - super(Registration, self).buildChildren(child_, node, nodeName_, True) -# end class Registration - - -class EndDeviceList(SubscribableList): - """A List element to hold EndDevice objects.""" - subclass = None - superclass = SubscribableList - def __init__(self, EndDevice=None): - self.original_tagname_ = None - super(EndDeviceList, self).__init__() - if EndDevice is None: - self.EndDevice = [] - else: - self.EndDevice = EndDevice - def factory(*args_, **kwargs_): - if EndDeviceList.subclass: - return EndDeviceList.subclass(*args_, **kwargs_) - else: - return EndDeviceList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_EndDevice(self): return self.EndDevice - def set_EndDevice(self, EndDevice): self.EndDevice = EndDevice - def add_EndDevice(self, value): self.EndDevice.append(value) - def insert_EndDevice_at(self, index, value): self.EndDevice.insert(index, value) - def replace_EndDevice_at(self, index, value): self.EndDevice[index] = value - def hasContent_(self): - if ( - self.EndDevice or - super(EndDeviceList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDeviceList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDeviceList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDeviceList'): - super(EndDeviceList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDeviceList') - def exportChildren(self, outfile, level, namespace_='', name_='EndDeviceList', fromsubclass_=False, pretty_print=True): - super(EndDeviceList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for EndDevice_ in self.EndDevice: - EndDevice_.export(outfile, level, namespace_, name_='EndDevice', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='EndDeviceList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDeviceList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDeviceList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('EndDevice=[\n') - level += 1 - for EndDevice_ in self.EndDevice: - showIndent(outfile, level) - outfile.write('model_.EndDevice(\n') - EndDevice_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDeviceList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'EndDevice': - obj_ = EndDevice.factory() - obj_.build(child_) - self.EndDevice.append(obj_) - obj_.original_tagname_ = 'EndDevice' - super(EndDeviceList, self).buildChildren(child_, node, nodeName_, True) -# end class EndDeviceList - - -class DeviceStatus(Resource): - """Status of device""" - subclass = None - superclass = Resource - def __init__(self, changedTime=None, onCount=None, opState=None, opTime=None, Temperature=None, TimeLink=None): - self.original_tagname_ = None - super(DeviceStatus, self).__init__() - self.changedTime = changedTime - self.onCount = onCount - self.opState = opState - self.opTime = opTime - if Temperature is None: - self.Temperature = [] - else: - self.Temperature = Temperature - self.TimeLink = TimeLink - def factory(*args_, **kwargs_): - if DeviceStatus.subclass: - return DeviceStatus.subclass(*args_, **kwargs_) - else: - return DeviceStatus(*args_, **kwargs_) - factory = staticmethod(factory) - def get_changedTime(self): return self.changedTime - def set_changedTime(self, changedTime): self.changedTime = changedTime - def get_onCount(self): return self.onCount - def set_onCount(self, onCount): self.onCount = onCount - def get_opState(self): return self.opState - def set_opState(self, opState): self.opState = opState - def get_opTime(self): return self.opTime - def set_opTime(self, opTime): self.opTime = opTime - def get_Temperature(self): return self.Temperature - def set_Temperature(self, Temperature): self.Temperature = Temperature - def add_Temperature(self, value): self.Temperature.append(value) - def insert_Temperature_at(self, index, value): self.Temperature.insert(index, value) - def replace_Temperature_at(self, index, value): self.Temperature[index] = value - def get_TimeLink(self): return self.TimeLink - def set_TimeLink(self, TimeLink): self.TimeLink = TimeLink - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_UInt32(self, value): - # Validate type UInt32, a restriction on xs:unsignedInt. - pass - def hasContent_(self): - if ( - self.changedTime is not None or - self.onCount is not None or - self.opState is not None or - self.opTime is not None or - self.Temperature or - self.TimeLink is not None or - super(DeviceStatus, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceStatus', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceStatus') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceStatus', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceStatus'): - super(DeviceStatus, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceStatus') - def exportChildren(self, outfile, level, namespace_='', name_='DeviceStatus', fromsubclass_=False, pretty_print=True): - super(DeviceStatus, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.changedTime is not None: - self.changedTime.export(outfile, level, namespace_, name_='changedTime', pretty_print=pretty_print) - if self.onCount is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sonCount>%s%s' % (namespace_, self.gds_format_integer(self.onCount, input_name='onCount'), namespace_, eol_)) - if self.opState is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sopState>%s%s' % (namespace_, self.gds_format_integer(self.opState, input_name='opState'), namespace_, eol_)) - if self.opTime is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sopTime>%s%s' % (namespace_, self.gds_format_integer(self.opTime, input_name='opTime'), namespace_, eol_)) - for Temperature_ in self.Temperature: - Temperature_.export(outfile, level, namespace_, name_='Temperature', pretty_print=pretty_print) - if self.TimeLink is not None: - self.TimeLink.export(outfile, level, namespace_, name_='TimeLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DeviceStatus'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DeviceStatus, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DeviceStatus, self).exportLiteralChildren(outfile, level, name_) - if self.changedTime is not None: - showIndent(outfile, level) - outfile.write('changedTime=model_.TimeType(\n') - self.changedTime.exportLiteral(outfile, level, name_='changedTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.onCount is not None: - showIndent(outfile, level) - outfile.write('onCount=%d,\n' % self.onCount) - if self.opState is not None: - showIndent(outfile, level) - outfile.write('opState=%d,\n' % self.opState) - if self.opTime is not None: - showIndent(outfile, level) - outfile.write('opTime=%d,\n' % self.opTime) - showIndent(outfile, level) - outfile.write('Temperature=[\n') - level += 1 - for Temperature_ in self.Temperature: - showIndent(outfile, level) - outfile.write('model_.Temperature(\n') - Temperature_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - if self.TimeLink is not None: - showIndent(outfile, level) - outfile.write('TimeLink=model_.TimeLink(\n') - self.TimeLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DeviceStatus, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'changedTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.changedTime = obj_ - obj_.original_tagname_ = 'changedTime' - elif nodeName_ == 'onCount': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'onCount') - self.onCount = ival_ - self.validate_UInt16(self.onCount) # validate type UInt16 - elif nodeName_ == 'opState': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'opState') - self.opState = ival_ - self.validate_UInt8(self.opState) # validate type UInt8 - elif nodeName_ == 'opTime': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'opTime') - self.opTime = ival_ - self.validate_UInt32(self.opTime) # validate type UInt32 - elif nodeName_ == 'Temperature': - obj_ = Temperature.factory() - obj_.build(child_) - self.Temperature.append(obj_) - obj_.original_tagname_ = 'Temperature' - elif nodeName_ == 'TimeLink': - obj_ = TimeLink.factory() - obj_.build(child_) - self.TimeLink = obj_ - obj_.original_tagname_ = 'TimeLink' - super(DeviceStatus, self).buildChildren(child_, node, nodeName_, True) -# end class DeviceStatus - - -class AbstractDevice(SubscribableResource): - """The EndDevice providing the resources available within the - DeviceCapabilities.""" - subclass = None - superclass = SubscribableResource - def __init__(self, ConfigurationLink=None, DERListLink=None, DeviceInformationLink=None, DeviceStatusLink=None, FileStatusLink=None, IPInterfaceListLink=None, LoadShedAvailabilityLink=None, loadShedDeviceCategory=None, LogEventListLink=None, PowerStatusLink=None, sFDI=None): - self.original_tagname_ = None - super(AbstractDevice, self).__init__() - self.ConfigurationLink = ConfigurationLink - self.DERListLink = DERListLink - self.DeviceInformationLink = DeviceInformationLink - self.DeviceStatusLink = DeviceStatusLink - self.FileStatusLink = FileStatusLink - self.IPInterfaceListLink = IPInterfaceListLink - self.LoadShedAvailabilityLink = LoadShedAvailabilityLink - self.loadShedDeviceCategory = loadShedDeviceCategory - self.LogEventListLink = LogEventListLink - self.PowerStatusLink = PowerStatusLink - self.sFDI = sFDI - def factory(*args_, **kwargs_): - if AbstractDevice.subclass: - return AbstractDevice.subclass(*args_, **kwargs_) - else: - return AbstractDevice(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ConfigurationLink(self): return self.ConfigurationLink - def set_ConfigurationLink(self, ConfigurationLink): self.ConfigurationLink = ConfigurationLink - def get_DERListLink(self): return self.DERListLink - def set_DERListLink(self, DERListLink): self.DERListLink = DERListLink - def get_DeviceInformationLink(self): return self.DeviceInformationLink - def set_DeviceInformationLink(self, DeviceInformationLink): self.DeviceInformationLink = DeviceInformationLink - def get_DeviceStatusLink(self): return self.DeviceStatusLink - def set_DeviceStatusLink(self, DeviceStatusLink): self.DeviceStatusLink = DeviceStatusLink - def get_FileStatusLink(self): return self.FileStatusLink - def set_FileStatusLink(self, FileStatusLink): self.FileStatusLink = FileStatusLink - def get_IPInterfaceListLink(self): return self.IPInterfaceListLink - def set_IPInterfaceListLink(self, IPInterfaceListLink): self.IPInterfaceListLink = IPInterfaceListLink - def get_LoadShedAvailabilityLink(self): return self.LoadShedAvailabilityLink - def set_LoadShedAvailabilityLink(self, LoadShedAvailabilityLink): self.LoadShedAvailabilityLink = LoadShedAvailabilityLink - def get_loadShedDeviceCategory(self): return self.loadShedDeviceCategory - def set_loadShedDeviceCategory(self, loadShedDeviceCategory): self.loadShedDeviceCategory = loadShedDeviceCategory - def get_LogEventListLink(self): return self.LogEventListLink - def set_LogEventListLink(self, LogEventListLink): self.LogEventListLink = LogEventListLink - def get_PowerStatusLink(self): return self.PowerStatusLink - def set_PowerStatusLink(self, PowerStatusLink): self.PowerStatusLink = PowerStatusLink - def get_sFDI(self): return self.sFDI - def set_sFDI(self, sFDI): self.sFDI = sFDI - def hasContent_(self): - if ( - self.ConfigurationLink is not None or - self.DERListLink is not None or - self.DeviceInformationLink is not None or - self.DeviceStatusLink is not None or - self.FileStatusLink is not None or - self.IPInterfaceListLink is not None or - self.LoadShedAvailabilityLink is not None or - self.loadShedDeviceCategory is not None or - self.LogEventListLink is not None or - self.PowerStatusLink is not None or - self.sFDI is not None or - super(AbstractDevice, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='AbstractDevice', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='AbstractDevice') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='AbstractDevice', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='AbstractDevice'): - super(AbstractDevice, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AbstractDevice') - def exportChildren(self, outfile, level, namespace_='', name_='AbstractDevice', fromsubclass_=False, pretty_print=True): - super(AbstractDevice, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ConfigurationLink is not None: - self.ConfigurationLink.export(outfile, level, namespace_, name_='ConfigurationLink', pretty_print=pretty_print) - if self.DERListLink is not None: - self.DERListLink.export(outfile, level, namespace_, name_='DERListLink', pretty_print=pretty_print) - if self.DeviceInformationLink is not None: - self.DeviceInformationLink.export(outfile, level, namespace_, name_='DeviceInformationLink', pretty_print=pretty_print) - if self.DeviceStatusLink is not None: - self.DeviceStatusLink.export(outfile, level, namespace_, name_='DeviceStatusLink', pretty_print=pretty_print) - if self.FileStatusLink is not None: - self.FileStatusLink.export(outfile, level, namespace_, name_='FileStatusLink', pretty_print=pretty_print) - if self.IPInterfaceListLink is not None: - self.IPInterfaceListLink.export(outfile, level, namespace_, name_='IPInterfaceListLink', pretty_print=pretty_print) - if self.LoadShedAvailabilityLink is not None: - self.LoadShedAvailabilityLink.export(outfile, level, namespace_, name_='LoadShedAvailabilityLink', pretty_print=pretty_print) - if self.loadShedDeviceCategory is not None: - self.loadShedDeviceCategory.export(outfile, level, namespace_, name_='loadShedDeviceCategory', pretty_print=pretty_print) - if self.LogEventListLink is not None: - self.LogEventListLink.export(outfile, level, namespace_, name_='LogEventListLink', pretty_print=pretty_print) - if self.PowerStatusLink is not None: - self.PowerStatusLink.export(outfile, level, namespace_, name_='PowerStatusLink', pretty_print=pretty_print) - if self.sFDI is not None: - self.sFDI.export(outfile, level, namespace_, name_='sFDI', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='AbstractDevice'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(AbstractDevice, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(AbstractDevice, self).exportLiteralChildren(outfile, level, name_) - if self.ConfigurationLink is not None: - showIndent(outfile, level) - outfile.write('ConfigurationLink=model_.ConfigurationLink(\n') - self.ConfigurationLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DERListLink is not None: - showIndent(outfile, level) - outfile.write('DERListLink=model_.DERListLink(\n') - self.DERListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DeviceInformationLink is not None: - showIndent(outfile, level) - outfile.write('DeviceInformationLink=model_.DeviceInformationLink(\n') - self.DeviceInformationLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.DeviceStatusLink is not None: - showIndent(outfile, level) - outfile.write('DeviceStatusLink=model_.DeviceStatusLink(\n') - self.DeviceStatusLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.FileStatusLink is not None: - showIndent(outfile, level) - outfile.write('FileStatusLink=model_.FileStatusLink(\n') - self.FileStatusLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.IPInterfaceListLink is not None: - showIndent(outfile, level) - outfile.write('IPInterfaceListLink=model_.IPInterfaceListLink(\n') - self.IPInterfaceListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.LoadShedAvailabilityLink is not None: - showIndent(outfile, level) - outfile.write('LoadShedAvailabilityLink=model_.LoadShedAvailabilityLink(\n') - self.LoadShedAvailabilityLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.loadShedDeviceCategory is not None: - showIndent(outfile, level) - outfile.write('loadShedDeviceCategory=model_.DeviceCategoryType(\n') - self.loadShedDeviceCategory.exportLiteral(outfile, level, name_='loadShedDeviceCategory') - showIndent(outfile, level) - outfile.write('),\n') - if self.LogEventListLink is not None: - showIndent(outfile, level) - outfile.write('LogEventListLink=model_.LogEventListLink(\n') - self.LogEventListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.PowerStatusLink is not None: - showIndent(outfile, level) - outfile.write('PowerStatusLink=model_.PowerStatusLink(\n') - self.PowerStatusLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.sFDI is not None: - showIndent(outfile, level) - outfile.write('sFDI=model_.SFDIType(\n') - self.sFDI.exportLiteral(outfile, level, name_='sFDI') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(AbstractDevice, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ConfigurationLink': - obj_ = ConfigurationLink.factory() - obj_.build(child_) - self.ConfigurationLink = obj_ - obj_.original_tagname_ = 'ConfigurationLink' - elif nodeName_ == 'DERListLink': - obj_ = DERListLink.factory() - obj_.build(child_) - self.DERListLink = obj_ - obj_.original_tagname_ = 'DERListLink' - elif nodeName_ == 'DeviceInformationLink': - obj_ = DeviceInformationLink.factory() - obj_.build(child_) - self.DeviceInformationLink = obj_ - obj_.original_tagname_ = 'DeviceInformationLink' - elif nodeName_ == 'DeviceStatusLink': - obj_ = DeviceStatusLink.factory() - obj_.build(child_) - self.DeviceStatusLink = obj_ - obj_.original_tagname_ = 'DeviceStatusLink' - elif nodeName_ == 'FileStatusLink': - obj_ = FileStatusLink.factory() - obj_.build(child_) - self.FileStatusLink = obj_ - obj_.original_tagname_ = 'FileStatusLink' - elif nodeName_ == 'IPInterfaceListLink': - obj_ = IPInterfaceListLink.factory() - obj_.build(child_) - self.IPInterfaceListLink = obj_ - obj_.original_tagname_ = 'IPInterfaceListLink' - elif nodeName_ == 'LoadShedAvailabilityLink': - obj_ = LoadShedAvailabilityLink.factory() - obj_.build(child_) - self.LoadShedAvailabilityLink = obj_ - obj_.original_tagname_ = 'LoadShedAvailabilityLink' - elif nodeName_ == 'loadShedDeviceCategory': - obj_ = DeviceCategoryType.factory() - obj_.build(child_) - self.loadShedDeviceCategory = obj_ - obj_.original_tagname_ = 'loadShedDeviceCategory' - elif nodeName_ == 'LogEventListLink': - obj_ = LogEventListLink.factory() - obj_.build(child_) - self.LogEventListLink = obj_ - obj_.original_tagname_ = 'LogEventListLink' - elif nodeName_ == 'PowerStatusLink': - obj_ = PowerStatusLink.factory() - obj_.build(child_) - self.PowerStatusLink = obj_ - obj_.original_tagname_ = 'PowerStatusLink' - elif nodeName_ == 'sFDI': - obj_ = SFDIType.factory() - obj_.build(child_) - self.sFDI = obj_ - obj_.original_tagname_ = 'sFDI' - super(AbstractDevice, self).buildChildren(child_, node, nodeName_, True) -# end class AbstractDevice - - -class DeviceCapability(FunctionSetAssignmentsBase): - """Returned by the URI provided by DNS-SD, to allow clients to find the - URIs to the resources in which they are interested.""" - subclass = None - superclass = FunctionSetAssignmentsBase - def __init__(self, EndDeviceListLink=None, MirrorUsagePointListLink=None, SelfDeviceLink=None): - self.original_tagname_ = None - super(DeviceCapability, self).__init__() - self.EndDeviceListLink = EndDeviceListLink - self.MirrorUsagePointListLink = MirrorUsagePointListLink - self.SelfDeviceLink = SelfDeviceLink - def factory(*args_, **kwargs_): - if DeviceCapability.subclass: - return DeviceCapability.subclass(*args_, **kwargs_) - else: - return DeviceCapability(*args_, **kwargs_) - factory = staticmethod(factory) - def get_EndDeviceListLink(self): return self.EndDeviceListLink - def set_EndDeviceListLink(self, EndDeviceListLink): self.EndDeviceListLink = EndDeviceListLink - def get_MirrorUsagePointListLink(self): return self.MirrorUsagePointListLink - def set_MirrorUsagePointListLink(self, MirrorUsagePointListLink): self.MirrorUsagePointListLink = MirrorUsagePointListLink - def get_SelfDeviceLink(self): return self.SelfDeviceLink - def set_SelfDeviceLink(self, SelfDeviceLink): self.SelfDeviceLink = SelfDeviceLink - def hasContent_(self): - if ( - self.EndDeviceListLink is not None or - self.MirrorUsagePointListLink is not None or - self.SelfDeviceLink is not None or - super(DeviceCapability, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='DeviceCapability', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceCapability') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='DeviceCapability', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DeviceCapability'): - super(DeviceCapability, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeviceCapability') - def exportChildren(self, outfile, level, namespace_='', name_='DeviceCapability', fromsubclass_=False, pretty_print=True): - super(DeviceCapability, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.EndDeviceListLink is not None: - self.EndDeviceListLink.export(outfile, level, namespace_, name_='EndDeviceListLink', pretty_print=pretty_print) - if self.MirrorUsagePointListLink is not None: - self.MirrorUsagePointListLink.export(outfile, level, namespace_, name_='MirrorUsagePointListLink', pretty_print=pretty_print) - if self.SelfDeviceLink is not None: - self.SelfDeviceLink.export(outfile, level, namespace_, name_='SelfDeviceLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='DeviceCapability'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(DeviceCapability, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(DeviceCapability, self).exportLiteralChildren(outfile, level, name_) - if self.EndDeviceListLink is not None: - showIndent(outfile, level) - outfile.write('EndDeviceListLink=model_.EndDeviceListLink(\n') - self.EndDeviceListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.MirrorUsagePointListLink is not None: - showIndent(outfile, level) - outfile.write('MirrorUsagePointListLink=model_.MirrorUsagePointListLink(\n') - self.MirrorUsagePointListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.SelfDeviceLink is not None: - showIndent(outfile, level) - outfile.write('SelfDeviceLink=model_.SelfDeviceLink(\n') - self.SelfDeviceLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(DeviceCapability, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'EndDeviceListLink': - obj_ = EndDeviceListLink.factory() - obj_.build(child_) - self.EndDeviceListLink = obj_ - obj_.original_tagname_ = 'EndDeviceListLink' - elif nodeName_ == 'MirrorUsagePointListLink': - obj_ = MirrorUsagePointListLink.factory() - obj_.build(child_) - self.MirrorUsagePointListLink = obj_ - obj_.original_tagname_ = 'MirrorUsagePointListLink' - elif nodeName_ == 'SelfDeviceLink': - obj_ = SelfDeviceLink.factory() - obj_.build(child_) - self.SelfDeviceLink = obj_ - obj_.original_tagname_ = 'SelfDeviceLink' - super(DeviceCapability, self).buildChildren(child_, node, nodeName_, True) -# end class DeviceCapability - - -class UsagePointBase(IdentifiedObject): - """Logical point on a network at which consumption or production is - either physically measured (e.g. metered) or estimated (e.g. - unmetered street lights). A container for associating - ReadingType, Readings and ReadingSets.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, roleFlags=None, serviceCategoryKind=None, status=None): - self.original_tagname_ = None - super(UsagePointBase, self).__init__() - self.roleFlags = roleFlags - self.serviceCategoryKind = serviceCategoryKind - self.status = status - def factory(*args_, **kwargs_): - if UsagePointBase.subclass: - return UsagePointBase.subclass(*args_, **kwargs_) - else: - return UsagePointBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_roleFlags(self): return self.roleFlags - def set_roleFlags(self, roleFlags): self.roleFlags = roleFlags - def get_serviceCategoryKind(self): return self.serviceCategoryKind - def set_serviceCategoryKind(self, serviceCategoryKind): self.serviceCategoryKind = serviceCategoryKind - def get_status(self): return self.status - def set_status(self, status): self.status = status - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.roleFlags is not None or - self.serviceCategoryKind is not None or - self.status is not None or - super(UsagePointBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UsagePointBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UsagePointBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UsagePointBase'): - super(UsagePointBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePointBase') - def exportChildren(self, outfile, level, namespace_='', name_='UsagePointBase', fromsubclass_=False, pretty_print=True): - super(UsagePointBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.roleFlags is not None: - self.roleFlags.export(outfile, level, namespace_, name_='roleFlags', pretty_print=pretty_print) - if self.serviceCategoryKind is not None: - self.serviceCategoryKind.export(outfile, level, namespace_, name_='serviceCategoryKind', pretty_print=pretty_print) - if self.status is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sstatus>%s%s' % (namespace_, self.gds_format_integer(self.status, input_name='status'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='UsagePointBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(UsagePointBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(UsagePointBase, self).exportLiteralChildren(outfile, level, name_) - if self.roleFlags is not None: - showIndent(outfile, level) - outfile.write('roleFlags=model_.RoleFlagsType(\n') - self.roleFlags.exportLiteral(outfile, level, name_='roleFlags') - showIndent(outfile, level) - outfile.write('),\n') - if self.serviceCategoryKind is not None: - showIndent(outfile, level) - outfile.write('serviceCategoryKind=model_.ServiceKind(\n') - self.serviceCategoryKind.exportLiteral(outfile, level, name_='serviceCategoryKind') - showIndent(outfile, level) - outfile.write('),\n') - if self.status is not None: - showIndent(outfile, level) - outfile.write('status=%d,\n' % self.status) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(UsagePointBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'roleFlags': - obj_ = RoleFlagsType.factory() - obj_.build(child_) - self.roleFlags = obj_ - obj_.original_tagname_ = 'roleFlags' - elif nodeName_ == 'serviceCategoryKind': - obj_ = ServiceKind.factory() - obj_.build(child_) - self.serviceCategoryKind = obj_ - obj_.original_tagname_ = 'serviceCategoryKind' - elif nodeName_ == 'status': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'status') - self.status = ival_ - self.validate_UInt8(self.status) # validate type UInt8 - super(UsagePointBase, self).buildChildren(child_, node, nodeName_, True) -# end class UsagePointBase - - -class ReadingSetBase(IdentifiedObject): - """A set of Readings of the ReadingType indicated by the parent - MeterReading. ReadingBase is abstract, used to define the - elements common to ReadingSet and IntervalBlock.""" - subclass = None - superclass = IdentifiedObject - def __init__(self, timePeriod=None): - self.original_tagname_ = None - super(ReadingSetBase, self).__init__() - self.timePeriod = timePeriod - def factory(*args_, **kwargs_): - if ReadingSetBase.subclass: - return ReadingSetBase.subclass(*args_, **kwargs_) - else: - return ReadingSetBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_timePeriod(self): return self.timePeriod - def set_timePeriod(self, timePeriod): self.timePeriod = timePeriod - def hasContent_(self): - if ( - self.timePeriod is not None or - super(ReadingSetBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingSetBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSetBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingSetBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingSetBase'): - super(ReadingSetBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSetBase') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingSetBase', fromsubclass_=False, pretty_print=True): - super(ReadingSetBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.timePeriod is not None: - self.timePeriod.export(outfile, level, namespace_, name_='timePeriod', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ReadingSetBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingSetBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingSetBase, self).exportLiteralChildren(outfile, level, name_) - if self.timePeriod is not None: - showIndent(outfile, level) - outfile.write('timePeriod=model_.DateTimeInterval(\n') - self.timePeriod.exportLiteral(outfile, level, name_='timePeriod') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingSetBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'timePeriod': - obj_ = DateTimeInterval.factory() - obj_.build(child_) - self.timePeriod = obj_ - obj_.original_tagname_ = 'timePeriod' - super(ReadingSetBase, self).buildChildren(child_, node, nodeName_, True) -# end class ReadingSetBase - - -class MirrorUsagePointList(List): - """A List of MirrorUsagePoint instances.""" - subclass = None - superclass = List - def __init__(self, MirrorUsagePoint=None): - self.original_tagname_ = None - super(MirrorUsagePointList, self).__init__() - if MirrorUsagePoint is None: - self.MirrorUsagePoint = [] - else: - self.MirrorUsagePoint = MirrorUsagePoint - def factory(*args_, **kwargs_): - if MirrorUsagePointList.subclass: - return MirrorUsagePointList.subclass(*args_, **kwargs_) - else: - return MirrorUsagePointList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_MirrorUsagePoint(self): return self.MirrorUsagePoint - def set_MirrorUsagePoint(self, MirrorUsagePoint): self.MirrorUsagePoint = MirrorUsagePoint - def add_MirrorUsagePoint(self, value): self.MirrorUsagePoint.append(value) - def insert_MirrorUsagePoint_at(self, index, value): self.MirrorUsagePoint.insert(index, value) - def replace_MirrorUsagePoint_at(self, index, value): self.MirrorUsagePoint[index] = value - def hasContent_(self): - if ( - self.MirrorUsagePoint or - super(MirrorUsagePointList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MirrorUsagePointList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorUsagePointList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MirrorUsagePointList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MirrorUsagePointList'): - super(MirrorUsagePointList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorUsagePointList') - def exportChildren(self, outfile, level, namespace_='', name_='MirrorUsagePointList', fromsubclass_=False, pretty_print=True): - super(MirrorUsagePointList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for MirrorUsagePoint_ in self.MirrorUsagePoint: - MirrorUsagePoint_.export(outfile, level, namespace_, name_='MirrorUsagePoint', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MirrorUsagePointList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MirrorUsagePointList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MirrorUsagePointList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('MirrorUsagePoint=[\n') - level += 1 - for MirrorUsagePoint_ in self.MirrorUsagePoint: - showIndent(outfile, level) - outfile.write('model_.MirrorUsagePoint(\n') - MirrorUsagePoint_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MirrorUsagePointList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'MirrorUsagePoint': - obj_ = MirrorUsagePoint.factory() - obj_.build(child_) - self.MirrorUsagePoint.append(obj_) - obj_.original_tagname_ = 'MirrorUsagePoint' - super(MirrorUsagePointList, self).buildChildren(child_, node, nodeName_, True) -# end class MirrorUsagePointList - - -class MirrorUsagePoint(UsagePointBase): - """A parallel to UsagePoint to support mirroring""" - subclass = None - superclass = UsagePointBase - def __init__(self, deviceLFDI=None, MirrorMeterReading=None): - self.original_tagname_ = None - super(MirrorUsagePoint, self).__init__() - self.deviceLFDI = deviceLFDI - if MirrorMeterReading is None: - self.MirrorMeterReading = [] - else: - self.MirrorMeterReading = MirrorMeterReading - def factory(*args_, **kwargs_): - if MirrorUsagePoint.subclass: - return MirrorUsagePoint.subclass(*args_, **kwargs_) - else: - return MirrorUsagePoint(*args_, **kwargs_) - factory = staticmethod(factory) - def get_deviceLFDI(self): return self.deviceLFDI - def set_deviceLFDI(self, deviceLFDI): self.deviceLFDI = deviceLFDI - def get_MirrorMeterReading(self): return self.MirrorMeterReading - def set_MirrorMeterReading(self, MirrorMeterReading): self.MirrorMeterReading = MirrorMeterReading - def add_MirrorMeterReading(self, value): self.MirrorMeterReading.append(value) - def insert_MirrorMeterReading_at(self, index, value): self.MirrorMeterReading.insert(index, value) - def replace_MirrorMeterReading_at(self, index, value): self.MirrorMeterReading[index] = value - def validate_HexBinary160(self, value): - # Validate type HexBinary160, a restriction on xs:hexBinary. - pass - def hasContent_(self): - if ( - self.deviceLFDI is not None or - self.MirrorMeterReading or - super(MirrorUsagePoint, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MirrorUsagePoint', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorUsagePoint') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MirrorUsagePoint', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MirrorUsagePoint'): - super(MirrorUsagePoint, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorUsagePoint') - def exportChildren(self, outfile, level, namespace_='', name_='MirrorUsagePoint', fromsubclass_=False, pretty_print=True): - super(MirrorUsagePoint, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.deviceLFDI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdeviceLFDI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.deviceLFDI).encode(ExternalEncoding), input_name='deviceLFDI'), namespace_, eol_)) - for MirrorMeterReading_ in self.MirrorMeterReading: - MirrorMeterReading_.export(outfile, level, namespace_, name_='MirrorMeterReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MirrorUsagePoint'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MirrorUsagePoint, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MirrorUsagePoint, self).exportLiteralChildren(outfile, level, name_) - if self.deviceLFDI is not None: - showIndent(outfile, level) - outfile.write('deviceLFDI=%s,\n' % quote_python(self.deviceLFDI).encode(ExternalEncoding)) - showIndent(outfile, level) - outfile.write('MirrorMeterReading=[\n') - level += 1 - for MirrorMeterReading_ in self.MirrorMeterReading: - showIndent(outfile, level) - outfile.write('model_.MirrorMeterReading(\n') - MirrorMeterReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MirrorUsagePoint, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'deviceLFDI': - deviceLFDI_ = child_.text - deviceLFDI_ = self.gds_validate_string(deviceLFDI_, node, 'deviceLFDI') - self.deviceLFDI = deviceLFDI_ - self.validate_HexBinary160(self.deviceLFDI) # validate type HexBinary160 - elif nodeName_ == 'MirrorMeterReading': - obj_ = MirrorMeterReading.factory() - obj_.build(child_) - self.MirrorMeterReading.append(obj_) - obj_.original_tagname_ = 'MirrorMeterReading' - super(MirrorUsagePoint, self).buildChildren(child_, node, nodeName_, True) -# end class MirrorUsagePoint - - -class MirrorReadingSet(ReadingSetBase): - """A set of Readings of the ReadingType indicated by the parent - MeterReading.""" - subclass = None - superclass = ReadingSetBase - def __init__(self, Reading=None): - self.original_tagname_ = None - super(MirrorReadingSet, self).__init__() - if Reading is None: - self.Reading = [] - else: - self.Reading = Reading - def factory(*args_, **kwargs_): - if MirrorReadingSet.subclass: - return MirrorReadingSet.subclass(*args_, **kwargs_) - else: - return MirrorReadingSet(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Reading(self): return self.Reading - def set_Reading(self, Reading): self.Reading = Reading - def add_Reading(self, value): self.Reading.append(value) - def insert_Reading_at(self, index, value): self.Reading.insert(index, value) - def replace_Reading_at(self, index, value): self.Reading[index] = value - def hasContent_(self): - if ( - self.Reading or - super(MirrorReadingSet, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MirrorReadingSet', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorReadingSet') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MirrorReadingSet', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MirrorReadingSet'): - super(MirrorReadingSet, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorReadingSet') - def exportChildren(self, outfile, level, namespace_='', name_='MirrorReadingSet', fromsubclass_=False, pretty_print=True): - super(MirrorReadingSet, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for Reading_ in self.Reading: - Reading_.export(outfile, level, namespace_, name_='Reading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MirrorReadingSet'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MirrorReadingSet, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MirrorReadingSet, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('Reading=[\n') - level += 1 - for Reading_ in self.Reading: - showIndent(outfile, level) - outfile.write('model_.Reading(\n') - Reading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MirrorReadingSet, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Reading': - obj_ = Reading.factory() - obj_.build(child_) - self.Reading.append(obj_) - obj_.original_tagname_ = 'Reading' - super(MirrorReadingSet, self).buildChildren(child_, node, nodeName_, True) -# end class MirrorReadingSet - - -class MeterReadingBase(IdentifiedObject): - """A container for associating ReadingType, Readings and ReadingSets.""" - subclass = None - superclass = IdentifiedObject - def __init__(self): - self.original_tagname_ = None - super(MeterReadingBase, self).__init__() - def factory(*args_, **kwargs_): - if MeterReadingBase.subclass: - return MeterReadingBase.subclass(*args_, **kwargs_) - else: - return MeterReadingBase(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(MeterReadingBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MeterReadingBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MeterReadingBase', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MeterReadingBase'): - super(MeterReadingBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReadingBase') - def exportChildren(self, outfile, level, namespace_='', name_='MeterReadingBase', fromsubclass_=False, pretty_print=True): - super(MeterReadingBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='MeterReadingBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MeterReadingBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MeterReadingBase, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MeterReadingBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(MeterReadingBase, self).buildChildren(child_, node, nodeName_, True) - pass -# end class MeterReadingBase - - -class MirrorMeterReadingList(List): - """A List of MirrorMeterReading instances.""" - subclass = None - superclass = List - def __init__(self, MirrorMeterReading=None): - self.original_tagname_ = None - super(MirrorMeterReadingList, self).__init__() - if MirrorMeterReading is None: - self.MirrorMeterReading = [] - else: - self.MirrorMeterReading = MirrorMeterReading - def factory(*args_, **kwargs_): - if MirrorMeterReadingList.subclass: - return MirrorMeterReadingList.subclass(*args_, **kwargs_) - else: - return MirrorMeterReadingList(*args_, **kwargs_) - factory = staticmethod(factory) - def get_MirrorMeterReading(self): return self.MirrorMeterReading - def set_MirrorMeterReading(self, MirrorMeterReading): self.MirrorMeterReading = MirrorMeterReading - def add_MirrorMeterReading(self, value): self.MirrorMeterReading.append(value) - def insert_MirrorMeterReading_at(self, index, value): self.MirrorMeterReading.insert(index, value) - def replace_MirrorMeterReading_at(self, index, value): self.MirrorMeterReading[index] = value - def hasContent_(self): - if ( - self.MirrorMeterReading or - super(MirrorMeterReadingList, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MirrorMeterReadingList', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorMeterReadingList') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MirrorMeterReadingList', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MirrorMeterReadingList'): - super(MirrorMeterReadingList, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorMeterReadingList') - def exportChildren(self, outfile, level, namespace_='', name_='MirrorMeterReadingList', fromsubclass_=False, pretty_print=True): - super(MirrorMeterReadingList, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - for MirrorMeterReading_ in self.MirrorMeterReading: - MirrorMeterReading_.export(outfile, level, namespace_, name_='MirrorMeterReading', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MirrorMeterReadingList'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MirrorMeterReadingList, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MirrorMeterReadingList, self).exportLiteralChildren(outfile, level, name_) - showIndent(outfile, level) - outfile.write('MirrorMeterReading=[\n') - level += 1 - for MirrorMeterReading_ in self.MirrorMeterReading: - showIndent(outfile, level) - outfile.write('model_.MirrorMeterReading(\n') - MirrorMeterReading_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MirrorMeterReadingList, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'MirrorMeterReading': - obj_ = MirrorMeterReading.factory() - obj_.build(child_) - self.MirrorMeterReading.append(obj_) - obj_.original_tagname_ = 'MirrorMeterReading' - super(MirrorMeterReadingList, self).buildChildren(child_, node, nodeName_, True) -# end class MirrorMeterReadingList - - -class MirrorMeterReading(MeterReadingBase): - """Mimic of MeterReading used for managing mirrors.""" - subclass = None - superclass = MeterReadingBase - def __init__(self, lastUpdateTime=None, MirrorReadingSet=None, nextUpdateTime=None, Reading=None, ReadingType=None): - self.original_tagname_ = None - super(MirrorMeterReading, self).__init__() - self.lastUpdateTime = lastUpdateTime - if MirrorReadingSet is None: - self.MirrorReadingSet = [] - else: - self.MirrorReadingSet = MirrorReadingSet - self.nextUpdateTime = nextUpdateTime - self.Reading = Reading - self.ReadingType = ReadingType - def factory(*args_, **kwargs_): - if MirrorMeterReading.subclass: - return MirrorMeterReading.subclass(*args_, **kwargs_) - else: - return MirrorMeterReading(*args_, **kwargs_) - factory = staticmethod(factory) - def get_lastUpdateTime(self): return self.lastUpdateTime - def set_lastUpdateTime(self, lastUpdateTime): self.lastUpdateTime = lastUpdateTime - def get_MirrorReadingSet(self): return self.MirrorReadingSet - def set_MirrorReadingSet(self, MirrorReadingSet): self.MirrorReadingSet = MirrorReadingSet - def add_MirrorReadingSet(self, value): self.MirrorReadingSet.append(value) - def insert_MirrorReadingSet_at(self, index, value): self.MirrorReadingSet.insert(index, value) - def replace_MirrorReadingSet_at(self, index, value): self.MirrorReadingSet[index] = value - def get_nextUpdateTime(self): return self.nextUpdateTime - def set_nextUpdateTime(self, nextUpdateTime): self.nextUpdateTime = nextUpdateTime - def get_Reading(self): return self.Reading - def set_Reading(self, Reading): self.Reading = Reading - def get_ReadingType(self): return self.ReadingType - def set_ReadingType(self, ReadingType): self.ReadingType = ReadingType - def hasContent_(self): - if ( - self.lastUpdateTime is not None or - self.MirrorReadingSet or - self.nextUpdateTime is not None or - self.Reading is not None or - self.ReadingType is not None or - super(MirrorMeterReading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MirrorMeterReading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorMeterReading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MirrorMeterReading', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MirrorMeterReading'): - super(MirrorMeterReading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MirrorMeterReading') - def exportChildren(self, outfile, level, namespace_='', name_='MirrorMeterReading', fromsubclass_=False, pretty_print=True): - super(MirrorMeterReading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.lastUpdateTime is not None: - self.lastUpdateTime.export(outfile, level, namespace_, name_='lastUpdateTime', pretty_print=pretty_print) - for MirrorReadingSet_ in self.MirrorReadingSet: - MirrorReadingSet_.export(outfile, level, namespace_, name_='MirrorReadingSet', pretty_print=pretty_print) - if self.nextUpdateTime is not None: - self.nextUpdateTime.export(outfile, level, namespace_, name_='nextUpdateTime', pretty_print=pretty_print) - if self.Reading is not None: - self.Reading.export(outfile, level, namespace_, name_='Reading', pretty_print=pretty_print) - if self.ReadingType is not None: - self.ReadingType.export(outfile, level, namespace_, name_='ReadingType', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MirrorMeterReading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MirrorMeterReading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MirrorMeterReading, self).exportLiteralChildren(outfile, level, name_) - if self.lastUpdateTime is not None: - showIndent(outfile, level) - outfile.write('lastUpdateTime=model_.TimeType(\n') - self.lastUpdateTime.exportLiteral(outfile, level, name_='lastUpdateTime') - showIndent(outfile, level) - outfile.write('),\n') - showIndent(outfile, level) - outfile.write('MirrorReadingSet=[\n') - level += 1 - for MirrorReadingSet_ in self.MirrorReadingSet: - showIndent(outfile, level) - outfile.write('model_.MirrorReadingSet(\n') - MirrorReadingSet_.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - level -= 1 - showIndent(outfile, level) - outfile.write('],\n') - if self.nextUpdateTime is not None: - showIndent(outfile, level) - outfile.write('nextUpdateTime=model_.TimeType(\n') - self.nextUpdateTime.exportLiteral(outfile, level, name_='nextUpdateTime') - showIndent(outfile, level) - outfile.write('),\n') - if self.Reading is not None: - showIndent(outfile, level) - outfile.write('Reading=model_.Reading(\n') - self.Reading.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ReadingType is not None: - showIndent(outfile, level) - outfile.write('ReadingType=model_.ReadingType(\n') - self.ReadingType.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MirrorMeterReading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'lastUpdateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.lastUpdateTime = obj_ - obj_.original_tagname_ = 'lastUpdateTime' - elif nodeName_ == 'MirrorReadingSet': - obj_ = MirrorReadingSet.factory() - obj_.build(child_) - self.MirrorReadingSet.append(obj_) - obj_.original_tagname_ = 'MirrorReadingSet' - elif nodeName_ == 'nextUpdateTime': - obj_ = TimeType.factory() - obj_.build(child_) - self.nextUpdateTime = obj_ - obj_.original_tagname_ = 'nextUpdateTime' - elif nodeName_ == 'Reading': - obj_ = Reading.factory() - obj_.build(child_) - self.Reading = obj_ - obj_.original_tagname_ = 'Reading' - elif nodeName_ == 'ReadingType': - obj_ = ReadingType.factory() - obj_.build(child_) - self.ReadingType = obj_ - obj_.original_tagname_ = 'ReadingType' - super(MirrorMeterReading, self).buildChildren(child_, node, nodeName_, True) -# end class MirrorMeterReading - - -class BillingReadingSet(ReadingSetBase): - """Time sequence of readings of the same reading type.""" - subclass = None - superclass = ReadingSetBase - def __init__(self, BillingReadingListLink=None): - self.original_tagname_ = None - super(BillingReadingSet, self).__init__() - self.BillingReadingListLink = BillingReadingListLink - def factory(*args_, **kwargs_): - if BillingReadingSet.subclass: - return BillingReadingSet.subclass(*args_, **kwargs_) - else: - return BillingReadingSet(*args_, **kwargs_) - factory = staticmethod(factory) - def get_BillingReadingListLink(self): return self.BillingReadingListLink - def set_BillingReadingListLink(self, BillingReadingListLink): self.BillingReadingListLink = BillingReadingListLink - def hasContent_(self): - if ( - self.BillingReadingListLink is not None or - super(BillingReadingSet, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingReadingSet', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingSet') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingReadingSet', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingReadingSet'): - super(BillingReadingSet, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingReadingSet') - def exportChildren(self, outfile, level, namespace_='', name_='BillingReadingSet', fromsubclass_=False, pretty_print=True): - super(BillingReadingSet, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.BillingReadingListLink is not None: - self.BillingReadingListLink.export(outfile, level, namespace_, name_='BillingReadingListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingReadingSet'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingReadingSet, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingReadingSet, self).exportLiteralChildren(outfile, level, name_) - if self.BillingReadingListLink is not None: - showIndent(outfile, level) - outfile.write('BillingReadingListLink=model_.BillingReadingListLink(\n') - self.BillingReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingReadingSet, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'BillingReadingListLink': - obj_ = BillingReadingListLink.factory() - obj_.build(child_) - self.BillingReadingListLink = obj_ - obj_.original_tagname_ = 'BillingReadingListLink' - super(BillingReadingSet, self).buildChildren(child_, node, nodeName_, True) -# end class BillingReadingSet - - -class BillingMeterReadingBase(MeterReadingBase): - """Contains historical, target, and projection readings of various - types, possibly associated with charges.""" - subclass = None - superclass = MeterReadingBase - def __init__(self, BillingReadingSetListLink=None, ReadingTypeLink=None): - self.original_tagname_ = None - super(BillingMeterReadingBase, self).__init__() - self.BillingReadingSetListLink = BillingReadingSetListLink - self.ReadingTypeLink = ReadingTypeLink - def factory(*args_, **kwargs_): - if BillingMeterReadingBase.subclass: - return BillingMeterReadingBase.subclass(*args_, **kwargs_) - else: - return BillingMeterReadingBase(*args_, **kwargs_) - factory = staticmethod(factory) - def get_BillingReadingSetListLink(self): return self.BillingReadingSetListLink - def set_BillingReadingSetListLink(self, BillingReadingSetListLink): self.BillingReadingSetListLink = BillingReadingSetListLink - def get_ReadingTypeLink(self): return self.ReadingTypeLink - def set_ReadingTypeLink(self, ReadingTypeLink): self.ReadingTypeLink = ReadingTypeLink - def hasContent_(self): - if ( - self.BillingReadingSetListLink is not None or - self.ReadingTypeLink is not None or - super(BillingMeterReadingBase, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='BillingMeterReadingBase', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='BillingMeterReadingBase') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='BillingMeterReadingBase', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BillingMeterReadingBase'): - super(BillingMeterReadingBase, self).exportAttributes(outfile, level, already_processed, namespace_, name_='BillingMeterReadingBase') - def exportChildren(self, outfile, level, namespace_='', name_='BillingMeterReadingBase', fromsubclass_=False, pretty_print=True): - super(BillingMeterReadingBase, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.BillingReadingSetListLink is not None: - self.BillingReadingSetListLink.export(outfile, level, namespace_, name_='BillingReadingSetListLink', pretty_print=pretty_print) - if self.ReadingTypeLink is not None: - self.ReadingTypeLink.export(outfile, level, namespace_, name_='ReadingTypeLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='BillingMeterReadingBase'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(BillingMeterReadingBase, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(BillingMeterReadingBase, self).exportLiteralChildren(outfile, level, name_) - if self.BillingReadingSetListLink is not None: - showIndent(outfile, level) - outfile.write('BillingReadingSetListLink=model_.BillingReadingSetListLink(\n') - self.BillingReadingSetListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ReadingTypeLink is not None: - showIndent(outfile, level) - outfile.write('ReadingTypeLink=model_.ReadingTypeLink(\n') - self.ReadingTypeLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(BillingMeterReadingBase, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'BillingReadingSetListLink': - obj_ = BillingReadingSetListLink.factory() - obj_.build(child_) - self.BillingReadingSetListLink = obj_ - obj_.original_tagname_ = 'BillingReadingSetListLink' - elif nodeName_ == 'ReadingTypeLink': - obj_ = ReadingTypeLink.factory() - obj_.build(child_) - self.ReadingTypeLink = obj_ - obj_.original_tagname_ = 'ReadingTypeLink' - super(BillingMeterReadingBase, self).buildChildren(child_, node, nodeName_, True) -# end class BillingMeterReadingBase - - -class UsagePoint(UsagePointBase): - """Logical point on a network at which consumption or production is - either physically measured (e.g. metered) or estimated (e.g. - unmetered street lights).""" - subclass = None - superclass = UsagePointBase - def __init__(self, MeterReadingListLink=None): - self.original_tagname_ = None - super(UsagePoint, self).__init__() - self.MeterReadingListLink = MeterReadingListLink - def factory(*args_, **kwargs_): - if UsagePoint.subclass: - return UsagePoint.subclass(*args_, **kwargs_) - else: - return UsagePoint(*args_, **kwargs_) - factory = staticmethod(factory) - def get_MeterReadingListLink(self): return self.MeterReadingListLink - def set_MeterReadingListLink(self, MeterReadingListLink): self.MeterReadingListLink = MeterReadingListLink - def hasContent_(self): - if ( - self.MeterReadingListLink is not None or - super(UsagePoint, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='UsagePoint', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePoint') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='UsagePoint', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UsagePoint'): - super(UsagePoint, self).exportAttributes(outfile, level, already_processed, namespace_, name_='UsagePoint') - def exportChildren(self, outfile, level, namespace_='', name_='UsagePoint', fromsubclass_=False, pretty_print=True): - super(UsagePoint, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.MeterReadingListLink is not None: - self.MeterReadingListLink.export(outfile, level, namespace_, name_='MeterReadingListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='UsagePoint'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(UsagePoint, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(UsagePoint, self).exportLiteralChildren(outfile, level, name_) - if self.MeterReadingListLink is not None: - showIndent(outfile, level) - outfile.write('MeterReadingListLink=model_.MeterReadingListLink(\n') - self.MeterReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(UsagePoint, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'MeterReadingListLink': - obj_ = MeterReadingListLink.factory() - obj_.build(child_) - self.MeterReadingListLink = obj_ - obj_.original_tagname_ = 'MeterReadingListLink' - super(UsagePoint, self).buildChildren(child_, node, nodeName_, True) -# end class UsagePoint - - -class ReadingSet(ReadingSetBase): - """A set of Readings of the ReadingType indicated by the parent - MeterReading.""" - subclass = None - superclass = ReadingSetBase - def __init__(self, ReadingListLink=None): - self.original_tagname_ = None - super(ReadingSet, self).__init__() - self.ReadingListLink = ReadingListLink - def factory(*args_, **kwargs_): - if ReadingSet.subclass: - return ReadingSet.subclass(*args_, **kwargs_) - else: - return ReadingSet(*args_, **kwargs_) - factory = staticmethod(factory) - def get_ReadingListLink(self): return self.ReadingListLink - def set_ReadingListLink(self, ReadingListLink): self.ReadingListLink = ReadingListLink - def hasContent_(self): - if ( - self.ReadingListLink is not None or - super(ReadingSet, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ReadingSet', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSet') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ReadingSet', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ReadingSet'): - super(ReadingSet, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ReadingSet') - def exportChildren(self, outfile, level, namespace_='', name_='ReadingSet', fromsubclass_=False, pretty_print=True): - super(ReadingSet, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.ReadingListLink is not None: - self.ReadingListLink.export(outfile, level, namespace_, name_='ReadingListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='ReadingSet'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ReadingSet, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ReadingSet, self).exportLiteralChildren(outfile, level, name_) - if self.ReadingListLink is not None: - showIndent(outfile, level) - outfile.write('ReadingListLink=model_.ReadingListLink(\n') - self.ReadingListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ReadingSet, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'ReadingListLink': - obj_ = ReadingListLink.factory() - obj_.build(child_) - self.ReadingListLink = obj_ - obj_.original_tagname_ = 'ReadingListLink' - super(ReadingSet, self).buildChildren(child_, node, nodeName_, True) -# end class ReadingSet - - -class MeterReading(MeterReadingBase): - """Set of values obtained from the meter.""" - subclass = None - superclass = MeterReadingBase - def __init__(self, RateComponentListLink=None, ReadingLink=None, ReadingSetListLink=None, ReadingTypeLink=None): - self.original_tagname_ = None - super(MeterReading, self).__init__() - self.RateComponentListLink = RateComponentListLink - self.ReadingLink = ReadingLink - self.ReadingSetListLink = ReadingSetListLink - self.ReadingTypeLink = ReadingTypeLink - def factory(*args_, **kwargs_): - if MeterReading.subclass: - return MeterReading.subclass(*args_, **kwargs_) - else: - return MeterReading(*args_, **kwargs_) - factory = staticmethod(factory) - def get_RateComponentListLink(self): return self.RateComponentListLink - def set_RateComponentListLink(self, RateComponentListLink): self.RateComponentListLink = RateComponentListLink - def get_ReadingLink(self): return self.ReadingLink - def set_ReadingLink(self, ReadingLink): self.ReadingLink = ReadingLink - def get_ReadingSetListLink(self): return self.ReadingSetListLink - def set_ReadingSetListLink(self, ReadingSetListLink): self.ReadingSetListLink = ReadingSetListLink - def get_ReadingTypeLink(self): return self.ReadingTypeLink - def set_ReadingTypeLink(self, ReadingTypeLink): self.ReadingTypeLink = ReadingTypeLink - def hasContent_(self): - if ( - self.RateComponentListLink is not None or - self.ReadingLink is not None or - self.ReadingSetListLink is not None or - self.ReadingTypeLink is not None or - super(MeterReading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='MeterReading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='MeterReading', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MeterReading'): - super(MeterReading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='MeterReading') - def exportChildren(self, outfile, level, namespace_='', name_='MeterReading', fromsubclass_=False, pretty_print=True): - super(MeterReading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.RateComponentListLink is not None: - self.RateComponentListLink.export(outfile, level, namespace_, name_='RateComponentListLink', pretty_print=pretty_print) - if self.ReadingLink is not None: - self.ReadingLink.export(outfile, level, namespace_, name_='ReadingLink', pretty_print=pretty_print) - if self.ReadingSetListLink is not None: - self.ReadingSetListLink.export(outfile, level, namespace_, name_='ReadingSetListLink', pretty_print=pretty_print) - if self.ReadingTypeLink is not None: - self.ReadingTypeLink.export(outfile, level, namespace_, name_='ReadingTypeLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='MeterReading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(MeterReading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(MeterReading, self).exportLiteralChildren(outfile, level, name_) - if self.RateComponentListLink is not None: - showIndent(outfile, level) - outfile.write('RateComponentListLink=model_.RateComponentListLink(\n') - self.RateComponentListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ReadingLink is not None: - showIndent(outfile, level) - outfile.write('ReadingLink=model_.ReadingLink(\n') - self.ReadingLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ReadingSetListLink is not None: - showIndent(outfile, level) - outfile.write('ReadingSetListLink=model_.ReadingSetListLink(\n') - self.ReadingSetListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.ReadingTypeLink is not None: - showIndent(outfile, level) - outfile.write('ReadingTypeLink=model_.ReadingTypeLink(\n') - self.ReadingTypeLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(MeterReading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'RateComponentListLink': - obj_ = RateComponentListLink.factory() - obj_.build(child_) - self.RateComponentListLink = obj_ - obj_.original_tagname_ = 'RateComponentListLink' - elif nodeName_ == 'ReadingLink': - obj_ = ReadingLink.factory() - obj_.build(child_) - self.ReadingLink = obj_ - obj_.original_tagname_ = 'ReadingLink' - elif nodeName_ == 'ReadingSetListLink': - obj_ = ReadingSetListLink.factory() - obj_.build(child_) - self.ReadingSetListLink = obj_ - obj_.original_tagname_ = 'ReadingSetListLink' - elif nodeName_ == 'ReadingTypeLink': - obj_ = ReadingTypeLink.factory() - obj_.build(child_) - self.ReadingTypeLink = obj_ - obj_.original_tagname_ = 'ReadingTypeLink' - super(MeterReading, self).buildChildren(child_, node, nodeName_, True) -# end class MeterReading - - -class TextResponse(Response): - """A response to a text message""" - subclass = None - superclass = Response - def __init__(self): - self.original_tagname_ = None - super(TextResponse, self).__init__() - def factory(*args_, **kwargs_): - if TextResponse.subclass: - return TextResponse.subclass(*args_, **kwargs_) - else: - return TextResponse(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TextResponse, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TextResponse', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TextResponse') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TextResponse', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TextResponse'): - super(TextResponse, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TextResponse') - def exportChildren(self, outfile, level, namespace_='', name_='TextResponse', fromsubclass_=False, pretty_print=True): - super(TextResponse, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TextResponse'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TextResponse, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TextResponse, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TextResponse, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TextResponse, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TextResponse - - -class Notification(SubscriptionBase): - """Holds the information related to a client subscription to receive - updates to a resource automatically. The actual resources may be - passed in the Notification by specifying a specific xsi:type for - the Resource and passing the full representation.""" - subclass = None - superclass = SubscriptionBase - def __init__(self, newResourceURI=None, Resource=None, status=None, subscriptionURI=None): - self.original_tagname_ = None - super(Notification, self).__init__() - self.newResourceURI = newResourceURI - self.Resource = Resource - self.status = status - self.subscriptionURI = subscriptionURI - def factory(*args_, **kwargs_): - if Notification.subclass: - return Notification.subclass(*args_, **kwargs_) - else: - return Notification(*args_, **kwargs_) - factory = staticmethod(factory) - def get_newResourceURI(self): return self.newResourceURI - def set_newResourceURI(self, newResourceURI): self.newResourceURI = newResourceURI - def get_Resource(self): return self.Resource - def set_Resource(self, Resource): self.Resource = Resource - def get_status(self): return self.status - def set_status(self, status): self.status = status - def get_subscriptionURI(self): return self.subscriptionURI - def set_subscriptionURI(self, subscriptionURI): self.subscriptionURI = subscriptionURI - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def hasContent_(self): - if ( - self.newResourceURI is not None or - self.Resource is not None or - self.status is not None or - self.subscriptionURI is not None or - super(Notification, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Notification', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Notification') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Notification', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Notification'): - super(Notification, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Notification') - def exportChildren(self, outfile, level, namespace_='', name_='Notification', fromsubclass_=False, pretty_print=True): - super(Notification, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.newResourceURI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snewResourceURI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.newResourceURI).encode(ExternalEncoding), input_name='newResourceURI'), namespace_, eol_)) - if self.Resource is not None: - self.Resource.export(outfile, level, namespace_, name_='Resource', pretty_print=pretty_print) - if self.status is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sstatus>%s%s' % (namespace_, self.gds_format_integer(self.status, input_name='status'), namespace_, eol_)) - if self.subscriptionURI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%ssubscriptionURI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.subscriptionURI).encode(ExternalEncoding), input_name='subscriptionURI'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Notification'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Notification, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Notification, self).exportLiteralChildren(outfile, level, name_) - if self.newResourceURI is not None: - showIndent(outfile, level) - outfile.write('newResourceURI=%s,\n' % quote_python(self.newResourceURI).encode(ExternalEncoding)) - if self.Resource is not None: - showIndent(outfile, level) - outfile.write('Resource=model_.Resource(\n') - self.Resource.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.status is not None: - showIndent(outfile, level) - outfile.write('status=%d,\n' % self.status) - if self.subscriptionURI is not None: - showIndent(outfile, level) - outfile.write('subscriptionURI=%s,\n' % quote_python(self.subscriptionURI).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Notification, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'newResourceURI': - newResourceURI_ = child_.text - newResourceURI_ = self.gds_validate_string(newResourceURI_, node, 'newResourceURI') - self.newResourceURI = newResourceURI_ - elif nodeName_ == 'Resource': - class_obj_ = self.get_class_obj_(child_, Resource) - obj_ = class_obj_.factory() - obj_.build(child_) - self.Resource = obj_ - obj_.original_tagname_ = 'Resource' - elif nodeName_ == 'status': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'status') - self.status = ival_ - self.validate_UInt8(self.status) # validate type UInt8 - elif nodeName_ == 'subscriptionURI': - subscriptionURI_ = child_.text - subscriptionURI_ = self.gds_validate_string(subscriptionURI_, node, 'subscriptionURI') - self.subscriptionURI = subscriptionURI_ - super(Notification, self).buildChildren(child_, node, nodeName_, True) -# end class Notification - - -class Subscription(SubscriptionBase): - """Holds the information related to a client subscription to receive - updates to a resource automatically.""" - subclass = None - superclass = SubscriptionBase - def __init__(self, Condition=None, encoding=None, level=None, limit=None, notificationURI=None): - self.original_tagname_ = None - super(Subscription, self).__init__() - self.Condition = Condition - self.encoding = encoding - self.level = level - self.limit = limit - self.notificationURI = notificationURI - def factory(*args_, **kwargs_): - if Subscription.subclass: - return Subscription.subclass(*args_, **kwargs_) - else: - return Subscription(*args_, **kwargs_) - factory = staticmethod(factory) - def get_Condition(self): return self.Condition - def set_Condition(self, Condition): self.Condition = Condition - def get_encoding(self): return self.encoding - def set_encoding(self, encoding): self.encoding = encoding - def get_level(self): return self.level - def set_level(self, level): self.level = level - def get_limit(self): return self.limit - def set_limit(self, limit): self.limit = limit - def get_notificationURI(self): return self.notificationURI - def set_notificationURI(self, notificationURI): self.notificationURI = notificationURI - def validate_UInt8(self, value): - # Validate type UInt8, a restriction on xs:unsignedByte. - pass - def validate_String16(self, value): - # Validate type String16, a restriction on xs:string. - pass - def validate_UInt16(self, value): - # Validate type UInt16, a restriction on xs:unsignedShort. - pass - def hasContent_(self): - if ( - self.Condition is not None or - self.encoding is not None or - self.level is not None or - self.limit is not None or - self.notificationURI is not None or - super(Subscription, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='Subscription', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='Subscription') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='Subscription', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Subscription'): - super(Subscription, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Subscription') - def exportChildren(self, outfile, level, namespace_='', name_='Subscription', fromsubclass_=False, pretty_print=True): - super(Subscription, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.Condition is not None: - self.Condition.export(outfile, level, namespace_, name_='Condition', pretty_print=pretty_print) - if self.encoding is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sencoding>%s%s' % (namespace_, self.gds_format_integer(self.encoding, input_name='encoding'), namespace_, eol_)) - if self.level is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slevel>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.level).encode(ExternalEncoding), input_name='level'), namespace_, eol_)) - if self.limit is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%slimit>%s%s' % (namespace_, self.gds_format_integer(self.limit, input_name='limit'), namespace_, eol_)) - if self.notificationURI is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%snotificationURI>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.notificationURI).encode(ExternalEncoding), input_name='notificationURI'), namespace_, eol_)) - def exportLiteral(self, outfile, level, name_='Subscription'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(Subscription, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(Subscription, self).exportLiteralChildren(outfile, level, name_) - if self.Condition is not None: - showIndent(outfile, level) - outfile.write('Condition=model_.Condition(\n') - self.Condition.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.encoding is not None: - showIndent(outfile, level) - outfile.write('encoding=%d,\n' % self.encoding) - if self.level is not None: - showIndent(outfile, level) - outfile.write('level=%s,\n' % quote_python(self.level).encode(ExternalEncoding)) - if self.limit is not None: - showIndent(outfile, level) - outfile.write('limit=%d,\n' % self.limit) - if self.notificationURI is not None: - showIndent(outfile, level) - outfile.write('notificationURI=%s,\n' % quote_python(self.notificationURI).encode(ExternalEncoding)) - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(Subscription, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'Condition': - obj_ = Condition.factory() - obj_.build(child_) - self.Condition = obj_ - obj_.original_tagname_ = 'Condition' - elif nodeName_ == 'encoding': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'encoding') - self.encoding = ival_ - self.validate_UInt8(self.encoding) # validate type UInt8 - elif nodeName_ == 'level': - level_ = child_.text - level_ = self.gds_validate_string(level_, node, 'level') - self.level = level_ - self.validate_String16(self.level) # validate type String16 - elif nodeName_ == 'limit': - sval_ = child_.text - try: - ival_ = int(sval_) - except (TypeError, ValueError) as exp: - raise_parse_error(child_, 'requires integer: %s' % exp) - ival_ = self.gds_validate_integer(ival_, node, 'limit') - self.limit = ival_ - self.validate_UInt16(self.limit) # validate type UInt16 - elif nodeName_ == 'notificationURI': - notificationURI_ = child_.text - notificationURI_ = self.gds_validate_string(notificationURI_, node, 'notificationURI') - self.notificationURI = notificationURI_ - super(Subscription, self).buildChildren(child_, node, nodeName_, True) -# end class Subscription - - -class FunctionSetAssignments(FunctionSetAssignmentsBase): - """Provides an identifiable, subscribable collection of resources for a - particular device to consume.Indicates whether or not - subscriptions are supported for this resource, and whether or - not conditional (thresholds) are supported. If not specified, is - "not subscribable" (0).""" - subclass = None - superclass = FunctionSetAssignmentsBase - def __init__(self, subscribable='0', mRID=None, description=None, version=None): - self.original_tagname_ = None - super(FunctionSetAssignments, self).__init__() - self.subscribable = _cast(None, subscribable) - self.mRID = mRID - self.description = description - self.version = version - def factory(*args_, **kwargs_): - if FunctionSetAssignments.subclass: - return FunctionSetAssignments.subclass(*args_, **kwargs_) - else: - return FunctionSetAssignments(*args_, **kwargs_) - factory = staticmethod(factory) - def get_mRID(self): return self.mRID - def set_mRID(self, mRID): self.mRID = mRID - def get_description(self): return self.description - def set_description(self, description): self.description = description - def get_version(self): return self.version - def set_version(self, version): self.version = version - def get_subscribable(self): return self.subscribable - def set_subscribable(self, subscribable): self.subscribable = subscribable - def validate_String32(self, value): - # Validate type String32, a restriction on xs:string. - pass - def validate_SubscribableType(self, value): - # Validate type SubscribableType, a restriction on UInt8. - pass - def hasContent_(self): - if ( - self.mRID is not None or - self.description is not None or - self.version is not None or - super(FunctionSetAssignments, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='FunctionSetAssignments', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignments') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='FunctionSetAssignments', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='FunctionSetAssignments'): - super(FunctionSetAssignments, self).exportAttributes(outfile, level, already_processed, namespace_, name_='FunctionSetAssignments') - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - outfile.write(' subscribable=%s' % (quote_attrib(self.subscribable), )) - def exportChildren(self, outfile, level, namespace_='', name_='FunctionSetAssignments', fromsubclass_=False, pretty_print=True): - super(FunctionSetAssignments, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.mRID is not None: - self.mRID.export(outfile, level, namespace_, name_='mRID', pretty_print=pretty_print) - if self.description is not None: - showIndent(outfile, level, pretty_print) - outfile.write('<%sdescription>%s%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_)) - if self.version is not None: - self.version.export(outfile, level, namespace_, name_='version', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='FunctionSetAssignments'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - if self.subscribable is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - showIndent(outfile, level) - outfile.write('subscribable=%d,\n' % (self.subscribable,)) - super(FunctionSetAssignments, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(FunctionSetAssignments, self).exportLiteralChildren(outfile, level, name_) - if self.mRID is not None: - showIndent(outfile, level) - outfile.write('mRID=model_.mRIDType(\n') - self.mRID.exportLiteral(outfile, level, name_='mRID') - showIndent(outfile, level) - outfile.write('),\n') - if self.description is not None: - showIndent(outfile, level) - outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding)) - if self.version is not None: - showIndent(outfile, level) - outfile.write('version=model_.VersionType(\n') - self.version.exportLiteral(outfile, level, name_='version') - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - value = find_attr_value_('subscribable', node) - if value is not None and 'subscribable' not in already_processed: - already_processed.add('subscribable') - self.subscribable = value - self.validate_SubscribableType(self.subscribable) # validate type SubscribableType - super(FunctionSetAssignments, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'mRID': - obj_ = mRIDType.factory() - obj_.build(child_) - self.mRID = obj_ - obj_.original_tagname_ = 'mRID' - elif nodeName_ == 'description': - description_ = child_.text - description_ = self.gds_validate_string(description_, node, 'description') - self.description = description_ - self.validate_String32(self.description) # validate type String32 - elif nodeName_ == 'version': - obj_ = VersionType.factory() - obj_.build(child_) - self.version = obj_ - obj_.original_tagname_ = 'version' - super(FunctionSetAssignments, self).buildChildren(child_, node, nodeName_, True) -# end class FunctionSetAssignments - - -class SelfDevice(AbstractDevice): - """The EndDevice providing the resources available within the - DeviceCapabilities.""" - subclass = None - superclass = AbstractDevice - def __init__(self): - self.original_tagname_ = None - super(SelfDevice, self).__init__() - def factory(*args_, **kwargs_): - if SelfDevice.subclass: - return SelfDevice.subclass(*args_, **kwargs_) - else: - return SelfDevice(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(SelfDevice, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='SelfDevice', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='SelfDevice') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='SelfDevice', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SelfDevice'): - super(SelfDevice, self).exportAttributes(outfile, level, already_processed, namespace_, name_='SelfDevice') - def exportChildren(self, outfile, level, namespace_='', name_='SelfDevice', fromsubclass_=False, pretty_print=True): - super(SelfDevice, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='SelfDevice'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(SelfDevice, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(SelfDevice, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(SelfDevice, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(SelfDevice, self).buildChildren(child_, node, nodeName_, True) - pass -# end class SelfDevice - - -class EndDevice(AbstractDevice): - """Asset container that performs one or more end device functions. - Contains information about individual devices in the network.""" - subclass = None - superclass = AbstractDevice - def __init__(self, FlowReservationRequestListLink=None, FlowReservationResponseListLink=None, FunctionSetAssignmentsListLink=None, RegistrationLink=None, SubscriptionListLink=None): - self.original_tagname_ = None - super(EndDevice, self).__init__() - self.FlowReservationRequestListLink = FlowReservationRequestListLink - self.FlowReservationResponseListLink = FlowReservationResponseListLink - self.FunctionSetAssignmentsListLink = FunctionSetAssignmentsListLink - self.RegistrationLink = RegistrationLink - self.SubscriptionListLink = SubscriptionListLink - def factory(*args_, **kwargs_): - if EndDevice.subclass: - return EndDevice.subclass(*args_, **kwargs_) - else: - return EndDevice(*args_, **kwargs_) - factory = staticmethod(factory) - def get_FlowReservationRequestListLink(self): return self.FlowReservationRequestListLink - def set_FlowReservationRequestListLink(self, FlowReservationRequestListLink): self.FlowReservationRequestListLink = FlowReservationRequestListLink - def get_FlowReservationResponseListLink(self): return self.FlowReservationResponseListLink - def set_FlowReservationResponseListLink(self, FlowReservationResponseListLink): self.FlowReservationResponseListLink = FlowReservationResponseListLink - def get_FunctionSetAssignmentsListLink(self): return self.FunctionSetAssignmentsListLink - def set_FunctionSetAssignmentsListLink(self, FunctionSetAssignmentsListLink): self.FunctionSetAssignmentsListLink = FunctionSetAssignmentsListLink - def get_RegistrationLink(self): return self.RegistrationLink - def set_RegistrationLink(self, RegistrationLink): self.RegistrationLink = RegistrationLink - def get_SubscriptionListLink(self): return self.SubscriptionListLink - def set_SubscriptionListLink(self, SubscriptionListLink): self.SubscriptionListLink = SubscriptionListLink - def hasContent_(self): - if ( - self.FlowReservationRequestListLink is not None or - self.FlowReservationResponseListLink is not None or - self.FunctionSetAssignmentsListLink is not None or - self.RegistrationLink is not None or - self.SubscriptionListLink is not None or - super(EndDevice, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='EndDevice', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='EndDevice') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='EndDevice', pretty_print=pretty_print) - showIndent(outfile, level, pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='EndDevice'): - super(EndDevice, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EndDevice') - def exportChildren(self, outfile, level, namespace_='', name_='EndDevice', fromsubclass_=False, pretty_print=True): - super(EndDevice, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.FlowReservationRequestListLink is not None: - self.FlowReservationRequestListLink.export(outfile, level, namespace_, name_='FlowReservationRequestListLink', pretty_print=pretty_print) - if self.FlowReservationResponseListLink is not None: - self.FlowReservationResponseListLink.export(outfile, level, namespace_, name_='FlowReservationResponseListLink', pretty_print=pretty_print) - if self.FunctionSetAssignmentsListLink is not None: - self.FunctionSetAssignmentsListLink.export(outfile, level, namespace_, name_='FunctionSetAssignmentsListLink', pretty_print=pretty_print) - if self.RegistrationLink is not None: - self.RegistrationLink.export(outfile, level, namespace_, name_='RegistrationLink', pretty_print=pretty_print) - if self.SubscriptionListLink is not None: - self.SubscriptionListLink.export(outfile, level, namespace_, name_='SubscriptionListLink', pretty_print=pretty_print) - def exportLiteral(self, outfile, level, name_='EndDevice'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(EndDevice, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(EndDevice, self).exportLiteralChildren(outfile, level, name_) - if self.FlowReservationRequestListLink is not None: - showIndent(outfile, level) - outfile.write('FlowReservationRequestListLink=model_.FlowReservationRequestListLink(\n') - self.FlowReservationRequestListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.FlowReservationResponseListLink is not None: - showIndent(outfile, level) - outfile.write('FlowReservationResponseListLink=model_.FlowReservationResponseListLink(\n') - self.FlowReservationResponseListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.FunctionSetAssignmentsListLink is not None: - showIndent(outfile, level) - outfile.write('FunctionSetAssignmentsListLink=model_.FunctionSetAssignmentsListLink(\n') - self.FunctionSetAssignmentsListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.RegistrationLink is not None: - showIndent(outfile, level) - outfile.write('RegistrationLink=model_.RegistrationLink(\n') - self.RegistrationLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - if self.SubscriptionListLink is not None: - showIndent(outfile, level) - outfile.write('SubscriptionListLink=model_.SubscriptionListLink(\n') - self.SubscriptionListLink.exportLiteral(outfile, level) - showIndent(outfile, level) - outfile.write('),\n') - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(EndDevice, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - if nodeName_ == 'FlowReservationRequestListLink': - obj_ = FlowReservationRequestListLink.factory() - obj_.build(child_) - self.FlowReservationRequestListLink = obj_ - obj_.original_tagname_ = 'FlowReservationRequestListLink' - elif nodeName_ == 'FlowReservationResponseListLink': - obj_ = FlowReservationResponseListLink.factory() - obj_.build(child_) - self.FlowReservationResponseListLink = obj_ - obj_.original_tagname_ = 'FlowReservationResponseListLink' - elif nodeName_ == 'FunctionSetAssignmentsListLink': - obj_ = FunctionSetAssignmentsListLink.factory() - obj_.build(child_) - self.FunctionSetAssignmentsListLink = obj_ - obj_.original_tagname_ = 'FunctionSetAssignmentsListLink' - elif nodeName_ == 'RegistrationLink': - obj_ = RegistrationLink.factory() - obj_.build(child_) - self.RegistrationLink = obj_ - obj_.original_tagname_ = 'RegistrationLink' - elif nodeName_ == 'SubscriptionListLink': - obj_ = SubscriptionListLink.factory() - obj_.build(child_) - self.SubscriptionListLink = obj_ - obj_.original_tagname_ = 'SubscriptionListLink' - super(EndDevice, self).buildChildren(child_, node, nodeName_, True) -# end class EndDevice - - -class TargetReading(BillingMeterReadingBase): - """Contains readings that specify a target or goal, such as a - consumption target, to which billing incentives or other - contractual ramifications may be associated.""" - subclass = None - superclass = BillingMeterReadingBase - def __init__(self): - self.original_tagname_ = None - super(TargetReading, self).__init__() - def factory(*args_, **kwargs_): - if TargetReading.subclass: - return TargetReading.subclass(*args_, **kwargs_) - else: - return TargetReading(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(TargetReading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='TargetReading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='TargetReading', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='TargetReading'): - super(TargetReading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TargetReading') - def exportChildren(self, outfile, level, namespace_='', name_='TargetReading', fromsubclass_=False, pretty_print=True): - super(TargetReading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='TargetReading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(TargetReading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(TargetReading, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(TargetReading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(TargetReading, self).buildChildren(child_, node, nodeName_, True) - pass -# end class TargetReading - - -class ProjectionReading(BillingMeterReadingBase): - """Contains values that forecast a future reading for the time or - interval specified.""" - subclass = None - superclass = BillingMeterReadingBase - def __init__(self): - self.original_tagname_ = None - super(ProjectionReading, self).__init__() - def factory(*args_, **kwargs_): - if ProjectionReading.subclass: - return ProjectionReading.subclass(*args_, **kwargs_) - else: - return ProjectionReading(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(ProjectionReading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='ProjectionReading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='ProjectionReading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='ProjectionReading', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ProjectionReading'): - super(ProjectionReading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ProjectionReading') - def exportChildren(self, outfile, level, namespace_='', name_='ProjectionReading', fromsubclass_=False, pretty_print=True): - super(ProjectionReading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='ProjectionReading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(ProjectionReading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(ProjectionReading, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(ProjectionReading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(ProjectionReading, self).buildChildren(child_, node, nodeName_, True) - pass -# end class ProjectionReading - - -class HistoricalReading(BillingMeterReadingBase): - """To be used to present readings that have been processed and possibly - corrected (as allowed, due to missing or incorrect data) by - backend systems. This includes quality codes valid, verified, - estimated, and derived / corrected.""" - subclass = None - superclass = BillingMeterReadingBase - def __init__(self): - self.original_tagname_ = None - super(HistoricalReading, self).__init__() - def factory(*args_, **kwargs_): - if HistoricalReading.subclass: - return HistoricalReading.subclass(*args_, **kwargs_) - else: - return HistoricalReading(*args_, **kwargs_) - factory = staticmethod(factory) - def hasContent_(self): - if ( - super(HistoricalReading, self).hasContent_() - ): - return True - else: - return False - def export(self, outfile, level, namespace_='', name_='HistoricalReading', namespacedef_='', pretty_print=True): - if pretty_print: - eol_ = '\n' - else: - eol_ = '' - if self.original_tagname_ is not None: - name_ = self.original_tagname_ - showIndent(outfile, level, pretty_print) - outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) - already_processed = set() - self.exportAttributes(outfile, level, already_processed, namespace_, name_='HistoricalReading') - if self.hasContent_(): - outfile.write('>%s' % (eol_, )) - self.exportChildren(outfile, level + 1, namespace_='', name_='HistoricalReading', pretty_print=pretty_print) - outfile.write('%s' % (namespace_, name_, eol_)) - else: - outfile.write('/>%s' % (eol_, )) - def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='HistoricalReading'): - super(HistoricalReading, self).exportAttributes(outfile, level, already_processed, namespace_, name_='HistoricalReading') - def exportChildren(self, outfile, level, namespace_='', name_='HistoricalReading', fromsubclass_=False, pretty_print=True): - super(HistoricalReading, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print) - pass - def exportLiteral(self, outfile, level, name_='HistoricalReading'): - level += 1 - already_processed = set() - self.exportLiteralAttributes(outfile, level, already_processed, name_) - if self.hasContent_(): - self.exportLiteralChildren(outfile, level, name_) - def exportLiteralAttributes(self, outfile, level, already_processed, name_): - super(HistoricalReading, self).exportLiteralAttributes(outfile, level, already_processed, name_) - def exportLiteralChildren(self, outfile, level, name_): - super(HistoricalReading, self).exportLiteralChildren(outfile, level, name_) - pass - def build(self, node): - already_processed = set() - self.buildAttributes(node, node.attrib, already_processed) - for child in node: - nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] - self.buildChildren(child, node, nodeName_) - return self - def buildAttributes(self, node, attrs, already_processed): - super(HistoricalReading, self).buildAttributes(node, attrs, already_processed) - def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): - super(HistoricalReading, self).buildChildren(child_, node, nodeName_, True) - pass -# end class HistoricalReading - - -GDSClassesMapping = { - 'energyRequested': SignedRealEnergy, - 'rtgA': CurrentRMS, - 'setVRefOfs': VoltageRMS, - 'availableCredit': AccountingUnit, - 'secondaryPower': PowerSourceType, - 'rtgW': ActivePower, - 'primaryPower': PowerSourceType, - 'creditStatus': CreditStatusType, - 'opModVoltWatt': DERCurveLink, - 'pricePowerOfTenMultiplier': PowerOfTenMultiplierType, - 'opModVoltVAr': DERCurveLink, - 'maxForwardPower': ActivePower, - 'localControlModeStatus': LocalControlModeStatusType, - 'dstStartRule': DstRuleType, - 'xMultiplier': PowerOfTenMultiplierType, - 'lowEmergencyCreditWarningLevel': AccountingUnit, - 'sheddablePercent': PerCent, - 'flowRateEndLimit': UnitValueType, - 'accumulationBehaviour': AccumulationBehaviourType, - 'yMultiplier': PowerOfTenMultiplierType, - 'uom': UomType, - 'touTier': TOUType, - 'refType': DERUnitRefType, - 'activateTime': TimeType, - 'opModFixedW': PerCent, - 'lowerLimit': DERCurveLink, - 'rtgMinPF': UnsignedFixedPointType, - 'setMinPFNeg': FixedPointType, - 'swActTime': TimeType, - 'reservePercent': PerCent, - 'flowDirection': FlowDirectionType, - 'setMaxDischargeRate': ActivePower, - 'costKind': CostKindType, - 'serviceStatus': ServiceStatusType, - 'rtgVArNeg': ReactivePower, - 'timeChargingStatusPEV': TimeType, - 'curveType': DERCurveType, - 'monetaryUnit': CurrencyCode, - 'energyRequestNow': RealEnergy, - 'estimatedChargeRemaining': PerCent, - 'dateTime': TimeType, - 'genConnectStatus': ConnectStatusType, - 'prepayMode': PrepayModeType, - 'timeChargeIsNeeded': TimeType, - 'upperLimit': DERCurveLink, - 'powerOfTenMultiplier': PowerOfTenMultiplierType, - 'lastUpdateTime': TimeType, - 'locale': LocaleType, - 'serviceCategoryKind': ServiceKind, - 'opModHVRT': CurvePairType, - 'serviceChange': ServiceChange, - 'value': PerCent, - 'logEventPEN': PENType, - 'timePeriod': DateTimeInterval, - 'subject': mRIDType, - 'sFDI': SFDIType, - 'flowRateStartLimit': UnitValueType, - 'chargingPowerNow': ActivePower, - 'version': VersionType, - 'mfID': PENType, - 'creditExpiryLevel': AccountingUnit, - 'setMaxVArNeg': ReactivePower, - 'multiplier': PowerOfTenMultiplierType, - 'randomizeStart': OneHourRangeType, - 'setMinPF': UnsignedFixedPointType, - 'rtgMaxChargeRate': ActivePower, - 'availabilityUpdatePercentChangeThreshold': PerCent, - 'dstEndTime': TimeType, - 'deviceCategory': DeviceCategoryType, - 'dateTimeRegistered': TimeType, - 'rtgAh': AmpereHour, - 'manufacturerStatus': ManufacturerStatusType, - 'statusTimeStamp': TimeType, - 'opModWattPF': DERCurveLink, - 'conversionFactor': UnitValueType, - 'mfDate': TimeType, - 'statWAvail': ActivePower, - 'currentPowerSource': PowerSourceType, - 'modesSupported': DERControlType, - 'opModFixedPF': FixedPowerFactor, - 'energyAvailable': RealEnergy, - 'sheddablePower': ActivePower, - 'changedTime': TimeType, - 'unit': UomType, - 'intervalRequested': DateTimeInterval, - 'start': TimeType, - 'consumptionBlock': ConsumptionBlockType, - 'setMaxW': ActivePower, - 'priority': PriorityType, - 'setMaxVA': ApparentPower, - 'creditTypeInUse': CreditTypeType, - 'dstEndRule': DstRuleType, - 'rtgVA': ApparentPower, - 'type': DERType, - 'potentiallySupersededTime': TimeType, - 'powerRequested': ActivePower, - 'rtgVAr': ReactivePower, - 'rtgWh': WattHour, - 'setMaxChargeRate': ActivePower, - 'stateOfChargeStatus': StateOfChargeStatusType, - 'emergencyCredit': AccountingUnit, - 'dstStartTime': TimeType, - 'updatedTime': TimeType, - 'kind': ChargeKind, - 'energyUnit': RealEnergy, - 'dstOffset': TimeOffsetType, - 'batteryInstallTime': TimeType, - 'creationTime': TimeType, - 'lowCreditWarningLevel': AccountingUnit, - 'availabilityUpdatePowerChangeThreshold': ActivePower, - 'powerAvailable': ActivePower, - 'inverterStatus': InverterStatusType, - 'statusTime': TimeType, - 'nextUpdateTime': TimeType, - 'primacy': PrimacyType, - 'tzOffset': TimeOffsetType, - 'nextRequestAttempt': TimeType, - 'newStatus': ServiceStatusType, - 'creditType': CreditTypeType, - 'roleFlags': RoleFlagsType, - 'effectiveTime': TimeType, - 'readingTime': TimeType, - 'loadShedDeviceCategory': DeviceCategoryType, - 'creditAmount': AccountingUnit, - 'setMaxVAr': ReactivePower, - 'currency': CurrencyCode, - 'setVRef': VoltageRMS, - 'currentLocale': LocaleType, - 'mRID': mRIDType, - 'targetStateOfCharge': PerCent, - 'maxDemand': ActivePower, - 'opModLVRT': CurvePairType, - 'storConnectStatus': ConnectStatusType, - 'opModFixedVAr': FixedVAr, - 'storageModeStatus': StorageModeStatusType, - 'rtgMinPFNeg': FixedPointType, - 'pIN': PINType, - 'emergencyCreditStatus': CreditStatusType, - 'randomizeDuration': OneHourRangeType, - 'yRefType': DERUnitRefType, - 'opModFixedFlow': SignedPerCent, - 'statVArAvail': ReactivePower, - 'startTime': TimeType, - 'phase': PhaseCode, - 'rtgMaxDischargeRate': ActivePower, - 'calorificValue': UnitValueType, - 'localTime': TimeType, - 'commodity': CommodityType, - 'currentTime': TimeType, - 'createdDateTime': TimeType, - 'dataQualifier': DataQualifierType, - 'interval': DateTimeInterval, - 'averageEnergy': RealEnergy, - 'operationalModeStatus': OperationalModeStatusType, - 'creditTypeChange': CreditTypeChange, - 'reserveChargePercent': PerCent, - 'opModFreqWatt': DERCurveLink, - 'newType': CreditTypeType, -} - - -USAGE_TEXT = """ -Usage: python .py [ -s ] -""" - - -def usage(): - print(USAGE_TEXT) - sys.exit(1) - - -def get_root_tag(node): - tag = Tag_pattern_.match(node.tag).groups()[-1] - rootClass = GDSClassesMapping.get(tag) - if rootClass is None: - rootClass = globals().get(tag) - return tag, rootClass - - -def parse(inFileName, silence=False): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'DeviceCapability' - rootClass = DeviceCapability - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('\n') - rootObj.export( - sys.stdout, 0, name_=rootTag, - namespacedef_='', - pretty_print=True) - return rootObj - - -def parseEtree(inFileName, silence=False): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'DeviceCapability' - rootClass = DeviceCapability - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - mapping = {} - rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping) - reverse_mapping = rootObj.gds_reverse_node_mapping(mapping) - if not silence: - content = etree_.tostring( - rootElement, pretty_print=True, - xml_declaration=True, encoding="utf-8") - sys.stdout.write(content) - sys.stdout.write('\n') - return rootObj, rootElement, mapping, reverse_mapping - - -def parseString(inString, silence=False): - from io import StringIO - doc = parsexml_(StringIO(inString)) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'DeviceCapability' - rootClass = DeviceCapability - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('\n') - rootObj.export( - sys.stdout, 0, name_=rootTag, - namespacedef_='') - return rootObj - - -def parseLiteral(inFileName, silence=False): - doc = parsexml_(inFileName) - rootNode = doc.getroot() - rootTag, rootClass = get_root_tag(rootNode) - if rootClass is None: - rootTag = 'DeviceCapability' - rootClass = DeviceCapability - rootObj = rootClass.factory() - rootObj.build(rootNode) - # Enable Python to collect the space used by the DOM. - doc = None - if not silence: - sys.stdout.write('#from xsd_models import *\n\n') - sys.stdout.write('import xsd_models as model_\n\n') - sys.stdout.write('rootObj = model_.rootClass(\n') - rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) - sys.stdout.write(')\n') - return rootObj - - -def main(): - args = sys.argv[1:] - if len(args) == 1: - parse(args[0]) - else: - usage() - - -if __name__ == '__main__': - #import pdb; pdb.set_trace() - main() - - -__all__ = [ - "AbstractDevice", - "AbstractFlowReservation", - "AccountBalance", - "AccountBalanceLink", - "AccountingUnit", - "AccumulationBehaviourType", - "ActiveBillingPeriodListLink", - "ActiveCreditRegisterListLink", - "ActiveDERControlListLink", - "ActiveEndDeviceControlListLink", - "ActiveFlowReservationListLink", - "ActivePower", - "ActiveProjectionReadingListLink", - "ActiveSupplyInterruptionOverrideListLink", - "ActiveTargetReadingListLink", - "ActiveTextMessageListLink", - "ActiveTimeTariffIntervalListLink", - "AmpereHour", - "ApparentPower", - "ApplianceLoadReduction", - "ApplianceLoadReductionType", - "AppliedTargetReduction", - "AssociatedDERProgramListLink", - "AssociatedUsagePointLink", - "BillingMeterReadingBase", - "BillingPeriod", - "BillingPeriodList", - "BillingPeriodListLink", - "BillingReading", - "BillingReadingList", - "BillingReadingListLink", - "BillingReadingSet", - "BillingReadingSetList", - "BillingReadingSetListLink", - "Charge", - "ChargeKind", - "CommodityType", - "Condition", - "Configuration", - "ConfigurationLink", - "ConnectStatusType", - "ConsumptionBlockType", - "ConsumptionTariffInterval", - "ConsumptionTariffIntervalList", - "ConsumptionTariffIntervalListLink", - "CostKindType", - "CreditRegister", - "CreditRegisterList", - "CreditRegisterListLink", - "CreditStatusType", - "CreditTypeChange", - "CreditTypeType", - "CurrencyCode", - "CurrentDERProgramLink", - "CurrentRMS", - "CurveData", - "CurvePairType", - "CustomerAccount", - "CustomerAccountLink", - "CustomerAccountList", - "CustomerAccountListLink", - "CustomerAgreement", - "CustomerAgreementList", - "CustomerAgreementListLink", - "DER", - "DERAvailability", - "DERAvailabilityLink", - "DERCapability", - "DERCapabilityLink", - "DERControl", - "DERControlBase", - "DERControlList", - "DERControlListLink", - "DERControlType", - "DERCurve", - "DERCurveLink", - "DERCurveList", - "DERCurveListLink", - "DERCurveType", - "DERLink", - "DERList", - "DERListLink", - "DERProgram", - "DERProgramLink", - "DERProgramList", - "DERProgramListLink", - "DERSettings", - "DERSettingsLink", - "DERStatus", - "DERStatusLink", - "DERType", - "DERUnitRefType", - "DRLCCapabilities", - "DataQualifierType", - "DateTimeInterval", - "DefaultDERControl", - "DefaultDERControlLink", - "DemandResponseProgram", - "DemandResponseProgramLink", - "DemandResponseProgramList", - "DemandResponseProgramListLink", - "DeviceCapability", - "DeviceCapabilityLink", - "DeviceCategoryType", - "DeviceInformation", - "DeviceInformationLink", - "DeviceStatus", - "DeviceStatusLink", - "DrResponse", - "DstRuleType", - "DutyCycle", - "EndDevice", - "EndDeviceControl", - "EndDeviceControlList", - "EndDeviceControlListLink", - "EndDeviceLink", - "EndDeviceList", - "EndDeviceListLink", - "EnvironmentalCost", - "Error", - "Event", - "EventStatus", - "File", - "FileLink", - "FileList", - "FileListLink", - "FileStatus", - "FileStatusLink", - "FixedPointType", - "FixedPowerFactor", - "FixedVAr", - "FlowDirectionType", - "FlowReservationRequest", - "FlowReservationRequestList", - "FlowReservationRequestListLink", - "FlowReservationResponse", - "FlowReservationResponseList", - "FlowReservationResponseListLink", - "FunctionSetAssignments", - "FunctionSetAssignmentsBase", - "FunctionSetAssignmentsList", - "FunctionSetAssignmentsListLink", - "HistoricalReading", - "HistoricalReadingList", - "HistoricalReadingListLink", - "IEEE_802_15_4", - "IPAddr", - "IPAddrList", - "IPAddrListLink", - "IPInterface", - "IPInterfaceList", - "IPInterfaceListLink", - "IdentifiedObject", - "InverterStatusType", - "KindType", - "LLInterface", - "LLInterfaceList", - "LLInterfaceListLink", - "Link", - "List", - "ListLink", - "LoadShedAvailability", - "LoadShedAvailabilityLink", - "LocalControlModeStatusType", - "LocaleType", - "LogEvent", - "LogEventList", - "LogEventListLink", - "ManufacturerStatusType", - "MessagingProgram", - "MessagingProgramList", - "MessagingProgramListLink", - "MeterReading", - "MeterReadingBase", - "MeterReadingLink", - "MeterReadingList", - "MeterReadingListLink", - "MirrorMeterReading", - "MirrorMeterReadingList", - "MirrorReadingSet", - "MirrorUsagePoint", - "MirrorUsagePointList", - "MirrorUsagePointListLink", - "Neighbor", - "NeighborList", - "NeighborListLink", - "Notification", - "NotificationList", - "NotificationListLink", - "Offset", - "OneHourRangeType", - "OperationalModeStatusType", - "PENType", - "PEVInfo", - "PINType", - "PerCent", - "PhaseCode", - "PowerConfiguration", - "PowerOfTenMultiplierType", - "PowerSourceType", - "PowerStatus", - "PowerStatusLink", - "PrepayModeType", - "PrepayOperationStatus", - "PrepayOperationStatusLink", - "Prepayment", - "PrepaymentLink", - "PrepaymentList", - "PrepaymentListLink", - "PriceResponse", - "PriceResponseCfg", - "PriceResponseCfgList", - "PriceResponseCfgListLink", - "PrimacyType", - "PriorityType", - "ProjectionReading", - "ProjectionReadingList", - "ProjectionReadingListLink", - "RPLInstance", - "RPLInstanceList", - "RPLInstanceListLink", - "RPLSourceRoutes", - "RPLSourceRoutesList", - "RPLSourceRoutesListLink", - "RandomizableEvent", - "RateComponent", - "RateComponentLink", - "RateComponentList", - "RateComponentListLink", - "ReactivePower", - "Reading", - "ReadingBase", - "ReadingLink", - "ReadingList", - "ReadingListLink", - "ReadingSet", - "ReadingSetBase", - "ReadingSetList", - "ReadingSetListLink", - "ReadingType", - "ReadingTypeLink", - "RealEnergy", - "Registration", - "RegistrationLink", - "RequestStatus", - "Resource", - "RespondableIdentifiedObject", - "RespondableResource", - "RespondableSubscribableIdentifiedObject", - "Response", - "ResponseList", - "ResponseListLink", - "ResponseSet", - "ResponseSetList", - "ResponseSetListLink", - "RoleFlagsType", - "SFDIType", - "SelfDevice", - "SelfDeviceLink", - "ServiceChange", - "ServiceKind", - "ServiceStatusType", - "ServiceSupplier", - "ServiceSupplierLink", - "ServiceSupplierList", - "SetPoint", - "SignedPerCent", - "SignedRealEnergy", - "StateOfChargeStatusType", - "StorageModeStatusType", - "SubscribableIdentifiedObject", - "SubscribableList", - "SubscribableResource", - "Subscription", - "SubscriptionBase", - "SubscriptionList", - "SubscriptionListLink", - "SupplyInterruptionOverride", - "SupplyInterruptionOverrideList", - "SupplyInterruptionOverrideListLink", - "SupportedLocale", - "SupportedLocaleList", - "SupportedLocaleListLink", - "TOUType", - "TargetReading", - "TargetReadingList", - "TargetReadingListLink", - "TargetReduction", - "TariffProfile", - "TariffProfileLink", - "TariffProfileList", - "TariffProfileListLink", - "Temperature", - "TextMessage", - "TextMessageList", - "TextMessageListLink", - "TextResponse", - "Time", - "TimeConfiguration", - "TimeLink", - "TimeOffsetType", - "TimeTariffInterval", - "TimeTariffIntervalList", - "TimeTariffIntervalListLink", - "TimeType", - "UnitType", - "UnitValueType", - "UnsignedFixedPointType", - "UomType", - "UsagePoint", - "UsagePointBase", - "UsagePointLink", - "UsagePointList", - "UsagePointListLink", - "VersionType", - "VoltageRMS", - "WattHour", - "loWPAN", - "mRIDType" -] diff --git a/services/core/IEEE2030_5Agent/README.md b/services/core/IEEE2030_5Agent/README.md deleted file mode 100644 index 62792c4b82..0000000000 --- a/services/core/IEEE2030_5Agent/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# IEEE2030_5 Agent -Agent that handles IEEE 2030.5 communication. -IEEE2030_5Agent uses the VOLTTRON web service to communicate with IEEE 2030.5 end devices. -End device configuration is outlined in the agent config file. - -IEEE 2030.5 data is exposed via get_point(), get_points() and set_point() calls. -A IEEE 2030.5 device driver (IEEE2030_5.py under PlatformDriverAgent) can be configured, -which gets and sets data by sending RPCs to this agent. - -For further information about this subsystem, please see the VOLTTRON -IEEE 2030.5 DER Support specification, which is located in VOLTTRON readthedocs -under specifications/IEEE2030_5_agent.html. - -## Configuration - -``` {.python} -{ - "devices": [ - { - "sfdi": "097935300833", - "lfdi": "247bd68e3378fe57ba604e3c8bdf9e3f78a3d743", - "load_shed_device_category": "0200", - "pin_code": "130178" - }, - { - "sfdi": "111576577659", - "lfdi": "2990c58a59935a7d5838c952b1a453c967341a07", - "load_shed_device_category": "0200", - "pin_code": "130178" - } - ], - "IEEE2030_5_server_sfdi": "413707194130", - "IEEE2030_5_server_lfdi": "29834592834729384728374562039847629", - "load_shed_device_category": "0020", - "timezone": "America/Los_Angeles" -} -``` diff --git a/services/core/IEEE2030_5Agent/config b/services/core/IEEE2030_5Agent/config deleted file mode 100644 index ba7fef49ba..0000000000 --- a/services/core/IEEE2030_5Agent/config +++ /dev/null @@ -1,20 +0,0 @@ -{ - "devices": [ - { - "sfdi": "097935300833", - "lfdi": "247bd68e3378fe57ba604e3c8bdf9e3f78a3d743", - "load_shed_device_category": "0200", - "pin_code": "130178" - }, - { - "sfdi": "111576577659", - "lfdi": "2990c58a59935a7d5838c952b1a453c967341a07", - "load_shed_device_category": "0200", - "pin_code": "130178" - } - ], - "IEEE2030_5_server_sfdi": "413707194130", - "IEEE2030_5_server_lfdi": "29834592834729384728374562039847629", - "load_shed_device_category": "0020", - "timezone": "America/Los_Angeles" -} diff --git a/services/core/IEEE2030_5Agent/setup.py b/services/core/IEEE2030_5Agent/setup.py deleted file mode 100644 index cc64769bff..0000000000 --- a/services/core/IEEE2030_5Agent/setup.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- {{{ -# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: -# -# Copyright 2020, Battelle Memorial Institute. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This material was prepared as an account of work sponsored by an agency of -# the United States Government. Neither the United States Government nor the -# United States Department of Energy, nor Battelle, nor any of their -# employees, nor any jurisdiction or organization that has cooperated in the -# development of these materials, makes any warranty, express or -# implied, or assumes any legal liability or responsibility for the accuracy, -# completeness, or usefulness or any information, apparatus, product, -# software, or process disclosed, or represents that its use would not infringe -# privately owned rights. Reference herein to any specific commercial product, -# process, or service by trade name, trademark, manufacturer, or otherwise -# does not necessarily constitute or imply its endorsement, recommendation, or -# favoring by the United States Government or any agency thereof, or -# Battelle Memorial Institute. The views and opinions of authors expressed -# herein do not necessarily state or reflect those of the -# United States Government or any agency thereof. -# -# PACIFIC NORTHWEST NATIONAL LABORATORY operated by -# BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY -# under Contract DE-AC05-76RL01830 -# }}} - -from os import path -from setuptools import setup, find_packages - -MAIN_MODULE = 'agent' - -# Find the agent package that contains the main module -packages = find_packages('.') -agent_package = '' -for package in find_packages(): - # Because there could be other packages such as tests - if path.isfile(package + '/' + MAIN_MODULE + '.py') is True: - agent_package = package -if not agent_package: - raise RuntimeError('None of the packages under {dir} contain the file ' - '{main_module}'.format(main_module=MAIN_MODULE + '.py', - dir=path.abspath('.'))) - -# Find the version number from the main module -agent_module = agent_package + '.' + MAIN_MODULE -_temp = __import__(agent_module, globals(), locals(), ['__version__'], 0) -__version__ = _temp.__version__ - -# Setup -setup( - name=agent_package + 'agent', - version=__version__, - install_requires=['volttron'], - packages=packages, - entry_points={ - 'setuptools.installation': [ - 'eggsecutable = ' + agent_module + ':main', - ] - } -) diff --git a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/IEEE2030_5drivertest.config b/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/IEEE2030_5drivertest.config deleted file mode 100644 index 7fd4f416c8..0000000000 --- a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/IEEE2030_5drivertest.config +++ /dev/null @@ -1,3 +0,0 @@ -{ - "agentid": "IEEE2030_5drivertest" -} diff --git a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/__init__.py b/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/setup.py b/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/setup.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/test_agent/__init__.py b/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/test_agent/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/test_agent/agent.py b/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/test_agent/agent.py deleted file mode 100644 index 6f23f157e7..0000000000 --- a/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/test_agent/agent.py +++ /dev/null @@ -1,449 +0,0 @@ -# -*- coding: utf-8 -*- {{{ -# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: -# -# Copyright 2020, Battelle Memorial Institute. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This material was prepared as an account of work sponsored by an agency of -# the United States Government. Neither the United States Government nor the -# United States Department of Energy, nor Battelle, nor any of their -# employees, nor any jurisdiction or organization that has cooperated in the -# development of these materials, makes any warranty, express or -# implied, or assumes any legal liability or responsibility for the accuracy, -# completeness, or usefulness or any information, apparatus, product, -# software, or process disclosed, or represents that its use would not infringe -# privately owned rights. Reference herein to any specific commercial product, -# process, or service by trade name, trademark, manufacturer, or otherwise -# does not necessarily constitute or imply its endorsement, recommendation, or -# favoring by the United States Government or any agency thereof, or -# Battelle Memorial Institute. The views and opinions of authors expressed -# herein do not necessarily state or reflect those of the -# United States Government or any agency thereof. -# -# PACIFIC NORTHWEST NATIONAL LABORATORY operated by -# BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY -# under Contract DE-AC05-76RL01830 -# }}} - -import gevent -import logging -import requests -import sys - -from volttron.platform.vip.agent import Agent, Core -from volttron.platform.agent import utils -from volttron.platform.agent.known_identities import PLATFORM_DRIVER - -_log = logging.getLogger(__name__) -utils.setup_logging() - -__version__ = '1.0' - -CYCLE_TIME = 3 # Seconds between sets of get_point/set_point calls - -ALL_POINTS = [ - 'b1_Md', - 'b1_Opt', - 'b1_SN', - 'b1_Vr', - 'b113_A', - 'b113_DCA', - 'b113_DCV', - 'b113_DCW', - 'b113_PF', - 'b113_WH', - 'b120_AhrRtg', - 'b120_ARtg', - 'b120_MaxChaRte', - 'b120_MaxDisChaRte', - 'b120_WHRtg', - 'b120_WRtg', - 'b121_WMax', - 'b122_ActWh', - 'b122_StorConn', - 'b124_WChaMax', - 'b403_Tmp', - 'b404_DCW', - 'b404_DCWh', - 'b802_LocRemCtl', - 'b802_SoC', - 'b802_State'] - -DEVICE_INFORMATION = """ - 0145 - 5509D69F8B353595206AD71B47E27906318EA367 - 1388566800 - MF-HW: 1.0.0 - 37250 - Mf Information - Mf Model - 1234567890 - 2 - 0 - 1416107035 - 9bc8e7b_modified - -""" - -DER_SETTINGS = """ - 55000 - - 1 - 2 - - - 3 - 4 - - - 1 - 1 - - true - 1416307137 -""" - -DER_STATUS = """ - 1416270124 - - 1416270124 - 777 - - - 1416270124 - 777 - - - 1416270124 - 777 - - - 1416270124 - 777 - -""" - -DER_AVAILABILITY = """ - 55036 - 3 - 1416304442 - 10000 - 10000 - - 1 - 1 - -""" - -DER_CAPABILITY = """ - 01 - - 1 - 35 - - - 1 - 33 - - - 1 - 22 - - - 1 - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - 123 - - 85 -""" - -POWER_STATUS = """ - 0 - 1416266598 - 3 - 1 - 0 - - - 0 - 3000 - - - 0 - 6100 - - - 3 - 7 - - 4337 - 1000 - 1516266598 - 1516266598 - - 2 - 2 -""" - -MUP = """ - 0600006CC8 - Gas Mirroring - 13 - 1 - 1 - 247bd68e3378fe57ba604e3c8bdf9e3f78a3d743 - - 0700006CC8 - Cumulative Reading for Gas - - 125 - - - 9 - 7 - 0 - 1 - 3 - 119 - - - - 0800006CC8 - Interval Readings for Gas - - 4 - 7 - 0 - 1 - 3 - 119 - - - - 0900006CC8 - InstantPackCurrent - - 125 - - - - 0900006CC8 - LineVoltageAvg - - 125 - - - - 0900006CC8 - PhasePowerAvg - - 125 - - - - 1000006CC8 - PhasePFA - - 126 - - - - 1100006CC8 - EnergyIMP - - 127 - - - - 1300006CC8 - InstantPackTemp - - 128 - - - 9 - 7 - 0 - 1 - 3 - 119 - - -""" - -MUP2 = """ - 0600006CC8 - Gas Mirroring - 13 - 1 - 1 - 247bd68e3378fe57ba604e3c8bdf9e3f78a3d743 - - 1200006CC8 - EnergyEXP - - 128 - - -""" - -MMR = """ - 6D6D72099BBDE9156400000000009182 - PhaseCurrentAvg - - - 0 - 2216441 - - 24 - - - 12 - 0 - 12 - 0 - 0 - 0 - 0 - 23 - -""" - -ASSERTED_VALUES = { - 'b1_Md': 'Mf Model', - 'b1_Opt': '247bd68e3378fe57ba604e3c8bdf9e3f78a3d743', - 'b1_SN': '097935300833', - 'b1_Vr': 'MF-HW: 1.0.0', - 'b113_A': '24.0', - 'b113_DCA': '125.0', - 'b113_DCV': '125.0', - 'b113_DCW': '125.0', - 'b113_PF': '126.0', - 'b113_WH': '127.0', - 'b120_AhrRtg': '350.0', - 'b120_ARtg': '330.0', - 'b120_MaxChaRte': '220.0', - 'b120_MaxDisChaRte': '10.0', - 'b120_WHRtg': '1230.0', - 'b120_WRtg': '10.0', - 'b121_WMax': '20.0', - 'b122_ActWh': '128.0', - 'b122_StorConn': '777', - 'b124_WChaMax': '10.0', - 'b403_Tmp': '128000.0', - 'b404_DCW': '3000.0', - 'b404_DCWh': '305.755555556', - 'b802_LocRemCtl': '777', - 'b802_SoC': '7.77', - 'b802_State': '777'} - -TEST_WEB_ADDRESS = 'http://127.0.0.1:8080' -DEFAULT_DRIVER = 'IEEE2030_5_1' - - -class IEEE2030_5DriverTestAgent(Agent): - """ - Test the IEEE 2030.5 driver (not a pytest regression test). - - Load a test data set by posting XML to IEEE2030_5Agent (assumed to be at port 8080 on the local host). - Periodically send get_point for each point on the IEEE 2030.5 driver. - Also send a set_point call to its der_control point, setting a power dispatch value. - - This agent can be installed as follows: - export VIP_SOCKET="ipc://$VOLTTRON_HOME/run/vip.socket" - export IEEE2030_5_TEST_ROOT=$VOLTTRON_ROOT/services/core/IEEE2030_5Agent/tests/IEEE2030_5DriverTestAgent/test_agent - cd $VOLTTRON_ROOT - python scripts/install-agent.py \ - -s $IEEE2030_5_TEST_ROOT \ - -i IEEE2030_5testagent \ - -c $IEEE2030_5_TEST_ROOT/IEEE2030_5drivertest.config \ - -t IEEE2030_5testagent \ - -f - """ - - def __init__(self, **kwargs): - super(IEEE2030_5DriverTestAgent, self).__init__(**kwargs) - self.default_config = {} - self.vip.config.set_default("config", self.default_config) - self.vip.config.subscribe(self.configure, actions=["NEW", "UPDATE"], pattern="config") - - def configure(self, config_name, action, contents): - config = self.default_config.copy() - config.update(contents) - - @Core.receiver('onstart') - def onstart(self, sender, **kwargs): - self.core.spawn(self.send_and_receive_points) - - def send_and_receive_points(self): - self.post_test_data() - while True: - self.set_point('b124_WChaMax', ASSERTED_VALUES['b124_WChaMax']) - for point_name in ALL_POINTS: - expected_value = ASSERTED_VALUES[point_name] - received_value = self.get_point(point_name) - assert received_value == expected_value - gevent.sleep(CYCLE_TIME) - - @staticmethod - def post_test_data(): - """Post XML test data for a IEEE 2030.5 resource to the IEEE2030_5Agent.""" - headers = {'content-type': 'application/sep+xml'} - requests.post('{}/dcap/edev/0/di'.format(TEST_WEB_ADDRESS), data=DEVICE_INFORMATION, headers=headers) - requests.post('{}/dcap/edev/0/der/1/derg'.format(TEST_WEB_ADDRESS), data=DER_SETTINGS, headers=headers) - requests.post('{}/dcap/edev/0/der/1/ders'.format(TEST_WEB_ADDRESS), data=DER_STATUS, headers=headers) - requests.post('{}/dcap/edev/0/der/1/dera'.format(TEST_WEB_ADDRESS), data=DER_AVAILABILITY, headers=headers) - requests.post('{}/dcap/edev/0/der/1/dercap'.format(TEST_WEB_ADDRESS), data=DER_CAPABILITY, headers=headers) - requests.post('{}/dcap/edev/0/ps'.format(TEST_WEB_ADDRESS), data=POWER_STATUS, headers=headers) - requests.post('{}/dcap/mup'.format(TEST_WEB_ADDRESS), data=MUP, headers=headers) - requests.post('{}/dcap/mup/0'.format(TEST_WEB_ADDRESS), data=MUP2, headers=headers) - requests.post('{}/dcap/mup/0'.format(TEST_WEB_ADDRESS), data=MMR, headers=headers) - - def get_point(self, point_name, driver_name=None): - """Issue a get_point RPC call for the named point and return the result.""" - driver = driver_name if driver_name else DEFAULT_DRIVER - response = self.vip.rpc.call(PLATFORM_DRIVER, 'get_point', driver, point_name).get(timeout=10) - _log.debug('{}: Sent get_point for {}, received {}'.format(driver, point_name, response)) - return response - - def set_point(self, point_name, value, driver_name=None): - """Issue a set_point RPC call for the named point and value, and return the result.""" - driver = driver_name if driver_name else DEFAULT_DRIVER - self.vip.rpc.call(PLATFORM_DRIVER, 'set_point', driver, point_name, value) - _log.debug('{}: Sent set_point for {} = {}'.format(driver, point_name, value)) - - -def test_IEEE2030_5_agent(config_path, **kwargs): - return IEEE2030_5DriverTestAgent(**kwargs) - - -def main(): - utils.vip_main(test_IEEE2030_5_agent, identity='IEEE2030_5testagent', version=__version__) - -if __name__ == '__main__': - try: - sys.exit(main()) - except KeyboardInterrupt: - pass diff --git a/services/core/IEEE2030_5Agent/tests/der.dera.PUT.xml b/services/core/IEEE2030_5Agent/tests/der.dera.PUT.xml deleted file mode 100644 index 3875af85ed..0000000000 --- a/services/core/IEEE2030_5Agent/tests/der.dera.PUT.xml +++ /dev/null @@ -1,11 +0,0 @@ - - 55036 - 3 - 1416304442 - 10000 - 10000 - - 1 - 1 - - \ No newline at end of file diff --git a/services/core/IEEE2030_5Agent/tests/der.dercap.PUT.xml b/services/core/IEEE2030_5Agent/tests/der.dercap.PUT.xml deleted file mode 100644 index 49510006fc..0000000000 --- a/services/core/IEEE2030_5Agent/tests/der.dercap.PUT.xml +++ /dev/null @@ -1,32 +0,0 @@ - - 01 - - 1 - 35 - - - 1 - 33 - - - 1 - 22 - - - 1 - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - 123 - - 85 - diff --git a/services/core/IEEE2030_5Agent/tests/der.derg.PUT.xml b/services/core/IEEE2030_5Agent/tests/der.derg.PUT.xml deleted file mode 100644 index ed10f419df..0000000000 --- a/services/core/IEEE2030_5Agent/tests/der.derg.PUT.xml +++ /dev/null @@ -1,17 +0,0 @@ - - 55000 - - 1 - 2 - - - 3 - 4 - - - 1 - 1 - - true - 1416307137 - \ No newline at end of file diff --git a/services/core/IEEE2030_5Agent/tests/der.ders.PUT.xml b/services/core/IEEE2030_5Agent/tests/der.ders.PUT.xml deleted file mode 100644 index 699d09a611..0000000000 --- a/services/core/IEEE2030_5Agent/tests/der.ders.PUT.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 1416270124 - - 1416270124 - 777 - - - 1416270124 - 777 - - - 1416270124 - 777 - - - 1416270124 - 777 - - diff --git a/services/core/IEEE2030_5Agent/tests/edev.di.PUT.xml b/services/core/IEEE2030_5Agent/tests/edev.di.PUT.xml deleted file mode 100644 index f7472b9806..0000000000 --- a/services/core/IEEE2030_5Agent/tests/edev.di.PUT.xml +++ /dev/null @@ -1,14 +0,0 @@ - - 0145 - 5509D69F8B353595206AD71B47E27906318EA367 - 1388566800 - MF-HW: 1.0.0 - 37250 - Mf Information - Mf Model - 1234567890 - 2 - 0 - 1416107035 - 9bc8e7b_modified - diff --git a/services/core/IEEE2030_5Agent/tests/edev.dstat.PUT.xml b/services/core/IEEE2030_5Agent/tests/edev.dstat.PUT.xml deleted file mode 100644 index a15a50171d..0000000000 --- a/services/core/IEEE2030_5Agent/tests/edev.dstat.PUT.xml +++ /dev/null @@ -1,6 +0,0 @@ - - 1416266460 - 5 - 0 - 0 - \ No newline at end of file diff --git a/services/core/IEEE2030_5Agent/tests/edev.ps.PUT.xml b/services/core/IEEE2030_5Agent/tests/edev.ps.PUT.xml deleted file mode 100644 index fa06647f1d..0000000000 --- a/services/core/IEEE2030_5Agent/tests/edev.ps.PUT.xml +++ /dev/null @@ -1,27 +0,0 @@ - - 0 - 1416266598 - 3 - 1 - 0 - - - 0 - 3000 - - - 0 - 6100 - - - 3 - 7 - - 4337 - 1000 - 1516266598 - 1516266598 - - 2 - 2 - diff --git a/services/core/IEEE2030_5Agent/tests/mup.mmr.PUT.xml b/services/core/IEEE2030_5Agent/tests/mup.mmr.PUT.xml deleted file mode 100644 index c14bed6d8f..0000000000 --- a/services/core/IEEE2030_5Agent/tests/mup.mmr.PUT.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 6D6D72099BBDE9156400000000009182 - PhaseCurrentAvg - - - 0 - 2216441 - - 24 - - - 12 - 0 - 12 - 0 - 0 - 0 - 0 - 23 - - \ No newline at end of file diff --git a/services/core/IEEE2030_5Agent/tests/mup.mup.PUT.xml b/services/core/IEEE2030_5Agent/tests/mup.mup.PUT.xml deleted file mode 100644 index 8c06c88533..0000000000 --- a/services/core/IEEE2030_5Agent/tests/mup.mup.PUT.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 0600006CC8 - Gas Mirroring - 13 - 1 - 1 - 247bd68e3378fe57ba604e3c8bdf9e3f78a3d743 - - 0700006CC8 - Cumulative Reading for Gas - - 125 - - - 9 - 7 - 0 - 1 - 3 - 119 - - - - 0800006CC8 - Interval Readings for Gas - - 4 - 7 - 0 - 1 - 3 - 119 - - - - 0900006CC8 - InstantPackCurrent - - 125 - - - - 0900006CC8 - LineVoltageAvg - - 125 - - - - 0900006CC8 - PhasePowerAvg - - 125 - - - - 1000006CC8 - PhasePFA - - 126 - - - - 1100006CC8 - EnergyIMP - - 127 - - - - 1300006CC8 - InstantPackTemp - - 128 - - - 9 - 7 - 0 - 1 - 3 - 119 - - - \ No newline at end of file diff --git a/services/core/IEEE2030_5Agent/tests/mup.mup2.PUT.xml b/services/core/IEEE2030_5Agent/tests/mup.mup2.PUT.xml deleted file mode 100644 index 7cdd1c5e04..0000000000 --- a/services/core/IEEE2030_5Agent/tests/mup.mup2.PUT.xml +++ /dev/null @@ -1,15 +0,0 @@ - - 0600006CC8 - Gas Mirroring - 13 - 1 - 1 - 247bd68e3378fe57ba604e3c8bdf9e3f78a3d743 - - 1200006CC8 - EnergyEXP - - 128 - - - \ No newline at end of file diff --git a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py b/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py deleted file mode 100644 index 5b931a0b65..0000000000 --- a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py +++ /dev/null @@ -1,291 +0,0 @@ -# -*- coding: utf-8 -*- {{{ -# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: -# -# Copyright 2020, Battelle Memorial Institute. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This material was prepared as an account of work sponsored by an agency of -# the United States Government. Neither the United States Government nor the -# United States Department of Energy, nor Battelle, nor any of their -# employees, nor any jurisdiction or organization that has cooperated in the -# development of these materials, makes any warranty, express or -# implied, or assumes any legal liability or responsibility for the accuracy, -# completeness, or usefulness or any information, apparatus, product, -# software, or process disclosed, or represents that its use would not infringe -# privately owned rights. Reference herein to any specific commercial product, -# process, or service by trade name, trademark, manufacturer, or otherwise -# does not necessarily constitute or imply its endorsement, recommendation, or -# favoring by the United States Government or any agency thereof, or -# Battelle Memorial Institute. The views and opinions of authors expressed -# herein do not necessarily state or reflect those of the -# United States Government or any agency thereof. -# -# PACIFIC NORTHWEST NATIONAL LABORATORY operated by -# BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY -# under Contract DE-AC05-76RL01830 -# }}} - -import pytest -import gevent -import requests - -from volttron.platform import get_services_core -from IEEE2030_5.end_device import IEEE2030_5Parser -from volttron.platform.agent.known_identities import PLATFORM_DRIVER - -DRIVER_NAME = 'IEEE2030_5' -DEVICE_ID = "097935300833" - -TEST_IEEE2030_5_CONFIG = { - "devices": [ - { - "sfdi": "097935300833", - "lfdi": "247bd68e3378fe57ba604e3c8bdf9e3f78a3d743", - "load_shed_device_category": "0200", - "pin_code": "130178" - }, - { - "sfdi": "111576577659", - "lfdi": "2990c58a59935a7d5838c952b1a453c967341a07", - "load_shed_device_category": "0200", - "pin_code": "130178" - } - ], - "IEEE2030_5_server_sfdi": "413707194130", - "IEEE2030_5_server_lfdi": "29834592834729384728374562039847629", - "load_shed_device_category": "0020", - "timezone": "America/Los_Angeles" -} - -REGISTRY_CONFIG_STRING = """Volttron Point Name,IEEE2030_5 Resource Name,IEEE2030_5 Field Name,Units,Writable,Default -b1_Md,DeviceInformation,mfModel,NA,FALSE,NA -b1_Opt,DeviceInformation,lFDI,NA,FALSE,NA -b1_SN,DeviceInformation,sFDI,NA,FALSE,NA -b1_Vr,DeviceInformation,mfHwVer,NA,FALSE,NA -b113_A,MirrorMeterReading,PhaseCurrentAvg,A,FALSE,NA -b113_DCA,MirrorMeterReading,InstantPackCurrent,A,FALSE,NA -b113_DCV,MirrorMeterReading,LineVoltageAvg,V,FALSE,NA -b113_DCW,MirrorMeterReading,PhasePowerAvg,W,FALSE,NA -b113_PF,MirrorMeterReading,PhasePFA,%,FALSE,NA -b113_WH,MirrorMeterReading,EnergyIMP,Wh,FALSE,NA -b120_AhrRtg,DERCapability,rtgAh,Ah,FALSE,NA -b120_ARtg,DERCapability,rtgA,A,FALSE,NA -b120_MaxChaRte,DERCapability,rtgMaxChargeRate,W,FALSE,NA -b120_MaxDisChaRte,DERCapability,rtgMaxDischargeRate,W,FALSE,NA -b120_WHRtg,DERCapability,rtgWh,Wh,FALSE,NA -b120_WRtg,DERCapability,rtgW,W,FALSE,NA -b121_WMax,DERSettings,setMaxChargeRate,W,FALSE,NA -b122_ActWh,MirrorMeterReading,EnergyEXP,Wh,FALSE,NA -b122_StorConn,DERStatus,storConnectStatus,NA,FALSE,NA -b124_WChaMax,DERControl,DERControlBase.opModFixedFlow,W,TRUE,NA -b403_Tmp,MirrorMeterReading,InstantPackTemp,C,FALSE,NA -b404_DCW,PowerStatus,PEVInfo.chargingPowerNow,W,FALSE,NA -b404_DCWh,DERAvailability,SOC,Wh,FALSE,NA -b802_LocRemCtl,DERStatus,localControlModeStatus,NA,FALSE,NA -b802_SoC,DERStatus,inverterStatus,%,FALSE,NA -b802_State,DERStatus,stateOfChargeStatus,NA,FALSE,NA""" - -web_address = "" - - -@pytest.fixture(scope="module") -def agent(request, volttron_instance_module_web): - - test_agent = volttron_instance_module_web.build_agent(identity="test_agent") - capabilities = {'edit_config_store': {'identity': PLATFORM_DRIVER}} - volttron_instance_module_web.add_capabilities(test_agent.core.publickey, capabilities) - # Configure a IEEE 2030.5 device in the Platform Driver - test_agent.vip.rpc.call('config.store', 'delete_store', PLATFORM_DRIVER).get(timeout=10) - test_agent.vip.rpc.call('config.store', 'set_config', PLATFORM_DRIVER, - 'devices/{}'.format(DRIVER_NAME), - """{ - "driver_config": { - "sfdi": "097935300833", - "IEEE2030_5_agent_id": "test_IEEE2030_5agent" - }, - "campus": "campus", - "building": "building", - "unit": "IEEE2030_5", - "driver_type": "IEEE2030_5", - "registry_config": "config://IEEE2030_5.csv", - "interval": 15, - "timezone": "US/Pacific", - "heart_beat_point": "Heartbeat" - }""", - 'json').get(timeout=10) - test_agent.vip.rpc.call('config.store', 'set_config', PLATFORM_DRIVER, - 'IEEE2030_5.csv', - REGISTRY_CONFIG_STRING, - 'csv').get(timeout=10) - - # Install and start a IEEE2030_5Agent - IEEE2030_5_id = volttron_instance_module_web.install_agent(agent_dir=get_services_core("IEEE2030_5Agent"), - config_file=TEST_IEEE2030_5_CONFIG, - vip_identity='test_IEEE2030_5agent', - start=True) - print('IEEE2030_5 agent id: ', IEEE2030_5_id) - - # Install and start a PlatformDriverAgent - md_id = volttron_instance_module_web.install_agent(agent_dir=get_services_core("PlatformDriverAgent"), - config_file={}, - start=True) - print('platform driver agent id: ', md_id) - - global web_address - web_address = volttron_instance_module_web.bind_web_address - - def stop(): - volttron_instance_module_web.stop_agent(md_id) - volttron_instance_module_web.stop_agent(IEEE2030_5_id) - test_agent.core.stop() - - gevent.sleep(3) # wait for agents and devices to start - - request.addfinalizer(stop) - - return test_agent - - -class TestIEEE2030_5Agent: - """Regression tests for the IEEE 2030.5 Agent.""" - - def test_get_urls(self, agent): - """Test that a requests.get succeeds (200 status) for various URLs.""" - assert requests.get('{}/dcap'.format(web_address)).status_code == 200 - self.IEEE2030_5_http_get('tm') - self.IEEE2030_5_http_get('edev') - self.IEEE2030_5_http_get('sdev') - self.IEEE2030_5_http_get('sdev/di') - self.IEEE2030_5_http_get('sdev/log') - self.IEEE2030_5_http_get('edev/0') - self.IEEE2030_5_http_get('edev/0/reg') - self.IEEE2030_5_http_get('edev/0/fsa') - self.IEEE2030_5_http_get('edev/0/der') - self.IEEE2030_5_http_get('edev/0/der/1') - - def test_set_di(self, agent): - """Test that DeviceInformation can be fetched after it's been set.""" - assert self.IEEE2030_5_http_get('edev/0/di').mfInfo is None - assert self.get_point(agent, 'b1_Vr') is None - assert self.get_point(agent, 'b1_Md') is None - assert self.IEEE2030_5_http_put('edev/0/di', 'edev.di').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/di').mfInfo == 'Mf Information' - assert self.get_point(agent, 'b1_Vr') == 'MF-HW: 1.0.0' - assert self.get_point(agent, 'b1_Md') == 'Mf Model' - - def test_set_dstat(self, agent): - """Test that DeviceStatus can be fetched after it's been set.""" - self.IEEE2030_5_http_get('edev/0/dstat') - assert self.IEEE2030_5_http_put('edev/0/dstat', 'edev.dstat').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/dstat').onCount == 5 - - def test_set_ps(self, agent): - """Test that PowerStatus can be fetched after it's been set.""" - assert self.IEEE2030_5_http_get('edev/0/ps').totalTimeOnBattery is None - assert self.IEEE2030_5_http_put('edev/0/ps', 'edev.ps').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/ps').totalTimeOnBattery == 2 - - def test_get_derc(self, agent): - """Test that DERControl can be used to dispatch a power setting.""" - self.IEEE2030_5_http_get('edev/0/derc/1') - self.set_point(agent, 'b124_WChaMax', 30) - # The next assert would fail -- DERControlBase.opModFixedFlow returns None - # assert self.get_point(agent, 'b124_WChaMax') == 30 - - def test_set_dercap(self, agent): - """Test that DERCapability can be fetched after it's been set.""" - assert self.IEEE2030_5_http_get('edev/0/der/1/dercap').type_ is None - assert self.IEEE2030_5_http_put('edev/0/der/1/dercap', 'der.dercap').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/der/1/dercap').type_.get_valueOf_() == '85' - - def test_set_derg(self, agent): - """Test that DERSettings can be fetched after it's been set.""" - assert self.IEEE2030_5_http_get('edev/0/der/1/derg').setGradW is None - assert self.get_point(agent, 'b121_WMax') is None - assert self.IEEE2030_5_http_put('edev/0/der/1/derg', 'der.derg').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/der/1/derg').setGradW == 55000 - assert self.get_point(agent, 'b121_WMax') == 20.0 - - def test_set_dera(self, agent): - """Test that DERAvailability can be fetched after it's been set.""" - assert self.IEEE2030_5_http_get('edev/0/der/1/dera').maxChargeDuration is None - assert self.get_point(agent, 'b404_DCWh') is None - assert self.IEEE2030_5_http_put('edev/0/der/1/dera', 'der.dera').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/der/1/dera').maxChargeDuration == 3 - assert self.get_point(agent, 'b404_DCWh') == 305.7555555555556 - - def test_set_ders(self, agent): - """Test that DERStatus can be fetched after it's been set.""" - assert self.IEEE2030_5_http_get('edev/0/der/1/ders').stateOfChargeStatus is None - assert self.get_point(agent, 'b802_State') is None - assert self.get_point(agent, 'b802_LocRemCtl') is None - assert self.get_point(agent, 'b802_SoC') is None - assert self.get_point(agent, 'b122_StorConn') is None - assert self.IEEE2030_5_http_put('edev/0/der/1/ders', 'der.ders').status_code == 204 - assert self.IEEE2030_5_http_get('edev/0/der/1/ders').stateOfChargeStatus.value.get_valueOf_() == '777' - assert self.get_point(agent, 'b802_State') == 7.77 - assert self.get_point(agent, 'b802_LocRemCtl') == 777 - assert self.get_point(agent, 'b802_SoC') == 777 - assert self.get_point(agent, 'b122_StorConn') == 777 - - def test_mup(self, agent): - """Test that metrics can be fetched from a MirrorUsagePoint.""" - self.IEEE2030_5_http_get('mup') - assert self.IEEE2030_5_http_put('mup', 'mup.mup').status_code == 201 - assert self.IEEE2030_5_http_get('mup').MirrorUsagePoint[0].description == 'Gas Mirroring' - self.IEEE2030_5_http_put('mup/0', 'mup.mmr') - self.IEEE2030_5_http_get('mup') - assert self.get_point(agent, 'b113_A') == 24.0 - assert self.get_point(agent, 'b122_ActWh') is None - self.IEEE2030_5_http_put('mup/0', 'mup.mup2') - assert self.get_point(agent, 'b122_ActWh') == 128 - - @staticmethod - def get_point(agent, point_name): - """Ask IEEE2030_5Agent for a point value for a IEEE 2030.5 resource.""" - return agent.vip.rpc.call('test_IEEE2030_5agent', 'get_point', DEVICE_ID, point_name).get(timeout=10) - - @staticmethod - def set_point(agent, point_name, value): - """Use IEEE2030_5Agent to set a point value for a IEEE 2030.5 resource.""" - return agent.vip.rpc.call('test_IEEE2030_5agent', 'set_point', DEVICE_ID, point_name, value).get(timeout=10) - - @staticmethod - def IEEE2030_5_http_get(IEEE2030_5_resource_name): - """ - Issue a web request to GET data for a IEEE 2030.5 resource. - - :param IEEE2030_5_resource_name: The distinguishing part of the name of the IEEE 2030.5 resource as it appears - in the URL. - :return: XML - """ - r = requests.get('{}/dcap/{}'.format(web_address, IEEE2030_5_resource_name)) - assert r.status_code == 200 - return IEEE2030_5Parser.parse(r.text.encode('ascii', 'ignore')) - - @staticmethod - def IEEE2030_5_http_put(IEEE2030_5_resource_name, IEEE2030_5_filename): - """ - Issue a web request to PUT data for a IEEE 2030.5 resource, using the contents of an XML file. - - @param IEEE2030_5_resource_name: The distinguishing part of the name of the IEEE 2030.5 resource as it appears - in the URL. - @param IEEE2030_5_filename: The distinguishing part of the IEEE 2030.5 sample data file name. - """ - url = '{}/dcap/{}'.format(web_address, IEEE2030_5_resource_name) - headers = {'content-type': 'application/IEEE2030_5+xml'} - return requests.post(url, - data=open(get_services_core("IEEE2030_5Agent/tests/{}.PUT.xml").format(IEEE2030_5_filename), - 'rb'), - headers=headers) diff --git a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py b/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py deleted file mode 100644 index ced543a8be..0000000000 --- a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py +++ /dev/null @@ -1,232 +0,0 @@ -# -*- coding: utf-8 -*- {{{ -# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: -# -# Copyright 2020, Battelle Memorial Institute. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This material was prepared as an account of work sponsored by an agency of -# the United States Government. Neither the United States Government nor the -# United States Department of Energy, nor Battelle, nor any of their -# employees, nor any jurisdiction or organization that has cooperated in the -# development of these materials, makes any warranty, express or -# implied, or assumes any legal liability or responsibility for the accuracy, -# completeness, or usefulness or any information, apparatus, product, -# software, or process disclosed, or represents that its use would not infringe -# privately owned rights. Reference herein to any specific commercial product, -# process, or service by trade name, trademark, manufacturer, or otherwise -# does not necessarily constitute or imply its endorsement, recommendation, or -# favoring by the United States Government or any agency thereof, or -# Battelle Memorial Institute. The views and opinions of authors expressed -# herein do not necessarily state or reflect those of the -# United States Government or any agency thereof. -# -# PACIFIC NORTHWEST NATIONAL LABORATORY operated by -# BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY -# under Contract DE-AC05-76RL01830 -# }}} - -import time -import pytest -import gevent -import requests - -from volttron.platform import get_services_core - -DRIVER_NAME = 'IEEE2030_5' -DEVICE_ID = "097935300833" - -TEST_CONFIG = { - "devices": [ - { - "sfdi": "097935300833", - "lfdi": "247bd68e3378fe57ba604e3c8bdf9e3f78a3d743", - "load_shed_device_category": "0200", - "pin_code": "130178" - }, - { - "sfdi": "111576577659", - "lfdi": "2990c58a59935a7d5838c952b1a453c967341a07", - "load_shed_device_category": "0200", - "pin_code": "130178" - } - ], - "IEEE2030_5_server_sfdi": "413707194130", - "IEEE2030_5_server_lfdi": "29834592834729384728374562039847629", - "load_shed_device_category": "0020", - "timezone": "America/Los_Angeles" -} - -REGISTRY_CONFIG_STRING = """Volttron Point Name,IEEE2030_5 Resource Name,IEEE2030_5 Field Name,Units,Writable,Default -b1_Md,DeviceInformation,mfModel,NA,FALSE,NA -b1_Opt,DeviceInformation,lFDI,NA,FALSE,NA -b1_SN,DeviceInformation,sFDI,NA,FALSE,NA -b1_Vr,DeviceInformation,mfHwVer,NA,FALSE,NA -b113_A,MirrorMeterReading,PhaseCurrentAvg,NA,FALSE,NA -b113_DCA,MirrorMeterReading,InstantPackCurrent,A,FALSE,NA -b113_DCV,MirrorMeterReading,LineVoltageAvg,V,FALSE,NA -b113_DCW,MirrorMeterReading,PhasePowerAvg,W,FALSE,NA -b113_PF,MirrorMeterReading,PhasePFA,%,FALSE,NA -b113_WH,MirrorMeterReading,EnergyIMP,Wh,FALSE,NA -b120_AhrRtg,DERCapability,rtgAh,Ah,FALSE,NA -b120_ARtg,DERCapability,rtgA,A,FALSE,NA -b120_MaxChaRte,DERCapability,rtgMaxChargeRate,W,FALSE,NA -b120_MaxDisChaRte,DERCapability,rtgMaxDischargeRate,W,FALSE,NA -b120_WHRtg,DERCapability,rtgWh,Wh,FALSE,NA -b120_WRtg,DERCapability,rtgW,W,FALSE,NA -b121_WMax,DERSettings,setMaxChargeRate,W,FALSE,NA -b122_ActWh,MirrorMeterReading,EnergyEXP,Wh,FALSE,NA -b122_StorConn,DERStatus,storConnectStatus,NA,FALSE,NA -b124_WChaMax,DERControl,DERControlBase.opModFixedFlow,W,TRUE,NA -b403_Tmp,MirrorMeterReading,InstantPackTemp,C,FALSE,NA -b404_DCW,PowerStatus,PEVInfo.chargingPowerNow,W,FALSE,NA -b404_DCWh,DERAvailability,SOC,Wh,FALSE,NA -b802_LocRemCtl,DERStatus,localControlModeStatus,NA,FALSE,NA -b802_SoC,DERStatus,inverterStatus,%,FALSE,NA -b802_State,DERStatus,stateOfChargeStatus,NA,FALSE,NA""" - -ASSERTED_VALUES = { - 'b1_Md': 'Mf Model', - 'b1_SN': '097935300833', - 'b1_Vr': 'MF-HW: 1.0.0', - 'b113_A': '24.0', - 'b113_DCA': '125.0', - 'b113_DCV': '125.0', - 'b113_DCW': '125.0', - 'b113_PF': '126.0', - 'b113_WH': '127.0', - 'b120_AhrRtg': '350.0', - 'b120_ARtg': '330.0', - 'b120_MaxChaRte': '220.0', - 'b120_MaxDisChaRte': '10.0', - 'b120_WHRtg': '1230.0', - 'b120_WRtg': '10.0', - 'b121_WMax': '20.0', - 'b122_ActWh': '128.0', - 'b122_StorConn': '777', - 'b124_WChaMax': '10.0', - 'b403_Tmp': '128000.0', - 'b404_DCW': '3000.0', - 'b404_DCWh': '305.755555556', - 'b802_LocRemCtl': '777', - 'b802_SoC': '777', - 'b802_State': '7.77'} - -web_address = "" - - -@pytest.fixture(scope="module") -def agent(request, volttron_instance_module_web): - test_agent = volttron_instance_module_web.build_agent() - - # Configure a IEEE 2030.5 device in the Platform Driver - test_agent.vip.rpc.call('config.store', 'delete_store', 'platform.driver').get(timeout=10) - test_agent.vip.rpc.call('config.store', 'set_config', 'platform.driver', - 'devices/{}'.format(DRIVER_NAME), - """{ - "driver_config": { - "sfdi": "097935300833", - "IEEE2030_5_agent_id": "test_IEEE2030_5agent" - }, - "campus": "campus", - "building": "building", - "unit": "IEEE2030_5", - "driver_type": "IEEE2030_5", - "registry_config": "config://IEEE2030_5.csv", - "interval": 15, - "timezone": "US/Pacific", - "heart_beat_point": "Heartbeat" - }""", - 'json').get(timeout=10) - test_agent.vip.rpc.call('config.store', 'set_config', 'platform.driver', - 'IEEE2030_5.csv', - REGISTRY_CONFIG_STRING, - 'csv').get(timeout=10) - - # Install and start a PlatformDriverAgent - md_id = volttron_instance_module_web.install_agent(agent_dir=get_services_core("PlatformDriverAgent"), - config_file={}, - start=True) - print('platform driver agent id: ', md_id) - - # Install and start a IEEE2030_5Agent - IEEE2030_5_id = volttron_instance_module_web.install_agent(agent_dir=get_services_core("IEEE2030_5Agent"), - config_file=TEST_CONFIG, - vip_identity='test_IEEE2030_5agent', - start=True) - print('IEEE 2030.5 agent id: ', IEEE2030_5_id) - - global web_address - web_address = volttron_instance_module_web.bind_web_address - - def stop(): - volttron_instance_module_web.stop_agent(md_id) - volttron_instance_module_web.stop_agent(IEEE2030_5_id) - test_agent.core.stop() - - gevent.sleep(10) # wait for agents and devices to start - - request.addfinalizer(stop) - - return test_agent - - -class TestIEEE2030_5Driver: - """Regression tests for the IEEE 2030.5 driver.""" - - def test_all_points(self, agent): - self.put_IEEE2030_5_data('edev/0/di', 'edev.di') # device_information - self.put_IEEE2030_5_data('edev/0/der/1/derg', 'der.derg') # der_settings - self.put_IEEE2030_5_data('edev/0/der/1/ders', 'der.ders') # der_status - self.put_IEEE2030_5_data('edev/0/der/1/dera', 'der.dera') # der_availability - self.put_IEEE2030_5_data('edev/0/der/1/dercap', 'der.dercap') # der_capabililty - self.put_IEEE2030_5_data('edev/0/ps', 'edev.ps') # power_status - self.put_IEEE2030_5_data('mup', 'mup.mup') # mup - self.put_IEEE2030_5_data('mup/0', 'mup.mup2') # mup (update) - self.put_IEEE2030_5_data('mup/0', 'mup.mmr') # mmr - - # Wait a few seconds to allow the HTTP requests to be processed (asynchronously?) - time.sleep(5) - - # Set the one settable point, the dispatched power value, and test that it comes back on a get_point - dispatch_point_name = 'b124_WChaMax' - dispatched_value = ASSERTED_VALUES[dispatch_point_name] - self.set_point(agent, dispatch_point_name, dispatched_value) - assert self.get_point(agent, dispatch_point_name) == dispatched_value - - # Test that each point has the test value that was posted to it - for point_name, expected_value in ASSERTED_VALUES.items(): - assert self.get_point(agent, point_name) == expected_value - - @staticmethod - def get_point(test_agent, point_name): - return test_agent.vip.rpc.call('platform.driver', 'get_point', DRIVER_NAME, point_name).get(timeout=10) - - @staticmethod - def set_point(test_agent, point_name, value): - return test_agent.vip.rpc.call('platform.driver', 'set_point', DRIVER_NAME, point_name, value).get(timeout=10) - - @staticmethod - def put_IEEE2030_5_data(IEEE2030_5_resource_name, IEEE2030_5_filename): - """ - PUT data for a IEEE 2030.5 resource, using the contents of an XML file in the current directory. - - @param IEEE2030_5_resource_name: The distinguishing part of the name of the IEEE 2030.5 resource as it appears - in the URL. - @param IEEE2030_5_filename: The distinguishing part of the IEEE 2030.5 sample data file name. - """ - url = '{}/dcap/{}'.format(web_address, IEEE2030_5_resource_name) - headers = {'content-type': 'application/sep+xml'} - requests.post(url, - data=open(get_services_core("IEEE2030_5Agent/tests/{}.PUT.xml".format(IEEE2030_5_filename)), 'rb'), - headers=headers) diff --git a/services/core/IEEE_2030_5/AGENTDEMO.md b/services/core/IEEE_2030_5/AGENTDEMO.md new file mode 100644 index 0000000000..2929eadcca --- /dev/null +++ b/services/core/IEEE_2030_5/AGENTDEMO.md @@ -0,0 +1,226 @@ + +# Demo for 2030.5 Agent # + +This document provides a walkthrough of a demonstration where an inverter publishes data points +to the VOLTTRON message bus. The 2030.5 agent receives these data points, creates MirrorUsagePoints, +and POSTs MirrorMeterReadings to the 2030.5 server. Additionally, the demo allows users to create a +DERControl event. When this event is activated, the agent logs messages to the 2030.5 server. + +To run the demo, you will need to have three terminal windows open. The first terminal runs the main +VOLTTRON process. The second terminal runs the 2030.5 server. The third terminal runs the agent demo +via a web interface. For the purposes of this document, we assume that you have cloned the volttron +repository to a location referred to as VOLTTRON_ROOT. + +The setup process involves configuring the 2030.5 server, setting up the VOLTTRON instance, and +finally launching the web-based demo. + +## Setting up the 2030.5 Server ## + +We will be using a 2030.5 server developed by a team at PNNL. The GridAPPS-D team has created this +server, which is available at . The version used while +creating this demo is version 0.0.2a14. The source code is currently in a private repository, but +it will be made public in the future. + +1. Open a new terminal and create a new virtual environment to install the gridappsd server. Please + note that this directory should be separate from the main volttron directory. + + ```bash + > mkdir 2030_5_server + > cd 2030_5_server + + # creates an environment 'serverenv' in the current directory + > python3 -m venv serverenv + + > source serverenv/bin/activate + + (serverenv)> pip install gridappsd-2030-5 + ``` + +1. Now, you need to adjust the `openssl.cnf` file to match your specific requirements. You can also + use the default settings. This file is used to create self-signed certificates for the client to + use. + + Copy the openssl.cnf and server.yml files from the $VOLTTRON_ROOT/services/core/IEEE_2030_5/demo + directory to the newly created 2030_5_server directory. After copying the current directory should + look like the following. + + ```bash + (serverenv)> ls -l + serverenv/ + openssl.cnf + server.yml + ``` + +1. Next, modify the `server.yml` file. The default `server.yml` file includes a device (id: dev1) and + a DERProgram. It's important to note that `dev1` must be present for the demo to run smoothly. + +1. Finally, start the server from the activated `serverenv`. This step will generate development + certificates for you. By default, the certificates will be stored in `~/tls`. You can change this + location in the `server.yml` configuration file, however the agent configuration file will also need + to be changed. + + ```bash + (serverenv)> 2030_5_server server.yml --no-validate + + # without creating certificates + # (serverenv)> 2030_5_server server.yml --no-validate --no-create-certs + ``` + +## Demo Requirements ## + +This demo requires you to start a default VOLTTRON instance from the command line. This command will +run VOLTTRON in the background and write to a `volttron.log` file. + +1. First, navigate to the VOLTTRON_ROOT directory and activate the virtual environment. + + ```bash + > cd $VOLTTRON_ROOT + > source env/bin/activate + ``` + +1. Next, start the VOLTTRON instance. + + ```bash + (volttron)> ./start-volttron + ``` + +1. If you want to monitor the VOLTTRON log, you can use the following command: + + ```bash + (volttron)> tail -f volttron.log + ``` + + >**Warning** + >If monitoring the log then open a new command prompt before continuing and follow step 1 + >before continuing. + +1. Install a platform.driver agent + + ```bash + (volttron)> vctl install services/core/PlatformDriverAgent --start + ``` + +1. Verify the platform.driver agent is running + + ```bash + (volttron)> vctl status + UUID AGENT IDENTITY TAG STATUS HEALTH + da2c1f0d-6c platform_driveragent-4.0 platform.driver running [476936] + ``` + +1. Add config store files to the platform.driver. + + ```bash + (volttron)> vctl config store 'platform.driver' 'devices/inverter1' 'services/core/IEEE_2030_5/demo/devices.inverter1.config' + (volttron)> vctl config store 'platform.driver' 'inverter1.points.csv' 'services/core/IEEE_2030_5/demo/inverter1.points.csv' --csv + ``` + +1. Add config store entries for the 2030.5 agent. We will use the identity `ed1`` for the agent. + + ```bash + (volttron)> vctl config store 'ed1' inverter_sample.csv services/core/IEEE_2030_5/inverter_sample.csv --csv + ``` + +1. Install and start the 2030.5 agent. + + ```bash + (volttron)> vctl install services/core/IEEE_2030_5/ --vip-identity ed1 --start --agent-config services/core/IEEE_2030_5/example.config.yml + ``` + +1. Finally start the web based demo. This should open a webpage allowing one + to test the functionality of the 2030.5 agent. By default it will open at . + If this does not work you can browse to and that should work as well. + + ```bash + (volttron)> cd services/core/IEEE_2030_5 + (volttron)> pip install -r requirements_demo.txt + (volttron)> python demo/webgui.py + ... + ``` + +## The Demo ## + +Once you start the demo, you'll see the local time displayed at the top, followed by the 2030.5 GMT +time represented as an integer. This integer representation is how the 2030.5 protocol communicates +datetime values. + +The demo interface includes six tabs: + +### Configuration Tab ### + +The "Configuration Tab" in the demo interface shows the configuration settings for the demo. The values are +set based on your VOLTTRON environment and 2030.5 server configuration + +![Configuration Tab](./demo/images/configuration.png) + +### DER Default Control Tab ### + +The "DER Default Control Tab" in the demo interface allows you to set default operational parameters +for Distributed Energy Resources (DERs). + +In this tab, you can specify the default mode for the inverter to operate in. Once you set the +parameters and click on the "Save" button, these default control settings are sent to the server. +The 2030.5 agent then polls the server and retrieves these default values to control the operation +of the DERs. + +![DER Default Control](./demo/images/default_control.png) + +### New DER Control Tab ### + +The "New DER Control Tab" in the demo interface is used to create new DER Control events. + +In this tab, you can specify the parameters for a new control event, such as the start and end times, +operational mode, and other settings. Once you've set these parameters, you can submit the new +control event. This event is then sent to the server and scheduled for execution. + +![New DER Control](./demo/images/control_entry.png) + +This tab is crucial for scheduling specific control events that override the default operational +parameters set in the "DER Default Control Tab". These events allow for more dynamic and responsive +control of the DERs based on changing conditions or requirements. Using the refresh icon +next to the "DER Control Entry" heading sets the schedule time of the event as current time + 30 seconds. + +### DER Control List Tab ### + +The "DER Control List Tab" in the demo interface provides a comprehensive list of all the DER Control +events that have been scheduled. + +This tab displays the status of each event, whether it's scheduled, active, or completed. It provides +an overview of all the control events, allowing you to monitor their progress and see when they are completed. + +Here's how the interface looks in different states: + +- No Events: ![DER Control List - No Events](./demo/images/control_list_no_events.png) +- Scheduled: ![DER Control List - Scheduled](./demo/images/control_list_scheduled.png) +- Active: ![DER Control List - Active](./demo/images/control_list_active.png) +- Complete: ![DER Control List - Complete](./demo/images/control_list_complete.png) + +This tab is crucial for managing and monitoring the control events that are used to dynamically control +the operation of the DERs. + +### DER Status Tab ### + +The "DER Status Tab" in the demo interface is used to monitor the current status of the DER. + +This tab provides real-time information about the operation of the DER, including their current mode +of operation, power output, and other operational parameters. + +### Usage Point Tab ### + +The "Usage Point Tab" in the demo interface is used to display the usage points. + +Usage points represent a collection of meter readings and are used to monitor the energy consumption +or production at a specific point. This could be a point of consumption like a building or a point of +production like a solar panel array. + +By monitoring the Usage Point Tab, you can get a live view of how much energy is being consumed or +produced at each usage point. This can be useful for energy management, performance monitoring, and +ensuring that the energy production or consumption is as expected. + +![Usage Point](./demo/images/usage_points.png) + + diff --git a/services/core/IEEE_2030_5/README.md b/services/core/IEEE_2030_5/README.md new file mode 100644 index 0000000000..5ef3ee62d0 --- /dev/null +++ b/services/core/IEEE_2030_5/README.md @@ -0,0 +1,279 @@ +# VOLTTRON 2030.5 Agent # + +The VOLTTRON 2030.5 agent facilitates communication between the PlatformDriverAgent and a 2030.5 +server, using the IEEE 2030.5(2018) protocol. The agent's primary role is to manage data exchange +between the PlatformDriverAgent and the 2030.5 server. It creates MirrorUsagePoints and readings on +the 2030.5 server and dispatches control actions to the message bus during DERControl events. + +The following diagram illustrates the data flow for the 2030.5 agent, from the PlatformDriverAgent to the 2030.5 server: + +```mermaid + sequenceDiagram + Agent->>Server: Creates MirrorUsagePoints + Server-->>Client: 201 OK + Agent->>PlatformDriverAgent: Subscribes to Device Data + PlatformDriverAgent->>Agent: Agent Receives Device Data + Agent->>Server: Posts MeterReadings(Device Data) + Agent->>PlatformDriverAgent: Publishes Event Controls +``` + +To see this process in action, please try out the [Agent Demo](AGENTDEMO.md). + +## Agent Configuration Files ## + +The IEEE 2030.5 Agent operates based on the output from the PlatformDriverAgent. This design allows the agent to remain +protocol-agnostic regarding the DER's actual communication protocol. For testing purposes, we provide sample registry +and device point files. These files generate changing numbers for some points and maintain steady set points, similar +to a typical piece of equipment. The agent requires a mapping from the platform driver point to a 2030.5 point to +identify which points are relevant to the 2030.5 protocol. + +### Example Platform Driver Files ### + +A platform driver manages communication with hardware, publishing and setting points using the hardware's specific +protocol (e.g., BACnet, Modbus, DNP3, etc.). The following example uses a fake driver to generate sine and cosine +function values, as well as some steady-state points for setting/getting from the 2030.5 agent. + +[demo/devices.inverter1.config](demo/devices.inverter1.config) + +```python +{ + "driver_config": {}, + # note requires inverter1.points.csv to be in the platform.driver configuration store. + "registry_config":"config://inverter1.points.csv", + "interval": 5, + "timezone": "US/Pacific", + "heart_beat_point": "Heartbeat", + "driver_type": "fakedriver", + "publish_breadth_first_all": false, + "publish_depth_first": false, + "publish_breadth_first": false, + "campus": "devices", + "building": "inverter1" +} +``` + +```shell +vctl config store platform.driver ed1 demo/devices/devices.inverter1.config +``` + +[demo/inverter1.points.csv](demo/inverter1.points.csv) + +**Point Name**|**Volttron Point Name**|**Units**|**Units Details**|**Writable**|**Starting Value**|**Type**|**Notes** +:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----: +Heartbeat|Heartbeat|On/Off|On/Off|TRUE|0|boolean|Point for heartbeat toggle +EKG1|BAT\_SOC|waveform|waveform|TRUE|sin|float|Sine wave for baseline output +EKG2|INV\_REAL\_PWR|waveform|waveform|TRUE|cos|float|Sine wave +EKG3|INV\_REACT\_PWR|waveform|waveform|TRUE|tan|float|Cosine wave +SampleBool3|energized|On / Off|on/off|FALSE|TRUE|boolean|Status indidcator of cooling stage 1 +SampleWritableBool3|connected|On / Off|on/off|TRUE|TRUE|boolean|Status indicator +SampleLong3|INV\_OP\_STATUS\_MODE|Enumeration|1-4|FALSE|3|int|Mode of Inverter +ctrl\_freq\_max|ctrl\_freq\_max| | |TRUE| |int| +ctrl\_volt\_max|ctrl\_volt\_max| | |TRUE| |int| +ctrl\_freq\_min|ctrl\_freq\_min| | |TRUE| |int| +ctrl\_volt\_min|ctrl\_volt\_min| | |TRUE| |int| +ctrl\_ramp\_tms|ctrl\_ramp\_tms| | |TRUE| |int| +ctrl\_rand\_delay|ctrl\_rand\_delay| | |TRUE| |int| +ctrl\_grad\_w|ctrl\_grad\_w| | |TRUE| |int| +ctrl\_soft\_grad\_w|ctrl\_soft\_grad\_w| | |TRUE| |int| +ctrl\_connected|ctrl\_connected| | |TRUE| |boolean| +ctrl\_energized|ctrl\_energized| | |TRUE| |boolean| +ctrl\_fixed\_pf\_absorb\_w|ctrl\_fixed\_pf\_absorb\_w| | |TRUE| |int| +ctrl\_fixed\_pf\_ingect\_w|ctrl\_fixed\_pf\_ingect\_w| | |TRUE| |int| +ctrl\_fixed\_var|ctrl\_fixed\_var| | |TRUE| |int| +ctrl\_fixed\_w|ctrl\_fixed\_w| | |TRUE| |int| +ctrl\_es\_delay|ctrl\_es\_delay| | |TRUE| |int| + +```shell +vctl config store platform.driver inverter1.points.csv demo/devices/inverter1.points.csv --csv +``` + +### Agent Configuration ### + +An example configuration file is at the root of the agent directory (example.config.yml) + +```yaml +# These are required in order for the agent to connect to the server. +cacertfile: ~/tls/certs/ca.crt +keyfile: ~/tls/private/dev1.pem +certfile: ~/tls/certs/dev1.crt +server_hostname: 127.0.0.1 + +# the pin number is used to verify the server is the correct server +pin: 111115 + +# Log the request and responses from the server. +log_req_resp: true + +# SSL defaults to 443 +server_ssl_port: 8443 + +# Number of seconds to poll for new default der settings. +default_der_control_poll: 10 + +MirrorUsagePointList: + # MirrorMeterReading based on Table E.2 IEEE Std 2030.5-18 + - device_point: INV_REAL_PWR + mRID: 5509D69F8B3535950000000000009182 + description: DER Inverter Real Power + roleFlags: 49 + serviceCategoryKind: 0 + status: 0 + MirrorMeterReading: + mRID: 5509D69F8B3535950000000000009183 + description: Real Power(W) Set + ReadingType: + accumulationBehavior: 12 + commodity: 1 + dataQualifier: 2 + intervalLength: 300 + powerOfTenMultiplier: 0 + uom: 38 + - device_point: INV_REAC_PWR + mRID: 5509D69F8B3535950000000000009184 + description: DER Inverter Reactive Power + roleFlags: 49 + serviceCategoryKind: 0 + status: 0 + MirrorMeterReading: + mRID: 5509D69F8B3535950000000000009185 + description: Reactive Power(VAr) Set + ReadingType: + accumulationBehavior: 12 + commodity: 1 + dataQualifier: 2 + intervalLength: 300 + powerOfTenMultiplier: 0 + uom: 38 + +# publishes on the following subscriptions will +# be available to create and POST readings to the +# 2030.5 server. +device_topic: devices/inverter1 + +# Nameplate ratings for this der client will be put to the +# server during startup of the system. +DERCapability: + # modesSupported is a HexBinary31 representation of DERControlType + # See Figure B.34 DER info types for information + # conversion in python is as follows + # "{0:08b}".format(int("500040", 16)) + # '10100000000000001000000' # This is a bitmask + # to generate HexBinary + # hex(int('10100000000000001000000', 2)) + # 0x500040 + modesSupported: 500040 + rtgMaxW: + multiplier: 0 + value: 0 + type: 0 + +DERSettings: + modesEnabled: 100000 + setGradW: 0 + setMaxW: + multiplier: 0 + value: 0 + +# Note this file MUST be in the config store or this agent will not run properly. +point_map: config:///inverter_sample.csv +``` + +See the [inverter_sample.csv](inverter_sample.csv) file. + +In the inverter_sample.csv file we have columns such as the following excerpt. The Point Name +corresponds to an all message published to the device_topic. Only the points with both the +Parameter Type and the Point Name are used when publshing/setting points to the platform.driver. + +| Point Name | Description | Multiplier | MRID | Offset | Parameter Type | Notes | +|------------------------|-------------------|------------|------|--------|---------------------------------------------|---------------------------------------------------| +| ctrl_connected | | | | | DERControlBase::opModConnect | True/False Connected = True, Disconnected = False | +| ctrl_energized | | | | | DERControlBase::opModEnergize | True/False Energized = True, De-Energized = False | +| ctrl_fixed_pf_absorb_w | | | | | DERControlBase::opModFixedPFAbsorbW | | +|------------------------|-------------------|------------|------|--------|---------------------------------------------|---------------------------------------------------| + +## Agent Installation ## + +The 2030.5 agent can be installed and started using an activated terminal from the root of the volttron +git repository. Here are the steps: + +1. Open a terminal and navigate to the root of the volttron git repository. + + ```bash + cd /path/to/volttron + ``` + +1. Activate the virtual environment for volttron. + + ```bash + source env/bin/activate + ``` + +1. Update the config store for the 2030.5 agent. Note we use the identity inverter1 + + ```bash + vctl config store 'inverter1' 'inverter_sample.csv' 'services/core/IEEE_2030_5/inverter_sample.csv' --csv + ``` + +1. Install and start the 2030.5 agent using the `vctl` command. The `--start` option starts the agent + immediately after installation. The `--agent-config` option specifies the configuration file for + the agent. The `--vip-identity` option sets the identity of the agent on the VOLTTRON message bus. + + ```bash + vctl install services/core/IEEE_2030_5 --start --agent-config services/core/IEEE_2030_5/example.config.yml --vip-identity inverter1 + ``` + +This completes the installation and startup of the 2030.5 agent. + +## 2030.5 Protocol ## + +The 2030.5 protocol uses a +REQUEST/RESPONSE pattern meaning that all communication with the 2030.5 server will start with a +REQUEST being sent from the client. + +### Communication ### + +The 2030.5 protocol starts with requests to the server for determining the DERProgram and DERControl +that the client should be using. Once the default and scheduled DERControls are known then the +client can act according to the 2030.5 server's requirements. + +The following diagram illistrates the request and response from the client to the server. + +```mermaid + sequenceDiagram + Client->>Server: /dcap + Server-->Client: DeviceCapabilities + Client->>Server: /edev + Server-->Client: EndDeviceList(1) /* found */ + Client->>Server: /edev/0 + Server-->Client: EndDevice + Client->>Server: /edev/0/fsa + Server-->Client: FunctionSetAssignmentList + Client->>Server: /edev/0/fsa/0 + Server-->Client: FunctionSetAssignment + Client->>Server: /edev/0/fsa/0/derp + Server-->Client: DERProgramList + Client->>Server: /derp/0 + Server-->Client: DERProgram + Client->>Server: /derp/0/derc + Server-->Client: DERControlList + Client->>Server: /derp/0/dderc + Server-->Client: DERDefaultControl + Client->>Server: /derp/0/derca + Server-->Client: DERControlList +``` + +After the DERControls are found the client needs to poll the server for updates. Depending on the +function set, the poll rate could be different. + +## Agent Limitations ## + +This agent is not a fully compliant 2030.5 client, meaning it does not support all of the function sets +within the 2030.5 standard. It provides the following function sets: + +- End Device +- Time +- Distributed Energy Resources +- Metering +- Metering Mirror + +As time goes on it is likely that this list will be extended through user support. diff --git a/services/core/IEEE2030_5Agent/conftest.py b/services/core/IEEE_2030_5/conftest.py similarity index 100% rename from services/core/IEEE2030_5Agent/conftest.py rename to services/core/IEEE_2030_5/conftest.py diff --git a/services/core/IEEE_2030_5/demo/devices.inverter1.config b/services/core/IEEE_2030_5/demo/devices.inverter1.config new file mode 100644 index 0000000000..eed61b85c0 --- /dev/null +++ b/services/core/IEEE_2030_5/demo/devices.inverter1.config @@ -0,0 +1,13 @@ +{ + "driver_config": {}, + "registry_config":"config://inverter1.points.csv", + "interval": 5, + "timezone": "US/Pacific", + "heart_beat_point": "Heartbeat", + "driver_type": "fakedriver", + "publish_breadth_first_all": false, + "publish_depth_first": false, + "publish_breadth_first": false, + "campus": "devices", + "building": "inverter1" +} diff --git a/services/core/IEEE_2030_5/demo/images/configuration.png b/services/core/IEEE_2030_5/demo/images/configuration.png new file mode 100644 index 0000000000..ab893c7c6b Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/configuration.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_active.png b/services/core/IEEE_2030_5/demo/images/control_active.png new file mode 100644 index 0000000000..541d14cf09 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_active.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_complete.png b/services/core/IEEE_2030_5/demo/images/control_complete.png new file mode 100644 index 0000000000..c258a255c1 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_complete.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_entry.png b/services/core/IEEE_2030_5/demo/images/control_entry.png new file mode 100644 index 0000000000..51e2312232 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_entry.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_list_active.png b/services/core/IEEE_2030_5/demo/images/control_list_active.png new file mode 100644 index 0000000000..93ad658bfb Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_list_active.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_list_complete.png b/services/core/IEEE_2030_5/demo/images/control_list_complete.png new file mode 100644 index 0000000000..afaf1f9d9f Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_list_complete.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_list_no_events.png b/services/core/IEEE_2030_5/demo/images/control_list_no_events.png new file mode 100644 index 0000000000..2251299a60 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_list_no_events.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_list_scheduled.png b/services/core/IEEE_2030_5/demo/images/control_list_scheduled.png new file mode 100644 index 0000000000..8442727450 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_list_scheduled.png differ diff --git a/services/core/IEEE_2030_5/demo/images/control_scheduled.png b/services/core/IEEE_2030_5/demo/images/control_scheduled.png new file mode 100644 index 0000000000..c17603ccd6 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/control_scheduled.png differ diff --git a/services/core/IEEE_2030_5/demo/images/default_control.png b/services/core/IEEE_2030_5/demo/images/default_control.png new file mode 100644 index 0000000000..7f90dfeb95 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/default_control.png differ diff --git a/services/core/IEEE_2030_5/demo/images/initial_conditions.png b/services/core/IEEE_2030_5/demo/images/initial_conditions.png new file mode 100644 index 0000000000..8b9c40c2f5 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/initial_conditions.png differ diff --git a/services/core/IEEE_2030_5/demo/images/start_agent_and_inverter.png b/services/core/IEEE_2030_5/demo/images/start_agent_and_inverter.png new file mode 100644 index 0000000000..ccf38aa45c Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/start_agent_and_inverter.png differ diff --git a/services/core/IEEE_2030_5/demo/images/usage_points.png b/services/core/IEEE_2030_5/demo/images/usage_points.png new file mode 100755 index 0000000000..2834a12075 Binary files /dev/null and b/services/core/IEEE_2030_5/demo/images/usage_points.png differ diff --git a/services/core/IEEE_2030_5/demo/inverter1.points.csv b/services/core/IEEE_2030_5/demo/inverter1.points.csv new file mode 100644 index 0000000000..2e2cbbfcbb --- /dev/null +++ b/services/core/IEEE_2030_5/demo/inverter1.points.csv @@ -0,0 +1,23 @@ +Point Name,Volttron Point Name,Units,Units Details,Writable,Starting Value,Type,Notes +Heartbeat,Heartbeat,On/Off,On/Off,TRUE,0,boolean,Point for heartbeat toggle +EKG1,BAT_SOC,waveform,waveform,TRUE,sin,float,Sine wave for baseline output +EKG2,INV_REAL_PWR,waveform,waveform,TRUE,cos,float,Sine wave +EKG3,INV_REACT_PWR,waveform,waveform,TRUE,tan,float,Cosine wave +SampleBool3,energized,On / Off,on/off,FALSE,TRUE,boolean,Status indidcator of cooling stage 1 +SampleWritableBool3,connected,On / Off,on/off,TRUE,TRUE,boolean,Status indicator +SampleLong3,INV_OP_STATUS_MODE,Enumeration,1-4,FALSE,3,int,Mode of Inverter +ctrl_freq_max,ctrl_freq_max,,,TRUE,,int, +ctrl_volt_max,ctrl_volt_max,,,TRUE,,int, +ctrl_freq_min,ctrl_freq_min,,,TRUE,,int, +ctrl_volt_min,ctrl_volt_min,,,TRUE,,int, +ctrl_ramp_tms,ctrl_ramp_tms,,,TRUE,,int, +ctrl_rand_delay,ctrl_rand_delay,,,TRUE,,int, +ctrl_grad_w,ctrl_grad_w,,,TRUE,,int, +ctrl_soft_grad_w,ctrl_soft_grad_w,,,TRUE,,int, +ctrl_connected,ctrl_connected,,,TRUE,,boolean, +ctrl_energized,ctrl_energized,,,TRUE,,boolean, +ctrl_fixed_pf_absorb_w,ctrl_fixed_pf_absorb_w,,,TRUE,,int, +ctrl_fixed_pf_ingect_w,ctrl_fixed_pf_ingect_w,,,TRUE,,int, +ctrl_fixed_var,ctrl_fixed_var,,,TRUE,,int, +ctrl_fixed_w,ctrl_fixed_w,,,TRUE,,int, +ctrl_es_delay,ctrl_es_delay,,,TRUE,,int, diff --git a/services/core/IEEE_2030_5/demo/keypair.json b/services/core/IEEE_2030_5/demo/keypair.json new file mode 100644 index 0000000000..77d8dd1527 --- /dev/null +++ b/services/core/IEEE_2030_5/demo/keypair.json @@ -0,0 +1,4 @@ +{ + "public": "YrRnX1ifv5hkctAtNsLMut1j3qr7dPf0gppvwH_53wE", + "secret": "C55SSFUKAM38dXZKjMSolRvFVfILbSTF9JkUQWlP8II" +} diff --git a/services/core/IEEE_2030_5/demo/openssl.cnf b/services/core/IEEE_2030_5/demo/openssl.cnf new file mode 100644 index 0000000000..3febb63be0 --- /dev/null +++ b/services/core/IEEE_2030_5/demo/openssl.cnf @@ -0,0 +1,123 @@ +# OpenSSL example configuration file. +# This is mostly being used for generation of certificate requests. +# + +# This definition stops the following lines choking if HOME isn't +# defined. +HOME = . +RANDFILE = $ENV::HOME/.rnd + +# Extra OBJECT IDENTIFIER info: +#oid_file = $ENV::HOME/.oid +oid_section = new_oids + +# To use this configuration file with the "-extfile" option of the +# "openssl x509" utility, name here the section containing the +# X.509v3 extensions to use: +# extensions = +# (Alternatively, use a configuration file that has only +# X.509v3 extensions in its main [= default] section.) + +[ new_oids ] + +# We can add new OIDs in here for use by 'ca', 'req' and 'ts'. +# Add a simple OID like this: +# testoid1=1.2.3.4 +# Or use config file substitution like this: +# testoid2=${testoid1}.5.6 + +# Policies used by the TSA examples. +tsa_policy1 = 1.2.3.4.1 +tsa_policy2 = 1.2.3.4.5.6 +tsa_policy3 = 1.2.3.4.5.7 + +#################################################################### +[ ca ] +default_ca = CA_default # The default ca section + +[ CA_default ] +dir = $ENV::HOME/tls # Where everything is kept +certs = $dir/certs # Where the issued certs are kept +database = $dir/index.txt # database index file. + # several certs with same subject. +new_certs_dir = $dir/certs # default place for new certs. +certificate = $dir/certs/ec-cacert.pem # The CA certificate +serial = $dir/serial # The current serial number +crlnumber = $dir/crlnumber # the current crl number + # must be commented out to leave a V1 CRL +private_key = $dir/private/ec-cakey.pem # The private key + +name_opt = ca_default # Subject Name options +cert_opt = ca_default # Certificate field options + +default_days = 365 # how long to certify for +default_crl_days= 30 # how long before next CRL +default_md = sha256 # use SHA-256 by default +preserve = no # keep passed DN ordering +policy = policy_match + +# For the CA policy +[ policy_match ] +countryName = optional +stateOrProvinceName = optional +organizationName = optional +organizationalUnitName = optional +commonName = supplied +emailAddress = optional + +[ policy_anything ] +countryName = optional +stateOrProvinceName = optional +localityName = optional +organizationName = optional +organizationalUnitName = optional +commonName = supplied +emailAddress = optional + +#################################################################### +[ req ] +default_bits = 2048 +default_md = sha256 +default_keyfile = privkey.pem +distinguished_name = req_distinguished_name +attributes = req_attributes +x509_extensions = v3_ca # The extentions to add to the self signed cert + +[ req_distinguished_name ] +countryName = Country Name (2 letter code) +countryName_default = IN +countryName_min = 2 +countryName_max = 2 +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = Some-State +localityName = Locality Name (eg, city) +localityName_default = BANGALORE +0.organizationName = Organization Name (eg, company) +0.organizationName_default = GoLinuxCloud +organizationalUnitName = Organizational Unit Name (eg, section) +commonName = Common Name (eg, your name or your server\'s hostname) +commonName_max = 64 +emailAddress = Email Address +emailAddress_max = 64 + +[ req_attributes ] +challengePassword = A challenge password +challengePassword_min = 4 +challengePassword_max = 20 +unstructuredName = An optional company name + + +[ v3_req ] +# Extensions to add to a certificate request +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +[ v3_ca ] +# Extensions for a typical CA +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid:always,issuer +basicConstraints = critical,CA:true + +[ crl_ext ] +# issuerAltName=issuer:copy +authorityKeyIdentifier=keyid:always \ No newline at end of file diff --git a/services/core/IEEE_2030_5/demo/server.yml b/services/core/IEEE_2030_5/demo/server.yml new file mode 100644 index 0000000000..324e18bd79 --- /dev/null +++ b/services/core/IEEE_2030_5/demo/server.yml @@ -0,0 +1,102 @@ +--- +server: 127.0.0.1 +port: 8443 + + +tls_repository: "~/tls" +openssl_cnf: "openssl.cnf" + +server_mode: enddevices_create_on_start + +# lfdi_mode: Determines what piece of information is used to calculate the lfdi +# +# Options: +# lfdi_mode_from_file - sha256 hash of certificate file's content. +# lfdi_mode_from_cert_fingerprint - sha256 hash of the certificates fingerprint. +# +# default: lfdi_mode_from_cert_fingerprint +#lfdi_mode: lfdi_mode_from_file +lfdi_mode: lfdi_mode_from_cert_fingerprint + +# Create an administrator certificate that can be used from +# browser/api to connect to the platform. +# +# this is important for the demo +generate_admin_cert: True + +log_event_list_poll_rate: 60 +device_capability_poll_rate: 60 +mirror_usage_point_post_rate: 15 + +# Reset storage so no memory when server restarts. +cleanse_storage: true + +# Directory containing data files for the platform. +# This directory will be created if it does not exist. +storage_path: data_store + +# End Device +devices: + # SolarEdge SE6000H HD-Wave SetApp Enabled Inverter + - id: dev1 + # DeviceCategoryType from ieee_2030_5.models.DeviceCategoryType + device_categories: + - OTHER_STORAGE_SYSTEMS + - OTHER_GENERATION_SYSTEMS + pin: 111115 + fsas: + - fsa1 + - fsa2 + ders: + - description: DER 1 + + - id: dev2 + device_categories: + - OTHER_STORAGE_SYSTEMS + - OTHER_GENERATION_SYSTEMS + pin: 111111 + fsas: + - fsa2 + ders: + - description: DER 2 + + +fsas: + - description: fsa1 + programs: + - Program 1 + - description: fsa2 + programs: + - Program 1 + + + +programs: + - description: Program 1 + primacy: 0 + DefaultDERControl: + setESDelay: 30 + setGradW: 1000 + + DERControlBase: + opModConnect: true + opModEnergize: true + +curves: + - description: Curve 1 + curveType: 11 + CurveData: + - xvalue: 99 + yvalue: 50 + - xvalue: 103 + yvalue: -50 + - xvalue: 101 + yvalue: -50 + - xvalue: 97 + yvalue: 50 + rampDecTms: 600 + rampIncTms: 600 + rampPT1Tms: 10 + xMultiplier: 0 + yMultiplier: 0 + yRefType: 3 diff --git a/services/core/IEEE_2030_5/demo/webgui.py b/services/core/IEEE_2030_5/demo/webgui.py new file mode 100644 index 0000000000..cf9fdbf682 --- /dev/null +++ b/services/core/IEEE_2030_5/demo/webgui.py @@ -0,0 +1,962 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +from copy import deepcopy +from pprint import pformat +from parser import ParserError + +import sys +import time +import uuid +import urllib3 +from dataclasses import dataclass, field, fields +from datetime import datetime, timedelta +from pathlib import Path +from typing import Any, Callable, Dict, List, TypeVar +import logging +import xsdata +import pandas as pd + +from volttron.platform.agent.utils import parse_timestamp_string + +urllib3.disable_warnings() + +sys.path.insert(0, str(Path(__file__).absolute().parent.parent.as_posix())) + +import requests +from nicegui import app, ui + +import ieee_2030_5.models as m +from ieee_2030_5 import dataclass_to_xml, xml_to_dataclass + +logging.getLogger('urllib3.connectionpool').setLevel(logging.INFO) +_log = logging.getLogger(__name__) + + +def uuid_2030_5() -> str: + return str(uuid.uuid4()).replace('-', '').upper() + + +def timestamp_to_string(timestamp: int) -> str: + return datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S') + + +def datetime_from_utc_to_local(utc_datetime): + now_timestamp = time.time() + offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(now_timestamp) + return utc_datetime + offset + + +@dataclass +class Configuration: + agent_2030_5_identity: str = 'ed1' + volttron_home: str = Path('~/.volttron').expanduser().as_posix() + ieee_server: str = 'https://127.0.0.1:8443' + ieee_client_pk: str = Path('~/tls/private/dev1.pem').expanduser().as_posix() + ieee_client_cert: str = Path('~/tls/certs/dev1.crt').expanduser().as_posix() + ieee_ca: str = Path('~/tls/certs/ca.crt').expanduser().as_posix() + + +@dataclass +class WatchFileState: + path: str + exists: bool = False + interval: int = 1 + in_routing: bool = False + + def remove(self): + Path(self.path).unlink(missing_ok=True) + + def check_file(self) -> bool: + return Path(self.path).exists() + + +@dataclass +class PlottedData: + series_labels: List[str] = field(default_factory=list) + series_ts: List[datetime] = field(default_factory=list) + series_values: Dict[str, List[float]] = field(default_factory=dict) + + def df(self) -> pd.DataFrame: + data = {'ts': self.series_ts.copy()} + data.update(self.series_values) + + my_df = pd.DataFrame(data) + my_df.set_index(['ts']) + return my_df + + +# Configuration parameters from the config page +config = Configuration() +# Temp storage for changes on the config page +config_working = Configuration() + +# A session for talking with the 2030.5 server +session = requests.Session() +# A file to watch for updates to output from the agent connected to volttron +# the "watch_devices_to_file.py" output. +#watch_file = WatchFileState(sys.argv[1], interval=3) +program_list = [] + +admin_session = requests.Session() +client_session = requests.Session() + +S = TypeVar('S') +T = TypeVar('T') + + +class PropertyWrapper: + """The PropertyWrapper class handles binding on behalf of the parent object. + + The class handles the binding from/to and formatting/applying when sending the + object to the parent. + """ + + def __init__(self, + backing_obj: T, + parent_obj: S, + parent_property: str, + formatters: Dict[str, Callable] = None, + applyers: Dict[str, Callable] = None): + # The sub object that we need to provide for + self.backing_obj = backing_obj + # The parent object this property is wrapping + self.parent_obj = parent_obj + # The property this object is wrapping on the parent_obj + self.parent_property = parent_property + + if formatters is None: + formatters = {} + + if applyers is None: + applyers = {} + + self.formatters = formatters + self.appliers = applyers + # Transfer the values from the parent to the backing object + if self.parent_obj.__dict__[self.parent_property] is not None: + if isinstance(self.backing_obj, + (m.VoltageRMS, m.ApparentPower, m.CurrentRMS, m.ActivePower, m.FixedVar, + m.FixedPointType, m.ReactivePower, m.AmpereHour, m.WattHour)): + self.backing_obj.__dict__['value'] = self.parent_obj.__dict__[ + self.parent_property].value + + def __setattr__(self, key: str, value: Any): + if key in ('backing_obj', 'parent_obj', 'parent_property', 'formatters', 'appliers'): + self.__dict__[key] = value + else: + if key in self.formatters: + self.backing_obj.__dict__[key] = self.formatters[key](value) + else: + _log.debug(f'Setting on {type(self.backing_obj)} {key} -> {value}') + self.backing_obj.__dict__[key] = value + + def __getattr__(self, key: str) -> Any: + if key in ('data_obj', 'parent_obj', 'parent_property', 'formatters', 'appliers'): + return self.__dict__[key] + else: + return self.backing_obj.__dict__[key] + + def apply_to_parent(self): + other_obj = deepcopy(self.backing_obj) + + if self.appliers: + for k, v in self.appliers.items(): + other_obj.__dict__[k] = self.appliers[k](other_obj.__dict__[k]) + + if self.should_be_none(): + setattr(self.parent_obj, self.parent_property, None) + else: + _log.debug(f'Setting {self.parent_property} to {other_obj}') + setattr(self.parent_obj, self.parent_property, other_obj) + _log.debug(f'Parent obj is {self.parent_obj}') + + def should_be_none(self) -> bool: + """Answers the question whether the parent property should be None. + + Loop over the backing object and if any of the fields are not None then + the answer is False. Otherwise the answer is True. + + :return: True if all fields are None, False otherwise. + """ + for fld in fields(self.backing_obj): + if getattr(self.backing_obj, fld.name): + return False + return True + + +def update_sessions(): + """Update the admin and client sessions with the current configuration.""" + tlsdir = Path(config.ieee_client_cert).parent.parent + admin_session.cert = (str(tlsdir.joinpath('certs/admin.crt')), + str(tlsdir.joinpath('private/admin.pem'))) + client_session.cert = (config.ieee_client_cert, config.ieee_client_pk) + admin_session.verify = config.ieee_ca + client_session.verify = config.ieee_ca + + +def get_from_server(context: str, + admin_request=False, + deserialize=False, + start=None, + after=None, + limit=None): + if admin_request: + session = admin_session + else: + session = client_session + + params = {} + if start is not None: + params['s'] = int(start) + if after is not None: + params['a'] = int(after) + if limit is not None: + params['l'] = int(limit) + + if admin_request: + response = session.get(config.ieee_server + f'/admin/{context}', params=params) + else: + response = session.get(config.ieee_server + f'/{context}', params=params) + + if deserialize: + return xml_to_dataclass(response.text) + return response.text + + +def admin_uri(path: str): + path = path.replace('_', '/') + if path.startswith('/'): + path = path[1:] + return f'{config.ieee_server}/admin/{path}' + + +def __uri__(path: str): + if path.startswith('/'): + path = path[1:] + return f'{config.ieee_server}/{path}' + + +def post_as_admin(path, data): + print(f'POST: {admin_uri(path)}') + assert admin_session.cert + return admin_session.post(admin_uri(path), data=data) + + +def put_as_admin(path, data): + print(f'PUT: {admin_uri(path)}') + assert admin_session.cert + return admin_session.put(admin_uri(path), data=data) + + +def post_as_device(path, data): + print(f'POST: {__uri__(path)}') + return client_session.post(__uri__(path), data=data) + + +def save_config(): + paths_needed = ('volttron_home', 'ieee_client_pk', 'ieee_client_cert', 'ieee_ca') + path_text = ('VOLTTRON home', 'Client PK', 'Client Cert', 'CA') + paths_unavailable = [] + + for index, p in enumerate(paths_needed): + if not Path(getattr(config_working, p)).exists(): + paths_unavailable.append(path_text[index]) + + if paths_unavailable: + ui.notify(f"Missing: {';'.join(paths_unavailable)}", type='warning', position='center') + else: + for fld in fields(config): + setattr(config, fld.name, getattr(config_working, fld.name)) + + update_sessions() + + ui.notify('Configuration Updated') + + +def reset_config(): + for fld in fields(config): + setattr(config_working, fld.name, getattr(config, fld.name)) + + +cards = [] + + +def convert_local_dt_to_utc_timestamp(dt: datetime) -> int: + """Converts a local datetime to a UTC timestamp. + + :param dt: A datetime object in local time. + :type dt: datetime + :return: A UTC timestamp for passing to 2030.5 server. + :rtype: int + """ + # Leaving these commented out as a guide to how we got the answer to the issue. + # _log.debug(f"Start with dt: {dt} at {int(dt.timestamp())}") + # _log.debug(f"get date from ts: {datetime.fromtimestamp(int(dt.timestamp()))}") + gmt_date = datetime.utcfromtimestamp(int(dt.timestamp())) + # _log.debug(f"gmtdate {gmt_date} at {int(gmt_date.timestamp())}") + # _log.debug(f"get gmtdate back: {datetime.fromtimestamp(int(gmt_date.timestamp()))}") + + # _log.debug(f"Converting {dt} to epoch time gmtime") + return int(gmt_date.timestamp()) + + +update_sessions() +dcap: m.DeviceCapability = get_from_server('dcap', deserialize=True) +edl: m.EndDeviceList = get_from_server(dcap.EndDeviceListLink.href, deserialize=True) +edev = edl.EndDevice[0] +ders: m.DERList = get_from_server(edev.DERListLink.href, deserialize=True) +der = ders.DER[0] +program: m.DERProgram = get_from_server(der.CurrentDERProgramLink.href, deserialize=True) + + +def noneable_int_change(obj: object, prop: str, value): + try: + num = int(value.sender.value) + setattr(obj, prop, num) + except (ValueError, TypeError): + if value.sender.value == '': + setattr(obj, prop, None) + + +@ui.refreshable +def render_der_default_control_tab(): + + def refresh_default_control_tab(): + render_der_default_control_tab.refresh() + ui.notify('Refreshed') + + default: m.DefaultDERControl = get_from_server(program.DefaultDERControlLink.href, + deserialize=True) + der_base: m.DERControlBase = default.DERControlBase + if der_base is None: + der_base = m.DERControlBase() + default.DERControlBase = der_base + + wrappers: List[PropertyWrapper] = [] + + with ui.row(): + with ui.column(): + with ui.label('DER Default Control').style('font-size: 200%;'): + ui.button(icon='refresh', + color='white', + on_click=lambda: refresh_default_control_tab()).style( + 'margin:5px; padding: 5px;') + ui.label( + 'Section 10.10 Distributed Energy Resources function set from 20305-2018 IEEE standard.' + ) + + with ui.row().classes('pt-10'): + with ui.column().classes('pr-15'): + ui.input('setESDelay (hundredth of a second)', + on_change=lambda e: noneable_int_change(default, 'setESDelay', e)) \ + .bind_value_from(default, 'setESDelay').classes('w-96') + #.bind_value_from(default, "setESDelay").classes("w-96") + ui.input('setESHighFreq (hundredth of a hertz)', + on_change=lambda e: noneable_int_change(default, 'setESHighFreq', e)) \ + .bind_value_from(default, 'setESHighFreq').classes('w-96') + ui.input('setESHighVolt (hundredth of a volt)', + on_change=lambda e: noneable_int_change(default, 'setESHighVolt', e)) \ + .bind_value_from(default, 'setESHighVolt').classes('w-96') + + with ui.column().classes('pr-15'): + ui.input('setESLowFreq (hundredth of a hertz)', + on_change=lambda e: noneable_int_change(default, 'setESLowFreq', e)) \ + .bind_value_from(default, 'setESLowFreq').classes('w-96') + ui.input('setESLowVolt (hundredth of a volt)', + on_change=lambda e: noneable_int_change(default, 'setESLowVolt', e)) \ + .bind_value_from(default, 'setESLowVolt').classes('w-96') + ui.input('setESRampTms (hundredth of a second)', + on_change=lambda e: noneable_int_change(default, 'setESRampTms', e)) \ + .bind_value_from(default, 'setESRampTms').classes('w-96') + with ui.column(): + + ui.input('setESRandomDelay (hundredth of a second)', + on_change=lambda e: noneable_int_change(default, 'setESRandomDelay', e)) \ + .bind_value_from(default, 'setESRandomDelay').classes('w-96') + ui.input('setGradW (hundredth of a watt)', + on_change=lambda e: noneable_int_change(default, 'setGradW', e)) \ + .bind_value_from(default, 'setGradW').classes('w-96') + ui.input('setSoftGradW (hundredth of a watt)', + on_change=lambda e: noneable_int_change(default, 'setSoftGradW', e)) \ + .bind_value_from(default, 'setSoftGradW').classes('w-96') + + with ui.row().style('margin-top:15px;margin-bottom:15px;'): + ui.label('DER Control Base').style('font-size: 150%;') + + with ui.row(): + with ui.column().classes('pr-20'): + ui.checkbox('opModConnect', value=True).bind_value(der_base, 'opModConnect') + ui.checkbox('opModEnergize', value=True).bind_value(der_base, 'opModEnergize') + + with ui.column().classes('pr-20'): + ui.label('Power Factor Absorb Watts').style('font-size: 125%;') + if der_base.opModFixedPFAbsorbW is None: + der_base.opModFixedPFAbsorbW = m.PowerFactorWithExcitation() + opModFixedPFAbsorbW_wrapper = PropertyWrapper(der_base.opModFixedPFAbsorbW, der_base, + 'opModFixedPFAbsorbW') + wrappers.append(opModFixedPFAbsorbW_wrapper) + ui.input('displacement', on_change=lambda e: noneable_int_change(opModFixedPFAbsorbW_wrapper, 'displacement', e)) \ + .bind_value_from(opModFixedPFAbsorbW_wrapper, 'displacement') + ui.checkbox('excitation', value=False).bind_value(opModFixedPFAbsorbW_wrapper, + 'excitation') + + ui.label('Power Factor Inject Watts').style('font-size: 125%;') + if der_base.opModFixedPFInjectW is None: + der_base.opModFixedPFInjectW = m.PowerFactorWithExcitation() + opModFixedPFInjectW_wrapper = PropertyWrapper(der_base.opModFixedPFInjectW, der_base, + 'opModFixedPFInjectW') + wrappers.append(opModFixedPFInjectW_wrapper) + ui.input('displacement', on_change=lambda e: noneable_int_change(opModFixedPFInjectW_wrapper, 'displacement', e)) \ + .bind_value_from(opModFixedPFInjectW_wrapper, 'displacement') + ui.checkbox('excitation', value=False).bind_value(opModFixedPFInjectW_wrapper, + 'excitation') + + with ui.column().classes('pr-20'): + fixedVar_wrapper = PropertyWrapper(m.FixedVar(), der_base, 'opModFixedVar') + wrappers.append(fixedVar_wrapper) + ui.input('opModFixedVar', on_change=lambda e: noneable_int_change(fixedVar_wrapper, 'value', e)) \ + .bind_value_from(fixedVar_wrapper, 'value') + + # fixedWatt_wrapper = PropertyWrapper(m.WattHour(), der_base, "opModFixedW") + # wrappers.append(fixedWatt_wrapper) + # ui.input("opModFixedW", on_change=lambda e: noneable_int_change(fixedWatt_wrapper, "value", e)) \ + # .bind_value_from(fixedWatt_wrapper, "value") + ui.input('opModFixedW', on_change=lambda e: noneable_int_change(der_base, 'opModFixedW', e)) \ + .bind_value_from(der_base, 'opModFixedW') + + # freqDroop_wrapper = Wrapper(m.FreqDroopType(), der_base, "openLoopTms") + # wrappers.append(freqDroop_wrapper) + # opModFreqDroop = ui.input("opModFreqDroop", + # on_change=lambda e: noneable_int_change(freqDroop_wrapper, "openLoopTms", e)) \ + # .bind_value_from(freqDroop_wrapper, "openLoopTms") + + ui.input('opModMaxLimW', on_change=lambda e: noneable_int_change(der_base, 'opModMaxLimW', e)) \ + .bind_value_from(der_base, 'opModMaxLimW') + + with ui.column().classes('pr-10'): + opModTargetVar_wrapper = PropertyWrapper(m.ReactivePower(), der_base, 'opModTargetVar') + wrappers.append(opModTargetVar_wrapper) + ui.input('opModTargetVar', on_change=lambda e: noneable_int_change(opModTargetVar_wrapper, 'value', e)) \ + .bind_value_from(opModTargetVar_wrapper, 'value') + + opModTargetW_wrapper = PropertyWrapper(m.ActivePower(), der_base, 'opModTargetW') + wrappers.append(opModTargetW_wrapper) + ui.input('opModTargetW', on_change=lambda e: noneable_int_change(opModTargetW_wrapper, 'value', e)) \ + .bind_value_from(opModTargetW_wrapper, 'value') + + # opModVoltVar = ui.input("opModVoltVar", + # on_change=lambda e: noneable_int_change(der_base, "opModVoltVar", e)) \ + # .bind_value_from(der_base, "opModVoltVar") + # opModWattPF = ui.input("opModWattPF", + # on_change=lambda e: noneable_int_change(der_base, "opModWattPF", e)) \ + # .bind_value_from(der_base, "opModWattPF") + ui.input('rampTms', on_change=lambda e: noneable_int_change(der_base, 'rampTms', e)) \ + .bind_value_from(der_base, 'rampTms') + # render_default_control(der_base) + + def store_default_der_control(): + try: + _log.debug(f'Before Apply {der_base}') + _log.debug(default) + for wrapper in wrappers: + _log.debug(f'Wrapper parent object {id(wrapper.parent_obj)} {wrapper.parent_obj}') + wrapper.apply_to_parent() + _log.debug( + f'Wrapper parent object after apply {id(wrapper.parent_obj)} {wrapper.parent_obj}' + ) + + _log.debug(f'After Apply {der_base}') + base_payload = dataclass_to_xml(der_base) + _log.warning(base_payload) + payload = dataclass_to_xml(default) + put_as_admin(program.DefaultDERControlLink.href, payload) + ui.notify('Default DER Control Updated') + render_der_default_control_tab.refresh() + except xsdata.exceptions.ParserError as ex: + ui.notify(ex.message, type='negative') + + with ui.row().classes('pt-10'): + with ui.column(): + ui.button('Save', on_click=lambda: store_default_der_control()) + + +@ui.refreshable +def render_der_status_tab(): + + def do_refresh(): + render_der_status_tab.refresh() + ui.notify('Refreshed') + + settings: m.DERSettings = get_from_server(der.DERSettingsLink.href, deserialize=True) + status: m.DERStatus = get_from_server(der.DERStatusLink.href, deserialize=True) + capabilities: m.DERCapability = get_from_server(der.DERCapabilityLink.href, deserialize=True) + with ui.row(): + with ui.label('DER Status').style('font-size: 200%;'): + ui.button(icon='refresh', color='white', + on_click=lambda: do_refresh()).style('margin:5px; padding: 5px;') + # ui.icon("refresh", size="sm").style("cursor: pointer; vertical-align: center; padding-left: 5px;") \ + # .on_click(lambda: render_der_status_tab.refresh()) + with ui.row(): + with ui.column(): + ui.label('Section 10.10.4.4 DER info resources from 20305-2018 IEEE standard.') + + columns = [{ + 'name': 'key', + 'label': 'Key', + 'field': 'key', + 'required': True + }, { + 'name': 'value', + 'label': 'Value', + 'field': 'value', + 'required': True + }] + + rows = [] + + for fld in fields(status): + if getattr(status, fld.name): + rows.append(dict(key=fld.name, value=str(getattr(status, fld.name)))) + + with ui.row(): + with ui.column(): + ui.label('DER Status').style('font-size: 150%;') + + with ui.row(): + with ui.column(): + ui.table(columns=columns, rows=rows) + + rows = [] + + for fld in fields(settings): + if getattr(settings, fld.name): + rows.append(dict(key=fld.name, value=getattr(settings, fld.name))) + + with ui.row(): + with ui.column(): + ui.label('DER Settings').style('font-size: 150%;') + + with ui.row(): + with ui.column(): + ui.table(columns=columns, rows=rows) + + rows = [] + + for fld in fields(capabilities): + if getattr(capabilities, fld.name): + rows.append(dict(key=fld.name, value=getattr(capabilities, fld.name))) + + with ui.row(): + with ui.column(): + ui.label('DER Capabilities').style('font-size: 150%;') + + with ui.row(): + with ui.column(): + ui.table(columns=columns, rows=rows) + + +@ui.refreshable +def render_der_control_list_tab(): + + def do_refresh(): + render_der_control_list_tab.refresh() + ui.notify('Refreshed') + + control_list: m.DERControlList = get_from_server(program.DERControlListLink.href, + deserialize=True, + limit=1000) + + #active_list: m.DERControlList = get_from_server(program.ActiveDERControlListLink.href, deserialize=True) + + with ui.row(): + with ui.column(): + with ui.label('DER Control List').style('font-size: 200%;'): + ui.button(icon='refresh', color='white', + on_click=lambda: do_refresh()).style('margin:5px; padding: 5px;') + ui.label( + 'Section 10.10 Distributed Energy Resources function set from 20305-2018 IEEE standard.' + ) + + columns = [{ + 'name': 'time', + 'label': 'Event Time', + 'field': 'time', + 'required': True + }, { + 'name': 'duration', + 'label': 'Event Duration', + 'field': 'duration', + 'required': True + }, { + 'name': 'status', + 'label': 'Event Status', + 'field': 'status', + 'required': True + }, { + 'name': 'control', + 'label': 'Control', + 'field': 'control', + 'required': True + }] + + def status_to_string(status: int): + if status == 0: + return 'Scheduled' + elif status == 1: + return 'Active' + elif status == 2: + return 'Cancelled' + elif status == 3: + return 'Supersceded' + elif status == 5: + return 'Completed' + else: + return 'Unknown' + + def build_list_rows(ctrl_list: m.DERControlList): + control_list_rows = [] + + def nonnone(control: m.DERControl): + dct = {} + + for obj, val in control.DERControlBase.__dict__.items(): + if val is not None: + if hasattr(val, 'value'): + val = val.value + elif hasattr(val, 'displacement'): + val = val.displacement + dct[obj] = val + return pformat(dct) + + for ctrl in sorted(ctrl_list.DERControl, key=lambda x: x.interval.start, reverse=True): + if ctrl.interval: + if ctrl.EventStatus is None and ctrl.interval.start and ctrl.interval.duration: + ctrl.EventStatus = m.EventStatus(currentStatus=0) # Scheduled. + local_dt = datetime_from_utc_to_local( + datetime.utcfromtimestamp(ctrl.interval.start)) + + row = { + 'time': local_dt, + 'duration': ctrl.interval.duration, + 'status': status_to_string(ctrl.EventStatus.currentStatus), + 'control': nonnone(ctrl) + } + + control_list_rows.append(row) + return control_list_rows + + with ui.row(): + with ui.column(): + ui.label('Control Events').style('font-size: 150%') + + # with ui.row(): + # with ui.column(): + # ui.table(columns=columns, rows=build_list_rows(active_list, 1)) + + # with ui.row(): + # with ui.column(): + # ui.label("Scheduled Controls").style("font-size: 150%") + + with ui.row(): + with ui.column(): + ui.table(columns=columns, rows=build_list_rows(control_list)) + + # with ui.row(): + # with ui.column(): + # ui.label("Completed Controls").style("font-size: 150%") + + # with ui.row(): + # with ui.column(): + # ui.table(columns=columns, rows=build_list_rows(control_list, 5)) + + +@ui.refreshable +def render_new_der_control_tab(): + # Need to start with the default control base before overwriting values from the new + # base control. + default: m.DefaultDERControl = get_from_server(program.DefaultDERControlLink.href, + deserialize=True) + der_base: m.DERControlBase = default.DERControlBase + wrappers: List[PropertyWrapper] = [] + if der_base is None: + der_base = m.DERControlBase() + default.DERControlBase = der_base + + def do_refresh(): + render_new_der_control_tab.refresh() + ui.notify('Refreshed') + + with ui.row(): + with ui.column(): + with ui.label('DER Control Entry').style('font-size: 200%;'): + ui.button(icon='refresh', color='white', + on_click=lambda: do_refresh()).style('margin:5px; padding: 5px;') + ui.label( + 'Section 10.10 Distributed Energy Resources function set from 20305-2018 IEEE standard.' + ) + + with ui.row().classes('pt-5'): + with ui.column(): + ui.label(f'DERProgram {der.CurrentDERProgramLink.href}').style('font-size: 150%') + + new_control = m.DERControl(mRID=uuid_2030_5(), DERControlBase=der_base) + + def submit_new_control(): + + for wrapper in wrappers: + if not wrapper.should_be_none(): + wrapper.apply_to_parent() + + event_start_time = datetime.fromtimestamp(new_control.interval.start) + + if event_start_time < datetime.utcnow(): + # Focus on the date time input. + ui.notify('Event Start Time must be in the future', type='error') + from_date.run_method('focus') + return + new_control.DERControlBase = der_base + + _log.debug(f'Date Time Sending: {datetime.fromtimestamp(new_control.interval.start)}') + + _log.debug(dataclass_to_xml(new_control)) + response = post_as_admin(program.DERControlListLink.href, + data=dataclass_to_xml(new_control)) + + ui.notify('New Control Complete') + render_der_control_list_tab.refresh() + panels.set_value('dercontrollist') + render_new_der_control_tab.refresh() + + def set_date(obj, prop, e): + try: + dt = parse_timestamp_string(e.value) + setattr(obj, prop, e.value) + except ParserError: + _log.debug(f'Invalid datetime specified: {e.value}') + + with ui.row(): + with ui.column(): + interval_wrapper = PropertyWrapper( + m.DateTimeInterval(duration=30, start=datetime.now() + timedelta(seconds=30)), + new_control, + 'interval', + formatters=dict(start=parse_timestamp_string), + applyers=dict(start=convert_local_dt_to_utc_timestamp)) + wrappers.append(interval_wrapper) + from_date = ui.input('Event Start', value=getattr(interval_wrapper, 'start'), + on_change=lambda e: set_date(interval_wrapper, 'start', e)) \ + .classes('w-96') + duration = ui.number('Duration', min=0, value=getattr(interval_wrapper, 'duration')) \ + .bind_value_from(interval_wrapper, 'duration') + + ui.input('MRID').bind_value(new_control, 'mRID').classes('w-96') + + with ui.column().classes('pr-20'): + ui.checkbox('opModConnect', value=True).bind_value(der_base, 'opModConnect') + ui.checkbox('opModEnergize', value=True).bind_value(der_base, 'opModEnergize') + + with ui.column().classes('pr-20'): + ui.label('Power Factor Absorb Watts').style('font-size: 125%;') + if der_base.opModFixedPFAbsorbW is None: + der_base.opModFixedPFAbsorbW = m.PowerFactorWithExcitation() + opModFixedPFAbsorbW_wrapper = PropertyWrapper(der_base.opModFixedPFAbsorbW, der_base, + 'opModFixedPFAbsorbW') + wrappers.append(opModFixedPFAbsorbW_wrapper) + ui.input('displacement', on_change=lambda e: noneable_int_change(opModFixedPFAbsorbW_wrapper, 'displacement', e)) \ + .bind_value_from(opModFixedPFAbsorbW_wrapper, 'displacement') + ui.checkbox('excitation', value=False).bind_value(opModFixedPFAbsorbW_wrapper, + 'excitation') + + ui.label('Power Factor Inject Watts').style('font-size: 125%;') + if der_base.opModFixedPFInjectW is None: + der_base.opModFixedPFInjectW = m.PowerFactorWithExcitation() + opModFixedPFInjectW_wrapper = PropertyWrapper(der_base.opModFixedPFInjectW, der_base, + 'opModFixedPFInjectW') + wrappers.append(opModFixedPFInjectW_wrapper) + ui.input('displacement', on_change=lambda e: noneable_int_change(opModFixedPFInjectW_wrapper, 'displacement', e)) \ + .bind_value_from(opModFixedPFInjectW_wrapper, 'displacement') + ui.checkbox('excitation', value=False).bind_value(opModFixedPFInjectW_wrapper, + 'excitation') + + with ui.column().classes('pr-20'): + if der_base.opModFixedVar is None: + der_base.opModFixedVar = m.FixedVar() + fixedVar_wrapper = PropertyWrapper(der_base.opModFixedVar, der_base, 'opModFixedVar') + wrappers.append(fixedVar_wrapper) + ui.input('opModFixedVar', on_change=lambda e: noneable_int_change(fixedVar_wrapper, 'value', e)) \ + .bind_value_from(fixedVar_wrapper, 'value') + + # Note this is not using PropertyWrapper because it is defined as an int in the xsd. + ui.input('opModFixedW', on_change=lambda e: noneable_int_change(der_base, 'opModFixedW', e)) \ + .bind_value_from(der_base, 'opModFixedW') + + # freqDroop_wrapper = Wrapper(m.FreqDroopType(), der_base, "openLoopTms") + # wrappers.append(freqDroop_wrapper) + # opModFreqDroop = ui.input("opModFreqDroop", + # on_change=lambda e: noneable_int_change(freqDroop_wrapper, "openLoopTms", e)) \ + # .bind_value_from(freqDroop_wrapper, "openLoopTms") + + ui.input('opModMaxLimW', on_change=lambda e: noneable_int_change(der_base, 'opModMaxLimW', e)) \ + .bind_value_from(der_base, 'opModMaxLimW') + + with ui.column().classes('pr-20'): + if der_base.opModTargetVar is None: + der_base.opModTargetVar = m.ReactivePower() + opModTargetVar_wrapper = PropertyWrapper(der_base.opModTargetVar, der_base, + 'opModTargetVar') + wrappers.append(opModTargetVar_wrapper) + ui.input('opModTargetVar', on_change=lambda e: noneable_int_change(opModTargetVar_wrapper, 'value', e)) \ + .bind_value_from(opModTargetVar_wrapper, 'value') + + if der_base.opModTargetW is None: + der_base.opModTargetW = m.ActivePower() + opModTargetW_wrapper = PropertyWrapper(der_base.opModTargetW, der_base, 'opModTargetW') + wrappers.append(opModTargetW_wrapper) + ui.input('opModTargetW', on_change=lambda e: noneable_int_change(opModTargetW_wrapper, 'value', e)) \ + .bind_value_from(opModTargetW_wrapper, 'value') + + # opModVoltVar = ui.input("opModVoltVar", + # on_change=lambda e: noneable_int_change(der_base, "opModVoltVar", e)) \ + # .bind_value_from(der_base, "opModVoltVar") + # opModWattPF = ui.input("opModWattPF", + # on_change=lambda e: noneable_int_change(der_base, "opModWattPF", e)) \ + # .bind_value_from(der_base, "opModWattPF") + ui.input('rampTms', on_change=lambda e: noneable_int_change(der_base, 'rampTms', e)) \ + .bind_value_from(der_base, 'rampTms') + + # with ui.row().classes("pt-10"): + # with ui.column().classes("pr-20"): + # ui.label("Curve Selection") + # ui.label("TODO") + + with ui.row().classes('pt-20'): + with ui.column(): + ui.button('Sumbit Control', on_click=lambda: submit_new_control()) + + +@ui.refreshable +def render_usage_points_tab(): + + def do_refresh(): + render_usage_points_tab.refresh() + ui.notify('Refreshed') + + usage_points: m.UsagePointList = get_from_server(dcap.UsagePointListLink.href, + deserialize=True, + limit=10) + + nodes = [] + + for upt in usage_points.UsagePoint: + upt_node = {'id': upt.href, 'label': upt.href, 'children': []} + nodes.append(upt_node) + meter_reading: m.MeterReadingList = get_from_server(upt.MeterReadingListLink.href, + deserialize=True, + limit=10) + for mr in meter_reading.MeterReading: + mr_node = {'id': mr.href, 'label': mr.description, 'children': []} + upt_node['children'].append(mr_node) + + if mr.ReadingLink is not None and mr.ReadingLink.href is not None: + readings_list: m.ReadingList = get_from_server(mr.ReadingLink.href, + deserialize=True, + limit=10) + if len(readings_list.Reading) > 0: + reading_node = {'id': reading.href, 'label': 'Readings', 'children': []} + mr_node['children'].append(reading_node) + for reading in readings_list.Reading: + read_node = {'id': reading.href, 'label': reading.href, 'children': []} + reading_node['children'].append(read_node) + + if mr.ReadingSetListLink is not None and mr.ReadingSetListLink.href is not None: + readingset_list: m.ReadingSetList = get_from_server(mr.ReadingSetListLink.href, + deserialize=True, + limit=10) + reading_node = {'id': readingset_list.href, 'label': 'Readings', 'children': []} + mr_node['children'].append(reading_node) + for rs in readingset_list.ReadingSet: + if rs.ReadingListLink is not None and rs.ReadingListLink.href is not None: + reading_list: m.ReadingList = get_from_server(rs.ReadingListLink.href, + deserialize=True, + limit=10) + for rdng in reading_list.Reading: + if rdng.timePeriod is not None: + period = rdng.timePeriod + else: + period = rs.timePeriod + + if period is not None: + period = timestamp_to_string(period.start) + read_node = { + 'id': rdng.href, + 'label': f'{period} Value: {rdng.value}', + 'children': [] + } + reading_node['children'].append(read_node) + + with ui.row(): + with ui.column(): + with ui.label('Usage Points').style('font-size: 200%;'): + ui.button(icon='refresh', color='white', + on_click=lambda: do_refresh()).style('margin:5px; padding: 5px;') + ui.label( + 'Section 10.10 Distributed Energy Resources function set from 20305-2018 IEEE standard.' + ) + with ui.row(): + ui.tree(nodes=nodes) + + +with ui.header(): + current_time_label = ui.label('Current Time') + ui.timer( + 1.0, lambda: current_time_label.set_text( + f'Local Time: {datetime.now().isoformat()} GMT TS: {convert_local_dt_to_utc_timestamp(datetime.now())}' + )) +with ui.tabs().classes('w-full') as tabs: + configuration_tab = ui.tab('configuration', 'Configuration') + der_default_control_tab = ui.tab('derdefaultcontrol', 'DER Default Control') + new_der_control_tab = ui.tab('newdercontrol', 'New DER Control') + der_control_list_tab = ui.tab('dercontrollist', 'DER Control List') + der_status_tab = ui.tab('derstatus', 'DER Status') + usage_point_tab = ui.tab('usage_point', 'Usage Points') + #results_tab = ui.tab("results", "Results") +line_plot = None +with ui.tab_panels(tabs, value=configuration_tab).classes('w-full') as panels: + with ui.tab_panel(configuration_tab): + with ui.row(): + with ui.column(): + ui.input('2030.5 Identity').classes('w-96').bind_value( + config_working, 'agent_2030_5_identity') + ui.input('VOLTTRON home').classes('w-96').bind_value(config_working, + 'volttron_home') + ui.input('EndDevice private').classes('w-96').bind_value( + config_working, 'ieee_client_pk') + ui.input('EndDevice cert').classes('w-96').bind_value( + config_working, 'ieee_client_cert') + ui.input('CA cert').classes('w-96').bind_value(config_working, 'ieee_ca') + + with ui.row().classes('p-10'): + ui.button('Save', on_click=lambda: save_config()) + ui.button('Reset', on_click=lambda: reset_config()) + + with ui.tab_panel(new_der_control_tab): + render_new_der_control_tab() + + with ui.tab_panel(der_default_control_tab): + render_der_default_control_tab() + + with ui.tab_panel(der_control_list_tab): + render_der_control_list_tab() + ui.timer(10, lambda: render_der_control_list_tab.refresh()) + + with ui.tab_panel(der_status_tab): + render_der_status_tab() + + with ui.tab_panel(usage_point_tab): + render_usage_points_tab() + +logging.basicConfig(level=logging.DEBUG) + +excludes = '.*, .py[cod], .sw.*, ~*,*.git,' +ui.run(reload=True, show=False, uvicorn_reload_excludes=excludes) diff --git a/services/core/IEEE_2030_5/example.config.yml b/services/core/IEEE_2030_5/example.config.yml new file mode 100644 index 0000000000..fa85a8583b --- /dev/null +++ b/services/core/IEEE_2030_5/example.config.yml @@ -0,0 +1,84 @@ +# These are required in order for the agent to connect to the server. +cacertfile: ~/tls/certs/ca.crt +keyfile: ~/tls/private/dev1.pem +certfile: ~/tls/certs/dev1.crt +server_hostname: 127.0.0.1 + +# the pin number is used to verify the server is the correct server +pin: 111115 + +# Log the request and responses from the server. +log_req_resp: true + +# SSL defaults to 443 +server_ssl_port: 8443 + +# Number of seconds to poll for new default der settings. +default_der_control_poll: 10 + +MirrorUsagePointList: + # MirrorMeterReading based on Table E.2 IEEE Std 2030.5-18 + - device_point: INV_REAL_PWR + mRID: 5509D69F8B3535950000000000009182 + description: DER Inverter Real Power + roleFlags: 49 + serviceCategoryKind: 0 + status: 0 + MirrorMeterReading: + mRID: 5509D69F8B3535950000000000009183 + description: Real Power(W) Set + ReadingType: + accumulationBehavior: 12 + commodity: 1 + dataQualifier: 2 + intervalLength: 300 + powerOfTenMultiplier: 0 + uom: 38 + - device_point: INV_REAC_PWR + mRID: 5509D69F8B3535950000000000009184 + description: DER Inverter Reactive Power + roleFlags: 49 + serviceCategoryKind: 0 + status: 0 + MirrorMeterReading: + mRID: 5509D69F8B3535950000000000009185 + description: Reactive Power(VAr) Set + ReadingType: + accumulationBehavior: 12 + commodity: 1 + dataQualifier: 2 + intervalLength: 300 + powerOfTenMultiplier: 0 + uom: 38 + +# publishes on the following subscriptions will +# be available to create and POST readings to the +# 2030.5 server. +device_topic: devices/inverter1 + +# Nameplate ratings for this der client will be put to the +# server during startup of the system. +DERCapability: + # modesSupported is a HexBinary31 representation of DERControlType + # See Figure B.34 DER info types for information + # conversion in python is as follows + # "{0:08b}".format(int("500040", 16)) + # '10100000000000001000000' # This is a bitmask + # to generate HexBinary + # hex(int('10100000000000001000000', 2)) + # 0x500040 + modesSupported: 500040 + rtgMaxW: + multiplier: 0 + value: 0 + type: 0 + +DERSettings: + modesEnabled: 100000 + setGradW: 0 + setMaxW: + multiplier: 0 + value: 0 + +# Note this file MUST be in the config store or this agent will not run properly. +point_map: config:///inverter_sample.csv diff --git a/services/core/IEEE_2030_5/ieee_2030_5/__init__.py b/services/core/IEEE_2030_5/ieee_2030_5/__init__.py new file mode 100644 index 0000000000..af7f4fa643 --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/__init__.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Any, Dict, List +from dataclasses import dataclass, is_dataclass +from pathlib import Path +from typing import Type, Optional + +from xsdata.formats.dataclass.context import XmlContext +from xsdata.formats.dataclass.parsers.config import ParserConfig +from xsdata.formats.dataclass.parsers.xml import XmlParser +from xsdata.formats.dataclass.serializers import XmlSerializer +from xsdata.formats.dataclass.serializers.config import SerializerConfig + +__xml_context__ = XmlContext() +__parser_config__ = ParserConfig(fail_on_unknown_attributes=False, + fail_on_unknown_properties=False) +__xml_parser__ = XmlParser(config=__parser_config__, context=__xml_context__) +__config__ = SerializerConfig(xml_declaration=False, pretty_print=True) +__serializer__ = XmlSerializer(config=__config__) +__ns_map__ = {None: 'urn:ieee:std:2030.5:ns'} + + +def serialize_dataclass(obj) -> str: + """ + Serializes a dataclass that was created via xsdata to an xml string for + returning to a client. + """ + if not is_dataclass(obj): + raise ValueError('Invalid object, must be a dataclass object.') + + return __serializer__.render(obj, ns_map=__ns_map__) + + +def xml_to_dataclass(xml: str, type: Optional[Type] = None) -> object: + """ + Parse the xml passed and return result from loaded classes. + """ + return __xml_parser__.from_string(xml, type) + + +def dataclass_to_xml(dc) -> str: + return serialize_dataclass(dc) + + +@dataclass +class AllPoints: + points: Dict = field(default_factory=dict) + meta: Dict = field(default_factory=dict) + + def add(self, name: str, value: Any, meta: Dict = {}): + self.points[name] = value + self.meta[name] = meta + + def get(self, name: str) -> Any: + return self.points[name] + + def forbus(self) -> List: + return [self.points, self.meta] + + @staticmethod + def frombus(message: List) -> AllPoints: + assert len(message) == 2, 'Message must have a length of 2' + + points = AllPoints() + + for k, v in message[0].items(): + points.add(name=k, value=v, meta=message[1].get(k)) + + return points + + +import ieee_2030_5.models as models diff --git a/services/core/IEEE_2030_5/ieee_2030_5/agent.py b/services/core/IEEE_2030_5/ieee_2030_5/agent.py new file mode 100644 index 0000000000..7bb765c0bf --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/agent.py @@ -0,0 +1,885 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from __future__ import annotations +from copy import deepcopy +from dataclasses import dataclass, field, fields +import math +import logging +import sys +from datetime import datetime +from pathlib import Path +from pprint import pformat +from typing import Any, Dict, List + +import ieee_2030_5.models as m +from volttron.platform.agent.known_identities import PLATFORM_DRIVER +from . import AllPoints +from .client import IEEE2030_5_Client + +try: # for modular + from volttron import utils + from volttron.client.messaging.health import STATUS_GOOD + from volttron.client.vip.agent import RPC, Agent, Core, PubSub + from volttron.client.vip.agent.subsystems.query import Query + from volttron.utils.commands import vip_main +except ImportError: + from volttron.platform.agent import utils + from volttron.platform.agent.utils import vip_main + from volttron.platform.vip.agent import RPC, Agent, Core, PubSub + from volttron.platform.vip.agent.subsystems.query import Query + +# from . import __version__ +__version__ = '0.1.0' + +# Setup logging so that it runs within the platform +utils.setup_logging() + +logging.getLogger('ieee_2030_5.client.req_resp').setLevel(logging.INFO) +# The logger for this agent is _log and can be used throughout this file. +_log = logging.getLogger(__name__) + +# These items are global for the agent and will periodically be +# sent to the 2030.5 server based upon the post interval. +DER_SETTINGS = m.DERSettings() +DER_CAPABILITIES = m.DERCapability() +# This is used for default control and control events. +DER_CONTROL_BASE = m.DERControlBase() +# Used for sending status message to the 2030.5 server. +DER_STATUS = m.DERStatus() +# Used for sending default control to the 2030.5 server. +DEFAULT_DER_CONTROL = m.DefaultDERControl() +DEFAULT_DER_CONTROL.DERControlBase = DER_CONTROL_BASE + + +@dataclass +class MappedPoint: + """The MappedPoint class models the mapping points. + + The MappedPoint class allows mapping of points from/to the platform.driver and + 2030.5 objects. + + Only points that have point_on_bus and parameter_type will be mapped. + + The format of the parameter_type is :: where object is one of + DERSettings, DERCapability, DERControlBase, or DERStatus. The property must be + a valid property of the object. + """ + + point_on_bus: str + description: str + multiplier: int + mrid: str + offset: int + parameter_type: str + notes: str + parent_object: object = None + parameter: str = None + value_2030_5: Any = None + changed: bool = False + + def reset_changed(self): + self.changed = False + + def set_value(self, value: Any): + current_value = getattr(self.parent_object, self.parameter) + if value != current_value: + setattr(self.parent_object, self.parameter, value) + self.changed = True + + def __post_init__(self): + """Post initialization of the MappedPoint object. + + This method is called after the object is initialized. It is used to + verify that the parameter_type is valid and that the parent_object and + parameter are set correctly. The parent_object is the object that the + parameter is a property of. + + The parameter_type must be in the format :: where object + is one of DERSettings, DERCapability, DERControlBase, or DERStatus. + """ + params = self.parameter_type.split('::') + + # Only if we have a proper object specifier that we know about + if len(params) == 2: + if params[0] == 'DERSettings': + self.parent_object = DER_SETTINGS + elif params[0] == 'DERCapability': + self.parent_object = DER_CAPABILITIES + elif params[0] == 'DERControlBase': + self.parent_object = DER_CONTROL_BASE + elif params[0] == 'DERStatus': + self.parent_object = DER_STATUS + elif params[0] == 'DefaultDERControl': + self.parent_object = DEFAULT_DER_CONTROL + + assert self.parent_object is not None, f'The parent object type {params[0]} is not known, please check spelling in configuration file.' + assert hasattr( + self.parent_object, params[1] + ), f'{params[0]} does not have property {params[1]}, please check spelling in configuration file.' + self.parameter = params[1] + + @staticmethod + def build_from_csv(data: Dict[str, str]) -> MappedPoint: + """Create a mapped point from a row of data. + + :param data: A row of data from the point_map csv file. + :type data: Dict[str, str] + :return: A mapped point object. + :rtype: MappedPoint + """ + return MappedPoint(point_on_bus=data['Point Name'].strip(), + description=data['Description'].strip(), + multiplier=data['Multiplier'].strip(), + mrid=data['MRID'].strip(), + offset=data['Offset'].strip(), + parameter_type=data['Parameter Type'].strip(), + notes=data['Notes'].strip()) + + +class IEEE_2030_5_Agent(Agent): + """ + IEEE_2030_5_Agent + """ + + def __init__(self, config_path: str, **kwargs): + """Initialize the IEEE 2030.5 agent. + + The IEEE 2030.5 agent is responsible for connecting to the IEEE 2030.5 server and + sending it data from the platform driver. The agent is also responsible for + creating MirrorUsagePoints on the IEEE 2030.5 server and sending data from the + platform driver to the IEEE 2030.5 server based upon those MirrorUsagePoints. + The configuration file holds information in order for the 2030.5 agent to accomplish + these tasks. + + In addition, the 2030.5 agent will poll the IEEE 2030.5 server for DERControl, and + DefaultDERControl objects. The DefaultDERControl object is used to set the default + mode of operation for the DER. When the DefaultDERControl object is updated, the + 2030.5 agent will send the updated values to the platform driver. During a DERControl + event, the 2030.5 agent will send the DERControl object data to the platform driver. + Once the DERControl event has ended, the 2030.5 agent will revert back to the + DefaultDERControl object and send that object to the platform driver. + + The Mapping of points from/to the platform driver and 2030.5 objects is done via the + config store entry point_map field within the configuration file. + + :param config_path: A path to the configuration file that holds the + defaults for the agent and connection to the + IEEE 2030.5 server. + :type config_path: str + """ + super().__init__(**kwargs) + _log.debug('vip_identity: ' + self.core.identity) + + config = utils.load_config(config_path) + + self._cacertfile = Path(config['cacertfile']).expanduser() + self._keyfile = Path(config['keyfile']).expanduser() + self._certfile = Path(config['certfile']).expanduser() + self._pin = config['pin'] + self._log_req_resp = bool(config.get('log_req_resp', False)) + if config['device_topic'].endswith('/all'): + config['device_topic'] = config['device_topic'][:-len('/all')] + self._device_topic = config['device_topic'] + self._control_point = config['device_topic'] + if self._control_point.startswith('devices/'): + self._control_point = self._control_point[len('devices/'):] + self._server_hostname = config['server_hostname'] + self._server_ssl_port = config.get('server_ssl_port', 443) + self._server_http_port = config.get('server_http_port', None) + self._mirror_usage_point_list = config.get('MirrorUsagePointList', []) + self._der_capabilities_info = config.get('DERCapability') + self._der_settings_info = config.get('DERSettings') + self._der_status_info = config.get('DERStatus') + #self._point_map = config.get("point_map") + self._mapped_points: Dict[str, MappedPoint] = {} + self._default_config = { + 'device_topic': self._device_topic, + 'MirrorUsagePointList': self._mirror_usage_point_list, + 'point_map': config.get('point_map'), + 'default_der_control_poll': int(config.get('default_der_control_poll', 60)) + } + self._topic_without_prefix: str = self._device_topic[self._device_topic.find('devices/') + + len('devices/'):] + self._server_usage_points: m.UsagePointList + + self._client = IEEE2030_5_Client(cafile=self._cacertfile, + server_hostname=self._server_hostname, + keyfile=self._keyfile, + certfile=self._certfile, + server_ssl_port=self._server_ssl_port, + pin=self._pin, + log_req_resp=self._log_req_resp) + + # Hook events up to the client so that we can send the correct information on to + # the platform driver. + self._client.der_control_event_started(self._control_event_started) + self._client.der_control_event_ended(self._control_event_ended) + self._client.der_default_control_changed(self._default_control_changed) + + # These objects are constructed from the platform driver's publishes + self._last_settings = m.DERSettings() + self._last_capabilities = m.DERCapability() + self._last_status = m.DERStatus() + + # These variables represent the current state of the der and + self._active_controls: List[m.DERControl] = [] + self._default_der_control: m.DefaultDERControl = None + self._current_control: m.DERControl = None + + try: + self._client.start(config=self._default_config) + except ConnectionRefusedError: + _log.error(f'Could not connect to server {self._server_hostname} agent exiting.') + sys.exit(1) + except ValueError as e: + _log.error(e) + sys.exit(1) + _log.info(self._client.enddevice) + assert self._client.enddevice + ed = self._client.enddevice + self._client.get_der_list() + self._point_to_reading_set: Dict[str, str] = {} + self._mirror_usage_points: Dict[str, m.MirrorUsagePoint] = {} + self._mup_readings: Dict[str, m.MirrorMeterReading] = {} + self._mup_pollRate: int = 60 + self._times_published: Dict[str, int] = {} + + # Set a default configuration to ensure that self.configure is called immediately to setup + # the agent. + self.vip.config.set_default('config', self._default_config) + # Hook self.configure up to changes to the configuration file "config". + self.vip.config.subscribe(self.configure, actions=['NEW', 'UPDATE'], pattern='config') + + def _active_controls_changed(self, active: m.DERControlList): + """Callback when the active controls have changed on the IEEE 2030.5 server. + + :param active: A list of active controls + :type active: m.DERControlList + """ + if not isinstance(active, m.DERControlList): + _log.error('Invalid instance passed to active control changed') + return + _log.debug('Active controls changed') + + def _default_control_changed(self, default_control: m.DefaultDERControl): + """Calback when the default control has changed on the IEEE 2030.5 server. + + @param: default_control: The new default control. + @type: default_control: m.DefaultDERControl + """ + if not isinstance(default_control, m.DefaultDERControl): + _log.error('Invalid instance of default control') + raise ValueError(f'Invalid instance of default control was {type(default_control)}') + + if self._current_control is not None: + _log.info('Default config has been overwritten by event.') + return + _log.info('Sending default control to platform.driver') + + self._default_der_control = default_control + + default_control_points = list( + filter(lambda x: 'DefaultDERControl' in x.parameter_type, + self._mapped_points.values())) + der_base_points = list( + filter(lambda x: 'DERControlBase' in x.parameter_type, self._mapped_points.values())) + + for point in default_control_points: + point_value = getattr(default_control, point.parameter) + + try: + if point_value: + if not isinstance(point_value, (float, int, bool)): + point_value = getattr(point_value, 'value') + + if point_value: + self.vip.rpc.call(PLATFORM_DRIVER, 'set_point', self._control_point, + point.point_on_bus, point_value) + except TypeError: + _log.error(f'Error setting point {point.point_on_bus} to {point_value}') + except KeyError: + _log.error(f'Error setting point {point.point_on_bus} to {point_value}') + + for point in der_base_points: + + point_value = getattr(default_control.DERControlBase, point.parameter) + + try: + if point_value: + if not isinstance(point_value, (float, int, bool)): + point_value = getattr(point_value, 'value') + + if point_value: + self.vip.rpc.call(PLATFORM_DRIVER, 'set_point', self._control_point, + point.point_on_bus, point_value) + except TypeError: + _log.error(f'Error setting point {point.point_on_bus} to {point_value}') + + def _control_event_started(self, control: m.DERControl): + """A control event has started. + + :param control: The control that has started. + :type control: m.DERControl + :raises ValueError: If the control is not an instance of m.DERControl + """ + _log.debug(f"{'='*50}Control event started") + if not isinstance(control, m.DERControl): + _log.error('Invalid control event passed to event_started') + raise ValueError( + f'Invalid type passed to event_started {type(control)} instead of {type(m.DERControl)}' + ) + + self._current_control = control + der_control: m.DERControl = control + # We override some of the base controls with the event controls + der_control_base: m.DERControlBase = None + if self._default_der_control is not None and self._default_der_control.DERControlBase is not None: + der_control_base = deepcopy(self._default_der_control.DERControlBase) + + if der_control_base: + # Overwrite all of the base controls with the controls from the event. + for fld in fields(m.DERControlBase): + setattr(der_control_base, fld.name, getattr(der_control.DERControlBase, fld.name)) + else: + der_control_base = der_control.DERControlBase + + # Retrieve mapped points that we can report on to the platform driver. + # Note this is a DERControlBase prefix in the parameter_type field. + der_base_points = list( + filter(lambda x: 'DERControlBase' in x.parameter_type, self._mapped_points.values())) + + for point in der_base_points: + + point_value = getattr(der_control_base, point.parameter) + + try: + if point_value: + # These are the point types that have a multiplyer assigned to them. + if isinstance(point_value, + (m.VoltageRMS, m.ApparentPower, m.PowerFactor, m.CurrentRMS, + m.ActivePower, m.WattHour, m.ReactivePower, m.FixedPointType)): + if isinstance(point_value, m.PowerFactor): + point_value = point_value.displacement * math.pow( + 10, -point_value.multiplier) + elif point_value.value is not None and point_value.multiplier is not None: + point_value = point_value.value * math.pow(10, -point_value.multiplier) + else: + point_value = None + elif isinstance(point_value, m.FixedVar): + # TODO: Deal with ref type? + point_value = point_value.value + + elif isinstance(point_value, m.DERCurveLink): + # TODO Handle DERCurve Types + ... + elif isinstance(point_value, bool): + point_value = 1 if point_value else 0 + elif isinstance(point_value, m.PowerFactorWithExcitation): + point_value = point_value.displacement + + if point_value: + _log.debug(f'Setting point: {point.point_on_bus} to {point_value}') + self.vip.rpc.call(PLATFORM_DRIVER, 'set_point', point.point_on_bus, + point_value) + except TypeError: + _log.error(f'Error setting point {point.point_on_bus} to {point_value}') + + def _control_event_ended(self, control: m.DERControl): + """Callback when a control event has ended. + + When the control event ends, we need to reset the controls to the default control + specified by the IEEE 2030.5 server. + + :param control: The control that has ended. + :type control: m.DERControl + """ + _log.debug(f"{'='*50}Control event ended") + self._current_control = None + self._default_control_changed(self._default_der_control) + + def configure(self, config_name, action, contents): + """ + Called after the Agent has connected to the message bus. If a configuration exists at startup + this will be called before onstart. + + It is called every time the configuration in the store changes for this agent. + """ + config = self._default_config.copy() + config.update(contents) + + if not config.get('point_map'): + raise ValueError( + 'Must have point_map specified in config store or referenced to a config store entry!' + ) + # Only deal with points that have both on bus point and + # a 2030.5 parameter type + for item in config['point_map']: + if item.get('Point Name').strip() and item.get('Parameter Type').strip(): + if 'DERSettings' in item['Parameter Type'] or \ + 'DERCapability' in item['Parameter Type'] or \ + 'DERStatus' in item['Parameter Type'] or \ + 'DERControlBase' in item['Parameter Type'] or \ + 'DefaultDERControl' in item['Parameter Type']: + + point = MappedPoint.build_from_csv(item) + self._mapped_points[point.point_on_bus] = point + # self._mapped_points[point.parameter_type] = point + else: + _log.debug( + f"Skipping {item['Point Name']} because it does not have a valid Parameter Type" + ) + + try: + device_topic = config['device_topic'] + new_usage_points: Dict[str, m.MirrorUsagePoint] = {} + + for mup in config.get('MirrorUsagePointList', []): + device_topic_point = mup.pop('device_point') + new_usage_points[mup['mRID']] = m.MirrorUsagePoint(**mup) + new_usage_points[mup['mRID']].deviceLFDI = self._client.lfdi + new_usage_points[mup['mRID']].MirrorMeterReading = [] + new_usage_points[mup['mRID']].MirrorMeterReading.append( + m.MirrorMeterReading(**mup['MirrorMeterReading'])) + mup['device_point'] = device_topic_point + + except ValueError as e: + _log.error('ERROR PROCESSING CONFIGURATION: {}'.format(e)) + return + + self.vip.pubsub.unsubscribe(peer='pubsub', + prefix=self._device_topic, + callback=self._data_published) + + self._device_topic = device_topic + self._control_point = device_topic + if self._control_point.startswith('devices/'): + self._control_point = self._control_point[len('devices/'):] + + self._mup_readings.clear() + self._mirror_usage_points.clear() + + ed = self._client.end_device + self._mirror_usage_points.update(new_usage_points) + server_usage_points = self._client.mirror_usage_point_list() + self._mup_pollRate = server_usage_points.pollRate if server_usage_points.pollRate else self._mup_pollRate + + for mup in self._mirror_usage_points.values(): + try: + found = next( + filter(lambda x: x.mRID == mup.mRID, server_usage_points.MirrorUsagePoint)) + except StopIteration: + location = self._client.create_mirror_usage_point(mup) + mup_reading = m.MirrorMeterReading( + mRID=mup.MirrorMeterReading[0].mRID, + href=location, + description=mup.MirrorMeterReading[0].description) + rs = m.MirrorReadingSet(mRID=mup_reading.mRID + '1', + timePeriod=m.DateTimeInterval()) + rs.timePeriod.start = int(round(datetime.utcnow().timestamp())) + rs.timePeriod.duration = self._mup_pollRate + + # new mrid is based upon the mirror reading. + mup_reading.MirrorReadingSet.append(rs) + rs.Reading = [] + + self._mup_readings[mup_reading.mRID] = mup_reading + + self._server_usage_points = self._client.mirror_usage_point_list() + + _log.debug(f'Subscribing to {self._device_topic}') + self.vip.pubsub.subscribe(peer='pubsub', + prefix=self._device_topic, + callback=self._data_published) + + def _cast_multipler(self, value: str) -> int: + try: + return int(value) + except ValueError: + _log.warning(f'Casting multiplier to int failed: {value}') + return 1 + + def _transform_settings(self, points: List[MappedPoint]) -> m.DERSettings: + """Update a DERSettings object so that it is correctly formatted to send to the server. + + The point has a parent_object property that must be a DERSettings object. Each setting + that requires a transition from a single element to a complex element is handled here. + + :param point: The point that is being updated. + :return: The updated DERSettings object. + :rtype: m.DERSettings + :raises AssertionError: If the parent_object is not a DERSettings object. + """ + # all of the settings are in the same envelope so we use the same + # server time for all of them. + server_time = self._client.server_time + settings = None + + for point in points: + assert isinstance( + point.parent_object, + m.DERSettings), f'Parent object is not a DERSettings object: {p.parent_object}' + + settings: m.DERSettings = point.parent_object + + # Transform point values into their correct object types. + if point.parameter == 'setMaxA': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxA = m.CurrentRMS(multiplier=point.multiplier, + value=settings.setMaxA) + + if point.parameter == 'setMaxAh': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxAh = m.AmpereHour(multiplier=point.multiplier, + value=settings.setMaxAh) + + if point.parameter == 'setMaxChargeRateVA': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxChargeRateVA = m.ApparentPower(multiplier=point.multiplier, + value=settings.setMaxChargeRateVA) + + if point.parameter == 'setMaxChargeRateW': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxChargeRateW = m.ActivePower(multiplier=point.multiplier, + value=settings.setMaxChargeRateW) + + if point.parameter == 'setMaxDischargeRateVA': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxDischargeRateVA = m.ApparentPower( + multiplier=point.multiplier, value=settings.setMaxDischargeRateVA) + + if point.parameter == 'setMaxDischargeRateW': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxDischargeRateW = m.ActivePower(multiplier=point.multiplier, + value=settings.setMaxDischargeRateW) + + if point.parameter == 'setMaxV': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxV = m.VoltageRMS(multiplier=point.multiplier, + value=settings.setMaxV) + + if point.parameter == 'setMaxVA': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxVA = m.ApparentPower(multiplier=point.multiplier, + value=settings.setMaxVA) + + if point.parameter == 'setMaxVar': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxVar = m.ReactivePower(multiplier=point.multiplier, + value=settings.setMaxVar) + + if point.parameter == 'setMaxVarNeg': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxVarNeg = m.ReactivePower(multiplier=point.multiplier, + value=settings.setMaxVarNeg) + + if point.parameter == 'setMaxW': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxW = m.ActivePower(multiplier=point.multiplier, + value=settings.setMaxW) + + if point.parameter == 'setMaxWh': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMaxWh = m.WattHour(multiplier=point.multiplier, + value=settings.setMaxWh) + + if point.parameter == 'setMinPFOverExcited': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMinPFOverExcited = m.PowerFactor(multiplier=point.multiplier, + value=settings.setMinPFOverExcited) + + if point.parameter == 'setMinPFUnderExcited': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMinPFUnderExcited = m.PowerFactor(multiplier=point.multiplier, + value=settings.setMinPFUnderExcited) + + if point.parameter == 'setMinV': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setMinV = m.VoltageRMS(multiplier=point.multiplier, + value=settings.setMinV) + + if point.parameter == 'setSoftGradW': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setSoftGradW = m.ActivePower(multiplier=point.multiplier, + value=settings.setSoftGradW) + + if point.parameter == 'setVNom': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setVNom = m.VoltageRMS(multiplier=point.multiplier, + value=settings.setVNom) + + if point.parameter == 'setVRef': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setVRef = m.VoltageRMS(multiplier=point.multiplier, + value=settings.setVRef) + + if point.parameter == 'setVRefOfs': + point.multiplier = self._cast_multipler(point.multiplier) + settings.setVRefOfs = m.VoltageRMS(multiplier=point.multiplier, + value=settings.setVRefOfs) + settings.updatedTime = server_time + + return settings + + def _transform_status(self, points: List[MappedPoint]) -> m.DERStatus: + """Update a derstatus object so that it is correctly formatted to send to the server. + + The point has a parent_object property that must be a DERStatus object. Each setting + that requires a transition from a single element to a complex element is handled here. + + :param point: The point that is being updated. + :return: The updated DERStatus object. + :rtype: m.DERStatus + :raises AssertionError: If the parent_object is not a DERStatus object. + """ + + server_time = self._client.server_time + status = None + + for point in points: + try: + assert isinstance( + point.parent_object, + m.DERStatus), f'Parent object is not a DERStatus object: {p.parent_object}' + + status: m.DERStatus = point.parent_object + + if point.parameter == 'genConnectStatus': + status.genConnectStatus = m.ConnectStatusType(dateTime=server_time, + value=status.genConnectStatus) + + if point.parameter == 'inverterStatus': + status.inverterStatus = m.InverterStatusType(dateTime=server_time, + value=status.inverterStatus) + + if point.parameter == 'localControlModeStatus': + status.localControlModeStatus = m.LocalControlModeStatusType( + dateTime=server_time, value=status.localControlModeStatus) + + if point.parameter == 'manufacturerStatus': + status.manufacturerStatus = m.ManufacturerStatusType( + dateTime=server_time, value=status.manufacturerStatus) + + if point.parameter == 'operationalModeStatus': + status.operationalModeStatus = m.OperationalModeStatusType( + dateTime=server_time, value=status.operationalModeStatus) + + if point.parameter == 'stateOfChargeStatus': + status.stateOfChargeStatus = m.StateOfChargeStatusType( + dateTime=server_time, value=status.stateOfChargeStatus) + + if point.parameter == 'storageModeStatus': + status.storageModeStatus = m.StorageModeStatusType( + dateTime=server_time, value=status.storageModeStatus) + + if point.parameter == 'storConnectStatus': + status.storConnectStatus = m.ConnectStatusType(dateTime=server_time, + value=status.storConnectStatus) + + status.readingTime = server_time + except Exception as e: + _log.error(f'Converting status: {e}') + return status + + def _transform_capabilities(self, points: List[MappedPoint]) -> m.DERCapability: + """Update a DERCapability object so that it is correctly formatted to send to the server. + + The point has a parent_object property that must be a DERCapability object. Each setting + that requires a transition from a single element to a complex element is handled here. + + :param point: The point that is being updated. + :return: The updated DERCapability object. + :rtype: m.DERCapability + :raises AssertionError: If the parent_object is not a DERCapability object. + """ + + server_time = self._client.server_time + capabilities = None + + for point in points: + assert isinstance( + point.parent_object, m.DERCapability + ), f'Parent object is not a DERCapability object: {point.parent_object}' + + capabilities: m.DERCapability = point.parent_object + + if point.parameter == 'rtgMaxA': + capabilities.rtgMaxA = m.CurrentRMS(multiplier=point.multiplier, + value=self.rtgMaxA) + + if point.parameter == 'rtgMaxAh': + capabilities.rtgMaxAh = m.AmpereHour(multiplier=point.multiplier, + value=self.rtgMaxAh) + + if point.parameter == 'rtgMaxChargeRateVA': + capabilities.rtgMaxChargeRateVA = m.ApparentPower(multiplier=point.multiplier, + value=self.rtgMaxChargeRateVA) + + if point.parameter == 'rtgMaxChargeRateW': + capabilities.rtgMaxChargeRateW = m.ActivePower(multiplier=point.multiplier, + value=self.rtgMaxChargeRateW) + + if point.parameter == 'rtgMaxV': + capabilities.rtgMaxV = m.VoltageRMS(multiplier=point.multiplier, + value=self.rtgMaxV) + + if point.parameter == 'rtgMaxVA': + capabilities.rtgMaxVA = m.ApparentPower(multiplier=point.multiplier, + value=self.rtgMaxVA) + + if point.parameter == 'rtgMaxVar': + capabilities.rtgMaxVar = m.ReactivePower(multiplier=point.multiplier, + value=self.rtgMaxVar) + + if point.parameter == 'rtgMaxVarNeg': + capabilities.rtgMaxVarNeg = m.ReactivePower(multiplier=point.multiplier, + value=self.rtgMaxVarNeg) + + if point.parameter == 'rtgMaxW': + capabilities.rtgMaxW = m.ActivePower(multiplier=point.multiplier, + value=self.rtgMaxW) + + if point.parameter == 'rtgMaxWh': + capabilities.rtgMaxWh = m.WattHour(multiplier=point.multiplier, + value=self.rtgMaxWh) + + if point.parameter == 'rtgMinPFOverExcited': + capabilities.rtgMinPFOverExcited = m.PowerFactor(multiplier=point.multiplier, + value=self.rtgMinPFOverExcited) + + if point.parameter == 'rtgMinPFUnderExcited': + capabilities.rtgMinPFUnderExcited = m.PowerFactor(multiplier=point.multiplier, + value=self.rtgMinPFUnderExcited) + + if point.parameter == 'rtgNormalCategory': + capabilities.rtgNormalCategory = m.RtgNormalCategoryType( + dateTime=server_time, value=self.rtgNormalCategory) + + if point.parameter == 'rtgOverExcitedPF': + capabilities.rtgOverExcitedPF = m.PowerFactor(multiplier=point.multiplier, + value=self.rtgOverExcitedPF) + + if point.parameter == 'rtgOverExcitedW': + capabilities.rtgOverExcitedW = m.ActivePower(multiplier=point.multiplier, + value=self.rtgOverExcitedW) + + if point.parameter == 'rtgReactiveSusceptance': + capabilities.rtgReactiveSusceptance = m.ReactiveSusceptance( + multiplier=point.multiplier, value=self.rtgReactiveSusceptance) + + if point.parameter == 'rtgUnderExcitedPF': + capabilities.rtgUnderExcitedPF = m.PowerFactor(multiplier=point.multiplier, + value=self.rtgUnderExcitedPF) + + if point.parameter == 'rtgUnderExcitedW': + capabilities.rtgUnderExcitedW = m.ActivePower(multiplier=point.multiplier, + value=self.rtgUnderExcitedW) + + if point.parameter == 'rtgVNom': + capabilities.rtgVNom = m.VoltageRMS(multiplier=point.multiplier, + value=self.rtgVNom) + + if point.parameter == 'type': + capabilities.type = m.DERTypeType(dateTime=server_time, value=self.type) + + return capabilities + + def _data_published(self, peer, sender, bus, topic, headers, message): + """ + Callback triggered by the device_topic setup using the topic from the agent's config file + """ + _log.debug(f'DATA Received from {sender}') + points = AllPoints.frombus(message) + + current_timestamp: datetime = utils.parse_timestamp_string(headers.get('TimeStamp')) + parent_objects: Dict[type, List[MappedPoint]] = {} + transforms = { + m.DERSettings: (self._transform_settings, self._client.put_der_settings), + m.DERCapability: (self._transform_capabilities, self._client.put_der_capability), + m.DERStatus: (self._transform_status, self._client.put_der_status) + } + + for obj_type in transforms.keys(): + # Create a list of properties that are for each of the types. + parent_objects[obj_type] = list( + filter(lambda x: isinstance(x.parent_object, obj_type), + self._mapped_points.values())) + + # Make sure that there is some points to update. + if parent_objects[obj_type]: + list( + map(lambda x: x.set_value(points.get(x.point_on_bus)), + parent_objects[obj_type])) + + # Do the transform from simple int/floats to complex objects. + sendable = transforms[obj_type][0](parent_objects[obj_type]) + if sendable: + # Send the data to the server. + transforms[obj_type][1](sendable) + + for mp in self._mapped_points.values(): + mp.reset_changed() + + for index, pt in enumerate(self._mirror_usage_point_list): + if pt['device_point'] in points.points: + reading_mRID = pt['MirrorMeterReading']['mRID'] + reading = self._mup_readings[reading_mRID] + for rs_index, rs in enumerate(reading.MirrorReadingSet): + rs = reading.MirrorReadingSet[rs_index] + rs.Reading.append( + m.Reading(timePeriod=m.DateTimeInterval( + start=int(current_timestamp.timestamp())), + value=points.points[pt['device_point']])) + start = rs.timePeriod.start + if start + self._mup_pollRate < self._client.server_time: + self._times_published[reading_mRID] = self._times_published.get( + reading_mRID, 0) + 1 + rs.mRID = '_'.join( + [reading_mRID, str(self._times_published[reading_mRID])]) + + new_reading_href = self._client.post_mirror_reading(reading) + _log.info( + f'New readings({len(rs.Reading)}) posted available at: {new_reading_href}' + ) + rs.Reading.clear() + rs.timePeriod.start = self._client.server_time + rs.timePeriod.duration = self._mup_pollRate + + +def main(): + """ + Main method called during startup of agent. + :return: + """ + try: + vip_main(IEEE_2030_5_Agent, version=__version__) + except Exception as e: + _log.exception('unhandled exception') + + +if __name__ == '__main__': + # Entry point for script + try: + sys.exit(main()) + except KeyboardInterrupt: + pass diff --git a/services/core/IEEE_2030_5/ieee_2030_5/client.py b/services/core/IEEE_2030_5/ieee_2030_5/client.py new file mode 100644 index 0000000000..a3c7b3396c --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/client.py @@ -0,0 +1,764 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from __future__ import annotations + +import atexit +import http +import logging +import ssl +import subprocess +import threading +import time +import xml.dom.minidom +from dataclasses import dataclass, field +from datetime import datetime +from http.client import HTTPMessage, HTTPSConnection, CannotSendRequest +from os import PathLike +from pathlib import Path +from threading import Semaphore, Timer +from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union +from uuid import uuid4 +import gevent + +import ieee_2030_5.models as m +import xsdata +from blinker import Signal +from ieee_2030_5 import dataclass_to_xml, xml_to_dataclass + +_log = logging.getLogger(__name__) +_log_req_resp = logging.getLogger(f'{__name__}.req_resp') + +TimeType = int +StrPath = Union[str, Path] + + +@dataclass +class TimerSpec: + trigger_after_seconds: int + fn: Callable + args: List = field(default_factory=list) + kwargs: Dict = field(default_factory=dict) + enabled: bool = True + trigger_count: int = 0 + last_trigger_time: int = int(time.mktime(datetime.utcnow().timetuple())) + + def disable(self): + self.enabled = False + + def enable(self): + self.enabled = True + + def reset_count(self): + self.trigger_count = 0 + + def __eq__(self, other: object) -> bool: + if not isinstance(other, TimerSpec): + raise NotImplementedError( + f'Comparison between {self.__class__.__name__} and {type(other)} not implemented') + return self.fn is other.fn + + def trigger(self, current_time: int): + if self.last_trigger_time + self.trigger_after_seconds < current_time: + if self.args and self.kwargs: + self.fn(args=self.args, kwargs=self.kwargs) + elif self.args: + self.fn(args=self.args) + else: + self.fn() + self.trigger_count += 1 + self.last_trigger_time = current_time + + +class _TimerThread(gevent.Greenlet): + tick = Signal('tick') + + def __init__(self): + super().__init__() + self._tick = 0 + + @staticmethod + def user_readable(timestamp: int): + dt = datetime.fromtimestamp(timestamp) + return dt.strftime('%m/%d/%Y, %H:%M:%S') + + def run(self) -> None: + + while True: + self._tick = int(time.mktime(datetime.utcnow().timetuple())) + _TimerThread.tick.send(self._tick) + time.sleep(1) + + +TimerThread = _TimerThread() +TimerThread.daemon = True +TimerThread.start() + + +class IEEE2030_5_Client: + clients: set[IEEE2030_5_Client] = set() + + # noinspection PyUnresolvedReferences + def __init__(self, + cafile: StrPath, + server_hostname: str, + keyfile: StrPath, + certfile: StrPath, + pin: str, + server_ssl_port: Optional[int] = 443, + debug: bool = True, + device_capabilities_endpoint: str = '/dcap', + log_req_resp: bool = True): + + self._cafile: Path = cafile if isinstance(cafile, Path) else Path(cafile) + self._keyfile: Path = keyfile if isinstance(keyfile, Path) else Path(keyfile) + self._certfile: Path = certfile if isinstance(certfile, Path) else Path(certfile) + + self._pin = pin + + # We know that these are Path objects now and have a .exists() function based upon above code. + assert self._cafile.exists( + ), f"cafile doesn't exist ({cafile})" # type: ignore[attr-defined] + assert self._keyfile.exists( + ), f"keyfile doesn't exist ({keyfile})" # type: ignore[attr-defined] + assert self._certfile.exists( + ), f"certfile doesn't exist ({certfile})" # type: ignore[attr-defined] + + self._ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self._ssl_context.check_hostname = False + self._ssl_context.verify_mode = ssl.CERT_REQUIRED + self._ssl_context.load_verify_locations(cafile=cafile) + + # Loads client information from the passed cert and key files. For + # client side validation. + self._ssl_context.load_cert_chain(certfile=certfile, keyfile=keyfile) + + self._http_conn = HTTPSConnection(host=server_hostname, + port=server_ssl_port, + context=self._ssl_context) + self._response_headers: HTTPMessage + self._response_status = None + self._debug = debug + self._debug = log_req_resp + if not self._debug: + _log_req_resp.setLevel(logging.WARNING) + + self._mup: m.MirrorUsagePointList = None # type: ignore + self._upt: m.UsagePointList = None # type: ignore + + self._dcap_poll_rate: int = 0 + self._dcap_timer: Optional[Timer] = None + self._disconnect: bool = False + + self._timer_specs: Dict[str, TimerSpec] = {} + + # Offset between local udt and server udt + self._time_offset: int = 0 + + self._end_device_map: Dict[str, m.EndDeviceList] = {} + self._end_devices: Dict[str, m.EndDevice] = {} + + self._fsa_map: Dict[str, m.FunctionSetAssignmentsList] = {} + self._fsa: Dict[str, m.FunctionSetAssignments] = {} + + self._der_map: Dict[str, m.DERList] = {} + self._der: Dict[str, m.DER] = {} + + self._der_program_map: Dict[str, m.DERProgramList] = {} + self._der_program: Dict[str, m.DERProgram] = {} + + self._mirror_usage_point_map: Dict[str, m.MirrorUsagePointList] = {} + self._mirror_usage_point: Dict[str, m.MirrorUsagePoint] = {} + + self._usage_point_map: Dict[str, m.UsagePointList] = {} + self._usage_point: Dict[str, m.UsagePoint] = {} + + self._before_dcap_update_signal = Signal('before-dcap-request') + self._after_dcap_update_signal = Signal('before-dcap-request') + self._before_client_start_signal = Signal('before-client-start') + self._after_client_start_signal = Signal('after-client-start') + + self._der_control_event_started_signal = Signal('der-control-event-started') + self._der_control_event_ended_signal = Signal('der-control-event-ended') + + self._default_control_changed = Signal('default-control-changed') + + self._dcap_endpoint = device_capabilities_endpoint + + self._der_default_control: m.DefaultDERControl = m.DefaultDERControl() + self._der_active_controls: m.DERControlList = m.DERControlList() + + self._config: Dict[str, Any] = {} + self._lock = Semaphore() + + IEEE2030_5_Client.clients.add(self) + + def start(self, config: Dict[str, Any]): + """Starts the client connection to the 2030.5 server configured during construction. + """ + self._config = config + self._before_client_start_signal.send(self) + self._update_dcap_tree() + self._after_client_start_signal.send(self) + TimerThread.tick.connect(self._tick) + + def _tick(self, timestamp: int): + """Handles the timer event thread for the client. + + :param timestamp: The current timestamp + :type timestamp: int + """ + if self._lock.acquire(blocking=False): + for ts in self._timer_specs.values(): + ts.trigger(timestamp) + self._lock.release() + + def der_default_control_changed(self, fun: Callable): + self._default_control_changed.connect(fun) + + def der_control_event_started(self, fun: Callable): + self._der_control_event_started_signal.connect(fun) + + def der_control_event_ended(self, fun: Callable): + self._der_control_event_ended_signal.connect(fun) + + def before_dcap_update(self, fun: Callable): + self._before_dcap_update_signal.connect(fun) + + def after_dcap_update(self, fun: Callable): + self._after_dcap_update_signal.connect(fun) + + def after_client_start(self, fun: Callable): + self._after_client_start_signal.connect(fun) + + def before_client_start(self, fun: Callable): + self._before_client_start_signal.connect(fun) + + @property + def server_time(self) -> TimeType: + """Returns the time on the server + + Uses an offset value from the 2030.5 Time function set to determine the + current time on the server. + + :return: A calculated server_time including offset from time endpoint + :rtype: TimeType + """ + return int(time.mktime(datetime.utcnow().timetuple())) + self._time_offset + + def get_der_hrefs(self) -> List[str]: + return list(self._der.keys()) + + def get_der(self, href: str) -> Optional[m.DER]: + return self._der.get(href) + + def get_der_list(self, href: Optional[str] = None) -> m.DERList: + if href is None: + href = self.enddevice.DERListLink.href + resp = self.__get_request__(href) + return self._der_map.get(href) + + def put_der_availability(self, der_href: str, new_availability: m.DERAvailability) -> int: + resp = self.__put__(der_href, dataclass_to_xml(new_availability)) + return resp.status + + def put_der_capability(self, new_capability: m.DERCapability) -> int: + resp = self.__put__( + list(self._der.values())[0].DERCapabilityLink, dataclass_to_xml(new_capability)) + return resp.status + + def put_der_settings(self, new_settings: m.DERSettings) -> int: + resp = self.__put__( + list(self._der.values())[0].DERSettingsLink.href, dataclass_to_xml(new_settings)) + return resp.status + + def put_der_status(self, new_status: m.DERStatus) -> int: + if not isinstance(new_status.operationalModeStatus, m.OperationalModeStatusType): + new_status.operationalModeStatus = m.OperationalModeStatusType( + self.server_time, value=new_status.operationalModeStatus) + + resp = self.__put__( + list(self._der.values())[0].DERStatusLink.href, dataclass_to_xml(new_status)) + return resp.status + + def _send_control_events(self, der_program_href: str): + # Need to check this every 10 seconds for updates to conttrols + program: m.DERProgram = self.__get_request__(der_program_href) + + active: m.DERControlList = self.__get_request__(program.ActiveDERControlListLink.href) + default = self.__get_request__(program.DefaultDERControlLink.href) + active_is_different = False + + to_add = [] + for newderctl in active.DERControl: + found = False + for existingctl in self._der_active_controls.DERControl: + if existingctl.mRID == newderctl.mRID: + found = True + if existingctl == newderctl: + _log.debug(f'Currently in event {newderctl.mRID}') + else: + _log.debug( + 'TODO ->>>>>>>>>>>>>>>>>>>>>>>>>>> Existing mRID should superscede????' + ) + break + if not found: + to_add.append(newderctl) + + for ctrl in to_add: + self._der_control_event_started_signal.send(ctrl) + + to_remove = [] + for existingctl in self._der_active_controls.DERControl: + found = False + for newctrl in active.DERControl: + if newctrl.mRID == existingctl.mRID: + found = True + break + if not found: + to_remove.append(existingctl) + + i = len(self._der_active_controls.DERControl) + while i > 0: + i -= 1 + if self._der_active_controls.DERControl[i] in to_remove: + self._der_control_event_ended_signal.send(self._der_active_controls.DERControl[i]) + self._der_active_controls.DERControl.pop(i) + + self._der_active_controls = active + + if default != self._der_default_control: + self._der_default_control = default + _log.debug('Default control changed....') + self._default_control_changed.send(default) + + # Poll every 60 if default otherwise use setting in config file. + refresh_time = self._config.get('default_der_control_poll', 60) + self._update_timer_spec('der_control_event', + refresh_time, + fn=lambda: self._send_control_events(der_program_href)) + + def _update_dcap_tree(self, endpoint: Optional[str] = None): + """Retrieve device capability + + :param endpoint: _description_, defaults to None + :type endpoint: Optional[str], optional + :raises ValueError: _description_ + :raises RuntimeError: _description_ + :raises ValueError: _description_ + """ + if not endpoint: + endpoint = self._dcap_endpoint + if not endpoint: + raise ValueError('Invalid device_capability_endpoint specified in constructor.') + + self._before_dcap_update_signal.send(self) + + # retrieve device capabilities from the server + dcap: m.DeviceCapability = self.__get_request__(endpoint) + if self._response_status != 200: + raise RuntimeError(dcap) + + self._after_dcap_update_signal.send(self) + + if dcap.pollRate is None: + dcap.pollRate = 900 + + if dcap.EndDeviceListLink is None or dcap.EndDeviceListLink.all == 0: + raise ValueError("Couldn't receive end device model from server. " + 'Check certificates or server configuration.') + + # if time is available then grab and create an offset + if dcap.TimeLink is not None and dcap.TimeLink.href: + _time: m.Time = self.__get_request__(dcap.TimeLink.href) + self._time_offset = int(time.mktime(datetime.utcnow().timetuple())) - _time.currentTime + + if dcap.EndDeviceListLink is not None and dcap.EndDeviceListLink.all > 0: + + self._update_list(dcap.EndDeviceListLink.href, 'EndDevice', self._end_device_map, + self._end_devices) + + for ed in self._end_devices.values(): + + if not self.is_end_device_registered(ed, self._pin): + raise ValueError(f'Device is not registered on this server!') + self._update_list(ed.FunctionSetAssignmentsListLink.href, 'FunctionSetAssignments', + self._fsa_map, self._fsa) + + if ed.DERListLink: + derlist: m.DERList = self.__get_request__(ed.DERListLink.href) + self._der_map[derlist.href] = derlist + for index, der in enumerate(derlist.DER): + self._der[der.href] = der + + if derlist.DER[0].CurrentDERProgramLink: + self._send_control_events(derlist.DER[0].CurrentDERProgramLink.href) + + for fsa in self._fsa.values(): + if fsa.DERProgramListLink: + self._der_program_map[fsa.DERProgramListLink.href] = self.__get_request__( + fsa.DERProgramListLink.href) + program = self._der_program_map[fsa.DERProgramListLink.href] + + if dcap.MirrorUsagePointListLink is not None and dcap.MirrorUsagePointListLink.href: + self._update_list(dcap.MirrorUsagePointListLink.href, 'MirrorUsagePoint', + self._mirror_usage_point_map, self._mirror_usage_point) + + self._dcap = dcap + self._update_timer_spec('dcap', dcap.pollRate, self._update_dcap_tree) + + def _update_timer_spec(self, spec_name: str, rate: int, fn: Callable, *args, **kwargs): + ts = self._timer_specs.get(spec_name) + if ts is None: + ts = self._timer_specs[spec_name] = TimerSpec(rate, fn, args, kwargs) + ts.trigger_after_seconds = rate + + def post_log_event(self, end_device: m.EndDevice, log_event: m.LogEvent): + if not log_event.createdDateTime: + log_event.createdDateTime = self.server_time + + self.request(end_device.LogEventListLink.href, method='POST') + + def _update_list(self, path: str, list_prop: str, outer_map: Dict, inner_map: Dict): + """Update mappings using 2030.5 list nomoclature. + + Example structure for EndDeviceListLink + + EndDeviceListLink.href points to EndDeviceList. + EndDeviceList.EndDevice points to a list of EndDevice objects. + + Args: + + path: Original path of the list (in example EndDeviceListLink.href) + list_prop: The property on the object that holds a list of elements (in example EndDevice) + outer_mapping: Mapping where the original list object is stored by href + inner_mapping: Mapping where the inner objects are stored by href + + """ + my_response = self.__get_request__(path) + + if self._response_status != 200: + raise RuntimeError(my_response) + + if my_response is not None: + href = getattr(my_response, 'href') + outer_map[href] = my_response + for inner in getattr(my_response, list_prop): + href = getattr(inner, 'href') + inner_map[href] = inner + + def _get_device_capabilities(self, endpoint: str) -> m.DeviceCapability: + dcap: m.DeviceCapability = self.__get_request__(endpoint) + if self._response_status != 200: + raise RuntimeError(dcap) + + self._dcap = dcap + + if self._device_cap.pollRate is not None: + self._dcap_poll_rate = self._device_cap.pollRate + else: + self._dcap_poll_rate = 600 + + self._dcap_timer = Timer(self._dcap_poll_rate, self.poll_timer, + (self.device_capability, url)) + self._dcap_timer.start() + + return self._device_cap + + @property + def lfdi(self) -> str: + cmd = ['openssl', 'x509', '-in', str(self._certfile), '-noout', '-fingerprint', '-sha256'] + ret_value = subprocess.check_output(cmd, text=True) + if '=' in ret_value: + ret_value = ret_value.split('=')[1].strip() + + fp = ret_value.replace(':', '') + lfdi = fp[:40] + return lfdi + + @property + def http_conn(self) -> HTTPSConnection: + if self._http_conn.sock is None: + self._http_conn.connect() + return self._http_conn + + @property + def enddevices(self) -> m.EndDeviceList: + return self._end_devices + + @property + def enddevice(self, href: str = '') -> m.EndDevice: + """Retrieve a client's end device based upon the href of the end device. + + Args: + + href: If "" then in single client mode and return the only end device available. + """ + if not href: + href = list(self._end_devices.keys())[0] + + end_device = self._end_devices.get(href) + + return end_device + + def __hash__(self) -> int: + return self._keyfile.read_text().__hash__() # type: ignore[attr-defined] + + def is_end_device_registered(self, end_device: m.EndDevice, pin: int) -> bool: + reg = self.registration(end_device) + return reg.pIN == self._pin + + def new_uuid(self, url: str = '/uuid') -> str: + res = self.__get_request__(url) + return res + + def get_enddevices(self) -> m.EndDeviceList: + return self.__get_request__(self._device_cap.EndDeviceListLink.href) + + def end_device(self, index: Optional[int] = 0) -> m.EndDevice: + if not self._end_devices: + self.end_devices() + + return self._end_devices.EndDevice[index] + + def self_device(self) -> m.EndDevice: + if not self._device_cap: + self.device_capability() + + return self.__get_request__(self._device_cap.SelfDeviceLink.href) + + def function_set_assignment(self) -> m.FunctionSetAssignmentsListLink: + fsa_list = self.__get_request__(self.end_device().FunctionSetAssignmentsListLink.href) + return fsa_list + + def poll_timer(self, fn, args): + if not self._disconnect: + _log.debug(threading.currentThread().name) + fn(args) + threading.currentThread().join() + + def device_capability(self, url: str = '/dcap') -> m.DeviceCapability: + self._device_cap: m.DeviceCapability = self.__get_request__(url) + if self._device_cap.pollRate is not None: + self._dcap_poll_rate = self._device_cap.pollRate + else: + self._dcap_poll_rate = 600 + + _log.debug(f'devcap id {id(self._device_cap)}') + _log.debug(threading.currentThread().name) + _log.debug(f'DCAP: Poll rate: {self._dcap_poll_rate}') + self._dcap_timer = Timer(self._dcap_poll_rate, self.poll_timer, + (self.device_capability, url)) + self._dcap_timer.start() + + return self._device_cap + + def time(self) -> m.Time: + timexml = self.__get_request__(self._device_cap.TimeLink.href) + return timexml + + def der_program_list(self, device: m.EndDevice) -> m.DERProgramList: + fsa: m.FunctionSetAssignments = self.__get_request__( + device.FunctionSetAssignmentsListLink.href) + der_programs_list: m.DERProgramList = self.__get_request__(fsa.DERProgramListLink.href) + + return der_programs_list + + def post_mirror_reading(self, reading: m.MirrorMeterReading) -> str: + data = dataclass_to_xml(reading) + resp = self.__post__(reading.href, data=data) + + if not int(resp.status) >= 200 and int(resp.status) < 300: + _log.error(f'Posting to {reading.href}') + _log.error(f'Response status: {resp.status}') + _log.error(f"{resp.read().decode('utf-8')}") + + return resp.headers['Location'] + + def mirror_usage_point_list(self) -> m.MirrorUsagePointList: + mupl = self._mirror_usage_point_map.get(self._dcap.MirrorUsagePointListLink.href) + + return mupl + + def usage_point_list(self) -> m.UsagePointList: + self._upt = self.__get_request__(self._device_cap.UsagePointListLink.href) + return self._upt + + def registration(self, end_device: m.EndDevice) -> m.Registration: + reg = self.__get_request__(end_device.RegistrationLink.href) + return reg + + def timelink(self): + if self._device_cap is None: + raise ValueError('Request device capability first') + return self.__get_request__(url=self._device_cap.TimeLink.href) + + def disconnect(self): + self._disconnect = True + self._dcap_timer.cancel() + IEEE2030_5_Client.clients.remove(self) + + def request(self, endpoint: str, body: dict = {}, method: str = 'GET', headers: dict = {}): + + if method.upper() == 'GET': + return self.__get_request__(endpoint, body, headers=headers) + + if method.upper() == 'POST': + return self.__post__(endpoint, body, headers=headers) + + def create_mirror_usage_point(self, mirror_usage_point: m.MirrorUsagePoint) -> str: + """Create a new mirror usage point on the server. + + Args: + + mirror_usage_point: Minimal type for MirrorUsagePoint + + Return: + + The location of the new usage point href for posting to. + """ + data = dataclass_to_xml(mirror_usage_point) + resp = self.__post__(self._dcap.MirrorUsagePointListLink.href, data=data) + return resp.headers['Location'] + + def __put__(self, url: str, data: Any, headers: Optional[Dict[str, str]] = None): + if not headers: + headers = {'Content-Type': 'text/xml'} + + if self._debug: + _log_req_resp.debug(f'----> PUT REQUEST\nurl: {url}\nbody: {data}') + + try: + self.http_conn.request(method='PUT', headers=headers, url=url, body=data) + except http.client.CannotSendRequest as ex: + self.http_conn.close() + _log.debug('Reconnecting to server') + self.http_conn.request(method='PUT', headers=headers, url=url, body=data) + + response = self._http_conn.getresponse() + return response + + def __post__(self, url: str, data=None, headers: Optional[Dict[str, str]] = None): + if not headers: + headers = {'Content-Type': 'text/xml'} + + if self._debug: + _log_req_resp.debug(f'----> POST REQUEST\nurl: {url}\nbody: {data}') + + self.http_conn.request(method='POST', headers=headers, url=url, body=data) + response = self._http_conn.getresponse() + response_data = response.read().decode('utf-8') + # response_data = response.read().decode("utf-8") + if response_data and self._debug: + _log_req_resp.debug(f'<---- POST RESPONSE\n{response_data}') + + return response + + def __get_request__(self, url: str, body=None, headers: Optional[Dict] = None): + if headers is None: + headers = {'Connection': 'keep-alive', 'keep-alive': 'timeout=30, max=1000'} + + if self._debug: + _log_req_resp.debug(f'----> GET REQUEST\nurl: {url}\nbody: {body}') + try: + self.http_conn.request(method='GET', url=url, body=body, headers=headers) + except http.client.CannotSendRequest as ex: + self.http_conn.close() + _log.debug('Reconnecting to server') + self.http_conn.request(method='GET', url=url, body=body, headers=headers) + + response = self._http_conn.getresponse() + response_data = response.read().decode('utf-8') + self._response_headers = response.headers + self._response_status = response.status + + response_obj = None + try: + response_obj = xml_to_dataclass(response_data) + resp_xml = xml.dom.minidom.parseString(response_data) + if resp_xml and self._debug: + _log_req_resp.debug(f'<---- GET RESPONSE\n{response_data}') # toprettyxml()}") + + except xsdata.exceptions.ParserError as ex: + if self._debug: + _log_req_resp.debug('<---- GET RESPONSE\n{response_data}') + response_obj = response_data + + return response_obj + + def __close__(self): + self._http_conn.close() + self._ssl_context = None + self._http_conn = None + + +# noinspection PyTypeChecker +def __release_clients__(): + for x in IEEE2030_5_Client.clients: + x.__close__() + IEEE2030_5_Client.clients = None + + +atexit.register(__release_clients__) + +# if __name__ == '__main__': +# SERVER_CA_CERT = Path("~/tls/certs/ca.crt").expanduser().resolve() +# KEY_FILE = Path("~/tls/private/dev1.pem").expanduser().resolve() +# CERT_FILE = Path("~/tls/certs/dev1.crt").expanduser().resolve() + + # headers = {'Connection': 'Keep-Alive', 'Keep-Alive': "max=1000,timeout=30"} + + # h = IEEE_2030_5_Client(cafile=SERVER_CA_CERT, + # server_hostname="127.0.0.1", + # server_ssl_port=8070, + # keyfile=KEY_FILE, + # certfile=CERT_FILE, + # debug=True) + # # h2 = IEEE2030_5_Client(cafile=SERVER_CA_CERT, server_hostname="me.com", ssl_port=8000, + # # keyfile=KEY_FILE, certfile=KEY_FILE) + # dcap = h.device_capability() + # end_devices = h.end_devices() + + # if not end_devices.all > 0: + # print("registering end device.") + # ed_href = h.register_end_device() + # my_ed = h.end_devices() + + # # ed = h.end_devices()[0] + # # resp = h.request("/dcap", headers=headers) + # # print(resp) + # # resp = h.request("/dcap", headers=headers) + # # print(resp) + # #dcap = h.device_capability() + # # get device list + # #dev_list = h.request(dcap.EndDeviceListLink.href).EndDevice + + # #ed = h.request(dev_list[0].href) + # #print(ed) + # # + # # print(dcap.mirror_usage_point_list_link) + # # # print(h.request(dcap.mirror_usage_point_list_link.href)) + # # print(h.request("/dcap", method="post")) + + # # tl = h.timelink() + # #print(IEEE2030_5_Client.clients) diff --git a/services/core/IEEE_2030_5/ieee_2030_5/models/Config.py b/services/core/IEEE_2030_5/ieee_2030_5/models/Config.py new file mode 100644 index 0000000000..8eab0106f1 --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/models/Config.py @@ -0,0 +1,336 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from __future__ import annotations +from dataclasses import dataclass, field +from typing import List, Optional + +__NAMESPACE__ = 'http://pypi.org/project/xsdata' + + +@dataclass +class TypeName: + + class Meta: + name = 'ClassName' + namespace = 'http://pypi.org/project/xsdata' + + case: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + safePrefix: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class CompoundFields: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + defaultName: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + forceDefaultName: Optional[bool] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + value: Optional[bool] = field(default=None, metadata={ + 'required': True, + }) + + +@dataclass +class ConstantName: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + case: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + safePrefix: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class FieldName: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + case: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + safePrefix: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class Format: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + repr: Optional[bool] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + eq: Optional[bool] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + order: Optional[bool] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + unsafeHash: Optional[bool] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + frozen: Optional[bool] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + slots: Optional[bool] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + kwOnly: Optional[bool] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + value: str = field(default='', metadata={ + 'required': True, + }) + + +@dataclass +class ModuleName: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + case: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + safePrefix: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class PackageName: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + case: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + safePrefix: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class Substitution: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + type_value: Optional[str] = field(default=None, + metadata={ + 'name': 'type', + 'type': 'Attribute', + 'required': True, + }) + search: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + replace: Optional[str] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class Conventions: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + ClassName: Optional[TypeName] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + FieldName: Optional[FieldName] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + ConstantName: Optional[ConstantName] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + ModuleName: Optional[ModuleName] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + PackageName: Optional[PackageName] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Output: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + maxLineLength: Optional[int] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + Package: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + Format: Optional[Format] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + Structure: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + DocstringStyle: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + FilterStrategy: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + RelativeImports: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + CompoundFields: Optional[CompoundFields] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + PostponedAnnotations: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + UnnestClasses: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + IgnorePatterns: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Substitutions: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + Substitution: List[Substitution] = field(default_factory=list, + metadata={ + 'type': 'Element', + 'min_occurs': 1, + }) + + +@dataclass +class Config: + + class Meta: + namespace = 'http://pypi.org/project/xsdata' + + version: Optional[float] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + Output: Optional[Output] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + Conventions: Optional[Conventions] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + Substitutions: Optional[Substitutions] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) diff --git a/services/core/IEEE_2030_5/ieee_2030_5/models/__init__.py b/services/core/IEEE_2030_5/ieee_2030_5/models/__init__.py new file mode 100644 index 0000000000..a6800cc1cc --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/models/__init__.py @@ -0,0 +1,394 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from ieee_2030_5.models.enums import CurveType, DeviceCategoryType, PrimacyType +from ieee_2030_5.models.Config import ( + TypeName, + CompoundFields, + Config, + ConstantName, + Conventions, + FieldName, + Format, + ModuleName, + Output, + PackageName, + Substitution, + Substitutions, +) +from ieee_2030_5.models.enums import CurveType, DeviceCategoryType, PrimacyType +from ieee_2030_5.models.sep import ( + DER, IEEE_802_15_4, AbstractDevice, AccountBalance, AccountBalanceLink, AccountingUnit, + ActiveBillingPeriodListLink, ActiveCreditRegisterListLink, ActiveDERControlListLink, + ActiveEndDeviceControlListLink, ActiveFlowReservationListLink, ActivePower, + ActiveProjectionReadingListLink, ActiveSupplyInterruptionOverrideListLink, + ActiveTargetReadingListLink, ActiveTextMessageListLink, ActiveTimeTariffIntervalListLink, + AmpereHour, ApparentPower, ApplianceLoadReduction, AppliedTargetReduction, + AssociatedDERProgramListLink, AssociatedUsagePointLink, BillingMeterReadingBase, BillingPeriod, + BillingPeriodList, BillingPeriodListLink, BillingReading, BillingReadingList, + BillingReadingListLink, BillingReadingSet, BillingReadingSetList, BillingReadingSetListLink, + Charge, Condition, Configuration, ConfigurationLink, ConnectStatusType, + ConsumptionTariffInterval, ConsumptionTariffIntervalList, ConsumptionTariffIntervalListLink, + CreditRegister, CreditRegisterList, CreditRegisterListLink, CreditTypeChange, + CurrentDERProgramLink, CurrentRMS, CurveData, CustomerAccount, CustomerAccountLink, + CustomerAccountList, CustomerAccountListLink, CustomerAgreement, CustomerAgreementList, + CustomerAgreementListLink, DateTimeInterval, DefaultDERControl, DefaultDERControlLink, + DemandResponseProgram, DemandResponseProgramLink, DemandResponseProgramList, + DemandResponseProgramListLink, DERAvailability, DERAvailabilityLink, DERCapability, + DERCapabilityLink, DERControl, DERControlBase, DERControlList, DERControlListLink, + DERControlResponse, DERCurve, DERCurveLink, DERCurveList, DERCurveListLink, DERLink, DERList, + DERListLink, DERProgram, DERProgramLink, DERProgramList, DERProgramListLink, DERSettings, + DERSettingsLink, DERStatus, DERStatusLink, DeviceCapability, DeviceCapabilityLink, + DeviceInformation, DeviceInformationLink, DeviceStatus, DeviceStatusLink, DRLCCapabilities, + DrResponse, DutyCycle, EndDevice, EndDeviceControl, EndDeviceControlList, + EndDeviceControlListLink, EndDeviceLink, EndDeviceList, EndDeviceListLink, EnvironmentalCost, + Error, Event, EventStatus, File, FileLink, FileList, FileListLink, FileStatus, FileStatusLink, + FixedPointType, FixedVar, FlowReservationRequest, FlowReservationRequestList, + FlowReservationRequestListLink, FlowReservationResponse, FlowReservationResponseList, + FlowReservationResponseListLink, FlowReservationResponseResponse, FreqDroopType, + FunctionSetAssignments, FunctionSetAssignmentsBase, FunctionSetAssignmentsList, + FunctionSetAssignmentsListLink, GPSLocationType, HistoricalReading, HistoricalReadingList, + HistoricalReadingListLink, IdentifiedObject, InverterStatusType, IPAddr, IPAddrList, + IPAddrListLink, IPInterface, IPInterfaceList, IPInterfaceListLink, Link, List_type, ListLink, + LLInterface, LLInterfaceList, LLInterfaceListLink, LoadShedAvailability, + LoadShedAvailabilityList, LoadShedAvailabilityListLink, LocalControlModeStatusType, LogEvent, + LogEventList, LogEventListLink, ManufacturerStatusType, MessagingProgram, MessagingProgramList, + MessagingProgramListLink, MeterReading, MeterReadingBase, MeterReadingLink, MeterReadingList, + MeterReadingListLink, MirrorMeterReading, MirrorMeterReadingList, MirrorReadingSet, + MirrorUsagePoint, MirrorUsagePointList, MirrorUsagePointListLink, Neighbor, NeighborList, + NeighborListLink, Notification, NotificationList, NotificationListLink, Offset, + OperationalModeStatusType, PEVInfo, PowerConfiguration, PowerFactor, PowerFactorWithExcitation, + PowerStatus, PowerStatusLink, Prepayment, PrepaymentLink, PrepaymentList, PrepaymentListLink, + PrepayOperationStatus, PrepayOperationStatusLink, PriceResponse, PriceResponseCfg, + PriceResponseCfgList, PriceResponseCfgListLink, ProjectionReading, ProjectionReadingList, + ProjectionReadingListLink, RandomizableEvent, RateComponent, RateComponentLink, + RateComponentList, RateComponentListLink, ReactivePower, ReactiveSusceptance, Reading, + ReadingBase, ReadingLink, ReadingList, ReadingListLink, ReadingSet, ReadingSetBase, + ReadingSetList, ReadingSetListLink, ReadingType, ReadingTypeLink, RealEnergy, Registration, + RegistrationLink, RequestStatus, Resource, RespondableIdentifiedObject, RespondableResource, + RespondableSubscribableIdentifiedObject, Response, ResponseList, ResponseListLink, ResponseSet, + ResponseSetList, ResponseSetListLink, RPLInstance, RPLInstanceList, RPLInstanceListLink, + RPLSourceRoutes, RPLSourceRoutesList, RPLSourceRoutesListLink, SelfDevice, SelfDeviceLink, + ServiceChange, ServiceSupplier, ServiceSupplierLink, ServiceSupplierList, SetPoint, + SignedRealEnergy, StateOfChargeStatusType, StorageModeStatusType, SubscribableIdentifiedObject, + SubscribableList, SubscribableResource, Subscription, SubscriptionBase, SubscriptionList, + SubscriptionListLink, SupplyInterruptionOverride, SupplyInterruptionOverrideList, + SupplyInterruptionOverrideListLink, SupportedLocale, SupportedLocaleList, + SupportedLocaleListLink, TargetReading, TargetReadingList, TargetReadingListLink, + TargetReduction, TariffProfile, TariffProfileLink, TariffProfileList, TariffProfileListLink, + Temperature, TextMessage, TextMessageList, TextMessageListLink, TextResponse, Time, + TimeConfiguration, TimeLink, TimeTariffInterval, TimeTariffIntervalList, + TimeTariffIntervalListLink, UnitValueType, UnsignedFixedPointType, UsagePoint, UsagePointBase, + UsagePointLink, UsagePointList, UsagePointListLink, VoltageRMS, WattHour, loWPAN) + +__all__ = [ + 'ForecastNumericType', + 'ForecastParameter', + 'ForecastParameterSet', + 'ForecastParameterSetList', + 'AbstractDevice', + 'AccountBalance', + 'AccountBalanceLink', + 'AccountingUnit', + 'ActiveBillingPeriodListLink', + 'ActiveCreditRegisterListLink', + 'ActiveDERControlListLink', + 'ActiveEndDeviceControlListLink', + 'ActiveFlowReservationListLink', + 'ActivePower', + 'ActiveProjectionReadingListLink', + 'ActiveSupplyInterruptionOverrideListLink', + 'ActiveTargetReadingListLink', + 'ActiveTextMessageListLink', + 'ActiveTimeTariffIntervalListLink', + 'AmpereHour', + 'ApparentPower', + 'ApplianceLoadReduction', + 'AppliedTargetReduction', + 'AssociatedDERProgramListLink', + 'AssociatedUsagePointLink', + 'BillingMeterReadingBase', + 'BillingPeriod', + 'BillingPeriodList', + 'BillingPeriodListLink', + 'BillingReading', + 'BillingReadingList', + 'BillingReadingListLink', + 'BillingReadingSet', + 'BillingReadingSetList', + 'BillingReadingSetListLink', + 'Charge', + 'Condition', + 'Configuration', + 'ConfigurationLink', + 'ConnectStatusType', + 'ConsumptionTariffInterval', + 'ConsumptionTariffIntervalList', + 'ConsumptionTariffIntervalListLink', + 'CreditRegister', + 'CreditRegisterList', + 'CreditRegisterListLink', + 'CreditTypeChange', + 'CurrentDERProgramLink', + 'CurrentRMS', + 'CurveData', + 'CurveType', + 'CustomerAccount', + 'CustomerAccountLink', + 'CustomerAccountList', + 'CustomerAccountListLink', + 'CustomerAgreement', + 'CustomerAgreementList', + 'CustomerAgreementListLink', + 'DER', + 'DERAvailability', + 'DERAvailabilityLink', + 'DERCapability', + 'DERCapabilityLink', + 'DERControl', + 'DERControlBase', + 'DERControlList', + 'DERControlListLink', + 'DERControlResponse', + 'DERCurve', + 'DERCurveLink', + 'DERCurveList', + 'DERCurveListLink', + 'DERLink', + 'DERList', + 'DERListLink', + 'DERProgram', + 'DERProgramLink', + 'DERProgramList', + 'DERProgramListLink', + 'DERSettings', + 'DERSettingsLink', + 'DERStatus', + 'DERStatusLink', + 'DRLCCapabilities', + 'DateTimeInterval', + 'DefaultDERControl', + 'DefaultDERControlLink', + 'DemandResponseProgram', + 'DemandResponseProgramLink', + 'DemandResponseProgramList', + 'DemandResponseProgramListLink', + 'DeviceCapability', + 'DeviceCapabilityLink', + 'DeviceCategoryType', + 'DeviceInformation', + 'DeviceInformationLink', + 'DeviceStatus', + 'DeviceStatusLink', + 'DrResponse', + 'DutyCycle', + 'EndDevice', + 'EndDeviceControl', + 'EndDeviceControlList', + 'EndDeviceControlListLink', + 'EndDeviceLink', + 'EndDeviceList', + 'EndDeviceListLink', + 'EnvironmentalCost', + 'Error', + 'Event', + 'EventStatus', + 'File', + 'FileLink', + 'FileList', + 'FileListLink', + 'FileStatus', + 'FileStatusLink', + 'FixedPointType', + 'FixedVar', + 'FlowReservationRequest', + 'FlowReservationRequestList', + 'FlowReservationRequestListLink', + 'FlowReservationResponse', + 'FlowReservationResponseList', + 'FlowReservationResponseListLink', + 'FlowReservationResponseResponse', + 'FreqDroopType', + 'FunctionSetAssignments', + 'FunctionSetAssignmentsBase', + 'FunctionSetAssignmentsList', + 'FunctionSetAssignmentsListLink', + 'GPSLocationType', + 'HistoricalReading', + 'HistoricalReadingList', + 'HistoricalReadingListLink', + 'IEEE_802_15_4', + 'IPAddr', + 'IPAddrList', + 'IPAddrListLink', + 'IPInterface', + 'IPInterfaceList', + 'IPInterfaceListLink', + 'IdentifiedObject', + 'InverterStatusType', + 'LLInterface', + 'LLInterfaceList', + 'LLInterfaceListLink', + 'Link', + 'List_type', + 'ListLink', + 'LoadShedAvailability', + 'LoadShedAvailabilityList', + 'LoadShedAvailabilityListLink', + 'LocalControlModeStatusType', + 'LogEvent', + 'LogEventList', + 'LogEventListLink', + 'ManufacturerStatusType', + 'MessagingProgram', + 'MessagingProgramList', + 'MessagingProgramListLink', + 'MeterReading', + 'MeterReadingBase', + 'MeterReadingLink', + 'MeterReadingList', + 'MeterReadingListLink', + 'MirrorMeterReading', + 'MirrorMeterReadingList', + 'MirrorReadingSet', + 'MirrorUsagePoint', + 'MirrorUsagePointList', + 'MirrorUsagePointListLink', + 'Neighbor', + 'NeighborList', + 'NeighborListLink', + 'Notification', + 'NotificationList', + 'NotificationListLink', + 'Offset', + 'OperationalModeStatusType', + 'PEVInfo', + 'PowerConfiguration', + 'PowerFactor', + 'PowerFactorWithExcitation', + 'PowerStatus', + 'PowerStatusLink', + 'PrepayOperationStatus', + 'PrepayOperationStatusLink', + 'Prepayment', + 'PrepaymentLink', + 'PrepaymentList', + 'PrepaymentListLink', + 'PriceResponse', + 'PriceResponseCfg', + 'PriceResponseCfgList', + 'PriceResponseCfgListLink', + 'ProjectionReading', + 'ProjectionReadingList', + 'ProjectionReadingListLink', + 'RPLInstance', + 'RPLInstanceList', + 'RPLInstanceListLink', + 'RPLSourceRoutes', + 'RPLSourceRoutesList', + 'RPLSourceRoutesListLink', + 'RandomizableEvent', + 'RateComponent', + 'RateComponentLink', + 'RateComponentList', + 'RateComponentListLink', + 'ReactivePower', + 'ReactiveSusceptance', + 'Reading', + 'ReadingBase', + 'ReadingLink', + 'ReadingList', + 'ReadingListLink', + 'ReadingSet', + 'ReadingSetBase', + 'ReadingSetList', + 'ReadingSetListLink', + 'ReadingType', + 'ReadingTypeLink', + 'RealEnergy', + 'Registration', + 'RegistrationLink', + 'RequestStatus', + 'Resource', + 'RespondableIdentifiedObject', + 'RespondableResource', + 'RespondableSubscribableIdentifiedObject', + 'Response', + 'ResponseList', + 'ResponseListLink', + 'ResponseSet', + 'ResponseSetList', + 'ResponseSetListLink', + 'SelfDevice', + 'SelfDeviceLink', + 'ServiceChange', + 'ServiceSupplier', + 'ServiceSupplierLink', + 'ServiceSupplierList', + 'SetPoint', + 'SignedRealEnergy', + 'StateOfChargeStatusType', + 'StorageModeStatusType', + 'SubscribableIdentifiedObject', + 'SubscribableList', + 'SubscribableResource', + 'Subscription', + 'SubscriptionBase', + 'SubscriptionList', + 'SubscriptionListLink', + 'SupplyInterruptionOverride', + 'SupplyInterruptionOverrideList', + 'SupplyInterruptionOverrideListLink', + 'SupportedLocale', + 'SupportedLocaleList', + 'SupportedLocaleListLink', + 'TargetReading', + 'TargetReadingList', + 'TargetReadingListLink', + 'TargetReduction', + 'TariffProfile', + 'TariffProfileLink', + 'TariffProfileList', + 'TariffProfileListLink', + 'Temperature', + 'TextMessage', + 'TextMessageList', + 'TextMessageListLink', + 'TextResponse', + 'Time', + 'TimeConfiguration', + 'TimeLink', + 'TimeTariffInterval', + 'TimeTariffIntervalList', + 'TimeTariffIntervalListLink', + 'UnitValueType', + 'UnsignedFixedPointType', + 'UsagePoint', + 'UsagePointBase', + 'UsagePointLink', + 'UsagePointList', + 'UsagePointListLink', + 'VoltageRMS', + 'WattHour', + 'loWPAN', +] diff --git a/services/core/IEEE_2030_5/ieee_2030_5/models/constants.py b/services/core/IEEE_2030_5/ieee_2030_5/models/constants.py new file mode 100644 index 0000000000..b8b525e229 --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/models/constants.py @@ -0,0 +1,221 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +import enum + + +class RtgNormalCategoryType(enum.IntEnum): + not_specified = 0 + category_a = 1 + category_b = 2 + + +class RtgAbnormalCategoryType(enum.IntEnum): + not_specified = 0 + category_I = 1 + category_II = 2 + category_III = 3 + + +class DataQualifierType(enum.IntEnum): + Not_applicable = 0 + Average = 2 + Maximum = 8 + Minimum = 9 + Normal = 12 + Standard_deviation_of_population = 29 + Standard_deviation_of_sample = 30 + + +class CommodityType(enum.IntEnum): + Not_applicable = 0 + Electricity_secondary_metered = 1 + Electricity_primary_metered = 2 + Air = 4 + NaturalGas = 7 + Propane = 8 + PotableWater = 9 + Steam = 10 + WasteWater = 11 + HeatingFluid = 12 + CoolingFluid = 13 + + +class FlowDirectionType(enum.IntEnum): + Not_applicable = 0 + Forward = 1 + Reverse = 19 + + +class UomType(enum.IntEnum): + Not_applicable = 0 + Amperes = 5 + Kelvin = 6 + Degrees_celsius = 23 + Voltage = 29 + Joule = 31 + Hz = 33 + W = 38 + M_cubed = 42 + VA = 61 + VAr = 63 + CosTheta = 65 + V_squared = 67 + A_squared = 69 + VAh = 71 + Wh = 72 + VArh = 73 + Ah = 106 + Ft_cubed = 119 + Ft_cubed_per_hour = 122 + M_cubed_per_hour = 125 + US_gallons = 128 + UG_gallons_per_hour = 129 + Imperial_gallons = 130 + Imperial_gallons_per_hour = 131 + BTU = 132 + BTU_per_hour = 133 + Liter = 134 + Liter_per_hour = 137 + PA_gauge = 140 + PA_absolute = 155 + Therm = 169 + + +class RoleFlagsType(enum.Flag): + IsMirror = 0 + IsPremiseAggregationPoint = 1 + IsPEV = 2 + IsDER = 4 + IsRevenueQuality = 8 + IsDC = 16 + IsSubmeter = 32 + + +class AccumlationBehaviourType(enum.IntEnum): + Not_applicable = 0 + Cumulative = 3 + DeltaData = 4 + Indicating = 6 + Summation = 9 + Instantaneous = 12 + + +class ServiceKind(enum.IntEnum): + Electricity = 0 + Gas = 1 + Water = 2 + Time = 3 + Pressure = 4 + Heat = 5 + Cooling = 6 + + +class QualityFlagsType(enum.Flag): + Valid = 0 + Manually_edited = 1 + estimated_using_reference_day = 2 + estimated_using_linear_interpolation = 4 + questionable = 8 + derived = 16 + projected = 32 + + +# p163 +class ConsumptionBlockType(enum.IntEnum): + Not_applicable = 0 + Block_1 = 1 + Block_2 = 2 + Block_3 = 3 + Block_4 = 4 + Block_5 = 5 + Block_6 = 6 + Block_7 = 7 + Block_8 = 8 + Block_9 = 9 + Block_10 = 10 + Block_11 = 11 + Block_12 = 12 + Block_13 = 13 + Block_14 = 14 + Block_15 = 15 + Block_16 = 16 + + +# p170 +class TOUType(enum.IntEnum): + Not_applicable = 0 + TOU_A = 1 + TOU_B = 2 + TOU_C = 3 + TOU_D = 4 + TOU_E = 5 + TOU_F = 6 + TOU_G = 7 + TOU_H = 8 + TOU_I = 9 + TOU_J = 10 + TOU_K = 11 + TOU_L = 12 + TOU_M = 13 + TOU_N = 14 + TOU_O = 15 + + +class KindType(enum.IntEnum): + Not_applicable = 0 + Currency = 3 + Demand = 8 + Energy = 12 + Power = 37 + + +class PhaseCode(enum.IntEnum): + Not_applicable = 0 + Phase_C = 32 # and S2 + Phase_CN = 33 # and S2N + Phase_CA = 40 + Phase_B = 64 + Phase_BN = 65 + Phase_BC = 66 + Phase_A = 128 # and S1 + Phase_AN = 129 # and S1N + Phase_AB = 132 + Phase_ABC = 224 + + +""" Subscription/Notification +""" + + +class ResponseRequiredType(enum.Flag): + enddevice_shall_indicate_that_message_was_received = 0 + enddevice_shall_indicate_specific_response = 1 + enduser_customer_response_is_required = 2 + + +class SubscribableType(enum.IntEnum): + resource_does_not_support_subscriptions = 0 + resource_supports_non_conditional_subscriptions = 1 + resource_supports_conditional_subscriptions = 2 + resource_supports_both_conditional_and_non_conditional_subscriptions = 3 diff --git a/services/core/IEEE_2030_5/ieee_2030_5/models/enums.py b/services/core/IEEE_2030_5/ieee_2030_5/models/enums.py new file mode 100644 index 0000000000..645b7dadf3 --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/models/enums.py @@ -0,0 +1,152 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from enum import IntEnum + + +class PrimacyType(IntEnum): + # Values possible for indication of "Primary" provider: + # 0: In home energy management system + # 1: Contracted premises service provider + # 2: Non-contractual service provider + # 3 - 64: Reserved + # 65 - 191: User-defined + #192 - 255: Reserved + InHomeManagementSystem = 0 + ContractedPremisesServiceProvider = 1 + NonContractualServiceProvider = 2 + + +class DERUnitRefType(IntEnum): + # 0 - N/A + # 1 - %setMaxW + # 2 - %setMaxVar + # 3 - %statVarAvail + # 4 - %setEffectiveV + # 5 - %setMaxChargeRateW + # 6 - %setMaxDischargeRateW + # 7 - %statWAvail + NA = 0 + setMaxW = 1 + setMaxVar = 2 + statVarAvail = 3 + setEffectiveV = 4 + setMaxChargeRateW = 5 + setMaxDischargeRateW = 6 + statWAvail = 7 + +class CurveType(IntEnum): + # 0 - opModFreqWatt (Frequency-Watt Curve Mode) + # 1 - opModHFRTMayTrip (High Frequency Ride Through, May Trip Mode) + # 2 - opModHFRTMustTrip (High Frequency Ride Through, Must Trip Mode) + # 3 - opModHVRTMayTrip (High Voltage Ride Through, May Trip Mode) + # 4 - opModHVRTMomentaryCessation (High Voltage Ride Through, Momentary Cessation + # Mode) + # 5 - opModHVRTMustTrip (High Voltage Ride Through, Must Trip Mode) + # 6 - opModLFRTMayTrip (Low Frequency Ride Through, May Trip Mode) + # 7 - opModLFRTMustTrip (Low Frequency Ride Through, Must Trip Mode) + # 8 - opModLVRTMayTrip (Low Voltage Ride Through, May Trip Mode) + # 9 - opModLVRTMomentaryCessation (Low Voltage Ride Through, Momentary Cessation + # Mode) + # 10 - opModLVRTMustTrip (Low Voltage Ride Through, Must Trip Mode) + # 11 - opModVoltVar (Volt-Var Mode) + # 12 - opModVoltWatt (Volt-Watt Mode) + # 13 - opModWattPF (Watt-PowerFactor Mode) + # 14 - opModWattVar (Watt-Var Mode) + opModFreqWatt = 0 + opModHFRTMayTrip = 1 + opModHFRTMustTrip = 2 + opModHVRTMayTrip = 3 + opModHVRTMomentaryCessation = 4 + opModHVRTMustTrip = 5 + opModLFRTMayTrip = 6 + opModLFRTMustTrip = 7 + opModLVRTMayTrip = 8 + opModLVRTMomentaryCessation = 9 + opModLVRTMustTrip = 10 + opModVoltVar = 11 + opModVoltWatt = 12 + opModWattPF = 13 + opModWattVar = 14 + + +class DeviceCategoryType(IntEnum): + """ + DeviceCategoryType defined from 20305-2018_IIEStandardforSmartEnergyProfileApplicationsProtocol.pdf Appendix + B.2.3.4 Types package + """ + # The Device category types defined. + # Bit positions SHALL be defined as follows: + PROGRAMMABLE_COMMUNICATING_THERMOSTAT = 0 + STRIP_HEATERS = 1 + BASEBOARD_HEATERS = 2 + WATER_HEATER = 3 + POOL_PUMP = 4 + SAUNA = 5 + HOT_TUB = 6 + SMART_APPLIANCE = 7 + IRRIGATION_PUMP = 8 + MANAGED_COMMERCIAL_AND_INDUSTRIAL_LOADS = 9 + SIMPLE_RESIDENTIAL_LOADS = 10 # On/Off loads + EXTERIOR_LIGHTING = 11 + INTERIOR_LIGHTING = 12 + LOAD_CONTROL_SWITCH = 13 + ENERGY_MANAGEMENT_SYSTEM = 14 + SMART_ENERGY_MODULE = 15 + ELECTRIC_VEHICLE = 16 + ELECTRIC_VEHICLE_SUPPLY_EQUIPMENT = 17 + VIRTUAL_OR_MIXED_DER = 18 + RECIPROCATING_ENGINE = 19 # Synchronous Machine + FUEL_CELL = 20 # Battery + PHOTOVOLTAIC_SYSTEM = 21 # Solar + COMBINED_HEAT_AND_POWER = 22 + COMBINED_PV_AND_STORAGE = 23 + OTHER_GENERATION_SYSTEMS = 24 + OTHER_STORAGE_SYSTEMS = 25 + + # Additional here for Aggregator + AGGREGATOR = 99 + OTHER_CLIENT = 100 + + +# 0 - Programmable Communicating Thermostat +# 1 - Strip Heaters +# 2 - Baseboard Heaters +# 3 - Water Heater +# 4 - Pool Pump +# 5 - Sauna +# 6 - Hot tub +# 7 - Smart Appliance +# 8 - Irrigation Pump +# 9 - Managed Commercial and Industrial Loads +# 10 - Simple Residential Loads +# 11 - Exterior Lighting +# 12 - Interior Lighting +# 13 - Electric Vehicle +# 14 - Generation Systems +# 15 - Load Control Switch +# 16 - Smart Inverter +# 17 - EVSE +# 18 - Residential Energy Storage Unit +# 19 - Energy Management System +# 20 - Smart Energy Module diff --git a/services/core/IEEE_2030_5/ieee_2030_5/models/sep.py b/services/core/IEEE_2030_5/ieee_2030_5/models/sep.py new file mode 100644 index 0000000000..a4d1df4758 --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/models/sep.py @@ -0,0 +1,8115 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import List, Optional + +__NAMESPACE__ = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActivePower: + """The active (real) power P (in W) is the product of root-mean-square + (RMS) voltage, RMS current, and cos(theta) where theta is the phase angle + of current relative to voltage. + + It is the primary measure of the rate of flow of energy. + + :ivar multiplier: Specifies exponent for uom. + :ivar value: Value in watts (uom 38) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class AmpereHour: + """ + Available electric charge. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Value in ampere-hours (uom 106) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ApparentPower: + """ + The apparent power S (in VA) is the product of root mean square (RMS) + voltage and RMS current. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Value in volt-amperes (uom 61) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ApplianceLoadReduction: + """The ApplianceLoadReduction object is used by a Demand Response service + provider to provide signals for ENERGY STAR compliant appliances. + + See the definition of ApplianceLoadReductionType for more + information. + + :ivar type: Indicates the type of appliance load reduction + requested. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + type: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class AppliedTargetReduction: + """ + Specifies the value of the TargetReduction applied by the device. + + :ivar type: Enumerated field representing the type of reduction + requested. + :ivar value: Indicates the requested amount of the relevant + commodity to be reduced. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + type: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Charge: + """Charges contain charges on a customer bill. + + These could be items like taxes, levies, surcharges, rebates, or + others. This is meant to allow the HAN device to retrieve enough + information to be able to reconstruct an estimate of what the total + bill would look like. Providers can provide line item billing, + including multiple charge kinds (e.g. taxes, surcharges) at whatever + granularity desired, using as many Charges as desired during a + billing period. There can also be any number of Charges associated + with different ReadingTypes to distinguish between TOU tiers, + consumption blocks, or demand charges. + + :ivar description: A description of the charge. + :ivar kind: The type (kind) of charge. + :ivar value: A monetary charge. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 20, + }) + kind: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Condition: + """ + Indicates a condition that must be satisfied for the Notification to be + triggered. + + :ivar attributeIdentifier: 0 = Reading value 1-255 = Reserved + :ivar lowerThreshold: The value of the lower threshold + :ivar upperThreshold: The value of the upper threshold + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + attributeIdentifier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + lowerThreshold: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'min_inclusive': -140737488355328, + 'max_inclusive': 140737488355328, + }) + upperThreshold: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'min_inclusive': -140737488355328, + 'max_inclusive': 140737488355328, + }) + + +@dataclass +class ConnectStatusType: + """DER ConnectStatus value (bitmap): + + 0 - Connected + 1 - Available + 2 - Operating + 3 - Test + 4 - Fault / Error + All other values reserved. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 1, + 'format': 'base16', + }) + + +@dataclass +class CreditTypeChange: + """ + Specifies a change to the credit type. + + :ivar newType: The new credit type, to take effect at the time + specified by startTime + :ivar startTime: The date/time when the change is to take effect. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + newType: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + startTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class CurrentRMS: + """ + Average flow of charge through a conductor. + + :ivar multiplier: Specifies exponent of value. + :ivar value: Value in amperes RMS (uom 5) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class CurveData: + """ + Data point values for defining a curve or schedule. + + :ivar excitation: If yvalue is Power Factor, then this field SHALL + be present. If yvalue is not Power Factor, then this field SHALL + NOT be present. True when DER is absorbing reactive power + (under-excited), false when DER is injecting reactive power + (over-excited). + :ivar xvalue: The data value of the X-axis (independent) variable, + depending on the curve type. See definitions in DERControlBase + for further information. + :ivar yvalue: The data value of the Y-axis (dependent) variable, + depending on the curve type. See definitions in DERControlBase + for further information. If yvalue is Power Factor, the + excitation field SHALL be present and yvalue SHALL be a positive + value. If yvalue is not Power Factor, the excitation field SHALL + NOT be present. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + excitation: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + xvalue: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + yvalue: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DateTimeInterval: + """ + Interval of date and time. + + :ivar duration: Duration of the interval, in seconds. + :ivar start: Date and time of the start of the interval. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + duration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + start: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DutyCycle: + """Duty cycle control is a device specific issue and is managed by the + device. + + The duty cycle of the device under control should span the shortest + practical time period in accordance with the nature of the device + under control and the intent of the request for demand reduction. + The default factory setting SHOULD be three minutes for each 10% of + duty cycle. This indicates that the default time period over which + a duty cycle is applied is 30 minutes, meaning a 10% duty cycle + would cause a device to be ON for 3 minutes. The “off state” SHALL + precede the “on state”. + + :ivar normalValue: Contains the maximum On state duty cycle applied + by the end device, as a percentage of time. The field not + present indicates that this field has not been used by the end + device. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + normalValue: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class EnvironmentalCost: + """Provides alternative or secondary price information for the relevant + RateComponent. + + Supports jurisdictions that seek to convey the environmental price + per unit of the specified commodity not expressed in currency. + Implementers and consumers can use this attribute to prioritize + operations of their HAN devices (e.g., PEV charging during times of + high availability of renewable electricity resources). + + :ivar amount: The estimated or actual environmental or other cost, + per commodity unit defined by the ReadingType, for this + RateComponent (e.g., grams of carbon dioxide emissions each per + kWh). + :ivar costKind: The kind of cost referred to in the amount. + :ivar costLevel: The relative level of the amount attribute. In + conjunction with numCostLevels, this attribute informs a device + of the relative scarcity of the amount attribute (e.g., a high + or low availability of renewable generation). numCostLevels and + costLevel values SHALL ascend in order of scarcity, where "0" + signals the lowest relative cost and higher values signal + increasing cost. For example, if numCostLevels is equal to “3,” + then if the lowest relative costLevel were equal to “0,” devices + would assume this is the lowest relative period to operate. + Likewise, if the costLevel in the next TimeTariffInterval + instance is equal to “1,” then the device would assume it is + relatively more expensive, in environmental terms, to operate + during this TimeTariffInterval instance than the previous one. + There is no limit to the number of relative price levels other + than that indicated in the attribute type, but for practicality, + service providers should strive for simplicity and recognize the + diminishing returns derived from increasing the numCostLevel + value greater than four. + :ivar numCostLevels: The number of all relative cost levels. In + conjunction with costLevel, numCostLevels signals the relative + scarcity of the commodity for the duration of the + TimeTariffInterval instance (e.g., a relative indication of + cost). This is useful in providing context for nominal cost + signals to consumers or devices that might see a range of amount + values from different service providres or from the same service + provider. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + amount: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + costKind: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + costLevel: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + numCostLevels: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Error: + """ + Contains information about the nature of an error if a request could not be + completed successfully. + + :ivar maxRetryDuration: Contains the number of seconds the client + SHOULD wait before retrying the request. + :ivar reasonCode: Code indicating the reason for failure. 0 - + Invalid request format 1 - Invalid request values (e.g. invalid + threshold values) 2 - Resource limit reached 3 - Conditional + subscription field not supported 4 - Maximum request frequency + exceeded All other values reserved + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + maxRetryDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + reasonCode: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class EventStatus: + """Current status information relevant to a specific object. + + The Status object is used to indicate the current status of an + Event. Devices can read the containing resource (e.g. TextMessage) + to get the most up to date status of the event. Devices can also + subscribe to a specific resource instance to get updates when any of + its attributes change, including the Status object. + + :ivar currentStatus: Field representing the current status type. 0 = + Scheduled This status indicates that the event has been + scheduled and the event has not yet started. The server SHALL + set the event to this status when the event is first scheduled + and persist until the event has become active or has been + cancelled. For events with a start time less than or equal to + the current time, this status SHALL never be indicated, the + event SHALL start with a status of “Active”. 1 = Active This + status indicates that the event is currently active. The server + SHALL set the event to this status when the event reaches its + earliest Effective Start Time. 2 = Cancelled When events are + cancelled, the Status.dateTime attribute SHALL be set to the + time the cancellation occurred, which cannot be in the future. + The server is responsible for maintaining the cancelled event in + its collection for the duration of the original event, or until + the server has run out of space and needs to store a new event. + Client devices SHALL be aware of Cancelled events, determine if + the Cancelled event applies to them, and cancel the event + immediately if applicable. 3 = Cancelled with Randomization The + server is responsible for maintaining the cancelled event in its + collection for the duration of the Effective Scheduled Period. + Client devices SHALL be aware of Cancelled with Randomization + events, determine if the Cancelled event applies to them, and + cancel the event immediately, using the larger of (absolute + value of randomizeStart) and (absolute value of + randomizeDuration) as the end randomization, in seconds. This + Status.type SHALL NOT be used with "regular" Events, only with + specializations of RandomizableEvent. 4 = Superseded Events + marked as Superseded by servers are events that may have been + replaced by new events from the same program that target the + exact same set of deviceCategory's (if applicable) AND + DERControl controls (e.g., opModTargetW) (if applicable) and + overlap for a given period of time. Servers SHALL mark an event + as Superseded at the earliest Effective Start Time of the + overlapping event. Servers are responsible for maintaining the + Superseded event in their collection for the duration of the + Effective Scheduled Period. Client devices encountering a + Superseded event SHALL terminate execution of the event + immediately and commence execution of the new event immediately, + unless the current time is within the start randomization window + of the superseded event, in which case the client SHALL obey the + start randomization of the new event. This Status.type SHALL NOT + be used with TextMessage, since multiple text messages can be + active. All other values reserved. + :ivar dateTime: The dateTime attribute will provide a timestamp of + when the current status was defined. dateTime MUST be set to the + time at which the status change occurred, not a time in the + future or past. + :ivar potentiallySuperseded: Set to true by a server of this event + if there are events that overlap this event in time and also + overlap in some, but not all, deviceCategory's (if applicable) + AND DERControl controls (e.g., opModTargetW) (if applicable) in + the same function set instance. + :ivar potentiallySupersededTime: Indicates the time that the + potentiallySuperseded flag was set. + :ivar reason: The Reason attribute allows a Service provider to + provide a textual explanation of the status. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + currentStatus: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + potentiallySuperseded: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + potentiallySupersededTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + reason: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 192, + }) + + +@dataclass +class FixedPointType: + """ + Abstract type for specifying a fixed-point value without a given unit of + measure. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Dimensionless value + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class FixedVar: + """ + Specifies a signed setpoint for reactive power. + + :ivar refType: Indicates whether to interpret 'value' as %setMaxVar + or %statVarAvail. + :ivar value: Specify a signed setpoint for reactive power in % (see + 'refType' for context). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + refType: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class FreqDroopType: + """ + Type for Frequency-Droop (Frequency-Watt) operation. + + :ivar dBOF: Frequency droop dead band for over-frequency conditions. + In thousandths of Hz. + :ivar dBUF: Frequency droop dead band for under-frequency + conditions. In thousandths of Hz. + :ivar kOF: Frequency droop per-unit frequency change for over- + frequency conditions corresponding to 1 per-unit power output + change. In thousandths, unitless. + :ivar kUF: Frequency droop per-unit frequency change for under- + frequency conditions corresponding to 1 per-unit power output + change. In thousandths, unitless. + :ivar openLoopTms: Open loop response time, the duration from a step + change in control signal input until the output changes by 90% + of its final change before any overshoot, in hundredths of a + second. Resolution is 1/100 sec. A value of 0 is used to mean no + limit. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dBOF: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + dBUF: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + kOF: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + kUF: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + openLoopTms: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class GPSLocationType: + """ + Specifies a GPS location, expressed in WGS 84 coordinates. + + :ivar lat: Specifies the latitude from equator. -90 (south) to +90 + (north) in decimal degrees. + :ivar lon: Specifies the longitude from Greenwich Meridian. -180 + (west) to +180 (east) in decimal degrees. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + lat: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + lon: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + + +@dataclass +class InverterStatusType: + """DER InverterStatus value: + + 0 - N/A + 1 - off + 2 - sleeping (auto-shutdown) or DER is at low output power/voltage + 3 - starting up or ON but not producing power + 4 - tracking MPPT power point + 5 - forced power reduction/derating + 6 - shutting down + 7 - one or more faults exist + 8 - standby (service on unit) - DER may be at high output voltage/power + 9 - test mode + 10 - as defined in manufacturer status + All other values reserved. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Link: + """ + Links provide a reference, via URI, to another resource. + + :ivar href: A URI reference. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + href: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class LocalControlModeStatusType: + """DER LocalControlModeStatus/value: + + 0 – local control 1 – remote control All other values reserved. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ManufacturerStatusType: + """ + DER ManufacturerStatus/value: String data type. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 6, + }) + + +@dataclass +class Offset: + """If a temperature offset is sent that causes the heating or cooling + temperature set point to exceed the limit boundaries that are programmed + into the device, the device SHALL respond by setting the temperature at the + limit. + + If an EDC is being targeted at multiple devices or to a device that + controls multiple devices (e.g., EMS), it can provide multiple + Offset types within one EDC. For events with multiple Offset types, + a client SHALL select the Offset that best fits their operating + function. Alternatively, an event with a single Offset type can be + targeted at an EMS in order to request a percentage load reduction + on the average energy usage of the entire premise. An EMS SHOULD use + the Metering function set to determine the initial load in the + premise, reduce energy consumption by controlling devices at its + disposal, and at the conclusion of the event, once again use the + Metering function set to determine if the desired load reduction was + achieved. + + :ivar coolingOffset: The value change requested for the cooling + offset, in degree C / 10. The value should be added to the + normal set point for cooling, or if loadShiftForward is true, + then the value should be subtracted from the normal set point. + :ivar heatingOffset: The value change requested for the heating + offset, in degree C / 10. The value should be subtracted for + heating, or if loadShiftForward is true, then the value should + be added to the normal set point. + :ivar loadAdjustmentPercentageOffset: The value change requested for + the load adjustment percentage. The value should be subtracted + from the normal setting, or if loadShiftForward is true, then + the value should be added to the normal setting. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + coolingOffset: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + heatingOffset: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + loadAdjustmentPercentageOffset: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class OperationalModeStatusType: + """DER OperationalModeStatus value: + + 0 - Not applicable / Unknown + 1 - Off + 2 - Operational mode + 3 - Test mode + All other values reserved. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class PowerConfiguration: + """ + Contains configuration related to the device's power sources. + + :ivar batteryInstallTime: Time/Date at which battery was installed, + :ivar lowChargeThreshold: In context of the PowerStatus resource, + this is the value of EstimatedTimeRemaining below which + BatteryStatus "low" is indicated and the PS_LOW_BATTERY is + raised. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + batteryInstallTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + lowChargeThreshold: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class PowerFactor: + """ + Specifies a setpoint for Displacement Power Factor, the ratio between + apparent and active powers at the fundamental frequency (e.g. 60 Hz). + + :ivar displacement: Significand of an unsigned value of cos(theta) + between 0 and 1.0. E.g. a value of 0.95 may be specified as a + displacement of 950 and a multiplier of -3. + :ivar multiplier: Specifies exponent of 'displacement'. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + displacement: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class PowerFactorWithExcitation: + """ + Specifies a setpoint for Displacement Power Factor, the ratio between + apparent and active powers at the fundamental frequency (e.g. 60 Hz) and + includes an excitation flag. + + :ivar displacement: Significand of an unsigned value of cos(theta) + between 0 and 1.0. E.g. a value of 0.95 may be specified as a + displacement of 950 and a multiplier of -3. + :ivar excitation: True when DER is absorbing reactive power (under- + excited), false when DER is injecting reactive power (over- + excited). + :ivar multiplier: Specifies exponent of 'displacement'. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + displacement: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + excitation: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ReactivePower: + """ + The reactive power Q (in var) is the product of root mean square (RMS) + voltage, RMS current, and sin(theta) where theta is the phase angle of + current relative to voltage. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Value in volt-amperes reactive (var) (uom 63) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ReactiveSusceptance: + """ + Reactive susceptance. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Value in siemens (uom 53) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class RealEnergy: + """ + Real electrical energy. + + :ivar multiplier: Multiplier for 'unit'. + :ivar value: Value of the energy in Watt-hours. (uom 72) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_inclusive': 281474976710655, + }) + + +@dataclass +class RequestStatus: + """ + The RequestStatus object is used to indicate the current status of a Flow + Reservation Request. + + :ivar dateTime: The dateTime attribute will provide a timestamp of + when the request status was set. dateTime MUST be set to the + time at which the status change occurred, not a time in the + future or past. + :ivar requestStatus: Field representing the request status type. 0 = + Requested 1 = Cancelled All other values reserved. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + requestStatus: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Resource: + """ + A resource is an addressable unit of information, either a collection + (List) or instance of an object (identifiedObject, or simply, Resource) + + :ivar href: A reference to the resource address (URI). Required in a + response to a GET, ignored otherwise. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + href: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class ServiceChange: + """ + Specifies a change to the service status. + + :ivar newStatus: The new service status, to take effect at the time + specified by startTime + :ivar startTime: The date/time when the change is to take effect. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + newStatus: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + startTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class SetPoint: + """The SetPoint object is used to apply specific temperature set points to + a temperature control device. + + The values of the heatingSetpoint and coolingSetpoint attributes SHALL be calculated as follows: + Cooling/Heating Temperature Set Point / 100 = temperature in degrees Celsius where -273.15°C &lt;= temperature &lt;= 327.67°C, corresponding to a Cooling and/or Heating Temperature Set Point. The maximum resolution this format allows is 0.01°C. + The field not present in a Response indicates that this field has not been used by the end device. + If a temperature is sent that exceeds the temperature limit boundaries that are programmed into the device, the device SHALL respond by setting the temperature at the limit. + + :ivar coolingSetpoint: This attribute represents the cooling + temperature set point in degrees Celsius / 100. (Hundredths of a + degree C) + :ivar heatingSetpoint: This attribute represents the heating + temperature set point in degrees Celsius / 100. (Hundredths of a + degree C) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + coolingSetpoint: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + heatingSetpoint: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class SignedRealEnergy: + """ + Real electrical energy, signed. + + :ivar multiplier: Multiplier for 'unit'. + :ivar value: Value of the energy in Watt-hours. (uom 72) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'min_inclusive': -140737488355328, + 'max_inclusive': 140737488355328, + }) + + +@dataclass +class StateOfChargeStatusType: + """ + DER StateOfChargeStatus value: Percent data type. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class StorageModeStatusType: + """DER StorageModeStatus value: + + 0 – storage charging 1 – storage discharging 2 – storage holding All + other values reserved. + + :ivar dateTime: The date and time at which the state applied. + :ivar value: The value indicating the state. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class TargetReduction: + """The TargetReduction object is used by a Demand Response service provider + to provide a RECOMMENDED threshold that a device/premises should maintain + its consumption below. + + For example, a service provider can provide a RECOMMENDED threshold + of some kWh for a 3-hour event. This means that the device/premises + would maintain its consumption below the specified limit for the + specified period. + + :ivar type: Indicates the type of reduction requested. + :ivar value: Indicates the requested amount of the relevant + commodity to be reduced. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + type: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class Temperature: + """ + Specification of a temperature. + + :ivar multiplier: Multiplier for 'unit'. + :ivar subject: The subject of the temperature measurement 0 - + Enclosure 1 - Transformer 2 - HeatSink + :ivar value: Value in Degrees Celsius (uom 23). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + subject: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class TimeConfiguration: + """ + Contains attributes related to the configuration of the time service. + + :ivar dstEndRule: Rule to calculate end of daylight savings time in + the current year. Result of dstEndRule must be greater than + result of dstStartRule. + :ivar dstOffset: Daylight savings time offset from local standard + time. + :ivar dstStartRule: Rule to calculate start of daylight savings time + in the current year. Result of dstEndRule must be greater than + result of dstStartRule. + :ivar tzOffset: Local time zone offset from UTCTime. Does not + include any daylight savings time offsets. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dstEndRule: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 4, + 'format': 'base16', + }) + dstOffset: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + dstStartRule: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 4, + 'format': 'base16', + }) + tzOffset: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class UnitValueType: + """ + Type for specification of a specific value, with units and power of ten + multiplier. + + :ivar multiplier: Multiplier for 'unit'. + :ivar unit: Unit in symbol + :ivar value: Value in units specified + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + unit: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class UnsignedFixedPointType: + """ + Abstract type for specifying an unsigned fixed-point value without a given + unit of measure. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Dimensionless value + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class VoltageRMS: + """ + Average electric potential difference between two points. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Value in volts RMS (uom 29) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class WattHour: + """ + Active (real) energy. + + :ivar multiplier: Specifies exponent of uom. + :ivar value: Value in watt-hours (uom 72) + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class loWPAN: + """ + Contains information specific to 6LoWPAN. + + :ivar octetsRx: Number of Bytes received + :ivar octetsTx: Number of Bytes transmitted + :ivar packetsRx: Number of packets received + :ivar packetsTx: Number of packets transmitted + :ivar rxFragError: Number of errors receiving fragments + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + octetsRx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + octetsTx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + packetsRx: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + packetsTx: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + rxFragError: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class AccountBalanceLink(Link): + """ + SHALL contain a Link to an instance of AccountBalance. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class AccountingUnit: + """ + Unit for accounting; use either 'energyUnit' or 'currencyUnit' to specify + the unit for 'value'. + + :ivar energyUnit: Unit of service. + :ivar monetaryUnit: Unit of currency. + :ivar multiplier: Multiplier for the 'energyUnit' or 'monetaryUnit'. + :ivar value: Value of the monetary aspect + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + energyUnit: Optional[RealEnergy] = field(default=None, metadata={ + 'type': 'Element', + }) + monetaryUnit: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + multiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + value: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class AssociatedUsagePointLink(Link): + """SHALL contain a Link to an instance of UsagePoint. + + If present, this is the submeter that monitors the DER output. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class BillingPeriod(Resource): + """A Billing Period relates to the period of time on which a customer is + billed. + + As an example the billing period interval for a particular customer + might be 31 days starting on July 1, 2011. The start date and + interval can change on each billing period. There may also be + multiple billing periods related to a customer agreement to support + different tariff structures. + + :ivar billLastPeriod: The amount of the bill for the previous + billing period. + :ivar billToDate: The bill amount related to the billing period as + of the statusTimeStamp. + :ivar interval: The time interval for this billing period. + :ivar statusTimeStamp: The date / time of the last update of this + resource. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + billLastPeriod: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'min_inclusive': -140737488355328, + 'max_inclusive': 140737488355328, + }) + billToDate: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'min_inclusive': -140737488355328, + 'max_inclusive': 140737488355328, + }) + interval: Optional[DateTimeInterval] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + statusTimeStamp: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ConfigurationLink(Link): + """ + SHALL contain a Link to an instance of Configuration. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ConsumptionTariffInterval(Resource): + """One of a sequence of thresholds defined in terms of consumption quantity + of a service such as electricity, water, gas, etc. + + It defines the steps or blocks in a step tariff structure, where + startValue simultaneously defines the entry value of this step and + the closing value of the previous step. Where consumption is greater + than startValue, it falls within this block and where consumption is + less than or equal to startValue, it falls within one of the + previous blocks. + + :ivar consumptionBlock: Indicates the consumption block related to + the reading. If not specified, is assumed to be "0 - N/A". + :ivar EnvironmentalCost: + :ivar price: The charge for this rate component, per unit of measure + defined by the associated ReadingType, in currency specified in + TariffProfile. The Pricing service provider determines the + appropriate price attribute value based on its applicable + regulatory rules. For example, price could be net or inclusive + of applicable taxes, fees, or levies. The Billing function set + provides the ability to represent billing information in a more + detailed manner. + :ivar startValue: The lowest level of consumption that defines the + starting point of this consumption step or block. Thresholds + start at zero for each billing period. If specified, the first + ConsumptionTariffInterval.startValue for a TimeTariffInteral + instance SHALL begin at "0." Subsequent + ConsumptionTariffInterval.startValue elements SHALL be greater + than the previous one. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + consumptionBlock: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + EnvironmentalCost: List[EnvironmentalCost] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + price: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + startValue: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_inclusive': 281474976710655, + }) + + +@dataclass +class CurrentDERProgramLink(Link): + """SHALL contain a Link to an instance of DERProgram. + + If present, this is the DERProgram containing the currently active + DERControl. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class CustomerAccountLink(Link): + """ + SHALL contain a Link to an instance of CustomerAccount. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERAvailabilityLink(Link): + """ + SHALL contain a Link to an instance of DERAvailability. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERCapability(Resource): + """ + Distributed energy resource type and nameplate ratings. + + :ivar modesSupported: Bitmap indicating the DER Controls implemented + by the device. See DERControlType for values. + :ivar rtgAbnormalCategory: Abnormal operating performance category + as defined by IEEE 1547-2018. One of: 0 - not specified 1 - + Category I 2 - Category II 3 - Category III All other values + reserved. + :ivar rtgMaxA: Maximum continuous AC current capability of the DER, + in Amperes (RMS). + :ivar rtgMaxAh: Usable energy storage capacity of the DER, in + AmpHours. + :ivar rtgMaxChargeRateVA: Maximum apparent power charge rating in + Volt-Amperes. May differ from the maximum apparent power rating. + :ivar rtgMaxChargeRateW: Maximum rate of energy transfer received by + the storage DER, in Watts. + :ivar rtgMaxDischargeRateVA: Maximum apparent power discharge rating + in Volt-Amperes. May differ from the maximum apparent power + rating. + :ivar rtgMaxDischargeRateW: Maximum rate of energy transfer + delivered by the storage DER, in Watts. Required for combined + generation/storage DERs (e.g. DERType == 83). + :ivar rtgMaxV: AC voltage maximum rating. + :ivar rtgMaxVA: Maximum continuous apparent power output capability + of the DER, in VA. + :ivar rtgMaxVar: Maximum continuous reactive power delivered by the + DER, in var. + :ivar rtgMaxVarNeg: Maximum continuous reactive power received by + the DER, in var. If absent, defaults to negative rtgMaxVar. + :ivar rtgMaxW: Maximum continuous active power output capability of + the DER, in watts. Represents combined generation plus storage + output if DERType == 83. + :ivar rtgMaxWh: Maximum energy storage capacity of the DER, in + WattHours. + :ivar rtgMinPFOverExcited: Minimum Power Factor displacement + capability of the DER when injecting reactive power (over- + excited); SHALL be a positive value between 0.0 (typically + &gt; 0.7) and 1.0. If absent, defaults to unity. + :ivar rtgMinPFUnderExcited: Minimum Power Factor displacement + capability of the DER when absorbing reactive power (under- + excited); SHALL be a positive value between 0.0 (typically + &gt; 0.7) and 0.9999. If absent, defaults to + rtgMinPFOverExcited. + :ivar rtgMinV: AC voltage minimum rating. + :ivar rtgNormalCategory: Normal operating performance category as + defined by IEEE 1547-2018. One of: 0 - not specified 1 - + Category A 2 - Category B All other values reserved. + :ivar rtgOverExcitedPF: Specified over-excited power factor. + :ivar rtgOverExcitedW: Active power rating in Watts at specified + over-excited power factor (rtgOverExcitedPF). If present, + rtgOverExcitedPF SHALL be present. + :ivar rtgReactiveSusceptance: Reactive susceptance that remains + connected to the Area EPS in the cease to energize and trip + state. + :ivar rtgUnderExcitedPF: Specified under-excited power factor. + :ivar rtgUnderExcitedW: Active power rating in Watts at specified + under-excited power factor (rtgUnderExcitedPF). If present, + rtgUnderExcitedPF SHALL be present. + :ivar rtgVNom: AC voltage nominal rating. + :ivar type: Type of DER; see DERType object + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + modesSupported: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 4, + 'format': 'base16', + }) + rtgAbnormalCategory: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxA: Optional[CurrentRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxAh: Optional[AmpereHour] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxChargeRateVA: Optional[ApparentPower] = field(default=None, + metadata={ + 'type': 'Element', + }) + rtgMaxChargeRateW: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxDischargeRateVA: Optional[ApparentPower] = field(default=None, + metadata={ + 'type': 'Element', + }) + rtgMaxDischargeRateW: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + }) + rtgMaxV: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxVA: Optional[ApparentPower] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxVar: Optional[ReactivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxVarNeg: Optional[ReactivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMaxW: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + rtgMaxWh: Optional[WattHour] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgMinPFOverExcited: Optional[PowerFactor] = field(default=None, + metadata={ + 'type': 'Element', + }) + rtgMinPFUnderExcited: Optional[PowerFactor] = field(default=None, + metadata={ + 'type': 'Element', + }) + rtgMinV: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgNormalCategory: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgOverExcitedPF: Optional[PowerFactor] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgOverExcitedW: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgReactiveSusceptance: Optional[ReactiveSusceptance] = field(default=None, + metadata={ + 'type': 'Element', + }) + rtgUnderExcitedPF: Optional[PowerFactor] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgUnderExcitedW: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + rtgVNom: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + type: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DERCapabilityLink(Link): + """ + SHALL contain a Link to an instance of DERCapability. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERCurveLink(Link): + """ + SHALL contain a Link to an instance of DERCurve. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERLink(Link): + """ + SHALL contain a Link to an instance of DER. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERProgramLink(Link): + """ + SHALL contain a Link to an instance of DERProgram. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERSettingsLink(Link): + """ + SHALL contain a Link to an instance of DERSettings. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERStatusLink(Link): + """ + SHALL contain a Link to an instance of DERStatus. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DRLCCapabilities: + """ + Contains information about the static capabilities of the device, to allow + service providers to know what types of functions are supported, what the + normal operating ranges and limits are, and other similar information, in + order to provide better suggestions of applicable programs to receive the + maximum benefit. + + :ivar averageEnergy: The average hourly energy usage when in normal + operating mode. + :ivar maxDemand: The maximum demand rating of this end device. + :ivar optionsImplemented: Bitmap indicating the DRLC options + implemented by the device. 0 - Target reduction (kWh) 1 - Target + reduction (kW) 2 - Target reduction (Watts) 3 - Target reduction + (Cubic Meters) 4 - Target reduction (Cubic Feet) 5 - Target + reduction (US Gallons) 6 - Target reduction (Imperial Gallons) 7 + - Target reduction (BTUs) 8 - Target reduction (Liters) 9 - + Target reduction (kPA (gauge)) 10 - Target reduction (kPA + (absolute)) 11 - Target reduction (Mega Joule) 12 - Target + reduction (Unitless) 13-15 - Reserved 16 - Temperature set point + 17 - Temperature offset 18 - Duty cycle 19 - Load adjustment + percentage 20 - Appliance load reduction 21-31 - Reserved + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + averageEnergy: Optional[RealEnergy] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + maxDemand: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + optionsImplemented: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 4, + 'format': 'base16', + }) + + +@dataclass +class DefaultDERControlLink(Link): + """SHALL contain a Link to an instance of DefaultDERControl. + + This is the default mode of the DER which MAY be overridden by + DERControl events. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DemandResponseProgramLink(Link): + """ + SHALL contain a Link to an instance of DemandResponseProgram. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DeviceCapabilityLink(Link): + """ + SHALL contain a Link to an instance of DeviceCapability. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DeviceInformationLink(Link): + """ + SHALL contain a Link to an instance of DeviceInformation. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DeviceStatusLink(Link): + """ + SHALL contain a Link to an instance of DeviceStatus. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class EndDeviceLink(Link): + """ + SHALL contain a Link to an instance of EndDevice. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class File(Resource): + """This resource contains various meta-data describing a file's + characteristics. + + The meta-data provides general file information and also is used to + support filtered queries of file lists + + :ivar activateTime: This element MUST be set to the date/time at + which this file is activated. If the activation time is less + than or equal to current time, the LD MUST immediately place the + file into the activated state (in the case of a firmware file, + the file is now the running image). If the activation time is + greater than the current time, the LD MUST wait until the + specified activation time is reached, then MUST place the file + into the activated state. Omission of this element means that + the LD MUST NOT take any action to activate the file until a + subsequent GET to this File resource provides an activateTime. + :ivar fileURI: This element MUST be set to the URI location of the + file binary artifact. This is the BLOB (binary large object) + that is actually loaded by the LD + :ivar lFDI: This element MUST be set to the LFDI of the device for + which this file in targeted. + :ivar mfHwVer: This element MUST be set to the hardware version for + which this file is targeted. + :ivar mfID: This element MUST be set to the manufacturer's Private + Enterprise Number (assigned by IANA). + :ivar mfModel: This element MUST be set to the manufacturer model + number for which this file is targeted. The syntax and semantics + are left to the manufacturer. + :ivar mfSerNum: This element MUST be set to the manufacturer serial + number for which this file is targeted. The syntax and semantics + are left to the manufacturer. + :ivar mfVer: This element MUST be set to the software version + information for this file. The syntax and semantics are left to + the manufacturer. + :ivar size: This element MUST be set to the total size (in bytes) of + the file referenced by fileURI. + :ivar type: A value indicating the type of the file. MUST be one of + the following values: 00 = Software Image 01 = Security + Credential 02 = Configuration 03 = Log 04–7FFF = reserved + 8000-FFFF = Manufacturer defined + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + activateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + fileURI: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + lFDI: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 20, + 'format': 'base16', + }) + mfHwVer: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 32, + }) + mfID: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + mfModel: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + mfSerNum: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 32, + }) + mfVer: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + }) + size: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + type: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 2, + 'format': 'base16', + }) + + +@dataclass +class FileLink(Link): + """This element MUST be set to the URI of the most recent File being + loaded/activated by the LD. + + In the case of file status 0, this element MUST be omitted. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class FileStatusLink(Link): + """ + SHALL contain a Link to an instance of FileStatus. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class IdentifiedObject(Resource): + """ + This is a root class to provide common naming attributes for all classes + needing naming attributes. + + :ivar mRID: The global identifier of the object. + :ivar description: The description is a human readable text + describing or naming the object. + :ivar version: Contains the version number of the object. See the + type definition for details. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + mRID: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 32, + }) + version: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class List_type(Resource): + """Container to hold a collection of object instances or references. + + See Design Pattern section for additional details. + + :ivar all: The number specifying "all" of the items in the list. + Required on a response to a GET, ignored otherwise. + :ivar results: Indicates the number of items in this page of + results. + """ + + class Meta: + name = 'List' + namespace = 'urn:ieee:std:2030.5:ns' + + all: Optional[int] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + results: Optional[int] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class ListLink(Link): + """ + ListLinks provide a reference, via URI, to a List. + + :ivar all: Indicates the total number of items in the referenced + list. This attribute SHALL be present if the href is a local or + relative URI. This attribute SHOULD NOT be present if the href + is a remote or absolute URI, as the server may be unaware of + changes to the value. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + all: Optional[int] = field(default=None, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class LogEvent(Resource): + """ + A time stamped instance of a significant event detected by the device. + + :ivar createdDateTime: The date and time that the event occurred. + :ivar details: Human readable text that MAY be used to transmit + additional details about the event. A host MAY remove this field + when received. + :ivar extendedData: May be used to transmit additional details about + the event. + :ivar functionSet: If the profileID indicates this is IEEE 2030.5, + the functionSet is defined by IEEE 2030.5 and SHALL be one of + the values from the table below (IEEE 2030.5 function set + identifiers). If the profileID is anything else, the functionSet + is defined by the identified profile. 0 General (not + specific to a function set) 1 Publish and Subscribe 2 + End Device 3 Function Set Assignment 4 Response 5 + Demand Response and Load Control 6 Metering 7 + Pricing 8 Messaging 9 Billing 10 Prepayment 11 + Distributed Energy Resources 12 Time 13 Software + Download 14 Device Information 15 Power Status 16 + Network Status 17 Log Event List 18 Configuration 19 + Security All other values are reserved. + :ivar logEventCode: An 8 bit unsigned integer. logEventCodes are + scoped to a profile and a function set. If the profile is IEEE + 2030.5, the logEventCode is defined by IEEE 2030.5 within one of + the function sets of IEEE 2030.5. If the profile is anything + else, the logEventCode is defined by the specified profile. + :ivar logEventID: This 16-bit value, combined with createdDateTime, + profileID, and logEventPEN, should provide a reasonable level of + uniqueness. + :ivar logEventPEN: The Private Enterprise Number(PEN) of the entity + that defined the profileID, functionSet, and logEventCode of the + logEvent. IEEE 2030.5-assigned logEventCodes SHALL use the IEEE + 2030.5 PEN. Combinations of profileID, functionSet, and + logEventCode SHALL have unique meaning within a logEventPEN and + are defined by the owner of the PEN. + :ivar profileID: The profileID identifies which profile (HA, BA, SE, + etc) defines the following event information. 0 Not + profile specific. 1 Vendor Defined 2 IEEE 2030.5 3 + Home Automation 4 Building Automation All other values are + reserved. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + createdDateTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + details: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 32, + }) + extendedData: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + functionSet: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + logEventCode: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + logEventID: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + logEventPEN: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + profileID: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class MeterReadingLink(Link): + """ + SHALL contain a Link to an instance of MeterReading. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class Neighbor(Resource): + """ + Contains 802.15.4 link layer specific attributes. + + :ivar isChild: True if the neighbor is a child. + :ivar linkQuality: The quality of the link, as defined by 802.15.4 + :ivar shortAddress: As defined by IEEE 802.15.4 + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + isChild: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + linkQuality: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + shortAddress: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class PEVInfo: + """ + Contains attributes that can be exposed by PEVs and other devices that have + charging requirements. + + :ivar chargingPowerNow: This is the actual power flow in or out of + the charger or inverter. This is calculated by the vehicle based + on actual measurements. This number is positive for charging. + :ivar energyRequestNow: This is the amount of energy that must be + transferred from the grid to EVSE and PEV to achieve the target + state of charge allowing for charger efficiency and any vehicle + and EVSE parasitic loads. This is calculated by the vehicle and + changes throughout the connection as forward or reverse power + flow change the battery state of charge. This number is + positive for charging. + :ivar maxForwardPower: This is maximum power transfer capability + that could be used for charging the PEV to perform the requested + energy transfer. It is the lower of the vehicle or EVSE + physical power limitations. It is not based on economic + considerations. The vehicle may draw less power than this value + based on its charging cycle. The vehicle defines this parameter. + This number is positive for charging power flow. + :ivar minimumChargingDuration: This is computed by the PEV based on + the charging profile to complete the energy transfer if the + maximum power is authorized. The value will never be smaller + than the ratio of the energy request to the power request + because the charging profile may not allow the maximum power to + be used throughout the transfer. This is a critical parameter + for determining whether any slack time exists in the charging + cycle between the current time and the TCIN. + :ivar targetStateOfCharge: This is the target state of charge that + is to be achieved during charging before the time of departure + (TCIN). The default value is 100%. The value cannot be set to a + value less than the actual state of charge. + :ivar timeChargeIsNeeded: Time Charge is Needed (TCIN) is the time + that the PEV is expected to depart. The value is manually + entered using controls and displays in the vehicle or on the + EVSE or using a mobile device. It is authenticated and saved by + the PEV. This value may be updated during a charging session. + :ivar timeChargingStatusPEV: This is the time that the parameters + are updated, except for changes to TCIN. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + chargingPowerNow: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + energyRequestNow: Optional[RealEnergy] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + maxForwardPower: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + minimumChargingDuration: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + targetStateOfCharge: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + timeChargeIsNeeded: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + timeChargingStatusPEV: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class PowerStatusLink(Link): + """ + SHALL contain a Link to an instance of PowerStatus. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class PrepayOperationStatus(Resource): + """ + PrepayOperationStatus describes the status of the service or commodity + being conditionally controlled by the Prepayment function set. + + :ivar creditTypeChange: CreditTypeChange is used to define a pending + change of creditTypeInUse, which will activate at a specified + time. + :ivar creditTypeInUse: CreditTypeInUse identifies whether the + present mode of operation is consuming regular credit or + emergency credit. + :ivar serviceChange: ServiceChange is used to define a pending + change of serviceStatus, which will activate at a specified + time. + :ivar serviceStatus: ServiceStatus identifies whether the service is + connected or disconnected, or armed for connection or + disconnection. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + creditTypeChange: Optional[CreditTypeChange] = field(default=None, + metadata={ + 'type': 'Element', + }) + creditTypeInUse: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + serviceChange: Optional[ServiceChange] = field(default=None, metadata={ + 'type': 'Element', + }) + serviceStatus: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class PrepayOperationStatusLink(Link): + """ + SHALL contain a Link to an instance of PrepayOperationStatus. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class PrepaymentLink(Link): + """ + SHALL contain a Link to an instance of Prepayment. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RPLSourceRoutes(Resource): + """ + A RPL source routes object. + + :ivar DestAddress: See [RFC 6554]. + :ivar SourceRoute: See [RFC 6554]. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DestAddress: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + SourceRoute: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + + +@dataclass +class RateComponentLink(Link): + """ + SHALL contain a Link to an instance of RateComponent. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ReadingBase(Resource): + """Specific value measured by a meter or other asset. + + ReadingBase is abstract, used to define the elements common to + Reading and IntervalReading. + + :ivar consumptionBlock: Indicates the consumption block related to + the reading. REQUIRED if ReadingType numberOfConsumptionBlocks + is non-zero. If not specified, is assumed to be "0 - N/A". + :ivar qualityFlags: List of codes indicating the quality of the + reading, using specification: Bit 0 - valid: data that has gone + through all required validation checks and either passed them + all or has been verified Bit 1 - manually edited: Replaced or + approved by a human Bit 2 - estimated using reference day: data + value was replaced by a machine computed value based on analysis + of historical data using the same type of measurement. Bit 3 - + estimated using linear interpolation: data value was computed + using linear interpolation based on the readings before and + after it Bit 4 - questionable: data that has failed one or more + checks Bit 5 - derived: data that has been calculated (using + logic or mathematical operations), not necessarily measured + directly Bit 6 - projected (forecast): data that has been + calculated as a projection or forecast of future readings + :ivar timePeriod: The time interval associated with the reading. If + not specified, then defaults to the intervalLength specified in + the associated ReadingType. + :ivar touTier: Indicates the time of use tier related to the + reading. REQUIRED if ReadingType numberOfTouTiers is non-zero. + If not specified, is assumed to be "0 - N/A". + :ivar value: Value in units specified by ReadingType + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + consumptionBlock: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + qualityFlags: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 2, + 'format': 'base16', + }) + timePeriod: Optional[DateTimeInterval] = field(default=None, metadata={ + 'type': 'Element', + }) + touTier: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + value: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'min_inclusive': -140737488355328, + 'max_inclusive': 140737488355328, + }) + + +@dataclass +class ReadingLink(Link): + """ + A Link to a Reading. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ReadingType(Resource): + """Type of data conveyed by a specific Reading. + + See IEC 61968 Part 9 Annex C for full definitions of these values. + + :ivar accumulationBehaviour: The “accumulation behaviour” indicates + how the value is represented to accumulate over time. + :ivar calorificValue: The amount of heat generated when a given mass + of fuel is completely burned. The CalorificValue is used to + convert the measured volume or mass of gas into kWh. The + CalorificValue attribute represents the current active value. + :ivar commodity: Indicates the commodity applicable to this + ReadingType. + :ivar conversionFactor: Accounts for changes in the volume of gas + based on temperature and pressure. The ConversionFactor + attribute represents the current active value. The + ConversionFactor is dimensionless. The default value for the + ConversionFactor is 1, which means no conversion is applied. A + price server can advertise a new/different value at any time. + :ivar dataQualifier: The data type can be used to describe a salient + attribute of the data. Possible values are average, absolute, + and etc. + :ivar flowDirection: Anything involving current might have a flow + direction. Possible values include forward and reverse. + :ivar intervalLength: Default interval length specified in seconds. + :ivar kind: Compound class that contains kindCategory and kindIndex + :ivar maxNumberOfIntervals: To be populated for mirrors of interval + data to set the expected number of intervals per ReadingSet. + Servers may discard intervals received that exceed this number. + :ivar numberOfConsumptionBlocks: Number of consumption blocks. 0 + means not applicable, and is the default if not specified. The + value needs to be at least 1 if any actual prices are provided. + :ivar numberOfTouTiers: The number of TOU tiers that can be used by + any resource configured by this ReadingType. Servers SHALL + populate this value with the largest touTier value that will + <i>ever</i> be used while this ReadingType is in + effect. Servers SHALL set numberOfTouTiers equal to the number + of standard TOU tiers plus the number of CPP tiers that may be + used while this ReadingType is in effect. Servers SHALL specify + a value between 0 and 255 (inclusive) for numberOfTouTiers + (servers providing flat rate pricing SHOULD set numberOfTouTiers + to 0, as in practice there is no difference between having no + tiers and having one tier). + :ivar phase: Contains phase information associated with the type. + :ivar powerOfTenMultiplier: Indicates the power of ten multiplier + applicable to the unit of measure of this ReadingType. + :ivar subIntervalLength: Default sub-interval length specified in + seconds for Readings of ReadingType. Some demand calculations + are done over a number of smaller intervals. For example, in a + rolling demand calculation, the demand value is defined as the + rolling sum of smaller intervals over the intervalLength. The + subintervalLength is the length of the smaller interval in this + calculation. It SHALL be an integral division of the + intervalLength. The number of sub-intervals can be calculated by + dividing the intervalLength by the subintervalLength. + :ivar supplyLimit: Reflects the supply limit set in the meter. This + value can be compared to the Reading value to understand if + limits are being approached or exceeded. Units follow the same + definition as in this ReadingType. + :ivar tieredConsumptionBlocks: Specifies whether or not the + consumption blocks are differentiated by TOUTier or not. Default + is false, if not specified. true = consumption accumulated over + individual tiers false = consumption accumulated over all tiers + :ivar uom: Indicates the measurement type for the units of measure + for the readings of this type. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + accumulationBehaviour: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + calorificValue: Optional[UnitValueType] = field(default=None, metadata={ + 'type': 'Element', + }) + commodity: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + conversionFactor: Optional[UnitValueType] = field(default=None, metadata={ + 'type': 'Element', + }) + dataQualifier: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + flowDirection: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + intervalLength: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + kind: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + maxNumberOfIntervals: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + numberOfConsumptionBlocks: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + numberOfTouTiers: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + phase: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + powerOfTenMultiplier: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + subIntervalLength: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + supplyLimit: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'max_inclusive': 281474976710655, + }) + tieredConsumptionBlocks: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + uom: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ReadingTypeLink(Link): + """ + SHALL contain a Link to an instance of ReadingType. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class Registration(Resource): + """ + Registration represents an authorization to access the resources on a host. + + :ivar dateTimeRegistered: Contains the time at which this + registration was created, by which clients MAY prioritize + information providers with the most recent registrations, when + no additional direction from the consumer is available. + :ivar pIN: Contains the registration PIN number associated with the + device, including the checksum digit. + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + dateTimeRegistered: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + pIN: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class RegistrationLink(Link): + """ + SHALL contain a Link to an instance of Registration. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RespondableResource(Resource): + """ + A Resource to which a Response can be requested. + + :ivar replyTo: A reference to the response resource address (URI). + Required on a response to a GET if responseRequired is "true". + :ivar responseRequired: Indicates whether or not a response is + required upon receipt, creation or update of this resource. + Responses shall be posted to the collection specified in + "replyTo". If the resource has a deviceCategory field, devices + that match one or more of the device types indicated in + deviceCategory SHALL respond according to the rules listed + below. If the category does not match, the device SHALL NOT + respond. If the resource does not have a deviceCategory field, a + device receiving the resource SHALL respond according to the + rules listed below. Value encoded as hex according to the + following bit assignments, any combination is possible. See + Table 27 for the list of appropriate Response status codes to be + sent for these purposes. 0 - End device shall indicate that + message was received 1 - End device shall indicate specific + response. 2 - End user / customer response is required. All + other values reserved. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + replyTo: Optional[str] = field(default=None, metadata={ + 'type': 'Attribute', + }) + responseRequired: bytes = field(default=b'\x00', + metadata={ + 'type': 'Attribute', + 'max_length': 1, + 'format': 'base16', + }) + + +@dataclass +class Response(Resource): + """ + The Response object is the generic response data repository which is + extended for specific function sets. + + :ivar createdDateTime: The createdDateTime field contains the date + and time when the acknowledgement/status occurred in the client. + The client will provide the timestamp to ensure the proper time + is captured in case the response is delayed in reaching the + server (server receipt time would not be the same as the actual + confirmation time). The time reported from the client should be + relative to the time server indicated by the + FunctionSetAssignment that also indicated the event resource; if + no FunctionSetAssignment exists, the time of the server where + the event resource was hosted. + :ivar endDeviceLFDI: Contains the LFDI of the device providing the + response. + :ivar status: The status field contains the acknowledgement or + status. Each event type (DRLC, DER, Price, or Text) can return + different status information (e.g. an Acknowledge will be + returned for a Price event where a DRLC event can return Event + Received, Event Started, and Event Completed). The Status field + value definitions are defined in Table 27: Response Types by + Function Set. + :ivar subject: The subject field provides a method to match the + response with the originating event. It is populated with the + mRID of the original object. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + createdDateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + endDeviceLFDI: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 20, + 'format': 'base16', + }) + status: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + subject: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + + +@dataclass +class SelfDeviceLink(Link): + """ + SHALL contain a Link to an instance of SelfDevice. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ServiceSupplierLink(Link): + """ + SHALL contain a Link to an instance of ServiceSupplier. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class SubscribableResource(Resource): + """ + A Resource to which a Subscription can be requested. + + :ivar subscribable: Indicates whether or not subscriptions are + supported for this resource, and whether or not conditional + (thresholds) are supported. If not specified, is "not + subscribable" (0). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + subscribable: int = field(default=0, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class SubscriptionBase(Resource): + """Holds the information related to a client subscription to receive + updates to a resource automatically. + + The actual resources may be passed in the Notification by specifying + a specific xsi:type for the Resource and passing the full + representation. + + :ivar subscribedResource: The resource for which the subscription + applies. Query string parameters SHALL NOT be specified when + subscribing to list resources. Should a query string parameter + be specified, servers SHALL ignore them. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + subscribedResource: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class SupplyInterruptionOverride(Resource): + """SupplyInterruptionOverride: There may be periods of time when social, regulatory or other concerns mean that service should not be interrupted, even when available credit has been exhausted. Each Prepayment instance links to a List of SupplyInterruptionOverride instances. Each SupplyInterruptionOverride defines a contiguous period of time during which supply SHALL NOT be interrupted. + + :ivar description: The description is a human readable text + describing or naming the object. + :ivar interval: Interval defines the period of time during which + supply should not be interrupted. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 32, + }) + interval: Optional[DateTimeInterval] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class SupportedLocale(Resource): + """ + Specifies a locale that is supported. + + :ivar locale: The code for a locale that is supported + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + locale: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 42, + }) + + +@dataclass +class TariffProfileLink(Link): + """ + SHALL contain a Link to an instance of TariffProfile. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class Time(Resource): + """ + Contains the representation of time, constantly updated. + + :ivar currentTime: The current time, in the format defined by + TimeType. + :ivar dstEndTime: Time at which daylight savings ends (dstOffset no + longer applied). Result of dstEndRule calculation. + :ivar dstOffset: Daylight savings time offset from local standard + time. A typical practice is advancing clocks one hour when + daylight savings time is in effect, which would result in a + positive dstOffset. + :ivar dstStartTime: Time at which daylight savings begins (apply + dstOffset). Result of dstStartRule calculation. + :ivar localTime: Local time: localTime = currentTime + tzOffset (+ + dstOffset when in effect). + :ivar quality: Metric indicating the quality of the time source from + which the service acquired time. Lower (smaller) quality + enumeration values are assumed to be more accurate. 3 - time + obtained from external authoritative source such as NTP 4 - time + obtained from level 3 source 5 - time manually set or obtained + from level 4 source 6 - time obtained from level 5 source 7 - + time intentionally uncoordinated All other values are reserved + for future use. + :ivar tzOffset: Local time zone offset from currentTime. Does not + include any daylight savings time offsets. For American time + zones, a negative tzOffset SHALL be used (eg, EST = GMT-5 which + is -18000). + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + currentTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + dstEndTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + dstOffset: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + dstStartTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + localTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + quality: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + tzOffset: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class TimeLink(Link): + """ + SHALL contain a Link to an instance of Time. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class UsagePointLink(Link): + """ + SHALL contain a Link to an instance of UsagePoint. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class AccountBalance(Resource): + """AccountBalance contains the regular credit and emergency credit balance + for this given service or commodity prepay instance. + + It may also contain status information concerning the balance data. + + :ivar availableCredit: AvailableCredit shows the balance of the sum + of credits minus the sum of charges. In a Central Wallet mode + this value may be passed down to the Prepayment server via an + out-of-band mechanism. In Local or ESI modes, this value may be + calculated based upon summation of CreditRegister transactions + minus consumption charges calculated using Metering (and + possibly Pricing) function set data. This value may be negative; + for instance, if disconnection is prevented due to a Supply + Interruption Override. + :ivar creditStatus: CreditStatus identifies whether the present + value of availableCredit is considered OK, low, exhausted, or + negative. + :ivar emergencyCredit: EmergencyCredit is the amount of credit still + available for the given service or commodity prepayment + instance. If both availableCredit and emergyCredit are + exhausted, then service will typically be disconnected. + :ivar emergencyCreditStatus: EmergencyCreditStatus identifies + whether the present value of emergencyCredit is considered OK, + low, exhausted, or negative. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + availableCredit: Optional[AccountingUnit] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + creditStatus: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + emergencyCredit: Optional[AccountingUnit] = field(default=None, metadata={ + 'type': 'Element', + }) + emergencyCreditStatus: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ActiveBillingPeriodListLink(ListLink): + """ + SHALL contain a Link to a List of active BillingPeriod instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveCreditRegisterListLink(ListLink): + """ + SHALL contain a Link to a List of active CreditRegister instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveDERControlListLink(ListLink): + """ + SHALL contain a Link to a List of active DERControl instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveEndDeviceControlListLink(ListLink): + """ + SHALL contain a Link to a List of active EndDeviceControl instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveFlowReservationListLink(ListLink): + """ + SHALL contain a Link to a List of active FlowReservation instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveProjectionReadingListLink(ListLink): + """ + SHALL contain a Link to a List of active ProjectionReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveSupplyInterruptionOverrideListLink(ListLink): + """ + SHALL contain a Link to a List of active SupplyInterruptionOverride + instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveTargetReadingListLink(ListLink): + """ + SHALL contain a Link to a List of active TargetReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveTextMessageListLink(ListLink): + """ + SHALL contain a Link to a List of active TextMessage instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ActiveTimeTariffIntervalListLink(ListLink): + """ + SHALL contain a Link to a List of active TimeTariffInterval instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class AssociatedDERProgramListLink(ListLink): + """ + SHALL contain a Link to a List of DERPrograms having the DERControl(s) for + this DER. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class BillingPeriodListLink(ListLink): + """ + SHALL contain a Link to a List of BillingPeriod instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class BillingReading(ReadingBase): + """Data captured at regular intervals of time. + + Interval data could be captured as incremental data, absolute data, + or relative data. The source for the data is usually a tariff + quantity or an engineering quantity. Data is typically captured in + time-tagged, uniform, fixed-length intervals of 5 min, 10 min, 15 + min, 30 min, or 60 min. However, consumption aggregations can also + be represented with this class. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Charge: List[Charge] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class BillingReadingListLink(ListLink): + """ + SHALL contain a Link to a List of BillingReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class BillingReadingSetListLink(ListLink): + """ + SHALL contain a Link to a List of BillingReadingSet instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ConsumptionTariffIntervalList(List_type): + """ + A List element to hold ConsumptionTariffInterval objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ConsumptionTariffInterval: List[ConsumptionTariffInterval] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class ConsumptionTariffIntervalListLink(ListLink): + """ + SHALL contain a Link to a List of ConsumptionTariffInterval instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class CreditRegister(IdentifiedObject): + """CreditRegister instances define a credit-modifying transaction. + + Typically this would be a credit-adding transaction, but may be a + subtracting transaction (perhaps in response to an out-of-band debt + signal). + + :ivar creditAmount: CreditAmount is the amount of credit being added + by a particular CreditRegister transaction. Negative values + indicate that credit is being subtracted. + :ivar creditType: CreditType indicates whether the credit + transaction applies to regular or emergency credit. + :ivar effectiveTime: EffectiveTime identifies the time at which the + credit transaction goes into effect. For credit addition + transactions, this is typically the moment at which the + transaction takes place. For credit subtraction transactions, + (e.g., non-fuel debt recovery transactions initiated from a + back-haul or ESI) this may be a future time at which credit is + deducted. + :ivar token: Token is security data that authenticates the + legitimacy of the transaction. The details of this token are not + defined by IEEE 2030.5. How a Prepayment server handles this + field is left as vendor specific implementation or will be + defined by one or more other standards. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + creditAmount: Optional[AccountingUnit] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + creditType: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + effectiveTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + token: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + + +@dataclass +class CreditRegisterListLink(ListLink): + """ + SHALL contain a Link to a List of CreditRegister instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class CustomerAccountListLink(ListLink): + """ + SHALL contain a Link to a List of CustomerAccount instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class CustomerAgreementListLink(ListLink): + """ + SHALL contain a Link to a List of CustomerAgreement instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERAvailability(SubscribableResource): + """ + Indicates current reserve generation status. + + :ivar availabilityDuration: Indicates number of seconds the DER will + be able to deliver active power at the reservePercent level. + :ivar maxChargeDuration: Indicates number of seconds the DER will be + able to receive active power at the reserveChargePercent level. + :ivar readingTime: The timestamp when the DER availability was last + updated. + :ivar reserveChargePercent: Percent of continuous received active + power (%setMaxChargeRateW) that is estimated to be available in + reserve. + :ivar reservePercent: Percent of continuous delivered active power + (%setMaxW) that is estimated to be available in reserve. + :ivar statVarAvail: Estimated reserve reactive power, in var. + Represents the lesser of received or delivered reactive power. + :ivar statWAvail: Estimated reserve active power, in watts. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + availabilityDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + maxChargeDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + readingTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + reserveChargePercent: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + reservePercent: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + statVarAvail: Optional[ReactivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + statWAvail: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class DERControlBase: + """ + Distributed Energy Resource (DER) control values. + + :ivar opModConnect: Set DER as connected (true) or disconnected + (false). Used in conjunction with ramp rate when re-connecting. + Implies galvanic isolation. + :ivar opModEnergize: Set DER as energized (true) or de-energized + (false). Used in conjunction with ramp rate when re-energizing. + :ivar opModFixedPFAbsorbW: The opModFixedPFAbsorbW function + specifies a requested fixed Power Factor (PF) setting for when + active power is being absorbed. The actual displacement SHALL be + within the limits established by setMinPFOverExcited and + setMinPFUnderExcited. If issued simultaneously with other + reactive power controls (e.g. opModFixedVar) the control + resulting in least var magnitude SHOULD take precedence. + :ivar opModFixedPFInjectW: The opModFixedPFInjectW function + specifies a requested fixed Power Factor (PF) setting for when + active power is being injected. The actual displacement SHALL be + within the limits established by setMinPFOverExcited and + setMinPFUnderExcited. If issued simultaneously with other + reactive power controls (e.g. opModFixedVar) the control + resulting in least var magnitude SHOULD take precedence. + :ivar opModFixedVar: The opModFixedVar function specifies the + delivered or received reactive power setpoint. The context for + the setpoint value is determined by refType and SHALL be one of + %setMaxW, %setMaxVar, or %statVarAvail. If issued + simultaneously with other reactive power controls (e.g. + opModFixedPFInjectW) the control resulting in least var + magnitude SHOULD take precedence. + :ivar opModFixedW: The opModFixedW function specifies a requested + charge or discharge mode setpoint, in %setMaxChargeRateW if + negative value or %setMaxW or %setMaxDischargeRateW if positive + value (in hundredths). + :ivar opModFreqDroop: Specifies a frequency-watt operation. This + operation limits active power generation or consumption when the + line frequency deviates from nominal by a specified amount. + :ivar opModFreqWatt: Specify DERCurveLink for curveType == 0. The + Frequency-Watt function limits active power generation or + consumption when the line frequency deviates from nominal by a + specified amount. The Frequency-Watt curve is specified as an + array of Frequency-Watt pairs that are interpolated into a + piecewise linear function with hysteresis. The x value of each + pair specifies a frequency in Hz. The y value specifies a + corresponding active power output in %setMaxW. + :ivar opModHFRTMayTrip: Specify DERCurveLink for curveType == 1. The + High Frequency Ride-Through (HFRT) function is specified by one + or two duration-frequency curves that define the operating + region under high frequency conditions. Each HFRT curve is + specified by an array of duration-frequency pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given frequency in seconds). The y value of each pair + specifies a frequency, in Hz. This control specifies the "may + trip" region. + :ivar opModHFRTMustTrip: Specify DERCurveLink for curveType == 2. + The High Frequency Ride-Through (HFRT) function is specified by + a duration-frequency curve that defines the operating region + under high frequency conditions. Each HFRT curve is specified + by an array of duration-frequency pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given frequency in seconds). The y value of each pair + specifies a frequency, in Hz. This control specifies the "must + trip" region. + :ivar opModHVRTMayTrip: Specify DERCurveLink for curveType == 3. The + High Voltage Ride-Through (HVRT) function is specified by one, + two, or three duration-volt curves that define the operating + region under high voltage conditions. Each HVRT curve is + specified by an array of duration-volt pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given voltage in seconds). The y value of each pair + specifies an effective percentage voltage, defined as ((locally + measured voltage - setVRefOfs / setVRef). This control specifies + the "may trip" region. + :ivar opModHVRTMomentaryCessation: Specify DERCurveLink for + curveType == 4. The High Voltage Ride-Through (HVRT) function + is specified by duration-volt curves that define the operating + region under high voltage conditions. Each HVRT curve is + specified by an array of duration-volt pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given voltage in seconds). The y value of each pair + specifies an effective percent voltage, defined as ((locally + measured voltage - setVRefOfs) / setVRef). This control + specifies the "momentary cessation" region. + :ivar opModHVRTMustTrip: Specify DERCurveLink for curveType == 5. + The High Voltage Ride-Through (HVRT) function is specified by + duration-volt curves that define the operating region under high + voltage conditions. Each HVRT curve is specified by an array of + duration-volt pairs that will be interpolated into a piecewise + linear function that defines an operating region. The x value + of each pair specifies a duration (time at a given voltage in + seconds). The y value of each pair specifies an effective + percent voltage, defined as ((locally measured voltage - + setVRefOfs) / setVRef). This control specifies the "must trip" + region. + :ivar opModLFRTMayTrip: Specify DERCurveLink for curveType == 6. The + Low Frequency Ride-Through (LFRT) function is specified by one + or two duration-frequency curves that define the operating + region under low frequency conditions. Each LFRT curve is + specified by an array of duration-frequency pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given frequency in seconds). The y value of each pair + specifies a frequency, in Hz. This control specifies the "may + trip" region. + :ivar opModLFRTMustTrip: Specify DERCurveLink for curveType == 7. + The Low Frequency Ride-Through (LFRT) function is specified by a + duration-frequency curve that defines the operating region under + low frequency conditions. Each LFRT curve is specified by an + array of duration-frequency pairs that will be interpolated into + a piecewise linear function that defines an operating region. + The x value of each pair specifies a duration (time at a given + frequency in seconds). The y value of each pair specifies a + frequency, in Hz. This control specifies the "must trip" region. + :ivar opModLVRTMayTrip: Specify DERCurveLink for curveType == 8. The + Low Voltage Ride-Through (LVRT) function is specified by one, + two, or three duration-volt curves that define the operating + region under low voltage conditions. Each LVRT curve is + specified by an array of duration-volt pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given voltage in seconds). The y value of each pair + specifies an effective percent voltage, defined as ((locally + measured voltage - setVRefOfs) / setVRef). This control + specifies the "may trip" region. + :ivar opModLVRTMomentaryCessation: Specify DERCurveLink for + curveType == 9. The Low Voltage Ride-Through (LVRT) function is + specified by duration-volt curves that define the operating + region under low voltage conditions. Each LVRT curve is + specified by an array of duration-volt pairs that will be + interpolated into a piecewise linear function that defines an + operating region. The x value of each pair specifies a duration + (time at a given voltage in seconds). The y value of each pair + specifies an effective percent voltage, defined as ((locally + measured voltage - setVRefOfs) / setVRef). This control + specifies the "momentary cessation" region. + :ivar opModLVRTMustTrip: Specify DERCurveLink for curveType == 10. + The Low Voltage Ride-Through (LVRT) function is specified by + duration-volt curves that define the operating region under low + voltage conditions. Each LVRT curve is specified by an array of + duration-volt pairs that will be interpolated into a piecewise + linear function that defines an operating region. The x value + of each pair specifies a duration (time at a given voltage in + seconds). The y value of each pair specifies an effective + percent voltage, defined as ((locally measured voltage - + setVRefOfs) / setVRef). This control specifies the "must trip" + region. + :ivar opModMaxLimW: The opModMaxLimW function sets the maximum + active power generation level at the electrical coupling point + as a percentage of set capacity (%setMaxW, in hundredths). This + limitation may be met e.g. by reducing PV output or by using + excess PV output to charge associated storage. + :ivar opModTargetVar: Target reactive power, in var. This control is + likely to be more useful for aggregators, as individual DERs may + not be able to maintain a target setting. + :ivar opModTargetW: Target output power, in Watts. This control is + likely to be more useful for aggregators, as individual DERs may + not be able to maintain a target setting. + :ivar opModVoltVar: Specify DERCurveLink for curveType == 11. The + static volt-var function provides over- or under-excited var + compensation as a function of measured voltage. The volt-var + curve is specified as an array of volt-var pairs that are + interpolated into a piecewise linear function with hysteresis. + The x value of each pair specifies an effective percent voltage, + defined as ((locally measured voltage - setVRefOfs) / setVRef) + and SHOULD support a domain of at least 0 - 135. If VRef is + present in DERCurve, then the x value of each pair is + additionally multiplied by (VRef / 10000). The y value specifies + a target var output interpreted as a signed percentage (-100 to + 100). The meaning of the y value is determined by yRefType and + must be one of %setMaxW, %setMaxVar, or %statVarAvail. + :ivar opModVoltWatt: Specify DERCurveLink for curveType == 12. The + Volt-Watt reduces active power output as a function of measured + voltage. The Volt-Watt curve is specified as an array of Volt- + Watt pairs that are interpolated into a piecewise linear + function with hysteresis. The x value of each pair specifies an + effective percent voltage, defined as ((locally measured voltage + - setVRefOfs) / setVRef) and SHOULD support a domain of at least + 0 - 135. The y value specifies an active power output + interpreted as a percentage (0 - 100). The meaning of the y + value is determined by yRefType and must be one of %setMaxW or + %statWAvail. + :ivar opModWattPF: Specify DERCurveLink for curveType == 13. The + Watt-PF function varies Power Factor (PF) as a function of + delivered active power. The Watt-PF curve is specified as an + array of Watt-PF coordinates that are interpolated into a + piecewise linear function with hysteresis. The x value of each + pair specifies a watt setting in %setMaxW, (0 - 100). The PF + output setting is a signed displacement in y value (PF sign + SHALL be interpreted according to the EEI convention, where + unity PF is considered unsigned). These settings are not + expected to be updated very often during the life of the + installation, therefore only a single curve is required. If + issued simultaneously with other reactive power controls (e.g. + opModFixedPFInjectW) the control resulting in least var + magnitude SHOULD take precedence. + :ivar opModWattVar: Specify DERCurveLink for curveType == 14. The + Watt-Var function varies vars as a function of delivered active + power. The Watt-Var curve is specified as an array of Watt-Var + pairs that are interpolated into a piecewise linear function + with hysteresis. The x value of each pair specifies a watt + setting in %setMaxW, (0-100). The y value specifies a target var + output interpreted as a signed percentage (-100 to 100). The + meaning of the y value is determined by yRefType and must be one + of %setMaxW, %setMaxVar, or %statVarAvail. + :ivar rampTms: Requested ramp time, in hundredths of a second, for + the device to transition from the current DERControl mode + setting(s) to the new mode setting(s). If absent, use default + ramp rate (setGradW). Resolution is 1/100 sec. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + opModConnect: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + opModEnergize: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + opModFixedPFAbsorbW: Optional[PowerFactorWithExcitation] = field(default=None, + metadata={ + 'type': 'Element', + }) + opModFixedPFInjectW: Optional[PowerFactorWithExcitation] = field(default=None, + metadata={ + 'type': 'Element', + }) + opModFixedVar: Optional[FixedVar] = field(default=None, metadata={ + 'type': 'Element', + }) + opModFixedW: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + opModFreqDroop: Optional[FreqDroopType] = field(default=None, metadata={ + 'type': 'Element', + }) + opModFreqWatt: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModHFRTMayTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModHFRTMustTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModHVRTMayTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModHVRTMomentaryCessation: Optional[DERCurveLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + opModHVRTMustTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModLFRTMayTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModLFRTMustTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModLVRTMayTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModLVRTMomentaryCessation: Optional[DERCurveLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + opModLVRTMustTrip: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModMaxLimW: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + opModTargetVar: Optional[ReactivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + opModTargetW: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + opModVoltVar: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModVoltWatt: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModWattPF: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + opModWattVar: Optional[DERCurveLink] = field(default=None, metadata={ + 'type': 'Element', + }) + rampTms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class DERControlListLink(ListLink): + """ + SHALL contain a Link to a List of DERControl instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERControlResponse(Response): + """ + A response to a DERControl. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERCurve(IdentifiedObject): + """DER related curves such as Volt-Var mode curves. + + Relationship between an independent variable (X-axis) and a + dependent variable (Y-axis). + + :ivar autonomousVRefEnable: If the curveType is opModVoltVar, then + this field MAY be present. If the curveType is not opModVoltVar, + then this field SHALL NOT be present. Enable/disable autonomous + vRef adjustment. When enabled, the Volt-Var curve characteristic + SHALL be adjusted autonomously as vRef changes and + autonomousVRefTimeConstant SHALL be present. If a DER is able to + support Volt-Var mode but is unable to support autonomous vRef + adjustment, then the DER SHALL execute the curve without + autonomous vRef adjustment. If not specified, then the value is + false. + :ivar autonomousVRefTimeConstant: If the curveType is opModVoltVar, + then this field MAY be present. If the curveType is not + opModVoltVar, then this field SHALL NOT be present. Adjustment + range for vRef time constant, in hundredths of a second. + :ivar creationTime: The time at which the object was created. + :ivar CurveData: + :ivar curveType: Specifies the associated curve-based control mode. + :ivar openLoopTms: Open loop response time, the time to ramp up to + 90% of the new target in response to the change in voltage, in + hundredths of a second. Resolution is 1/100 sec. A value of 0 is + used to mean no limit. When not present, the device SHOULD + follow its default behavior. + :ivar rampDecTms: Decreasing ramp rate, interpreted as a percentage + change in output capability limit per second (e.g. %setMaxW / + sec). Resolution is in hundredths of a percent/second. A value + of 0 means there is no limit. If absent, ramp rate defaults to + setGradW. + :ivar rampIncTms: Increasing ramp rate, interpreted as a percentage + change in output capability limit per second (e.g. %setMaxW / + sec). Resolution is in hundredths of a percent/second. A value + of 0 means there is no limit. If absent, ramp rate defaults to + rampDecTms. + :ivar rampPT1Tms: The configuration parameter for a low-pass filter, + PT1 is a time, in hundredths of a second, in which the filter + will settle to 95% of a step change in the input value. + Resolution is 1/100 sec. + :ivar vRef: If the curveType is opModVoltVar, then this field MAY be + present. If the curveType is not opModVoltVar, then this field + SHALL NOT be present. The nominal AC voltage (RMS) adjustment to + the voltage curve points for Volt-Var curves. + :ivar xMultiplier: Exponent for X-axis value. + :ivar yMultiplier: Exponent for Y-axis value. + :ivar yRefType: The Y-axis units context. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + autonomousVRefEnable: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + autonomousVRefTimeConstant: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + creationTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + CurveData: List[CurveData] = field(default_factory=list, + metadata={ + 'type': 'Element', + 'min_occurs': 1, + 'max_occurs': 10, + }) + curveType: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + openLoopTms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + rampDecTms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + rampIncTms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + rampPT1Tms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + vRef: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + xMultiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + yMultiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + yRefType: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DERCurveListLink(ListLink): + """ + SHALL contain a Link to a List of DERCurve instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERListLink(ListLink): + """ + SHALL contain a Link to a List of DER instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERProgramListLink(ListLink): + """ + SHALL contain a Link to a List of DERProgram instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DERSettings(SubscribableResource): + """ + Distributed energy resource settings. + + :ivar modesEnabled: Bitmap indicating the DER Controls enabled on + the device. See DERControlType for values. If a control is + supported (see DERCapability::modesSupported), but not enabled, + the control will not be executed if encountered. + :ivar setESDelay: Enter service delay, in hundredths of a second. + :ivar setESHighFreq: Enter service frequency high. Specified in + hundredths of Hz. + :ivar setESHighVolt: Enter service voltage high. Specified as an + effective percent voltage, defined as (100% * (locally measured + voltage - setVRefOfs) / setVRef), in hundredths of a percent. + :ivar setESLowFreq: Enter service frequency low. Specified in + hundredths of Hz. + :ivar setESLowVolt: Enter service voltage low. Specified as an + effective percent voltage, defined as (100% * (locally measured + voltage - setVRefOfs) / setVRef), in hundredths of a percent. + :ivar setESRampTms: Enter service ramp time, in hundredths of a + second. + :ivar setESRandomDelay: Enter service randomized delay, in + hundredths of a second. + :ivar setGradW: Set default rate of change (ramp rate) of active + power output due to command or internal action, defined in + %setWMax / second. Resolution is in hundredths of a + percent/second. A value of 0 means there is no limit. + Interpreted as a percentage change in output capability limit + per second when used as a default ramp rate. + :ivar setMaxA: AC current maximum. Maximum AC current in RMS + Amperes. + :ivar setMaxAh: Maximum usable energy storage capacity of the DER, + in AmpHours. Note: this may be different from physical + capability. + :ivar setMaxChargeRateVA: Apparent power charge maximum. Maximum + apparent power the DER can absorb from the grid in Volt-Amperes. + May differ from the apparent power maximum (setMaxVA). + :ivar setMaxChargeRateW: Maximum rate of energy transfer received by + the storage device, in Watts. Defaults to rtgMaxChargeRateW. + :ivar setMaxDischargeRateVA: Apparent power discharge maximum. + Maximum apparent power the DER can deliver to the grid in Volt- + Amperes. May differ from the apparent power maximum (setMaxVA). + :ivar setMaxDischargeRateW: Maximum rate of energy transfer + delivered by the storage device, in Watts. Defaults to + rtgMaxDischargeRateW. + :ivar setMaxV: AC voltage maximum setting. + :ivar setMaxVA: Set limit for maximum apparent power capability of + the DER (in VA). Defaults to rtgMaxVA. + :ivar setMaxVar: Set limit for maximum reactive power delivered by + the DER (in var). SHALL be a positive value &lt;= rtgMaxVar + (default). + :ivar setMaxVarNeg: Set limit for maximum reactive power received by + the DER (in var). If present, SHALL be a negative value + &gt;= rtgMaxVarNeg (default). If absent, defaults to + negative setMaxVar. + :ivar setMaxW: Set limit for maximum active power capability of the + DER (in W). Defaults to rtgMaxW. + :ivar setMaxWh: Maximum energy storage capacity of the DER, in + WattHours. Note: this may be different from physical capability. + :ivar setMinPFOverExcited: Set minimum Power Factor displacement + limit of the DER when injecting reactive power (over-excited); + SHALL be a positive value between 0.0 (typically &gt; 0.7) + and 1.0. SHALL be &gt;= rtgMinPFOverExcited (default). + :ivar setMinPFUnderExcited: Set minimum Power Factor displacement + limit of the DER when absorbing reactive power (under-excited); + SHALL be a positive value between 0.0 (typically &gt; 0.7) + and 0.9999. If present, SHALL be &gt;= rtgMinPFUnderExcited + (default). If absent, defaults to setMinPFOverExcited. + :ivar setMinV: AC voltage minimum setting. + :ivar setSoftGradW: Set soft-start rate of change (soft-start ramp + rate) of active power output due to command or internal action, + defined in %setWMax / second. Resolution is in hundredths of a + percent/second. A value of 0 means there is no limit. + Interpreted as a percentage change in output capability limit + per second when used as a ramp rate. + :ivar setVNom: AC voltage nominal setting. + :ivar setVRef: The nominal AC voltage (RMS) at the utility's point + of common coupling. + :ivar setVRefOfs: The nominal AC voltage (RMS) offset between the + DER's electrical connection point and the utility's point of + common coupling. + :ivar updatedTime: Specifies the time at which the DER information + was last updated. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + modesEnabled: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 4, + 'format': 'base16', + }) + setESDelay: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESHighFreq: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESHighVolt: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESLowFreq: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESLowVolt: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESRampTms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESRandomDelay: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setGradW: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + setMaxA: Optional[CurrentRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxAh: Optional[AmpereHour] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxChargeRateVA: Optional[ApparentPower] = field(default=None, + metadata={ + 'type': 'Element', + }) + setMaxChargeRateW: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxDischargeRateVA: Optional[ApparentPower] = field(default=None, + metadata={ + 'type': 'Element', + }) + setMaxDischargeRateW: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + }) + setMaxV: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxVA: Optional[ApparentPower] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxVar: Optional[ReactivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxVarNeg: Optional[ReactivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + setMaxW: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + setMaxWh: Optional[WattHour] = field(default=None, metadata={ + 'type': 'Element', + }) + setMinPFOverExcited: Optional[PowerFactor] = field(default=None, + metadata={ + 'type': 'Element', + }) + setMinPFUnderExcited: Optional[PowerFactor] = field(default=None, + metadata={ + 'type': 'Element', + }) + setMinV: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + setSoftGradW: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setVNom: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + setVRef: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + setVRefOfs: Optional[VoltageRMS] = field(default=None, metadata={ + 'type': 'Element', + }) + updatedTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DERStatus(SubscribableResource): + """ + DER status information. + + :ivar alarmStatus: Bitmap indicating the status of DER alarms (see + DER LogEvents for more details). 0 - DER_FAULT_OVER_CURRENT 1 - + DER_FAULT_OVER_VOLTAGE 2 - DER_FAULT_UNDER_VOLTAGE 3 - + DER_FAULT_OVER_FREQUENCY 4 - DER_FAULT_UNDER_FREQUENCY 5 - + DER_FAULT_VOLTAGE_IMBALANCE 6 - DER_FAULT_CURRENT_IMBALANCE 7 - + DER_FAULT_EMERGENCY_LOCAL 8 - DER_FAULT_EMERGENCY_REMOTE 9 - + DER_FAULT_LOW_POWER_INPUT 10 - DER_FAULT_PHASE_ROTATION 11-31 - + Reserved + :ivar genConnectStatus: Connect/status value for generator DER. See + ConnectStatusType for values. + :ivar inverterStatus: DER InverterStatus/value. See + InverterStatusType for values. + :ivar localControlModeStatus: The local control mode status. See + LocalControlModeStatusType for values. + :ivar manufacturerStatus: Manufacturer status code. + :ivar operationalModeStatus: Operational mode currently in use. See + OperationalModeStatusType for values. + :ivar readingTime: The timestamp when the current status was last + updated. + :ivar stateOfChargeStatus: State of charge status. See + StateOfChargeStatusType for values. + :ivar storageModeStatus: Storage mode status. See + StorageModeStatusType for values. + :ivar storConnectStatus: Connect/status value for storage DER. See + ConnectStatusType for values. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + alarmStatus: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 4, + 'format': 'base16', + }) + genConnectStatus: Optional[ConnectStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + inverterStatus: Optional[InverterStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + localControlModeStatus: Optional[LocalControlModeStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + manufacturerStatus: Optional[ManufacturerStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + operationalModeStatus: Optional[OperationalModeStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + readingTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + stateOfChargeStatus: Optional[StateOfChargeStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + storageModeStatus: Optional[StorageModeStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + storConnectStatus: Optional[ConnectStatusType] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class DemandResponseProgramListLink(ListLink): + """ + SHALL contain a Link to a List of DemandResponseProgram instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class DeviceStatus(Resource): + """ + Status of device. + + :ivar changedTime: The time at which the reported values were + recorded. + :ivar onCount: The number of times that the device has been turned + on: Count of "device on" times, since the last time the counter + was reset + :ivar opState: Device operational state: 0 - Not applicable / + Unknown 1 - Not operating 2 - Operating 3 - Starting up 4 - + Shutting down 5 - At disconnect level 6 - kW ramping 7 - kVar + ramping + :ivar opTime: Total time device has operated: re-settable: + Accumulated time in seconds since the last time the counter was + reset. + :ivar Temperature: + :ivar TimeLink: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + changedTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + onCount: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + opState: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + opTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + Temperature: List[Temperature] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + TimeLink: Optional[TimeLink] = field(default=None, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class DrResponse(Response): + """ + A response to a Demand Response Load Control (EndDeviceControl) message. + + :ivar ApplianceLoadReduction: + :ivar AppliedTargetReduction: + :ivar DutyCycle: + :ivar Offset: + :ivar overrideDuration: Indicates the amount of time, in seconds, + that the client partially opts-out during the demand response + event. When overriding within the allowed override duration, the + client SHALL send a partial opt-out (Response status code 8) for + partial opt-out upon completion, with the total time the event + was overridden (this attribute) populated. The client SHALL send + a no participation status response (status type 10) if the user + partially opts-out for longer than + EndDeviceControl.overrideDuration. + :ivar SetPoint: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ApplianceLoadReduction: Optional[ApplianceLoadReduction] = field(default=None, + metadata={ + 'type': 'Element', + }) + AppliedTargetReduction: Optional[AppliedTargetReduction] = field(default=None, + metadata={ + 'type': 'Element', + }) + DutyCycle: Optional[DutyCycle] = field(default=None, metadata={ + 'type': 'Element', + }) + Offset: Optional[Offset] = field(default=None, metadata={ + 'type': 'Element', + }) + overrideDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + SetPoint: Optional[SetPoint] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class EndDeviceControlListLink(ListLink): + """ + SHALL contain a Link to a List of EndDeviceControl instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class EndDeviceListLink(ListLink): + """ + SHALL contain a Link to a List of EndDevice instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class FileList(List_type): + """ + A List element to hold File objects. + + :ivar File: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + File: List[File] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class FileListLink(ListLink): + """ + SHALL contain a Link to a List of File instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class FileStatus(Resource): + """ + This object provides status of device file load and activation operations. + + :ivar activateTime: Date/time at which this File, referred to by + FileLink, will be activated. Omission of or presence and value + of this element MUST exactly match omission or presence and + value of the activateTime element from the File resource. + :ivar FileLink: + :ivar loadPercent: This element MUST be set to the percentage of the + file, indicated by FileLink, that was loaded during the latest + load attempt. This value MUST be reset to 0 each time a load + attempt is started for the File indicated by FileLink. This + value MUST be increased when an LD receives HTTP response + containing file content. This value MUST be set to 100 when the + full content of the file has been received by the LD + :ivar nextRequestAttempt: This element MUST be set to the time at + which the LD will issue its next GET request for file content + from the File indicated by FileLink + :ivar request503Count: This value MUST be reset to 0 when FileLink + is first pointed at a new File. This value MUST be incremented + each time an LD receives a 503 error from the FS. + :ivar requestFailCount: This value MUST be reset to 0 when FileLink + is first pointed at a new File. This value MUST be incremented + each time a GET request for file content failed. 503 errors MUST + be excluded from this counter. + :ivar status: Current loading status of the file indicated by + FileLink. This element MUST be set to one of the following + values: 0 - No load operation in progress 1 - File load in + progress (first request for file content has been issued by LD) + 2 - File load failed 3 - File loaded successfully (full content + of file has been received by the LD), signature verification in + progress 4 - File signature verification failed 5 - File + signature verified, waiting to activate file. 6 - File + activation failed 7 - File activation in progress 8 - File + activated successfully (this state may not be reached/persisted + through an image activation) 9-255 - Reserved for future use. + :ivar statusTime: This element MUST be set to the time at which file + status transitioned to the value indicated in the status + element. + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + activateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + FileLink: Optional[FileLink] = field(default=None, metadata={ + 'type': 'Element', + }) + loadPercent: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + nextRequestAttempt: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + request503Count: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + requestFailCount: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + status: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + statusTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class FlowReservationRequest(IdentifiedObject): + """Used to request flow transactions. + + Client EndDevices submit a request for charging or discharging from + the server. The server creates an associated FlowReservationResponse + containing the charging parameters and interval to provide a lower + aggregated demand at the premises, or within a larger part of the + distribution system. + + :ivar creationTime: The time at which the request was created. + :ivar durationRequested: A value that is calculated by the storage + device that defines the minimum duration, in seconds, that it + will take to complete the actual flow transaction, including any + ramp times and conditioning times, if applicable. + :ivar energyRequested: Indicates the total amount of energy, in + Watt-Hours, requested to be transferred between the storage + device and the electric power system. Positive values indicate + charging and negative values indicate discharging. This sign + convention is different than for the DER function where + discharging is positive. Note that the energyRequestNow + attribute in the PowerStatus Object must always represent a + charging solution and it is not allowed to have a negative + value. + :ivar intervalRequested: The time window during which the flow + reservation is needed. For example, if an electric vehicle is + set with a 7:00 AM time charge is needed, and price drops to the + lowest tier at 11:00 PM, then this window would likely be from + 11:00 PM until 7:00 AM. + :ivar powerRequested: Indicates the sustained level of power, in + Watts, that is requested. For charging this is calculated by the + storage device and it represents the charging system capability + (which for an electric vehicle must also account for any power + limitations due to the EVSE control pilot). For discharging, a + lower value than the inverter capability can be used as a + target. + :ivar RequestStatus: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + creationTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + durationRequested: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + energyRequested: Optional[SignedRealEnergy] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + intervalRequested: Optional[DateTimeInterval] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + powerRequested: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + RequestStatus: Optional[RequestStatus] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class FlowReservationRequestListLink(ListLink): + """ + SHALL contain a Link to a List of FlowReservationRequest instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class FlowReservationResponseListLink(ListLink): + """ + SHALL contain a Link to a List of FlowReservationResponse instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class FlowReservationResponseResponse(Response): + """ + A response to a FlowReservationResponse. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class FunctionSetAssignmentsListLink(ListLink): + """ + SHALL contain a Link to a List of FunctionSetAssignments instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class HistoricalReadingListLink(ListLink): + """ + SHALL contain a Link to a List of HistoricalReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class IPAddrListLink(ListLink): + """ + SHALL contain a Link to a List of IPAddr instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class IPInterfaceListLink(ListLink): + """ + SHALL contain a Link to a List of IPInterface instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class LLInterfaceListLink(ListLink): + """ + SHALL contain a Link to a List of LLInterface instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class LoadShedAvailability(Resource): + """ + Indicates current consumption status and ability to shed load. + + :ivar availabilityDuration: Indicates for how many seconds the + consuming device will be able to reduce consumption at the + maximum response level. + :ivar DemandResponseProgramLink: + :ivar sheddablePercent: Maximum percent of current operating load + that is estimated to be sheddable. + :ivar sheddablePower: Maximum amount of current operating load that + is estimated to be sheddable, in Watts. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + availabilityDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + DemandResponseProgramLink: Optional[DemandResponseProgramLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + sheddablePercent: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + sheddablePower: Optional[ActivePower] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class LoadShedAvailabilityListLink(ListLink): + """ + SHALL contain a Link to a List of LoadShedAvailability instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class LogEventListLink(ListLink): + """ + SHALL contain a Link to a List of LogEvent instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class MessagingProgramListLink(ListLink): + """ + SHALL contain a Link to a List of MessagingProgram instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class MeterReadingBase(IdentifiedObject): + """ + A container for associating ReadingType, Readings and ReadingSets. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class MeterReadingListLink(ListLink): + """ + SHALL contain a Link to a List of MeterReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class MirrorUsagePointListLink(ListLink): + """ + SHALL contain a Link to a List of MirrorUsagePoint instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class NeighborList(List_type): + """ + List of 15.4 neighbors. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Neighbor: List[Neighbor] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class NeighborListLink(ListLink): + """ + SHALL contain a Link to a List of Neighbor instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class Notification(SubscriptionBase): + """Holds the information related to a client subscription to receive + updates to a resource automatically. + + The actual resources may be passed in the Notification by specifying + a specific xsi:type for the Resource and passing the full + representation. + + :ivar newResourceURI: The new location of the resource, if moved. + This attribute SHALL be a fully-qualified absolute URI, not a + relative reference. + :ivar Resource: + :ivar status: 0 = Default Status 1 = Subscription canceled, no + additional information 2 = Subscription canceled, resource moved + 3 = Subscription canceled, resource definition changed (e.g., a + new version of IEEE 2030.5) 4 = Subscription canceled, resource + deleted All other values reserved. + :ivar subscriptionURI: The subscription from which this notification + was triggered. This attribute SHALL be a fully-qualified + absolute URI, not a relative reference. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + newResourceURI: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + }) + Resource: Optional[Resource] = field(default=None, metadata={ + 'type': 'Element', + }) + status: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + subscriptionURI: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class NotificationListLink(ListLink): + """ + SHALL contain a Link to a List of Notification instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class PowerStatus(Resource): + """ + Contains the status of the device's power sources. + + :ivar batteryStatus: Battery system status 0 = unknown 1 = normal + (more than LowChargeThreshold remaining) 2 = low (less than + LowChargeThreshold remaining) 3 = depleted (0% charge remaining) + 4 = not applicable (mains powered only) + :ivar changedTime: The time at which the reported values were + recorded. + :ivar currentPowerSource: This value will be fixed for devices + powered by a single source. This value may change for devices + able to transition between multiple power sources (mains to + battery backup, etc.). + :ivar estimatedChargeRemaining: Estimate of remaining battery charge + as a percent of full charge. + :ivar estimatedTimeRemaining: Estimated time (in seconds) to total + battery charge depletion (under current load) + :ivar PEVInfo: + :ivar sessionTimeOnBattery: If the device has a battery, this is the + time since the device last switched to battery power, or the + time since the device was restarted, whichever is less, in + seconds. + :ivar totalTimeOnBattery: If the device has a battery, this is the + total time the device has been on battery power, in seconds. It + may be reset when the battery is replaced. + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + batteryStatus: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + changedTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + currentPowerSource: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + estimatedChargeRemaining: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + estimatedTimeRemaining: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + PEVInfo: Optional[PEVInfo] = field(default=None, metadata={ + 'type': 'Element', + }) + sessionTimeOnBattery: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + totalTimeOnBattery: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class PrepaymentListLink(ListLink): + """ + SHALL contain a Link to a List of Prepayment instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class PriceResponse(Response): + """ + A response related to a price message. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class PriceResponseCfg(Resource): + """ + Configuration data that specifies how price responsive devices SHOULD + respond to price changes while acting upon a given RateComponent. + + :ivar consumeThreshold: Price responsive clients acting upon the + associated RateComponent SHOULD consume the associated commodity + while the price is less than this threshold. + :ivar maxReductionThreshold: Price responsive clients acting upon + the associated RateComponent SHOULD reduce consumption to the + maximum extent possible while the price is greater than this + threshold. + :ivar RateComponentLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + consumeThreshold: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + maxReductionThreshold: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + RateComponentLink: Optional[RateComponentLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class PriceResponseCfgListLink(ListLink): + """ + SHALL contain a Link to a List of PriceResponseCfg instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ProjectionReadingListLink(ListLink): + """ + SHALL contain a Link to a List of ProjectionReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RPLInstanceListLink(ListLink): + """ + SHALL contain a Link to a List of RPLInterface instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RPLSourceRoutesList(List_type): + """ + List or RPL source routes if the hosting device is the DODAGroot. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + RPLSourceRoutes: List[RPLSourceRoutes] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class RPLSourceRoutesListLink(ListLink): + """ + SHALL contain a Link to a List of RPLSourceRoutes instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RateComponentListLink(ListLink): + """ + SHALL contain a Link to a List of RateComponent instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class Reading(ReadingBase): + """ + Specific value measured by a meter or other asset. + + :ivar localID: The local identifier for this reading within the + reading set. localIDs are assigned in order of creation time. + For interval data, this value SHALL increase with each interval + time, and for block/tier readings, localID SHALL not be + specified. + :ivar subscribable: Indicates whether or not subscriptions are + supported for this resource, and whether or not conditional + (thresholds) are supported. If not specified, is "not + subscribable" (0). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + localID: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 2, + 'format': 'base16', + }) + subscribable: int = field(default=0, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class ReadingListLink(ListLink): + """ + SHALL contain a Link to a List of Reading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ReadingSetBase(IdentifiedObject): + """A set of Readings of the ReadingType indicated by the parent + MeterReading. + + ReadingBase is abstract, used to define the elements common to + ReadingSet and IntervalBlock. + + :ivar timePeriod: Specifies the time range during which the + contained readings were taken. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + timePeriod: Optional[DateTimeInterval] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ReadingSetListLink(ListLink): + """ + SHALL contain a Link to a List of ReadingSet instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RespondableIdentifiedObject(RespondableResource): + """ + An IdentifiedObject to which a Response can be requested. + + :ivar mRID: The global identifier of the object. + :ivar description: The description is a human readable text + describing or naming the object. + :ivar version: Contains the version number of the object. See the + type definition for details. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + mRID: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 32, + }) + version: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class RespondableSubscribableIdentifiedObject(RespondableResource): + """ + An IdentifiedObject to which a Response can be requested. + + :ivar mRID: The global identifier of the object. + :ivar description: The description is a human readable text + describing or naming the object. + :ivar version: Contains the version number of the object. See the + type definition for details. + :ivar subscribable: Indicates whether or not subscriptions are + supported for this resource, and whether or not conditional + (thresholds) are supported. If not specified, is "not + subscribable" (0). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + mRID: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 32, + }) + version: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + subscribable: int = field(default=0, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class ResponseList(List_type): + """ + A List element to hold Response objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Response: List[Response] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ResponseListLink(ListLink): + """ + SHALL contain a Link to a List of Response instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ResponseSetListLink(ListLink): + """ + SHALL contain a Link to a List of ResponseSet instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class ServiceSupplier(IdentifiedObject): + """ + Organisation that provides services to Customers. + + :ivar email: E-mail address for this service supplier. + :ivar phone: Human-readable phone number for this service supplier. + :ivar providerID: Contains the IANA PEN for the commodity provider. + :ivar web: Website URI address for this service supplier. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + email: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 32, + }) + phone: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 20, + }) + providerID: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + web: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 42, + }) + + +@dataclass +class SubscribableIdentifiedObject(SubscribableResource): + """ + An IdentifiedObject to which a Subscription can be requested. + + :ivar mRID: The global identifier of the object. + :ivar description: The description is a human readable text + describing or naming the object. + :ivar version: Contains the version number of the object. See the + type definition for details. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + mRID: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 32, + }) + version: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class SubscribableList(SubscribableResource): + """ + A List to which a Subscription can be requested. + + :ivar all: The number specifying "all" of the items in the list. + Required on GET, ignored otherwise. + :ivar results: Indicates the number of items in this page of + results. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + all: Optional[int] = field(default=None, metadata={ + 'type': 'Attribute', + 'required': True, + }) + results: Optional[int] = field(default=None, + metadata={ + 'type': 'Attribute', + 'required': True, + }) + + +@dataclass +class Subscription(SubscriptionBase): + """ + Holds the information related to a client subscription to receive updates + to a resource automatically. + + :ivar Condition: + :ivar encoding: 0 - application/sep+xml 1 - application/sep-exi + 2-255 - reserved + :ivar level: Contains the preferred schema and extensibility level + indication such as "+S1" + :ivar limit: This element is used to indicate the maximum number of + list items that should be included in a notification when the + subscribed resource changes. This limit is meant to be + functionally equivalent to the ‘limit’ query string parameter, + but applies to both list resources as well as other resources. + For list resources, if a limit of ‘0’ is specified, then + notifications SHALL contain a list resource with results=’0’ + (equivalent to a simple change notification). For list + resources, if a limit greater than ‘0’ is specified, then + notifications SHALL contain a list resource with results equal + to the limit specified (or less, should the list contain fewer + items than the limit specified or should the server be unable to + provide the requested number of items for any reason) and follow + the same rules for list resources (e.g., ordering). For non- + list resources, if a limit of ‘0’ is specified, then + notifications SHALL NOT contain a resource representation + (equivalent to a simple change notification). For non-list + resources, if a limit greater than ‘0’ is specified, then + notifications SHALL contain the representation of the changed + resource. + :ivar notificationURI: The resource to which to post the + notifications about the requested subscribed resource. Because + this URI will exist on a server other than the one being POSTed + to, this attribute SHALL be a fully-qualified absolute URI, not + a relative reference. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Condition: Optional[Condition] = field(default=None, metadata={ + 'type': 'Element', + }) + encoding: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + level: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + }) + limit: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + notificationURI: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class SubscriptionListLink(ListLink): + """ + SHALL contain a Link to a List of Subscription instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class SupplyInterruptionOverrideList(List_type): + """ + A List element to hold SupplyInterruptionOverride objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + SupplyInterruptionOverride: List[SupplyInterruptionOverride] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class SupplyInterruptionOverrideListLink(ListLink): + """ + SHALL contain a Link to a List of SupplyInterruptionOverride instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class SupportedLocaleList(List_type): + """ + A List element to hold SupportedLocale objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + SupportedLocale: List[SupportedLocale] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class SupportedLocaleListLink(ListLink): + """ + SHALL contain a Link to a List of SupportedLocale instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class TargetReadingListLink(ListLink): + """ + SHALL contain a Link to a List of TargetReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class TariffProfileListLink(ListLink): + """ + SHALL contain a Link to a List of TariffProfile instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class TextMessageListLink(ListLink): + """ + SHALL contain a Link to a List of TextMessage instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class TextResponse(Response): + """ + A response to a text message. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class TimeTariffIntervalListLink(ListLink): + """ + SHALL contain a Link to a List of TimeTariffInterval instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class UsagePointBase(IdentifiedObject): + """Logical point on a network at which consumption or production is either + physically measured (e.g. metered) or estimated (e.g. unmetered street + lights). + + A container for associating ReadingType, Readings and ReadingSets. + + :ivar roleFlags: Specifies the roles that apply to the usage point. + :ivar serviceCategoryKind: The kind of service provided by this + usage point. + :ivar status: Specifies the current status of the service at this + usage point. 0 = off 1 = on + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + roleFlags: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 2, + 'format': 'base16', + }) + serviceCategoryKind: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + status: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class UsagePointListLink(ListLink): + """ + SHALL contain a Link to a List of UsagePoint instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class AbstractDevice(SubscribableResource): + """ + The EndDevice providing the resources available within the + DeviceCapabilities. + + :ivar ConfigurationLink: + :ivar DERListLink: + :ivar deviceCategory: This field is for use in devices that can + adjust energy usage (e.g., demand response, distributed energy + resources). For devices that do not respond to + EndDeviceControls or DERControls (for instance, an ESI), this + field should not have any bits set. + :ivar DeviceInformationLink: + :ivar DeviceStatusLink: + :ivar FileStatusLink: + :ivar IPInterfaceListLink: + :ivar lFDI: Long form of device identifier. See the Security section + for additional details. + :ivar LoadShedAvailabilityListLink: + :ivar LogEventListLink: + :ivar PowerStatusLink: + :ivar sFDI: Short form of device identifier, WITH the checksum + digit. See the Security section for additional details. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ConfigurationLink: Optional[ConfigurationLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERListLink: Optional[DERListLink] = field(default=None, metadata={ + 'type': 'Element', + }) + deviceCategory: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 4, + 'format': 'base16', + }) + DeviceInformationLink: Optional[DeviceInformationLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DeviceStatusLink: Optional[DeviceStatusLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + FileStatusLink: Optional[FileStatusLink] = field(default=None, metadata={ + 'type': 'Element', + }) + IPInterfaceListLink: Optional[IPInterfaceListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + lFDI: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 20, + 'format': 'base16', + }) + LoadShedAvailabilityListLink: Optional[LoadShedAvailabilityListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + LogEventListLink: Optional[LogEventListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + PowerStatusLink: Optional[PowerStatusLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + sFDI: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_inclusive': 281474976710655, + }) + + +@dataclass +class BillingMeterReadingBase(MeterReadingBase): + """ + Contains historical, target, and projection readings of various types, + possibly associated with charges. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + BillingReadingSetListLink: Optional[BillingReadingSetListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + ReadingTypeLink: Optional[ReadingTypeLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class BillingPeriodList(SubscribableList): + """ + A List element to hold BillingPeriod objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + BillingPeriod: List[BillingPeriod] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class BillingReadingList(List_type): + """ + A List element to hold BillingReading objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + BillingReading: List[BillingReading] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class BillingReadingSet(ReadingSetBase): + """ + Time sequence of readings of the same reading type. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + BillingReadingListLink: Optional[BillingReadingListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class Configuration(SubscribableResource): + """ + This resource contains various settings to control the operation of the + device. + + :ivar currentLocale: [RFC 4646] identifier of the language-region + currently in use. + :ivar PowerConfiguration: + :ivar PriceResponseCfgListLink: + :ivar TimeConfiguration: + :ivar userDeviceName: User assigned, convenience name used for + network browsing displays, etc. Example "My Thermostat" + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + currentLocale: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 42, + }) + PowerConfiguration: Optional[PowerConfiguration] = field(default=None, + metadata={ + 'type': 'Element', + }) + PriceResponseCfgListLink: Optional[PriceResponseCfgListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + TimeConfiguration: Optional[TimeConfiguration] = field(default=None, + metadata={ + 'type': 'Element', + }) + userDeviceName: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class CreditRegisterList(List_type): + """ + A List element to hold CreditRegister objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + CreditRegister: List[CreditRegister] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class CustomerAccount(IdentifiedObject): + """Assignment of a group of products and services purchased by the Customer + through a CustomerAgreement, used as a mechanism for customer billing and + payment. + + It contains common information from the various types of + CustomerAgreements to create billings (invoices) for a Customer and + receive payment. + + :ivar currency: The ISO 4217 code indicating the currency applicable + to the bill amounts in the summary. See list at + http://www.unece.org/cefact/recommendations/rec09/rec09_ecetrd203.pdf + :ivar customerAccount: The account number for the customer (if + applicable). + :ivar CustomerAgreementListLink: + :ivar customerName: The name of the customer. + :ivar pricePowerOfTenMultiplier: Indicates the power of ten + multiplier for the prices in this function set. + :ivar ServiceSupplierLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + currency: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + customerAccount: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 42, + }) + CustomerAgreementListLink: Optional[CustomerAgreementListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + customerName: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 42, + }) + pricePowerOfTenMultiplier: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + ServiceSupplierLink: Optional[ServiceSupplierLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class CustomerAgreement(IdentifiedObject): + """Agreement between the customer and the service supplier to pay for + service at a specific service location. + + It records certain billing information about the type of service + provided at the service location and is used during charge creation + to determine the type of service. + + :ivar ActiveBillingPeriodListLink: + :ivar ActiveProjectionReadingListLink: + :ivar ActiveTargetReadingListLink: + :ivar BillingPeriodListLink: + :ivar HistoricalReadingListLink: + :ivar PrepaymentLink: + :ivar ProjectionReadingListLink: + :ivar serviceAccount: The account number of the service account (if + applicable). + :ivar serviceLocation: The address or textual description of the + service location. + :ivar TargetReadingListLink: + :ivar TariffProfileLink: + :ivar UsagePointLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ActiveBillingPeriodListLink: Optional[ActiveBillingPeriodListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + ActiveProjectionReadingListLink: Optional[ActiveProjectionReadingListLink] = field( + default=None, metadata={ + 'type': 'Element', + }) + ActiveTargetReadingListLink: Optional[ActiveTargetReadingListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + BillingPeriodListLink: Optional[BillingPeriodListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + HistoricalReadingListLink: Optional[HistoricalReadingListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + PrepaymentLink: Optional[PrepaymentLink] = field(default=None, metadata={ + 'type': 'Element', + }) + ProjectionReadingListLink: Optional[ProjectionReadingListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + serviceAccount: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 42, + }) + serviceLocation: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 42, + }) + TargetReadingListLink: Optional[TargetReadingListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + TariffProfileLink: Optional[TariffProfileLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + UsagePointLink: Optional[UsagePointLink] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class DER(SubscribableResource): + """ + Contains links to DER resources. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + AssociatedDERProgramListLink: Optional[AssociatedDERProgramListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + AssociatedUsagePointLink: Optional[AssociatedUsagePointLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + CurrentDERProgramLink: Optional[CurrentDERProgramLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERAvailabilityLink: Optional[DERAvailabilityLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERCapabilityLink: Optional[DERCapabilityLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERSettingsLink: Optional[DERSettingsLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERStatusLink: Optional[DERStatusLink] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class DERCurveList(List_type): + """ + A List element to hold DERCurve objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DERCurve: List[DERCurve] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class DERProgram(SubscribableIdentifiedObject): + """ + Distributed Energy Resource program. + + :ivar ActiveDERControlListLink: + :ivar DefaultDERControlLink: + :ivar DERControlListLink: + :ivar DERCurveListLink: + :ivar primacy: Indicates the relative primacy of the provider of + this Program. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ActiveDERControlListLink: Optional[ActiveDERControlListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DefaultDERControlLink: Optional[DefaultDERControlLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERControlListLink: Optional[DERControlListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DERCurveListLink: Optional[DERCurveListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + primacy: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DefaultDERControl(SubscribableIdentifiedObject): + """ + Contains control mode information to be used if no active DERControl is + found. + + :ivar DERControlBase: + :ivar setESDelay: Enter service delay, in hundredths of a second. + When present, this value SHALL update the value of the + corresponding setting (DERSettings::setESDelay). + :ivar setESHighFreq: Enter service frequency high. Specified in + hundredths of Hz. When present, this value SHALL update the + value of the corresponding setting (DERSettings::setESHighFreq). + :ivar setESHighVolt: Enter service voltage high. Specified as an + effective percent voltage, defined as (100% * (locally measured + voltage - setVRefOfs) / setVRef), in hundredths of a percent. + When present, this value SHALL update the value of the + corresponding setting (DERSettings::setESHighVolt). + :ivar setESLowFreq: Enter service frequency low. Specified in + hundredths of Hz. When present, this value SHALL update the + value of the corresponding setting (DERSettings::setESLowFreq). + :ivar setESLowVolt: Enter service voltage low. Specified as an + effective percent voltage, defined as (100% * (locally measured + voltage - setVRefOfs) / setVRef), in hundredths of a percent. + When present, this value SHALL update the value of the + corresponding setting (DERSettings::setESLowVolt). + :ivar setESRampTms: Enter service ramp time, in hundredths of a + second. When present, this value SHALL update the value of the + corresponding setting (DERSettings::setESRampTms). + :ivar setESRandomDelay: Enter service randomized delay, in + hundredths of a second. When present, this value SHALL update + the value of the corresponding setting + (DERSettings::setESRandomDelay). + :ivar setGradW: Set default rate of change (ramp rate) of active + power output due to command or internal action, defined in + %setWMax / second. Resolution is in hundredths of a + percent/second. A value of 0 means there is no limit. + Interpreted as a percentage change in output capability limit + per second when used as a default ramp rate. When present, this + value SHALL update the value of the corresponding setting + (DERSettings::setGradW). + :ivar setSoftGradW: Set soft-start rate of change (soft-start ramp + rate) of active power output due to command or internal action, + defined in %setWMax / second. Resolution is in hundredths of a + percent/second. A value of 0 means there is no limit. + Interpreted as a percentage change in output capability limit + per second when used as a ramp rate. When present, this value + SHALL update the value of the corresponding setting + (DERSettings::setSoftGradW). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DERControlBase: Optional[DERControlBase] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + setESDelay: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESHighFreq: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESHighVolt: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESLowFreq: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESLowVolt: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESRampTms: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setESRandomDelay: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setGradW: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + setSoftGradW: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class DemandResponseProgram(IdentifiedObject): + """ + Demand response program. + + :ivar ActiveEndDeviceControlListLink: + :ivar availabilityUpdatePercentChangeThreshold: This attribute + allows program providers to specify the requested granularity of + updates to LoadShedAvailability sheddablePercent. If not + present, or set to 0, then updates to LoadShedAvailability SHALL + NOT be provided. If present and greater than zero, then clients + SHALL provide their LoadShedAvailability if it has not + previously been provided, and thereafter if the difference + between the previously provided value and the current value of + LoadShedAvailability sheddablePercent is greater than + availabilityUpdatePercentChangeThreshold. + :ivar availabilityUpdatePowerChangeThreshold: This attribute allows + program providers to specify the requested granularity of + updates to LoadShedAvailability sheddablePower. If not present, + or set to 0, then updates to LoadShedAvailability SHALL NOT be + provided. If present and greater than zero, then clients SHALL + provide their LoadShedAvailability if it has not previously been + provided, and thereafter if the difference between the + previously provided value and the current value of + LoadShedAvailability sheddablePower is greater than + availabilityUpdatePowerChangeThreshold. + :ivar EndDeviceControlListLink: + :ivar primacy: Indicates the relative primacy of the provider of + this program. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ActiveEndDeviceControlListLink: Optional[ActiveEndDeviceControlListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + availabilityUpdatePercentChangeThreshold: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + }) + availabilityUpdatePowerChangeThreshold: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + }) + EndDeviceControlListLink: Optional[EndDeviceControlListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + primacy: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DeviceInformation(Resource): + """ + Contains identification and other information about the device that changes + very infrequently, typically only when updates are applied, if ever. + + :ivar DRLCCapabilities: + :ivar functionsImplemented: Bitmap indicating the function sets used + by the device as a client. 0 - Device Capability 1 - Self Device + Resource 2 - End Device Resource 3 - Function Set Assignments 4 + - Subscription/Notification Mechanism 5 - Response 6 - Time 7 - + Device Information 8 - Power Status 9 - Network Status 10 - Log + Event 11 - Configuration Resource 12 - Software Download 13 - + DRLC 14 - Metering 15 - Pricing 16 - Messaging 17 - Billing 18 - + Prepayment 19 - Flow Reservation 20 - DER Control + :ivar gpsLocation: GPS location of this device. + :ivar lFDI: Long form device identifier. See the Security section + for full details. + :ivar mfDate: Date/time of manufacture + :ivar mfHwVer: Manufacturer hardware version + :ivar mfID: The manufacturer's IANA Enterprise Number. + :ivar mfInfo: Manufacturer dependent information related to the + manufacture of this device + :ivar mfModel: Manufacturer's model number + :ivar mfSerNum: Manufacturer assigned serial number + :ivar primaryPower: Primary source of power. + :ivar secondaryPower: Secondary source of power + :ivar SupportedLocaleListLink: + :ivar swActTime: Activation date/time of currently running software + :ivar swVer: Currently running software version + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DRLCCapabilities: Optional[DRLCCapabilities] = field(default=None, + metadata={ + 'type': 'Element', + }) + functionsImplemented: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 8, + 'format': 'base16', + }) + gpsLocation: Optional[GPSLocationType] = field(default=None, metadata={ + 'type': 'Element', + }) + lFDI: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 20, + 'format': 'base16', + }) + mfDate: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + mfHwVer: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + mfID: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + mfInfo: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 32, + }) + mfModel: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + mfSerNum: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + primaryPower: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + secondaryPower: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + SupportedLocaleListLink: Optional[SupportedLocaleListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + swActTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + swVer: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 32, + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class Event(RespondableSubscribableIdentifiedObject): + """An Event indicates information that applies to a particular period of + time. + + Events SHALL be executed relative to the time of the server, as + described in the Time function set section 11.1. + + :ivar creationTime: The time at which the Event was created. + :ivar EventStatus: + :ivar interval: The period during which the Event applies. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + creationTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + EventStatus: Optional[EventStatus] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + interval: Optional[DateTimeInterval] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class FlowReservationRequestList(List_type): + """ + A List element to hold FlowReservationRequest objects. + + :ivar FlowReservationRequest: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + FlowReservationRequest: List[FlowReservationRequest] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class FunctionSetAssignmentsBase(Resource): + """ + Defines a collection of function set instances that are to be used by one + or more devices as indicated by the EndDevice object(s) of the server. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + CustomerAccountListLink: Optional[CustomerAccountListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + DemandResponseProgramListLink: Optional[DemandResponseProgramListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + DERProgramListLink: Optional[DERProgramListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + FileListLink: Optional[FileListLink] = field(default=None, metadata={ + 'type': 'Element', + }) + MessagingProgramListLink: Optional[MessagingProgramListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + PrepaymentListLink: Optional[PrepaymentListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + ResponseSetListLink: Optional[ResponseSetListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + TariffProfileListLink: Optional[TariffProfileListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + TimeLink: Optional[TimeLink] = field(default=None, metadata={ + 'type': 'Element', + }) + UsagePointListLink: Optional[UsagePointListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class IEEE_802_15_4: + """ + Contains 802.15.4 link layer specific attributes. + + :ivar capabilityInfo: As defined by IEEE 802.15.4 + :ivar NeighborListLink: + :ivar shortAddress: As defined by IEEE 802.15.4 + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + capabilityInfo: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 1, + 'format': 'base16', + }) + NeighborListLink: Optional[NeighborListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + shortAddress: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class IPAddr(Resource): + """ + An Internet Protocol address object. + + :ivar address: An IP address value. + :ivar RPLInstanceListLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + address: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + RPLInstanceListLink: Optional[RPLInstanceListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class IPInterface(Resource): + """Specific IPInterface resource. + + This resource may be thought of as network status information for a + specific network (IP) layer interface. + + :ivar ifDescr: Use rules from [RFC 2863]. + :ivar ifHighSpeed: Use rules from [RFC 2863]. + :ivar ifInBroadcastPkts: Use rules from [RFC 2863]. + :ivar ifIndex: Use rules from [RFC 2863]. + :ivar ifInDiscards: Use rules from [RFC 2863]. Can be thought of as + Input Datagrams Discarded. + :ivar ifInErrors: Use rules from [RFC 2863]. + :ivar ifInMulticastPkts: Use rules from [RFC 2863]. Can be thought + of as Multicast Datagrams Received. + :ivar ifInOctets: Use rules from [RFC 2863]. Can be thought of as + Bytes Received. + :ivar ifInUcastPkts: Use rules from [RFC 2863]. Can be thought of as + Datagrams Received. + :ivar ifInUnknownProtos: Use rules from [RFC 2863]. Can be thought + of as Datagrams with Unknown Protocol Received. + :ivar ifMtu: Use rules from [RFC 2863]. + :ivar ifName: Use rules from [RFC 2863]. + :ivar ifOperStatus: Use rules and assignments from [RFC 2863]. + :ivar ifOutBroadcastPkts: Use rules from [RFC 2863]. Can be thought + of as Broadcast Datagrams Sent. + :ivar ifOutDiscards: Use rules from [RFC 2863]. Can be thought of as + Output Datagrams Discarded. + :ivar ifOutErrors: Use rules from [RFC 2863]. + :ivar ifOutMulticastPkts: Use rules from [RFC 2863]. Can be thought + of as Multicast Datagrams Sent. + :ivar ifOutOctets: Use rules from [RFC 2863]. Can be thought of as + Bytes Sent. + :ivar ifOutUcastPkts: Use rules from [RFC 2863]. Can be thought of + as Datagrams Sent. + :ivar ifPromiscuousMode: Use rules from [RFC 2863]. + :ivar ifSpeed: Use rules from [RFC 2863]. + :ivar ifType: Use rules and assignments from [RFC 2863]. + :ivar IPAddrListLink: + :ivar lastResetTime: Similar to ifLastChange in [RFC 2863]. + :ivar lastUpdatedTime: The date/time of the reported status. + :ivar LLInterfaceListLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ifDescr: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 192, + }) + ifHighSpeed: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInBroadcastPkts: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifIndex: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInDiscards: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInErrors: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInMulticastPkts: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInOctets: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInUcastPkts: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifInUnknownProtos: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifMtu: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifName: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 16, + }) + ifOperStatus: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifOutBroadcastPkts: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifOutDiscards: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifOutErrors: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifOutMulticastPkts: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifOutOctets: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifOutUcastPkts: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifPromiscuousMode: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + ifSpeed: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + ifType: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + IPAddrListLink: Optional[IPAddrListLink] = field(default=None, metadata={ + 'type': 'Element', + }) + lastResetTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + lastUpdatedTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLInterfaceListLink: Optional[LLInterfaceListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class LoadShedAvailabilityList(List_type): + """ + A List element to hold LoadShedAvailability objects. + + :ivar LoadShedAvailability: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + LoadShedAvailability: List[LoadShedAvailability] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class LogEventList(SubscribableList): + """ + A List element to hold LogEvent objects. + + :ivar LogEvent: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + LogEvent: List[LogEvent] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class MessagingProgram(SubscribableIdentifiedObject): + """ + Provides a container for collections of text messages. + + :ivar ActiveTextMessageListLink: + :ivar locale: Indicates the language and region of the messages in + this collection. + :ivar primacy: Indicates the relative primacy of the provider of + this program. + :ivar TextMessageListLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ActiveTextMessageListLink: Optional[ActiveTextMessageListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + locale: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 42, + }) + primacy: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + TextMessageListLink: Optional[TextMessageListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class MeterReading(MeterReadingBase): + """ + Set of values obtained from the meter. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + RateComponentListLink: Optional[RateComponentListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + ReadingLink: Optional[ReadingLink] = field(default=None, metadata={ + 'type': 'Element', + }) + ReadingSetListLink: Optional[ReadingSetListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + ReadingTypeLink: Optional[ReadingTypeLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class MirrorReadingSet(ReadingSetBase): + """ + A set of Readings of the ReadingType indicated by the parent MeterReading. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Reading: List[Reading] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class NotificationList(List_type): + """ + A List element to hold Notification objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Notification: List[Notification] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class PriceResponseCfgList(List_type): + """ + A List element to hold PriceResponseCfg objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + PriceResponseCfg: List[PriceResponseCfg] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class RPLInstance(Resource): + """Specific RPLInstance resource. + + This resource may be thought of as network status information for a + specific RPL instance associated with IPInterface. + + :ivar DODAGid: See [RFC 6550]. + :ivar DODAGroot: See [RFC 6550]. + :ivar flags: See [RFC 6550]. + :ivar groundedFlag: See [RFC 6550]. + :ivar MOP: See [RFC 6550]. + :ivar PRF: See [RFC 6550]. + :ivar rank: See [RFC 6550]. + :ivar RPLInstanceID: See [RFC 6550]. + :ivar RPLSourceRoutesListLink: + :ivar versionNumber: See [RFC 6550]. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DODAGid: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + DODAGroot: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + flags: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + groundedFlag: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + MOP: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + PRF: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + rank: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + RPLInstanceID: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + RPLSourceRoutesListLink: Optional[RPLSourceRoutesListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + versionNumber: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class RateComponent(IdentifiedObject): + """ + Specifies the applicable charges for a single component of the rate, which + could be generation price or consumption price, for example. + + :ivar ActiveTimeTariffIntervalListLink: + :ivar flowRateEndLimit: Specifies the maximum flow rate (e.g. kW for + electricity) for which this RateComponent applies, for the usage + point and given rate / tariff. In combination with + flowRateStartLimit, allows a service provider to define the + demand or output characteristics for the particular tariff + design. If a server includes the flowRateEndLimit attribute, + then it SHALL also include flowRateStartLimit attribute. For + example, a service provider’s tariff limits customers to 20 kWs + of demand for the given rate structure. Above this threshold + (from 20-50 kWs), there are different demand charges per unit of + consumption. The service provider can use flowRateStartLimit + and flowRateEndLimit to describe the demand characteristics of + the different rates. Similarly, these attributes can be used to + describe limits on premises DERs that might be producing a + commodity and sending it back into the distribution network. + Note: At the time of writing, service provider tariffs with + demand-based components were not originally identified as being + in scope, and service provider tariffs vary widely in their use + of demand components and the method for computing charges. It + is expected that industry groups (e.g., OpenSG) will document + requirements in the future that the IEEE 2030.5 community can + then use as source material for the next version of IEEE 2030.5. + :ivar flowRateStartLimit: Specifies the minimum flow rate (e.g., kW + for electricity) for which this RateComponent applies, for the + usage point and given rate / tariff. In combination with + flowRateEndLimit, allows a service provider to define the demand + or output characteristics for the particular tariff design. If + a server includes the flowRateStartLimit attribute, then it + SHALL also include flowRateEndLimit attribute. + :ivar ReadingTypeLink: Provides indication of the ReadingType with + which this price is associated. + :ivar roleFlags: Specifies the roles that this usage point has been + assigned. + :ivar TimeTariffIntervalListLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ActiveTimeTariffIntervalListLink: Optional[ActiveTimeTariffIntervalListLink] = field( + default=None, metadata={ + 'type': 'Element', + }) + flowRateEndLimit: Optional[UnitValueType] = field(default=None, metadata={ + 'type': 'Element', + }) + flowRateStartLimit: Optional[UnitValueType] = field(default=None, + metadata={ + 'type': 'Element', + }) + ReadingTypeLink: Optional[ReadingTypeLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + roleFlags: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 2, + 'format': 'base16', + }) + TimeTariffIntervalListLink: Optional[TimeTariffIntervalListLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class ReadingList(SubscribableList): + """ + A List element to hold Reading objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Reading: List[Reading] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ReadingSet(ReadingSetBase): + """ + A set of Readings of the ReadingType indicated by the parent MeterReading. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ReadingListLink: Optional[ReadingListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class ResponseSet(IdentifiedObject): + """ + A container for a ResponseList. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ResponseListLink: Optional[ResponseListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class ServiceSupplierList(List_type): + """ + A List element to hold ServiceSupplier objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ServiceSupplier: List[ServiceSupplier] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class SubscriptionList(List_type): + """ + A List element to hold Subscription objects. + + :ivar Subscription: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Subscription: List[Subscription] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class TariffProfile(IdentifiedObject): + """ + A schedule of charges; structure that allows the definition of tariff + structures such as step (block) and time of use (tier) when used in + conjunction with TimeTariffInterval and ConsumptionTariffInterval. + + :ivar currency: The currency code indicating the currency for this + TariffProfile. + :ivar pricePowerOfTenMultiplier: Indicates the power of ten + multiplier for the price attribute. + :ivar primacy: Indicates the relative primacy of the provider of + this program. + :ivar rateCode: The rate code for this tariff profile. Provided by + the Pricing service provider per its internal business needs and + practices and provides a method to identify the specific rate + code for the TariffProfile instance. This would typically not + be communicated to the user except to facilitate troubleshooting + due to its service provider-specific technical nature. + :ivar RateComponentListLink: + :ivar serviceCategoryKind: The kind of service provided by this + usage point. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + currency: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + pricePowerOfTenMultiplier: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + primacy: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + rateCode: Optional[str] = field(default=None, metadata={ + 'type': 'Element', + 'max_length': 20, + }) + RateComponentListLink: Optional[RateComponentListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + serviceCategoryKind: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class UsagePoint(UsagePointBase): + """ + Logical point on a network at which consumption or production is either + physically measured (e.g. metered) or estimated (e.g. unmetered street + lights). + + :ivar deviceLFDI: The LFDI of the source device. This attribute + SHALL be present when mirroring. + :ivar MeterReadingListLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + deviceLFDI: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 20, + 'format': 'base16', + }) + MeterReadingListLink: Optional[MeterReadingListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class BillingReadingSetList(SubscribableList): + """ + A List element to hold BillingReadingSet objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + BillingReadingSet: List[BillingReadingSet] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class CustomerAccountList(SubscribableList): + """ + A List element to hold CustomerAccount objects. + + :ivar CustomerAccount: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + CustomerAccount: List[CustomerAccount] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class CustomerAgreementList(SubscribableList): + """ + A List element to hold CustomerAgreement objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + CustomerAgreement: List[CustomerAgreement] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class DERList(List_type): + """ + A List element to hold DER objects. + + :ivar DER: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DER: List[DER] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class DERProgramList(SubscribableList): + """ + A List element to hold DERProgram objects. + + :ivar DERProgram: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DERProgram: List[DERProgram] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class DemandResponseProgramList(SubscribableList): + """ + A List element to hold DemandResponseProgram objects. + + :ivar DemandResponseProgram: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DemandResponseProgram: List[DemandResponseProgram] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class DeviceCapability(FunctionSetAssignmentsBase): + """ + Returned by the URI provided by DNS-SD, to allow clients to find the URIs + to the resources in which they are interested. + + :ivar EndDeviceListLink: + :ivar MirrorUsagePointListLink: + :ivar SelfDeviceLink: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + EndDeviceListLink: Optional[EndDeviceListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + MirrorUsagePointListLink: Optional[MirrorUsagePointListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + SelfDeviceLink: Optional[SelfDeviceLink] = field(default=None, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class EndDevice(AbstractDevice): + """Asset container that performs one or more end device functions. + + Contains information about individual devices in the network. + + :ivar changedTime: The time at which this resource was last modified + or created. + :ivar enabled: This attribute indicates whether or not an EndDevice + is enabled, or registered, on the server. If a server sets this + attribute to false, the device is no longer registered. It + should be noted that servers can delete EndDevice instances, but + using this attribute for some time is more convenient for + clients. + :ivar FlowReservationRequestListLink: + :ivar FlowReservationResponseListLink: + :ivar FunctionSetAssignmentsListLink: + :ivar postRate: POST rate, or how often EndDevice and subordinate + resources should be POSTed, in seconds. A client MAY indicate a + preferred postRate when POSTing EndDevice. A server MAY add or + modify postRate to indicate its preferred posting rate. + :ivar RegistrationLink: + :ivar SubscriptionListLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + changedTime: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + enabled: Optional[bool] = field(default=None, metadata={ + 'type': 'Element', + }) + FlowReservationRequestListLink: Optional[FlowReservationRequestListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + FlowReservationResponseListLink: Optional[FlowReservationResponseListLink] = field( + default=None, metadata={ + 'type': 'Element', + }) + FunctionSetAssignmentsListLink: Optional[FunctionSetAssignmentsListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + postRate: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + RegistrationLink: Optional[RegistrationLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + SubscriptionListLink: Optional[SubscriptionListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class FlowReservationResponse(Event): + """ + The server may modify the charging or discharging parameters and interval + to provide a lower aggregated demand at the premises, or within a larger + part of the distribution system. + + :ivar energyAvailable: Indicates the amount of energy available. + :ivar powerAvailable: Indicates the amount of power available. + :ivar subject: The subject field provides a method to match the + response with the originating event. It is populated with the + mRID of the corresponding FlowReservationRequest object. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + energyAvailable: Optional[SignedRealEnergy] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + powerAvailable: Optional[ActivePower] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + subject: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + + +@dataclass +class FunctionSetAssignments(FunctionSetAssignmentsBase): + """ + Provides an identifiable, subscribable collection of resources for a + particular device to consume. + + :ivar mRID: The global identifier of the object. + :ivar description: The description is a human readable text + describing or naming the object. + :ivar version: Contains the version number of the object. See the + type definition for details. + :ivar subscribable: Indicates whether or not subscriptions are + supported for this resource, and whether or not conditional + (thresholds) are supported. If not specified, is "not + subscribable" (0). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + mRID: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 16, + 'format': 'base16', + }) + description: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 32, + }) + version: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + subscribable: int = field(default=0, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class HistoricalReading(BillingMeterReadingBase): + """To be used to present readings that have been processed and possibly + corrected (as allowed, due to missing or incorrect data) by backend + systems. + + This includes quality codes valid, verified, estimated, and derived + / corrected. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class IPAddrList(List_type): + """ + List of IPAddr instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + IPAddr: List[IPAddr] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class IPInterfaceList(List_type): + """ + List of IPInterface instances. + + :ivar IPInterface: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + IPInterface: List[IPInterface] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class LLInterface(Resource): + """ + A link-layer interface object. + + :ivar CRCerrors: Contains the number of CRC errors since reset. + :ivar EUI64: Contains the EUI-64 of the link layer interface. 48 bit + MAC addresses SHALL be changed into an EUI-64 using the method + defined in [RFC 4291], Appendix A. (The method is to insert + "0xFFFE" as described in the reference.) + :ivar IEEE_802_15_4: + :ivar linkLayerType: Specifies the type of link layer interface + associated with the IPInterface. Values are below. 0 = + Unspecified 1 = IEEE 802.3 (Ethernet) 2 = IEEE 802.11 (WLAN) 3 = + IEEE 802.15 (PAN) 4 = IEEE 1901 (PLC) All other values reserved. + :ivar LLAckNotRx: Number of times an ACK was not received for a + frame transmitted (when ACK was requested). + :ivar LLCSMAFail: Number of times CSMA failed. + :ivar LLFramesDropRx: Number of dropped receive frames. + :ivar LLFramesDropTx: Number of dropped transmit frames. + :ivar LLFramesRx: Number of link layer frames received. + :ivar LLFramesTx: Number of link layer frames transmitted. + :ivar LLMediaAccessFail: Number of times access to media failed. + :ivar LLOctetsRx: Number of Bytes received. + :ivar LLOctetsTx: Number of Bytes transmitted. + :ivar LLRetryCount: Number of MAC transmit retries. + :ivar LLSecurityErrorRx: Number of receive security errors. + :ivar loWPAN: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + CRCerrors: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + EUI64: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 8, + 'format': 'base16', + }) + IEEE_802_15_4: Optional[IEEE_802_15_4] = field(default=None, metadata={ + 'type': 'Element', + }) + linkLayerType: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + LLAckNotRx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLCSMAFail: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLFramesDropRx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLFramesDropTx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLFramesRx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLFramesTx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLMediaAccessFail: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLOctetsRx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLOctetsTx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLRetryCount: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + LLSecurityErrorRx: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + loWPAN: Optional[loWPAN] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class MessagingProgramList(SubscribableList): + """ + A List element to hold MessagingProgram objects. + + :ivar MessagingProgram: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + MessagingProgram: List[MessagingProgram] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class MeterReadingList(SubscribableList): + """ + A List element to hold MeterReading objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + MeterReading: List[MeterReading] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class MirrorMeterReading(MeterReadingBase): + """ + Mimic of MeterReading used for managing mirrors. + + :ivar lastUpdateTime: The date and time of the last update. + :ivar MirrorReadingSet: + :ivar nextUpdateTime: The date and time of the next planned update. + :ivar Reading: + :ivar ReadingType: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + lastUpdateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + MirrorReadingSet: List[MirrorReadingSet] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + nextUpdateTime: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + Reading: Optional[Reading] = field(default=None, metadata={ + 'type': 'Element', + }) + ReadingType: Optional[ReadingType] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class Prepayment(IdentifiedObject): + """ + Prepayment (inherited from CIM SDPAccountingFunction) + + :ivar AccountBalanceLink: + :ivar ActiveCreditRegisterListLink: + :ivar ActiveSupplyInterruptionOverrideListLink: + :ivar creditExpiryLevel: CreditExpiryLevel is the set point for + availableCredit at which the service level may be changed. The + typical value for this attribute is 0, regardless of whether the + account balance is measured in a monetary or commodity basis. + The units for this attribute SHALL match the units used for + availableCredit. + :ivar CreditRegisterListLink: + :ivar lowCreditWarningLevel: LowCreditWarningLevel is the set point + for availableCredit at which the creditStatus attribute in the + AccountBalance resource SHALL indicate that available credit is + low. The units for this attribute SHALL match the units used for + availableCredit. Typically, this value is set by the service + provider. + :ivar lowEmergencyCreditWarningLevel: LowEmergencyCreditWarningLevel + is the set point for emergencyCredit at which the creditStatus + attribute in the AccountBalance resource SHALL indicate that + emergencycredit is low. The units for this attribute SHALL match + the units used for availableCredit. Typically, this value is set + by the service provider. + :ivar prepayMode: PrepayMode specifies whether the given Prepayment + instance is operating in Credit, Central Wallet, ESI, or Local + prepayment mode. The Credit mode indicates that prepayment is + not presently in effect. The other modes are described in the + Overview Section above. + :ivar PrepayOperationStatusLink: + :ivar SupplyInterruptionOverrideListLink: + :ivar UsagePoint: + :ivar UsagePointLink: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + AccountBalanceLink: Optional[AccountBalanceLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + ActiveCreditRegisterListLink: Optional[ActiveCreditRegisterListLink] = field(default=None, + metadata={ + 'type': + 'Element', + }) + ActiveSupplyInterruptionOverrideListLink: Optional[ + ActiveSupplyInterruptionOverrideListLink] = field(default=None, + metadata={ + 'type': 'Element', + }) + creditExpiryLevel: Optional[AccountingUnit] = field(default=None, + metadata={ + 'type': 'Element', + }) + CreditRegisterListLink: Optional[CreditRegisterListLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + lowCreditWarningLevel: Optional[AccountingUnit] = field(default=None, + metadata={ + 'type': 'Element', + }) + lowEmergencyCreditWarningLevel: Optional[AccountingUnit] = field(default=None, + metadata={ + 'type': 'Element', + }) + prepayMode: Optional[int] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + PrepayOperationStatusLink: Optional[PrepayOperationStatusLink] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + SupplyInterruptionOverrideListLink: Optional[SupplyInterruptionOverrideListLink] = field( + default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + UsagePoint: List[UsagePoint] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + UsagePointLink: Optional[UsagePointLink] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ProjectionReading(BillingMeterReadingBase): + """ + Contains values that forecast a future reading for the time or interval + specified. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class RPLInstanceList(List_type): + """ + List of RPLInstances associated with the IPinterface. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + RPLInstance: List[RPLInstance] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class RandomizableEvent(Event): + """ + An Event that can indicate time ranges over which the start time and + duration SHALL be randomized. + + :ivar randomizeDuration: Number of seconds boundary inside which a + random value must be selected to be applied to the associated + interval duration, to avoid sudden synchronized demand changes. + If related to price level changes, sign may be ignored. Valid + range is -3600 to 3600. If not specified, 0 is the default. + :ivar randomizeStart: Number of seconds boundary inside which a + random value must be selected to be applied to the associated + interval start time, to avoid sudden synchronized demand + changes. If related to price level changes, sign may be ignored. + Valid range is -3600 to 3600. If not specified, 0 is the + default. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + randomizeDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + randomizeStart: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class RateComponentList(List_type): + """ + A List element to hold RateComponent objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + RateComponent: List[RateComponent] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class ReadingSetList(SubscribableList): + """ + A List element to hold ReadingSet objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ReadingSet: List[ReadingSet] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class ResponseSetList(List_type): + """ + A List element to hold ResponseSet objects. + + :ivar ResponseSet: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ResponseSet: List[ResponseSet] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class SelfDevice(AbstractDevice): + """ + The EndDevice providing the resources available within the + DeviceCapabilities. + + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class TargetReading(BillingMeterReadingBase): + """ + Contains readings that specify a target or goal, such as a consumption + target, to which billing incentives or other contractual ramifications may + be associated. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + +@dataclass +class TariffProfileList(SubscribableList): + """ + A List element to hold TariffProfile objects. + + :ivar TariffProfile: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + TariffProfile: List[TariffProfile] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class TextMessage(Event): + """ + Text message such as a notification. + + :ivar originator: Indicates the human-readable name of the publisher + of the message + :ivar priority: The priority is used to inform the client of the + priority of the particular message. Devices with constrained or + limited resources for displaying Messages should use this + attribute to determine how to handle displaying currently active + Messages (e.g. if a device uses a scrolling method with a single + Message viewable at a time it MAY want to push a low priority + Message to the background and bring a newly received higher + priority Message to the foreground). + :ivar textMessage: The textMessage attribute contains the actual + UTF-8 encoded text to be displayed in conjunction with the + messageLength attribute which contains the overall length of the + textMessage attribute. Clients and servers SHALL support a + reception of a Message of 100 bytes in length. Messages that + exceed the clients display size will be left to the client to + choose what method to handle the message (truncation, scrolling, + etc.). + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + originator: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 20, + }) + priority: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + textMessage: Optional[str] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class UsagePointList(SubscribableList): + """ + A List element to hold UsagePoint objects. + + :ivar UsagePoint: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + UsagePoint: List[UsagePoint] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class DERControl(RandomizableEvent): + """ + Distributed Energy Resource (DER) time/event-based control. + + :ivar DERControlBase: + :ivar deviceCategory: Specifies the bitmap indicating the + categories of devices that SHOULD respond. Devices SHOULD ignore + events that do not indicate their device category. If not + present, all devices SHOULD respond. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DERControlBase: Optional[DERControlBase] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + deviceCategory: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'max_length': 4, + 'format': 'base16', + }) + + +@dataclass +class EndDeviceControl(RandomizableEvent): + """ + Instructs an EndDevice to perform a specified action. + + :ivar ApplianceLoadReduction: + :ivar deviceCategory: Specifies the bitmap indicating the + categories of devices that SHOULD respond. Devices SHOULD ignore + events that do not indicate their device category. + :ivar drProgramMandatory: A flag to indicate if the EndDeviceControl + is considered a mandatory event as defined by the service + provider issuing the EndDeviceControl. The drProgramMandatory + flag alerts the client/user that they will be subject to penalty + or ineligibility based on the service provider’s program rules + for that deviceCategory. + :ivar DutyCycle: + :ivar loadShiftForward: Indicates that the event intends to increase + consumption. A value of true indicates the intention to increase + usage value, and a value of false indicates the intention to + decrease usage. + :ivar Offset: + :ivar overrideDuration: The overrideDuration attribute provides a + duration, in seconds, for which a client device is allowed to + override this EndDeviceControl and still meet the contractual + agreement with a service provider without opting out. If + overrideDuration is not specified, then it SHALL default to 0. + :ivar SetPoint: + :ivar TargetReduction: + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ApplianceLoadReduction: Optional[ApplianceLoadReduction] = field(default=None, + metadata={ + 'type': 'Element', + }) + deviceCategory: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 4, + 'format': 'base16', + }) + drProgramMandatory: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + DutyCycle: Optional[DutyCycle] = field(default=None, metadata={ + 'type': 'Element', + }) + loadShiftForward: Optional[bool] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + }) + Offset: Optional[Offset] = field(default=None, metadata={ + 'type': 'Element', + }) + overrideDuration: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + SetPoint: Optional[SetPoint] = field(default=None, metadata={ + 'type': 'Element', + }) + TargetReduction: Optional[TargetReduction] = field(default=None, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class EndDeviceList(SubscribableList): + """ + A List element to hold EndDevice objects. + + :ivar EndDevice: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + EndDevice: List[EndDevice] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class FlowReservationResponseList(SubscribableList): + """ + A List element to hold FlowReservationResponse objects. + + :ivar FlowReservationResponse: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + FlowReservationResponse: List[FlowReservationResponse] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class FunctionSetAssignmentsList(SubscribableList): + """ + A List element to hold FunctionSetAssignments objects. + + :ivar FunctionSetAssignments: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + FunctionSetAssignments: List[FunctionSetAssignments] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class HistoricalReadingList(List_type): + """ + A List element to hold HistoricalReading objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + HistoricalReading: List[HistoricalReading] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class LLInterfaceList(List_type): + """ + List of LLInterface instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + LLInterface: List[LLInterface] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class MirrorMeterReadingList(List_type): + """ + A List of MirrorMeterReading instances. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + MirrorMeterReading: List[MirrorMeterReading] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class MirrorUsagePoint(UsagePointBase): + """ + A parallel to UsagePoint to support mirroring. + + :ivar deviceLFDI: The LFDI of the device being mirrored. + :ivar MirrorMeterReading: + :ivar postRate: POST rate, or how often mirrored data should be + POSTed, in seconds. A client MAY indicate a preferred postRate + when POSTing MirrorUsagePoint. A server MAY add or modify + postRate to indicate its preferred posting rate. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + deviceLFDI: Optional[bytes] = field(default=None, + metadata={ + 'type': 'Element', + 'required': True, + 'max_length': 20, + 'format': 'base16', + }) + MirrorMeterReading: List[MirrorMeterReading] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + postRate: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + }) + + +@dataclass +class PrepaymentList(SubscribableList): + """ + A List element to hold Prepayment objects. + + :ivar Prepayment: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + Prepayment: List[Prepayment] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class ProjectionReadingList(List_type): + """ + A List element to hold ProjectionReading objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ProjectionReading: List[ProjectionReading] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class TargetReadingList(List_type): + """ + A List element to hold TargetReading objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + TargetReading: List[TargetReading] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class TextMessageList(SubscribableList): + """ + A List element to hold TextMessage objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + TextMessage: List[TextMessage] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class TimeTariffInterval(RandomizableEvent): + """ + Describes the time-differentiated portion of the RateComponent, if + applicable, and provides the ability to specify multiple time intervals, + each with its own consumption-based components and other attributes. + + :ivar ConsumptionTariffIntervalListLink: + :ivar touTier: Indicates the time of use tier related to the + reading. If not specified, is assumed to be "0 - N/A". + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + ConsumptionTariffIntervalListLink: Optional[ConsumptionTariffIntervalListLink] = field( + default=None, metadata={ + 'type': 'Element', + }) + touTier: Optional[int] = field(default=None, metadata={ + 'type': 'Element', + 'required': True, + }) + + +@dataclass +class DERControlList(SubscribableList): + """ + A List element to hold DERControl objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + DERControl: List[DERControl] = field(default_factory=list, metadata={ + 'type': 'Element', + }) + + +@dataclass +class EndDeviceControlList(SubscribableList): + """ + A List element to hold EndDeviceControl objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + EndDeviceControl: List[EndDeviceControl] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + + +@dataclass +class MirrorUsagePointList(List_type): + """ + A List of MirrorUsagePoint instances. + + :ivar MirrorUsagePoint: + :ivar pollRate: The default polling rate for this function set (this + resource and all resources below), in seconds. If not specified, + a default of 900 seconds (15 minutes) is used. It is RECOMMENDED + a client poll the resources of this function set every pollRate + seconds. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + MirrorUsagePoint: List[MirrorUsagePoint] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) + pollRate: int = field(default=900, metadata={ + 'type': 'Attribute', + }) + + +@dataclass +class TimeTariffIntervalList(SubscribableList): + """ + A List element to hold TimeTariffInterval objects. + """ + + class Meta: + namespace = 'urn:ieee:std:2030.5:ns' + + TimeTariffInterval: List[TimeTariffInterval] = field(default_factory=list, + metadata={ + 'type': 'Element', + }) diff --git a/services/core/IEEE_2030_5/ieee_2030_5/utils.py b/services/core/IEEE_2030_5/ieee_2030_5/utils.py new file mode 100644 index 0000000000..4fd1a9dfb2 --- /dev/null +++ b/services/core/IEEE_2030_5/ieee_2030_5/utils.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} +def is_binary(binary: str) -> bool: + return all([c in '01' for c in str(binary)]) + + +def is_hex(hex: str) -> bool: + return all([c in '0123456789ABCDEFabcdef' for c in hex]) + + +def binary_to_binary_hex(binary: str) -> str: + return hex(int(binary, 2))[2:] + + +def decimal_to_binary_hex(decimal: int) -> str: + return hex(int(decimal))[2:] diff --git a/services/core/IEEE_2030_5/inverter_sample.csv b/services/core/IEEE_2030_5/inverter_sample.csv new file mode 100644 index 0000000000..cf98438b52 --- /dev/null +++ b/services/core/IEEE_2030_5/inverter_sample.csv @@ -0,0 +1,66 @@ +Point Name,Description,Multiplier,MRID,Offset,Parameter Type,Notes +,,,,,DERCapability::rtgMaxW,DERCapabilities are not generally writable but the corresponding setting is. +,,,,,DERCapability::rtgOverExcitedW, +,,,,,DERCapability::rtgOverExcitedPF, +,,,,,DERCapability::rtgUnderExcitedW, +,,,,,DERCapability::rtgUnderExcitedPF, +,,,,,DERCapability::rtgMaxVA, +,,,,,DERCapability::rtgNormalCategory, +,,,,,DERCapability::rtgAbnormalCategory, +,,,,,DERCapability::rtgMaxVar, +,,,,,DERCapability::rtgMaxVarNeg, +,,,,,DERCapability::rtgMaxChargeRateW, +,,,,,DERCapability::rtgMaxChargeRateVA, +,,,,,DERCapability::rtgVNom, +,,,,,DERCapability::rtgMaxV, +,,,,,DERCapability::rtgMinV, +,,,,,DERCapability::modesSupported, +,,,,,DERCapability::rtgReactiveSusceptance, +,,,,,DERStatus::alarmStatus,"Bitmap Position (0 = over current, 1 over voltage, 2 under voltage, 3 over frequency, 4 under frequency, 5 voltage imbalance, 6 current imbalance, 7 emergency local, 8 emergency remote, 9 low power input, 10 phase rotation)" +,,,,,DERStatus::genConnectStatus,"DER Generator Status (0 = Connected, 1 = Available, 2 = Operating, 3 = Test, 4 = Fault/Error)" +,,,,,DERStatus::inverterStatus,"DER Inverter Status (0 = Connected, 1 = Available, 2 = Operating, 3 = Test, 4 = Fault/Error)" +,,,,,DERStatus::localControlModeStatus,0 = local control 1 = remote control +,,,,,DERStatus::manufacturerStatus,A manufacturer status code string +,,,,,DERStatus::operationalModeStatus,"DER OperationalModeStatus (0 = Not applicable, 1 = Off, 2 = Operational, 3 = Test)" +BAT_SOC,,,,,DERStatus::stateOfChargeStatus,DER StateOfChargeStatus % of charge +,,,,,DERStatus::storageModeStatus,"DER StorageModeStatus (0 = Charging, 1 = Discharging, 2 = Holding)" +,,,,,DERStatus::storConnectStatus,"DER Storage Status (0 = Connected, 1 = Available, 2 = Operating, 3 = Test, 4 = Fault/Error)" +,,,,,DERSettings::setESHighVolt, +,,,,,DERSettings::setESLowVolt, +,,,,,DERSettings::setESHighFreq, +,,,,,DERSettings::setESLowFreq, +,,,,,DERSettings::setESDelay, +,,,,,DERSettings::setESRandomDelay, +,,,,,DERSettings::setESRampTms, +ctrl_es_delay,,,,,DefaultDERControl::setESDelay, +ctrl_freq_max,,,,,DefaultDERControl::setESHighFreq, +ctrl_volt_max,,,,,DefaultDERControl::setESHighVolt, +ctrl_freq_min,,,,,DefaultDERControl::setESLowFreq, +ctrl_volt_min,,,,,DefaultDERControl::setESLowVolt, +ctrl_ramp_tms,,,,,DefaultDERControl::setESRampTms, +ctrl_rand_delay,,,,,DefaultDERControl::setESRandomDelay, +ctrl_grad_w,,,,,DefaultDERControl::setGradW, +ctrl_soft_grad_w,,,,,DefaultDERControl::setSoftGradW, +ctrl_connected,,,,,DERControlBase::opModConnect,"True/False Connected = True, Disconnected = False" +ctrl_energized,,,,,DERControlBase::opModEnergize,"True/False Energized = True, De-Energized = False" +ctrl_fixed_pf_absorb_w,,,,,DERControlBase::opModFixedPFAbsorbW, +ctrl_fixed_pf_ingect_w,,,,,DERControlBase::opModFixedPFInjectW, +ctrl_fixed_var,,,,,DERControlBase::opModFixedVar, +ctrl_fixed_w,,,,,DERControlBase::opModFixedW, +ctrl_freq_droop,,,,,DERControlBase::opModFreqDroop, +ctrl_freq_w,,,,,DERControlBase::opModFreqWatt, +,,,,,DERControlBase::opModHFRTMayTrip, +,,,,,DERControlBase::opModHFRTMustTrip, +,,,,,DERControlBase::opModHVRTMomentaryCessation, +,,,,,DERControlBase::opModHVRTMustTrip, +,,,,,DERControlBase::opModLFRTMayTrip, +,,,,,DERControlBase::opModLVRTMomentaryCessation, +,,,,,DERControlBase::opModLVRTMustTrip, +ctrl_max_w,,,,,DERControlBase::opModMaxLimW, +ctrl_target_var,,,,,DERControlBase::opModTargetVar, +ctrl_target_w,Target Real Power,,,,DERControlBase::opModTargetW, +,,,,,DERControlBase::opModVoltVar, +,,,,,DERControlBase:opModVoltWatt, +,,,,,DERControlBase::opModWattPF, +,,,,,DERControlBase::opModWattVar, +,,,,,DERControlBase::rampTms, diff --git a/services/core/IEEE_2030_5/requirements.txt b/services/core/IEEE_2030_5/requirements.txt new file mode 100644 index 0000000000..22e8585248 --- /dev/null +++ b/services/core/IEEE_2030_5/requirements.txt @@ -0,0 +1,2 @@ +xsdata>=23.8 +blinker diff --git a/services/core/IEEE_2030_5/requirements_demo.txt b/services/core/IEEE_2030_5/requirements_demo.txt new file mode 100644 index 0000000000..cf84bba01d --- /dev/null +++ b/services/core/IEEE_2030_5/requirements_demo.txt @@ -0,0 +1,4 @@ +nicegui +requests +xsdata>=23.8 +blinker diff --git a/services/core/IEEE_2030_5/setup.py b/services/core/IEEE_2030_5/setup.py new file mode 100644 index 0000000000..d038299030 --- /dev/null +++ b/services/core/IEEE_2030_5/setup.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- {{{ +# ===----------------------------------------------------------------------=== +# +# Component of Eclipse VOLTTRON +# +# ===----------------------------------------------------------------------=== +# +# Copyright 2023 Battelle Memorial Institute +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# ===----------------------------------------------------------------------=== +# }}} + +from os import path + +from setuptools import find_packages, setup + +MAIN_MODULE = 'agent' + +# Find the agent package that contains the main module +packages = find_packages('.') +agent_package = '' +for package in find_packages(): + # Because there could be other packages such as tests + if path.isfile(package + '/' + MAIN_MODULE + '.py') is True: + agent_package = package +if not agent_package: + raise RuntimeError('None of the packages under {dir} contain the file ' + '{main_module}'.format(main_module=MAIN_MODULE + '.py', + dir=path.abspath('.'))) + +# Find the version number from the main module +agent_module = agent_package + '.' + MAIN_MODULE +_temp = __import__(agent_module, globals(), locals(), ['__version__'], 0) +__version__ = _temp.__version__ + +# Setup +setup(name=agent_package + 'agent', + version=__version__, + install_requires=['volttron'], + packages=packages, + entry_points={'setuptools.installation': [ + 'eggsecutable = ' + agent_module + ':main', + ]}) diff --git a/services/core/IEEE_2030_5/tests/fixtures/test_config.yml b/services/core/IEEE_2030_5/tests/fixtures/test_config.yml new file mode 100644 index 0000000000..cb6f5c4689 --- /dev/null +++ b/services/core/IEEE_2030_5/tests/fixtures/test_config.yml @@ -0,0 +1,84 @@ +# required parameters +cacertfile: ~/tls/certs/ca.crt +keyfile: ~/tls/private/dev1.pem +certfile: ~/tls/certs/dev1.crt +server_hostname: 127.0.0.1 +# the pin number is used to verify the server is the correct server +pin: 111115 + +# Log the request and responses from the server. +log_req_resp: true + +# SSL defaults to 443 +server_ssl_port: 8443 +# http port defaults to none +#server_http_port: 8080 + +MirrorUsagePointList: + # MirrorMeterReading based on Table E.2 IEEE Std 2030.5-18 + # note the mRID in the MirrorMeterReading is the same that is in the + # MirrorUsagePoint. + - subscription_point: p_ac + mRID: 5509D69F8B3535950000000000009182 + description: DER Inverter Real Power + roleFlags: 49 + serviceCategoryKind: 0 + status: 0 + MirrorMeterReading: + mRID: 5509D69F8B3535950000000000009182 + description: Real Power(W) Set + ReadingType: + accumulationBehavior: 12 + commodity: 1 + dataQualifier: 2 + intervalLength: 300 + powerOfTenMultiplier: 0 + uom: 38 + - subscription_point: q_ac + mRID: 5509D69F8B3535950000000000009184 + description: DER Inverter Reactive Power + roleFlags: 49 + serviceCategoryKind: 0 + status: 0 + MirrorMeterReading: + mRID: 5509D69F8B3535950000000000009184 + description: Reactive Power(VAr) Set + ReadingType: + accumulationBehavior: 12 + commodity: 1 + dataQualifier: 2 + intervalLength: 300 + powerOfTenMultiplier: 0 + uom: 38 + +# publishes on the following subscriptions will +# be available to create and POST readings to the +# 2030.5 server. +subscriptions: + - devices/inverter1/all + +# Nameplate ratings for this der client will be put to the +# server during startup of the system. +DERCapability: + # modesSupported is a HexBinary31 representation of DERControlType + # See Figure B.34 DER info types for information + # conversion in python is as follows + # "{0:08b}".format(int("500040", 16)) + # '10100000000000001000000' # This is a bitmask + # to generate HexBinary + # hex(int('10100000000000001000000', 2)) + # 0x500040 + modesSupported: 500040 + rtgMaxW: + multiplier: 0 + value: 0 + type: 0 + +DERSettings: + modesEnabled: 100000 + setGradW: 0 + setMaxW: + multiplier: 0 + value: 0 + +point_map: config:///inverter_sample.csv \ No newline at end of file diff --git a/services/core/IEEE_2030_5/tests/fixtures/test_inverter.csv b/services/core/IEEE_2030_5/tests/fixtures/test_inverter.csv new file mode 100644 index 0000000000..34ce513301 --- /dev/null +++ b/services/core/IEEE_2030_5/tests/fixtures/test_inverter.csv @@ -0,0 +1,8 @@ +Point Name,Description,Multiplier,MRID,Writeable,Parameter Type,Notes +INV_REAL_PWR,Inverter Real Power,,,,ActivePower,2030.5 is in Watts +INV_REAC_PWR,Inverter Reactive Power,,,,ReactivePower,2030.5 is in vars +BESS_SETOP_REQ,Energy Storage Set Point,,,True,, +INV_OPER_STATE,Inverter Operating State,,,True,DERControlBase::opModFixedW, +INV_REAL_PWR_REQ,Power Request Topic,,,,ActivePower, +BAT_SOC,,,,True,DERStatus::stateOfChargeStatus, +target_p,Target Real Power,,,True,DERControlBase::opModTargetW, diff --git a/services/core/IEEE_2030_5/tests/get_dcap.py b/services/core/IEEE_2030_5/tests/get_dcap.py new file mode 100644 index 0000000000..d9ebdd8dd8 --- /dev/null +++ b/services/core/IEEE_2030_5/tests/get_dcap.py @@ -0,0 +1,202 @@ +from datetime import datetime +import sys +import os +import time +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from dataclasses import asdict +from pprint import pprint +import urllib3 +from request_session import get_as_admin, get_as_device, post_as_admin, post_as_device +import ieee_2030_5.models as m +from ieee_2030_5 import dataclass_to_xml, xml_to_dataclass +urllib3.disable_warnings() + +def print_it(thing: str, obj: object): + print(f"{'='*20} {thing} {'='*20}") + try: + pprint(asdict(obj), indent=4) + except TypeError: + print(f'Type: {type(obj)} was passed and cannot be printed!') + +dcap: m.DeviceCapability = get_as_device('dcap') +print_it('DeviceCapability', dcap) + +tm: m.Time = get_as_device(dcap.TimeLink.href) +print_it('Time', tm) + +edevl: m.EndDeviceList = get_as_device('edev') +print_it('EndDeviceList', edevl) +edev = edevl.EndDevice[0] +print(edev.LogEventListLink.href) + +derl = get_as_device(edev.DERListLink.href) +print_it('DERList', derl) + +der: m.DER = derl.DER[0] +current_program = get_as_device(der.CurrentDERProgramLink.href) +print_it('CurrentDERProgram', current_program) + +config: m.Configuration = get_as_device(edev.ConfigurationLink.href) +print_it('Configuration', config) + +info: m.DeviceInformation = get_as_device(edev.DeviceInformationLink.href) +print_it('DeviceInformation', info) + +status: m.DeviceStatus = get_as_device(edev.DeviceStatusLink.href) +print_it('DeviceStatus', status) + +fsal: m.FunctionSetAssignmentsList = get_as_device(edev.FunctionSetAssignmentsListLink.href) +print_it('FunctionSetAssignmentsList', fsal) +derpl: m.DERProgramList = get_as_device(fsal.FunctionSetAssignments[0].DERProgramListLink.href) +print_it('DERProgramList', derpl) + +derp: m.DERProgram = derpl.DERProgram[0] +derca = get_as_device(derp.ActiveDERControlListLink.href) +print_it('ActiveDERControlList', derca) + + +dderc: m.DefaultDERControl = get_as_device(derp.DefaultDERControlLink.href) +print_it('DefaultDERControl', dderc) + + +dercl: m.DERControlList = get_as_device(derp.DERControlListLink.href) +print_it('DERControlList', dercl) + +# No curves yet +#curvel = get_as_device(derp.DERCurveListLink.href) +#print_it("DERCurveList", curvel) + +mup = m.MirrorUsagePoint() +mup.description = 'Test Mirror Usage Point' +mup.deviceLFDI = edev.lFDI +mup.mRID = '5509D69F8B3535950000000000009182' +mup.serviceCategoryKind = 0 +mup.roleFlags = 49 + +mmr = m.MirrorMeterReading() +mmr.description = 'Real Power(W) Set' +mmr.mRID = '5509D69F8B3535950000000000009182' + +mrt = m.ReadingType() +mrt.accumulationBehaviour = 12 +mrt.commodity = 1 +mrt.intervalLength = 300 +mrt.powerOfTenMultiplier = 0 +mrt.uom = 38 +mmr.ReadingType = mrt +mup.MirrorMeterReading.append(mmr) + +# Expect +resp = post_as_device('mup', data=dataclass_to_xml(mup)) + +new_mup = get_as_device(resp.headers['Location']) + +print_it('New Mirror Usage Point', new_mup) +print('\n\n') +input('Press Enter to continue...') +#while True: +current_time = int(time.mktime(datetime.utcnow().timetuple())) +print(f'Time is: {current_time}') +new_ctrl = m.DERControl(mRID='b234245afff', DERControlBase=dderc.DERControlBase, description='A new control is going here') +new_ctrl.interval = m.DateTimeInterval(start=current_time + 5, duration=10) +response = post_as_admin(dercl.href, data=dataclass_to_xml(new_ctrl)) + +ctrl_evnt = get_as_device(response.headers['Location']) +print_it('DERControl', ctrl_evnt) + +ctrll = get_as_device(derp.DERControlListLink.href) +print_it('DERControl List', ctrll) + +activel = get_as_device(derp.ActiveDERControlListLink.href) +print_it('ActiveDERControl', activel) + +print('Waiting for activation of control on server...') +print(print(f"{'='*20} Sleeping 6 s {'='*20}")) +time.sleep(6) + +activel = get_as_device(derp.ActiveDERControlListLink.href) +print_it('ActiveDERControl', activel) + +print('Waiting for deactivation of control on server...') +print(print(f"{'='*20} Sleeping 20 s {'='*20}")) +time.sleep(20) + +activel = get_as_device(derp.ActiveDERControlListLink.href) +print_it('ActiveDERControl', activel) + +# ctrl_str = """ +# +# Control 1 +# {'opModConnect': True, 'opModMaxLimW': 9500} +# +# +# Control 2 +# {'opModConnect': True, 'opModFixedW': 80} +# +# +# 94E46E50F4964762B94E6C24AA350CA2 +# +# 60 +# 1696592892 +# +# +# true +# 9500 +# +# +# """ + + + + +# def _change_power_factor(new_pf): +# global inverter_pf + +# current_time = int(time.mktime(datetime.utcnow().timetuple())) + +# ctrl_base = m.DERControlBase(opModConnect=True, opModMaxLimW=9500) +# ctrl = m.DERControl(mRID="ctrl1mrdi", description="A control for the control list") +# ctrl.DERControlBase = ctrl_base +# ctrl.interval = m.DateTimeInterval(start=current_time + 10, duration=20) +# ctrl.randomizeDuration = 180 +# ctrl.randomizeStart = 180 +# ctrl.DERControlBase.opModFixedW = 500 +# ctrl.DERControlBase.opModFixedPFInjectW = m.PowerFactorWithExcitation( +# displacement=int(pf.value)) + +# posted = dataclass_to_xml(ctrl) +# _log.debug(f"POST\n{posted}") +# resp = session.post(get_url("derp/0/derc"), data=posted) +# # Post will have a response with the location of the DERControl +# der_control_uri = resp.headers.get('Location') +# _log.debug(f"GET\n{der_control_uri}") +# resp = session.get(der_control_uri, not_admin=True) +# _log.debug(f"{resp.text}") +# # pfingect: m.DERControl = resp.text) +# # inverter_pf = pfingect.DERControlBase.opModFixedPFInjectW.displacement +# # status.content = updated_markdown() + + +# def get_control_event_default(): +# derbase = m.DERControlBase(opModConnect=True, opModEnergize=False, opModFixedPFInjectW=80) + +# time_plus_10 = int(time.mktime((datetime.utcnow() + timedelta(seconds=60)).timetuple())) + +# derc = m.DERControl(mRID=str(uuid.uuid4()), +# description="New DER Control Event", +# DERControlBase=derbase, +# interval=m.DateTimeInterval(duration=10, start=time_plus_10)) + +# return dataclass_to_xml(derc) + + +# def _setup_event(element): +# derbase = m.DERControlBase(opModConnect=True, opModEnergize=False, opModFixedPFInjectW=80) + +# time_plus_60 = int(time.mktime((datetime.utcnow() + timedelta(seconds=60)).timetuple())) + +# derc = m.DERControl(mRID=str(uuid.uuid4()), +# description="New DER Control Event", +# DERControlBase=derbase, +# interval=m.DateTimeInterval(duration=10, start=time_plus_60)) +# element.value = dataclass_to_xml(derc) diff --git a/services/core/IEEE_2030_5/tests/new_event.py b/services/core/IEEE_2030_5/tests/new_event.py new file mode 100644 index 0000000000..2b9c35f16c --- /dev/null +++ b/services/core/IEEE_2030_5/tests/new_event.py @@ -0,0 +1,66 @@ +from datetime import datetime +import sys +import os +import time +import uuid +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from dataclasses import asdict +from pprint import pprint +import urllib3 +from request_session import get_as_admin, get_as_device, post_as_admin, post_as_device +import ieee_2030_5.models as m +from ieee_2030_5 import dataclass_to_xml, xml_to_dataclass +urllib3.disable_warnings() + +def print_it(thing: str, obj: object): + print(f"{'='*20} {thing} {'='*20}") + try: + pprint(asdict(obj), indent=4) + except TypeError: + print(f"Type: {type(obj)} was passed and cannot be printed!") + +dcap: m.DeviceCapability = get_as_device("dcap") +print_it("DeviceCapability", dcap) + +edevl: m.EndDeviceList = get_as_device("edev") +print_it("EndDeviceList", edevl) + +edev = edevl.EndDevice[0] +derl = get_as_device(edev.DERListLink.href) +print_it("DERList", derl) + +der: m.DER = derl.DER[0] +current_program: m.DERProgram = get_as_device(der.CurrentDERProgramLink.href) +print_it("CurrentDERProgram", current_program) + +dderc: m.DefaultDERControl = get_as_device(current_program.DefaultDERControlLink.href) +print_it("DefaultDERControl", dderc) + +dercl: m.DERControlList = get_as_device(current_program.DERControlListLink.href) +print_it("DERControlList", dercl) + +current_time = int(time.mktime(datetime.utcnow().timetuple())) +print(f"Time is: {current_time}") +mrid = str(uuid.uuid4()).replace('-', '') +new_ctrl = m.DERControl(mRID=mrid, DERControlBase=dderc.DERControlBase, description="A new control is going here") +new_ctrl.interval = m.DateTimeInterval(start=current_time + 5, duration=30) +new_ctrl.DERControlBase.opModTargetW = m.ActivePower(3, 2000) +print_it("New Control is", new_ctrl) +print(f"{dataclass_to_xml(new_ctrl)}") +response = post_as_admin(dercl.href, data=dataclass_to_xml(new_ctrl)) + +print("Right before controls start") +dercl: m.DERControlList = get_as_device(current_program.DERControlListLink.href) +print_it("DERControlList", dercl) +activectl: m.DERControlList = get_as_device(current_program.ActiveDERControlListLink.href) +print("Should not have an active control.") +print_it("ActiveDERControlList", activectl) +print("Sleeping 10 seconds until control has started") +time.sleep(10) +activectl: m.DERControlList = get_as_device(current_program.ActiveDERControlListLink.href) +print("Active control should have started!") +print_it("ActiveDERControlList", activectl) +time.sleep(35) +activectl: m.DERControlList = get_as_device(current_program.ActiveDERControlListLink.href) +print("Event should be over now") +print_it("ActiveDERControlList", activectl) \ No newline at end of file diff --git a/services/core/IEEE_2030_5/tests/request_session.py b/services/core/IEEE_2030_5/tests/request_session.py new file mode 100644 index 0000000000..67b29b8f2c --- /dev/null +++ b/services/core/IEEE_2030_5/tests/request_session.py @@ -0,0 +1,56 @@ +from pathlib import Path +from requests import Session +import yaml + +from ieee_2030_5 import xml_to_dataclass + +__test_config_file__ = Path(__file__).parent.joinpath("fixtures/test_config.yml") +__test_config_file_data__ = yaml.safe_load(__test_config_file__.open("rt").read()) + +__request_admin_session__ = Session() +__request_base_uri__ = f"https://{__test_config_file_data__['server_hostname']}:{__test_config_file_data__['server_ssl_port']}" +__tls_path__ = Path(__test_config_file_data__["certfile"]).expanduser().parent.parent +__request_admin_session__.cert = (__tls_path__.joinpath("certs/admin.crt"), __tls_path__.joinpath("private/admin.pem")) +__request_admin_session__.verify = Path(__test_config_file_data__["cacertfile"]).expanduser().as_posix() + +__request_device_session__ = Session() +__request_device_session__.cert = (__tls_path__.joinpath("certs/dev1.crt"), __tls_path__.joinpath("private/dev1.pem")) +__request_device_session__.verify = Path(__test_config_file_data__["cacertfile"]).expanduser().as_posix() + +def __admin_uri__(path: str): + path = path.replace("_", "/") + if path.startswith("/"): + path = path[1:] + return f"{__request_base_uri__}/admin/{path}" + +def __uri__(path: str): + if path.startswith("/"): + path = path[1:] + return f"{__request_base_uri__}/{path}" + +def post_as_admin(path, data): + print(f"POST: {__admin_uri__(path)}") + return __request_admin_session__.post(__admin_uri__(path), data=data) + +def post_as_device(path, data): + print(f"POST: {__uri__(path)}") + return __request_device_session__.post(__uri__(path), data=data) + + +def get_as_admin(path) -> str: + print(f"GET: {__uri__(path)}") + resp = __request_device_session__.get(__admin_uri__(path)) + + if resp.text: + return xml_to_dataclass(resp.text) + else: + resp + +def get_as_device(path) -> str: + print(f"GET: {__uri__(path)}") + resp = __request_device_session__.get(__uri__(path)) + + if resp.text: + return xml_to_dataclass(resp.text) + else: + resp \ No newline at end of file diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/__init__.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/__init__.py index 86e37efefe..bbecd2c773 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/__init__.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/__init__.py @@ -35,7 +35,6 @@ # BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY # under Contract DE-AC05-76RL01830 # }}} - """ ================== Driver Development @@ -167,9 +166,9 @@ """ - import abc import logging +from typing import List _log = logging.getLogger(__name__) @@ -203,35 +202,36 @@ class BaseRegister: publishing. When instantiating register instances be sure to provide a useful string for the units argument. """ - def __init__(self, register_type, read_only, pointName, units, description = ''): + + def __init__(self, register_type, read_only, pointName, units, description=''): self.read_only = read_only self.register_type = register_type self.point_name = pointName self.units = units self.description = description self.python_type = int - + def get_register_python_type(self): """ :return: The python type of the register. :rtype: type """ return self.python_type - + def get_register_type(self): """ :return: (register_type, read_only) :rtype: tuple """ return self.register_type, self.read_only - + def get_units(self): """ :return: Register units :rtype: str """ return self.units - + def get_description(self): """ :return: Register description @@ -250,23 +250,26 @@ class BaseInterface(object, metaclass=abc.ABCMeta): :param core: A reference to the parent driver agent's core subsystem. """ + def __init__(self, vip=None, core=None, **kwargs): # Object does not take any arguments to the init. super(BaseInterface, self).__init__() self.vip = vip self.core = core - + self.point_map = {} - + self.build_register_map() - + def build_register_map(self): - self.registers = {('byte',True):[], - ('byte',False):[], - ('bit',True):[], - ('bit',False):[]} - - @abc.abstractmethod + self.registers = { + ('byte', True): [], + ('byte', False): [], + ('bit', True): [], + ('bit', False): [] + } + + @abc.abstractmethod def configure(self, config_dict, registry_config_str): """ Configures the :py:class:`Interface` for the specific instance of a device. @@ -282,7 +285,7 @@ def configure(self, config_dict, registry_config_str): to the Interface with :py:meth:`BaseInterface.insert_register`. """ pass - + def get_register_by_name(self, name): """ Get a register by it's point name. @@ -295,8 +298,8 @@ def get_register_by_name(self, name): try: return self.point_map[name] except KeyError: - raise DriverInterfaceError("Point not configured on device: "+name) - + raise DriverInterfaceError("Point not configured on device: " + name) + def get_register_names(self): """ Get a list of register names. @@ -312,8 +315,8 @@ def get_register_names_view(self): :rtype: dictview """ return self.point_map.keys() - - def get_registers_by_type(self, reg_type, read_only): + + def get_registers_by_type(self, reg_type, read_only) -> List[BaseRegister]: """ Get a list of registers by type. Useful for an :py:class:`Interface` that needs to categorize registers by type when doing a scrape. @@ -325,8 +328,8 @@ def get_registers_by_type(self, reg_type, read_only): :return: An list of BaseRegister instances. :rtype: list """ - return self.registers[reg_type,read_only] - + return self.registers[reg_type, read_only] + def insert_register(self, register): """ Inserts a register into the :py:class:`Interface`. @@ -336,12 +339,12 @@ def insert_register(self, register): """ register_point = register.point_name self.point_map[register_point] = register - + register_type = register.get_register_type() - self.registers[register_type].append(register) - + self.registers[register_type].append(register) + @abc.abstractmethod - def get_point(self, point_name, **kwargs): + def get_point(self, point_name, **kwargs): """ Get the current value for the point name given. @@ -350,7 +353,7 @@ def get_point(self, point_name, **kwargs): :type point_name: str :return: Point value """ - + @abc.abstractmethod def set_point(self, point_name, value, **kwargs): """ @@ -369,8 +372,8 @@ def set_point(self, point_name, value, **kwargs): :type point_name: str :return: Actual point value set. """ - - @abc.abstractmethod + + @abc.abstractmethod def scrape_all(self): """ Method the Platform Driver Agent calls to get the current state @@ -379,16 +382,16 @@ def scrape_all(self): :return: Point names to values for device. :rtype: dict """ - - @abc.abstractmethod + + @abc.abstractmethod def revert_all(self, **kwargs): """ Revert entire device to it's default state :param kwargs: Any interface specific parameters. """ - - @abc.abstractmethod + + @abc.abstractmethod def revert_point(self, point_name, **kwargs): """ Revert point to it's default state. @@ -452,11 +455,12 @@ class RevertTracker: """ A helper class for tracking the state of writable points on a device. """ + def __init__(self): self.defaults = {} self.clean_values = {} self.dirty_points = set() - + def update_clean_values(self, points): """ Update all state of all the clean point values for a device. @@ -471,7 +475,7 @@ def update_clean_values(self, points): if k not in self.dirty_points and k not in self.defaults: clean_values[k] = v self.clean_values.update(clean_values) - + def set_default(self, point, value): """ Set the value to revert a point to. Overrides any clean value detected. @@ -481,7 +485,7 @@ def set_default(self, point, value): :type point: str """ self.defaults[point] = value - + def get_revert_value(self, point): """ Returns the clean value for a point if no default is set, otherwise returns @@ -498,9 +502,9 @@ def get_revert_value(self, point): return self.defaults[point] if point not in self.clean_values: raise DriverInterfaceError("Nothing to revert to for {}".format(point)) - + return self.clean_values[point] - + def clear_dirty_point(self, point): """ Clears the dirty flag on a point. @@ -509,7 +513,7 @@ def clear_dirty_point(self, point): :type point: str """ self.dirty_points.discard(point) - + def mark_dirty_point(self, point): """ Sets the dirty flag on a point. @@ -521,7 +525,7 @@ def mark_dirty_point(self, point): """ if point not in self.defaults: self.dirty_points.add(point) - + def get_all_revert_values(self): """ Returns a dict of points to revert values. @@ -543,7 +547,7 @@ def get_all_revert_values(self): results[point] = self.get_revert_value(point) except DriverInterfaceError: results[point] = DriverInterfaceError() - + return results @@ -573,13 +577,14 @@ class BasicRevert(object, metaclass=abc.ABCMeta): should be set in the :py:meth:`BaseInterface.configure` call. """ + def __init__(self, **kwargs): super(BasicRevert, self).__init__(**kwargs) self._tracker = RevertTracker() - + def _update_clean_values(self, points): self._tracker.update_clean_values(points) - + def set_default(self, point, value): """ Set the value to revert a point to. @@ -596,20 +601,20 @@ def set_point(self, point_name, value): Passes arguments through to :py:meth:`BasicRevert._set_point` """ - result = self._set_point(point_name, value) + result = self._set_point(point_name, value) self._tracker.mark_dirty_point(point_name) return result - + def scrape_all(self): """ Implementation of :py:meth:`BaseInterface.scrape_all` """ - result = self._scrape_all() + result = self._scrape_all() self._update_clean_values(result) return result - - @abc.abstractmethod + + @abc.abstractmethod def _set_point(self, point_name, value): """ Set the current value for the point name given. @@ -631,8 +636,8 @@ def _set_point(self, point_name, value): :type point_name: str :return: Actual point value set. """ - - @abc.abstractmethod + + @abc.abstractmethod def _scrape_all(self): """ Method the Platform Driver Agent calls to get the current state @@ -645,8 +650,7 @@ def _scrape_all(self): :return: Point names to values for device. :rtype: dict """ - - + def revert_all(self, **kwargs): """ Implementation of :py:meth:`BaseInterface.revert_all` @@ -685,8 +689,8 @@ def revert_point(self, point_name, **kwargs): value = self._tracker.get_revert_value(point_name) except DriverInterfaceError: return - + _log.debug("Reverting {} to {}".format(point_name, value)) - - self._set_point(point_name, value) + + self._set_point(point_name, value) self._tracker.clear_dirty_point(point_name) diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/fakedriver.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/fakedriver.py index cc4c51408b..42376d65b3 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/fakedriver.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/fakedriver.py @@ -36,7 +36,6 @@ # under Contract DE-AC05-76RL01830 # }}} - import random import datetime import math @@ -46,20 +45,21 @@ import logging _log = logging.getLogger(__name__) -type_mapping = {"string": str, - "int": int, - "integer": int, - "float": float, - "bool": bool, - "boolean": bool} +type_mapping = { + "string": str, + "int": int, + "integer": int, + "float": float, + "bool": bool, + "boolean": bool +} class FakeRegister(BaseRegister): - def __init__(self, read_only, pointName, units, reg_type, - default_value=None, description=''): + + def __init__(self, read_only, pointName, units, reg_type, default_value=None, description=''): # register_type, read_only, pointName, units, description = ''): - super(FakeRegister, self).__init__("byte", read_only, pointName, units, - description='') + super(FakeRegister, self).__init__("byte", read_only, pointName, units, description='') self.reg_type = reg_type if default_value is None: @@ -72,14 +72,13 @@ def __init__(self, read_only, pointName, units, reg_type, class EKGregister(BaseRegister): - def __init__(self, read_only, pointName, units, reg_type, - default_value=None, description=''): - super(EKGregister, self).__init__("byte", read_only, pointName, units, - description='') - self._value = 1; - - math_functions = ('acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', - 'atanh', 'sin', 'sinh', 'sqrt', 'tan', 'tanh') + + def __init__(self, read_only, pointName, units, reg_type, default_value=None, description=''): + super(EKGregister, self).__init__("byte", read_only, pointName, units, description='') + self._value = 1 + + math_functions = ('acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'sin', + 'sinh', 'sqrt', 'tan', 'tanh') if default_value in math_functions: self.math_func = getattr(math, default_value) else: @@ -102,6 +101,7 @@ def value(self, x): class Interface(BasicRevert, BaseInterface): + def __init__(self, **kwargs): super(Interface, self).__init__(**kwargs) @@ -116,8 +116,7 @@ def get_point(self, point_name): def _set_point(self, point_name, value): register = self.get_register_by_name(point_name) if register.read_only: - raise RuntimeError( - "Trying to write to a point configured read only: " + point_name) + raise RuntimeError("Trying to write to a point configured read only: " + point_name) register.value = register.reg_type(value) return register.value @@ -128,21 +127,20 @@ def _scrape_all(self): write_registers = self.get_registers_by_type("byte", False) for register in read_registers + write_registers: result[register.point_name] = register.value - return result def parse_config(self, configDict): if configDict is None: return - for regDef in configDict: # Skip lines that have no address yet. if not regDef['Point Name']: continue read_only = regDef['Writable'].lower() != 'true' - point_name = regDef['Volttron Point Name'] + volttron_point_name = regDef['Volttron Point Name'] + point_name = regDef['Point Name'] description = regDef.get('Notes', '') units = regDef['Units'] default_value = regDef.get("Starting Value", 'sin').strip() @@ -153,15 +151,14 @@ def parse_config(self, configDict): register_type = FakeRegister if not point_name.startswith('EKG') else EKGregister - register = register_type( - read_only, - point_name, - units, - reg_type, - default_value=default_value, - description=description) + register = register_type(read_only=read_only, + pointName=volttron_point_name, + reg_type=reg_type, + default_value=default_value, + description=description, + units=units) if default_value is not None: - self.set_default(point_name, register.value) + self.set_default(volttron_point_name, register.value) self.insert_register(register) diff --git a/volttron/__init__.py b/volttron/__init__.py index e78403ae4e..3999d69c5b 100644 --- a/volttron/__init__.py +++ b/volttron/__init__.py @@ -1,3 +1,4 @@ # This is a namespace package; do not add anything else to this file. +# from pkgutil import extend_path __path__ = extend_path(__path__, __name__) diff --git a/volttron/platform/agent/utils.py b/volttron/platform/agent/utils.py index cda9c8cf7f..e1f62125c3 100644 --- a/volttron/platform/agent/utils.py +++ b/volttron/platform/agent/utils.py @@ -74,19 +74,17 @@ from volttron.utils.prompt import prompt_response __all__ = [ - 'load_config', 'run_agent', 'start_agent_thread', 'is_valid_identity', - 'load_platform_config', 'get_messagebus', 'get_fq_identity', - 'execute_command', 'get_aware_utc_now', 'is_secure_mode', 'is_web_enabled', - 'is_auth_enabled', 'wait_for_volttron_shutdown', 'is_volttron_running' + 'load_config', 'run_agent', 'start_agent_thread', 'is_valid_identity', 'load_platform_config', + 'get_messagebus', 'get_fq_identity', 'execute_command', 'get_aware_utc_now', 'is_secure_mode', + 'is_web_enabled', 'is_auth_enabled', 'wait_for_volttron_shutdown', 'is_volttron_running' ] __author__ = 'Brandon Carpenter ' __copyright__ = 'Copyright (c) 2016, Battelle Memorial Institute' __license__ = 'Apache 2.0' -_comment_re = re.compile( - r'((["\'])(?:\\?.)*?\2)|(/\*.*?\*/)|((?:#|//).*?(?=\n|$))', - re.MULTILINE | re.DOTALL) +_comment_re = re.compile(r'((["\'])(?:\\?.)*?\2)|(/\*.*?\*/)|((?:#|//).*?(?=\n|$))', + re.MULTILINE | re.DOTALL) _log = logging.getLogger(__name__) @@ -321,13 +319,13 @@ def store_message_bus_config(message_bus, instance_name): def update_kwargs_with_config(kwargs, config): """ Loads the user defined configurations into kwargs. - + 1. Converts any dash/hyphen in config variables into underscores - 2. Checks for configured "identity" value. Prints a deprecation - warning and uses it. - 3. Checks for configured "agentid" value. Prints a deprecation warning + 2. Checks for configured "identity" value. Prints a deprecation + warning and uses it. + 3. Checks for configured "agentid" value. Prints a deprecation warning and ignores it - + :param kwargs: kwargs to be updated :param config: dictionary of user/agent configuration """ @@ -336,10 +334,9 @@ def update_kwargs_with_config(kwargs, config): _log.warning("DEPRECATION WARNING: Setting a historian's VIP IDENTITY" " from its configuration file will no longer be supported" " after VOLTTRON 4.0") - _log.warning( - "DEPRECATION WARNING: Using the identity configuration setting " - "will override the value provided by the platform. This new value " - "will not be reported correctly by 'volttron-ctl status'") + _log.warning("DEPRECATION WARNING: Using the identity configuration setting " + "will override the value provided by the platform. This new value " + "will not be reported correctly by 'volttron-ctl status'") _log.warning("DEPRECATION WARNING: Please remove 'identity' from your " "configuration file and use the new method provided by " "the platform to set an agent's identity. See " @@ -361,11 +358,7 @@ def parse_json_config(config_str): return jsonapi.loads(strip_comments(config_str)) -def run_agent(cls, - subscribe_address=None, - publish_address=None, - config_path=None, - **kwargs): +def run_agent(cls, subscribe_address=None, publish_address=None, config_path=None, **kwargs): """Instantiate an agent and run it in the current thread. Attempts to get keyword parameters from the environment if they @@ -426,8 +419,7 @@ def default_main(agent_class, sub_addr = os.environ['AGENT_SUB_ADDR'] pub_addr = os.environ['AGENT_PUB_ADDR'] except KeyError as exc: - sys.stderr.write('missing environment variable: {}\n'.format( - exc.args[0])) + sys.stderr.write('missing environment variable: {}\n'.format(exc.args[0])) sys.exit(1) if sub_addr.startswith('ipc://') and sub_addr[6:7] != '@': if not os.path.exists(sub_addr[6:]): @@ -467,8 +459,29 @@ def vip_main(agent_class, identity=None, version='0.1', **kwargs): if identity is not None: if not is_valid_identity(identity): _log.warning('Deprecation warining') - _log.warning( - f'All characters in {identity} are not in the valid set.') + _log.warning(f'All characters in {identity} are not in the valid set.') + + publickey = kwargs.pop("publickey", None) + if not publickey: + publickey = os.environ.get("AGENT_PUBLICKEY") + secretkey = kwargs.pop("secretkey", None) + if not secretkey: + secretkey = os.environ.get("AGENT_SECRETKEY") + serverkey = kwargs.pop("serverkey", None) + if not serverkey: + serverkey = os.environ.get("VOLTTRON_SERVERKEY") + + # AGENT_PUBLICKEY and AGENT_SECRETKEY must be specified + # for the agent to execute successfully. aip should set these + # if the agent is run from the platform. If run from the + # run command it should be set automatically from vctl and + # added to the server. + # + # TODO: Make required for all agents. Handle it through vctl and aip. + if not os.environ.get("_LAUNCHED_BY_PLATFORM"): + if not publickey or not secretkey: + raise ValueError("AGENT_PUBLIC and AGENT_SECRET environmental variables must " + "be set to run without the platform.") address = get_address() agent_uuid = os.environ.get('AGENT_UUID') @@ -483,6 +496,9 @@ def vip_main(agent_class, identity=None, version='0.1', **kwargs): volttron_home=volttron_home, version=version, message_bus=message_bus, + publickey=publickey, + secretkey=secretkey, + serverkey=serverkey, **kwargs) try: @@ -513,8 +529,7 @@ class SyslogFormatter(logging.Formatter): def format(self, record): level = self._level_map.get(record.levelno, syslog.LOG_INFO) - return '<{}>'.format(level) + super(SyslogFormatter, - self).format(record) + return '<{}>'.format(level) + super(SyslogFormatter, self).format(record) class JsonFormatter(logging.Formatter): @@ -565,8 +580,7 @@ def setup_logging(level=logging.DEBUG, console=False): handler.setFormatter(JsonFormatter()) elif console: # Below format is more readable for console - handler.setFormatter( - logging.Formatter('%(levelname)s: %(message)s')) + handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s')) else: fmt = '%(asctime)s %(name)s %(lineno)d %(levelname)s: %(message)s' handler.setFormatter(logging.Formatter(fmt)) @@ -583,10 +597,10 @@ def setup_logging(level=logging.DEBUG, console=False): def format_timestamp(time_stamp): """Create a consistent datetime string representation based on ISO 8601 format. - + YYYY-MM-DDTHH:MM:SS.mmmmmm for unaware datetime objects. YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM for aware datetime objects - + :param time_stamp: value to convert :type time_stamp: datetime :returns: datetime in string format @@ -605,9 +619,7 @@ def format_timestamp(time_stamp): seconds = td.seconds minutes, seconds = divmod(seconds, 60) hours, minutes = divmod(minutes, 60) - time_str += "{sign}{HH:02}:{MM:02}".format(sign=sign, - HH=hours, - MM=minutes) + time_str += "{sign}{HH:02}:{MM:02}".format(sign=sign, HH=hours, MM=minutes) return time_str @@ -637,8 +649,7 @@ def parse_timestamp_string(time_stamp_str): try: base_time_stamp_str = time_stamp_str[:26] time_zone_str = time_stamp_str[26:] - time_stamp = datetime.strptime(base_time_stamp_str, - "%Y-%m-%dT%H:%M:%S.%f") + time_stamp = datetime.strptime(base_time_stamp_str, "%Y-%m-%dT%H:%M:%S.%f") # Handle most common case. if time_zone_str == "+00:00": return time_stamp.replace(tzinfo=pytz.UTC) @@ -660,7 +671,7 @@ def parse_timestamp_string(time_stamp_str): def get_aware_utc_now(): """Create a timezone aware UTC datetime object from the system time. - + :returns: an aware UTC datetime object :rtype: datetime """ @@ -708,9 +719,8 @@ def process_timestamp(timestamp_string, topic=''): try: timestamp = parse_timestamp_string(timestamp_string) except (ValueError, TypeError): - _log.error( - "message for {topic} bad timetamp string: {ts_string}".format( - topic=topic, ts_string=timestamp_string)) + _log.error("message for {topic} bad timetamp string: {ts_string}".format( + topic=topic, ts_string=timestamp_string)) return if timestamp.tzinfo is None: @@ -724,13 +734,13 @@ def process_timestamp(timestamp_string, topic=''): def watch_file(path: str, callback: Callable): """Run callback method whenever `path` changes. - + If `path` is not rooted the function assumes relative to the $VOLTTRON_HOME environmental variable - + The watch_file will create a watchdog event handler and will trigger when the close event happens for writing to the file. - + Not available on OS X/MacOS. """ file_path = Path(path) @@ -785,8 +795,7 @@ def create_file_if_missing(path, permission=0o660, contents=None): success = False try: if contents: - contents = contents if isinstance( - contents, bytes) else contents.encode("utf-8") + contents = contents if isinstance(contents, bytes) else contents.encode("utf-8") os.write(fd, contents) success = True except Exception as e: @@ -799,12 +808,12 @@ def create_file_if_missing(path, permission=0o660, contents=None): def fix_sqlite3_datetime(sql=None): """Primarily for fixing the base historian cache on certain versions of python. - + Registers a new datetime converter to that uses dateutil parse. This should better resolve #216, #174, and #91 without the goofy workarounds that change data. - + Optional sql argument is for testing only. """ if sql is None: @@ -922,9 +931,7 @@ def wait_for_volttron_startup(vhome, timeout): gevent.sleep(3) sleep_time += 3 if sleep_time >= timeout: - raise Exception( - "Platform startup failed. Please check volttron.log in {}".format( - vhome)) + raise Exception("Platform startup failed. Please check volttron.log in {}".format(vhome)) def wait_for_volttron_shutdown(vhome, timeout): @@ -935,5 +942,4 @@ def wait_for_volttron_shutdown(vhome, timeout): sleep_time += 1 if sleep_time >= timeout: raise Exception( - "Platform shutdown failed. Please check volttron.cfg.log in {}". - format(vhome)) + "Platform shutdown failed. Please check volttron.cfg.log in {}".format(vhome)) diff --git a/volttrontesting/utils/build_agent.py b/volttrontesting/utils/build_agent.py index 7020e0610b..a925d9fc09 100644 --- a/volttrontesting/utils/build_agent.py +++ b/volttrontesting/utils/build_agent.py @@ -3,17 +3,21 @@ import gevent from volttron.platform.keystore import KeyStore +from volttron.platform.vip.agent import Agent from volttrontesting.utils.platformwrapper import PlatformWrapper -def build_agent(platform: PlatformWrapper, identity=None): +def build_agent(platform: PlatformWrapper, identity=None, agent_class=None): """Builds an agent instance with the passed platform as its bus. The agent identity will be set. If the identity is set to None then a random identity will be created. """ + if agent_class is None: + agent_class = Agent + os.environ['VOLTTRON_HOME'] = platform.volttron_home - agent = platform.build_agent(identity) + agent = platform.build_agent(identity, agent_class=agent_class) gevent.sleep(0.1) # switch context for a bit os.environ.pop('VOLTTRON_HOME') return agent diff --git a/volttrontesting/utils/platformwrapper.py b/volttrontesting/utils/platformwrapper.py index 4c9688f763..80bf8109b7 100644 --- a/volttrontesting/utils/platformwrapper.py +++ b/volttrontesting/utils/platformwrapper.py @@ -2,7 +2,7 @@ import logging import os from pathlib import Path -from typing import Optional, Union +from typing import Literal, Optional, Union import uuid from urllib.parse import urlencode @@ -628,6 +628,37 @@ def add_capabilities(self, publickey, capabilities): # auth.update rpc call. So sleeping here instead expecting individual test cases to sleep for long gevent.sleep(2) return True + + file_types = Union[Literal["raw"], Literal["json"], Literal["csv"]] + + def config_store_get(self, vip_identity: str, name: str, file_type: Optional[Literal["raw"]] = None) -> str: + with with_os_environ(self.env): + self.__wait_for_control_connection_to_exit__() + env = self.env.copy() + file_type = None if file_type is None else "--raw" + + cmd = ['volttron-ctl', '--json', 'config', 'get', vip_identity, name] + + if file_type: + cmd.append(file_type) + + res = execute_command(cmd, env=env, logger=_log) + + print(res) + return res + + def config_store_store(self, identity: str, name: str, infile: Path, file_type: file_types = "json"): + with with_os_environ(self.env): + self.__wait_for_control_connection_to_exit__() + env = self.env.copy() + file_type = "--" + file_type + + cmd = ['volttron-ctl', '--json', 'config', 'store', identity, name, infile.absolute().as_posix(), file_type] + + res = execute_command(cmd, env=env, logger=_log) + + print(res) + def add_capability(self, entry, capabilities): if not self.auth_enabled: