• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to trace gremlin fouling my formula  RSS feed

 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I can't get the totalLift() or wingLoading() methods to calculate properly for some reason.  I have no compiler errors and have retraced my logic to no avail.  Any direction on getting those two items to function would be greatly appreciated. NOTE: I'm new to programming and I understand my deployment of XYZ may not be as elegant as what can be achieved, I'm primarily interested in the methods I mentioned.

Please let me know if you have any questions.

Below is the subject code, also attached.

CLASS BEGIN--->



***CLASS ENDS***

CLASS TESTER BEGINS--->

 
Paul Clapham
Sheriff
Posts: 22521
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Kilo wrote:I can't get the totalLift() or wingLoading() methods to calculate properly for some reason.


Hi Nick, welcome to the Ranch!

You've got a lot of code there, but you left out some important information... namely, what's wrong with the values returned by those methods? Could you give some examples of what you expected given certain inputs and what you got instead?
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I appreciate the quick review Paul.  Sorry for all the excess code, I didn't want to leave out something critical to the solution.

Unfortunately I don't have samples of verified correct output data, but as you'll see below, the outputs for totalLift() and wingLoading() or 0 and Nan, respectively.  I'm only confident that I'm wrong on those two currently, and I'm working under the assumption my dynamicPressure() is functioning correctly since I at least have an output beyond zero.

Please let me know if you have any additional questions.

Thanks again for the effort.

Here is the output of the tester class:


----jGRASP exec: java WingTester
----   at: Sep 9, 2016 4:25:31 PM

----jGRASP wedge: pid for wedge is 10616.
----jGRASP wedge2: pid for wedge2 is 10580.
----jGRASP wedge2: CLASSPATH is ";.;;.;C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip;C:\Program Files (x86)\jGRASP\extensions\classes".
----jGRASP wedge2: working directory is [C:\Users\Nick\Desktop\School Work\Fall 2016\Computer Science 13\Lab1] platform id is 2.
----jGRASP wedge2: actual command sent ["C:\Program Files\Java\jdk1.8.0_91\bin\java.exe" WingTester].
----jGRASP wedge2: pid for process is 11656.
Enter wing span of proposed aircraft (in feet) --> 30
Enter chord of proposed aircraft (in feet) --> 4.6
Enter anticipated cruising velocity of proposed aircraft (200 knots = 200) --> 120
Enter anticipated stall velocity of proposed aircraft (45 knots = 45) --> 45
Enter maximum lift of proposed aircraft --> 1.4
Enter cruising lift of proposed aircraft --> .3
Enter anticipated takeoff altitude of proposed aircraft (0-20,000 feet = 0-20 [increments of 1 per 1,000 feet ]) --> 0
Enter anticipated cruising altitude of proposed aircraft (0-20,000 feet = 0-20 [increments of 1 per 1,000 feet ]) --> 8

Would you like the calculation performed for STANDARD DAY or HOT DAY? Answer = '1' for HOT or '0' for STANDARD 0

The Dynamic Pressure equates to 6.87434442975 based on the following inputs:
Span 30.0
Chord 4.6
Cruising Velocity 202.68FPS
Stall Velocity 76.005FPS
Maximum Lift 1.4
Cruising Lift 0.3
Takeoff Altitude 0.0k feet
With a temp of STANDARD DAY

The Dynamic Pressure at your provided Cruising Altitude of 8.0k feet based on those same parameters above, equates to a Dynamic Pressure of 38.409035544000005

Based on the supplied inputs:
Span 30.0
Chord 4.6
Cruising Velocity 202.68FPS
Stall Velocity 76.005FPS
Maximum Lift 1.4
Cruising Lift 0.3
Takeoff Altitude 0.0k feet
Cruising Altitude 8.0k feet
Total achievable lift breaks down as follows:
Standard Day - Takeoff = 0.0
Standard Day - Cruising = 0.0
Hot Day - Takeoff = 0.0
Hot Day - Cruising = 0.0
Based on the supplied inputs:
Span 30.0
Chord 4.6
Cruising Velocity 202.68FPS
Stall Velocity 76.005FPS
Maximum Lift 1.4
Cruising Lift 0.3
Takeoff Altitude 0.0k feet
Cruising Altitude 8.0k feet
Total achievable wing loading breaks down as follows:
Standard Day - Takeoff = NaN
Standard Day - Cruising = NaN
Hot Day - Takeoff = NaN
Hot Day - Cruising = NaN
----jGRASP wedge2: exit code for process is 0.
----jGRASP: operation complete.
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just calculated the totalLift() manually, for the above parameters totalLift() should be 284.59785939165.

The apparent culprit seems to be takeoffDynamicPressureStandard not making it's way out of the dynamicPressure() method where the value of takeoffDynamicPressure is assigned to it, and thus passes a zero, throwing the calculation.  But takeoffDynamicPressure prints without issue in the call right before the value is assigned to takeoffDynamicPressureStandard. Anyone's thoughts?
 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm on my tiny tablet so I  can not test anything. Where are you re-initializing  the  variable 'wingArea', once you get the values of span and chord?
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's initialized toward the top only:

 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what I thought. Can you print out the value of it?
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the delay, I had it took me a minute to get it done but the result is "0.0", so there is one pain point identified. Thanks!  I will probably think about a solution, feel free to offer any advice on the matter should you have any.
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will go through and do that to each variable in the morning, I've been working on this thing for 9+ hours today and I feel my attention to detail degrading.  I'm opening to making any adjustments you have in mine while I got your attention though, but it may take me a few minutes to pound it out.   Thanks for the feedback so far.
 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A safe solution would be to change 'wingSpan' to a method 'wingSpan ()'.
 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Kilo wrote:I will go through and do that to each variable in the morning, I've been working on this thing for 9+ hours today and I feel my attention to detail degrading.  I'm opening to making any adjustments you have in mine while I got your attention though, but it may take me a few minutes to pound it out.   Thanks for the feedback so far.

Understandable,  and you are welcome!
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I call that method in place of "wingArea" in the calculation for the totalLift() method of the Wing class?




 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it look something like this?



Then I would use "area" in the calculation in the other method?
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was looking at this thread here, seemed similar: http://www.dreamincode.net/forums/topic/41274-calling-a-method-to-calculate-area/
 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I should have called it 'wingArea()'. My mistake. Well, the method body would simply be: return span × chord, and everywhere you now have 'wingArea' you would use 'wingArea()'.
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understood, I'll make the adjustment first thing in the morning. That was my initial thought but I didn't think I would be that lucky. Thanks!
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piet Souris you magnificent bastard!!!   wingArea() is what I needed, running like a champ now. If you can PM me an email I'll send you a $5 gift card to Amazon or Starbucks for the help.  Thanks again!
 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


hi Nick,
well, being able to help here at this forum is all the reward we need! I remember from my younger days that dealing with Physics formulae tends to make one very thirsty. So: 

Piet   
 
Nick Kilo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome, thanks again.  If you have a website/FB page or anything you want to follow/like send the link. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!