initial commit. First functions
commit
9db1c93bf8
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="flask-swagger-ui" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (toll_collect)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/toll_collect.iml" filepath="$PROJECT_DIR$/.idea/toll_collect.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import json
|
||||
from vehicle_group import get_vehicle_group
|
||||
|
||||
|
||||
class App:
|
||||
def __init__(self):
|
||||
self._co2_class = None
|
||||
self._read_configs()
|
||||
|
||||
def _read_configs(self):
|
||||
with open("config/co2_classe.json") as json_file:
|
||||
self._co2_class = json.load(json_file)
|
||||
|
||||
def get_co2_class(self, registrations_date, emission, vehicle_type, axis_type, power, cabin):
|
||||
vehicle_grp = get_vehicle_group(power, cabin, vehicle_type, axis_type)
|
||||
co2_limit = self._co2_class[vehicle_grp][registrations_date]
|
||||
print(vehicle_grp)
|
||||
print(co2_limit)
|
||||
if emission < (co2_limit * 0.5):
|
||||
print("Klasse 4")
|
||||
elif emission < (co2_limit * 0.92):
|
||||
print("Klasse 3")
|
||||
elif emission < (co2_limit * 0.95):
|
||||
print("Klasse 2")
|
||||
else:
|
||||
print("Klasse 1")
|
||||
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
{
|
||||
"4-UD": {
|
||||
"2019": 307.23,
|
||||
"2020": 299.549,
|
||||
"2021": 291.869,
|
||||
"2022": 284.188,
|
||||
"2023": 276.507,
|
||||
"2024": 268.826,
|
||||
"2025": 261.146,
|
||||
"2026": 251.929,
|
||||
"2027": 242.712,
|
||||
"2028": 233.495,
|
||||
"2029": 224.278,
|
||||
"2030": 215.061
|
||||
},
|
||||
"4-RD": {
|
||||
"2019": 197.16,
|
||||
"2020": 192.231,
|
||||
"2021": 187.302,
|
||||
"2022": 182.373,
|
||||
"2023": 177.444,
|
||||
"2024": 172.515,
|
||||
"2025": 167.586,
|
||||
"2026": 161.671,
|
||||
"2027": 155.756,
|
||||
"2028": 149.842,
|
||||
"2029": 143.927,
|
||||
"2030": 138.012
|
||||
},
|
||||
"5-RD": {
|
||||
"2019": 84.00,
|
||||
"2020": 81.900,
|
||||
"2021": 79.800,
|
||||
"2022": 77.700,
|
||||
"2023": 75.600,
|
||||
"2024": 73.500,
|
||||
"2025": 71.400,
|
||||
"2026": 68.880,
|
||||
"2027": 66.360,
|
||||
"2028": 63.840,
|
||||
"2029": 61.320,
|
||||
"2030": 58.800
|
||||
},
|
||||
"4-LH": {
|
||||
"2019": 105.96,
|
||||
"2020": 103.311,
|
||||
"2021": 100.662,
|
||||
"2022": 98.013,
|
||||
"2023": 95.364,
|
||||
"2024": 92.715,
|
||||
"2025": 90.066,
|
||||
"2026": 86.887,
|
||||
"2027": 83.708,
|
||||
"2028": 80.5296,
|
||||
"2029": 77.351,
|
||||
"2030": 74.172
|
||||
},
|
||||
"5-LH": {
|
||||
"2019": 56.60,
|
||||
"2020": 55.185,
|
||||
"2021": 53.770,
|
||||
"2022": 52.355,
|
||||
"2023": 50.940,
|
||||
"2024": 49.525,
|
||||
"2025": 48.110,
|
||||
"2026": 46.412,
|
||||
"2027": 44.714,
|
||||
"2028": 43.016,
|
||||
"2029": 41.318,
|
||||
"2030": 39.620
|
||||
},
|
||||
"9-RD": {
|
||||
"2019": 110.98,
|
||||
"2020": 108.206,
|
||||
"2021": 105.431,
|
||||
"2022": 102.657,
|
||||
"2023": 99.882,
|
||||
"2024": 97.108,
|
||||
"2025": 94.333,
|
||||
"2026": 91.004,
|
||||
"2027": 87.674,
|
||||
"2028": 84.345,
|
||||
"2029": 81.015,
|
||||
"2030": 77.68
|
||||
},
|
||||
"9-LH": {
|
||||
"2019": 65.16,
|
||||
"2020": 63.531,
|
||||
"2021": 61.902,
|
||||
"2022": 60.273,
|
||||
"2023": 58.644,
|
||||
"2024": 57.015,
|
||||
"2025": 55.386,
|
||||
"2026": 53.431,
|
||||
"2027": 51.476,
|
||||
"2028": 49.522,
|
||||
"2029": 47.567,
|
||||
"2030": 45.612
|
||||
},
|
||||
"10-RD": {
|
||||
"2019": 83.26,
|
||||
"2020": 81.179,
|
||||
"2021": 79.097,
|
||||
"2022": 77.016,
|
||||
"2023": 74.934,
|
||||
"2024": 72.853,
|
||||
"2025": 70.771,
|
||||
"2026": 68.273,
|
||||
"2027": 65.775,
|
||||
"2028": 63.278,
|
||||
"2029": 60.7798,
|
||||
"2030": 58.282
|
||||
},
|
||||
"10-LH": {
|
||||
"2019": 58.26,
|
||||
"2020": 56.804,
|
||||
"2021": 55.347,
|
||||
"2022": 53.891,
|
||||
"2023": 52.434,
|
||||
"2024": 50.978,
|
||||
"2025": 49.521,
|
||||
"2026": 47.773,
|
||||
"2027": 46.025,
|
||||
"2028": 44.278,
|
||||
"2029": 42.5298,
|
||||
"2030": 40.782
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"4-UD": {
|
||||
"power": "< 170",
|
||||
"cabin": "both"
|
||||
|
||||
},
|
||||
"4-RD": {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
from app import App
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = App()
|
||||
app.get_co2_class("2020", 54.4, 'szm', '6x2', 325, "sleep")
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
|
||||
def get_vehicle_group(power, cabin, vehicle_type, axis_type):
|
||||
if power < 170:
|
||||
return "4-UD"
|
||||
elif power >= 265 and axis_type == "4x2" and vehicle_type == "lkw":
|
||||
return "4-LH"
|
||||
elif power > 170 and axis_type == "4x2":
|
||||
return "4-RD"
|
||||
elif axis_type == "6x2" and vehicle_type == "szm" and cabin == "solo":
|
||||
return "10-RD"
|
||||
elif axis_type == "6x2" and vehicle_type == "szm" and cabin == "sleep":
|
||||
return "10-LH"
|
||||
elif power >= 265 and cabin == "sleep" and axis_type == '4x2' and vehicle_type == 'szm':
|
||||
return "5-LH"
|
||||
elif power < 265 and axis_type == '4x2' and vehicle_type == 'szm':
|
||||
return "5-RD"
|
||||
elif axis_type == '6x2' and vehicle_type == 'lkw' and cabin == 'sleep':
|
||||
return "9-LH"
|
||||
elif axis_type == '6x2' and vehicle_type == 'lkw' and cabin == 'solo':
|
||||
return "9-RD"
|
||||
Loading…
Reference in New Issue