-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Solver: filter attributes in matrix elaboration * MuSIASEM concepts: new fields for Indicators * Embedded_nis: new "state" property * AST evaluators: completed "aggregation function" implementations * Declared "nancount" and "LCIAMethod" functions (the second still not implemented) * Modification of fields in InterfaceTypes and Indicator commands * New command "LCIAMethods"
- Loading branch information
Showing
23 changed files
with
185 additions
and
37 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file added
BIN
+218 KB
backend_tests/z_input_files/v2/solver_Netherlandsv1ToNISHierarchy2.xlsx
Binary file not shown.
Binary file added
BIN
+116 KB
backend_tests/z_input_files/v2/solver_Netherlandsv1ToNISHierarchy2_new.xlsx
Binary file not shown.
Binary file added
BIN
+12.2 KB
backend_tests/z_input_files/v2/solver_SimpleCaseLabourMultifunctional_withParams.xlsx
Binary file not shown.
Binary file added
BIN
+9.61 KB
backend_tests/z_input_files/v2/solver_SimpleCaseLabour_errorAstEvaluator.xlsx
Binary file not shown.
Binary file added
BIN
+13.8 KB
backend_tests/z_input_files/v2/solver_SimpleCaseLabour_nonlinear.xlsx
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+93.1 KB
backend_tests/z_input_files/v2/solver_SimpleCaseWaterConflictsMulti.xlsx
Binary file not shown.
Binary file added
BIN
+92.5 KB
backend_tests/z_input_files/v2/solver_SimpleCaseWaterConflicts_problems.xlsx
Binary file not shown.
Binary file added
BIN
+94.7 KB
backend_tests/z_input_files/v2/solver_SimpleCaseWaterManyConflicts.xlsx
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+114 KB
backend_tests/z_input_files/v2/solver_SimpleCase_OliveOil_LocalExternal.xlsx
Binary file not shown.
Binary file not shown.
This file contains 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
48 changes: 48 additions & 0 deletions
48
nexinfosys/command_executors/version2/lcia_methods_command.py
This file contains 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,48 @@ | ||
import json | ||
from typing import Optional, Dict, Any | ||
|
||
from nexinfosys.command_generators import Issue, IssueLocation, IType | ||
from nexinfosys.common.helper import strcmp, first, PartialRetrievalDictionary | ||
from nexinfosys.model_services import IExecutableCommand, get_case_study_registry_objects | ||
from nexinfosys.models.musiasem_concepts import Observer, FactorTypesRelationUnidirectionalLinearTransformObservation, \ | ||
FactorType, Processor, Indicator | ||
from nexinfosys.command_executors import BasicCommand, CommandExecutionError, subrow_issue_message | ||
from nexinfosys.command_field_definitions import get_command_fields_from_class | ||
from nexinfosys.models.musiasem_concepts_helper import find_or_create_observer, find_processor_by_name | ||
|
||
|
||
class LCIAMethodsCommand(BasicCommand): | ||
def __init__(self, name: str): | ||
BasicCommand.__init__(self, name, get_command_fields_from_class(self.__class__)) | ||
|
||
def _process_row(self, fields: Dict[str, Any], subrow=None) -> None: | ||
""" | ||
:param fields: | ||
:param subrow: | ||
:return: | ||
""" | ||
# Interface (Type) must exist | ||
interface_type = self._get_factor_type_from_field(self, None, fields["interface"]) | ||
# (LCIA) Indicator must exist | ||
indicator = self._glb_idx.get(Indicator.partial_key(fields["lcia_indicator"])) | ||
if len(indicator) == 1: | ||
pass | ||
elif len(indicator) == 0: | ||
self._add_issue(IType.ERROR, f"Indicator with name '{fields['lcia_indicator']}' not found" + subrow_issue_message(subrow)) | ||
return | ||
else: | ||
self._add_issue(IType.WARNING, | ||
f"Indicator with name '{fields['lcia_indicator']}' found {len(indicator)} times" + subrow_issue_message(subrow)) | ||
return | ||
|
||
# Store LCIA Methods as a new variable. | ||
# TODO Use it to prepare a pd.DataFrame previous to calculating Indicators (after solving). Use "to_pickable" | ||
lcia_methods = self._state.get("_lcia_methods") | ||
if not lcia_methods: | ||
lcia_methods = PartialRetrievalDictionary() | ||
self._state.set("_lcia_methods", lcia_methods) | ||
lcia_methods.put(dict(m=fields["lcia_method"], | ||
i=fields["lcia_indicator"], | ||
h=fields["lcia_horizon"]), | ||
(fields["interface"], fields["interface_unit"], fields["lcia_coefficient"]) | ||
) |
This file contains 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 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 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 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 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 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
Oops, something went wrong.