Calculate transformer loss