2014년 12월 15일 월요일

Aircraft Weight & Balance


So, I am in commercial Helicopter pilot school, I have been looking for a Bell 206L3 weight and balance program out there somewhere,and it just isn't there.  So in my infinite wisdom, I decided I would try to make one... Yeah after the tutorials and countless all-nighters I am hitting a wall.  I made a drawing board in photoshop of what I wish to accomplish, and so far all I can get to work is the basic calculations on screen 2.  I'm trying to incorporate a database using lists, but it's just not clicking for some reason.  I have read every topic I can find on this in the forums, think I need a Barney style idiot-proof description or pictures.  Any help would be appreciated.  I'll attach the drawing board and what I have so far.  After I finally get this part functioning I need to add one more screen to display Center of Gravity graphs to display limits.  This is my intro into Java and I think I took a HUGE bite...  Thanks all



--
First of all, AI2 does not help you to bite into Java and you should be thankful for that! Maybe you can really start doing Java by the time you think the app you are trying to make now was a piece of cake.

Why don't you take things step by step?
Start with completing the code in screen 2. You probably want to have a global variable that is going to contain a list with all the items in your template for one plane. You should also have a TinyDB in this screen, where you can put this list when you press save. As tag you probably want to use the tail number, I suppose it is unique. When you are ready with this, you can go to screen 3. Here you also want a TinyDB and automagically it will contain what you have saved in screen2. Instead of those balls, maybe you want a ListView, that you can use to display the tail numbers you have saved so far and you could find the details as you have saved them in the TinyDB. When you have all this working, you probably know how to continue.
So again, step by step, try something for screen 2, and if you get stuck, post again.

--
Thanks for the input, as for the "balls" I just have the number in them right now and they are hidden until populated.  What I am working on is using TinyDB to call the tailnumber and record number saved from screen 2, making the 1(for instance) visible, and replacing 1 with the tail number entry for record #1, so there will be a blank screen until it is populated with aircraft.  Then as they become visible, the button will appear with the tailnumber as their text.  That way I can populate another area with that pre-loaded weight/cg/and mom to do the later required calculations and graphing.  I would like to complete one page at a time, but the amount of cross-referencing required for the different data is mind blowing.  But hey a lot of time spent now should save me time later right? :)


--

OK, first thing I'll say... you're not biting into Java at all... AI doesn't use it.  You'll be able to play with the blocks, and add actions and stuff via the blocks, but this is not in any way Java ;)!


Couple of things I see right away... Screen 2 should not be buttons, but a list view of available aircraft.  You'll do way too much work aligning things with the buttons, and it's really not necessary.

It's really difficult to see the code blocks and definition in your screenshots.

I believe you're using a TinyDB there.  That's fine. Again, if you use a ListView or a ListPicker for the list of aircraft, it'll make your life much easier cause you can assign the tags tot he ListPicker Elements.  One thing... you're saving on tag number, and I probably wouldn't do that. I would opt to save the records with the tag being a brief description of the craft and THEN a tag number... that way, you could group aircraft by type.

For the graphs in the end, you'll have to do everything on a canvas, drawing your graph manually line by line, then adding the data etc.

--
ok, so I am about 75% complete,now I am starting to get errors and I have been trying to figure out where.  It happens on initialization so I am assuming its in one of the hundreds of TinyDB calls... I have scoured and cannot see where the "dave" thing is coming from, any suggestions would be appreciated.






--

Wow... so think I figured it out finally... just was looking 1 too deep in database, removed the TinyDB calls and went straight to "global personnel" and bingo!


--
Dave... The message says you're trying to get item two from something that only has one.


You're overworking this... In screen.initialize, get the value from default personnel, which will be a list and store that value to the list.  Then, use the list you store the default_personnel data to to extract everything.  Don't make constant calls to the TinyDB... it's not necessary.

Oops... just saw your new post... yes, you were going too deep...

--
is there an easier way to draw? I have like 2200 blocks to get the graphs I want... I hope its not mandatory lol..   and I only end up with this...











--
I'm getting no errors in the AI companion, as soon as I bundle it to APK it starts and gives me this...I just cant win...



--


There are several things you can do... For example, for the horizontal and vertical lines, you can have 4 statements in each of two loops that just increments the coordinates every time it loops.  Instead of 14 sets of three blocks for the vertical lines, you could do that with one loop of a total of 16 blocks...  For example, here's one loop....  You can do the same for the lateral stuff too.

--
As you realize, the Canvas is not a Drawing program.  You are doing some neat things, however rather than draw the entire Canvas image, just draw part of it with AI2 and the rest with the graphics program you might have on your PC.

Being able to use a 'calibrated' Canvas.BackgroundImage to draw on might work depending on how you need to use these images within your app.  It appears these diagrams you are drawing from scratch are either sophisticated histograms  or  a nomogram. If you use a background template, the Canvas dimensions must be identical to the graph dimensions to keep this simple and at the same time, will save you lots of blocks.

