Conditions | 24 |
Total Lines | 555 |
Code Lines | 358 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
Complex classes like data.datasets.sanity_checks.sanitycheck_emobility_mit() often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | """ |
||
808 | def sanitycheck_emobility_mit(): |
||
809 | """Execute sanity checks for eMobility: motorized individual travel |
||
810 | |||
811 | Checks data integrity for eGon2035, eGon2035_lowflex and eGon100RE scenario |
||
812 | using assertions: |
||
813 | 1. Allocated EV numbers and EVs allocated to grid districts |
||
814 | 2. Trip data (original inout data from simBEV) |
||
815 | 3. Model data in eTraGo PF tables (grid.egon_etrago_*) |
||
816 | |||
817 | Parameters |
||
818 | ---------- |
||
819 | None |
||
820 | |||
821 | Returns |
||
822 | ------- |
||
823 | None |
||
824 | """ |
||
825 | |||
826 | def check_ev_allocation(): |
||
827 | # Get target number for scenario |
||
828 | ev_count_target = scenario_variation_parameters["ev_count"] |
||
829 | print(f" Target count: {str(ev_count_target)}") |
||
830 | |||
831 | # Get allocated numbers |
||
832 | ev_counts_dict = {} |
||
833 | with db.session_scope() as session: |
||
834 | for table, level in zip( |
||
835 | [ |
||
836 | EgonEvCountMvGridDistrict, |
||
837 | EgonEvCountMunicipality, |
||
838 | EgonEvCountRegistrationDistrict, |
||
839 | ], |
||
840 | ["Grid District", "Municipality", "Registration District"], |
||
841 | ): |
||
842 | query = session.query( |
||
843 | func.sum( |
||
844 | table.bev_mini |
||
845 | + table.bev_medium |
||
846 | + table.bev_luxury |
||
847 | + table.phev_mini |
||
848 | + table.phev_medium |
||
849 | + table.phev_luxury |
||
850 | ).label("ev_count") |
||
851 | ).filter( |
||
852 | table.scenario == scenario_name, |
||
853 | table.scenario_variation == scenario_var_name, |
||
854 | ) |
||
855 | |||
856 | ev_counts = pd.read_sql( |
||
857 | query.statement, query.session.bind, index_col=None |
||
858 | ) |
||
859 | ev_counts_dict[level] = ev_counts.iloc[0].ev_count |
||
860 | print( |
||
861 | f" Count table: Total count for level {level} " |
||
862 | f"(table: {table.__table__}): " |
||
863 | f"{str(ev_counts_dict[level])}" |
||
864 | ) |
||
865 | |||
866 | # Compare with scenario target (only if not in testmode) |
||
867 | if TESTMODE_OFF: |
||
868 | for level, count in ev_counts_dict.items(): |
||
869 | np.testing.assert_allclose( |
||
870 | count, |
||
871 | ev_count_target, |
||
872 | rtol=0.0001, |
||
873 | err_msg=f"EV numbers in {level} seems to be flawed.", |
||
874 | ) |
||
875 | else: |
||
876 | print(" Testmode is on, skipping sanity check...") |
||
877 | |||
878 | # Get allocated EVs in grid districts |
||
879 | with db.session_scope() as session: |
||
880 | query = session.query( |
||
881 | func.count(EgonEvMvGridDistrict.egon_ev_pool_ev_id).label( |
||
882 | "ev_count" |
||
883 | ), |
||
884 | ).filter( |
||
885 | EgonEvMvGridDistrict.scenario == scenario_name, |
||
886 | EgonEvMvGridDistrict.scenario_variation == scenario_var_name, |
||
887 | ) |
||
888 | ev_count_alloc = ( |
||
889 | pd.read_sql(query.statement, query.session.bind, index_col=None) |
||
890 | .iloc[0] |
||
891 | .ev_count |
||
892 | ) |
||
893 | print( |
||
894 | f" EVs allocated to Grid Districts " |
||
895 | f"(table: {EgonEvMvGridDistrict.__table__}) total count: " |
||
896 | f"{str(ev_count_alloc)}" |
||
897 | ) |
||
898 | |||
899 | # Compare with scenario target (only if not in testmode) |
||
900 | if TESTMODE_OFF: |
||
901 | np.testing.assert_allclose( |
||
902 | ev_count_alloc, |
||
903 | ev_count_target, |
||
904 | rtol=0.0001, |
||
905 | err_msg=( |
||
906 | "EV numbers allocated to Grid Districts seems to be " |
||
907 | "flawed." |
||
908 | ), |
||
909 | ) |
||
910 | else: |
||
911 | print(" Testmode is on, skipping sanity check...") |
||
912 | |||
913 | return ev_count_alloc |
||
914 | |||
915 | def check_trip_data(): |
||
916 | # Check if trips start at timestep 0 and have a max. of 35040 steps |
||
917 | # (8760h in 15min steps) |
||
918 | print(" Checking timeranges...") |
||
919 | with db.session_scope() as session: |
||
920 | query = session.query( |
||
921 | func.count(EgonEvTrip.event_id).label("cnt") |
||
922 | ).filter( |
||
923 | or_( |
||
924 | and_( |
||
925 | EgonEvTrip.park_start > 0, |
||
926 | EgonEvTrip.simbev_event_id == 0, |
||
927 | ), |
||
928 | EgonEvTrip.park_end |
||
929 | > (60 / int(meta_run_config.stepsize)) * 8760, |
||
930 | ), |
||
931 | EgonEvTrip.scenario == scenario_name, |
||
932 | ) |
||
933 | invalid_trips = pd.read_sql( |
||
934 | query.statement, query.session.bind, index_col=None |
||
935 | ) |
||
936 | np.testing.assert_equal( |
||
937 | invalid_trips.iloc[0].cnt, |
||
938 | 0, |
||
939 | err_msg=( |
||
940 | f"{str(invalid_trips.iloc[0].cnt)} trips in table " |
||
941 | f"{EgonEvTrip.__table__} have invalid timesteps." |
||
942 | ), |
||
943 | ) |
||
944 | |||
945 | # Check if charging demand can be covered by available charging energy |
||
946 | # while parking |
||
947 | print(" Compare charging demand with available power...") |
||
948 | with db.session_scope() as session: |
||
949 | query = session.query( |
||
950 | func.count(EgonEvTrip.event_id).label("cnt") |
||
951 | ).filter( |
||
952 | func.round( |
||
953 | cast( |
||
954 | (EgonEvTrip.park_end - EgonEvTrip.park_start + 1) |
||
955 | * EgonEvTrip.charging_capacity_nominal |
||
956 | * (int(meta_run_config.stepsize) / 60), |
||
957 | Numeric, |
||
958 | ), |
||
959 | 3, |
||
960 | ) |
||
961 | < cast(EgonEvTrip.charging_demand, Numeric), |
||
962 | EgonEvTrip.scenario == scenario_name, |
||
963 | ) |
||
964 | invalid_trips = pd.read_sql( |
||
965 | query.statement, query.session.bind, index_col=None |
||
966 | ) |
||
967 | np.testing.assert_equal( |
||
968 | invalid_trips.iloc[0].cnt, |
||
969 | 0, |
||
970 | err_msg=( |
||
971 | f"In {str(invalid_trips.iloc[0].cnt)} trips (table: " |
||
972 | f"{EgonEvTrip.__table__}) the charging demand cannot be " |
||
973 | f"covered by available charging power." |
||
974 | ), |
||
975 | ) |
||
976 | |||
977 | def check_model_data(): |
||
978 | # Check if model components were fully created |
||
979 | print(" Check if all model components were created...") |
||
980 | # Get MVGDs which got EV allocated |
||
981 | with db.session_scope() as session: |
||
982 | query = ( |
||
983 | session.query( |
||
984 | EgonEvMvGridDistrict.bus_id, |
||
985 | ) |
||
986 | .filter( |
||
987 | EgonEvMvGridDistrict.scenario == scenario_name, |
||
988 | EgonEvMvGridDistrict.scenario_variation |
||
989 | == scenario_var_name, |
||
990 | ) |
||
991 | .group_by(EgonEvMvGridDistrict.bus_id) |
||
992 | ) |
||
993 | mvgds_with_ev = ( |
||
994 | pd.read_sql(query.statement, query.session.bind, index_col=None) |
||
995 | .bus_id.sort_values() |
||
996 | .to_list() |
||
997 | ) |
||
998 | |||
999 | # Load model components |
||
1000 | with db.session_scope() as session: |
||
1001 | query = ( |
||
1002 | session.query( |
||
1003 | EgonPfHvLink.bus0.label("mvgd_bus_id"), |
||
1004 | EgonPfHvLoad.bus.label("emob_bus_id"), |
||
1005 | EgonPfHvLoad.load_id.label("load_id"), |
||
1006 | EgonPfHvStore.store_id.label("store_id"), |
||
1007 | ) |
||
1008 | .select_from(EgonPfHvLoad, EgonPfHvStore) |
||
1009 | .join( |
||
1010 | EgonPfHvLoadTimeseries, |
||
1011 | EgonPfHvLoadTimeseries.load_id == EgonPfHvLoad.load_id, |
||
1012 | ) |
||
1013 | .join( |
||
1014 | EgonPfHvStoreTimeseries, |
||
1015 | EgonPfHvStoreTimeseries.store_id == EgonPfHvStore.store_id, |
||
1016 | ) |
||
1017 | .filter( |
||
1018 | EgonPfHvLoad.carrier == "land transport EV", |
||
1019 | EgonPfHvLoad.scn_name == scenario_name, |
||
1020 | EgonPfHvLoadTimeseries.scn_name == scenario_name, |
||
1021 | EgonPfHvStore.carrier == "battery storage", |
||
1022 | EgonPfHvStore.scn_name == scenario_name, |
||
1023 | EgonPfHvStoreTimeseries.scn_name == scenario_name, |
||
1024 | EgonPfHvLink.scn_name == scenario_name, |
||
1025 | EgonPfHvLink.bus1 == EgonPfHvLoad.bus, |
||
1026 | EgonPfHvLink.bus1 == EgonPfHvStore.bus, |
||
1027 | ) |
||
1028 | ) |
||
1029 | model_components = pd.read_sql( |
||
1030 | query.statement, query.session.bind, index_col=None |
||
1031 | ) |
||
1032 | |||
1033 | # Check number of buses with model components connected |
||
1034 | mvgd_buses_with_ev = model_components.loc[ |
||
1035 | model_components.mvgd_bus_id.isin(mvgds_with_ev) |
||
1036 | ] |
||
1037 | np.testing.assert_equal( |
||
1038 | len(mvgds_with_ev), |
||
1039 | len(mvgd_buses_with_ev), |
||
1040 | err_msg=( |
||
1041 | f"Number of Grid Districts with connected model components " |
||
1042 | f"({str(len(mvgd_buses_with_ev))} in tables egon_etrago_*) " |
||
1043 | f"differ from number of Grid Districts that got EVs " |
||
1044 | f"allocated ({len(mvgds_with_ev)} in table " |
||
1045 | f"{EgonEvMvGridDistrict.__table__})." |
||
1046 | ), |
||
1047 | ) |
||
1048 | |||
1049 | # Check if all required components exist (if no id is NaN) |
||
1050 | np.testing.assert_equal( |
||
1051 | model_components.drop_duplicates().isna().any().any(), |
||
1052 | False, |
||
1053 | err_msg=( |
||
1054 | f"Some components are missing (see True values): " |
||
1055 | f"{model_components.drop_duplicates().isna().any()}" |
||
1056 | ), |
||
1057 | ) |
||
1058 | |||
1059 | # Get all model timeseries |
||
1060 | print(" Loading model timeseries...") |
||
1061 | # Get all model timeseries |
||
1062 | model_ts_dict = { |
||
1063 | "Load": { |
||
1064 | "carrier": "land transport EV", |
||
1065 | "table": EgonPfHvLoad, |
||
1066 | "table_ts": EgonPfHvLoadTimeseries, |
||
1067 | "column_id": "load_id", |
||
1068 | "columns_ts": ["p_set"], |
||
1069 | "ts": None, |
||
1070 | }, |
||
1071 | "Link": { |
||
1072 | "carrier": "BEV charger", |
||
1073 | "table": EgonPfHvLink, |
||
1074 | "table_ts": EgonPfHvLinkTimeseries, |
||
1075 | "column_id": "link_id", |
||
1076 | "columns_ts": ["p_max_pu"], |
||
1077 | "ts": None, |
||
1078 | }, |
||
1079 | "Store": { |
||
1080 | "carrier": "battery storage", |
||
1081 | "table": EgonPfHvStore, |
||
1082 | "table_ts": EgonPfHvStoreTimeseries, |
||
1083 | "column_id": "store_id", |
||
1084 | "columns_ts": ["e_min_pu", "e_max_pu"], |
||
1085 | "ts": None, |
||
1086 | }, |
||
1087 | } |
||
1088 | |||
1089 | with db.session_scope() as session: |
||
1090 | for node, attrs in model_ts_dict.items(): |
||
1091 | print(f" Loading {node} timeseries...") |
||
1092 | subquery = ( |
||
1093 | session.query(getattr(attrs["table"], attrs["column_id"])) |
||
1094 | .filter(attrs["table"].carrier == attrs["carrier"]) |
||
1095 | .filter(attrs["table"].scn_name == scenario_name) |
||
1096 | .subquery() |
||
1097 | ) |
||
1098 | |||
1099 | cols = [ |
||
1100 | getattr(attrs["table_ts"], c) for c in attrs["columns_ts"] |
||
1101 | ] |
||
1102 | query = session.query( |
||
1103 | getattr(attrs["table_ts"], attrs["column_id"]), *cols |
||
1104 | ).filter( |
||
1105 | getattr(attrs["table_ts"], attrs["column_id"]).in_( |
||
1106 | subquery |
||
1107 | ), |
||
1108 | attrs["table_ts"].scn_name == scenario_name, |
||
1109 | ) |
||
1110 | attrs["ts"] = pd.read_sql( |
||
1111 | query.statement, |
||
1112 | query.session.bind, |
||
1113 | index_col=attrs["column_id"], |
||
1114 | ) |
||
1115 | |||
1116 | # Check if all timeseries have 8760 steps |
||
1117 | print(" Checking timeranges...") |
||
1118 | for node, attrs in model_ts_dict.items(): |
||
1119 | for col in attrs["columns_ts"]: |
||
1120 | ts = attrs["ts"] |
||
1121 | invalid_ts = ts.loc[ts[col].apply(lambda _: len(_)) != 8760][ |
||
1122 | col |
||
1123 | ].apply(len) |
||
1124 | np.testing.assert_equal( |
||
1125 | len(invalid_ts), |
||
1126 | 0, |
||
1127 | err_msg=( |
||
1128 | f"{str(len(invalid_ts))} rows in timeseries do not " |
||
1129 | f"have 8760 timesteps. Table: " |
||
1130 | f"{attrs['table_ts'].__table__}, Column: {col}, IDs: " |
||
1131 | f"{str(list(invalid_ts.index))}" |
||
1132 | ), |
||
1133 | ) |
||
1134 | |||
1135 | # Compare total energy demand in model with some approximate values |
||
1136 | # (per EV: 14,000 km/a, 0.17 kWh/km) |
||
1137 | print(" Checking energy demand in model...") |
||
1138 | total_energy_model = ( |
||
1139 | model_ts_dict["Load"]["ts"].p_set.apply(lambda _: sum(_)).sum() |
||
1140 | / 1e6 |
||
1141 | ) |
||
1142 | print(f" Total energy amount in model: {total_energy_model} TWh") |
||
1143 | total_energy_scenario_approx = ev_count_alloc * 14000 * 0.17 / 1e9 |
||
1144 | print( |
||
1145 | f" Total approximated energy amount in scenario: " |
||
1146 | f"{total_energy_scenario_approx} TWh" |
||
1147 | ) |
||
1148 | np.testing.assert_allclose( |
||
1149 | total_energy_model, |
||
1150 | total_energy_scenario_approx, |
||
1151 | rtol=0.1, |
||
1152 | err_msg=( |
||
1153 | "The total energy amount in the model deviates heavily " |
||
1154 | "from the approximated value for current scenario." |
||
1155 | ), |
||
1156 | ) |
||
1157 | |||
1158 | # Compare total storage capacity |
||
1159 | print(" Checking storage capacity...") |
||
1160 | # Load storage capacities from model |
||
1161 | with db.session_scope() as session: |
||
1162 | query = session.query( |
||
1163 | func.sum(EgonPfHvStore.e_nom).label("e_nom") |
||
1164 | ).filter( |
||
1165 | EgonPfHvStore.scn_name == scenario_name, |
||
1166 | EgonPfHvStore.carrier == "battery storage", |
||
1167 | ) |
||
1168 | storage_capacity_model = ( |
||
1169 | pd.read_sql( |
||
1170 | query.statement, query.session.bind, index_col=None |
||
1171 | ).e_nom.sum() |
||
1172 | / 1e3 |
||
1173 | ) |
||
1174 | print( |
||
1175 | f" Total storage capacity ({EgonPfHvStore.__table__}): " |
||
1176 | f"{round(storage_capacity_model, 1)} GWh" |
||
1177 | ) |
||
1178 | |||
1179 | # Load occurences of each EV |
||
1180 | with db.session_scope() as session: |
||
1181 | query = ( |
||
1182 | session.query( |
||
1183 | EgonEvMvGridDistrict.bus_id, |
||
1184 | EgonEvPool.type, |
||
1185 | func.count(EgonEvMvGridDistrict.egon_ev_pool_ev_id).label( |
||
1186 | "count" |
||
1187 | ), |
||
1188 | ) |
||
1189 | .join( |
||
1190 | EgonEvPool, |
||
1191 | EgonEvPool.ev_id |
||
1192 | == EgonEvMvGridDistrict.egon_ev_pool_ev_id, |
||
1193 | ) |
||
1194 | .filter( |
||
1195 | EgonEvMvGridDistrict.scenario == scenario_name, |
||
1196 | EgonEvMvGridDistrict.scenario_variation |
||
1197 | == scenario_var_name, |
||
1198 | EgonEvPool.scenario == scenario_name, |
||
1199 | ) |
||
1200 | .group_by(EgonEvMvGridDistrict.bus_id, EgonEvPool.type) |
||
1201 | ) |
||
1202 | count_per_ev_all = pd.read_sql( |
||
1203 | query.statement, query.session.bind, index_col="bus_id" |
||
1204 | ) |
||
1205 | count_per_ev_all["bat_cap"] = count_per_ev_all.type.map( |
||
1206 | meta_tech_data.battery_capacity |
||
1207 | ) |
||
1208 | count_per_ev_all["bat_cap_total_MWh"] = ( |
||
1209 | count_per_ev_all["count"] * count_per_ev_all.bat_cap / 1e3 |
||
1210 | ) |
||
1211 | storage_capacity_simbev = count_per_ev_all.bat_cap_total_MWh.div( |
||
1212 | 1e3 |
||
1213 | ).sum() |
||
1214 | print( |
||
1215 | f" Total storage capacity (simBEV): " |
||
1216 | f"{round(storage_capacity_simbev, 1)} GWh" |
||
1217 | ) |
||
1218 | |||
1219 | np.testing.assert_allclose( |
||
1220 | storage_capacity_model, |
||
1221 | storage_capacity_simbev, |
||
1222 | rtol=0.01, |
||
1223 | err_msg=( |
||
1224 | "The total storage capacity in the model deviates heavily " |
||
1225 | "from the input data provided by simBEV for current scenario." |
||
1226 | ), |
||
1227 | ) |
||
1228 | |||
1229 | # Check SoC storage constraint: e_min_pu < e_max_pu for all timesteps |
||
1230 | print(" Validating SoC constraints...") |
||
1231 | stores_with_invalid_soc = [] |
||
1232 | for idx, row in model_ts_dict["Store"]["ts"].iterrows(): |
||
1233 | ts = row[["e_min_pu", "e_max_pu"]] |
||
1234 | x = np.array(ts.e_min_pu) > np.array(ts.e_max_pu) |
||
1235 | if x.any(): |
||
1236 | stores_with_invalid_soc.append(idx) |
||
1237 | |||
1238 | np.testing.assert_equal( |
||
1239 | len(stores_with_invalid_soc), |
||
1240 | 0, |
||
1241 | err_msg=( |
||
1242 | f"The store constraint e_min_pu < e_max_pu does not apply " |
||
1243 | f"for some storages in {EgonPfHvStoreTimeseries.__table__}. " |
||
1244 | f"Invalid store_ids: {stores_with_invalid_soc}" |
||
1245 | ), |
||
1246 | ) |
||
1247 | |||
1248 | def check_model_data_lowflex_eGon2035(): |
||
1249 | # TODO: Add eGon100RE_lowflex |
||
1250 | print("") |
||
1251 | print("SCENARIO: eGon2035_lowflex") |
||
1252 | |||
1253 | # Compare driving load and charging load |
||
1254 | print(" Loading eGon2035 model timeseries: driving load...") |
||
1255 | with db.session_scope() as session: |
||
1256 | query = ( |
||
1257 | session.query( |
||
1258 | EgonPfHvLoad.load_id, |
||
1259 | EgonPfHvLoadTimeseries.p_set, |
||
1260 | ) |
||
1261 | .join( |
||
1262 | EgonPfHvLoadTimeseries, |
||
1263 | EgonPfHvLoadTimeseries.load_id == EgonPfHvLoad.load_id, |
||
1264 | ) |
||
1265 | .filter( |
||
1266 | EgonPfHvLoad.carrier == "land transport EV", |
||
1267 | EgonPfHvLoad.scn_name == "eGon2035", |
||
1268 | EgonPfHvLoadTimeseries.scn_name == "eGon2035", |
||
1269 | ) |
||
1270 | ) |
||
1271 | model_driving_load = pd.read_sql( |
||
1272 | query.statement, query.session.bind, index_col=None |
||
1273 | ) |
||
1274 | driving_load = np.array(model_driving_load.p_set.to_list()).sum(axis=0) |
||
1275 | |||
1276 | print( |
||
1277 | " Loading eGon2035_lowflex model timeseries: dumb charging " |
||
1278 | "load..." |
||
1279 | ) |
||
1280 | with db.session_scope() as session: |
||
1281 | query = ( |
||
1282 | session.query( |
||
1283 | EgonPfHvLoad.load_id, |
||
1284 | EgonPfHvLoadTimeseries.p_set, |
||
1285 | ) |
||
1286 | .join( |
||
1287 | EgonPfHvLoadTimeseries, |
||
1288 | EgonPfHvLoadTimeseries.load_id == EgonPfHvLoad.load_id, |
||
1289 | ) |
||
1290 | .filter( |
||
1291 | EgonPfHvLoad.carrier == "land transport EV", |
||
1292 | EgonPfHvLoad.scn_name == "eGon2035_lowflex", |
||
1293 | EgonPfHvLoadTimeseries.scn_name == "eGon2035_lowflex", |
||
1294 | ) |
||
1295 | ) |
||
1296 | model_charging_load_lowflex = pd.read_sql( |
||
1297 | query.statement, query.session.bind, index_col=None |
||
1298 | ) |
||
1299 | charging_load = np.array( |
||
1300 | model_charging_load_lowflex.p_set.to_list() |
||
1301 | ).sum(axis=0) |
||
1302 | |||
1303 | # Ratio of driving and charging load should be 0.9 due to charging |
||
1304 | # efficiency |
||
1305 | print(" Compare cumulative loads...") |
||
1306 | print(f" Driving load (eGon2035): {driving_load.sum() / 1e6} TWh") |
||
1307 | print( |
||
1308 | f" Dumb charging load (eGon2035_lowflex): " |
||
1309 | f"{charging_load.sum() / 1e6} TWh" |
||
1310 | ) |
||
1311 | driving_load_theoretical = ( |
||
1312 | float(meta_run_config.eta_cp) * charging_load.sum() |
||
1313 | ) |
||
1314 | np.testing.assert_allclose( |
||
1315 | driving_load.sum(), |
||
1316 | driving_load_theoretical, |
||
1317 | rtol=0.01, |
||
1318 | err_msg=( |
||
1319 | f"The driving load (eGon2035) deviates by more than 1% " |
||
1320 | f"from the theoretical driving load calculated from charging " |
||
1321 | f"load (eGon2035_lowflex) with an efficiency of " |
||
1322 | f"{float(meta_run_config.eta_cp)}." |
||
1323 | ), |
||
1324 | ) |
||
1325 | |||
1326 | print("=====================================================") |
||
1327 | print("=== SANITY CHECKS FOR MOTORIZED INDIVIDUAL TRAVEL ===") |
||
1328 | print("=====================================================") |
||
1329 | |||
1330 | for scenario_name in ["eGon2035", "eGon100RE"]: |
||
1331 | scenario_var_name = DATASET_CFG["scenario"]["variation"][scenario_name] |
||
1332 | |||
1333 | print("") |
||
1334 | print(f"SCENARIO: {scenario_name}, VARIATION: {scenario_var_name}") |
||
1335 | |||
1336 | # Load scenario params for scenario and scenario variation |
||
1337 | scenario_variation_parameters = get_sector_parameters( |
||
1338 | "mobility", scenario=scenario_name |
||
1339 | )["motorized_individual_travel"][scenario_var_name] |
||
1340 | |||
1341 | # Load simBEV run config and tech data |
||
1342 | meta_run_config = read_simbev_metadata_file( |
||
1343 | scenario_name, "config" |
||
1344 | ).loc["basic"] |
||
1345 | meta_tech_data = read_simbev_metadata_file(scenario_name, "tech_data") |
||
1346 | |||
1347 | print("") |
||
1348 | print("Checking EV counts...") |
||
1349 | ev_count_alloc = check_ev_allocation() |
||
1350 | |||
1351 | print("") |
||
1352 | print("Checking trip data...") |
||
1353 | check_trip_data() |
||
1354 | |||
1355 | print("") |
||
1356 | print("Checking model data...") |
||
1357 | check_model_data() |
||
1358 | |||
1359 | print("") |
||
1360 | check_model_data_lowflex_eGon2035() |
||
1361 | |||
1362 | print("=====================================================") |
||
1363 | |||
1542 |