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