473,715 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overflow Error

13 New Member
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...
May 31 '07 #1
3 2244
kadghar
1,295 Recognized Expert Top Contributor
Hi!!

So you say you're not having any trobule giving some value to "out" so, why dont you try giving "eff" the same variable type than "out" (i'd guess its a double or a string).

I dont know very much about thermodinamic, so why dont you give us some values for the inputs so we can check'm

Good Luck
May 31 '07 #2
Tophurious
13 New Member
out is defined as a Double, as with Eff (the function return value).

lets see the values would be:
STMPSH(pOut.P, pIn.S) returns 1231.0336228993 3 : Double
pIn.H : 1488.1436843042 5 : Double
pOut.H : 1292.7445069537 1 : Double

which if you do the calculations:
numer : 195.39917735054 1 : Double
denom : 257.11006140492 8 : Double
these two were used just to see if either the numerator of the Eff or denominator of the Eff calc were causing the overflow.
out : 0.7599826171049 87 : Double

like I said, if I use F8 in the debugger to step through the code, I get no errors, no problems, everything all hunky-dory. However! If I just run the code, I get the nice "Run Time Error '6': OverFlow!"... so first off why is it only when I run the code, it should also spit the exception when I am steping through, and second.... why is it spitting the exception at all. the numbers are right and the equate out to the ~76% that out is....
May 31 '07 #3
kadghar
1,295 Recognized Expert Top Contributor
out is defined as a Double, as with Eff (the function return value).

lets see the values would be:
STMPSH(pOut.P, pIn.S) returns 1231.0336228993 3 : Double
pIn.H : 1488.1436843042 5 : Double
pOut.H : 1292.7445069537 1 : Double

which if you do the calculations:
numer : 195.39917735054 1 : Double
denom : 257.11006140492 8 : Double
these two were used just to see if either the numerator of the Eff or denominator of the Eff calc were causing the overflow.
out : 0.7599826171049 87 : Double

like I said, if I use F8 in the debugger to step through the code, I get no errors, no problems, everything all hunky-dory. However! If I just run the code, I get the nice "Run Time Error '6': OverFlow!"... so first off why is it only when I run the code, it should also spit the exception when I am steping through, and second.... why is it spitting the exception at all. the numbers are right and the equate out to the ~76% that out is....
Hi, i realy dont know where the error could be. I tried making a function and it worked perfectly, i think you should see if the problem is inside or outside this method. (or just delete de eff=out line and rename the prop as "Out" jajajajaja)

By the way, here's the function i made:

Public Function Eff(pInH As Double, pOutH As Double, STMP As Double) As Double 'Efficiency of the Turbine

Dim out As Double
Dim numer As Double
Dim denom As Double

numer = pInH - pOutH
denom = pInH - STMP
out = numer / denom

Eff = out '(numer / denom) '(pIn.H - pOut.H) / (pIn.H - STMPSH(pOut.P, pIn.S)) * 100
End Function

and when i tried
Eff(1488.143684 30425, 1292.7445069537 1, 1231.0336228993 3)
it actually returned 0.7599826171050 07 (wich is preety close from the one you was expecting).

I hope you find the solution soon.

Hasta luego.
Kad
Jun 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

44
8566
by: JKop | last post by:
You know how the saying goes that *unsigned* overflow is... well.. defined. That means that if you add 1 to its maximum value, then you know exactly what value it will have afterward on all implementations. But then you have signed integers. Let's say a signed integer is set to its maximum positive value. If you add 1 to it, what happens?: A) It's implementation defined what value it will
19
3139
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form (nested), three list views, one tree control with up to 30,000 nodes, maybe 15 comboboxes (half of which have a large recordset as rowsource), 20 or so buttons and around 30 text boxes (not to mention the images, labels, etc and around 1000 lines...
4
12895
by: Chua Wen Ching | last post by:
Thanks Derek... Okay i had another question.. my program runs smoothly for the first minute, after 1 minute... suddenly it breaks and display this error: do you know what is the cause of this problem...
25
6252
by: junky_fellow | last post by:
Is there any way by which the overflow during addition of two integers may be detected ? eg. suppose we have three unsigned integers, a ,b, c. we are doing a check like if ((a +b) > c) do something;
8
10666
by: starffly | last post by:
In my program, the caculated value is supposed to be no more than the constant named MAXINT,otherwise, overflow error will be informed.however, I cannot test if the value exceeds MAXINT within the integer scope smaller than MAXINT,so I want to seek a measure to test the excess without the value's comparing to MAXINT. Please let me know if you have a good idea. THX.
10
1109
by: Parachute | last post by:
Using Borland Builder 6, I get numerical overflow when running a small programme without CodeGuard ("exp: OVERFLOW error"). The programme does not give any error messages when CodeGuard is activated during the run. The equation that causes overflow uses the exp-function, but given and resulting values are not very large (and are written in double-variables anyway). So why does it seem as if there were not enough space in the buffer? And...
1
3315
by: zaneh | last post by:
I have found TheScripts a very useful site, but however I cannot find an answer to a problem I am having, so I finally have to ask the question! I am getting an Overflow error in a Function I have written. BUT... It does not occur all the time. If I call the Function from the "After Update" event for a checkbox, it works as intended, how ever if I call the Function from the "On Load" event of the Form, testing to see whether the...
3
2161
by: MLH | last post by:
A wide comma delimited text file import into A97 failed with an overflow error. I'm estimating it to have been no more than 1000 records. 100% of all the fields were quoted strings or ZLS's. What most likely caused the overflow? Might it be upper limit on number of fields in table?
3
10738
by: jer006 | last post by:
Hi I am writing a select statement that has an arithmetic function inside a case statement that uses logic to decide whether to divide or multiply and when I run the arithmetic statements outside the case statement they work fine, but blow up with an overflow error in the case statement. The select looks like: SELECT a.acct_cd, a.crrncy_cd, a.mkt_val, c.rate,
42
7018
by: thomas.mertes | last post by:
Is it possible to use some C or compiler extension to catch integer overflow? The situation is as follows: I use C as target language for compiled Seed7 programs. For integer computions the C type 'long' is used. That way native C speed can be reached. Now I want to experiment with raising a Seed7 exception (which is emulated with setjmp(), longjmp() in C) for integer
0
8715
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9322
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9193
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9039
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4472
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4734
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3171
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.