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