• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

ALT/BAT switch in XML - Helllp!!! :-(

Messages
11
Country
unitedkingdom
OKAY, this is driving me scatty. I've been customizing my own version of the Cessna 182RG and have created XML gauges for things such as the light switches, throttle/prop/mix etc. I've also built a new version of the GPS500 which I called GPS500DSX which includes extra functions such as a virtual radio stack, auto pilot, transponder and ground handling - controlled by adding 3 extra buttons and turning the rest into soft buttons.

I'm trying to make an XML ALT/BAT/AVIONICS master switch... The avionics bit works OK. I'm confused by the ALT/BAT bit ?

What do I need to test to see if each of the alt and bat switches are on or off ?

Additionally, I know that you can have ALT/BAT in the off/off, on/on, off/on, positions, but not on/off. However, on using blackbox2 to display various variables, I see that:

1 off/off: PARTIAL PANEL ELECTRICAL = 1, ELECTRICAL MASTER BATTERY = 0
2 on/on: PARTIAL PANEL ELECTRICAL = 0, ELECTRICAL MASTER BATTERY = 1
3 off/on: PARTIAL PANEL ELECTRICAL = 0, ELECTRICAL MASTER BATTERY = 1

From the above, I cannot distinguish between 2 and 3 - I need to do this for correctly displaying my bitmaps. There must be another variable that I am missing to test, but cannot find it.

Additionally, what K:vars do I need to used to set the three distinct states that the two switches can occupy ?

Even, has anyone successfuly coded the ALT/BAT switch in XML ? (a code snippet would be nice !)

One other thing - I would expect the engine to cut out if I turned off the ALT/BAT - this does not seem to happen, how can I force this behaviour ?

Please help, this is sending me dotty !

Dave.
 
Last edited:
Hi
First up aircraft run magnetos which generate their own current, so long as the motor is turning over there should be spark.
Im not sure what your trying to do :) are trying to code a single switch for batt alt,separate ones or a 3 position style switch ?
TOGGLE_MASTER_ALTERNATOR is the alt K var
TOGGLE_MASTER_BATTERY is batt K var

(A:ELECTRICAL MASTER BATTERY, bool) (A:GENERAL ENG MASTER ALTERNATOR:1, bool) == if{ (>K:TOGGLE_MASTER_ALTERNATOR) } (>K:TOGGLE_MASTER_BATTERY)

is a combined type code

also note the the electrical system in the aircraft cfg denotes what system uses what buss, so if there are any omissions or errors in there then no amount of coding will help :)
Oh and the electrical system in fs is buggie as hell,these bugs can be gotten around most of the time with some L:vars and outside the box thinking ;)
Wozza
 
Last edited:
Hey, thanks.

Yeah, it's effectively a direct replacement for the original c coded switch, but made into a single bank with the avionics switch and iluminated from inside. So it is the three positions I listed it can occupy.

I understand your comment about the magneto on the engine - was just being a bit thick there.

I will use local vars to manage the switch positions and an update section to couple them to the FS vars.

Thanks for your help, think I've may have what I need to make it work now - not 100% sure, but I'll give it a try.

Cheers,

Dave
 
Last edited:
One final thing...

Are there any definitive documents anywhere setting out exactly how the electrical system of flight simulator X is supposed to work and if so where are they ?

I have trawled through the MSDN / ESP website, but find the content therin very sketchy, often inadequate and in some ways all over the place - it's as if the writers of that documentation didn't want to give too much away. (Having said that, it's standard Micro$oft, I guess. meow!)
 
Oh and the electrical system in fs is buggie as hell,these bugs can be gotten around most of the time with some L:vars and outside the box thinking ;)
Wozza

On re-reading I wondered - is there a simple buglist anywhere listing faulty behaviours and possible workarounds ?
 
Hi
As Bill said,most of the bugs are just silly things like flat bats are set at 6.something volts for a 12 v system and 16 volts for a 24 volt system,
the batts discharge to quickly ect ect most of em are not to probmatic if your using a basic electrical system.
Wozza
 
