Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Problem with a function
INSA
post May 16 2007, 08:13 AM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 15-May 07
Member No.: 881



Hi,
I have coded this function and there are some errors. I don't understand what is the problem.
Thanks,
CODE

function CalculHforce
  input Modelica.SIunits.AbsolutePressure p "Pressure";
  input Modelica.SIunits.Temperature T "Temperature";
  input Modelica.SIunits.MassFraction X[:] "Mass fractions";
  input Modelica.SIunits.MassFlowRate mdot;
  input Modelica.SIunits.Length Dhyd;
  input Modelica.SIunits.Area Area;
  output Modelica.SIunits.CoefficientOfHeatTransfer alpha;
protected
Real Re;
Real Pr;
Real Nu;
algorithm
  
Re:=ThermoFluidPro.CharacteristicNumbers.ReynoldsNumber(mdot,Dhyd,Area,
    ThermoFluidPro.Media.Air.NoncondensingAir.dynamicViscosity(
ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X)));
Pr:=ThermoFluidPro.CharacteristicNumbers.PrandtlNumber(
ThermoFluidPro.Media.Air.NoncondensingAir.dynamicViscosity(
       ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X)),
ThermoFluidPro.Media.Air.NoncondensingAir.specificHeatCapacityCp( ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X)),
  ThermoFluidPro.Media.Air.NoncondensingAir.thermalConductivity( ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X)));
  
if abs(Re)<5000 then
   Nu:=0.664*Re^0.5*Pr^(1./3.);
else
   Nu :=0.037*abs(Re)^0.8*Pr/(1 + 2.443*abs(Re)^(-0.1)*(Pr^(2./3.) - 1));
end if;
alpha:=Nu*Polynomials_Temp.evaluate({(-4.8737307422969E-008), 7.67803133753502E-005, 0.0241814385504202},
   T)/Dhyd;
end CalculHforce;


CODE
Error: Unknown function ThermoFluidPro.Media.Air.NoncondensingAir.ThermodynamicState_Unique'"146A1C80"' in  (function ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX).
Error: Unknown function ThermoFluidPro.Media.Air.NoncondensingAir.ThermodynamicState_Unique'"146A1C80"' in  (function ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX).
Errors found in:
state = (if size(X, 1) == (if size({"water", "air"}, 1) == 1 then 0 else size({"water",
  "air"}, 1)) then ThermoFluidPro.Media.Air.NoncondensingAir.ThermodynamicState_Unique'"146A1C80"'
  () else ThermoFluidPro.Media.Air.NoncondensingAir.ThermodynamicState_Unique'"146A1C80"'
  ())
  File: C:/Program Files/Dymola/Modelica/Library/ThermoFluidPro 1.4.2/package.moe, line 23438
Error: argument 1 in call of unknown function ThermoFluidPro.Media.Air.NoncondensingAir.specificHeatCapacityCp
   is a record in:
ThermoFluidPro.Media.Air.NoncondensingAir.specificHeatCapacityCp(
  ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X))
Error: argument 1 in call of unknown function ThermoFluidPro.Media.Air.NoncondensingAir.thermalConductivity
   is a record in:
ThermoFluidPro.Media.Air.NoncondensingAir.thermalConductivity(ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X))
Error: For equation
Pr = ThermoFluidPro.CharacteristicNumbers.PrandtlNumber(ThermoFluidPro.Media.Air.NoncondensingAir.dynamicViscosity(...), ThermoFluidPro.Media.Air.NoncondensingAir.specificHeatCapacityCp
  (ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X)), ThermoFluidPro.Media.Air.NoncondensingAir.thermalConductivity(
  ThermoFluidPro.Media.Air.NoncondensingAir.setState_pTX(p, T, X)));
found in class Truck.CalculHforce, declaration window at line 22.

Failed to expand:Truck.CalculHforce(101325, 300, {1}, 1, 1, 1)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 9th December 2019 - 01:44 PM