SIOC Programming

Yesterday i spent 4 hours (including 1,5 with my wife, thanks alot:-) )to get the following running:

If Aircraft on ground and Engine is running, than one LED should go on.
If the Engines are off the LED should be off.

If the Aircraft is in the Air, the LED should be off, except if the Flapstatus is >0 than the led should be again on.

But we were not able to get this working. Hopfully someone in the OC Forum can help us… I will post the results here.