Welcome to Dream.In.Code
Become a VB Expert!

Join 137,382 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,048 people online right now. Registration is fast and FREE... Join Now!




in depth equations

 
Reply to this topicStart new topic

in depth equations

zorba0332
8 Oct, 2008 - 08:27 PM
Post #1

New D.I.C Head
*

Joined: 8 Oct, 2008
Posts: 8

Hello all....
These 3 equations are use to determine the pressure of temperature compensated gas. (SF6)

I really have no clue how to perform math like this and was hoping for some guidance or explanation of not only how to solve but how to add into vb code.

I attached a small jpg file that shows the equations… if you can offer any thoughts, I would appreciate any feedback!! Thanks!!!!!



Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post

thava
RE: In Depth Equations
8 Oct, 2008 - 09:12 PM
Post #2

D.I.C Regular
Group Icon

Joined: 17 Apr, 2007
Posts: 456



Thanked: 18 times
Dream Kudos: 50
My Contributions
hii
seems it is physics
in all equations there is a variable T what is it ?

for finding the solutions for all
declare an array
and set the value for every index
make a for loop for all the summations and calculations
substitute the values
that's all you get the answer

if you want a code for solving the equation then

first give a little try and show where did you struck post your question here wait for some time one of us clear your points or i will try to solve your problem icon_up.gif icon_up.gif icon_up.gif icon_up.gif

This post has been edited by thava: 8 Oct, 2008 - 09:14 PM
User is offlineProfile CardPM
+Quote Post

zorba0332
RE: In Depth Equations
9 Oct, 2008 - 06:20 AM
Post #3

New D.I.C Head
*

Joined: 8 Oct, 2008
Posts: 8

Hello thava!
Thanks for you input!!! I am trying to solve the first equation and see where it gets me. It seems that this is the easiest of the three!!!

These equations basically solve liquid density, vapor pressure and weather in a liquid state or in a vapor state. All based on the Pressure and temperature of the gas. Very very heavy gas at that.

So T is temperature and I believe it to be all represented in Rankine throughout the equations.

I will take a day or two to work out the first one if I can. I appreciate your interest in helping!

Thanks so much for the post!!!

Zorba

User is offlineProfile CardPM
+Quote Post

jens
RE: In Depth Equations
10 Oct, 2008 - 11:38 AM
Post #4

D.I.C Head
Group Icon

Joined: 9 May, 2008
Posts: 119



Thanked: 4 times
Dream Kudos: 150
My Contributions
QUOTE(zorba0332 @ 8 Oct, 2008 - 09:27 PM) *

I attached a small jpg file that shows the equations… if you can offer any thoughts, I would appreciate any feedback!! Thanks!!!!!


Ok, I had some problems reading the smaller parts of your equations. Somthing might be misinterpreted. I have solved your first equation for you and give you the code here. Now, this is more math/physics than programming so I didn't do any fancy stuff, it just pops up a messagebox with the answer.

In VB6 create a form, double-click it in the designer. Remove all code present in the edit window and paste in code below and press the run button.

Then your work starts...
Try to make a field for temperature input on your form.
Make a button that calculates the temperature you gave.
Hints: Textbox1.text, button1_click, cdouble(), "const" means constant... smile.gif

CODE

Private Sub Form_Load()
    Const T = 373 'This is 100 Celsius (boiling water) expressed in Kelvin as an example
    Dim Pc  As Double
    Dim D(4) As Double
    Dim sigmaSum As Double, answer As Double
    
    Pc = 45.3
    D(1) = 91.9
    D(2) = -17.7
    D(3) = 81.3
    D(4) = -39.2
    
    'A little math...
    'a rto (raised to) x = e rto (x * ln(a))
    '(T-1) rto i/3 = e rto ((i/3) * ln(T-1)
    
    'A little VB6...
    'In VB6 e raised to x is expressed exp(x)
    'In VB6 the natural logarithm of Y is expressed Log(Y)
    
    'I put the Di part outside the Sigma for a while...
    sigmaSum = 0
    For i = 1 To 4
      sigmaSum = sigmaSum + D(i) * Exp((i / 3) * Log(T - 1))
    Next i
    
    'Total represents what the expression to the right of the "="-mark computes to.
    answer = Pc + sigmaSum
    MsgBox (CStr(answer))
    Unload Me
End Sub


Edit:
I see this is about density. The code I supplied gives NEGATIVE results which is totally unreasonalble. There must be somthing I didn't read correctly.... Hope the code gives you a clue any way.

/Jens

