So I posted this before, but got no answer. I found a way around it but now my backway is doing the same problem.
Basically, in one of my get methods: -
Property Get H() As Double
-
H = CalcH 'This was implemented as the "Back Way" and it fixed problem, before the code in CalcH was in here
-
End Property
-
-
Private Function CalcH() As Double
-
If pH <= 0# And pT > 0# And pP > 0# Then 'calculate if not set
-
pH = STMPTH(pP, pT)
-
ElseIf pH <= 0# And pT > 0# Then
-
If pType = StreamType.Water Then
-
pH = STMTQH(pT, 0#)
-
Else
-
pH = STMTQH(pT, 1#)
-
End If
-
ElseIf pH <= 0# And pP > 0# Then
-
If pType = StreamType.Water Then
-
pH = STMPQH(pP, 0#)
-
Else
-
pH = STMPQH(pP, 1#)
-
End If
-
End If
-
CalcH = pH
-
End Function
-
When I run the program, I give pH a value of 1488. But when it comes to retrieving that value the compiler goes nuts. If I run the program, I get "Error 6: Overflow". So I use the debugger, I step through the WHOLE program... and it completes its run with no issue.... so I run again... and get the error. I find out it is when I retrieve the H value. So I put a break right there. I run program to the break and then step through the retrieval and find something quite odd. When it gets to the - If pH <= 0# And pT > 0# And pP > 0# Then 'calculate if not set
it actually returns true... but pH has a value of 1488! so I do this again and mouse over the pH to see what it says and it says "pH = 0" thats odd... I hit F8 to step. then mouse over pH, still "pH = 0" I open up the locals window and locate the pH variable. it says "pH = 1488", I mouse over pH again and now it says "pH = 1488" BUT IT JUST PASSED AN IF STATEMENT SAYING IF<=0!!!! please help!
Screenshots (in order): #1 #2 #3 #4 #5 #6 #7 7 1563
So I posted this before, but got no answer. I found a way around it but now my backway is doing the same problem.
Basically, in one of my get methods: -
Property Get H() As Double
-
H = CalcH 'This was implemented as the "Back Way" and it fixed problem, before the code in CalcH was in here
-
End Property
-
-
Private Function CalcH() As Double
-
If pH <= 0# And pT > 0# And pP > 0# Then 'calculate if not set
-
pH = STMPTH(pP, pT)
-
ElseIf pH <= 0# And pT > 0# Then
-
If pType = StreamType.Water Then
-
pH = STMTQH(pT, 0#)
-
Else
-
pH = STMTQH(pT, 1#)
-
End If
-
ElseIf pH <= 0# And pP > 0# Then
-
If pType = StreamType.Water Then
-
pH = STMPQH(pP, 0#)
-
Else
-
pH = STMPQH(pP, 1#)
-
End If
-
End If
-
CalcH = pH
-
End Function
-
When I run the program, I give pH a value of 1488. But when it comes to retrieving that value the compiler goes nuts. If I run the program, I get "Error 6: Overflow". So I use the debugger, I step through the WHOLE program... and it completes its run with no issue.... so I run again... and get the error. I find out it is when I retrieve the H value. So I put a break right there. I run program to the break and then step through the retrieval and find something quite odd. When it gets to the - If pH <= 0# And pT > 0# And pP > 0# Then 'calculate if not set
it actually returns true... but pH has a value of 1488! so I do this again and mouse over the pH to see what it says and it says "pH = 0" thats odd... I hit F8 to step. then mouse over pH, still "pH = 0" I open up the locals window and locate the pH variable. it says "pH = 1488", I mouse over pH again and now it says "pH = 1488" BUT IT JUST PASSED AN IF STATEMENT SAYING IF<=0!!!! please help!
i saw that you are programing about Class. I've never seen this type of error before. But i think problem here is caused by Local Varriables and Global Varriables. Can u discribe more about ur Class. ( Member Varriables and Member Function)
I can't look at the images right now, because my work system blocks them. Will have a look in a few hours when I'm at home. In the meantime...
Are you setting it to 1488 or 1488# ? Perhaps there's an unintended conversion happening somewhere along the line, which is causing a calculation to overflow. VB, along with some other languagesw, has a nasty tendency to convert everything in a calculation to match the smallest data type used anywhere in the calculation. This can really screw you up sometimes.
Like I said, I'll have a look at this in detail in a few hours, and see whether anything comes to mind.
-
Private pP As Double 'Pressure of the stream
-
Private pT As Double 'Temperature of the stream
-
Private pH As Double 'Enthalpy of the stream
-
Private pW As Double 'Flow of the stream
-
Private pType As StreamType 'Type of stream: Steam, Water, Leak(Enum)
-
Private pName As String 'Name of the stream
-
-
Property Let P(P As Double)
-
pP = P
-
End Property
-
-
Property Let T(T As Double)
-
If pType = Steam And pP <> 0 Then
-
If (T - STMPT(pP)) < 27 Then 'Check for 27 degree superheat per PTC 6
-
pT = 0
-
Else
-
pT = T
-
End If
-
Else
-
pT = T
-
End If
-
End Property
-
-
Property Let H(H As Double)
-
pH = H
-
End Property
-
-
Property Let W(W As Double)
-
pW = W
-
End Property
-
-
Property Get P() As Double
-
P = pP
-
End Property
-
-
Property Get T() As Double
-
If pT = 0 And pH > 0 And pP > 0 Then 'calculate if temp unknown & H known
-
If Not SuperHeat Then
-
pT = STMPHT(pP, pH)
-
End If
-
End If
-
T = pT
-
End Property
-
-
Property Get H() As Double
-
H = CalcH
-
End Property
-
-
Property Get W() As Double
-
W = pW
-
End Property
-
-
Property Get SType() As StreamType
-
SType = pType
-
End Property
-
-
Property Get Name() As String
-
Name = pName
-
End Property
-
-
Property Get S() As Double 'Get Entropy
-
If pT <> 0 And pP <> 0 Then
-
S = STMPTS(pP, pT)
-
ElseIf pT = 0 And pP <> 0 Then
-
S = STMPHS(pP, H)
-
End If
-
End Property
-
-
Property Get x() As Double 'Get X
-
x = STMPHQ(pP, H)
-
End Property
-
-
Property Get Q() As Double 'Get Energy Flow Rate (H*W)
-
Q = H * pW
-
End Property
-
-
Property Get V() As Double 'Get Specific Volume
-
V = STMPTV(P, T)
-
End Property
-
-
Property Get Density() As Double 'Get Specific Density
-
If P = 0 Then
-
Density = 62.087 + 0.022519 * T - 0.00033873 * (T ^ 2) + 0.0000010579 * (T ^ 3)
-
Else
-
Density = 1 / V
-
End If
-
End Property
-
-
Property Get C() As Double 'Get Specific Heat
-
C = 1.0244 - 0.00071715 * pT + 0.0000061796 * (pT ^ 2) - 0.000000016397 * (pT ^ 3)
-
End Property
-
This problem went away. And KEEPS COMING BACK!!! I switched my computers out and it started working again. Now I have the same sort of issue and we tried it on 3 different computers here. same problem. I run the program and get overflow. but I can hold down F8 for 20 minutes and easily fly past the point at which it crashes. I am so tired of it. I want to use C# or C++ but unfortunately my company does not have licenses for it.
This problem went away. And KEEPS COMING BACK!!! I switched my computers out and it started working again. Now I have the same sort of issue and we tried it on 3 different computers here. same problem. I run the program and get overflow. but I can hold down F8 for 20 minutes and easily fly past the point at which it crashes. I am so tired of it. I want to use C# or C++ but unfortunately my company does not have licenses for it.
i tried copy ur code in to a new project and do it. No problem occured. Maybe, u have other statement that i dont know. But i have small idea. -
Property Let H(H As Double)
-
pH = H
-
End Property
-
Here, u let pH = H. H maybe a local varriable in proprerty Let. If this is, no problem occure. But if VB translate H as Property Get H() As Double that u declare. So, this is wrong. I donot ensure how VB translate this, but u shouldnt use the same name for the varriable as the Property name.
Use the same name for Property Let and Property Get only. -
Property Let H (hValue as Double)
-
pH = hValue
-
End Property
-
Property Get H () As Double
-
H = calH()
-
End Property
-
Try replacing other Varriables which name as similar as Property name and do ur project again. If it still have error, i must say sorry because i cannot help u any more.
That is some weird stuff you've got going on there.
Sorry, I completely forgot about it. I'll e-mail myself a reminder to have a look when I get home tonight.
In the meantime, one straw you could grasp in desperation is to put DefDBL A-Z at the top of the module(s), to indicate a default data type of Double for everything. Probably won't help, but hey, it probably won't hurt.
Just a note. As I think on it further, it's not really all that surprising that things can work slightly differently between compiled and interpreted code. After all, if the problem is related to temporary values generated during a calculation, there's no reason why the runtime and IDE code couldn't be using some slightly different code internally to do it.
My guess is that it will probably just end up being necessary to force something to Double format, or split up a calculation (or comparison) to gain finer control over the format conversions. However, I haven't read back through the whole of the thread yet. Will do so tonight.
In the meantime, good luck!
Well, I've had a look through the images. I'm going to admit complete bafflement. I've never really done much with classes, and I know things can get complicated due to different memory models, different types of creation/sharing/destruction of objects and so on. For all I know, there might be another instance of something which is working with the same data that you are looking at.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: rhmd |
last post by:
Just found Python and I love it. What an elegant language!
I would like to use it for various applications, but the
mathematical calculations are way too slow (a million sines 8 seconds
in Python...
|
by: Martin Bless |
last post by:
The good news:
Along with Python-2.4 comes really good news to Windows users. Yes,
you now CAN build extension modules yourself using the SAME C++
compiler and linker Python is built with...
|
by: Alan Lee |
last post by:
Hi i am writing a small simulation for a bunch of atoms jumping around on a
surface. I know i am a crappy programmer since i am not very familiar with
object oriented languages. I am woindering...
|
by: Ebay boy |
last post by:
I have recently bought a compiler and I have this sample code that
includes the following:
#include <stdlib.h>
#include <string.h>
#include <time.h>
Unfortunately, my compiler doesn't...
|
by: Knady |
last post by:
Hi,
I have the following problem, I must to do my assignment, but I really do
not know how to use the malloc.
I need create a program that will be used to do some algebrical computation
on the...
|
by: Student |
last post by:
Hi All,
I have an assignment for my Programming language project to create a
compiler that takes a C++ file as input and translate it into the C
file. Here I have to take care of inheritance and...
|
by: Ark |
last post by:
Consider
static T foo;
..............
T get_foo(void) { return foo; }
In a multi-threaded (or -tasked) environment, I need to ensure that I
get_foo() grabs T atomically (e.g. is not...
|
by: Anonymous |
last post by:
Came across some code summarized as follows:
char const* MyClass::errToText(int err) const
{
switch (err)
{
case 0: return "No error";
case 1: return "Not enough";
case 2: return "Too...
|
by: Rene |
last post by:
Hello to all!
For a long time I have been "fighting" a problem compiling an OpenGL
program which uses GLUT. First I have put a question in a Watcom group
(I want to use this compiler) to which I...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |