Skip to content

Commit

Permalink
fix: add system v2 to generator set consumers
Browse files Browse the repository at this point in the history
  • Loading branch information
jsolaas committed Sep 12, 2023
1 parent 56da4b2 commit f776b16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from typing import Any, Dict, List, Type
from typing import Any, Dict, List, Type, Union

from libecalc.dto.base import ConsumerUserDefinedCategoryType
from libecalc.input.yaml_types import YamlBase
from libecalc.input.yaml_types.components.category import CategoryField
from libecalc.input.yaml_types.components.compressor_system import CompressorSystem
from libecalc.input.yaml_types.components.legacy.yaml_electricity_consumer import (
YamlElectricityConsumer,
)
from libecalc.input.yaml_types.components.pump_system import PumpSystem
from libecalc.input.yaml_types.placeholder_type import PlaceholderType
from libecalc.input.yaml_types.schema_helpers import (
replace_temporal_placeholder_property_with_legacy_ref,
Expand Down Expand Up @@ -43,7 +45,7 @@ def schema_extra(schema: Dict[str, Any], model: Type["YamlGeneratorSet"]) -> Non
description="Specifies the correlation between the electric power delivered and the fuel burned by a "
"generator set.\n\n$ECALC_DOCS_KEYWORDS_URL/ELECTRICITY2FUEL",
)
consumers: List[YamlElectricityConsumer] = Field(
consumers: List[Union[YamlElectricityConsumer, CompressorSystem, PumpSystem]] = Field(
...,
title="CONSUMERS",
description="Consumers getting electrical power from the generator set.\n\n$ECALC_DOCS_KEYWORDS_URL/CONSUMERS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,17 @@
"CONSUMERS": {
"description": "Consumers getting electrical power from the generator set.\n\nhttps://test.ecalc.equinor.com/docs/docs/modelling/keywords/CONSUMERS",
"items": {
"$ref": "#/definitions/YamlElectricityConsumer"
"anyOf": [
{
"$ref": "#/definitions/YamlElectricityConsumer"
},
{
"$ref": "#/definitions/CompressorSystem"
},
{
"$ref": "#/definitions/PumpSystem"
}
]
},
"title": "CONSUMERS",
"type": "array"
Expand Down

0 comments on commit f776b16

Please sign in to comment.