This post has been edited by jens: 10 Oct, 2008 - 12:07 PM
User is offlineProfile CardPM
+Quote Post

zorba0332
RE: In Depth Equations
10 Oct, 2008 - 04:23 PM
Post #5

New D.I.C Head
*

Joined: 8 Oct, 2008
Posts: 8

Thanks!!! I was woking on the same way and reading about arrays!!! hahahaha

You need to abs the answer I believe... abs()

I will be looking at this this weekend.. you did the easy one.. hehhhehe

I have a form already made... just need to add the names... (easy stuff)
The next equation will be far more harder but i really want to try to get it...

I really like VB.. as well as VBA...

Thanks for the input!!!!!!

Zorba
User is offlineProfile CardPM
+Quote Post

jens
RE: In Depth Equations
11 Oct, 2008 - 08:19 AM
Post #6

D.I.C Head
Group Icon

Joined: 9 May, 2008
Posts: 119



Thanked: 4 times
Dream Kudos: 150
My Contributions
If you need more help, just ask. In that case I need a larger picture of the equations.

If you found my post helpful, please click the "This post was helpful!" below my post. They are my collectors items... smile.gif

/Jens
User is offlineProfile CardPM
+Quote Post

zorba0332
RE: In Depth Equations
14 Oct, 2008 - 05:20 PM
Post #7

New D.I.C Head
*

Joined: 8 Oct, 2008
Posts: 8

Well I have played with this system and came up with a pretty good running model.
The playing was fun, entertaining and very enlightening. VB is very powerful just as with Logic programming (PLC software) there is so many ways to do the same thing, there is questions as to what is the wrong way.

I did however find that the equations I wanted to solve did not give me the answers to the problems at hand. They helped.. but not the solution.

I do have far more questions with moving foward but am finding too much fun trying to solve it first.

I have a very complex excell program that is very embedded that works. I have to follow it and find a way to put this into a VB program.

I will continue to look and review and see if I can put it into a system that flows and works.

Thanks for the help thus far!
User is offlineProfile CardPM
+Quote Post

jens
RE: In Depth Equations
15 Oct, 2008 - 11:36 AM
Post #8

D.I.C Head
Group Icon

Joined: 9 May, 2008
Posts: 119



Thanked: 4 times
Dream Kudos: 150
My Contributions
Tried to PM you but it seems you have PMs turned off.

Your excel sheet, what is it about? Is it by any chance dealing with heat exchangers?

/Jens
User is offlineProfile CardPM
+Quote Post

zorba0332
RE: In Depth Equations
15 Oct, 2008 - 04:05 PM
Post #9

New D.I.C Head
*

Joined: 8 Oct, 2008
Posts: 8

QUOTE(jens @ 15 Oct, 2008 - 12:36 PM) *

Tried to PM you but it seems you have PMs turned off.

Your excel sheet, what is it about? Is it by any chance dealing with heat exchangers?

/Jens


Hi /Jens
No PM yet... tooooo much of a noob here still (I think)
Nope.. not heat exchanger... no delta T...
This is a a very heavy gas. The equations I offered only help to compare data to a curve that is non linear. So doing the equations helps compare the coefficients of the gas to the particular temperature and to calculate the density at that particular place on the graph.

This gas changes pressure very much under temperture changes. Far more the O2. In my job, I have to chart these pressures constanlty. Some very smart people put this into a spread sheet but I want to do it in a VB program. I just have far more to learn.

As far as HE... I have done tons of work with PLC's and MMI interface controlling water cooling using Chillers (big in's too 650 ton) colling towers, HE, VFD pump control etc.... Water conditioning, chemical additives, controling and monitoring discharges etc... I am a Rockwell Software / Allen Bradly Freak... hehehehe
User is offlineProfile CardPM
+Quote Post

jens
RE: In Depth Equations
16 Oct, 2008 - 12:36 PM
Post #10

D.I.C Head
Group Icon

Joined: 9 May, 2008
Posts: 119



Thanked: 4 times
Dream Kudos: 150
My Contributions
Sounds like a lot of fun, could you tell what gas? Guess you're in to powerplants and that would make the gas.... ...over critical water? (I don't know the english word for it but water under such temperature and pressure that it is neither liquid or gas)

You really should look at Visual Basic 2008 Express Edition. It's free and has many nice features. You will have to get used to OOP though - it sure is taking its time for me to learn OO.

Fun with someone more working with PLC's. I'm using GE-Fanuc at current work. Doing MMI in VB6 and trying to convince people to switch to VB2008.

/Jens
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/5/08 01:48AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month