def __init__(self): """Initialise a default context.""" self.verbose = False self.track_exchanges = False self.regions = regions.All self.startdate = startdate # Number of timesteps is determined by the number of demand rows. self.hours = len(hourly_regional_demand) # Estimate the number of years from the number of simulation hours. if self.hours == 8760 or self.hours == 8784: self.years = 1 else: self.years = self.hours / (365.25 * 24) self.relstd = 0.002 # 0.002% unserved energy self.generators = [ generators.CCGT(polygons.wildcard, 20000), generators.OCGT(polygons.wildcard, 20000) ] self.demand = hourly_demand.copy() self.timesteps = len(self.demand) self.spill = pd.DataFrame() self.generation = pd.DataFrame() self.unserved = pd.DataFrame() # System non-synchronous penetration limit self.nsp_limit = float(configfile.get('limits', 'nonsync-penetration')) self.exchanges = np.zeros( (self.hours, polygons.numpolygons, polygons.numpolygons)) self.costs = costs.NullCosts()
def test_005(self): """Test Context summary with no cost generator.""" c = nemo.Context() c.costs = costs.NullCosts() print(str(c)) c.verbose = True print(str(c)) c.regions = [regions.nsw] print(str(c)) f = types.MethodType(lambda self, costs: None, c.generators[0]) print(f) c.generators[0].summary = f print(c.generators[0].summary(None)) print(str(c))
def test_005(self): """Test Context summary with no cost generator.""" from nemo import costs import types c = nemo.Context() c.costs = costs.NullCosts() print str(c) c.verbose = True print str(c) c.regions = [regions.nsw] print str(c) f = types.MethodType(lambda self, costs: None, c.generators[0], nemo.Context) print f c.generators[0].summary = f print c.generators[0].summary(None) print str(c)