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:
4) The work produced by a piston-cylinder device depends on the pressure inside the cylinder and ...
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
  • visual studio 2017 c++ 4) The work produced by a piston-cylinder device depends on the pressure...

    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...

  • 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...

  • 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...

  • 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.

  • 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.

  • P3A.2 A sample consisting of 0.10 mol of perfect gas muICLUL is piston inside a cylinder...

    P3A.2 A sample consisting of 0.10 mol of perfect gas muICLUL is piston inside a cylinder such that the volume is 1.25 dm'; the external pressure is constant at 1.00 bar and the temperature is maintained at 300 K by a thermostat. The piston is released so that the gas can expand. Calculate (a) the volume of the gas when the expansion is complete; (b) the work done when the gas expands; (c) the heat absorbed by the system. Hence...

  • A stoichiometric mixture of ethanol (C2H6O), octane (C8H18), and air initially at T1 = 300 K,...

    A stoichiometric mixture of ethanol (C2H6O), octane (C8H18), and air initially at T1 = 300 K, P1 = 100 kPa, P2 =4500 kPa, and V1 = 5 liters (0.005 m3) is compressed in a piston-cylinder assembly in a polytropic process where n = 1.2 What is the final volume V2 (m3 ), the initial total volume of moles (kmol), and the final Temperature T2? NOTE: Universal gas constant: Ru = 8.314 k]/ kmolK Please show ALL steps and units with...

  • 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....

  • 1. electrical energy is applied to a system enclosed inside the piston-cylinder device shown. the voltage...

    1. electrical energy is applied to a system enclosed inside the piston-cylinder device shown. the voltage is 10 volts and the current is 2 amps for 20 seconds. during this time there is a heat transfer from the system to the outside equal to 90J, the system expands 0.2m^3 at a constant pressure of 200 kPa. 1. the amount of electrical energy in J applied to the system is? 2. the expansion work in J is ? 3. the increase...

  • A 0.073-m3 piston-cylinder device contains 0.15 kg of Argon. Weights are placed on top of the...

    A 0.073-m3 piston-cylinder device contains 0.15 kg of Argon. Weights are placed on top of the piston so that the initial pressure inside the cylinder is at 335 kPa. Now weights are removed one-by-one until the final volume is 3.00 times that of the initial volume. During this process, the argon's temperature is maintained constant. Determine the final pressure in the device. Round your answers to one decimal place. kPa

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