# imports the necesarry libraries
import pandas as pd
import numpy as np
# load all the data files into pandas dataframes
nycc_data = pd.read_csv("/work/Test Data/NYCC_100SOC.csv", delimiter = ',', encoding = 'cp1252')
nycc_data = nycc_data.replace(np.nan, 0)
nycc_data = nycc_data.iloc[1:,:]
nycc_data = nycc_data.astype(float)
wltc_data = pd.read_csv("/work/Test Data/WLTC_100SOC.csv", delimiter = ',', encoding = 'cp1252')
wltc_data = wltc_data.replace(np.nan, 0)
wltc_data = wltc_data.iloc[1:,:]
wltc_data = wltc_data.astype(float)
us06_data = pd.DataFrame()
us06_data = pd.read_csv("/work/Test Data/US06_50SOC.csv", delimiter = ',', encoding = 'cp1252')
us06_data = us06_data.replace(np.nan, 0)
us06_data = us06_data.iloc[1:,:]
us06_data = us06_data.astype(float)
# load duty cycles from .npy file
drive_cycles = np.load("/work/Test Data/Drive_Cycles.npy",allow_pickle=True).all()

us06_data.head(10) # feel free to replace the 5 with different number - the number you enter means the number of rows will be displayed

"""
---EXAMPLE of how to fill in the number---
battery_open_circuit_voltage = 220 # find the value of the battery OCV in the test data
-------------
"""
battery_capacity_wltc = ___ # the Prius has got a 4.4kWh battery - fill in this value
initial_StateOfCharge_wltc = ___ # find the initial battery State of Charge from the test data
final_StateOfCharge_wltc = ___ # find the final battery State of Charge from the test data
energy_used_wltc = battery_capacity_wltc * (initial_StateOfCharge_wltc - final_StateOfCharge_wltc) / 100
print("The amount of electric energy used during WLTC drive cycle is: {} Wh".format(energy_used_wltc))

# use this block to fill in data for NYCC driving cycle
battery_capacity_nycc = ___ # the Prius has got a 4.4kWh battery - fill in this value
initial_StateOfCharge_nycc = ___ # find the initial battery State of Charge from the test data
final_StateOfCharge_nycc = ___ # find the final battery State of Charge from the test data
energy_used_nycc = battery_capacity_nycc * (initial_StateOfCharge_nycc - final_StateOfCharge_nycc) / 100
print("The amount of electric energy used during NYCC drive cycle is: {} Wh".format(energy_used_nycc))

# use this block to fill in data for the US06 driving cycle
battery_capacity_us06 = ___ # the Prius has got a 4.4kWh battery - fill in this value
initial_StateOfCharge_us06 = ___ # find the initial battery State of Charge from the test data
final_StateOfCharge_us06 = ___ # find the final battery State of Charge from the test data
energy_used_us06 = battery_capacity_us06 * (initial_StateOfCharge_us06 - final_StateOfCharge_us06) / 100
print("The amount of electric energy used during US06 drive cycle is: {} Wh".format(energy_used_us06))

carbon_content_grams = ___ * ___ # find the total Fuel Consumption value from the WLTC emission report, this should be in grams and multiplied by 87% as that is the amount of carbon in fuel
amount_of_oxygen_in_air = ___ # fill in value for % of oxygen in air
oxygen_required_to_burn_fuel = carbon_content_grams * (___/___) # this is the ratio of oxygen to carbon required from the combustion equation
total_sum_of_CO2_grams = carbon_content_grams + oxygen_required_to_burn_fuel
emission_CO2_per_km = total_sum_of_CO2_grams / ___ # have a look at the Dieselnet website and try to find the length of the WLTC cycle to calculate the CO2/km
print("The amount of oxygen required to burn the fuel is {} {}".format(,total_sum_of_CO2_grams, emission_CO2_per_km))