Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 (VB6) VisualBasic6.0 Runtime error 11, 2 Variables cannot be equal

views
     
TSpearlloi
post Nov 23 2014, 11:45 AM, updated 10y ago

New Member
*
Junior Member
7 posts

Joined: Nov 2014
I need help in solving a VB coding.

This is my condition

http://i.pictr.com/ujsfs7phro.png

http://i.pictr.com/1x9c241ady.png


How can i solve this problem? The Tc variable turned 0 caused the followed answer uncountable and it turns up into runtime error 11.
AkasakaRyuunosuke
post Nov 23 2014, 11:02 PM

Getting Started
**
Junior Member
101 posts

Joined: Mar 2014

I dont know what are you calculating. but yes, it divide by zero..which is not understandable by machine.

try to use "Throw Statement"
http://msdn.microsoft.com/en-us/library/5hsw66as.aspx

Hopefully this can help you.
TSpearlloi
post Nov 24 2014, 08:58 AM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
Hi, i am calculating an aircraft's engine temperature value (Tc) with the followed equation:

Tc = ((2 / (Ygas +1) * T05A)

where Ygas is constant and T05A is the temperature of the engine in the previous stage.

As it shown, when i highlight the right hand side equation, i got 1023.03.
Supposingly, the Tc = 1023.03, but Tc end up equal to zero.

Which i dunno why sad.gif

P/S: i cant use "On Error Resume Next " cause every equation are linked.

shahnazz
post Nov 24 2014, 09:50 AM

Getting Started
**
Junior Member
182 posts

Joined: Jan 2003


Have you properly declared your variables to the correct data type?
TSpearlloi
post Nov 24 2014, 10:01 AM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
i already declared Tc as Double.
shahnazz
post Nov 24 2014, 10:10 AM

Getting Started
**
Junior Member
182 posts

Joined: Jan 2003


Can you give me the actual values for Ygas and T05A?
Also are these two variables also declared?
blackstar88
post Nov 24 2014, 11:47 AM

Casual
***
Junior Member
424 posts

Joined: Apr 2013
QUOTE(pearlloi @ Nov 24 2014, 08:58 AM)
Hi, i am calculating an aircraft's engine temperature value (Tc) with the followed equation:

Tc = ((2 / (Ygas +1) * T05A)

where Ygas is constant and T05A is the temperature of the engine in the previous stage.

As it shown, when i highlight the right hand side equation, i got 1023.03.
Supposingly, the Tc = 1023.03, but Tc end up equal to zero.

Which i dunno why sad.gif

P/S: i cant use "On Error Resume Next " cause every equation are linked.
*
I am not sure any1 notice it or not... but your code obviously show Tc = T6A
it got nothing to do with your equation u give above
shahnazz
post Nov 24 2014, 12:54 PM

Getting Started
**
Junior Member
182 posts

Joined: Jan 2003


QUOTE(blackstar88 @ Nov 24 2014, 11:47 AM)
I am not sure any1 notice it or not... but your code obviously show Tc = T6A
it got nothing to do with your equation u give above
*
Gosh. You're right. rclxms.gif
TSpearlloi
post Nov 24 2014, 06:27 PM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
QUOTE(blackstar88 @ Nov 24 2014, 11:47 AM)
I am not sure any1 notice it or not... but your code obviously show Tc = T6A
it got nothing to do with your equation u give above
*
no no no...what i meant was, the Tc value can only get from the equation.


http://i.pictr.com/twtj6ncxa5.png


The T05 is the temperature of air in turbine.
After passed through Turbine the air tempeature will decreased into Tc

where Tc is the same as T6A. Thats why i code Tc = T6A which T6A never appear in the previous coding.

Besides, i also declared T6A as doubled

Sorry to confuse you guys doh.gif

i got this thing stuck with my final year project rclxub.gif
TSpearlloi
post Nov 24 2014, 06:31 PM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
QUOTE(shahnazz @ Nov 24 2014, 10:10 AM)
Can you give me the actual values for Ygas and T05A?
Also are these two variables also declared?
*
Basically, all variables are declared.

For your information, Ygas = 1.33 and T05A can be any value depends on the amount of air entered and the surrounding temperature.

but you may try T05A = 764.2 and suppose Tc = 655.97
shahnazz
post Nov 24 2014, 07:24 PM

Getting Started
**
Junior Member
182 posts

Joined: Jan 2003


QUOTE(pearlloi @ Nov 24 2014, 06:27 PM)
no no no...what i meant was, the Tc value can only get from the equation.
http://i.pictr.com/twtj6ncxa5.png
The T05 is the temperature of air in turbine.
After passed through Turbine the air tempeature will decreased into Tc

where Tc is the same as T6A. Thats why i code Tc = T6A which T6A never appear in the previous coding.

Besides, i also declared T6A as doubled

Sorry to confuse you guys  doh.gif

i got this thing stuck with my final year project  rclxub.gif
*
If I get what you mean there, I suppose the correct assignment would be:

T6A = TC

Because if it's the other way round, TC will get the value of T6A instead
shahnazz
post Nov 24 2014, 07:25 PM

Getting Started
**
Junior Member
182 posts

Joined: Jan 2003


Or more specifically:

if ... then

T6 = TC
T6A = TC

... some more code ...

end if

TSpearlloi
post Nov 25 2014, 08:27 AM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
QUOTE(shahnazz @ Nov 24 2014, 07:25 PM)
Or more specifically:

if ... then

T6 = TC
T6A = TC

... some more code ...

end if
*
ok...i did what you mentioned. i also changed the name of the variable from Tc to Tc1 and it works...
However, the other variables and equation experienced the same as the previous Tc condition which is 0...

it is something to do with the name?
shahnazz
post Nov 25 2014, 08:30 AM

Getting Started
**
Junior Member
182 posts

Joined: Jan 2003


I will need to look at your flowchart / pseudocode and compare with your source code to see if it is correct.
TSpearlloi
post Nov 25 2014, 08:56 AM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
but i dun recommend you to see the codes, cause its more than 10,000 lines...haha...

i try myself first, if still cant, i will refer to you...Thanks alot ^^
khk1987
post Nov 25 2014, 09:04 AM

Getting Started
**
Junior Member
257 posts

Joined: Jul 2007
From: 5

Check any value assigned to Tc that is zero. Use break points on this assignment to Tc. Then if found, check whether the value is calculated properly.

This post has been edited by khk1987: Nov 25 2014, 09:10 AM
blackstar88
post Nov 25 2014, 02:52 PM

Casual
***
Junior Member
424 posts

Joined: Apr 2013
QUOTE(pearlloi @ Nov 24 2014, 06:27 PM)
no no no...what i meant was, the Tc value can only get from the equation.
http://i.pictr.com/twtj6ncxa5.png
The T05 is the temperature of air in turbine.
After passed through Turbine the air tempeature will decreased into Tc

where Tc is the same as T6A. Thats why i code Tc = T6A which T6A never appear in the previous coding.

Besides, i also declared T6A as doubled

Sorry to confuse you guys  doh.gif

i got this thing stuck with my final year project  rclxub.gif
*
Tc = ((2 / (Ygas +1) * T05A)
until this point ur Tc is 1023.xxxx, so lets assume this value is "A"

Pc = some formula, so i presume now you Pc got some value

If (condition) then
Tc = T6 <<<<<value "A" is replaced by T6, presume value "B", so now Tc is "B"
Tc = T6A <<<<<value "B" in Tc is replaced by T6A, so now Tc have the value of "C".... so value of T6A is? if T6A is 0, then u get error 11


To break down what you have done:
Tc = some formula << not used AT ALL, coz being replaced after than by T6
Tc = T6 <<not used AT ALL, coz being replaced by T6A
Tc = T6A <<used only this. the formula below which gives you error 11 if T6A is 0 or null

no point you do so much calculation since u dont use the formula AT ALL!!
why waste so many lines of code when you dont use them?

if your purpose is to get 1023.xxxxx to D6, you should do it like this:

Tc = some formula
nn = textbox.text
Pc = some formula
if (condition) then
M6=1
Rgas = some formula
V6 = some formula

D6 = (Pc / Rgas * Tc) << there is no point assign P6 = Pc, straight put Pc here is more efficient and ignore T6 and T6A
.
.
.

This should make u get what u want...

And "where Tc is the same as T6A. Thats why i code Tc = T6A which T6A never appear in the previous coding." << this is why it is 0 or null, coz you never assign anything to it
declare a variable as double/int/or anything will not gives it a value.

This post has been edited by blackstar88: Nov 25 2014, 03:12 PM
TSpearlloi
post Nov 26 2014, 09:48 AM

New Member
*
Junior Member
7 posts

Joined: Nov 2014
QUOTE(blackstar88 @ Nov 25 2014, 02:52 PM)
Tc = ((2 / (Ygas +1) * T05A)
until this point ur Tc is 1023.xxxx, so lets assume this value is "A"

Pc = some formula, so i presume now you Pc got some value

If (condition) then
Tc = T6 <<<<<value "A" is replaced by T6, presume value "B", so now Tc is "B"
Tc = T6A <<<<<value "B" in Tc is replaced by T6A, so now Tc have the value of "C".... so value of T6A is? if T6A is 0, then u get error 11
To break down what you have done:
Tc = some formula  << not used AT ALL, coz being replaced after than by T6
Tc = T6 <<not used AT ALL, coz being replaced by T6A
Tc = T6A <<used only this. the formula below which gives you error 11 if T6A is 0 or null

no point you do so much calculation since u dont use the formula AT ALL!!
why waste so many lines of code when you dont use them?

if your purpose is to get 1023.xxxxx to D6, you should do it like this:

Tc = some formula
nn = textbox.text
Pc =  some formula
if (condition) then
M6=1
Rgas = some formula
V6 = some formula

D6 = (Pc / Rgas * Tc)  << there is no point assign P6 = Pc, straight put Pc here is more efficient and ignore T6 and T6A
.
.
.

This should make u get what u want...

And "where Tc is the same as T6A. Thats why i code Tc = T6A which T6A never appear in the previous coding."  << this is why it is 0 or null, coz you never assign anything to it
declare a variable as double/int/or anything will not gives it a value.
*
arghh...i see i see....i got what you mean nod.gif Thanks, let me try it out first ^^ laugh.gif
blackstar88
post Nov 26 2014, 09:54 AM

Casual
***
Junior Member
424 posts

Joined: Apr 2013
QUOTE(pearlloi @ Nov 26 2014, 09:48 AM)
arghh...i see i see....i got what you mean  nod.gif  Thanks, let me try it out first ^^  laugh.gif
*
good to know you finally understand... rclxms.gif thumbup.gif

 

Change to:
| Lo-Fi Version
0.0177sec    0.43    5 queries    GZIP Disabled
Time is now: 28th March 2024 - 09:39 PM