Jump to content
The simFlight Network Forums

takeoff.lua


Recommended Posts

Hi there, I wrote a simple lua file to compute the length of the take off roll.

It works, but if you have a look at the file I had to use an auxiliary array f to make the conversion to feet.

f = 1.687*e

It didn't work if I simply wrote

e = 1.687*e

I really can't understand why....

I would appreciate any comment.

Regards

Jose Ignaciotakeoff(1).lua

Edited by José Ignacio
missing [i]
Link to comment
Share on other sites

On 11/12/2017 at 10:37 PM, José Ignacio said:

t works, but if you have a look at the file I had to use an auxiliary array f to make the conversion to feet.

f = 1.687*e

It didn't work if I simply wrote

e = 1.687*e

I really can't understand why....

Sorry, I don't know why either. May be worth asking on the Lua website. Not sure of the actual link to a support forum, but start as lua.org.

What actually was the "didn't work"? Gave an error, or obtained incorrect values?

BTW, you are using an expanding array but only seem to use two elemants at a time: indexed and [i-1]. why not make it more efficient using just a "current" and "previous" value and moving one to the other? Even a small structure with your v, t and e in it, to make it a one line copy over.  And elapsed doesn't need to be an array as you only use the first and the current.

Pete

 

Link to comment
Share on other sites

Thank you for your comments Pete.

Certainly it could have been done with a "current" and "previous" scheme but in my first sketch I wanted to keep track of all variables for debugging and/or logging purposes.

The error I get is that roughly at i =30 ( I don't remember the exact value), e starts to grow very quickly even if the aircraft is stopped and eventually saturates. I suspect it has something to do with arrays boundaries which are very tricky. Anyway I am afraid I have not time to do further research...

Regards

Jose

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.