In this paper, an optimization framework for the calibration of energy management in plug-in hybrid electric vehicles (PHEVs) is proposed. The framework is based on the modeling of hybrid vehicles as hybrid systems in the mathematical sense, i.e., as a system, whose input is composed of continuous and discrete variables. This allows for the flexible integration of discrete decisions, such as drive modes and gear selection. Hybrid optimal control problems are then formulated, which seek optimal continuous and discrete system inputs, and methods for the efficient solution are described. The framework also allows for the incorporation of losses that occur due to a change in a discrete variable. The results can then be used to automatically calculate lookup tables for optimal gear shifts, optimal torque split between the motor/generator and the internal combustion engine, and the determination of the drive mode (electric or hybrid mode). It is demonstrated that when switching cost is disregarded, the main challenge is still finding the initial costate value. Practical strategies for determining the costate value online are described, containing a rule-based method, a $\hbox{CO}_{2}$ optimal method, and predictive energy management. The most important implementation issues are discussed, and the results of real-world experiments of predictive energy management are shown.