Batt Warning Light - Reset on Battery Switch

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
warbirdguy1
Posts: 25
Joined: Sat May 01, 2021 12:57 am
Location: United States

Batt Warning Light - Reset on Battery Switch

#1 Post by warbirdguy1 »

Hey all I am starting to work on some LED caution panel for a project I am working on.

---On the real aircraft

The Battery Warning light comes on when the Battery is no longer charging (failed charging system or the generator is not on).

If the charging system kicks back on the Battery Warning light will only turn off if the Battery Switch is reset.

--In my code

The Battery Warning light turns on when the charging system fails or the generator is off which is correct.

My problem is that the light goes out as soon as the charging system is restored.

How can I make a condition where the Battery Warning LED can only turn off if the Battery Switch is cycled once the charging system is restored?

See below for my current code. Thanks in advance!

-----

Code: Select all


led_is_charging = hw_led_add("Arduino_MEGA_2560_A_D13",0)

function num(bool)
if bool then return 1 else return 0 end
end

function is_charging(charging)
    hw_led_set(led_is_charging, 1-num(charging))
end

fsx_variable_subscribe("ELECTRICAL BATTERY IS CHARGING", "Bool", is_charging)

"I know just enough to break something"

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Batt Warning Light - Reset on Battery Switch

#2 Post by JackZ »

Hi

Without more information(addon used, type of airplane, for the sim platform I assume it’s FSX), it’s gonna be difficult to help, but from what I see, the answer is in part in the question.

You are only subscribing to the ELECTRICAL BATTERY IS CHARGING state. But the annunciator BATTERY WARNING LIGHT is not linked to this! It is usually related to a minimum battery voltage.

The battery bus is usually used at startup and during emergency when the generators are non longer generating voltage.
When the battery voltage is below a certain value, then the charging system automatically kicks in, unless the generator is not working (engines off, or generators turned off).

After startup this annunciator should light up for a brief moment until the battery is fully replenished (batt voltage above a certain voltage).
If the charging system fails the battery voltage will not raise to its charged level and the warning light comes on again.

So I would rather use the « battery voltage » as a trigger, along with a « generator are on » surveillance as a criteria for turning on the light.
But once again, without further information, it is difficult

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Batt Warning Light - Reset on Battery Switch

#3 Post by jph »

Agree with Jacques 100%

Out of interest and just as a guide , you can also reduce your existing code to -

Code: Select all

led_is_charging = hw_led_add("Arduino_MEGA_2560_A_D13",0)
function is_charging(charging)
    hw_led_set(led_is_charging,(charging)) 
end
fsx_variable_subscribe("ELECTRICAL BATTERY IS CHARGING", "Bool", is_charging)
Providing the led is supposed to illuminate when charging. ?
Joe
Joe. CISSP, MSc.

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Batt Warning Light - Reset on Battery Switch

#4 Post by JackZ »

Nearly one week from the initial message of the OP & no reply from him/her. Typical. :x
Sometimes one wonders why spend time to help people like this one. Lesson learnt.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Batt Warning Light - Reset on Battery Switch

#5 Post by jph »

JackZ wrote: Sat May 08, 2021 12:14 pm Nearly one week from the initial message of the OP & no reply from him/her. Typical. :x
Sometimes one wonders why spend time to help people like this one. Lesson learnt.

Jacques
Jacques
It is Fecking annoying !.
I agree, It makes one pissed off. Perhaps we need a section where people with a few posts can only post in ? - I know, I know, it is difficult, and I don't know the answer. :cry:
But..............
Joe. CISSP, MSc.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Batt Warning Light - Reset on Battery Switch

#6 Post by Sling »

jph wrote: Sat May 08, 2021 1:12 pm Jacques
Perhaps we need a section where people with a few posts can only post in ? - I know, I know, it is difficult, and I don't know the answer. :cry:
But..............
I proposed something like this to help with the spamming issue quite recently and some of you didn’t like it. Other forums do it in varying different ways. Anyone been through the FSE registration process will know what a pain that is. No perfect answer but something a little different might be worth a trial.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Batt Warning Light - Reset on Battery Switch

