Full text
FACULDADE DE ENGENHARIA DA UNIVERSIDADE DO PORTO Integrating Electric Buses in Conventional Public Transit: A First Appraisal Diogo Ribeiro Gomes dos Santos Mestrado Integrado em Engenharia Informática e Computação Supervisor: Rosaldo J. F. Rossetti, PhD Co-supervisor: Zafeiris Kokkinogenis, MSc July 18, 2016
Integrating Electric Buses in Conventional Public Transit: A First Appraisal Diogo Ribeiro Gomes dos Santos Mestrado Integrado em Engenharia Informática e Computação Approved in oral examination by the committee: Chair: Prof. Dr. Daniel Augusto Gama de Castro Silva External Examiner: Prof. Dr. Brígida Mónica Teixeira de Faria Supervisor: Prof. Dr. Rosaldo J. F. Rossetti July 18, 2016
Abstract Private individual transportation is becoming cumbersome and expensive, as urban traffic turns more chaotic, fuel prices increase and the effects of pollutant emissions become evident. Public transit systems are an answer to reducing the number of cars on the road. Particularly, buses are an attractive alternative, as they mostly depend on pre-existent infrastructure, having no need for complex changes. Making some of these buses electric would mean even less tailpipe emissions and cheaper consumption costs, when compared to fully conventional fleets. However, electric vehicles have disadvantages, such as lower power and autonomy, scarce recharge points on most urban networks and vehicle performance greatly dependent on route characteristics. We can solve this with a more conservative approach - using hybrid fleets, comprised by both electric and conventional buses. This dissertation intends on tackling two main aspects with this kind of fleets: estimating the performance of the integrated electric buses and obtaining optimal balances of both kinds of vehicles. To fulfil these goals, real and simulated data of a bus network in Porto, Portugal, is analysed and heuristic approaches are used to devise hybrid fleet arrangements. The conclusions of this study, supported by real data covering a large scope of the public transit network, formulate general recommendations towards sustainable urban network planning and management and result in a configuration tool for optimizing mixed bus fleets in such scenarios. The analysis shows the Porto urban network to be performance-demanding for electric buses, but their influence to be positive on fuel costs and pollutant emissions. Nonetheless, this work also makes evident the strong impact of electric vehicle autonomy and purchase prices on the return of investment for configured mixed bus fleets. i
ii
Resumo O caos urbano, a instabilidade dos preços de combustível e os efeitos cada vez mais evidentes da emissão de poluentes atmosféricos têm tornado o transporte individual privado frequentemente desagradável e dispendioso. Sistemas de transporte público são uma resposta possível para a redução do número de automóveis nas estradas; Em particular, autocarros são uma alternativa atraente, visto dependerem maioritariamente de infraestruturas pré-existentes sem necessitarem de mudanças significativas. Adicionalmente, o uso de autocarros elétricos na rede significaria uma maior redução de emissões poluentes e consumos de combustível mais baixos, quando comparado com frotas de autocarros exclusivamente convencionais. No entanto, veículos elétricos também apresentam desvantagens, tais como menor potência e autonomia, um escasso número de pontos de recarga em grande parte das redes urbanas e um desempenho altamente dependente das caraterísticas da via onde circulam. Isto poderá ser resolvido recorrendo a uma abordagem mais conservadora - frotas híbridas, constituídas por autocarros elétricos e convencionais. Nesta dissertação pretende-se abordar duas questões importantes neste tipo de frotas: como estimar o desempenho dos autocarros elétricos integrados na frota e como obter o equilíbrio ótimo entre os dois tipos de veículos. Para atingir estes objetivos, são analisados dados reais e simulados de uma rede de autocarros no Porto, Portugal, e são aplicadas abordagens heurísticas para obter a composição ideal das frotas híbridas. As conclusões deste estudo, suportado por dados reais que cobrem uma grande parte da rede de autocarros, formulam recomendações gerais para o planeamento e gestão de redes urbanas sustentáveis e resultam numa ferramenta de configuração para a otimização de frotas mistas de autocarros neste tipo de cenários. Os resultados mostram que a rede urbana da cidade do Porto é exigente no desempenho dos autocarros elétricos, mas que o seu uso leva a emissões de poluentes e custos de combustível mais reduzidos. No entanto, este trabalho torna ainda evidente o forte impacto da autonomia dos veículos elétricos e do seu preço de compra no retorno de investimento das frotas mistas de autocarros. iii
iv
Acknowledgements As several people know, the period of this dissertation was an eventful one in my life, filled with its ups and downs and with very particular moments that made me question if the Universe itself was out to get me. I would not have been as successful if it were not for all the support and rather accurate, wise, ultimately very true words I tended to ignore, that people gave me; and so, as is customary, I shall now thank everyone with generic and less-than-warm words (just kidding). First, I want to thank my parents and my sister for sort of understanding that spending several days in my pyjamas holding on to my laptop actually is, in fact, me working. On a more serious note, though, my work would have been much, much, harder if it were not for the support of my family. In addition, I want to thank my friends for listening to me when I was stressing out and for trying to help whenever they could. It is always amazing how much it helps just having someone there to listen to your rants when you need them to. Now, in a less joke-full tone, I want to thank my supervisor, Prof. Dr. Rosaldo Rossetti, for always offering me his friendship and understanding my situation when the dissertation seemed to be constantly moving slower than it should. I am also thankful for the productive discussions I had with Zafeiris Kokkinogenis, my co-supervisor, that never failed to give me new ideas to advance on my work. I also want to thank Dr. Deborah Perrotta and Tiago Azevedo for always being available whenever I needed help figuring out details regarding their past work. To finish, I want to show my enormous gratitude to Prof. Dr. Jorge Freire, whose interest in my research and fruitful suggestions led to an important collaboration with STCP. Prof. Freire’s links to STCP allowed for real bus operational data to be used in this dissertation, enhancing its results and applicability in the real world. A special thanks is also due to Pedro Gonçalves, Paulo Ferreira and Susana Silva from STCP, for their important help facilitating such a collaboration. Diogo Santos v
LIST OF FIGURES xii
List of Tables 2.1 Charging level comparison, adapted from [YK13].................. 7 2.2 General vehicle type comparison - summary . . . . . . . . . . . . . . . . . . . . 9 3.1 Relative tailpipe emission values used for different vehicle typologies . . . . . . 24 3.2 Operational costs considered for the real scenario study . . . . . . . . . . . . . . 25 3.3 Pollutant GWP and CO2equivalence........................ 26 4.1 Summary of data tables provided by STCP. . . . . . . . . . . . . . . . . . . . . 40 4.2 Excerpt of a solution description file. Last column is truncated due to the wide length of the allocation string. . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 4.3 Excerpt of a vehicle allocation details file. . . . . . . . . . . . . . . . . . . . . . 55 4.4 Example of cluster centroids. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 5.1 Reference of input values used and respective sources. . . . . . . . . . . . . . . 62 5.2 Baseline values table for solutions with vehicle purchase cost included and with minimumemissions. ................................ 63 5.3 Mixed fleet values table for solutions with vehicle purchase cost included and with minimumemissions. ................................ 63 5.4 Baseline values table for solutions with vehicle purchase cost included and with minimumtotalcost.................................. 64 5.5 Mixed fleet values table for solutions with vehicle purchase cost included and with minimumtotalcost.................................. 64 5.6 Baseline values table for solutions with vehicle purchase cost included and median emissions and total cost values. . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5.7 Mixed fleet values table for solutions with vehicle purchase cost included and median emissions and total cost values. . . . . . . . . . . . . . . . . . . . . . . 64 5.8 Baseline values table for solutions with no vehicle purchase costs and with minimumemissions.................................... 66 5.9 Mixed fleet values table for solutions with no vehicle purchase costs and with minimumemissions. ................................ 66 5.10 Reduction from baseline values for an emissions reduction favouring tradeoff (purchasecostsnotconsidered).............................. 66 5.11 Emission and cost reduction for emissions reduction favouring solution type, in comparison with the baseline values. . . . . . . . . . . . . . . . . . . . . . . . . 66 5.12 Baseline values table for solutions with no vehicle purchase costs and with minimumcosts. ..................................... 67 5.13 Mixed fleet values table for solutions with no vehicle purchase costs and with minimumcosts.................................... 67 xiii
LIST OF TABLES 5.14 Reduction from baseline values for a total cost favouring tradeoff (purchase costs notconsidered).................................... 67 5.15 Emission and cost reduction for total cost reduction favouring solution type, in comparison with the baseline values. . . . . . . . . . . . . . . . . . . . . . . . . 67 5.16 Baseline values table for solutions with no vehicle purchase costs and median emissions and total cost values. . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.17 Mixed fleet values table for solutions with no vehicle purchase costs and median emissions and total cost values. . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.18 Reduction from baseline values for middle-ground (median) solutions (purchase costsnotconsidered)................................. 69 5.19 Emission and cost reduction for median valued solution type, in comparison with thebaselinevalues. ................................. 69 5.20 Centroid values for a k = 3 k-means clustering. . . . . . . . . . . . . . . . . . . 76 5.21 Trip distribution per cluster. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 5.22 Line distribution per cluster. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.23 Distribution of electric bus trips per cluster, for the three solution typologies, not considering vehicle purchase costs. . . . . . . . . . . . . . . . . . . . . . . . . . 79 B.1 Example solution summary file for the operations day of 10/05/2016, not considering vehicle purchase costs. Only the first five solutions are shown. . . . . . . . 106 B.2 Excerpt of an example solution vehicle-to-trips allocation file for the operations day of 10/05/2016, not considering vehicle purchase costs. . . . . . . . . . . . . 107 xiv
Abbreviations ACO Ant Colony Optimization API Application Programming Interface BEV Battery-Electric Vehicle CNG Compressed Natural Gas CO2e Carbon Dioxide Equivalent CV Conventional Vehicle DSS Decision Support System EV Electric Vehicle E-VRPTWMF Electric Vehicle Routing Problem with Time Windows and Mixed Fleet FEV Full Electric Vehicle FIFO First-In-First-Out FUT Future Urban Transport G2V Grid-to-Vehicle GHG Green House Gas GVRP Green Vehicle Routing Problem GWP Global Warming Potential HBEFA Handbook Emission Factors for Road Transport HEV Hybrid Electric Vehicle HLA High Level Architecture IACO Inverted Ant Colony Optimization ICEV Internal Combustion Engine Vehicle ITS Intelligent Transportation Systems MAS Multi-Agent System MOEA Multi-Objective Evolutionary Algorithm PHEV Plug-in Hybrid Electric Vehicle PRP Pollution Routing Problem RTI Run-Time Infrastructure STCP Sociedade de Transportes Coletivos do Porto SWOT Strengths, Weaknesses, Opportunities and Threats TTW Tank-To-Wheel V2G Vehicle-to-Grid TraSMAPI Traffic Simulation Management Application Programming Interface VRP Vehicle Routing Problem VRPRL Vehicle Routing Problem in Reverse Logistics WTT Well-To-Tank xv
Chapter 1 Introduction 1.1 Context It is difficult to deny that the number of vehicles in the roads has been growing incessantly over the years. A recent study by Navigant Research [Nav16] estimates the number of light-duty vehicles being driven today to be near 1.2 billion. Passenger car production worldwide in 2014 surmounted to 72.3 million, with a tendency to grow about 4% every year [Eur16a]. The previously mentioned study by Navigant points out around 89 million light-duty vehicles sold in 2015, predicting that number to grow yearly until reaching 123 million in 2035. The magnitude of these numbers is worrying, as situations of complete urban chaos are increasingly frequent in the world’s major cities, propping up the stress of daily commutes, intensifying city infrastructure issues and impacting negatively many areas of economic activity. Even worse, population health is critically affected, both psychologically due to the rising stress levels, as well as physically, consequence of rising pollution levels. Pollution is another major concern with the current trends in urban transportation. As of today, the large majority of vehicles in the road use conventional internal combustion engines, which emit significant amounts of greenhouse gases. The 2015 United Nations Conference on Climate Change, held in Paris towards the end of 2015, was highlighted by the historic recognition by many of the world’s nations of the urgent need to reduce worldwide greenhouse gas emissions, which are currently projected to reach 55 gigatonnes by 2030. In the conference, 195 countries adopted the Paris Agreement [Uni15]. Among other goals, the involved parties compromised to reduce the emission levels to at least below 40 gigatonnes by 2030, achieving an average temperature below 2ºC above pre-industrial levels, and ideally to 1.5ºC above those levels. The involved parties recognized that this action has the potential to significantly reduce the risks and impacts of climate change. Another important result of the conference was the convergence of several companies, cities, 1
Introduction national governments and associations to sign the Paris Declaration on Electro-Mobility and Climate Change & Call to Action [Lim15]. Involved right from the start were Tesla Motors, Michelin, Nissan-Renault, the United Nations Environment Programme and the International Energy Agency, who recognized that transportation has the highest growth in CO2emissions of any industrial sector. In order to achieve the greenhouse gas reduction goal proposed in the conference, the parties agreed that at least 20% of all road vehicles (cars, trucks, buses and others) must be electric-powered by 2030, in conjunction with the proliferation of low-carbon methods for energy production. A plausible way to reduce the number of private passenger vehicles in the roads is the implementation and incentive for usage of robust public transport infrastructures such as bus transportation. If we consider each bus to be able to carry around 40 people, and that a light-weight passenger vehicle can carry around 4 people (although in daily commutes it is often seen cars with only one or two passengers), each bus can eliminate, on average, 10 cars from the road. Allying this idea with that of transport electrification for emission reduction, an interesting solution to both urban chaos and the rising pollution levels resulting from transportation is that of electric buses in public transport. It is, however, important to recognize that electric vehicles are not a “one-size-fits-all” solution, as Ribberink and Entchev [RE] accurately point out. First, it is too idealistic to consider feasible for a transportation entity to completely replace their existing conventional vehicle fleets by electric ones. Second, as Ribberink and Entchev mention in their study, a large, sudden proliferation of electric vehicles will impose a significant load on the existing power grid. Besides the problem of unexpected economical impacts, some power grids in the world are still highly dependent on carbon-based methods of energy production, such as coal and natural gas burning. As such, the rising demand to generate electricity to supply all electric vehicles may turn out to have a larger negative impact on the environment when compared to the current conventional vehicle panorama. Besides those pressing issues, there are other concerns when using electric vehicles, such as their higher entry cost and lower autonomy when compared to conventional vehicles. In addition, there are dependencies on road topology due to energy consumption variations. Lastly, there is the issue of possible shortage of charging stations and necessary time to fully recharge a battery. Given all this, it is important to investigate approaches to mitigate these shortcomings. Fleet management is an important field of operations for goals such as balancing mixed fleets composed of both electric and conventional buses, to minimise possible economical and ecological impacts. Route management can help optimize electric vehicle range and energy efficiency. Lastly, optimizing the distribution of charging stations and the scheduling of vehicle recharging can minimise issues even in regions where stations are scarce. All of these considerations belong to the transportation management field of research and are often approached in the more recent field of Intelligent Transportation Systems. Many research efforts have been dedicated to improving transportation systems as a whole, as well as dealing with the current shortcomings of electric vehicles. This dissertation intends on providing an overview of those efforts and propose solutions that could help planning and building 2
Introduction sustainable transportation systems, with recourse to electric buses. 1.2 Motivation and Goals Besides the environmental and economical incentives for this work, it is motivated by the evergrowing potential of Intelligent Transportation Systems. Public transport already contributes to making cities more peaceful by often bypassing the inherent stress of driving a vehicle in rushhour congested roads. However, not enough attention seems to be devoted to buses in particular. By bringing electrification to buses in a robust, optimized, smart way, the well-being of the whole urban network benefits. In addition, the specific issue addressed by this work - mixed bus typology fleet management - seems to be underexplored in current literature. Thus, the opportunity to bridge such an important gap brings further appeal to its development. The main goal of this dissertation is to explore different approaches to optimizing the performance of mixed bus fleets (of electric and conventional vehicles), taking into consideration pollutant emissions and energy consumption, without sacrificing service quality. This goal can be divided in several, more specific, ones: • To analyse state-of-the-art approaches in transport system management, with focus on electric vehicle operations, their simulation and optimization; • To create reliable and realistic simulation configurations on which to evaluate and compare developments; • To analyse bus trips and their impact on electric bus performance; • Ultimately, to study the best options to implement flexible and well balanced vehicle fleets of electric and conventional buses, while promoting system sustainability. 1.3 Dissertation Outline The remainder of this document is structured into five chapters. Chapter 2presents a review on important operations and tools on the topic of electric vehicle management for sustainable transportation. Chapter 3starts by stating the main problem approached by this dissertation. It then proposes a formalization of the mixed bus fleet problem applied to real scenario data and a solution approach using evolutionary algorithms. This chapter also proposes an approach for route profiling using clustering methodologies and finishes by describing briefly how microscopic traffic simulation could be used to analyse new problem scenarios. Chapter 4provides technical details on the developments during the course of the dissertation work. These include the description of the data selection and preparation process, details on microscopic traffic and bus powertrain simulation, notes on the implementation of the evolutionary algorithm based solver and specifics regarding the K-means clustering methodology used. Chapter 5describes the main results of this 3
Introduction work, along with their analysis and discussion. Lastly, in Chapter 6, conclusions regarding this work are drawn, the main contributions of this dissertation are described, and recommendations for further developments are proposed. 4
Chapter 2 Sustainable transportation - a review on electric vehicle management operations and tools Electric vehicle operations in urban networks is a broad subject, encompassing concepts from research areas of alternative fuel vehicles, transportation management, intelligent transportation systems (ITS), operations research, simulation and modelling, amongst others. Literature on subjects relating to transportation management, for instance, can be found since the early 1980’s, examples of such being research on classical fleet composition and routing problems. This means a large amount of concepts have been developed ever since, being fundamental the review of the current state-of-the-art in order to better understand where this dissertation is framed within the various related research areas. This chapter intends on providing the reader with an overview of which can be considered the cornerstone concepts behind the dissertation: electric vehicles, hybrid electric vehicles and their comparison with conventional vehicles, in section 2.1; transport systems simulation and modelling, in section 2.2; and electric (and conventional) vehicle management in section 2.3. As contributions from this chapter we expect: • A wide coverage of important concepts in research areas related to transport system management and sustainable transportation; • Some brief, high level discussion of possible approaches and tools presented in the literature; • The highlighting of possible reference literature for the surveyed concepts, for readers wishing to further consolidate their knowledge on the subjects. 5
Sustainable transportation - a review on electric vehicle management operations and tools generic approach may be desired in order to facilitate switching the tools being used at any time. With this purpose in mind, this subsection presents to the reader two possibilities, first explored by J. Macedo in 2013 [Mac13]: a High Level Architecture (HLA) based approach and the adoption of TraSMAPI - Traffic Simulation Management Application Programming Interface. HLA - High Level Architecture is an IEEE software standard with the objective of providing a common architecture for distributed modelling and simulation systems [KWD99]. A Run-Time Infrastructure (RTI) defines how the different simulation systems interact, by providing a specification compliant common API. The participating systems in the HLA are called federates, which interact within a federation. A HLA is typically composed of three components: • A federate interface specification, which describes the services the federates need to use and provide for intercommunication throughout the RTI middleware. Interaction between federates and the RTI is made through ambassadors, which are objects with needed methods for interfacing communication. •Framework and rules, which are the set of rules that need to be respected in order to ensure proper interaction between federates within a federation. These rules define the overall architecture of the encompassing simulation and thus the responsibilities of the federates and the federation. • An Object model template specification that describes the format and syntax of all the data transferred between federates. The correct implementation of a HLA should allow for the seamless communication between different systems. In his work, Macedo [Mac13] used such an implementation to integrate SUMO for microscopic traffic simulation and a MATLAB / Simulink model of an electric bus powertrain subsystem. For that specific case, the author used the commercial package Pitch pRTI [Pit16] that implements the IEEE HLA standard. In a follow-up work, Macedo et al. [MKS+] further discuss the implementation of a HLA-based distributed architecture for electric bus powertrain simulation in dynamic urban mobility settings. The authors conclude on its flexibility and potential of bringing together automotive and transportation research in future urban transport system scenarios. Azevedo et al. [ARB16] also discuss the possibility of cloud-based Simulation as a Service using HLA based approaches. TraSMAPI - Traffic Simulation Management Application Programming Interface is a tool for the simulation of dynamic control systems in urban networks, focusing on Multi-Agent Systems (MAS) [TARO,TARO12]. It allows for real-time communication between microscopic simulators while also providing a framework for the development of MAS solutions that communicate with the underlying simulator systems. TraSMAPI offers three modules in its architecture: the Communication module, providing the abstraction layer for interaction between the simulators, the Statistics module, that stores important information from the simulators and enables its 12
Sustainable transportation - a review on electric vehicle management operations and tools access, and the aforementioned MAS module. Particularly relevant to this discussion is the Communication module. This module offers a common Application Programming Interface (API) that the simulation systems can use in order to communicate. This communication is achieved via sockets. Macedo validated this approach in a similar environment as the previously mentioned HLA. The author validated the system on the integration of a SUMO simulation with a MATLAB / Simulink model for an electric bus powertrain subsystem. According to the author, the usage of TraSMAPI proves to be useful for integrating MAS solutions with different simulation paradigms and allowing data exchanges between multiple simulation models. 2.3 Main components of electric vehicle management This section intends on reviewing work relating to some of the main aspects of (electric) vehicle operation management in transportation systems. Mehar et al. [MZRS15] proposed a Sustainable Transportation Management System, of which three types of applications were identified: • Fleet management systems; • Itinerary planning applications; • Grid-to-Vehicle (G2V) and Vehicle-to-Grid management (V2G) systems and charging stations’ reservation solutions. This description was found to be comprehensive and the work, overall, complete. As such, a similar concept was adopted for the structure of this literature review section, with some adaptation as follows. • The fleet management subsection will focus on surveying fleet resource allocation and balancing methodologies. • Itinerary planning will be considered in the route management subsection, where a brief review of work essentially relating to vehicle itineraries and the vehicle routing problem (VRP) will be performed. Some focus will be given to work considering electric vehicles, buses, or otherwise “green” (considering emission and energy consumption reduction) approaches to route management. • Lastly, for the scope of this dissertation, G2V and V2G interactions will be simplified to charging station management. In this subsection, a survey of approaches to the distribution of charging stations and the management of simultaneously charging vehicles will be performed. 2.3.1 Fleet management Fleet management consists in managing fleet activity on different strategical, tactical and operational levels, for different transport modes and concerning a wide array of tasks, such as vehicle 13
Sustainable transportation - a review on electric vehicle management operations and tools routing, fleet composition, vehicle scheduling and fleet monitoring. Vehicle routing, in specific, will be reviewed in section 2.3.2. Bielli et al. [BBR11] performed a survey regarding main trends in models and algorithms for fleet management. This survey identified some of the most relevant problems in fleet management regarding different transport modes and contributions to their solution. Bielli et al. recognized the class of fleet composition problems, where the fleets being optimized are heterogeneous, that is, composed of a mix of different vehicle types. The objective in this kind of problems is determining the optimal number of vehicles of each type and their task distribution and ordering. Hoff et al. [HAC+10] surveyed industrial aspects regarding fleet composition and routing. The survey covers a large amount of work ranging from 1982 to 2008 regarding several instances of heterogeneous fleet composition problems. Methods identified include statistical methods, dynamic programming, several heuristic algorithms like tabu search and simulated annealing, and integer programming based methods. More recently, Koç et al. [KBJL16] reviewed work from the past thirty years concerning heterogeneous vehicle routing, which inevitably deals with strict fleet composition issues. It is important to point out some work regarding efforts of GHG emission and energy consumption reduction and electric vehicles in fleet management. Rémy et al. [RMS+] propose a green fleet management architecture that collects data from road characteristics, weather, fleet monitoring and driver behaviour monitoring to optimize fuel economy in transport. Sharing similar concepts, Jossé et al. [JSZ15] propose EasyEV, a monitoring and querying system for electric vehicles, especially designed to manage the sharing of a car fleet between multiple drivers. This system, in usage in three German cities at the time of its writing, is capable of informing fleet managers of potential problems and anomalies with the fleet. For the car drivers, real time data regarding charging stations, itineraries and other information is provided. Kurzcvezil et al. [KSB] propose the usage of simulation models for the assessment of time tables, network topology, optimal vehicle types and infrastructure for optimization of bus operations in an urban network. Li et al. [LLC15] proposed an analysis of the remaining life additional benefit-cost of vehicle fleets for bus fleet management. This work took into consideration emission reduction and the possibility of retrofitting or replacing existing vehicles before their expected retirement. In addition, the study assessed monetary costs in order to ascertain needed subsidies from the government, integrating the analysis in a case study in the city of Hong Kong. Also relating to bus fleets, Ribau et al. [RSS15] propose a multi-objective genetic algorithm to find optimal substitutes to diesel-based buses, considering electric and hybrid alternatives, in order to reduce the carbon footprint and minimise negative financial impacts. Authors report reductions up to 50% in the carbon footprint in an example Lisbon urban fleet originally composed of several ICEVs. Still relating to alternative energy vehicle usage in bus fleets, Ercan et al. [EZTP15] propose a multi-objective linear programming approach to detect optimal bus fleet combinations. Their 14
Sustainable transportation - a review on electric vehicle management operations and tools results indicate useful fleet management advices like the usage of full electric vehicles when planning high fuel consumption driving cycles and the possibility of more heterogeneous fleets in others. Jiménez and Román [JR16] devised a methodology based on mixed integer linear programming for the assignment of an heterogeneous bus fleet to a set of different fixed routes in order to reduce the emissions of different GHGs. The authors claim to be able to successfully reduce the emissions of some of the gases without compromising the emissions of others. 2.3.2 Route management This subsection presents relevant literature relating to vehicle routing and itinerary planning, mostly integrated as examples of the Vehicle Routing Problem (VRP). The classical VRP aims to design optimal delivery routes for each vehicle in an homogeneous fleet, from a central depot, in order to satisfy the demands of each customer exactly once. Each vehicle must start and end the route in the depot and ensure its capacity is not exceeded. As shown in the comprehensive review by Braekers et al. [BRVN], the classical VRP has seen many extensions over the years, by the introduction of real-life characteristics, such as the Heterogeneous Fleet VRP (HFVRP), also referred to by Mixed Fleet VRP, or the addition of Time Windows (VRPTW) to ensure delivery to customers in a given time frame. The combination of multiple real-life aspects gives rise to the class of “rich” vehicle routing problems. The work by Braekers et al. reviews literature ranging from 2009 to 2015 addressing these and several other types of vehicle routing problems, classifying them according to a detailed taxonomy. The authors’ studies found a predomination of metaheuristic models in the reviewed literature, followed by exact and classical heuristic methods, real-time solution methods and simulation based ones. While the analysed publications mostly considered generic instances of the several VRP variants, no special considerations being taken relating to “green” itineraries, electric vehicles or bus routing, they still serve as a useful basis to better understand these specific variants. As mentioned in the previous subsection, Koç et al. [KBJL16] also performed a comprehensive review of multiple vehicle routing problem variants, in this case focusing on the case for heterogeneous vehicle fleets. The authors reviewed variants such as routing with multiple depots, “green” itineraries, open VRPs and several others. Solutions surveyed included meta and classical heuristics, integer and mixed integer programming, exact methods and others. The authors consider these variants of the VRP with heterogeneous vehicle fleets to have reached maturity and near optimality in their solutions, with focus starting to change towards rich routing problems with multiple simultaneous real-life characteristics. However, they point out the need for further research when considering “green” variants of the problems. Regarding “green” VRPs, Lin et al. [LCH+14] performed a review on the state of the art for these kinds of problems. The authors renewed the existing taxonomy on “green” VRPs, by further classifying these as Green-VRPs - optimizing energy consumption, Pollution Routing Problems (PRP) - focusing on pollutant reduction and VRP in Reverse Logistics (VRPRL) - dealing primarily with the recycling of waste and end-of-life goods. The authors concluded that, while 15
Sustainable transportation - a review on electric vehicle management operations and tools growing, the GVRP research area is still limited, possibly due to the necessity of interdisciplinary approaches, concerning energy consumption, environmental impacts, public policies and transport system management. In addition, they point out the reliance of existing methodologies in idealistic models, not necessarily corresponding to reality. In the subject of electric vehicle routing, Schneider et al. [SSG14] considered electric vehicles with limited batteries and the possibility of en-route recharging on fixed charging stations. This resulted in the specific problem of integrating recharging stations into a VRP with time windows. The proposed solution consisted in a hybrid metaheuristic composed of Variable Neighborhood Search and Tabu Search. The authors tested the solution in several benchmarks, claiming good performance in these. Goeke and Schneider [GS15] build on the previous work and introduce mixed fleets of electric and internal combustion vehicles, proposing the Electric Vehicle Routing Problem with Time Windows and Mixed Fleet (E-VRPTWMF). Considerations about en-route recharging are also taken, along with time window and capacity considerations and taking into account energy consumption. The authors incorporate a realistic energy consumption model that accounts for speed, road grade and cargo load distribution. The proposed solution for the E-VRPTWMF consisted in an Adaptive Large Neighbourhood Search, exhaustively described by the authors in their work. The experiments performed by the authors showed improvements in comparison to the previous best known solution in aspects such as total run time and travelled distance. Considering electric buses, Perrotta et al. [PMR+14] analyse a simulation-based case study in Porto for electric bus routing. In this analysis, important factors to take into consideration when planning itineraries for electric buses are identified, such as the impact of road topography, distance between bus stops, total length of the route and effects of regenerative braking in the vehicles. Attempting to represent urban networks more realistically, managing uncertainty and timedependent characteristics of urbna traffic, Peng et al. [PHTD+] propose a method to build a stochastic time-dependent model for public transit networks, ensuring the first-in-first-out (FIFO) properties of buses. This model also takes into account travel time and waiting time for the service, as well as its reliability, and is built using real data recorded from all bus lines in Singapore, over a period of three months in 2011. In addition, the authors developed a dynamic route planner, which they named DEPART, that uses an adapted multi-criteria shortest path algorithm to plan optimal routes according to travel time and reliability. Peng et al. tested DEPART on the mentioned real data from Singapore, claiming a better adaptation of traffic situations when compared to other approaches. Lastly, it is worth noting that route planning does not always need to be performed on strategical, pre-operational levels, as most of the mentioned approaches are. Real-time route advising is also possible, adapting to unexpected situations, such as traffic congestion, road blockage or accidents. An example of such a possibility is the work of Dias et al. [DMSA14]. The authors propose an Inverted Ant Colony Optimization (IACO) algorithm, inverting the logic of pheromone attraction of the better known Ant Colony Optimization (ACO) algorithm into a “repulsion” effect. 16
Sustainable transportation - a review on electric vehicle management operations and tools This effect simulates drivers’ “repulsion” to highly congested roads, essentially allowing for a decentralized, real-time traffic management solution where traffic density is more evenly distributed. The approach was tested using simulated artificial and reality-based urban networks and compared against shortest / fastest path algorithms. Results showed a decrease in average trip times of up to 84% for vehicles compliant to the algorithm, and up to 71% for the remaining. CO2emissions were also shown to decrease from 8% to 49%. 2.3.3 Charging station management Charging station management is an important subject to take into consideration when operating electric vehicles. As described in section 2.1, comparatively short electric vehicle range and low availability of charging stations are critical aspects in the current EV panorama. As such, this review intends on addressing two relevant issues: localization models for charging stations and charging scheduling considering multiple criteria. Baouche et al. [BBTEF14] identify two main sub-topics when allocating charging stations: choosing the type of station and the number of charging stations to consider. The authors performed a review of location models, where they concluded that most of the proposed methods are derived from resources/work sites location and Emergency Medical Services. In addition, they identified that several publications on location problems were based on variants of the set covering problem. Approaches to the problem include Lagrangian relaxation with branch and bound, greedy approaches, median and dispersion models and others. The authors proposed their own modelling approach based on an adaptation of the fixed charge location model with a p-dispersion constraint. The model considered specific EV related factors that influence their range and energy consumption, derived from realistic consumption models. Robust experimentation and a sensitivity analysis on the city of Lyon, France, show that the model is scalable and realistic, adapting the results to different scales of EV penetration in the urban network. While not considering the scheduling of multiple vehicles in the same charging station, but instead the charging scheduling of EVs in the whole smart grid, Yang et al. [YLF15] perform an extensive review of scheduling methods considering multiple criteria. Scheduling objectives reviewed included cost minimisation, welfare maximisation, power loss minimisation, emission reduction, battery performance optimization, among others. For the satisfaction of those objectives, analysed methods comprised of conventional mathematical optimisation methods such as linear and non-linear programming and mixed integer programming and meta-heuristic approaches such as genetic algorithms and particle swarm optimisation. The review compared the different approaches in the literature, summarising the main advantages and disadvantages of each. The comparison seems to indicate generally lower flexibility and performance of the mathematical approaches when compared with meta-heuristic ones. Hu et al. [HMSL16] provide an overview of electric vehicle fleet management from the point of view of smart grid optimization. The authors review and classify different methods of smart 17
Sustainable transportation - a review on electric vehicle management operations and tools charging for both G2V and V2G contexts for fleet operators, taking into consideration the relationship with four other important actors in smart grids: the transmission system operator, the distribution system operator, the renewable energy source supplier and the electric vehicle owner. The review concentrates mostly on the optimization of energy costs and profit, load balancing, power loss reduction and grid congestion management. Considering that the main focus of the work is optimizing utility for the smart grid, not many considerations are made towards directly benefiting the transport network itself, such as by reducing charging times, maximizing fleet vehicle range or preventing vehicle queuing. Nonetheless, the various optimization criteria and methodologies analysed in the review may prove interesting to take into consideration when improving charging point distribution and scheduling. Similarly, several other reviews analyse work focused on power grid related issues. Richardson [Ric13] cites EV-grid models commonly used in the literature and discusses key-findings regarding EV impacts and performance on the power grid. Another interesting subject is the review on work integrating EVs with renewable energy and corresponding useful V2G interactions. Still on the topic of V2G and renewable energy, Mwasilu et al. [MJK+14] review infrastructure concerns and study the feasibility of such integrations. Liu et al. [LKL+15] review EV interaction with renewable energy sources in smart grids, taking into consideration emission reduction, utilization optimization and cost-awareness. 2.4 Summary This chapter reviewed some basic concepts useful to contextualize the reader in the subject of vehicle management and tools, with focus on electric vehicles and sustainable transportation: a background on electric and hybrid electric vehicles was given, along with a comparison against their conventional counterparts; concepts and examples of transport systems simulation were discussed, both regarding urban network simulation and vehicle modelling; lastly, important components in electric vehicle management, such as fleet management, route management and charging station management were presented. Due to the main focus of this dissertation, during the reviewed concepts there was an attempt to maintain the connection both with electric vehicles and public transport / bus fleet subjects. However, most of the literature found either made little mention of specific electric vehicle concerns - as, for example, in the classical fleet and route management works - or did not consider electrification of public transport and buses in particular - especially noticeable in the background section of this review, as most of the literature concentrates in private or lightweight, individualconsumer grade vehicles. While this does not mean that this literature does not exist - instead that it was not found during the review - it presents an opportunity to further elaborate on these subjects. As such, the work of this dissertation intends on coping possible shortcomings in Section 2.2 by making use of realistic simulation scenarios for electric buses in urban networks and in Section 2.3 by proposing, implementing, testing and comparing different algorithms regarding fleet, route 18
Sustainable transportation - a review on electric vehicle management operations and tools and charging point management. Naturally, the focus on electric and conventional bus fleets may help to further consolidate Section 2.1 with specific concepts regarding public transport. All considered, we hope that this review proved useful for the reader to further understand the current state-of-the-art regarding electric vehicle operations in modern urban networks and what gaps this dissertation has an opportunity to bridge in the current panorama. 19
Sustainable transportation - a review on electric vehicle management operations and tools 20
Chapter 3 Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach This chapter identifies the underlying problem this dissertation intends on solving and describes the methodology followed to approach it. As seen in the previous chapter, interesting literature exists on the problem of optimizing electric vehicles in urban networks. However, (i) electric vehicles applied to public transit bus fleets are a less approached subject and (ii) electric vehicles are seldom studied inserted into fleets of other, conventional, vehicles. Taking these issues into consideration, this dissertation proposes the optimization of mixed or hybrid bus fleets in public transit. These fleets are composed not only of the mentioned electric vehicles, but also of conventional vehicles, such as Diesel or Compressed Natural Gas (CNG) based ones. This necessity arises from the desire to consider the present economical reality and the viability of using electric vehicles in public transit. As such, efforts were taken in order to make sure the tackled problem represented the present reality as close as possible. Besides the study being based primarily on realistic data provided by STCP - Sociedade de Transportes Colectivos do Porto, the main bus transportation company in Porto, Portugal, attempts to retrieve other data from up-to-date and trustworthy sources were made. The chapter is structured as follows. First an overview of the problem is presented, along with the main questions being answered by this dissertation. Then, the main approach, using real operational data, is described, specifying the studied inputs, the theoretical modelling of the problem as a multi-variable, multi-objective optimization problem and the proposed solution using a multi-objective evolutionary algorithm. After this, it is described an approach to profile different bus routes using clustering methodologies, with the intent on generating route profiles for bus routes operational data is not available for. Lastly, a possible approach to generate new problem scenarios using microscopic simulation is presented. 21
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach |Vcng| |V|≤rcng,Vcng ={v|v=1}(3.13) |Vdiesel| |V|≤rdiesel,Vdiesel ={v|v=2}(3.14) Equation 3.10 defines the first objective to be minimised, the total pollutant emissions during the period of operations for the fleet of vehicles configured, E(V). To remind, these pollutant emissions are composed of CO2, CO and NOx emissions, converted to carbon dioxide equivalent units. Equation 3.11 defines the second objective, the total cost for the operations period and configured vehicle fleet, C(V), including initial cost to acquire each different vehicle and possible discounts in purchase and fuel prices. Some constraints are also needed to assure the validity of the problem. Constraint 3.12 assures no electric vehicle performs a set of trips that exceeds its total battery autonomy. Constraints 3.13 and 3.14 allow the specification of a maximum ratio of CNG and Diesel vehicles, respectively, to be used in the fleet. 3.2.3 A solution approach using evolutionary algorithms Multi-objective optimization problems are frequently solved using evolutionary algorithms, in the literature. With each extra objective to optimize, the computational complexity grows and the number of possible solutions grows as well; Usually, a single, optimal solution ceases to exist and we need to consider a Pareto frontier of solutions [CLV06, Chapter 1]. As previously mentioned, this frontier represents the different solutions for which it is impossible to improve any objective without making at least one of the others worse. Finding all the Pareto optimal solutions may be time and resource demanding for classical, deterministic approaches. As such, meta-heuristics like evolutionary algorithms strive to find an approximation set for the Pareto frontier. Diesel buses, while cheaper, are often more pollutant than their electric and compressed natural gas counterparts. Due to this, there are necessary tradeoffs between pollutant emissions and cost reduction. This prevents us from obtaining a single optimal solution for the allocation of bus typologies to trips in any period of operations, showing the usefulness of obtaining a Pareto frontier of solutions. The number of vehicles in the bus fleet represents the number of decision variables in our optimization problem. Since this number varies with the scenario being studied, growing large if more than a single day is considered, evolutionary algorithms seem like a good first approach. As such, an open-source, multi-objective evolutionary algorithm library was used in order to quickly implement an algorithm to solve our specific problem [Had16]. Due to its compatibility with multiple problem formulations, according to the library documentation, a variation of the Nondominated Sorting Genetic Algorithm (NSGA) [SD94] [CLV06, Chapter 2.3.2], called NSGA-III [DJ14] was used. The authors of NSGA-III describe the procedure to be consistently efficient with multiple problems and an increasing number of optimization objectives. This gives an assurance that the approach currently developed in this dissertation could be scaled to a larger 28
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach number of objectives in the future, by using NSGA-III. In addition, the algorithm can be configured with a smaller set of parameters than similar approaches, meaning it would be simpler to fine-tune this approach as a decision making tool for specific scenarios. Since performance issues were not critical for the present work, the algorithm was run using default library parameters. For further theoretical details regarding the NSGA and NSGA-III algorithms, the reader is advised to consult the referred original works. For specific details regarding the usage of the library and implementation of the solver, for the present scenario, the reader is referred to Chapter 4. 3.3 A Clustering Based Approach for Trip Profiling The extensive trip-by-trip data analysis that, at a first look, appears to be needed in order to follow the approach mentioned in the previous subsection may not be possible. Reasons for this include data unavailability (e.g. new bus routes that have not been subject to studies, entirely different study regions or significantly different time periods) or lack of resources (time or otherwise) to analyse large amounts of data. This section intends on proposing a data-mining approach to profile and classify bus trips in order to provide sufficient data for mixed-fleet implementation studies. The main objective of this approach is to use cluster analysis [KR09] in order to find relevant clusters of bus trips with specific characteristics. While pre-existent bus trip data is needed in order to perform the actual analysis and discovering the cluster models, these can be used, in the future, to classify less-studied bus trips and estimate their profile. An important distinction to be made is the one of bus route against bus trip. A route, in this work, is considered to be a fixed path a bus travels. A route has its own characteristics, such as the route topology, location of bus stops during its course, total length, among others. A specific route can be travelled in different scenarios, however. For example, the same route travelled during rush hour can take longer and have a greater exertion on the bus performance than in a calmer situation. To the travels a bus performs on a single route but under different situations (usually at different time periods) we call trips. 3.3.1 Input data description First we start by describing what sort of input data is proposed to be used in order train the characteristic cluster model. This input data was selected on the basis of what sort of characteristics in a bus trip’s profile are more likely to impact electric vehicle performance. As such, for each trip, it is of interest to consider: • The average velocity; • Number of acceleration moments; • Number of deceleration moments; 29
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach • Average acceleration; • Average deceleration; • Number of ascents along the route; • Number of descents along the route; • Average ascent; • Average descent; • Total trip length; • Estimated electric bus energy consumption for the trip; • Estimated electric bus battery level variation for the trip. The units used for the input data are irrelevant, as long as the entire data set uses the same units. In addition, the resulting clusters must be analysed using the same units. Input data should also be normalized to the same magnitude to prevent some characteristics having a larger weight than others when clustering. 3.3.2 Clustering methodology The specific set of steps proposed to perform the data clustering is described here. First, if the input data set being used to train the cluster model has more characteristics than the ones previously described, the extra data needs to be filtered out. Secondly, trips with missing characteristics cannot be used as training data and must be filtered out as well (e.g. trips for which energy consumption values are not known). After this, any non-numerical characteristics (for example, dates) must be converted into some sort of numerical representation prior to usage (specifically if K-means clustering is being employed, as described next). These few initial steps guarantee that the data is prepared to be supplied into the clustering algorithm. K-means clustering The clustering algorithm proposed in this work is the K-means clustering [HW79]. The basis of this algorithm is grouping the data in Kdifferent clusters in order to maximize the similarity of the elements within a cluster and the dissimilarity between elements of different clusters. The similarity between elements is based on a measure of the distance between them, like the Euclidean distance or the Bregman divergence [DD09] (the latter used in this project). Briefly speaking, the K-means algorithm starts by selecting Kdifferent points that will act as the centroids of the Kpotential clusters. A cluster centroid is a point for which each attribute value is the average value of the same attribute for all the elements in the cluster. After picking these K centroids, we assign each data example to the cluster with the nearest valued centroid (using the 30
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach distance measure). After this, we recalculate the centroids and repeat the same procedure until the centroids no longer change between iterations. In sum (adapted from the RapidMiner platform documentation [Rap16]): 1. Choose a value of K; 2. Select Kdata points to use as the initial set of Kcentroids; 3. Assign each one of the data records to the cluster with the nearest centroid, using the distance measure; 4. Recalculate the centroids of the Kclusters; 5. Repeat steps 3 and 4 until the centroids no longer change. K-means is suggested for this approach due to its simplicity of usage and generally good results. The next figures show two examples of interesting data retrieved using the clustering approach. Figure 3.1 shows a bar plot of the average energy consumption per cluster, while Figure 3.2 shows a scatter plot of the distribution of energy consumption relative to the number of ascents in a trip, grouped by cluster. Figure 3.1: Average energy consumption per cluster. 3.3.3 Considerations on the usage of cluster information Now follows some advice on using the information retrieved from the created cluster models. 31
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach Figure 3.2: Distribution of energy consumption relative to the number of ascents in a trip, grouped by cluster. Depending on the choice of the number of clusters (K) and on the actual values of the data provided, the cluster interpretation can vary greatly. For example, for a K=3 value, one of the obtained cluster models during this study grouped the trips the following way: 1. Trips with comparatively high average velocity, low number of accelerations and decelerations and low energy consumption; 2. Trips with comparatively low average velocity but a medium number of accelerations and decelerations and a higher number of ascents and descents, corresponding to medium energy consumption; 3. Long trips with a medium average velocity in comparison with the other clusters, but very hilly, with a large number of accelerations and decelerations and corresponding to high energy consumption. In broad terms, these clusters could be associated to low,medium and high performance demand for electric buses. The utility of the clustering approach can already be seen by allowing a fast and simple way to profile a large number of different bus trips (in the case of this study, around 36000 trips that took less than 30 seconds to process) based on multiple configurable characteristics. If performed by a human, trip by trip, the same task could be considerably more time demanding. 32
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach Besides the possibility to profile trips for which data already exists, the cluster models allow us to estimate the profile of new, uncategorised, bus trips, based on a subset of their characteristics. If, for example, we only possessed the information that a given bus trip is long and extremely hilly, with a “stop-and-go” nature, we could perhaps assume this trip belongs to the high performance demand cluster. Then, using the characteristic centroid values for that cluster, we can estimate the value of missing characteristics for the given trip, such as the consumed energy. While this estimation could be error-prone, it can be a good approach for cases were the trips cannot be studied with further detail, providing an “educated guess” supported by previous data. Another possibility of approach, one to be explored in future work, is the attribution of a cost and emission penalty to each cluster and altering the equations formulated in Section 3.2 to take these penalties into account. Since this possibility has not been explored to a greater detail until the present date, it is left here just as a suggestion. 3.4 Microscopic Traffic Simulation for New Scenario Analysis Often we cannot obtain enough real data to perform large scale studies. For large urban networks, sometimes even with different public transit agencies operating in the same region, it can be complicated to gather all the desired data. A possible solution is, instead, to simulate the urban network to a microscopic level and model the public transit operations to the desired degree of fidelity. This section proposes a general approach to use the SUMO - Simulation of Urban Mobility [KHRW] simulator, already described in Section 2.2, to simulate urban networks, in conjunction with a Simulink electric bus model to accurately simulate the operations of electric buses. An attempt is made to summarize the workflow of such an approach, describing the necessary steps to perform and input and output data to consider, along with some caveats necessary to take into account. 3.4.1 Urban network modelling The first step consists in modelling the actual urban network under study. This involves modelling streets, lanes, traffic light information, speed limits and other traffic rules, roundabouts, highways, bus-only lanes, rail-roads, and all other information that describes the network. In sum, the network topology and logic needs to be described. To use with SUMO, all this information is defined in a XML format file called the network file. Creating this file “from scratch” is a complex and time consuming task that requires a vast knowledge of the urban network being modelled. To simplify this task, SUMO allows importing urban networks directly from different sources, using the NETCONVERT [DLR16b] tool. These sources include other traffic simulators, geospatial shapefiles and the collaborative world mapping service OpenStreetMap [Ope16]. Public transit simulations require a particularly detailed modelling of the bus stops and their locations, along with the specification of the different bus routes and service times (the latter two being characteristics of demand modelling). 33
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach After modelling the road topology and logic, a phase of demand modelling follows. Demand modelling consists on describing the vehicles and respective routes that will be present in the simulation, along with possible individual peons and logistics. Demand modelling can be defined on an individual element basis (like, for example, specifying the routes a bus takes during the simulation period) or generated automatically with basis on probability models, specific activities or optimal models. Vehicles and vehicle types can be described using a series of vehicle models embedded in the platform, that can provide accurate fuel and pollutant emission estimation (based on factors such as the ones described in HBEFA [KKH+99]). Having the network topology, logic, and demand modelled, the simulation should be ready to run. Figure 3.3 shows an example of the Aliados urban network, in Porto, Portugal, as seen in the SUMO GUI. Figure 3.3: Aliados urban network, in Porto, Portugal, as seen in the SUMO GUI 3.4.2 Using SUMO and Simulink Since this study concerns specifically with the usage of electric buses it is important to simulate accurately the functioning of these vehicles. The methodology followed was to use a MATLAB Simulink model of an electric bus powertrain to simulate energy consumption, regenerative breaking and battery autonomy values for each electric bus in the network. The High Level Architecture concept, as described in Section 2.2.3, was used to integrate the Simulink model with SUMO. The electric vehicle model should receive, at each simulation step, the current velocity and road elevation provided by the urban network simulation; then, values simulated by the vehicle model should be fed back to SUMO. Figure 3.4 schematises the SUMO and Simulink HLA-based integration. 34
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach Figure 3.4: HLA integration of SUMO and Simulink, as proposed by Macedo et al. [MKS+] 3.4.3 Output data Interesting and useful output data obtainable after running the urban network simulation includes the following: • “Raw” vehicle positions; • Pollutant emissions; • Fuel / energy consumption values; • Velocity values; • Trajectory information; • Electric battery usage. In particular for the Simulink model, outputs include: • Acceleration at different time points; • Battery autonomy information; • Energy consumption; • Energy recuperation by regenerative braking. If able to retrieve these values for a set of bus trips during a simulated period of operations, the simulated scenario can be studied using the approach proposed in Section 3.2. 35
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach 3.4.4 Considerations on the usage of microscopic traffic simulation for scenario creation and analysis Provided a good urban network modelling is provided, using SUMO and Simulink to create elaborate public transit operation scenarios to study is a viable alternative to real data analysis. However, due to the simulation platform’s high level of detail, errors in the network modelling can have a large influence in the simulation outcome. For example, during the development of the work described in this dissertation, an attempt to model the Aliados area of Porto, in Portugal, by auto-importing this data from OpenStreetMap, was made. While, at first glance, the model looked accurate and the simulations were seemingly correctly executed, a more in-depth analysis showed some issues. A large number of road lanes were incorrectly connected and traffic light logic was often erroneous. While this did not stop the simulation from running, it tended to cause traffic “deadlocks” which would force SUMO to relocate the vehicles from road to road when they got stuck. For general vehicles in the network, this relocation had no severe impacts. However, when it happened to the electric buses being studied, these “teleportation”-like movements skewed the final results. In addition, modelling bus stops and bus routes can be complicated. In the case of Porto, Portugal, bus public transit information is still hidden from public API usage, preventing automatic generation of this data for use in the simulations. Some attempts to circumvent this limitation were made, more concretely described in Chapter 4. Lastly, while the whole network simulation can be run in a single instance of the SUMO platform, each electric bus needs its own individual Simulink model being executed. This requires an extension of the HLA-based code to allow for parallel execution of multiple Simulink instances, all in communication with the SUMO platform. This can pose some computational challenges, as well as demanding a computer with the capacity of running a large amount of simulation models simultaneously. For example, a day of operations for the STCP data studied in this work considered fleets with more than 200 vehicles. To simulate a fleet composed entirely of electric buses, it would imply running more than 200 Simulink models simultaneously. The reader should take into account these caveats when considering studying new scenarios through simulation. While, by far, not an impossible approach, correctly retrieving and modelling all the needed data can be a time and resource demanding task. In addition, performing the simulation for a large fleet or network can be computationally expensive. For some of these reasons, the microscopic simulation approach, while explored during the course of this dissertation work, was superseded by the real data analysis. 3.5 Summary This chapter begun by stating the main problem addressed by this dissertation work. It concerns to ascertaining the optimal resource allocation of a public transport system, in terms of vehicle types, in order to robustly implement a mixed fleet of electric and conventional buses. The developed 36
Multi-Objective Optimization of Mixed Bus Fleets - Methodological Approach solution should consider different fleet management characteristics, such as individual vehicles performing more than one trip per operations day. As results of the analysis, the solution should find the Pareto-optimal balance between the environmental impacts and economical impacts of the mixed bus fleet implementation. The approaches explored during the course of this dissertation to fulfil these goals were described next, in an attempt to give the reader a clear view of the methodological approach followed. Firstly, the full approach considering real operational data as input was presented, alongside a mathematical formalization of the mixed bus fleet problem at hands, as a multi-objective, constrained, integer optimization problem. Secondly, a methodology for bus trip profiling and classification, using cluster analysis was proposed. Lastly, a description on how microscopic traffic simulation could be used to study new public transit scenarios was shown. The description of the approaches included an overview of necessary input data, the basic workflow, or methodologies used, to reach results and the expected output. In addition, an explanation of possible caveats to each of the approaches was attempted. By providing an overview of different methods to study the implementation of a mixed bus fleet, we try to adapt to different situations of data availability and study scale. 37
Implementation Notes and Details Figure 4.2: Database scheme after data preparation. information and automatic GPS data processing methods [FCR09,FCR10] could prove effective to correct many inaccuracies. In general, despite the possibly existing errors, since the overall number of trips under analysis is significantly large, a small number of trips with data errors can be assumed not to impact the results much. In addition, emission and fuel values, as well as costs for fuel and vehicles were not provided by STCP, instead being calculated using averages or other estimations found in the literature. If such values were directly provided, related to the STCP scenario at hands, it would be possible to increase the reliability of all calculations. 4.2 Electric Bus Powertrain Simulation for Performance Estimation This section approaches some technical details regarding the Simulink powertrain model used to estimate electric bus performance data. As previously mentioned, the model was developed by Deborah Perrotta [PMR+14] and implemented using MATLAB’s Simulink tool. The model describes the powertrain of an electric bus developed by Salvador Caetano Group’s bus manufacturing company CaetanoBus, of Portuguese origin [Cae16], the COBUS 2500 EL. Figure 4.3 is an overview of the Simulink model. Each of the individual boxes represents a complex mechanical subsystem of the powertrain. As an example, Figure 4.4 shows the battery 44
Implementation Notes and Details subsystem model. For further details on the model specification, the reader is advised to consult the work of Perrotta et al., previously referred in this section. For information regarding electric vehicle powertrain models, in general, the reader can also consult the work of Barreras et al. [BPdC+15]. Torq ue Speed Out Acceleration Out Speed/Acceleration Power In Current Out Speed In Acceleration In Gear Out Gear Performance Scope Battery Scope Current (A) Energy (kWh) To r q u e ( N . m ) Motor Speed (rpm) Power (kW) SOC (%) Voltage (V) Figure 4.3: COBUS 2500 EL Simulink model overview. Minimal changes were required to use the model for the present study. In particular, the model inputs were changed to read the velocity and elevation data directly from the MATLAB workspace instead of from files. This allowed the creation of a MATLAB program that, for a specific day of operations, queried the database to retrieve time, velocity and elevation data for all the trips performed in the database and ran the Simulink model individually for each trip. After, the model outputs were automatically inserted back into the database. The following is an excerpt from the MATLAB program developed, showing the main simulation loop: 1for i = ids 2% Observations with id = x 3inds = data(:,1) == i; 4elevacoes = data(inds,2:3); 5velocidades = data(inds,[2 4]); 6 7% Extract total trip time 45
Implementation Notes and Details kWh Voltage (V) Curren t (A) kWh Curren t (A) accel eration m/s2 to W i>0 -1 -KVoltage3 Voltage1 E-u(1)* R Voltage P>0 f(u) Voltage P<0 RegenEnergy Energy Voltage SOC Current f(u) Sq root (d) f(u) Sq root (c) Saturation3 SOC1 100 SOC Initial Regenerated Energy P>0 1 s 1 s > Switch2 ~= 0 Switch3 1 s >= 0 Switch >= 0 Switch1 -KAND -KFinal Current 0 E E1 E E u2 Math Function u2 Math Function1 f(u) Current2 Current1 Battery Energy (kWh) 4*R*u(1 ) 4RP(d) 4*R*u(1 ) 4RP(c) f(u) f(u) 4 Voltage (V) Out 3 Energy Out 2 SOC Out 1 Current Out 3 Speed In 2 Acceleration In 1 Power In Figure 4.4: Simulink battery subsystem model. 8totalTime = max(elevacoes(:,1)) + 1; 9 10 disp('Simulating...') 11 SimOut = sim('cateanocycle_16.slx','StopTime', sprintf('%d', totalTime)); 12 13 energy = SimOut.get('Energy').signals(1).values(end); 14 regenEnergy = SimOut.get('RegenEnergy').signals(1).values(end); 15 batteryLevelAtEnd = SimOut.get('Battery_Scope').signals(2). values(end); 16 spentBatteryLevel = 100 - SimOut.get('Battery_Scope').signals(2) .values(end); 17 18 results(matrixIndex,:) = [i energy regenEnergy batteryLevelAtEnd spentBatteryLevel]; 19 matrixIndex = matrixIndex + 1; 20 end Instead of performing a database query twice per trip, once to retrieve the trip data, and another to store it in the database, a single query that reads the information for all the trips, at once, is 46
Implementation Notes and Details performed and stored in a data matrix. The aforementioned loop then reads individual trip data from that matrix, runs the simulation and stores the output in another matrix. Then, the matrix with all the outputs is used to store the data back into the database, again in a single query: 1resultsCells = num2cell(results(:,2:5)); 2 3ids = cellfun(@num2str, num2cell(results(:,1)), 'UniformOutput', false); 4 5whereClause = (strcat(' WHERE id = ', ids)); 6 7update(conn,'viagens',{'energy','regenenergy','batterylevelatend',' spentbatterylevel'},resultsCells, whereClause); This approach was devised because tests showed that while the Simulink model was able to perform the whole simulation in less than 0.5 seconds, the query to retrieve trip data from the database, and the query to store the simulation outputs in a database table together took over 2 seconds to execute. This meant that running the simulation for the over 30000 different trips in the database would take around 17 hours. With this approach, it instead took 5 times less, for a total of around 4 hours of execution time. 4.3 On the Implementation of the Evolutionary Algorithm Based Solver The objective of this section is sharing with the reader relevant details regarding the implementation of the evolutionary solver for the mixed fleet problem formulated in Section 3.2.2. The solver was implemented in the Java [Ora16a] language, with recourse of JavaEE [Ora16b] to make the connection with the PostgreSQL database and the MOEA framework [Had16] to implement the algorithms. 4.3.1 Solver connection to the database To simplify the data retrieval process from the PostgreSQL database a persistence layer was created using Java Enterprise Edition. Through this, it was possible to model the viagens database table into a Java class directly, and seamlessly query the database for information regarding this table. In addition, a Vehicle class was also created that represents each individual vehicle in the bus fleet being optimized by the solver. Figure 4.5 shows the attributes this class possesses. The index attribute represents which decision variable this Vehicle object defines. For example, if index = 0, it means this Vehicle object represents the first decision variable of the problem. the vehicleNumber attribute identifies the corresponding vehicle number in the database. The tripIDs list stores the 47
Implementation Notes and Details IDs of all the trips this vehicle instance is supposed to perform in the period of operations under study. The remaining attributes accumulate the total emissions and fuel (or energy) consumption values for all the trips the vehicle is performing. Figure 4.5: Vehicle class and its attributes. In addition, this class defines two important methods used to calculate the total emissions in CO2e equivalent units and the total costs for the vehicle, getEmissionsCO2Equivalent(int vehicleType) and getTotalCost(int vehicleType), respectively. The current implementation of these methods is as follows: 1public double getEmissionsCO2Equivalent(int vehicleType) { 2switch(vehicleType) { 3case ELECTRIC_VEHICLE_TYPE: 4return 0.0; 5case CNG_VEHICLE_TYPE: 6double coKg = (getTotalDieselCO() *(1 - 0.50)) / 1000000; 7double co2Kg = (getTotalDieselCO2()*(1 - 0.28)) / 1000000; 8double noxKg = (getTotalDieselNOx()*(1 - 0.80)) / 1000000; 9double noxCO2Eq = noxKg *NOX_GLOBAL_WARMING_POTENTIAL_100_YEARS; 10 double coCO2Eq = coKg *CO_GLOBAL_WARMING_POTENTIAL_100_YEARS; 11 return co2Kg + coCO2Eq + noxCO2Eq; 12 case DIESEL_VEHICLE_TYPE: 13 coKg = getTotalDieselCO() / 1000000; 14 co2Kg = getTotalDieselCO2() / 1000000; 15 noxKg = getTotalDieselNOx() / 1000000; 16 noxCO2Eq = noxKg *NOX_GLOBAL_WARMING_POTENTIAL_100_YEARS; 17 coCO2Eq = coKg *CO_GLOBAL_WARMING_POTENTIAL_100_YEARS; 48
Implementation Notes and Details 18 19 return co2Kg + coCO2Eq + noxCO2Eq; 20 default: 21 throw new RuntimeException("Emissions calculator received invalid vehicle type!"); 22 } 23 } 1public double getTotalCost(int vehicleType) { 2switch(vehicleType) { 3case ELECTRIC_VEHICLE_TYPE: 4return (ELECTRIC_VEHICLE_COST *(1 - ELECTRIC_VEHICLE_DISCOUNT)) 5+ (totalSpentEnergy *ELECTRICITY_COST_PER_KWH *(1 - ELECTRICITY_DISCOUNT)); 6case CNG_VEHICLE_TYPE: 7return (CNG_VEHICLE_COST *(1 - CNG_VEHICLE_DISCOUNT)) 8+ (totalSpentCNG *CNG_COST_PER_G *(1 - CNG_DISCOUNT)); 9case DIESEL_VEHICLE_TYPE: 10 return (DIESEL_VEHICLE_COST *(1 - DIESEL_VEHICLE_DISCOUNT)) 11 + (totalSpentDiesel *DIESEL_COST_PER_ML *(1 - DIESEL_DISCOUNT)); 12 default: 13 throw new RuntimeException("Cost calculator received invalid vehicle type!"); 14 } 15 } In the getEmissionsCO2Equivalent(int vehicleType we can see that electric vehicle emissions are defined as 0, while CNG emissions are defined as ratios of Diesel emissions. All emissions are converted to kg before converting to CO2e units. In the getTotalCost(int vehicleType) method, ELECTRIC_VEHICLE_COST,CNG_VEHICLE_ COST and DIESEL_VEHICLE_COST correspond to the initial purchase cost of electric, CND and diesel type buses, respectively. The corresponding DISCOUNT constants indicate how much those prices are to be discounted when calculating the total cost. Similarly, ELECTRICITY_COST_PER_ KWH,CNG_COST_PER_G,DIESEL_COST_PER_ML correspond to electricity and fuel prices, with their corresponding DISCOUNT values as well. The price and discount constants shown in the code can and should be adapted by the user to the scenario at hands, as they can have a significant impact on the optimization results. 4.3.2 Overview of the MOEA framework The MOEA (Multi-Objective Evolutionary Algorithm) framework [Had16] is a free and opensource Java framework for developing and experimenting with multi-objective evolutionary algorithms (MOEAs) and other general-purpose optimization algorithms. The framework supports 49
Implementation Notes and Details several kinds of evolutionary algorithms such as genetic algorithms, differential evolution and particle swarm optimization. It is often used to conduct comparative studies to assess efficiency and reliability of proposed multi-objective evolutionary algorithms. It was selected to be used in this project due to its simplicity of installation, configuration and overall use. Documentation is plenty and includes well explained usage examples. Key features of the framework include: • Fast, reliable implementations of many state-of-the-art multi-objective evolutionary algorithms; • Simple extensibility with custom algorithms or problems; • Modular design; • Permissive open-source license; • Fully documented source code; • Extensive online support; • Many test cases ensuring validity (over 1200, according to the authors). The workflow of the framework is simple for most simple cases, although a considerable degree of customization is possible. We need to specify the problem to be solved, by defining the number of decision variables, objectives and constraints. Then we must implement a method that generates a prototype solution, describing each decision variable, their type and corresponding bounds. Finally, we need to define an evaluation function that computes the values for all the optimization objectives. The following subsections give a brief overview of the code implemented for these purposes. 4.3.3 Problem definition As defined in the formulation done in Section 3.2.2, the problem has a number of integer decision variables equal to the number of vehicles in the fleet to be optimized. Each can take on the values 0, representing an electric bus, 1, representing a CNG bus and 2, representing a Diesel bus. The problem has two objectives to be minimised, the total emissions, in CO2e units and the total cost, which may or may not include initial vehicle purchase costs. Lastly, the problem has three constraints that must be fulfilled to ensure the validity of the solutions. The framework needs a class implementing the AbstractProblem interface, which requires the implementation of a constructor, a prototype solution generation function (the newSolution() method) and an evaluation function (the evaluate(Solution solution) method). The constructor is simple, initializing the list of vehicles with Vehicle class objects and passing the number of decision variables, objectives and constraints to the superclass constructor. The implementation is as follows: 50
Implementation Notes and Details 1public ElectricBusDistributionProblem(List<Vehicle> vehicles, int numberOfVariables ) { 2super(numberOfVariables, 2, 3); 3this.vehicles = vehicles; 4} In addition, the prototype solution generation function was implemented as follows: 1public Solution newSolution() { 2int numberOfVariables = this.getNumberOfVariables(); 3Solution solution = new Solution(numberOfVariables, 2, 3); 4for(int i = 0; i < numberOfVariables; i++) { 5solution.setVariable(i, EncodingUtils.newBinaryInt(0, 2)); 6} 7 8return solution; 9} We can see in the code each decision variable being defined as an integer with range [0,2], encoded with a bit string representation: EncodingUtils.newBinaryInt(0, 2) 4.3.4 Evaluation function The evaluation function is slightly more complex in comparison with the previous described code: 1public void evaluate(Solution solution) { 2double totalEmissionsCO2Eq = 0.0; 3double totalCostAllVehicles = 0.0; 4 5int numberExceedingTotalSpentBattery = 0; 6int numberOfElectricBuses = 0; 7int numberOfCNGBuses = 0; 8int numberOfDieselBuses = 0; 9 10 for(int i = 0; i < solution.getNumberOfVariables(); i++) { 11 int vehicleType = EncodingUtils.getInt(solution.getVariable(i)); 12 13 Vehicle vehicle = ElectricBusDistributor.getVehicleByIndex(i, vehicles); 14 assert vehicle != null; 15 16 switch(vehicleType) { 17 case Vehicle.ELECTRIC_VEHICLE_TYPE: 18 totalEmissionsCO2Eq += vehicle.getEmissionsCO2Equivalent(Vehicle. ELECTRIC_VEHICLE_TYPE); 19 51
Implementation Notes and Details 20 double totalCost = vehicle.getTotalCost(Vehicle. ELECTRIC_VEHICLE_TYPE); 21 assert totalCost >= 0; 22 totalCostAllVehicles += totalCost; 23 24 double totalSpentBattery = vehicle.getTotalSpentBattery(); 25 if(totalSpentBattery > (100.0 + Vehicle. EXTRA_ELECTRIC_BATTERY_PERCENT)) { 26 numberExceedingTotalSpentBattery++; 27 } 28 29 numberOfElectricBuses++; 30 break; 31 case Vehicle.CNG_VEHICLE_TYPE: 32 totalEmissionsCO2Eq += vehicle.getEmissionsCO2Equivalent(Vehicle. CNG_VEHICLE_TYPE); 33 34 totalCost = vehicle.getTotalCost(Vehicle.CNG_VEHICLE_TYPE); 35 assert totalCost >= 0; 36 totalCostAllVehicles += totalCost; 37 38 numberOfCNGBuses++; 39 break; 40 case Vehicle.DIESEL_VEHICLE_TYPE: 41 totalEmissionsCO2Eq += vehicle.getEmissionsCO2Equivalent(Vehicle. DIESEL_VEHICLE_TYPE); 42 43 totalCost = vehicle.getTotalCost(Vehicle.DIESEL_VEHICLE_TYPE); 44 assert totalCost >= 0; 45 totalCostAllVehicles += totalCost; 46 47 numberOfDieselBuses++; 48 break; 49 } 50 } 51 52 // Make sure no electric vehicle exceeds its autonomy 53 solution.setConstraint(0, numberExceedingTotalSpentBattery == 0 ? 0 : numberExceedingTotalSpentBattery); 54 55 // Make sure the number of CNG buses on the fleet is <= the maximum ratio 56 double cngBusRatio = ((double) numberOfCNGBuses) / solution. getNumberOfVariables(); 57 solution.setConstraint(1, cngBusRatio <= MAXIMUM_ALLOWED_CNG_BUS_RATIO ? 0.0 : cngBusRatio); 58 59 // Make sure the number of Diesel buses on the fleet is <= the maximum ratio 60 double dieselBusRatio = ((double) numberOfDieselBuses) / solution. getNumberOfVariables(); 52
Implementation Notes and Details 61 solution.setConstraint(2, dieselBusRatio <= MAXIMUM_ALLOWED_DIESEL_BUS_RATIO ? 0.0 : dieselBusRatio); 62 63 solution.setObjective(0, totalEmissionsCO2Eq); 64 solution.setObjective(1, totalCostAllVehicles); 65 } The evaluation function iterates through each decision variable. Lines 16 to 50 calculate costs and emissions differently considering the type of vehicle allocated to the variable. Lines 52 to 61 check if constraints are not broken with the solution under analysis. The first constraint ensures there are no electric vehicles exceeding their total battery autonomy to perform their allocated set of trips. The two other constraints allow us to define a maximum ratio of CNG and Diesel vehicles in the fleet. For example, STCP has a fleet composed of about 50% CNG vehicles and the rest Diesel ones. We can model that characteristic using these constraints. The last two lines of code set the value of the two objectives to the accumulated emission and cost values. 4.3.5 Configuration parameters Most of the parameters for the solver were kept on their default values. The following code pertains to the creation of the problem instance and execution of the solver: 1Problem problem = new ElectricBusDistributionProblem(vehicles, vehicles.size()); 2 3String algorithmToUse = "NSGAIII"; 4 5NondominatedPopulation result = new Executor() 6.withAlgorithm(algorithmToUse) 7.withProblem(problem) 8.withMaxTime(240000) 9.distributeOnAllCores() 10 .run(); The algorithm to use is set to the NSGA-III algorithm. The termination condition was set to a maximum execution time of 240 seconds because, based on the test runs performed, longer execution times were not generating significantly different solutions. Lastly, distributeOnAllCores() allows the algorithm to run on multiple CPU cores in a parallel fashion, essentially speeding up the performance of the solver. Other parameters could be further configured, but due to the quality of the solutions obtained versus the time it would probably take to fine-tune the solver, the configuration was left as shown, for the time being. 53
Implementation Notes and Details vehicles have to be individually sent over the run-time environment to the corresponding Simulink Federates. These federates need to be subscribed to updates on the correct vehicles as well and process this information at each step to update their models. After the update is performed, the new data must be sent back to SUMO. The main challenge of this implementation was ensuring the correct publish and subscription behaviours both on the SUMO Federate and the Simulink ones. For one vehicle, the behaviour is essentially publishing and subscribing data on the only electric vehicle instance available on the run-time environment. For multiple vehicles, each Simulink Federate must know exactly what vehicle instance concerns it, and the SUMO Federate must know the correct mappings in order to distribute the data correctly. The current prototype seems to perform these operations correctly and, so far, three different electric buses were able to be simulated with recourse to three different Simulink instances. At the time being, no tests were performed to investigate how scalable simulations with multiple Simulink instances are. It is a real possibility that simulating a fleet with many electric vehicles proves to be infeasible in a single machine. The properly documented, modified code is to be made publicly available after further testing is performed. 4.6 Summary The aim of this chapter was to provide the reader with some specific details regarding the work developed during the course of the dissertation. It begun by describing with detail the full process of storing, preparing and retrieving information from the data provided by STCP, used in these studies. Next, a description on the Simulink model used to simulate energy consumption values was made, while detailing the MATLAB code implemented to run the simulation efficiently for the full extent of the data set. After this, the reader was shown the specification of the evolutionary solver that was implemented, focusing on the main implementation challenges and configuration details. After this followed a brief section describing how RapidMiner was used to create a clustering process, attempting to provide the reader with the necessary steps to follow in order replicate such an approach. Lastly, the main challenges of using SUMO to simulate new public transit scenarios were brought to light, with a brief explanation of how these were approached. 60
Chapter 5 Results and Analysis This chapter presents to the user the description of the experimental setup and results of the study performed on the STCP data. In detail, we analyse the results of applying the evolutionary solver to the data in order to find good configurations of mixed fleets for a given period of operations. 5.1 Mixed Bus Fleet Applied to a Real Scenario - Study Results 5.1.1 Experimental setup The evolutionary solver was run individually for each day in the 09/05/2016 - 16/05/2016 (Monday to Monday) operation period. A first set of experiments included the vehicle purchase costs in the solver’s cost function. The solver was run once for each day of the entire period of operations while considering only CNG and Diesel buses in the fleet, with a maximum of a 50% ratio of CNG buses. These runs had the objective of gathering data in a fleet scenario consistent with STCP’s current one, with no electric buses, in order to serve as a comparison baseline. Then, the solver was executed again for the whole period of operations, but this time considering electric vehicles in the fleet. A second set of experiments consisted in the same procedure as the first one, but now without considering vehicle purchase costs, in order to evaluate allocation outputs based on the cost impact solely related to fuel and energy costs. After analysing and comparing these two sets of experiments, a brief sensitivity analysis was performed on the variation of electric vehicle purchase cost and extra battery autonomy. For reference, Table 5.1 summarizes the input values used in the experiments, along with their respective sources. Many of these inputs are described in detail in Section 3.2.1 of this document. It is important to note that the electric bus model considered during the tests was the CaetanoBus 2500 EL [Cae16]. CNG and Diesel vehicle purchase costs were based on average estimations [AdE16]. 61
Results and Analysis Table 5.1: Reference of input values used and respective sources. Parameter Value Description Electric Vehicle Cost 500 000 C Initial purchase cost of a CaetanoBus 2500 EL electric bus [Cae16]. CNG Vehicle Cost 180 000 C Estimated initial purchase cost of a CNG bus [AdE16]. Diesel Vehicle Cost 150 000 C Estimated initial purchase cost of a Diesel bus [AdE16]. Electric Bus Purchase Discount 0% - 50% Discount on the initial purchase cost of an electric bus. CNG Bus Purchase Discount 0% Discount on the initial purchase cost of a CNG bus. (Not considered in this study.) Diesel Bus Purchase Discount 0% Discount on the initial purchase cost of a Diesel bus. (Not considered in this study.) Electricity Cost 0.1402 C / kWh Price of electricity per kWh. Retrieved from electricity cost for industry, in Portugal [POR16]. CNG Fuel Cost 0.0009 C / g Price of CNG fuel, per gram [MAN16]. Diesel Fuel Cost 0.0011 C / ml Price of Diesel fuel, per milliliter [MAN16]. Electricity Discount 0% - 50% Discount on electricity costs. CNG Discount 0% Discount on CNG fuel costs. (Not considered in this study.) Diesel Discount 0% Discount on Diesel fuel costs. (Not considered in this study.) Electric Bus Energy Consumption Variable, in kWh Energy consumption for a particular trip, as simulated with the Simulink model. CNG Bus Fuel Consumption 510 g / km CNG fuel consumption for a particular trip [HJF+13]. Diesel Bus Fuel Consumption Variable, in ml Diesel fuel consumption for a particular trip, based on HBEFA [KKH+99,INF16]. NOx GWP 68 NOx global warming potential over 100 years [LA90]. CO GWP 2 CO global warming potentialover 100 years[LA90]. Diesel CO2Emissions Variable, in mg HBEFA CO2emissions for a Diesel bus, for a particular trip [KKH+99,INF16]. Diesel NOx Emissions Variable, in mg HBEFA NOx emissions for a Diesel bus, for a particular trip [KKH+99,INF16]. Diesel CO Emissions Variable, in mg HBEFA CO emissions for a Diesel bus, for a particular trip [KKH+99,INF16]. CNG CO2Emissions 72% of Diesel values CNG bus CO2emissions relative to a Diesel bus, for a particular trip [MUR05]. CNG NOx Emissions 20% of Diesel values CNG bus NOx emissions relative to a Diesel bus, for a particular trip [dR01]. CNG CO Emissions 50% of Diesel values CNG bus CO emissions relative to a Diesel bus, for a particular trip [dR01]. EV Emissions (CO2+ NOx + CO) 0 Electric bus tailpipe emissions (none). Extra Battery Percentage 0% - 100% Percentage of extra battery allowed when studying electric bus autonomy. 62
Results and Analysis 5.1.2 Solver results considering initial vehicle purchase costs As mentioned before, the first set of experiments made were with vehicle purchase costs considered in the cost function, evaluated over the operations period of 09/05/2016 to 16/05/2016. Each day generated an approximate Pareto frontier of around 100 solutions. From these, three solutions for each day were selected as representative of the frontier: Emissions tradeoff - The first type of solution selected is the one that trades total costs for minimising emissions as much as possible. Table 5.2 summarizes the baseline results (with no electric buses) for this tradeoff solution, while Table 5.3 shows the same tradeoff solutions but for mixed fleets with electric vehicles. Table 5.2: Baseline values table for solutions with vehicle purchase cost included and with minimum emissions. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 75787.374 62548867.439 0 189 190 379 10/05/2016 77135.822 62729279.069 0 190 190 380 11/05/2016 75075.653 62068836.387 0 188 188 376 12/05/2016 75530.403 64048911.462 0 194 194 388 13/05/2016 74995.421 64378524.178 0 195 195 390 14/05/2016 43539.637 39948016.112 0 121 121 242 15/05/2016 31760.1 36133870.869 0 109 110 219 16/05/2016 76194.278 63209082.112 0 191 192 383 Table 5.3: Mixed fleet values table for solutions with vehicle purchase cost included and with minimum emissions. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 76558.689 62548933.61 0 189 190 379 10/05/2016 77666.178 62729511.17 0 190 190 380 11/05/2016 75671.199 62068820.99 0 188 188 376 12/05/2016 75950.047 64369153.24 1 193 194 388 13/05/2016 75857.569 64318709.42 0 193 197 390 14/05/2016 43946.317 39948054.44 0 121 121 242 15/05/2016 32069.234 36133876.24 0 109 110 219 16/05/2016 76975.616 63149131.45 0 189 194 383 Total cost tradeoff - The second type of solution selected is the one that minimises total overall cost at the expense of pollutant emissions reduction. Table 5.4 summarises the baseline results for this tradeoff solution, while Table 5.5 shows the same tradeoff solutions for mixed fleets with electric vehicles. Median emissions and total cost - Lastly, this type of solution takes on a “best of both worlds” approach, representing a middle-ground between emissions reduction and total cost minimisation. Table 5.6 summarises the baseline results for this approach, while Table 5.7 shows the same middle-ground solutions for mixed fleets with electric vehicles. 63
Results and Analysis Table 5.4: Baseline values table for solutions with vehicle purchase cost included and with minimum total cost. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 57571049.46 104651.576 0 23 356 379 10/05/2016 57691630.036 106986.747 0 22 358 380 11/05/2016 57150799.274 104276.886 0 24 352 376 12/05/2016 58861224.985 105944.577 0 21 367 388 13/05/2016 59100989.096 105456.499 0 19 371 390 14/05/2016 36438968.022 64837.563 0 4 238 242 15/05/2016 32894215.621 48858.119 0 1 218 219 16/05/2016 58111332.446 106178.923 0 21 362 383 Table 5.5: Mixed fleet values table for solutions with vehicle purchase cost included and with minimum total cost. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 58590561.1 98859.41 0 57 322 379 10/05/2016 58531150.92 101992.635 0 50 330 380 11/05/2016 57960509.92 99296.813 0 51 325 376 12/05/2016 60060609.67 98357.012 0 61 327 388 13/05/2016 60450307.7 97157.699 0 64 326 390 14/05/2016 36798739.09 62534.173 0 16 226 242 15/05/2016 33254132.27 46496.717 0 13 206 219 16/05/2016 59100877.25 99982.38 0 54 329 383 Table 5.6: Baseline values table for solutions with vehicle purchase cost included and median emissions and total cost values. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 89589.736 60000084.485 0 104 275 379 10/05/2016 91517.847 60060781.571 0 101 279 380 11/05/2016 89056.316 59549868.308 0 104 272 376 12/05/2016 89934.46 61380030.319 0 105 283 388 13/05/2016 89547.58 61679768.368 0 105 285 390 14/05/2016 53528.051 38118361.792 0 60 182 242 15/05/2016 39670.984 34363954.864 0 50 169 219 16/05/2016 90440.899 60570376.768 0 103 280 383 Table 5.7: Mixed fleet values table for solutions with vehicle purchase cost included and median emissions and total cost values. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 87049.732 60569800.65 0 123 256 379 10/05/2016 89141.723 60570318.81 0 118 262 380 11/05/2016 88035.972 59879649.59 0 115 261 376 12/05/2016 86526.961 62069773.77 0 128 260 388 13/05/2016 85966.596 62369349.67 0 128 262 390 14/05/2016 52926.193 38238431.4 0 64 178 242 15/05/2016 38312.129 34604077.14 0 58 161 219 16/05/2016 88610.537 60960275.3 0 116 267 383 64
Results and Analysis As the reader can check, of the three types of tradeoffs, only the one focusing on optimizing emissions actually allocated electric buses to the fleet (column MinEmissionsEV), in the solution respective to 12/05/2016, in comparison to the baseline results. In addition, the corresponding emissions value and total costs were higher for that day, in comparison with the baseline solution, showing that specific fleet configuration to actually be worse than the corresponding solution without electric vehicles. Due to the absence of electric vehicles in the fleet in the rest of the solutions shown, those specific fleet allocations will not be discussed any further, as they are outside the scope of this dissertation. Section 5.1.4 help understanding such results. 5.1.3 Results considering fuel costs and pollutant emissions only Due to the inability to find relevant solutions when including vehicle purchase costs in the evaluation function of the solver, a suite of experiments similar to the one in Section 5.1.2 was performed without considering such costs in the solver. The resulting solutions were evaluated in a similar manner as well, by selecting the ones according to the same emissions and total cost tradeoff, as well as the median solutions in the Pareto frontier. Due to the significant difference in the number of trips and fleet composition, weekend operation days were not considered in the comparisons with the baseline values. Emissions tradeoff - We can now see that, in comparison with the previous analysis, the found solutions consider electric vehicles in the fleet every day. For each day, we can calculate how lower both the emissions and costs are in comparison with the baseline solutions and see that these fleets mixed with electric vehicles allow decreased pollutant emissions and actually save on the total costs with fuel and electricity. These reductions are shown in Table 5.10. In total, for the operations period, the reduction in pollutant emissions is of approximately 8161 kg CO2eand there is reduction in fuel costs of about C1765, when comparing with the baseline solutions. Fleets were configured with approximately 24 electric buses (on average), per day. Table 5.10 shows the emissions and cost reduction against the baseline solutions of the same type, for each day. Perhaps more interesting is analysing the emissions and cost differences against other types of baselines. We can see, in Table 5.11, that the emissions favouring fleet configurations benefit of a large reduction in emissions, especially in comparison with a cost favouring baseline. However, when it comes to fuel costs its more expensive than that same baseline. Total cost tradeoff - Doing a similar analysis to Table 5.12 and Table 5.13, regarding the tradeoff benefiting total cost reduction, we can see fleet configurations consisting on a similar quantity of electric buses. Regarding the benefits against the baseline values favouring cost reduction, we can witness on Table 5.14 a reduction in emissions totalling on approximately 12131 kg CO2efor the whole period of operations. On total costs, there is an improvement of C1010. 65
Results and Analysis Table 5.8: Baseline values table for solutions with no vehicle purchase costs and with minimum emissions. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 76006.266 28632.157 0 189 190 379 10/05/2016 77277.557 29171.622 0 190 190 380 11/05/2016 75523.44 28568.052 0 188 188 376 12/05/2016 75767.91 28734.667 0 194 194 388 13/05/2016 75193.308 28427.017 0 195 195 390 14/05/2016 43659.028 17960.317 0 121 121 242 15/05/2016 31849.615 13831.065 0 109 110 219 16/05/2016 76501.694 28870.558 0 191 192 383 Table 5.9: Mixed fleet values table for solutions with no vehicle purchase costs and with minimum emissions. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 74095.022 28238.086 27 189 163 379 10/05/2016 76142.654 28836.772 23 190 167 380 11/05/2016 74528.145 28252.756 21 188 167 376 12/05/2016 73923.832 28540.17 30 194 164 388 13/05/2016 74126.108 28071.664 24 195 171 390 14/05/2016 41052.282 17523.76 30 121 91 242 15/05/2016 28961.293 13382.483 43 109 67 219 16/05/2016 75293.714 28699.079 19 191 173 383 Table 5.10: Reduction from baseline values for an emissions reduction favouring tradeoff (purchase costs not considered). Day of operations Emissions reduction (kg CO2e) Cost reduction (C) 09/05/2016 1911.24 394.07 10/05/2016 1134.90 334.85 11/05/2016 995.30 315.30 12/05/2016 1844.08 194.50 13/05/2016 1067.20 355.35 16/05/2016 1207.98 171.48 Total 8160.70 1765.55 Table 5.11: Emission and cost reduction for emissions reduction favouring solution type, in comparison with the baseline values. Emissions reduction (kg CO2e) Cost reduction (C) Versus emission favouring baseline 8160.70 1765.55 Versus cost favouring baseline 20616.04 -626.23 Versus median valued baseline 12857.31 264.68 66
Results and Analysis Table 5.12: Baseline values table for solutions with no vehicle purchase costs and with minimum costs. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 10/05/2016 28706.915 79543.197 0 190 190 380 11/05/2016 28177.138 77677.326 0 188 188 376 12/05/2016 28365.703 77840.311 0 194 194 388 13/05/2016 28038.879 77211.208 0 195 195 390 14/05/2016 17653.007 45636.862 0 121 121 242 15/05/2016 13518.27 34427.234 0 109 110 219 16/05/2016 28504.279 78549.648 0 191 192 383 Table 5.13: Mixed fleet values table for solutions with no vehicle purchase costs and with minimum costs. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 27965.236 75547.357 27 189 163 379 10/05/2016 28558.446 77397.407 23 190 167 380 11/05/2016 27978.339 76118.474 21 188 167 376 12/05/2016 28170.514 76064.377 30 194 164 388 13/05/2016 27927.692 74934.206 24 194 172 390 14/05/2016 17261.058 42736.181 30 121 91 242 15/05/2016 13129.16 31132.416 43 109 67 219 16/05/2016 28402.065 76532.791 19 191 173 383 Table 5.14: Reduction from baseline values for a total cost favouring tradeoff (purchase costs not considered). Day of operations Emissions reduction (kg CO2e) Cost reduction (C) 09/05/2016 2356.47 254.15 10/05/2016 2145.79 148.47 11/05/2016 1558.85 198.80 12/05/2016 1775.93 195.19 13/05/2016 2277.00 111.19 16/05/2016 2016.86 102.21 Total 12130.90 1010.01 Table 5.15: Emission and cost reduction for total cost reduction favouring solution type, in comparison with the baseline values. Emissions reduction (kg CO2e) Cost reduction (C) Versus emission favouring baseline -324.44 3401.78 Versus cost favouring baseline 12130.90 1010.01 Versus median valued baseline 4372.18 1900.91 67
Results and Analysis Analysing Table 5.15 we see a large cost benefit, of around C3402, versus the emission reduction favouring baseline, but at the consequence of an increase in pollutant emissions, despite the presence of electric vehicles in the fleet. However, against the middle-ground baseline, there are solid advantages in using this configuration, both emissions and cost reduction wise. Median emissions and total cost - Repeating once again the analysis to solutions on the “middleground” of pollutant emissions to fuel costs, we see a fleet configuration very similar to the previous ones, in Table 5.17. When comparing with the baseline values in Table 5.16 we see a reduction in emissions for every single day of operations under study, along with a corresponding reduction in fuel costs. Summed up, these differences account for a total reduction of 9519 kg CO2ein pollutant emissions and a reduction in costs of C1350, as shown in Table 5.18. Table 5.16: Baseline values table for solutions with no vehicle purchase costs and median emissions and total cost values. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 10/05/2016 78092.759 28872.449 0 190 190 380 11/05/2016 76307.87 28323.331 0 188 188 376 12/05/2016 76639.457 28518.153 0 194 194 388 13/05/2016 75904.162 28184.196 0 195 195 390 14/05/2016 44365.329 17768.89 0 121 121 242 15/05/2016 32766.958 13632.13 0 109 110 219 16/05/2016 77258.304 28637.064 0 191 192 383 Table 5.17: Mixed fleet values table for solutions with no vehicle purchase costs and median emissions and total cost values. Day of operations Emissions (kg CO2e) Total cost (C) No. EVs No. CNG No. Diesel Total vehicles 09/05/2016 74691.407 28038.467 28 189 162 379 10/05/2016 76432.717 28669.102 23 190 167 380 11/05/2016 75063.438 28053.802 21 188 167 376 12/05/2016 74721.243 28309.662 30 194 164 388 13/05/2016 74619.102 27992.312 24 195 171 390 14/05/2016 41694.749 17363.056 30 121 91 242 15/05/2016 29813.098 13216.615 43 109 67 219 16/05/2016 75919.903 28489.033 19 191 173 383 As expected, while not witnessing emissions or cost reductions as large as in the previous tradeoff analyses, we see steady improvements when comparing with all the baselines for the other types of solutions. These values are shown in Table 5.19. Studying fleet costs - Now that we have analysed three different types of solution tradeoffs we must pay attention to the fact that the added cost when buying an electric bus instead of a CNG or Diesel counterpart is extremely important when making fleet management decisions. So, these costs were not ignored in this set of experiments. Instead, the purchase costs were used to evaluate the solutions devised by the solver after-the-fact. So, using the same set of solutions considered so far in this analysis, a study on the total cost of the bus fleets was made. 68
Results and Analysis Table 5.18: Reduction from baseline values for middle-ground (median) solutions (purchase costs not considered). Day of operations Emissions reduction (kg CO2e) Cost reduction (C) 09/05/2016 2072.83 329.54 10/05/2016 1660.04 203.35 11/05/2016 1244.43 269.53 12/05/2016 1918.21 208.49 13/05/2016 1285.06 191.88 16/05/2016 1338.40 148.03 Total 9518.98 1350.83 Specifically, the average fleet composition was estimated both for the baseline solutions and the ones including electric vehicles. The average baseline fleet was considered to be composed of 191 CNG buses and 191 Diesel buses. For the average fleet with electric vehicles, the composition considered was 24 electric buses,191 CNG buses and 167 Diesel counterparts. The total length of these fleets is 382 vehicles. Considering costs of C180 000 per CNG bus and C150 000 per Diesel bus, we have a total value of C63 030 000 for the baseline fleet. As for the mixed EV fleet, considering the full value of C500 000 per electric vehicle, we get a total cost of C71 430 000, hence a 13%, or C8 400 000, increase. Considering the amount of fuel costs saved per operation day, for each of the solution types against their respective baselines, it is possible to estimate the amount of time it would take to recuperate the additional investment in the fleet - the break even point. Since the cost per electric vehicle is considerably high in comparison with the other typologies, an analysis was made in order to estimate the variation on the break even point if we cut the electric vehicle prices. Figure 5.1 shows its results. As it is possible to see, the break even points for full-price electric vehicle fleets are longer than 100 years. In fact, the break even point lowers very slowly with the discount variation, still exceeding 30 years even with half-priced vehicles. 5.1.4 A brief sensitivity analysis We decided to further study the impact of electric vehicle purchase costs and autonomy on the break even point of investment. Table 5.19: Emission and cost reduction for median valued solution type, in comparison with the baseline values. Emissions reduction (kg CO2e) Cost reduction (C) Versus emission favouring baseline 4822.37 2851.69 Versus cost favouring baseline 17277.70 459.92 Versus median valued baseline 9518.98 1350.83 69
Results and Analysis can we significantly lower the break even point. 5.2 Road Profile Analysis and Clustering Results In here we describe some results and interpretations pertaining to the clustering methodology applied to the STCP data. The process described in Section 3.3 was applied to the about 35 769 different trips in the database. The attributes used to perform the clustering were the average velocity,number of accelerations,number of decelerations,number of descents,number of ascents, average descent,average ascent,average acceleration,average deceleration,trip length and energy consumed. The results on this section correspond to a Kvalue of 3. The reason for this is that, while still giving useful information, a lower Kwould create large clusters that are harder to analyse; a higher value of Kstarts creating clusters with a small number of examples each, and with very similar centroid values amount each other. Table 5.20: Centroid values for a k = 3 k-means clustering. Cluster Avg. velocity No. accelerations No. decelerations No. descents No. ascents Avg. descent Avg. ascent Avg. acceleration Avg. deceleration Length Energy cluster_0 17.67 47.25 43.49 36.95 37.38 -5.82 5.73 15.64 -17.44 16.41 38.50 cluster_1 19.84 22.33 21.11 19.70 19.90 -7.73 7.65 15.43 -16.63 9.30 17.72 cluster_2 14.57 32.48 29.89 25.93 25.79 -4.98 5.018 13.78 -15.43 10.17 29.29 Analysing the centroid table, Table 5.20, we can make a quick assessment of the average road profiles in each cluster: •Cluster 0, analysing the energy consumption values, seems to be the most demanding for the bus engine. Besides having the longest average length of all clusters, it seems to have a large number of “stop-and-go” situations, as the total number of braking and accelerating situations is very high. In addition, it is a very hilly route profile, in comparison with the other clusters, as the number of ascents and descents seems to indicate. •Cluster 1 is the least demanding group of trips for electric vehicles. Energy consumption is at its lowest and the average total length is the shortest of all clusters as well. It has a small number of total ascents and descents and a comparatively small number of “stop-and-go” situations, looking at the total accelerations and decelerations column. Nonetheless, this trip has the highest average velocity and the highest average ascent and descent. •Cluster 2, with regards to energy consumption and length, stands halfway between the other two, despite being the one with lowest average velocity. The trips in this cluster are also characterized by having average ascents and descents lower than the other clusters, despite having a rather large number of ascents and descents, in total. So we can assume these trips are hilly, but not with very high elevation variations. Figure 5.8 shows the relationship between the total number of ascents in a trip and the respective consumed energy, with values grouped by cluster. We can see here how the energy consumption generally increases with the number of ascents in a trip, and how trips with higher performance 76
Results and Analysis demands tend to be grouped in cluster 0, as described previously. A similar situation happens in Figure 5.9, for the total number of accelerations. Figure 5.8: Relationship between total number of ascents and consumed energy for a trip, grouped by cluster. 5.2.1 Trip and line distribution per cluster We analysed what cluster each of the trips in the case study belonged to. Table 5.21 shows this distribution. We can see that the largest number of trips concentrates in cluster 2, representing the middle level of energy demand for electric buses among the three clusters. A large number of trips also concentrate in the high energy demand cluster, cluster 0. This trip distribution leads to the conclusion that the bus network in analysis has an overall medium to high energy demand profile for electric buses, requiring good autonomy on over half the total trips. This supports the conclusions in the previous section regarding the impact of electric bus autonomy on the fleet configurations. Table 5.21: Trip distribution per cluster. No. trips Cluster 0 12345 Cluster 1 8756 Cluster 2 14668 One must note that different trips of the same line can belong to different clusters. As such, for each line, the cluster that the highest number of its trips were grouped to was determined. 77
Results and Analysis Figure 5.9: Relationship between total number of accelerations and consumed energy for a trip, grouped by cluster. Table 5.22 shows a distribution of the number of lines per cluster most of their trips were grouped into. The cluster with most lines is cluster 0, followed by cluster 2 and lastly cluster 1. Table 5.22: Line distribution per cluster. No. lines Cluster 0 25 Cluster 1 22 Cluster 2 24 5.2.2 Association between solver fleet configurations and clusters An analysis was made regarding the allocation of vehicle typologies on the fleet configuration solutions obtained in Section 5.1.3, considering only fuel costs and pollutant emissions, and the distribution of the corresponding trips in the different clusters. The results in Table 5.23 show the distribution of trips travelled by electric buses in the three different clusters, for each of the considered solution typologies. What we witness is that most of the trips performed by electric buses are grouped in cluster 1, the least demanding group for electric vehicles, for all three solution types. The rest of the trips are almost evenly distributed among clusters 0 and 2. 78
Results and Analysis Table 5.23: Distribution of electric bus trips per cluster, for the three solution typologies, not considering vehicle purchase costs. Cluster 0 Cluster 1 Cluster 2 Emissions tradeoff 273 357 273 Total cost tradeoff 244 332 249 Median values 244 332 249 5.3 Summary This chapter focused on presenting, describing and analysing the main results of this dissertation, with focus on the results of the case study and of the cluster-based trip profiling. The case study results allowed us to see the positive impacts of the integration of electric buses in a bus fleet, in terms of pollutant emissions reduction and fuel cost reduction. However, the results also warned us of the critical caveat of high electric vehicle purchase costs. A break even point analysis done showed that the electric vehicle purchase cost needed to be discounted over 65% in order to break even in less than 10 years time. However, a sensitivity analysis indicated that with a proper balance of extra vehicle autonomy and discounted vehicle purchase prices we could reach the break even point faster. The results on cluster profiling showed the possibility to group all the trips in three different clusters, each having its own set of characteristics. By looking at these, we can then estimate the expected demand on electric vehicles and profile the trips accordingly. The trip distribution among the clusters suggests that the STCP bus network demands above average performance from electric buses, due to the large number of trips associated with the clusters of medium and high performance trip profiles. These results seem consistent with the conclusion that electric bus autonomy greatly impacts the distribution of these vehicles in the mixed bus fleets devised for this scenario. The fleet configuration solutions obtained by the solver, described in Section 5.1, support the obtained cluster profiles, due to the allocation of the majority of electric buses to trips of lower electric bus performance demand profiles. 79
Results and Analysis 80
Chapter 6 Conclusions 6.1 General remarks The subject of transportation management has been approached by vast research over the years. More recently, however, the concepts of sustainable transportation and intelligent transportation systems have been growing in importance, as environmental issues increase in relevancy day after day and the positive impacts of a smart, fine-tuned and efficient urban network become evident. With the concept of a smartly managed city comes the necessity of a public transit system that keeps up with the needs of its encompassing urban network. In the present times, a good public transit system should correspond to high standards of environmental quality without becoming too much of a financial burden or sacrificing service quality to its customers. The electrification of transportation is a subject of increasing popularity, and one that should surely be explored in the context of public transit. In this dissertation, we approached that subject under the assumption of a conservative approach. While a promising technology, electric vehicles are generally expensive and, for the most part, lack the robustness of their conventional counterparts. Due to this, implementing electric vehicles in such a critical component of an urban network as the public transit system must be done with caution. Considering the replacement of an entire fleet of conventional buses by electric vehicles is infeasible by most public transit agencies and, under some criteria, may even be undesirable. Taking this into account, this dissertation proposed and studied not the replacement but the integration of electric vehicles in a public transit bus fleet of conventional vehicles. Existing literature focuses on the individual evaluation of electric vehicles. In this work, we evaluated their performance in conjunction with conventional vehicles in a mixed bus fleet. We started by performing a review on concepts and tools useful for conventional and electric vehicle management, focusing on some background on these vehicles, surveying transport systems simulation approaches and the main components of electric vehicle management. In addition to contextualizing the work done in this dissertation, this review also has the objective of providing a starting point to further developments related to the approached themes. We then analysed the integration of electric vehicles in a conventional bus fleet by studying a 81
Conclusions real scenario provided by STCP - Sociedade de Transportes Colectivos do Porto, the main public transit service in the city of Porto, Portugal. Using an evolutionary algorithm framework, we were able to devise mixed bus fleet configurations that took into account the minimisation of pollutant emissions and operational costs simultaneously. We reached the conclusion that, analysing aPareto frontier of solutions, we are able to devise fleet configurations that consider tradeoffs between pollutant emissions and operational costs. We can then choose the configuration that most suits our management goal, be it reduction of pollutant emissions, minimisation of costs or a balanced approach of both objectives. We could witness that, if not considering initial purchase costs, mixed fleets with electric buses generally outperform conventional fleet configurations both in pollutant emissions and fuel consumption costs, for configurations devised with similar objectives in mind. Through this study, we have also seen how the increased cost of purchase of electric buses, in relation to CNG or diesel buses, impacts negatively the viability of these mixed fleets. We have seen that, for an average mixed fleet configuration, it takes a large amount of years to reach the investment break even point. However, we must take into account that scaling the number of electric buses in the fleet could contribute to bring closer the break even point. In addition, possibly increasing the autonomy of the electric bus over a day of operations (for example, by charging more often) could contribute to making a high number of electric buses in the fleet more viable, as indicated by the sensitivity analysis. In addition to this, we proposed a clustering based methodology to perform bus trip profiling on existing operational data. We have seen these clusters profile bus trips according to characteristics with relevant impact on electric bus performance, such as how hilly a route is, how many “stopand-go” situations the vehicle faces, etc. These clusters help profiling new bus trips that do not have all the operational data available to directly analyse, but a smaller and relevant subset of characteristics. The cluster profiling done to the STCP bus network showed its above average demand for electric bus performance, especially regarding autonomy. The results were supported by the fleet configurations devised by the developed solver, which tended to allocate a larger number of electric buses to trips grouped in the lowest electric bus performance demand cluster. Furthermore, we studied how microscopic traffic simulation could be used to create new public transit scenarios to analyse. We made evident the utility of this method, but also brought into attention the complex and time demanding task it is to model an urban network properly, along with other caveats. In a broad conclusion to this work, we can attest to the potential of electric buses integrated in conventional bus fleets. As the technology costs decrease, issues like high break even points start to be mitigated and more options for fleet configuration arise, leading us to more cost-efficient fleets, overall. Regardless of the progress in electric vehicles, the approaches proposed in this dissertation should remain relevant and usable in different scenarios. In addition, the results of the study should be sufficiently generalizable in order to serve as general recommendations for the implementation of mixed bus fleets in different urban scenarios. 82
Conclusions 6.2 Main contributions In sum, the main contributions of this dissertation can be divided into three domains. Technical contributions This work had as one of its results a mixed bus fleet configuration tool that, given bus trip operational data and vehicle information as input data, can suggest multiple fleet configurations that balance the pollutant emission reduction and total cost minimisation objectives. Thus, it has the capability of working as a decision support tool for transportation system managers. These developments should be open-sourced and made publicly available after the conclusion of this work. On the subject of clustering for trip profiling, this work described a comprehensive process to analyse and aggregate operational data and use it to determine relevant clusters of data using k-means clustering. Regarding microscopic traffic simulation, a tool for adding elevation data to pre-existent SUMO microscopic simulator network files was a result of this dissertation. Alongside this, a tool to solve the issue of retrieving bus stop and bus route information to use in SUMO simulations was also developed. Moreover, an extension on the work of Macedo et al. [MKS+] resulted in the ability to integrate the SUMO simulator with multiple instances of MATLAB Simulink models, in parallel. All the developments mentioned are to be made publicly available soon with the necessary documentation, integrated in the MAS-Ter Lab specification [ROB07], which incorporates the concept of Artificial Transportation Systems and Simulation [RL14,RLT11]. Scientific contributions Regarding scientific contributions, this work identified an overall focus of existing literature on the subject of private electric vehicles or entirely electrified vehicle fleets. This dissertation helps bridging this gap by proposing conservative, mixed fleet approaches of electric and conventional vehicles in public transit. Part of the methodology and results of this case study originated an article submitted to the 19th IEEE Intelligent Transportation Systems Conference (ITSC 2016), currently awaiting review. The work performed on the issue of extending two-dimensional microscopic traffic simulations with elevation data brought some helpful approaches on a relevant problem for electric vehicle simulation. This work yielded a publication in the CISTI’2016 conference, and an extended version was submitted to the Journal of Information Systems Engineering & Management (JISEM) and is awaiting review. Applicational contributions A significant part of the contributions of this dissertation are the several conclusions and considerations drawn from a relevant, network-wide study on a real operations scenario. While different case studies would output different results, such as different fleet configurations, the main conclusions regarding the impact of electric vehicle cost, autonomy and bus trip profiles on the performance of the mixed bus fleets are transversal to all public transit scenarios. Furthermore, possible interpretations of cluster characteristics in the context of electric vehicles in public transit were suggested and described and can be used for route and trip profiling applications for electric bus fleet management. In addition, an approach to model and analyse 83
Conclusions new scenarios using microscopic traffic simulation was described, along with common issues and caveats. In sum, this dissertation provides a set of approaches and considerations that can be used on the application area of public transit management when considering mixed fleets of electric and conventional buses. 6.3 Further Developments As follow-up to this dissertation, it would be interesting to tackle some challenges that presented during the work. Extend the case study period of operations and objectives. Extending the present study to a wider period of operations would give more confidence to the decisions and recommendations devised. In addition, this would allow us to witness how scale affects the integration of electric vehicles in conventional fleets. Furthermore, it would be interesting to consider the optimization of other objectives when configuring the fleets, such as service quality metrics. The solver allows easily extending the number of optimization objectives, meaning only a proper evaluation function would need to be implemented. Considering a wide period of operations along with multiple relevant objectives would provide us with even more realistic results. Perform a more in-depth sensitivity analysis. As studied, both initial electric bus purchase cost and battery autonomy have a strong impact on mixed fleet configurations. It would be of interest to perform a sensitivity analysis spanning even more parameters over several days of operation to see exactly the impact of each parameter and, if possible, estimate which would be the ideal values for high-impact parameters. Compare cluster profiles with solver configurations While both the evolutionary solver and the cluster methodology provided us with interesting insights on the electric vehicle integration in public transit, there was not much effort done in “combining” the information of both approaches. For example, it would be interesting to analyse both approaches and try to find relevant relationships between specific road profiles and fleet configurations. Properly model the Porto urban network. Due to time constraints, the modelling of the Porto urban network for simulation of scenarios was never properly fine-tuned to allow the simulation of the whole transit system without problems. Thus, it would be helpful to finish this modelling in the future and test solver configuration solutions with it. Update input parameters. Some of the input data used for this study should be updated, such as the emission factors provided by HBEFA3, in order to better ensure the accuracy of the case results. 84
Conclusions Itinerary planning. Another interesting development to be added would be the capability of automatically generating optimal itineraries for each specific mixed bus fleet configuration, instead of using the itineraries already planned by STCP. This would be useful due to the fact that optimal paths for conventional buses may not remain optimal for electric vehicles, because of their particularities, such as lower autonomy and sensitivity to road topology. Charging station distribution. Different fleet configurations will result on different charge demands for the electric vehicles that compose the fleets. It would be useful to study charging station distribution and witness the impact on vehicle autonomy and usage within the bus fleet. V2G and G2V considerations. Some electric vehicles, when charging their batteries, can deliver “unused” energy back into the power grid and receive compensation by the power companies (vehicle-to-grid, or V2G). However, when many vehicles are charging at the same time (grid-tovehicle, or G2V), it becomes difficult for the power grid to properly balance these users. It would be a relevant work to be able to take V2G and G2V values into account when configuring fleets. 85
REFERENCES [LLC15] Lu Li, Hong K. Lo, and Xuekai Cen. Optimal bus fleet management strategy for emissions reduction. Transportation Research Part D: Transport and Environment, 41:330–347, 2015. [LMBH+13] Clemens Lorf, Ricardo F. Martínez-Botas, David A. Howey, Luca Lytton, and Ben Cussons. Comparative analysis of the energy consumption and CO2 emissions of 40 electric, plug-in hybrid electric, hybrid electric and internal combustion engine vehicles. Transportation Research Part D: Transport and Environment, 23:12–19, 2013. [Mac13] José Luís Pereira Macedo. An integrated framework for multi-paradigm traffic simulation. Thesis, 2013. [MAN16] MAN Autocarros Portugal. MAN Lion´s City CNG - A distância entre o preço do gasóleo e do gás natural cresce em todo o mundo. http://www.bus.man.eu/ pt/pt/autocarros-urbanos/man-lions-city-cng/resumo/Resumo. html, 2016 (accessed June 25, 2016). [MJK+14] Francis Mwasilu, Jackson John Justo, Eun-Kyung Kim, Ton Duc Do, and Jin-Woo Jung. Electric vehicles and smart grid interaction: A review on vehicle to grid and renewable energy sources integration. Renewable and Sustainable Energy Reviews, 34:501–516, 2014. [MKS+] José Macedo, Zafeiris Kokkinogenis, Guilherme Soares, Deborah Perrotta, and Rosaldo J. F. Rossetti. A HLA-based multi-resolution approach to simulating electric vehicles in simulink and sumo. In Intelligent Transportation Systems - (ITSC), 2013 16th International IEEE Conference on, pages 2367–2372. [MSWuQ] M. M. Mubasher and J. Syed Waqar ul Qounain. Systematic literature review of vehicular traffic flow simulators. In Open Source Software Computing (OSSCOM), 2015 International Conference on, pages 1–6. [MUR05] MURE - Mesures d’Utilisation Rationnelle de l’Energie. POR5 - Regulation on the use of natural gas as fuel for vehicles - Decree-Law nº 298/2001 of 21 November 2001. Technical report, 2005. [MZRS15] S. Mehar, S. Zeadally, G. Remy, and S. M. Senouci. Sustainable transportation management system for a fleet of electric vehicles. Intelligent Transportation Systems, IEEE Transactions on, 16(3):1401–1414, 2015. [Nav16] Navigant Consulting, Inc. Transportation forecast: Light duty vehicles navigant research. http://www.navigantresearch.com/research/ transportation-forecast-light-duty-vehicles, 2015 (accessed February 13, 2016). [New16] New Zealand Government. World Geodetic System 1984 (WGS84) | Land Information New Zealand (LINZ). http://www.linz.govt. nz/data/geodetic-system/datums-projections-and-heights/ geodetic-datums/world-geodetic-system-1984-wgs84, 2016 (accessed June 25, 2016). 92
REFERENCES [NRA13] K. M. Ng, M. B. I. Reaz, and M. A. M. Ali. A review on the applications of petri nets in modeling, analysis, and control of urban traffic. Intelligent Transportation Systems, IEEE Transactions on, 14(2):858–870, 2013. [OKT15] Nuri Cihat Onat, Murat Kucukvar, and Omer Tatari. Conventional, hybrid, plug-in hybrid or electric vehicles? State-based comparative carbon and energy footprint analysis in the united states. Applied Energy, 150:36–49, 2015. [Ope16] OpenStreetMap Foundation. OpenStreetMap. https://www.openstreetmap. org/, 2016 (accessed June 23, 2016). [Ora16a] Orable Technology Network. Java. https://java.com/en/, 2016 (accessed June 23, 2016). [Ora16b] Orable Technology Network. Java Platform, Enterprise Edition (Java EE). http://www.oracle.com/technetwork/java/javaee/overview/ index.html, 2016 (accessed June 23, 2016). [PF16] Tim Pokorny and Michael Fraser. The PoRTIco Project. http://www. porticoproject.org/, 2016 (accessed June 23, 2016). [PHTD+] Ni Peng, Vo Hoang Tam, D. Dahlmeier, Cai Wentong, J. Ivanchev, and H. Aydt. Depart: Dynamic route planning in stochastic time-dependent public transit networks. In Intelligent Transportation Systems (ITSC), 2015 IEEE 18th International Conference on, pages 1672–1677. [Pit16] Pitch Technologies. Pitch technologies. http://www.pitch.se/, 2016 (accessed February 13, 2016). [PMR+14] Deborah Perrotta, José Luís Macedo, Rosaldo J. F. Rossetti, Jorge Freire de Sousa, Zafeiris Kokkinogenis, Bernardo Ribeiro, and João L. Afonso. Route planning for electric buses: A case study in oporto. Procedia - Social and Behavioral Sciences, 111:1004–1014, 2014. [POR16] PORDATA - Base de Dados Portugal Contemporâneo. Preços da electricidade para utilizadores industriais e domésticos (Euro/ECU) - Portugal. http://www.pordata.pt/Europa/Pre%c3%a7os+da+electricidade+ para+utilizadores+industriais+e+dom%c3%a9sticos+(Euro+ECU) -1477-211472, 2016 (accessed June 25, 2016). [Pos16a] PostGIS Project Steering Committee. PostGIS — Spatial and Geographic Objects for PostgreSQL. http://postgis.net/, 2016 (accessed June 25, 2016). [Pos16b] PostgreSQL Global Development Group. PostgreSQL: The world’s most advanced open source database. http://www.postgresql.org/, 2016 (accessed June 25, 2016). [PRK] Luis S. Passos, Rosaldo J. F. Rossetti, and Zafeiris Kokkinogenis. Towards the next-generation traffic simulation tools: a first appraisal. In Information Systems and Technologies (CISTI), 2011 6th Iberian Conference on, pages 1–6. [PRRA12] Deborah Perrotta, Bernardo Ribeiro, Rosaldo J.F. Rossetti, and João L. Afonso. On the potential of regenerative braking of electric buses as a function of their itinerary. Procedia - Social and Behavioral Sciences, 54:1156 – 1167, 2012. 93
REFERENCES [Rap16] RapidMiner GmbH. k-Means - RapidMiner Documentation - Operator Reference Guide. http://docs.rapidminer.com/studio/operators/modeling/ segmentation/k_means.html, 2016 (accessed June 23, 2016). [RB99] Rosaldo J. F. Rossetti and Sergio Bampi. A software environment to integrate urban traffic simulation tasks. Journal of Geographic Information and Decision Analysis, 3(1):56–63, 1999. [RE] H. Ribberink and E. Entchev. Electric vehicles: ‘one-size-fits-all’solution for emission reduction from transportation? In Electric Vehicle Symposium and Exhibition (EVS27), 2013 World, pages 1–7. [Ric13] David B. Richardson. Electric vehicles and the electric grid: A review of modeling approaches, impacts, and renewable energy integration. Renewable and Sustainable Energy Reviews, 19:247–254, 2013. [RL05] Rosaldo J. F. Rossetti and Ronghui Liu. An agent-based approach to assess drivers’ interaction with pre-trip information systems. Journal of Intelligent Transportation Systems, 9(1):1–10, 2005. [RL14] Rosaldo J. F. Rossetti and Ronghui Liu. Advances in Artificial Transportation Systems and Simulation. Academic Press, 2014. [RLCB02] Rosaldo J. f. Rossetti, Ronghui Liu, Helena B. B. Cybis, and Sergio Bampi. A multi-agent demand model. Proceedings of the 13th Mini-Euro Conference and The 9th Meeting of the Euro Working Group Transportation, pages 193–198, 2002. [RLT11] Rosaldo J. F. Rossetti, Ronghui Liu, and Shuming Tang. Guest editorial special issue on artificial transportation systems and simulation. IEEE Transactions on Intelligent Transportation Systems, 12(2):309–312, June 2011. [RMS+] G. Remy, S. Mehar, T. Sophy, S. Senouci, F. Jan, and Y. Gourhant. Green fleet management architecture: Application to economic itinerary planning. In Globecom Workshops (GC Wkshps), 2012 IEEE, pages 369–373. [ROB07] Rosaldo J. F. Rossetti, Eugénio C. Oliveira, and Ana L. C. Bazzan. Towards a specification of a framework for sustainable transportation analysis. In 13th Portuguese Conference on Artificial Intelligence, EPIA, Guimarães, Portugal, pages 179–190. APPIA, 2007. [RSS15] J. P. Ribau, J. M. C. Sousa, and C. M. Silva. Reducing the carbon footprint of urban bus fleets using multi-objective optimization. Energy, 93:1089–1104, 2015. [SA] Anita Singh and Madhoolika Agrawal. Acid rain and its ecological consequences. Journal of environmental biology, 29(1):15. [SCB11] Razvan Stanica, Emmanuel Chaput, and André-Luc Beylot. Simulation of vehicular ad-hoc networks: Challenges, review of tools and recommendations. Computer Networks, 55(14):3179–3188, 2011. [SD94] Nidamarthi Srinivas and Kalyanmoy Deb. Muiltiobjective optimization using nondominated sorting in genetic algorithms. Evolutionary computation, 2(3):221–248, 1994. 94
REFERENCES [SPRO16] Diogo Santos, José Pinto, Rosaldo J. F. Rossetti, and Eugénio C. Oliveira. Three Dimensional Modelling of Porto’s Network for Electric Mobility Simulation. In 2016 11th Iberian Conference on Information Systems and Technologies (CISTI), pages 728–733. IEEE, 2016. [SSG14] Michael Schneider, Andreas Stenger, and Dominik Goeke. The electric vehiclerouting problem with time windows and recharging stations. Transportation Science, 48(4):500–520, 2014. [SSP13] B. L. Salvi, K. A. Subramanian, and N. L. Panwar. Alternative fuels for transportation vehicles: A technical review. Renewable and Sustainable Energy Reviews, 25:404–419, 2013. [SWT13] Simone Steinhilber, Peter Wells, and Samarthia Thankappan. Socio-technical inertia: Understanding the barriers to electric vehicles. Energy Policy, 60:531–539, 2013. [TARO] Ivo J. P. M. Timóteo, Miguel R. Araújo, Rosaldo J. F. Rossetti, and Eugénio C. Oliveira. TraSMAPI: An api oriented towards multi-agent systems real-time interaction with multiple traffic simulators. In Intelligent Transportation Systems (ITSC), 2010 13th International IEEE Conference on, pages 1183–1188. IEEE. [TARO12] Ivo J. P. M. Timóteo, Miguel R. Araújo, Rosaldo J. F. Rossetti, and Eugénio C. Oliveira. Using TraSMAPI for the assessment of multi-agent traffic management solutions. Progress in Artificial Intelligence, 1(2):157–164, 2012. [The16] The MathWorks, Inc. Simulink - simulation and model-based design. http:// www.mathworks.com/products/simulink/, 2016 (accessed February 13, 2016). [TIC16a] TICE.Mobilidade. One.Stop.Transport. https://www.ost.pt/, 2016 (accessed June 23, 2016). [TIC16b] TICE.Mobilidade. TICE.Mobilidade. http://tice.mobilidade.ipn.pt/, 2016 (accessed June 23, 2016). [TJB04] Rochdi Trigui, Bruno Jeanneret, and Francois Badin. Systemic modelling of hybrid vehicles in order to predict dynamic performance and energy consumption building the vehlib library of models. RTS-Recherche Transports Securite, (83):129–150, 2004. [U. 15] U. S. Energy Information Administration (EIA). Annual energy outlook 2015, April 2015 2015. [U. 16a] U. S. Department of Energy. Top fuel sippers (epa ratings, 2016 model year). http://www.fueleconomy.gov/feg/topten.jsp, 2016 (accessed February 10, 2016). [U. 16b] U. S. Department of Energy. Where the energy goes: Electric cars. https://www. fueleconomy.gov/feg/atv-ev.shtml, 2016 (accessed February 10, 2016). [U. 16c] U. S. Department of Energy. Where the energy goes: Hybrids. https:// www.fueleconomy.gov/feg/atv-hev.shtml, 2016 (accessed February 10, 2016). 95
REFERENCES [U. 16d] U. S. Department of Energy. Where the energy goes: Gasoline vehicles. https:// www.fueleconomy.gov/feg/atv.shtml, 2016 (accessed February 9, 2016). [Uni15] United Nations Framework Convention on Climate Change Int. Adoption of the paris agreement - draft decision, 12 December 2015 2015. [WWK+15] Renjie Wang, Ye Wu, Wenwei Ke, Shaojun Zhang, Boya Zhou, and Jiming Hao. Can propulsion and fuel diversity for the bus fleet achieve the win–win strategy of energy conservation and environmental protection? Applied Energy, 147:92–103, 2015. [YK13] M. Yilmaz and P. T. Krein. Review of battery charger topologies, charging power levels, and infrastructure for plug-in electric and hybrid vehicles. Power Electronics, IEEE Transactions on, 28(5):2151–2169, 2013. [YLF15] Zhile Yang, Kang Li, and Aoife Foley. Computational scheduling methods for integrating plug-in electric vehicles with power systems: A review. Renewable and Sustainable Energy Reviews, 51:396–416, 2015. [YRTM15] Jia Ying Yong, Vigna K. Ramachandaramurthy, Kang Miao Tan, and N. Mithulananthan. A review on the state-of-the-art technologies of electric vehicle, its impacts and prospects. Renewable and Sustainable Energy Reviews, 49:365–385, 2015. 96
Appendix A SQL queries for data preparation This appendix lists an overview of the main SQL queries used to prepare the data in the PostgreSQL database. 1-- Create new geometry point column with converted WGS84 coordinates: 2ALTER TABLE regposicao ADD COLUMN geom geometry(POINT, 4326) 3UPDATE regposicao SET 4geom = ST_Transform(ST_SetSRID(ST_MakePoint(CAST(replace(x, ’,’, ’.’) AS double precision), CAST(replace(y, ’,’, ’.’) AS double precision)), 20790), 4326); 5 6-- Remove rows with NULL coordinates: 7DELETE FROM regposicao WHERE xISNULL or y IS NULL; 8DELETE FROM regposicao WHERE x = "0" or y = "0"; 9 10 -- Find distinct trips and create the trip summary table: 11 CREATE TABLE viagens AS 12 SELECT *FROM 13 (SELECT DISTINCT ON(date_trunc(’day’, inicio_viagem), nr_linha, nr_viagem, nr_veiculo) inicio_viagem, nr_linha, nr_veiculo, nr_viagem, sentido 14 FROM regposicao 15 WHERE nr_linha IS NOT NULL and nr_viagem IS NOT NULL and nr_viagem != ’0’ and inicio_viagem IS NOT NULL ORDER BY nr_linha, date_trunc(’day’, inicio_viagem), nr_viagem) q 16 ORDER BY nr_linha, inicio_viagem, nr_viagem; 17 18 -- Add a primary key: 19 ALTER TABLE viagens ADD COLUMN id SERIAL PRIMARY KEY; 20 21 -- Create the trip registry table: 22 CREATE TABLE registo_viagens AS 23 24 SELECT viagens.id AS id_viagem, regposicao.data_trama, regposicao.x, regposicao.y, 25 regposicao.motorista, regposicao.nr_servico, regposicao.nr_turno, 26 regposicao.nr_ptparagem, regposicao.nr_ordem_paragem, regposicao.servico_km, 27 regposicao.inicio_servico, regposicao.velocidade, regposicao.geom 97
SQL queries for data preparation 28 FROM viagens 29 INNER JOIN regposicao 30 ON date_trunc(’day’, viagens.inicio_viagem) = date_trunc(’day’, regposicao. inicio_viagem) 31 AND viagens.nr_linha = regposicao.nr_linha 32 AND viagens.nr_viagem = regposicao.nr_viagem 33 AND viagens.nr_veiculo = regposicao.nr_veiculo 34 35 ORDER BY data_trama; 36 37 -- Query to remove data frames of trips with less than 20 data frames (aprox. 10 minutes of registry): 38 DELETE FROM registo_viagens WHERE id_viagem in 39 ( 40 SELECT id FROM ( 41 SELECT id, COUNT(id) as count_id 42 FROM viagens, registo_viagens WHERE viagens.id = registo_viagens.id_viagem GROUP BY id ORDER BY id 43 )as sq 44 WHERE count_id < 20 45 ); 46 47 -- Query to remove trips without any data frames (the ones affected by the previous query): 48 DELETE FROM viagens WHERE id IN ( 49 50 SELECT id 51 FROM viagens WHERE viagens.id NOT IN ( 52 SELECT id_viagem FROM registo_viagens GROUP BY id_viagem 53 ) 54 GROUP BY id ORDER BY id 55 ); 56 57 -- Add elevation raster to the database: 58 -- raster2pgsql.exe -s 3035 -t 200x200 -I -C -M -d "*.tif" public.demelevation > script3.sql 59 -- psql -d STCP_DADOS -f script3.sql -U postgres -q 60 61 -- Retrieve elevation for each point: 62 SELECT rid, ST_Value(rast, ST_SetSRID(point, 3035)) AS elevation, ST_AsText(point) FROM demelevation, ( 63 SELECT geom as point FROM regposicao LIMIT 20) AS foo 64 WHERE ST_Intersects(rast, ST_SetSRID(point, 3035)); 65 66 -- Add elevation data to the data frames: 67 ALTER TABLE registo_viagens ADD COLUMN elevacao DOUBLE PRECISION; 68 69 WITH elevacoes as ( 70 SELECT id, ST_Value(rast, ST_SetSRID(geom, 3035)) AS elevacao 98
SQL queries for data preparation 71 FROM demelevation, registo_viagens 72 WHERE ST_Intersects(rast, ST_SetSRID(geom, 3035)) 73 ) 74 UPDATE registo_viagens 75 SET elevacao = elevacoes.elevacao 76 FROM elevacoes 77 WHERE elevacoes.id = registo_viagens.id; 78 79 -- Add average velocity column to trip summary table: 80 ALTER TABLE viagens ADD COLUMN velocidade_media NUMERIC; 81 82 WITH medias as ( 83 SELECT id_viagem, AVG(velocidade) AS velocidade_media 84 FROM registo_viagens 85 GROUP BY id_viagem 86 ) 87 UPDATE viagens 88 SET velocidade_media = medias.velocidade_media 89 FROM medias 90 WHERE medias.id_viagem = viagens.id; 91 92 -- Add column to the trip registry table with velocity differences between point: 93 ALTER TABLE registo_viagens ADD COLUMN delta_velocidade NUMERIC; 94 95 WITH diffs AS ( 96 SELECT 97 id, 98 id_viagem, 99 velocidade, 100 coalesce(velocidade - lag(velocidade) OVER (PARTITION BY id_viagem ORDER BY data_trama), 0) AS delta_velocidade 101 FROM 102 registo_viagens 103 ) 104 UPDATE registo_viagens 105 SET delta_velocidade = diffs.delta_velocidade 106 FROM diffs 107 WHERE diffs.id = registo_viagens.id; 108 109 -- Add column to the trip registry table with elevation differences between point. Only consider elevations > than 1 meter, else consider it to be 0: 110 WITH diffs AS ( 111 SELECT 112 id, 113 id_viagem, 114 elevacao, 115 coalesce(elevacao - lag(elevacao) OVER (PARTITION BY id_viagem ORDER BY data_trama), 0) AS delta_elevacao, 116 CASE WHEN ABS(delta_elevacao) < 1 THEN 0 99
SQL queries for data preparation 117 ELSE delta_elevacao 118 END AS delta_elevacao_formated 119 FROM 120 registo_viagens 121 ) 122 UPDATE registo_viagens 123 SET delta_elevacao = diffs.delta_elevacao_formated 124 FROM diffs 125 WHERE diffs.id = registo_viagens.id; 126 127 -- Count the number of accelerations and decelerations with a value higher than 5 km/h and add to respective columns in the trip summary table. 128 -- Accelerations: 129 ALTER TABLE viagens ADD COLUMN aceleracoes_maiores_5kmh BIGINT; 130 131 WITH contagem AS ( 132 SELECT id_viagem, 133 coalesce(COUNT(delta_velocidade), 0) as aceleracoes_maiores_5kmh 134 FROM registo_viagens 135 WHERE delta_velocidade > 0 136 AND ABS(delta_velocidade) >= 5 137 GROUP BY id_viagem 138 ) 139 UPDATE viagens 140 SET aceleracoes_maiores_5kmh = contagem.aceleracoes_maiores_5kmh 141 FROM contagem 142 WHERE contagem.id_viagem = viagens.id; 143 144 UPDATE viagens 145 SET aceleracoes_maiores_5kmh = 0 146 WHERE aceleracoes_maiores_5kmh IS NULL; 147 148 -- Decelerations: 149 ALTER TABLE viagens ADD COLUMN travagens_maiores_5kmh BIGINT; 150 151 WITH contagem AS ( 152 SELECT id_viagem, 153 coalesce(COUNT(delta_velocidade), 0) as travagens_maiores_5kmh 154 FROM registo_viagens 155 WHERE delta_velocidade < 0 156 AND ABS(delta_velocidade) >= 5 157 GROUP BY id_viagem 158 ) 159 UPDATE viagens 160 SET travagens_maiores_5kmh = contagem.travagens_maiores_5kmh 161 FROM contagem 162 WHERE contagem.id_viagem = viagens.id; 163 164 UPDATE viagens 100
SQL queries for data preparation 165 SET travagens_maiores_5kmh = 0 166 WHERE travagens_maiores_5kmh IS NULL; 167 168 -- Count the number of ascents and descents and add the information to the trip summary table. 169 -- Only the ascents code is shown here, descents is similar. 170 ALTER TABLE viagens ADD COLUMN num_descidas BIGINT; 171 172 WITH contagem AS ( 173 SELECT id_viagem, COUNT(delta_elevacao) as num_descidas 174 FROM registo_viagens 175 WHERE delta_elevacao < 0 176 GROUP BY id_viagem 177 ) 178 UPDATE viagens 179 SET num_descidas = contagem.num_descidas 180 FROM contagem 181 WHERE contagem.id_viagem = viagens.id; 182 183 UPDATE viagens 184 SET num_descidas = 0 185 WHERE num_descidas IS NULL; 186 187 -- Calculate average accelerations and decelerations, as well as average ascents and descents, and add to the respective columns. 188 -- Ascents and descents (only ascents code shown): 189 190 ALTER TABLE viagens ADD COLUMN descida_media NUMERIC; 191 192 WITH contagem AS ( 193 SELECT id_viagem, AVG(delta_elevacao) as descida_media 194 FROM registo_viagens 195 WHERE delta_elevacao < 0 196 GROUP BY id_viagem 197 ) 198 UPDATE viagens 199 SET descida_media = contagem.descida_media 200 FROM contagem 201 WHERE contagem.id_viagem = viagens.id; 202 203 UPDATE viagens 204 SET descida_media = 0 205 WHERE descida_media IS NULL; 206 207 -- Accelerations and decelerations (only accelerations code shown): 208 ALTER TABLE viagens ADD COLUMN aceleracao_media NUMERIC; 209 210 WITH contagem AS ( 211 SELECT id_viagem, AVG(delta_velocidade) as aceleracao_media 101