def load_car_models(self): """ Loads all car models from car_models.csv. Returns ------- None. """ cast = Cast("Car Model") self.car_models = dict() csv_helper = CSVHelper("data", "car_models.csv") for row in csv_helper.data: uid = cast.to_positive_int(row[0], "Uid") cast.uid = uid car_model_name = str(row[1]).strip(" ").strip('"') car_consumption = cast.to_positive_float(row[2], "Car consumption") drag_coeff = cast.to_positive_float(row[3], "Drag coeff") frontal_area = cast.to_positive_float(row[4], "Frontal area") mass = cast.to_positive_float(row[5], "Mass") battery_capacity \ = cast.to_positive_float(row[6], "Battery capacity") charger_capacity \ = cast.to_positive_float(row[7], "Charger capacity") cm = CarModel(uid, car_model_name, car_consumption, drag_coeff, frontal_area, mass, battery_capacity, charger_capacity) self.car_models[uid] = cm
def load_charger_models(self): """ Reads information on individual charger models from charger_models.csv. """ cast = Cast("Charger Model") self.charger_models = dict() csv_helper = CSVHelper("data", "charger_models.csv") for row in csv_helper.data: uid = cast.to_positive_int(row[0], "Uid") cast.uid = uid classification = row[1] ac_power = cast.to_positive_int(row[2], "AC Power") dc_power = cast.to_positive_int(row[2], "DC Power") cm = ChargerModel(uid, classification, ac_power, dc_power) self.charger_models[uid] = cm if cm.classification == "com": self.commercial_model_uids.append(cm.uid) else: self.residential_model_uids.append(cm.uid)
def load_locations(self): """ Reads information on individual suburbs from locations.csv. """ cast = Cast("Location") self.locations = {} csv_helper = CSVHelper("data", "locations.csv") for row in csv_helper.data: uid = cast.to_positive_int(row[0], "Uid") cast.uid = uid name = row[2] longitude = cast.to_float(row[3], "Longitude") latitude = cast.to_float(row[4], "Latitude") population = cast.to_positive_int(row[5], "Population") commute_mean = cast.to_positive_float(row[6], "Commute mean") commute_std_dev = cast.to_positive_float(row[7], "Commute std dev") occupant_distribution \ = cast.to_positive_int_list(row[8], "Occupant distribution") occupant_values \ = cast.to_positive_int_list(row[9], "Occupant values") pv_capacity_mean \ = cast.to_positive_float(row[10], "PV capacity mean") pv_capacity_std_dev \ = cast.to_positive_float(row[11], "PV capacity std dev") battery_capacity_mean \ = cast.to_positive_float(row[12], "Battery capacity mean") battery_capacity_std_dev\ = cast.to_positive_float(row[13], "Battery capacity std dev") loc = Location(uid, name, longitude, latitude, population, commute_mean, commute_std_dev, occupant_distribution, occupant_values, pv_capacity_mean, pv_capacity_std_dev, battery_capacity_mean, battery_capacity_std_dev) # add public charger self.cpm.add_company(loc) self.locations[loc.uid] = loc
def load_electricity_plans(self, parameters, clock): """ Loads all electricity plans from electricity_plans.csv. Parameters ---------- clock : Clock required for time_step parameter Returns ------- None. """ cast = Cast("Electricity Plan") self.electricity_plans = dict() csv_helper = CSVHelper("data", "electricity_plans.csv") for row in csv_helper.data: uid = cast.to_positive_int(row[0], "Uid") cast.uid = uid classification = row[1] if not classification in ["res", "com"]: sys.exit("Classification of electricity plan " + str(uid) \ + " is ill-defined!") is_commercial_plan = classification == "com" base = cast.to_float(row[2], "Base") feed_in_tariff = parameters.get_parameter("feed_in_tariff", "float") # create tariff structure tariff_str = row[3] tariff = self.extract_tariffs_from_string(tariff_str) ep = ElectricityPlan(uid, is_commercial_plan, base, feed_in_tariff, tariff, clock.time_step) self.electricity_plans[uid] = ep if ep.is_commercial_plan: self.commercial_plan_uids.append(ep.uid) else: self.residential_plan_uids.append(ep.uid)