Energy, Heat, and Work

Read this page. Pay close attention to how the system and surroundings are defined; this will determine the direction of energy flow in thermodynamic systems.