averaged switch modeling and simulation