Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: pump v2 support for single speed #348

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

TeeeJay
Copy link
Collaborator

@TeeeJay TeeeJay commented Jan 15, 2024

Have you remembered and considered?

  •  Update documentation, if relevant
  •  Update manual changelog, if relevant
  • Update migration guide, if relevant
  • Tagged commit with BREAKING: in footer or ! in header if breaking
  • Considered to add tests
  • Used conventional commits syntax

Why is this pull request needed?

This pull request is needed because of....

What does this pull request change?

Write summary of what this pull request changes if needed.

Issues related to this change:

@TeeeJay TeeeJay requested a review from a team as a code owner January 15, 2024 12:01
@TeeeJay
Copy link
Collaborator Author

TeeeJay commented Jan 15, 2024

rebased etc. will go through a final check

@@ -1211,7 +1216,8 @@ def get_asset_result(self) -> libecalc.dto.result.EcalcModelResult:
},
)

sub_components.append(obj)
if obj:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is it None?

Comment on lines +36 to +44
# Temporary v2 only
# We are not able to currently import PumpModelResult due to circular import, therefore we use duck typing...
if (
len(values) == 1
and len(other_values) == 1
and hasattr(values[0], "extend")
and hasattr(other_values[0], "extend")
):
values[0].extend(other_values[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the comment above...circular import. Next step with v2 will have to be to sort out a few ofthe ciruclar import issues..

consumers: List[Union[ElectricityConsumer, ConsumerSystem, Any]] = Field(
default_factory=list
) # Any here is Pump, that cannot be explicitly specified due to circular import ...temporalequipment?
# Any must be set in order for pydantic to accept/validate the consumer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we fix this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a quick fix, but solve all the "hacks" where we have incorrect directions of dependencies.

Comment on lines +145 to +147
return pump_yaml.to_temporal_domain_models(
references=self.__references, timesteps=timevector, fuel=fuel
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be done in energy calculator instead? So we don't have to send timevector here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, didnt check, but since we are moving away from energy calculator?

@@ -33,6 +55,10 @@ class Config:

energy_usage_model: YamlTemporalModel[str]

# TODO: Currently we share the stream conditions between consumer system and pump. Might change if they deviate ...
# TODO: We may also want to enforce the names of the streams, and e.g. limit to 1 in -and output stream ...? At least we need to know what is in and out ...
stream_conditions: Optional[YamlConsumerStreamConditions]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think we should fix the schema here, by not making stream_conditions optional.

@@ -66,6 +66,9 @@ def test_valid(self):
)
}

@pytest.mark.skip(
reason="Due to circular dependencies we cannot specify a pump as an alternative as a consumer for genset, therefore we must set Any, which makes this not fail."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we fix it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every case must be considered separately. Here we must figure out the problem with the pumpcharts I think. We can however not move those to domain yet, as that will cause serialization to not work (unless we add that, but it doesnt make sense to serialize domain objects...). So we must avoid need for serialization of the ecalcmodel first...I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants