Added energy calculation in model object, updated hysteresis demo script accordingly