Ok, I've been working on this for two days and have finally resulted to asking for help. I am designing a program for my work that will emulate the thermodynamic systems of a power plant. however, I have a very simple issue that I cannot seem to fix... here is the code snippet:
Property Get Eff() As Double 'Efficiency of the Turbine
If pType = HP Then
Dim I As Integer
Dim OutEnth As Double 'Enthalpy
Dim OutIEnth As Double 'Isentropic Enthalpy
Dim out As Double
OutEnth = pOut.H
OutIEnth = STMPSH(pOut.P, pIn.S)
For I = 1 To pExts.Count
OutEnth = OutEnth + pExts(I).H
OutIEnth = OutIEnth + STMPSH(pExts(I).P, pExts(I).S)
Next I
Dim numer As Double
Dim denom As Double
numer = pIn.H - pOut.H
denom = pIn.H - STMPSH(pOut.P, pIn.S)
out = numer / denom
Eff = out '(numer / denom) '(pIn.H - pOut.H) / (pIn.H - STMPSH(pOut.P, pIn.S)) * 100
ElseIf pType = LP Then
Eff = (pIn.H - ELEP) / (pIn.H - STMPSH(pIn.P, pOut.S)) * 100
ElseIf pType = IP Then
Eff = (pIn.H - pOut.H) / (pIn.H - STMPSH(pOut.P, pIn.S)) * 100
End If
End Property
the underlined portion is where I get an overflow error. I'm not sure why either. If you step through it using the debugger, it works just fine (which I really don't think the users of this program want to use the Step Into function to run this whole thing). but if you run the code, it spits out runtime error 6, overflow. I've used a calculator and the numbers work. The variable Out doesn't spit an error, but the return of Eff does. same data type too. I need some help. thanks...