#Cont. electrical logic

1 messages ยท Page 1 of 1 (latest)

buoyant egret
#

Continuation to electrical logic discussion

#

@open mason So I don't really understand anything in that article

#

The thing is that i need a light to come on only when my battery switch is on and never else

open mason
#

the basic logic with everything in MobiFlight is, that we always treat the simulator as the source of "truth".

#

so a switch sets the battery switch on in the simulator

#

and we create an output config that reads the battery state back

buoyant egret
#

Right

open mason
#

in this way all possible sim failures or other factors like drained battery will work

buoyant egret
#

Got it

open mason
#

what sim is this?

buoyant egret
#

MSFS2020

open mason
#

and what aircraft?

buoyant egret
#

DA42 by COWS

open mason
#

ok so there are a few layers to this

#

first we need to have the battery state

#

so that we read it from the sim and it is 1 when the battery is on and 0 when it is off

#

also, alternator also usually supplies power so this can get complicated unless we find a sim variable that does the work for us

#

one possibility is to test Microsoft / Generic / CIRCUIT GENERAL PANEL ON

#

and try if that reacts also in COWS

buoyant egret
#

So how do I open a menu for these?

open mason
#

it usually works

#

so what do you have so far?

buoyant egret
#

Nothing, I don't know how to open a menu for the battery state

#

like, how do i add the battery state value

open mason
#

ok, it will be helpful to watch the "getting started" video on youtube, but lets see

#

select the output configs tab

#

and click the empty line to add "battery state"

#

then click the edit on the right edge

buoyant egret
#

Got it

#

Hold on

open mason
buoyant egret
#

Right where do I go from here

open mason
#

it pops up a dialog

buoyant egret
#

oh so just like connecting a switch? got it

open mason
#

select simconnect (MSFS) to read from msfs, and usually the Generic aircraft events work for most planes

#

just like ocnnecting switch but for output yeah

buoyant egret
#

Okay it's done

open mason
#

then test it

buoyant egret
#

press OK right?

open mason
#

yeah

#

save your file of course like always

buoyant egret
#

Right

open mason
#

and press "run" and test if you get a value on "Flight sim value" column

buoyant egret
#

So i test if the value works now?

open mason
#

yeah

buoyant egret
#

Okay

#

Hold on

open mason
#

we need to have it working first or nothing else will really work ๐Ÿ™‚

#

but basically this is like a led indicator

#

but we just dont define a led output for it

#

I mean we could but we dont need it

#

we just want the value

buoyant egret
#

Just an output value from the sim got it

open mason
#

so CIRCUIT GENERAL PANEL ON should usually work unless the plane vendor has created a fully custom logic for everything

buoyant egret
#

By the way COWS has an LVAR list if this one doesn't work

open mason
#

yeah that is good to know too

#

so that would be another option

#

and maybe even better then

#

but lets see once you have something that reacts to the panel power state

#

it might be even better since it might have some custom logic for the Diamond's backup battery etc

#

not sure how the DA42 electrical system is exactly wired

buoyant egret
#

Yes it does work

#

Circ general panel on works

open mason
#

ok good

#

so if you wanted to make your gear indicators only work when panel has power

#

lets open one of them

buoyant egret
#

Alright

open mason
#

and open the modify tab

buoyant egret
#

Right i have the right gear led edit tab open now

#

Okay

open mason
#

click "add reference"

buoyant egret
#

And battery state?

open mason
#

so yeah, whatever you named it, select it

#

now this means # represents the value of your battery state config

buoyant egret
#

so # = 1?

#

if it's on?

open mason
#

yes it is 1 if it is on

#

and 0 if it is off

#

now add modifier -> Transform

#

and you can likely see what we are after

#

$ is our gear state for the led, we multiply with # so it is either $*1 or $*0

buoyant egret
#

Ohh

open mason
#

so config references let you bring other values into your configs

buoyant egret
#

Right

#

So how do I test it now?

open mason
#

close it

#

with OK

#

if you turn battery off, your led should turn off

#

because the multiplication of anything x 0 is 0

buoyant egret
#

It does work indeed

open mason
#

so when the batt variable turns 0, also the led transform results in a 0

buoyant egret
#

You helped me to understand config references now too

open mason
#

yeah, also if you have the gear leds in PWM enabled pins

#

you can also use config references to dim your panel lights

buoyant egret
#

No dimmer for gear indicators in DA42 afaik

open mason
#

ok then it is not a big deal, but for cockpit lights if you have other leds or flood light etc

#

you can read the panel light dimmer value from sim, and use Interpolate modifier to make it 0-255 range and then use that in the transform to set the brightness if you want

#

but one thing at a time ๐Ÿ™‚ config references are pretty useful for a lot of things

buoyant egret
#

Very useful indeed, been looking for this, i think i can apply this to different things myself now too?

open mason
#

yeah

buoyant egret
#

Thank you Tuomas very helpful

open mason
#

you're welcome

buoyant egret
#

Nevermind, found a solution...