More checking on technology_interconnections
As system level control gets further developed - it will likely become even more dependent on technology_interconnections for understanding the system architecture. With more dependence on technology_interconnections, we should integrate more checking on the connections and throw errors for "invalid" connections or connections that should be done differently. I think a good starting point would be the following:
- Check for any connections that are formatted as
[source_tech, dest_tech, [commodity_out, commodity_in]] and throw an error or warning to note that this should be formatted as [source_tech, dest_tech, commodity, transport_tech]. The length 3 connection does not provide information about the commodity being passed (when used to make the technology graph). So - this type of connection should be discouraged when length 4 connection would work. This check could be done by first checking if the end of source_param and dest_param are _out and _in (respectively). If this is the case, then check if the starts of that string are the same (if source_param.split("_in",1) == dest_param.split("_out", 1) then raise error that encourages user to use a length 4 connection and utilize the generic transport component if needed.)
- Check usage of combiners with storage components. With storage components, its common to have the following type of connection:
- [generation_tech, storage_tech, commodity, transport_tech]
- [generation_tech, combiner, commodity, transport_tech]
- [storage_tech, combiner, commodity, transport_tech]
- [combiner, downstream_tech, commodity, transport_tech]
In these cases, we should check that:
- technology connected to storage_tech (
generation_tech) has only two out streams (unless its a splitter). These out streams would be storage_tech and combiner
storage_tech has only one out stream, which is the same combiner as generation_tech
For all other technologies connected with length 4 connections, we should ensure that they each have a maximum of 1 in stream and 1 out stream (except splitters).
This can be done somewhat easily using the technology_graph attribute. Length 4 connections mean that the edge in the technology graph has the "commodity" data being passed. A somewhat simplified approach is below (does not have any pre-filtering for length 4 connections):
in_degs = dict(self.technology_graph.in_degree)
out_degs = dict(self.technology_graph.out_degree)
# check storage technologies
storage_techs = [k for k,v in self.tech_control_classifiers.items() if v=="storage"]
for storage_tech in storage_techs:
if (n_in := in_degs.get(storage_tech,0)) != 1:
raise ValueError(f"storage tech {storage_tech} has {n_in} input connections but should only have 1")
if (n_out := out_degs.get(storage_tech,0)) >!= 1:
raise ValueError(f"storage tech {storage_tech} has {n_out} output connections but should only have 1")
storage_input_tech = list(self.technology_graph.predecessors(storage_tech)) # should be length 1 given earlier check
if (n_out := out_degs.get(storage_input_tech[0],0)) > 2:
raise ValueError(f"Technology {storage_input_tech[0]} should only be connected to {storage_tech} and a combiner but has {n_out} output streams")
More checking on
technology_interconnectionsAs system level control gets further developed - it will likely become even more dependent on
technology_interconnectionsfor understanding the system architecture. With more dependence ontechnology_interconnections, we should integrate more checking on the connections and throw errors for "invalid" connections or connections that should be done differently. I think a good starting point would be the following:[source_tech, dest_tech, [commodity_out, commodity_in]]and throw an error or warning to note that this should be formatted as[source_tech, dest_tech, commodity, transport_tech]. The length 3 connection does not provide information about the commodity being passed (when used to make the technology graph). So - this type of connection should be discouraged when length 4 connection would work. This check could be done by first checking if the end ofsource_paramanddest_paramare_outand_in(respectively). If this is the case, then check if the starts of that string are the same (if source_param.split("_in",1) == dest_param.split("_out", 1)then raise error that encourages user to use a length 4 connection and utilize the generic transport component if needed.)In these cases, we should check that:
generation_tech) has only two out streams (unless its a splitter). These out streams would bestorage_techandcombinerstorage_techhas only one out stream, which is the same combiner asgeneration_techFor all other technologies connected with length 4 connections, we should ensure that they each have a maximum of 1 in stream and 1 out stream (except splitters).
This can be done somewhat easily using the
technology_graphattribute. Length 4 connections mean that the edge in the technology graph has the "commodity" data being passed. A somewhat simplified approach is below (does not have any pre-filtering for length 4 connections):