Question
visual studio 2017 c++
4) The work produced by a piston-cylinder device depends on the pressure inside the cylinder and the amount the piston moves,
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>

using namespace std;

double f(double v)
{
   double n=1,T=300,R=8.314;
   double P = n*R*T/v;
   return P;
}
int main()
{
   int vL=1,vR=5,panels=100;
   double h = (vR-vL)*1.0/panels,v,b1,b2;
   v=vL;
   double work = 0;
   while (v<vR)
   {
       b1=f(v);
       b2=f(v+h);
       work = work +(.5*h*(b1+b2));
       v=v+h;
   }
   cout<<"Work Done: "<<work;
   return 0;
  
}

Work Done: 4014.58 Process exited after 0.519 seconds with return value 0 Press any key to continue

Add a comment
Know the answer?
Add Answer to:
visual studio 2017 c++ 4) The work produced by a piston-cylinder device depends on the pressure...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4) The work produced by a piston-cylinder device depends on the pressure inside the cylinder and ...

    visual studio 2017 c++ 4) The work produced by a piston-cylinder device depends on the pressure inside the cylinder and the amount the piston moves, resulting in a change in volume inside the cylinder. Mathematically In order to integrate this equation, we need to understand how the pressure changes with the volume. We can model most combustion gases as air and assume that they follow the ideal gas law PV- nRT where P- pressure, kPa, volume, m n- number of...

  • Consider a piston-cylinder device (system) that contains 0.06 m3 of air at 300 kPa and 125...

    Consider a piston-cylinder device (system) that contains 0.06 m3 of air at 300 kPa and 125 ̊C. (a) If the volume of air in the device increases to 0.15 m3 while the pressure remains constant, determine the work done by the system during the process. (b) If as a result of heat transfer to the surrounding, the pressure and temperature in the device drop to 240 kPa and 55 ̊C, respectively, and the piston is held such that the volume...

  • Constant Pressure Process Oxygen (molar mass 32 kg/kmol) expands reversibly in a cylinder behind a piston...

    Constant Pressure Process Oxygen (molar mass 32 kg/kmol) expands reversibly in a cylinder behind a piston at a constant pressure of 3 bar. The volume initially is o.o1 m2 and finally is o.o3 m3, the initial temperature is 17 C. Calculate the work output and the heat supplied during the expansion. Assume Oxygen to be a perfect gas and take Cp o.g17 kJ/kgK. 2.

  • Gas inside a piston-cylinder device initially at the pressure of 7 bar and volume of o...

    Gas inside a piston-cylinder device initially at the pressure of 7 bar and volume of o m expands to 0.5 m according to PV" Constant. (i.e. PV -Constant ), determine the work done and the final pressure in 17] i. Ifn this process. ii. If the value of n is changed to 1.5, determine the final pressure. ii. Draw both processes (i.e. when n-1 and -1.5) on a P-V diagram iv. Explain why and how does the value of the...

  • A frictionless piston-cylinder device contains air at 300 K and 1 bar and is heated until...

    A frictionless piston-cylinder device contains air at 300 K and 1 bar and is heated until its volume doubles and the temperature reaches 600 K. Answer the following: A. You are interested in studying the air in the piston-cylinder device as a closed system. Draw a schematic of your device and the boundary that defines your system. Assume the cylinder is in horizontal position. B. Determine the final pressure of the air at the end of the process, in bar....

  • A piston cylinder device contains air with a volume of 0.05 m3 at 25oC and 100...

    A piston cylinder device contains air with a volume of 0.05 m3 at 25oC and 100 kPa pressure. The gas is now compressed to a final temperature of 95oC at 250 kPa. This compression is polytropic and follows PVn=constant. a. Determine how much boundary work was added to the gas [in kJ] b. How much heat was added or removed from this system during this process? [in kJ]

  • A piston cylinder device contains 5 kg nitrogen.  The pressure inside the system is 100 kPa, and...

    A piston cylinder device contains 5 kg nitrogen.  The pressure inside the system is 100 kPa, and the temperature is 17oC.  The relationship between pressure and volume is    PV3 = C.  If a process results in a volume reduction of 2x, calculate the work and heat transfer occurring during the process.

  • Nitrogen in a piston cylinder device occupies 0.5 m3 at 100 kPa and 20 °C. It undergoes a compres...

    Nitrogen in a piston cylinder device occupies 0.5 m3 at 100 kPa and 20 °C. It undergoes a compression process (during which PV1.30-constant) to a final state where the temperature is 200 °C. The specific heats are assumed to be constant while Tsur - 15 C a) Prove that the gas, at state 1, can be treated as an ideal gas. b) Find the pressure and volume at state 2 c) Find the heat transfer, in kJ. d) Find the...

  • An insulated piston-cylinder device contains 0.1m3 of air (ideal gas) at 400 kPa and 25℃. A...

    An insulated piston-cylinder device contains 0.1m3 of air (ideal gas) at 400 kPa and 25℃. A paddle wheel within the cylinder is rotated until 15 kJ of work is done on the air while the pressure is held constant. Assuming the kinetic and potential energies are negligible and the gas constant and specific heat of air are ? = 0.287 kJ kg∙K and ?? = 1.005 kJ kg∙K . Tasks: ( a ) Determine the mass of air inside the...

  • * A gas is contained in a vertical, frictionless piston-cylinder device. The piston has a mass...

    * A gas is contained in a vertical, frictionless piston-cylinder device. The piston has a mass of 2 kg and a cross-sectional area of 30 cm2. A spring above the piston is compressed by 2.5 mm and has a spring constant, k, of 38 kN/m. a. If the atmospheric pressure is 1 atm, determine the initial pressure (P1) inside the cylinder. Heat is added to the system until the piston moves an additional 10 mm. b. How much did the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT