From 942897921d8f38115878bdd95349c43c449240b7 Mon Sep 17 00:00:00 2001 From: Jostein Solaas <33114722+jsolaas@users.noreply.github.com> Date: Mon, 18 Sep 2023 07:43:28 +0200 Subject: [PATCH] refactor: generate facility type schema (#182) --- .../json_schemas/facility-files.json | 132 ----- .../input/yaml_types/components/yaml_asset.py | 8 +- .../facility_type/yaml_facility_type.py | 105 ++++ .../test_json_schema_changed/schemas.json | 492 +++++++++++------- 4 files changed, 421 insertions(+), 316 deletions(-) delete mode 100644 src/ecalc/libraries/libecalc/common/libecalc/input/validation/json_schemas/facility-files.json create mode 100644 src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/facility_type/yaml_facility_type.py diff --git a/src/ecalc/libraries/libecalc/common/libecalc/input/validation/json_schemas/facility-files.json b/src/ecalc/libraries/libecalc/common/libecalc/input/validation/json_schemas/facility-files.json deleted file mode 100644 index 2632594f4..000000000 --- a/src/ecalc/libraries/libecalc/common/libecalc/input/validation/json_schemas/facility-files.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "id": "$SERVER_NAME/api/v1/schema-validation/facility-files.json", - "type": "object", - "title": "ecalc yaml setup", - "description": "Facility files", - "properties": { - "FACILITY_INPUTS": { - "type": "array", - "items": { - "type": "object", - "properties": { - "NAME": { - "title": "NAME", - "description": "Name of the facility input.\n\n$ECALC_DOCS_KEYWORDS_URL/NAME", - "type": "string" - }, - "FILE": { - "title": "FILE", - "description": "Specifies the name of an input file.\n\n$ECALC_DOCS_KEYWORDS_URL/FILE", - "type": "string" - }, - "TYPE": { - "title": "TYPE", - "description": "Defines the type of model applied on the data in the file.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE", - "type": "string", - "anyOf": [ - { - "title": "ELECTRICITY2FUEL", - "description": "Table specifying the relationship between electrical load and fuel consumption for an entire generator set.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE#use-in-facility-inputs", - "const": "ELECTRICITY2FUEL" - }, - { - "title": "TABULAR", - "description": "Consumer energy function for pure barycentric interpolation, no extrapolation outside convex area.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE#use-in-facility-inputs", - "const": "TABULAR" - }, - { - "title": "COMPRESSOR_TABULAR", - "description": "Consumer energy function for compressor (or compressor train) in tabular format.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE.html#use-in-facility-inputs", - "const": "COMPRESSOR_TABULAR" - }, - { - "title": "PUMP_CHART_SINGLE_SPEED", - "description": "Pump chart data for single speed pump.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE#use-in-facility-inputs", - "const": "PUMP_CHART_SINGLE_SPEED" - }, - { - "title": "PUMP_CHART_VARIABLE_SPEED", - "description": "Pump chart data for variable speed (VSD) pump.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE#use-in-facility-inputs", - "const": "PUMP_CHART_VARIABLE_SPEED" - } - ] - }, - "HEAD_MARGIN": { - "title": "HEAD_MARGIN", - "description": "Adjustment of the head margin for power calibration.\n\n$ECALC_DOCS_KEYWORDS_URL/HEAD_MARGIN", - "type": "number" - }, - "ADJUSTMENT": { - "title": "ADJUSTMENT", - "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\n$ECALC_DOCS_KEYWORDS_URL/ADJUSTMENT", - "type": "object", - "properties": { - "CONSTANT": { - "title": "CONSTANT", - "description": "Adjust input data with a constant value.\n\n$ECALC_DOCS_KEYWORDS_URL/CONSTANT", - "type": "number" - }, - "FACTOR": { - "title": "FACTOR", - "description": "Adjust input data with a constant multiplier.\n\n$ECALC_DOCS_KEYWORDS_URL/FACTOR", - "type": "number" - } - }, - "oneOf": [ - { - "required": ["CONSTANT"] - }, - { - "required": ["FACTOR"] - } - ] - }, - "UNITS": { - "title": "pump_chart_units", - "description": "Units for pump charts: RATE, HEAD and EFFICIENCY.", - "type": "object", - "properties": { - "RATE": { - "title": "RATE", - "description": "Unit for rate in pump chart. Currently only AM3_PER_HOUR is supported", - "const": "AM3_PER_HOUR" - }, - "HEAD": { - "title": "HEAD", - "description": "Unit for head in pump chart. Supported units are M (default), KJ_PER_KG and JOULE_PER_KG", - "anyOf": [ - { "const": "M" }, - { "const": "KJ_PER_KG" }, - { "const": "JOULE_PER_KG" } - ] - }, - "EFFICIENCY": { - "title": "EFFICIENCY", - "description": "Unit of efficiency in pump chart. Supported units are PERCENTAGE (default) and FRACTION.", - "anyOf": [{ "const": "FRACTION" }, { "const": "PERCENTAGE" }] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "if": { - "anyOf": [ - { - "properties": { "TYPE": { "const": "PUMP_CHART_SINGLE_SPEED" } }, - "required": ["TYPE"] - }, - { - "properties": { - "TYPE": { "const": "PUMP_CHART_VARIABLE_SPEED" } - }, - "required": ["TYPE"] - } - ] - }, - "then": { "required": ["NAME", "FILE", "TYPE", "UNITS"] }, - "else": { "required": ["NAME", "FILE", "TYPE"] } - } - } - } -} diff --git a/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/components/yaml_asset.py b/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/components/yaml_asset.py index f4045f79c..4df53cb06 100644 --- a/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/components/yaml_asset.py +++ b/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/components/yaml_asset.py @@ -2,6 +2,7 @@ from libecalc.input.yaml_types import YamlBase from libecalc.input.yaml_types.components.yaml_installation import YamlInstallation +from libecalc.input.yaml_types.facility_type.yaml_facility_type import YamlFacilityType from libecalc.input.yaml_types.fuel_type.yaml_fuel_type import YamlFuelType from libecalc.input.yaml_types.time_series.yaml_time_series import ( YamlTimeSeriesCollection, @@ -22,11 +23,6 @@ class Config: @staticmethod def schema_extra(schema: Dict[str, Any], model: Type["YamlAsset"]) -> None: - replace_placeholder_property_with_legacy_ref( - schema=schema, - property_key="FACILITY_INPUTS", - property_ref="$SERVER_NAME/api/v1/schema-validation/facility-files.json#properties/FACILITY_INPUTS", - ) replace_placeholder_property_with_legacy_ref( schema=schema, property_key="MODELS", @@ -39,7 +35,7 @@ def schema_extra(schema: Dict[str, Any], model: Type["YamlAsset"]) -> None: description="Defines the inputs for time dependent variables, or 'reservoir variables'." "\n\n$ECALC_DOCS_KEYWORDS_URL/TIME_SERIES", ) - facility_inputs: YamlPlaceholderType = Field( + facility_inputs: List[YamlFacilityType] = Field( None, title="FACILITY_INPUTS", description="Defines input files which characterize various facility elements." diff --git a/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/facility_type/yaml_facility_type.py b/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/facility_type/yaml_facility_type.py new file mode 100644 index 000000000..36eb5b20a --- /dev/null +++ b/src/ecalc/libraries/libecalc/common/libecalc/input/yaml_types/facility_type/yaml_facility_type.py @@ -0,0 +1,105 @@ +from typing import Literal, Union + +from libecalc.input.yaml_types import YamlBase +from pydantic import Field +from typing_extensions import Annotated + + +def FacilityTypeField(): + return Field( + ..., + title="TYPE", + description="Defines the type of model applied on the data in the file.\n\n$ECALC_DOCS_KEYWORDS_URL/TYPE", + ) + + +class YamlFacilityAdjustment(YamlBase): + constant: float = Field( + 0, + title="CONSTANT", + description="Adjust input data with a constant value.\n\n$ECALC_DOCS_KEYWORDS_URL/CONSTANT", + ) + factor: float = Field( + 1, + title="FACTOR", + description="Adjust input data with a constant multiplier.\n\n$ECALC_DOCS_KEYWORDS_URL/FACTOR", + ) + + +class YamlFacilityTypeBase(YamlBase): + name: str = Field( + ..., + title="NAME", + description="Name of the facility input.\n\n$ECALC_DOCS_KEYWORDS_URL/NAME", + ) + file: str = Field( + ..., + title="FILE", + description="Specifies the name of an input file.\n\n$ECALC_DOCS_KEYWORDS_URL/FILE", + ) + adjustment: YamlFacilityAdjustment = Field( + None, + title="ADJUSTMENT", + description="Definition of adjustments to correct for mismatches in facility energy usage.\n\n$ECALC_DOCS_KEYWORDS_URL/ADJUSTMENT", + ) + + +class YamlGeneratorSetModel(YamlFacilityTypeBase): + type: Literal["ELECTRICITY2FUEL"] = FacilityTypeField() + + +class YamlTabularModel(YamlFacilityTypeBase): + type: Literal["TABULAR"] = FacilityTypeField() + + +class YamlCompressorTabularModel(YamlFacilityTypeBase): + type: Literal["COMPRESSOR_TABULAR"] = FacilityTypeField() + + +class YamlPumpChartUnits(YamlBase): + rate: Literal["AM3_PER_HOUR"] = Field( + ..., + title="RATE", + description="Unit for rate in pump chart. Currently only AM3_PER_HOUR is supported", + ) + head: Literal["M", "KJ_PER_KG", "JOULE_PER_KG"] = Field( + ..., + title="HEAD", + description="Unit for head in pump chart. Supported units are M (default), KJ_PER_KG and JOULE_PER_KG", + ) + efficiency: Literal["PERCENTAGE", "FRACTION"] = Field( + ..., + title="EFFICIENCY", + description="Unit of efficiency in pump chart. Supported units are PERCENTAGE (default) and FRACTION.", + ) + + +class YamlPumpChartBase(YamlFacilityTypeBase): + head_margin: float = Field( + None, + title="HEAD_MARGIN", + description="Adjustment of the head margin for power calibration.\n\n$ECALC_DOCS_KEYWORDS_URL/HEAD_MARGIN", + ) + units: YamlPumpChartUnits = Field( + ..., title="UNITS", description="Units for pump charts: RATE, HEAD and EFFICIENCY." + ) + + +class YamlPumpChartSingleSpeed(YamlPumpChartBase): + type: Literal["PUMP_CHART_SINGLE_SPEED"] = FacilityTypeField() + + +class YamlPumpChartVariableSpeed(YamlPumpChartBase): + type: Literal["PUMP_CHART_VARIABLE_SPEED"] = FacilityTypeField() + + +YamlFacilityType = Annotated[ + Union[ + YamlGeneratorSetModel, + YamlTabularModel, + YamlCompressorTabularModel, + YamlPumpChartSingleSpeed, + YamlPumpChartVariableSpeed, + ], + Field(discriminator="type"), +] diff --git a/src/ecalc/libraries/libecalc/common/tests/input/validation/snapshots/test_validation_json_schemas/test_json_schema_changed/schemas.json b/src/ecalc/libraries/libecalc/common/tests/input/validation/snapshots/test_validation_json_schemas/test_json_schema_changed/schemas.json index 202875beb..27fc41b72 100644 --- a/src/ecalc/libraries/libecalc/common/tests/input/validation/snapshots/test_validation_json_schemas/test_json_schema_changed/schemas.json +++ b/src/ecalc/libraries/libecalc/common/tests/input/validation/snapshots/test_validation_json_schemas/test_json_schema_changed/schemas.json @@ -328,6 +328,45 @@ "title": "CompressorSystemOperationalSettings", "type": "object" }, + "YamlCompressorTabularModel": { + "additionalProperties": false, + "properties": { + "ADJUSTMENT": { + "allOf": [ + { + "$ref": "#/definitions/YamlFacilityAdjustment" + } + ], + "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/ADJUSTMENT", + "title": "ADJUSTMENT" + }, + "FILE": { + "description": "Specifies the name of an input file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FILE", + "title": "FILE", + "type": "string" + }, + "NAME": { + "description": "Name of the facility input.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/NAME", + "title": "NAME", + "type": "string" + }, + "TYPE": { + "description": "Defines the type of model applied on the data in the file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE", + "enum": [ + "COMPRESSOR_TABULAR" + ], + "title": "TYPE", + "type": "string" + } + }, + "required": [ + "NAME", + "FILE", + "TYPE" + ], + "title": "YamlCompressorTabularModel", + "type": "object" + }, "YamlDefaultTimeSeriesCollection": { "additionalProperties": false, "properties": { @@ -568,6 +607,25 @@ "title": "YamlEmitterModel", "type": "object" }, + "YamlFacilityAdjustment": { + "additionalProperties": false, + "properties": { + "CONSTANT": { + "default": 0, + "description": "Adjust input data with a constant value.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/CONSTANT", + "title": "CONSTANT", + "type": "number" + }, + "FACTOR": { + "default": 1, + "description": "Adjust input data with a constant multiplier.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FACTOR", + "title": "FACTOR", + "type": "number" + } + }, + "title": "YamlFacilityAdjustment", + "type": "object" + }, "YamlFuelConsumer": { "additionalProperties": false, "properties": { @@ -752,6 +810,45 @@ "title": "GeneratorSet", "type": "object" }, + "YamlGeneratorSetModel": { + "additionalProperties": false, + "properties": { + "ADJUSTMENT": { + "allOf": [ + { + "$ref": "#/definitions/YamlFacilityAdjustment" + } + ], + "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/ADJUSTMENT", + "title": "ADJUSTMENT" + }, + "FILE": { + "description": "Specifies the name of an input file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FILE", + "title": "FILE", + "type": "string" + }, + "NAME": { + "description": "Name of the facility input.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/NAME", + "title": "NAME", + "type": "string" + }, + "TYPE": { + "description": "Defines the type of model applied on the data in the file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE", + "enum": [ + "ELECTRICITY2FUEL" + ], + "title": "TYPE", + "type": "string" + } + }, + "required": [ + "NAME", + "FILE", + "TYPE" + ], + "title": "YamlGeneratorSetModel", + "type": "object" + }, "YamlInstallation": { "additionalProperties": false, "properties": { @@ -1008,6 +1105,153 @@ "title": "Pump", "type": "object" }, + "YamlPumpChartSingleSpeed": { + "additionalProperties": false, + "properties": { + "ADJUSTMENT": { + "allOf": [ + { + "$ref": "#/definitions/YamlFacilityAdjustment" + } + ], + "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/ADJUSTMENT", + "title": "ADJUSTMENT" + }, + "FILE": { + "description": "Specifies the name of an input file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FILE", + "title": "FILE", + "type": "string" + }, + "HEAD_MARGIN": { + "description": "Adjustment of the head margin for power calibration.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/HEAD_MARGIN", + "title": "HEAD_MARGIN", + "type": "number" + }, + "NAME": { + "description": "Name of the facility input.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/NAME", + "title": "NAME", + "type": "string" + }, + "TYPE": { + "description": "Defines the type of model applied on the data in the file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE", + "enum": [ + "PUMP_CHART_SINGLE_SPEED" + ], + "title": "TYPE", + "type": "string" + }, + "UNITS": { + "allOf": [ + { + "$ref": "#/definitions/YamlPumpChartUnits" + } + ], + "description": "Units for pump charts: RATE, HEAD and EFFICIENCY.", + "title": "UNITS" + } + }, + "required": [ + "NAME", + "FILE", + "UNITS", + "TYPE" + ], + "title": "YamlPumpChartSingleSpeed", + "type": "object" + }, + "YamlPumpChartUnits": { + "additionalProperties": false, + "properties": { + "EFFICIENCY": { + "description": "Unit of efficiency in pump chart. Supported units are PERCENTAGE (default) and FRACTION.", + "enum": [ + "PERCENTAGE", + "FRACTION" + ], + "title": "EFFICIENCY", + "type": "string" + }, + "HEAD": { + "description": "Unit for head in pump chart. Supported units are M (default), KJ_PER_KG and JOULE_PER_KG", + "enum": [ + "M", + "KJ_PER_KG", + "JOULE_PER_KG" + ], + "title": "HEAD", + "type": "string" + }, + "RATE": { + "description": "Unit for rate in pump chart. Currently only AM3_PER_HOUR is supported", + "enum": [ + "AM3_PER_HOUR" + ], + "title": "RATE", + "type": "string" + } + }, + "required": [ + "RATE", + "HEAD", + "EFFICIENCY" + ], + "title": "YamlPumpChartUnits", + "type": "object" + }, + "YamlPumpChartVariableSpeed": { + "additionalProperties": false, + "properties": { + "ADJUSTMENT": { + "allOf": [ + { + "$ref": "#/definitions/YamlFacilityAdjustment" + } + ], + "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/ADJUSTMENT", + "title": "ADJUSTMENT" + }, + "FILE": { + "description": "Specifies the name of an input file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FILE", + "title": "FILE", + "type": "string" + }, + "HEAD_MARGIN": { + "description": "Adjustment of the head margin for power calibration.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/HEAD_MARGIN", + "title": "HEAD_MARGIN", + "type": "number" + }, + "NAME": { + "description": "Name of the facility input.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/NAME", + "title": "NAME", + "type": "string" + }, + "TYPE": { + "description": "Defines the type of model applied on the data in the file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE", + "enum": [ + "PUMP_CHART_VARIABLE_SPEED" + ], + "title": "TYPE", + "type": "string" + }, + "UNITS": { + "allOf": [ + { + "$ref": "#/definitions/YamlPumpChartUnits" + } + ], + "description": "Units for pump charts: RATE, HEAD and EFFICIENCY.", + "title": "UNITS" + } + }, + "required": [ + "NAME", + "FILE", + "UNITS", + "TYPE" + ], + "title": "YamlPumpChartVariableSpeed", + "type": "object" + }, "YamlPumpSystem": { "additionalProperties": false, "properties": { @@ -1316,6 +1560,45 @@ ], "title": "YamlSingleVariable", "type": "object" + }, + "YamlTabularModel": { + "additionalProperties": false, + "properties": { + "ADJUSTMENT": { + "allOf": [ + { + "$ref": "#/definitions/YamlFacilityAdjustment" + } + ], + "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/ADJUSTMENT", + "title": "ADJUSTMENT" + }, + "FILE": { + "description": "Specifies the name of an input file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FILE", + "title": "FILE", + "type": "string" + }, + "NAME": { + "description": "Name of the facility input.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/NAME", + "title": "NAME", + "type": "string" + }, + "TYPE": { + "description": "Defines the type of model applied on the data in the file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE", + "enum": [ + "TABULAR" + ], + "title": "TYPE", + "type": "string" + } + }, + "required": [ + "NAME", + "FILE", + "TYPE" + ], + "title": "YamlTabularModel", + "type": "object" } }, "description": "An eCalc\u2122 yaml file", @@ -1326,9 +1609,38 @@ "type": "string" }, "FACILITY_INPUTS": { - "$ref": "https://test.ecalc.equinor.com/api/v1/schema-validation/facility-files.json#properties/FACILITY_INPUTS", "description": "Defines input files which characterize various facility elements.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FACILITY_INPUTS", - "title": "FACILITY_INPUTS" + "items": { + "discriminator": { + "mapping": { + "COMPRESSOR_TABULAR": "#/definitions/YamlCompressorTabularModel", + "ELECTRICITY2FUEL": "#/definitions/YamlGeneratorSetModel", + "PUMP_CHART_SINGLE_SPEED": "#/definitions/YamlPumpChartSingleSpeed", + "PUMP_CHART_VARIABLE_SPEED": "#/definitions/YamlPumpChartVariableSpeed", + "TABULAR": "#/definitions/YamlTabularModel" + }, + "propertyName": "TYPE" + }, + "oneOf": [ + { + "$ref": "#/definitions/YamlGeneratorSetModel" + }, + { + "$ref": "#/definitions/YamlTabularModel" + }, + { + "$ref": "#/definitions/YamlCompressorTabularModel" + }, + { + "$ref": "#/definitions/YamlPumpChartSingleSpeed" + }, + { + "$ref": "#/definitions/YamlPumpChartVariableSpeed" + } + ] + }, + "title": "FACILITY_INPUTS", + "type": "array" }, "FUEL_TYPES": { "description": "Specifies the various fuel types and associated emissions used in the model.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FUEL_TYPES", @@ -2512,182 +2824,6 @@ }, "uri": "https://test.ecalc.equinor.com/api/v1/schema-validation/energy-usage-model.json" }, - { - "fileMatch": [], - "schema": { - "description": "Facility files", - "id": "https://test.ecalc.equinor.com/api/v1/schema-validation/facility-files.json", - "properties": { - "FACILITY_INPUTS": { - "items": { - "additionalProperties": false, - "else": { - "required": [ - "NAME", - "FILE", - "TYPE" - ] - }, - "if": { - "anyOf": [ - { - "properties": { - "TYPE": { - "const": "PUMP_CHART_SINGLE_SPEED" - } - }, - "required": [ - "TYPE" - ] - }, - { - "properties": { - "TYPE": { - "const": "PUMP_CHART_VARIABLE_SPEED" - } - }, - "required": [ - "TYPE" - ] - } - ] - }, - "properties": { - "ADJUSTMENT": { - "description": "Definition of adjustments to correct for mismatches in facility energy usage.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/ADJUSTMENT", - "oneOf": [ - { - "required": [ - "CONSTANT" - ] - }, - { - "required": [ - "FACTOR" - ] - } - ], - "properties": { - "CONSTANT": { - "description": "Adjust input data with a constant value.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/CONSTANT", - "title": "CONSTANT", - "type": "number" - }, - "FACTOR": { - "description": "Adjust input data with a constant multiplier.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FACTOR", - "title": "FACTOR", - "type": "number" - } - }, - "title": "ADJUSTMENT", - "type": "object" - }, - "FILE": { - "description": "Specifies the name of an input file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/FILE", - "title": "FILE", - "type": "string" - }, - "HEAD_MARGIN": { - "description": "Adjustment of the head margin for power calibration.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/HEAD_MARGIN", - "title": "HEAD_MARGIN", - "type": "number" - }, - "NAME": { - "description": "Name of the facility input.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/NAME", - "title": "NAME", - "type": "string" - }, - "TYPE": { - "anyOf": [ - { - "const": "ELECTRICITY2FUEL", - "description": "Table specifying the relationship between electrical load and fuel consumption for an entire generator set.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE#use-in-facility-inputs", - "title": "ELECTRICITY2FUEL" - }, - { - "const": "TABULAR", - "description": "Consumer energy function for pure barycentric interpolation, no extrapolation outside convex area.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE#use-in-facility-inputs", - "title": "TABULAR" - }, - { - "const": "COMPRESSOR_TABULAR", - "description": "Consumer energy function for compressor (or compressor train) in tabular format.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE.html#use-in-facility-inputs", - "title": "COMPRESSOR_TABULAR" - }, - { - "const": "PUMP_CHART_SINGLE_SPEED", - "description": "Pump chart data for single speed pump.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE#use-in-facility-inputs", - "title": "PUMP_CHART_SINGLE_SPEED" - }, - { - "const": "PUMP_CHART_VARIABLE_SPEED", - "description": "Pump chart data for variable speed (VSD) pump.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE#use-in-facility-inputs", - "title": "PUMP_CHART_VARIABLE_SPEED" - } - ], - "description": "Defines the type of model applied on the data in the file.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/TYPE", - "title": "TYPE", - "type": "string" - }, - "UNITS": { - "additionalProperties": false, - "description": "Units for pump charts: RATE, HEAD and EFFICIENCY.", - "properties": { - "EFFICIENCY": { - "anyOf": [ - { - "const": "FRACTION" - }, - { - "const": "PERCENTAGE" - } - ], - "description": "Unit of efficiency in pump chart. Supported units are PERCENTAGE (default) and FRACTION.", - "title": "EFFICIENCY" - }, - "HEAD": { - "anyOf": [ - { - "const": "M" - }, - { - "const": "KJ_PER_KG" - }, - { - "const": "JOULE_PER_KG" - } - ], - "description": "Unit for head in pump chart. Supported units are M (default), KJ_PER_KG and JOULE_PER_KG", - "title": "HEAD" - }, - "RATE": { - "const": "AM3_PER_HOUR", - "description": "Unit for rate in pump chart. Currently only AM3_PER_HOUR is supported", - "title": "RATE" - } - }, - "title": "pump_chart_units", - "type": "object" - } - }, - "then": { - "required": [ - "NAME", - "FILE", - "TYPE", - "UNITS" - ] - }, - "type": "object" - }, - "type": "array" - } - }, - "title": "ecalc yaml setup", - "type": "object" - }, - "uri": "https://test.ecalc.equinor.com/api/v1/schema-validation/facility-files.json" - }, { "fileMatch": [], "schema": {