Thanks again guys !

Still "living in interesting times" with this one - I would have thought it was very simple, but noooo.... Okay, so I can turn the stock GPS virtually into a glass cockpit, but I've got dificulties creating an on/off switch ! :rolleyes:

I did wonder if some of my problems were caused by having the XML and the original stock switch on the panel at the same time - no such luck...

For my next trick, I'm gonna put ALL the electrical A vars in a comment in my gauge, generate a debug gauge using blackbox2 and examine how they change and when - using of course the stock master switch. I'll let you know how I get on... ( I may even publish a truth table for these eleccyvars - not a promise :o, though )
 
Hi Guys,
Nearly forgot to post this...

So I finally got it working - it was soooooo simple in the end. really don't know why I was getting confused :o

I have a habit of making rocker switches only clickable on the part that is 'sticking out' or radio-butons only clickable if they are 'out' - this also simplifies the [stock alt/bat switch style] logic whereby:

1. turning alt on also turns bat on
2. turning bat off also turns alt off
3. you can turn bat on without alt going on
4. you can turn alt off without bat going off
5. alt-on/bat-off together and bat-off/alt-on are not possible

I don't know if the position in point 5 above would be a valid electrical configuration... I suppose it could happen in a failure situation ? That being the case, I guess I could use partial panel to detect it and prevent the switch visually going into the positions in 5 above ?? (or do I need to bother ?)

Anyway, if anyone is interested, here is my mousearea code:

Code:
	<Mouse Name="MouseRoutines">

		<Area Name="ALT Top" Left="17" Top="14" Width="22" Height="20">
			<Visible>(A:GENERAL ENG MASTER ALTERNATOR:1,bool) ! </Visible>
			<Click Kind="LeftSingle">1 (>K:TOGGLE_MASTER_ALTERNATOR) (A:ELECTRICAL MASTER BATTERY,bool) ! if{ 1 (>K:TOGGLE_MASTER_BATTERY) } </Click>
			<Cursor Type="Hand"/>
		</Area>

		<Area Name="ALT Bot" Left="17" Top="35" Width="22" Height="20">
			<Visible>(A:GENERAL ENG MASTER ALTERNATOR:1,bool)</Visible>
			<Click Kind="LeftSingle">1 (>K:TOGGLE_MASTER_ALTERNATOR)</Click>
			<Cursor Type="Hand"/>
		</Area>

		<Area Name="BAT Top" Left="39" Top="14" Width="22" Height="20">
			<Visible>(A:ELECTRICAL MASTER BATTERY,bool) ! </Visible>
			<Click Kind="LeftSingle">1 (>K:TOGGLE_MASTER_BATTERY)</Click>
			<Cursor Type="Hand"/>
		</Area>

		<Area Name="BAT Bot" Left="39" Top="35" Width="22" Height="20">
			<Visible>(A:ELECTRICAL MASTER BATTERY,bool) </Visible>
			<Click Kind="LeftSingle">1 (>K:TOGGLE_MASTER_BATTERY) (A:GENERAL ENG MASTER ALTERNATOR:1,bool) if{ 1 (>K:TOGGLE_MASTER_ALTERNATOR) } </Click>
			<Cursor Type="Hand"/>
		</Area>

		<Area Name="AVI Top" Left="61" Top="14" Width="32" Height="20">
			<Visible>(A:AVIONICS MASTER SWITCH,bool) ! </Visible>
			<Click Kind="LeftSingle">1 (>K:TOGGLE_AVIONICS_MASTER)</Click>
			<Cursor Type="Hand"/>
		</Area>

		<Area Name="AVI Bot" Left="61" Top="35" Width="32" Height="20">
			<Visible>(A:AVIONICS MASTER SWITCH,bool)</Visible>
			<Click Kind="LeftSingle">1 (>K:TOGGLE_AVIONICS_MASTER)</Click>
			<Cursor Type="Hand"/>
		</Area>
	</Mouse>

Hope this helps learners and others out there :)
 
Back
Top