Skip to content

Scenarios fail when variables are Zeroed out #112

Description

@carbz

For many of the variables, if one zeros out the value of variables on the Metric model, the scenario fails.

Specifically, a user wishes to Zero out categories like Available system capacities (diesel generator) and Grid transformer available system capacities, etc. This is a valid use-case because the user may wish to disregard one of the three technology options for consideration. In this case, he wishes to consider a tradeoff between 'off-grid' and 'mini-grid' systems.

image

Perhaps we should have a divide by zero check in some of the variable transformations that happen in the Metric Model?

Sample error code below:

raceback (most recent call last):
File "utilities/harvest.py", line 53, in
scenario.run()
File "/var/www/np/np/model/init.py", line 256, in run
metricValueByOptionBySection = datasetStore.applyMetric(metricModel, metricConfiguration)
...
File "/var/www/np/np/lib/metric/mvMax5/costOffGrid.py", line 525, in compute
self.get(DieselGeneratorActualSystemCapacityCounts))
File "/var/www/np/np/lib/variable_store.py", line 213, in get
return self.variableStore.get(variableClass)
File "/var/www/np/np/lib/variable_store.py", line 64, in get
return self.getVariable(variableClass).value
File "/var/www/np/np/lib/variable_store.py", line 76, in getVariable
variable = variableClass(self)
File "/var/www/np/np/lib/variable_store.py", line 191, in init
self.value = self.compute()
File "/var/www/np/np/lib/metric/mvMax5/costOffGrid.py", line 506, in compute
self.get(DieselGeneratorAvailableSystemCapacities))
File "/var/www/np/np/lib/metric/init.py", line 32, in computeSystemCounts
availableCapacityCount = int(remainingCapacity / availableCapacity)
ZeroDivisionError: float division by zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions