Modeling switching losses in MOSFETs half-bridges