If you just need to 'fill-up' the vertical space, from bottom to top, you could then program the Canvas to display a line of width whatever you want, sequentially, using as many lines as needed where the 'line' width would vary if necessary as the stacking of lines proceeds up the graph (higher in the aircraft).   That could be done with the DrawLine on the Canvas or you could use a sprite (for the line) or several sprites. 

It is possible to do some neat things with the Canvas:

Consider using a scaled background image... sorry I do not have an example of that at the moment and forgot where in the forum I saw someone do exactly that.

--
Here's an example of a background scale ... Accelerometer tester

--
Basically what needs to be done on these images,is when you get your calculations back from that specific aircraft, with the pilot, passenger, fuel,and baggage info, it will display points and lines mapping out your center of gravity and it needs to be inside the limitations drawn so far,otherwise you will not have the adequate forward or rear control to land or takeoff.

--
Understand that Dave.  What is suggested is a way to simplify the drawing.   It may or may not work for you.


and the code looks something like this:

where the image is 325 x 215 ...   but you would have to figure that out yourself.

The Touched is used to help calibrate the background image ... it posts the x and y coordinates of points on the 'graph' template to the Title Bar.
What I would do to get the thing to fill in the upper regions is to change the x1 and x2 coordinates appropriately.    Of course, this may not be what you want to do with the graph.

At the moment, only you understand what you want to do.

--
That May help, but the graph will look more like this, it is a graphical representation of the change in center of gravity of the aircraft as you burn the available fuel.


--
you might want to take a look at http://www.chartjs.org/ and their line chart
I have an example which uses their pie chart here

--
Why is the visualization of the chart needed?

The chart might be encoded as a lookup table in the app,
a csv table with two columns:

1. Fuel in liters (0-500)
2. Fuselage station in inches or whatever.

This would be a list of lists, for use with the
lookup in pairs block, effectively taking in
fuel level and returning fuselage station readings.

If the app could convert one into the other, why would
the graph be needed?

--
Doable with Canvas most probably Dave.

If all you need are the red points and can live with straight-line curve (in green) between them this can be done probably fairly accurately on the AI2 Canvas.'

What the graph above has is 12 x 13 cells, place a 12 x 13 grid in the Canvas background like shown in the image I sent earlier, calibrate using the Touched block.    Do your calculations for the points in red.   Post them to the graph at the nodes using the Circle control; draw a line between them as required using the DrawLine

If you need the curvature, then either plot more points (pixel by pixel ..Canvas will do that) and you do not need the green lines.  This is simple trig and being able to plot coordinate to coordinate will help.

My 36 buttons with Scotts snap    https://groups.google.com/forum/#!searchin/mitappinventortest/36$20buttons/mitappinventortest/c7xYUTKFG_Q/hlwOMxsNm6oJ  shows a way to snap data to the grid if necessary..

--
@Abraham:  The graph is needed because before you fly, you need to know what your weight and CG will be at all times.  If you are going somewhere 40 miles away, you need to know what your CURRENT CG will be.  Each aircraft has it's own burn rate for fuel, each aircraft weights different amounts so starting values are different.  Be any flight you need to know you full fuel, empty fuel, most forward, and most aft CG(Center of gravity) and ensure your not outside of the operating limitations.  I want this app to plot the relevant data on this in the general shape of that diagram as the Bell 206 burn operations are basically that of which is shown.  There are also different ones depending on aircraft serial number which I already incorporated the discriminator for that.

--
@Steve: Yeah that straight line is livable.  I think I'll give that a try.  If I get stuck I'll Let ya know.  As for why the grids are different, that is just the fuel burn diagram, it gives different information but in the same way.  Overall that is what the basic shape of it should be after you calculate.  Because the 206 has 2 fuel tanks so it kind of teeter totters back and forth gradually as you burn fuel.  Thanks

--
Ok, here is a weird error for you... When I save something in the listpicker, then later in the same instance of the program delete it, next time I go to the listpicker screen, it flashes on and off REALLY fast I have to click like 50 times to finally get a selection in.  Any Idea how to prevent this?  Don't really have a way to get a picture of that... but I am making some killer progress on this thing... only one real error right now other then the blinky listpicker thing...workin it out though.



--
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

PS: don't hesitate to start a new thread for new questions next time...

--
As I said in the last message, it's not really possible to get a screenshot of the error...It flashes at like 50-60 times per second like it is trying to close the listpicker and re-open it a bunch of times, but I have no idea why it would do that.  I'll include the coding for the listpicker and the delete box because those should be the only things affecting that option...

--
Do you have a timer running?  If so, what's the interval set to?

--
nope

--
You MUST have some recursion going on there... Just look for anything that triggers a listpicker or a choice of some sort and that should lead you to your recursion.

댓글 없음:

댓글 쓰기