mirror of
https://github.com/JHUAPL/SIMoN.git
synced 2026-01-09 14:57:56 -05:00
connect power supply (thermo water) to water demand
Former-commit-id: 9789f2d584efd641a39138107c2bb70691499599
This commit is contained in:
20
models/examples/water_demand/schemas/input/power_supply.json
Normal file
20
models/examples/water_demand/schemas/input/power_supply.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"co2": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string", "value": "county"}
|
||||
}
|
||||
},
|
||||
"thermo_water": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string", "value": "county"}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["co2", "thermo_water"]
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
# Distributed under the terms of the MIT License.
|
||||
|
||||
|
||||
def Water_Demand_Simulation(countypop, rates):
|
||||
def Water_Demand_Simulation(countypop, rates, thermo_water):
|
||||
|
||||
water = {}
|
||||
for i in rates:
|
||||
water[i] = countypop.get(i, 0) * rates[i]
|
||||
water[i] = thermo_water.get(i, 0) + countypop.get(i, 0) * rates[i]
|
||||
return water
|
||||
|
||||
@@ -24,6 +24,11 @@ class InnerWrapper(OuterWrapper):
|
||||
self.rate = kwargs["rates"]
|
||||
else:
|
||||
logging.warning(f"incstep {self.incstep}: rates not found")
|
||||
if "thermo_water" in kwargs.keys():
|
||||
self.thermo_water = kwargs["thermo_water"]
|
||||
else:
|
||||
logging.warning(f"incstep {self.incstep}: thermo_water not found")
|
||||
self.thermo_water = {}
|
||||
if "2016_populations" in kwargs.keys():
|
||||
self.countypop = kwargs["2016_populations"]
|
||||
else:
|
||||
@@ -37,7 +42,12 @@ class InnerWrapper(OuterWrapper):
|
||||
elif self.incstep > 1:
|
||||
logging.warning(f"incstep {self.incstep}: population not found")
|
||||
|
||||
demand = Water_Demand_Simulation(self.countypop, self.rate)
|
||||
if "power_supply" in kwargs.keys():
|
||||
self.thermo_water = kwargs["power_supply"]["thermo_water"]["data"]
|
||||
elif self.incstep > 1:
|
||||
logging.warning(f"incstep {self.incstep}: thermo_water not found")
|
||||
|
||||
demand = Water_Demand_Simulation(self.countypop, self.rate, self.thermo_water)
|
||||
|
||||
results = {
|
||||
"water_demand": {
|
||||
|
||||
Reference in New Issue
Block a user