Dear moderator, i'm sorry for this big message. If it will not fit in forum rules, i'll (or you, please) delete it... Thank you for your patience.

Quote Originally Posted by US Iceman
I would be interested to discuss some of the simulations you did for the:
some code from compressor simulating program:
Code:
# ---------------------------------------------------------------------------
#
# START OF ROTATION
#
  for ($a=0; $a<=360; $a+=$anglestep) {
		$curr{a} = $a;

%prev = %curr;

# Heat transfer to wall
	$curr{S} = $curr{pos} * 2*3.14159*$Radius +  2*$Scyl;

   %curr = HeatTransfer(\%curr,$Twalls,$tau);

# Leakage between piston and cylinder wall

	if (($curr{P}>$Pin) and (not $discharge)) {
		$wleak = sqrt(2.0*($curr{P}-$Pin)*101300/$curr{D});
		$wleak=180 if ($wleak>180);
		$dMsuction = $wleak * $Sleak * $curr{D} * $tau;
	}else{
		$dMsuction = 0;
	}
	$curr{m} -= $dMsuction;
	$curr{P}*= $curr{m}/$curr{V}/$curr{D};
	$curr{D} = $curr{m}/$curr{V};
	$Mleak+=$dMsuction;

#print "dMsuction:$dMsuction\n";
#PrintPoint("      leakage:");


# Expansion

		%next = %curr;

	$next{a} =  $curr{a} + $anglestep;
	$next{pos} = ($Stroke / 2.0) * (1-cos($next{a}*3.14159/180));
	$dpos = $next{pos}-$curr{pos};
	$dVprev = $dV;
	$dV = $dpos * $Scyl;
		if (($dVprev/$dV)<0) {
			$suction 		= undef;
			$discharge	= undef;
		}
	$next{V} = $curr{V} + $dV;
	$dVv = $dV/$tau;
	$next{D} = $next{m} / $next{V};

	$gamma = getG($curr{P},$curr{T});
	$Pshouldbe = $curr{P} * ($curr{V}/$next{V})**$gamma;
	if ((not $suction) and (not $discharge)) {
		$next{P} = $Pshouldbe;
		$next{T} = getTbyS($next{P},$next{enthr});
		$next{H} = getH($next{P},$next{T});
	}



	%curr = %next;

#PrintPoint("    expansion:");

# Suction and discharge


	if ($curr{P}<=$Pin) {
		$w = $dVv / $Ssuc;  ## here the crsection of input equalized to Scyl/2
#		$w = $dVv / $Scyl;
		$wv = $dVv / $Svalve;
#		$maxw = 0.95 * getSS($curr{P},$curr{T});
#			if ($wv>$maxw) { 		## should not be supersonic
#				$dVsuccoeff=$maxw/$wv;
#			}else{
#				$dVsuccoeff=1;
#			}
		$dPin = $DefaultPressureDropSuction + $dPsuc + $dzeta * $Din * ($w*$w)/2.0 				/101300;
		$Psuc = ($Pin -$dPin);  # values that should be to start process
print "dPin=$dPin; Psuc=$Psuc;\n";
		$suction = 1		if ($curr{P}<=$Psuc);
	}

	if ($curr{P}>=$Pout) {
		$w = $dVv / $Ssuc/1.5;
#		$w = $dVv / $Scyl;
		$dPout = $DefaultPressureDropDischarge + $dPdis + $dzeta * $curr{D} * ($w*$w)/2.0	/101300;
		$Pdis = ($Pout+$dPout);
print "dPout=$dPout; Pdis=$Pdis;\n";
		$discharge = 1	if ($curr{P}>=$Pdis);
	}


	if ($suction) {	
#		$dVsuc = $dV * ($curr{P} - $dPin) / $Pin;
		$dVsuc = $dV * ($Psuc - $dPin) / $Pin;
		$dm = $Din * $dVsuc;
	$Vsuc+=$dVsuc;
		$next{m} += $dm;
		$next{enthr} = 	($curr{enthr}*$curr{m} + $Sin*$dm)/$next{m};
		$next{H} = 			($curr{H}*$curr{m} + $Hin*$dm)		/$next{m};
		$next{T} = 			($curr{T}*$curr{m} + $Tin*$dm)		/$next{m};
		$next{D} = $next{m} / $next{V};
		$next{P} = $Psuc;
print "suction @ $Psuc! dVsuc=$dVsuc; Vsuc=$Vsuc; w=$w:$wv dP=$dPin\n";
#		$Pupper = $Pin;
	}


	if ($discharge) {
#		$dVdis = $dV * ($curr{P} - $dPout) / $Pout;
		$dVdis = $dV * ($Pdis - $dPout) / $Pout;
		$dm = $curr{D} * $dV;
		$next{m} += $dm;
		$next{D} = $next{m} / $next{V};
		$next{P} = $Pdis;
print "discharge @ Pdis=$Pdis! dV=$dVdis; dVv=$dVv; w=$wout; dP=$dPout\n";
#		$Pupper = $Pout;
	}

	%curr = %next;
	
PrintPoint("      suc|dis:");

	$arm = sin(3.14159*$a/180);#*$Stroke/2.0;
	$direction = $arm/abs($arm) if (abs($arm)>0);
	$arm = abs($arm);

	$InnerGasWork = ($curr{P} - $Pin) * $dV * 101300 ;

	$MotorWork = - $InnerGasWork +  $FrictionForce * abs($dpos);
#	$MotorWork *= $arm ;
	$MotorWork = 0 if ($MotorWork<0);

	$MotorPower = $MotorWork / $tau;
	$MotorWorkTotal += $MotorWork;

#	print "			MotorPower: $MotorPower\n";


#	print "angle:$a\n";
	}


$Vreturned = $Mleak/$Din;
$Vsucreal = $Vsuc - $Vreturned;
$Veff = $Vsucreal / $Vcyl;

#printf "Vsuc=%.4e; Vsucreal=%.4e; Veff=%.4f\n", $Vsuc, $Vsucreal, $Veff;
printf "Veff=%.4f\n", $Veff;

printf "Total Veff: %.4f\n", $Veff*$Veff2;

printf "Compressor displacement (one piston): %.2f m3/h\n", $Vcyl/(60/$W)*3600;
printf "Compressor volume capacity (per piston): %.1f m3/h\n", $Vcyl/(60/$W)*3600*$Veff*$Veff2;

printf "Compressor displacement: %.2f m3/h\n", $Vcyl/(60/$W)*3600*$NumberOfCylinders;
printf "Compressor volume capacity: %.1f m3/h\n", $Vcyl/(60/$W)*3600*$Veff*$Veff2*$NumberOfCylinders;


$MotorPowerAverage = $MotorWorkTotal / ($tau*360/$anglestep);
print "Mean crankshaft power (per piston): $MotorPowerAverage\n";

$MotorHeatAverage = $MotorPowerAverage / 0.95 / $MotorPowerEfficiency;
print "Mean motor heat power (per piston): $MotorHeatAverage\n";
printf "Mean motor heat power: %.0f\n", $MotorHeatAverage*$NumberOfCylinders;
I have to say, that result of ruuning ths program is not true as i wanted It should be reworked, but in 2003 i went to another kind of job...