Conversation
|
@FJanssen-TNO I have written an implementation for this issue. It is not ready for a proper PR, I still need to write some test and do all the formatting and linting, but if you have some time it would be useful for me if you can check if my approach for it makes sense. |
FJanssen-TNO
left a comment
There was a problem hiding this comment.
First notes on the structure
|
|
||
| elif ( | ||
| asset.asset_type == "GeothermalSource" | ||
| and len(asset.out_ports) == 1 | ||
| and len(asset.in_ports) == 2 | ||
| ): | ||
| for p in [*asset.in_ports, *asset.out_ports]: | ||
|
|
||
| if isinstance(p, InPort) and isinstance( | ||
| p.carrier, esdl.ElectricityCommodity | ||
| ): | ||
| port_map[p.id] = getattr(component, elec_in_suf) | ||
| elif isinstance(p, InPort) and isinstance(p.carrier, esdl.HeatCommodity): | ||
| port_map[p.id] = getattr(component, in_suf) | ||
| elif isinstance(p, OutPort): # OutPort | ||
| port_map[p.id] = getattr(component, out_suf) | ||
| else: | ||
| raise Exception( | ||
| f"{asset.name} has does not have (1 electricity in_port) 1 heat " | ||
| f"in port and 1 Heat out_ports " | ||
| ) | ||
|
|
There was a problem hiding this comment.
I believe this is a copy of another asset with 2 heat ports and one electricity inport. Therefore please combine with that if statement, no need to have duplicated code.
There was a problem hiding this comment.
Yes, you are right, I see now that I copied this snipped from the air to water heat pump. I am merging it with that if statement in the next commit.
| ) | ||
| # TODO: A better check might be needed here. Perhaps check for an elec asset. | ||
| if len(asset.in_ports) == 2: # Geothermal source with an electricity in port. | ||
| _, modifiers = self.convert_geothermal_source_elec(asset) |
There was a problem hiding this comment.
right now you are not using any of the modifiers that have already been created upto this point and that you need, you basically starting from scratch again.
Instead of creating an entire convert method where you do everything from scratch again, you can just update the modifiers here that are based on the electricity connection. (You can create a method for that you call here, but it doesn't have to contain anything that has already been done above here)
|
|
||
| return AirWaterHeatPumpElec, modifiers | ||
|
|
||
| def convert_geothermal_source_elec( |
There was a problem hiding this comment.
See my comment above.
| id_mapping = asset.global_properties["carriers"][asset.in_ports[0].carrier.id][ | ||
| "id_number_mapping" | ||
| ] |
There was a problem hiding this comment.
This is not required.
There was a problem hiding this comment.
The first step was not create a completely new geothermal asset with an additional port. The first step is to calculate the electricity consumption by a geothermal asset. Updating the geothermal asset with a variable "Power_elec" and calculating that variable using an equation.
After that we can create a new geothermal asset, but that will be relatively easy as it then only is based on adding an electricity port.
| if isinstance(port.carrier, esdl.ElectricityCommodity): | ||
| min_voltage = port.carrier.voltage | ||
| i_max, i_nom = self._get_connected_i_nominal_and_max(asset) | ||
| cop = asset.attributes["COP"] if asset.attributes["COP"] else 1.0 |
There was a problem hiding this comment.
Think about default values that you would like to use. In case someone hasn't specified the COP (e.g. how much electricity is used), should it then be a ratio of 1 compared to the heat energy produced. Maybe is someone hasn't specified you want it to be 0.
There was a problem hiding this comment.
@Jaimepatt check what a reasonable default value is for the COP of a geothermal source asset. For ATES it was 0.1kWh/m3/hr.
| self.add_variable(Variable, "Power_elec", min=0.0, nominal=self.elec_power_nominal) | ||
|
|
||
| self.add_equation(((self.ElectricityIn.Power - self.Power_elec) / self.elec_power_nominal)) | ||
| self.add_equation(((self.Power_elec * self.cop - self.Heat_source) / self.Heat_nominal)) |
There was a problem hiding this comment.
This you can move to geothermal asset together with the variable creation.
Work for issue: #421