-
Notifications
You must be signed in to change notification settings - Fork 10
refactor: make temperature setter inherit from ProcessUnit #1373
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
Merged
olelod
merged 1 commit into
main
from
refactor/temperature-setter-inherit-from-processunit
Feb 4, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/libecalc/domain/process/entities/process_units/temperature_setter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| from libecalc.domain.process.process_system.process_unit import ProcessUnit | ||
| from libecalc.domain.process.value_objects.fluid_stream import FluidService, FluidStream | ||
|
|
||
|
|
||
| class TemperatureSetter(ProcessUnit): | ||
| def __init__(self, required_temperature_kelvin: float, fluid_service: FluidService): | ||
| self._required_temperature_kelvin = required_temperature_kelvin | ||
| self._fluid_service = fluid_service | ||
|
|
||
| @property | ||
| def required_temperature_kelvin(self) -> float: | ||
| return self._required_temperature_kelvin | ||
|
|
||
| def propagate_stream(self, inlet_stream: FluidStream) -> FluidStream: | ||
| """This process unit currently acts as both a cooler and a heater. This is because eCalc currently attaches | ||
| all information about stream temperature to the compressor stage. We dont really know the temperature of the | ||
| stream until the temperature setter is reached (stream could have standard temperature). | ||
|
|
||
| If the inlet stream is hotter than the required temperature, it cools it down to the required temperature. | ||
| If the inlet stream is cooler than the required temperature, it heats it up to the required temperature. | ||
|
|
||
| TODO: When the YAML file has a full definition of inlet streams and hence temperatures are all defined in the | ||
| correct place, make this unit into a cooler, that only reduces temperature, and raise an error if the inlet | ||
| stream is cooler than the required temperature. | ||
|
|
||
| Args: | ||
| inlet_stream: The fluid stream to set the temperature of. | ||
|
|
||
| Returns: | ||
| A new FluidStream at the required temperature. | ||
| """ | ||
| if inlet_stream.temperature_kelvin != self.required_temperature_kelvin: | ||
| new_fluid = self._fluid_service.create_fluid( | ||
| inlet_stream.fluid_model, | ||
| inlet_stream.pressure_bara, | ||
| self.required_temperature_kelvin, | ||
| ) | ||
| return inlet_stream.with_new_fluid(new_fluid) | ||
| return inlet_stream | ||
Empty file removed
0
src/libecalc/domain/process/entities/process_units/temperature_setter/__init__.py
Empty file.
29 changes: 0 additions & 29 deletions
29
src/libecalc/domain/process/entities/process_units/temperature_setter/temperature_setter.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.