etsap-TIMES / xl2times

Open source tool to convert TIMES models specified in Excel
https://xl2times.readthedocs.io/
MIT License
10 stars 7 forks source link

Filtering out invalid flows specified in `UC_T` #154

Open olejandro opened 6 months ago

olejandro commented 6 months ago
          The remaining regression on `Ireland` is due to the tool currently not filtering out non-valid combinations of processes and commodities specified in `UC_T`, e.g. for `UC_FLO`.

Originally posted by @olejandro in https://github.com/etsap-TIMES/xl2times/issues/148#issuecomment-1857234704

Antti-L commented 6 months ago

@olejandro : Yes, by default topology check is enabled under UC_T (while it is by default not enabled under TFM_*). However, with Top_Check=N you can also disable the topology check under UC_T in VEDA (for individual rows or all), and so I think that should eventually be supported by xl2times as well.

olejandro commented 6 months ago

@Antti-L, do you see any reason for not doing topology check always in both UC_T and TFM_*, other than it requiring extra processing time?

Antti-L commented 6 months ago

Of course, at least for TFM_*, because for many attributes the commodity specified does not need to be in the process topology. And yes, I have had a real need for disabling topology check under UC_T, but cannot remember now in what context it was.

olejandro commented 6 months ago

Of course, at least for TFM_*, because for many attributes the commodity specified does not need to be in the process topology.

Is this because it is later added to the topology by TIMES? Could you give an example where a topology check in TFM_* would be undesirable?

Antti-L commented 6 months ago

Is this because it is later added to the topology by TIMES?

In some cases, yes, for example, FLO_EMIS can be used for defining any emission flows, and so a topology check would basically prevent using the attribute for its main purpose. Indeed, in that case TIMES does add it to the topology, unless it is already there. But there are other attributes where the commodity is not, and should not be added to the topology.

olejandro commented 6 months ago

Thanks @Antti-L. Would you say that the concept of topology check is broader than just checking against TOP? I am asking, because of the attrabites that include CG as index rather than commodity in the example above.

Antti-L commented 6 months ago

Sorry, I don't see what you are implying by your question.

VEDA does the check only against the process topology, which, however, includes also TOP_IRE, and probably even some flows defined by FLO_EMIS (at least the variant ENV_ACT), for which VEDA may internally define topology entries. So, when a commodity is specified in CSet_CN, the topology check is NOT performed under TFM_*, unless requested by Top_Check. If requested, it is of course performed also for commodities defined for e.g. PRC_ACTFLO, which has a CG index. It checks that the commodity is in the process topology, as an Input, or an Output, or both, depending on what the user requests.

olejandro commented 6 months ago

Thanks @Antti-L. Your example for PRC_ACTFLO more or less answers my question. A few more clarifications:

It checks that the commodity is in the process topology, as an Input, or an Output, or both, depending on what the user requests.

Also, do you think one can catergorise attributes on those for which the topology check should always / never be performed and those for which it should be user controlled?

I believe it is okay to deviate on some of these from Veda if it e.g. reduces the size of the QA log or improves user experience.

Antti-L commented 6 months ago

In case of a CG containing more than 1 commodity, should one check whether any of the commodities are in the process topology?

Should it matter for the topology check whether a CG is specified in a commodity column or in other_indexes?

I don't think VEDA does any Topology check for labels specified in Other_Indexes. But yes, doing that might also be considered, but then in my view under the following rules (assuming user has requested Top_Check, or the attribute has been qualified for checking it by default):

How does one control it? I thought it would only check whether a flow is valid, but would not distinguish between input/output flows.

Valid entries for Top_Check: I / O / A / N / Blank

do you think one can catergorise attributes on those for which the topology check should always / never be performed and those for which it should be user controlled?

I am not sure of too much benefit. I think the current defaults and the user control are basically fine. But ok, I think the following could be categorized for "always": NCAP_MSPRF, FLO_FEQ, FLO_FR, IRE_PRICE, NCAP_VALU, STGIN_BND, STGOUT_BND. "Never" for the BS_*.

olejandro commented 6 months ago

Thanks a lot for this input @Antti-L