Sign in to follow this  
dragonflightdesign

Bit of a problem with generators

Recommended Posts

i.e. I can't start them! :smile:

 

The aircraft.cfg file contains an engine_generator_map line with a genny for each engine and I've tried

 

trigger_key_event(KEY_TOGGLE_MASTER_ALTERNATOR, 0);

 

and

trigger_key_event(KEY_TOGGLE_ALTERNATORx, 0);

 

but they don't seem to want to play. Is there something missing from the .air file, for example?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Since it's always worked for me... I'm going to assume you're mistaken on whether they're working.

 

How are you determining if they're working? (I know, sounds really stupid LOL)

 

Also show your map entry.

Share this post


Link to post
Share on other sites

Hello Ed

 

[electrical]

max_battery_voltage = 24.0
generator_alternator_voltage = 30.0
max_generator_alternator_amps = 400.0
engine_generator_map= 1,1,1

 

MODULE_VAR default_gen2_active =    {GENERAL_ENGINE2_GENERATOR_ACTIVE};

MODULE_VAR default_gen2_switch =    {GENERAL_ENGINE2_GENERATOR_SWITCH};

-----------------

 

    lookup_var(&default_gen2_active);
//    lookup_var(&default_gen2_switch);
//    if (!default_gen2_active.var_value.b )
//    if (!default_gen2_switch.var_value.b )
//    if (!default_gen2_switch.var_value.n )
    if (!default_gen2_active.var_value.n)
    {
//        trigger_key_event(KEY_TOGGLE_MASTER_ALTERNATOR, 0);
        trigger_key_event(KEY_TOGGLE_ALTERNATOR2, 0);
//        send_key_event(KEY_TOGGLE_ALTERNATOR2, 0);  

   }

 

 

I think that about sums up all of my tries. Running in debug mode shows that neither _switch nor _active ever changes from zero/false.

 

Do you need any other info?

 

-Dai

Share this post


Link to post
Share on other sites

Engines running? Also, since you're teling the sim that all 3 engines have a generator... why are you using the mask? The sim defaults to putting a generator on an engine, not the other way around.

Share this post


Link to post
Share on other sites

Hello Ed

 

That was quick! :)

 

The mask was just something I tried. Yes, the engines are running: the intro line to that section of code (which I should have left in) is:

 

if (e2n2.var_value.n>8700)
{

 

This always equates to true after engine start.

 

-Dai

Share this post


Link to post
Share on other sites

Remove the mask... see if you have generators working. This is FSX?

Share this post


Link to post
Share on other sites

It's FSX and it still fails without the mask. I've checked that I'm not doing something stupid like turning them off elsewhere but no. It's not an absolute that I use the FSX default generators - I just want to know if they're active and producing voltage - so it's just as easy to create my own (almost! :smile: ). If you've no other suggestions then I'll take this route; I appreciate your help, always.

Share this post


Link to post
Share on other sites

The concern is that the sim works, I know... I have several aircraft I've coded.

 

So you have something wrong somewhere... I'd hate to just ignore it.

Share this post


Link to post
Share on other sites

I'm definately head-scratching. As a test I set up a read/write in XML instead using execute_calculator_code but got the same result. Oh well, I'll keep poking at it. You're right - I'm not over-happy in just ignoring it either!

Share this post


Link to post
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
Sign in to follow this