José Ignacio Posted November 12, 2017 Report Posted November 12, 2017 (edited) 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 November 12, 2017 by José Ignacio missing [i]
Pete Dowson Posted November 15, 2017 Report Posted November 15, 2017 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
José Ignacio Posted November 18, 2017 Author Report Posted November 18, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now