#7 Post by Keith Baxter »

Hi

I have a different view... :evil:

The OP posted his first post on...
Post by warbirdguy1 » Sat May 01, 2021 3:19 am

The first response was a few days later.,...
by JackZ » Mon May 03, 2021 2:56 pm


If it was me posting here for the first time waiting all this time for some help. Would you return???

Looks like the OP was quite resilient and did, and now is accessing advice given

And was last on line on the ....
Last active:Fri May 07, 2021 11:15 pm

We all to often take things for granted and do not look in the mirror.

I sure hope that we all reconsider how new members are treated and stop taking digs and cheep swipes at them. Most come here for advise and guidance expecting some warm fuzzies. Lets provide that to all the new members and keep the cold pricklies off this forum.

My 2p

Keith

EDIT: I see the OP was online at "Last active:Sat May 08, 2021 5:25 pm" soon after I posted. Hopefully he takes heart and reverts to us.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
warbirdguy1
Posts: 25
Joined: Sat May 01, 2021 12:57 am
Location: United States

Re: Batt Warning Light - Reset on Battery Switch

#8 Post by warbirdguy1 »

Some of us have jobs and do not dedicate all our spare time to making our fake airplanes fly...No shocker if we are not sitting at our PC on every lunch break ready to engage with every new reply.

Thanks for those who provided constructive feedback.
"I know just enough to break something"

User avatar
warbirdguy1
Posts: 25
Joined: Sat May 01, 2021 12:57 am
Location: United States

Re: Batt Warning Light - Reset on Battery Switch

#9 Post by warbirdguy1 »

jph wrote: Tue May 04, 2021 9:36 am Agree with Jacques 100%

Out of interest and just as a guide , you can also reduce your existing code to -

Code: Select all

led_is_charging = hw_led_add("Arduino_MEGA_2560_A_D13",0)
function is_charging(charging)
    hw_led_set(led_is_charging,(charging)) 
end
fsx_variable_subscribe("ELECTRICAL BATTERY IS CHARGING", "Bool", is_charging)
Providing the led is supposed to illuminate when charging. ?
Joe
The light in this particular case only illuminates if the battery is not charging.

Here is my current code but it is not working. Still trying to figure out what I am missing here.

My problem resides with the is_charging and is_batt_sw since I only desire the Battery Warning light to extinguish when the switch is cycled off and on.

Code: Select all

led_is_charging = hw_led_add("Arduino_MEGA_2560_A_D13",0)
led_is_alt1charging = hw_led_add("Arduino_MEGA_2560_A_D12",0)
led_is_alt2charging = hw_led_add("Arduino_MEGA_2560_A_D11",0)

function num(bool)
if bool then return 1 else return 0 end
end

function is_charging(charging) and is_batt_sw(batt_sw)
    if charging == 1 then
    hw_led_set(led_is_charging, 1)
    elseif
    if charging == 0 and batt_sw == 0 then
    hw_led_set(led_is_charging, 0)
end
  
function is_alt1charging(alt1charging)
    hw_led_set(led_is_alt1charging, 1-num(alt1charging))
end

function is_alt2charging(alt2charging)
    hw_led_set(led_is_alt2charging, 1-num(alt2charging))
end

fsx_variable_subscribe("ELECTRICAL MASTER BATTERY", "Bool", is_batt_sw)
fsx_variable_subscribe("ELECTRICAL BATTERY IS CHARGING", "Bool", is_charging)
fsx_variable_subscribe("GENERAL ENG GENERATOR ACTIVE:1", "Bool", is_alt1charging)
fsx_variable_subscribe("GENERAL ENG GENERATOR ACTIVE:2", "Bool", is_alt2charging)

"I know just enough to break something"

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Batt Warning Light - Reset on Battery Switch

#10 Post by Ralph »

I don't think this rather bold reply from you is gonna spark much joy for others to help you. Just saying...

Post Reply