You're viewing an older version of this page (#799). View the current version.

View versions (1)

Interface

#include <codecogs/engineering/thermodynamics/work.h>

using namespace Engineering::Thermodynamics;

According to Thermodynamics second law, a thermal machine works in cycles receiving and losing heat and receiving or doing work. (Act as a machine or refrigerator)

Q_{1} - Q_{2} = W
(1)
Q_{1} ~~ is ~the~ incoming~ heat\par 
Q_{2} ~~ is~ the~ lost~ heat\par 
W ~~ is~ the~ work~ done~/~received
(2)

Example 1

The work done by a machine receiving 10J of heat and losing 4J to ambient, with cycle in clockwise direction

printf("%d",work(10,4,1));

Output: 6

Output: 6

Parameters

in_heat
The incoming heat (Any value)
out_heat
The lost heat to ambient(Any value)
cycle
The cycle direction ( 1 for clockwise, -1 for counter-clockwise )

Returns

The work done by the machine

Input for cycle must be -1 or 1 (counter-clockwise and clockwise), if a value different from those is inputted, the function will return 0.

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

in_heat
out_heat
cycle
Result