• 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.

FSXA WEP Switch

Messages
455
Country
ca-ontario
Hi folks, after a long lay-off I'm back to working on an aircraft project again. I have been searching through the SDK, modeldef.xml file and this site trying to find some clues but to no avail hence the following question to you guys.

My current aircraft has electrically operated WEP switches but I can't seem to find any reference to WEP switches anywhere. Does FSX/A have stock code for WEP switches?

If not does anyone have any working code they'd be willing to share? I'm looking for WEP on engine 1 and engine 2 (or even one switch for all engines which might be better) with a duration time of about 5 minutes and with auto shut-off.

I do have a working WEP 2D gauge from FS2004 (or earlier) that runs extra power for 5 minutes and then shuts off but it's a .gau gauge so I can't look at the code to see how it was written in order to try to write my own.

Any help/suggestions would be greatly appreciated.
 
Tako,
Good to hear! What might you be working on!?

It's in the [piston_engine] section of the aircraft.cfg.

Look for, or add these four lines:

emergency_boost_type = 3
// 0 = None
// 1 = Water Injection
// 2 = Methanol/Water Injection
// 3 = War Emergency Power

emergency_boost_mp_offset = 0
// Additional manifold pressure supplied by emergency boost, if available

emergency_boost_gain_offset = 0.2901
// Multiplier on manifold pressure due to emergency boost.

emergency_boost_duration = 300
// Emergency boost duration in seconds.


A Couple things.
If there's a max_design_mp =45, but you have a detonation_onset = 40, for example, and with WEP you multiply that by 0.2901 you'll be around 58", and as long as power is kept up there, damage will accrue. (If engine damage is on within settings).

Now, the trick is, that this only kicks in at maximum power. So you'd have to use some creative liberty to ensure that the throttle input didn't reach full stage, until you're switch was activated. The XML would be written as such so that throttle was at x% until the switch is active, then 100%. You might have to run an event logger to determine when variable RECIP ENG EMERGENCY BOOST ACTIVE:index starts. (At what % of throttle)

The other way to do this would be to simulate the WEP with Nitrous in combination with ADI. Nitrous can be triggered with a simple key event. (Note won't work in the obscure case that someone was using an old version of FSX, without Acceleration)


Let me know what you come up with.

Of course if you are writing a gauge through simconnect, you could call the RECIP ENG EMERGENCY BOOST directly, I believe.

- Joseph
 
Tako,
Good to hear! What might you be working on!?

It's a FSX native conversion of Yamamoto's old C-119 Boxcar. All the external updates are done along with a totally rebuilt cargo interior. I am currently re-working the VC to bring it up to FSX standards but using 2D gauges to save time and to allow people to put whatever they like in there. The whole project was just supposed to be a quick conversion with a VC update but as usual feature creep crept in and it became a whole lot bigger project!

It's in the [piston_engine] section of the aircraft.cfg.

Look for, or add these four lines:

emergency_boost_type = 3
// 0 = None
// 1 = Water Injection
// 2 = Methanol/Water Injection
// 3 = War Emergency Power

emergency_boost_mp_offset = 0
// Additional manifold pressure supplied by emergency boost, if available

emergency_boost_gain_offset = 0.2901
// Multiplier on manifold pressure due to emergency boost.

emergency_boost_duration = 300
// Emergency boost duration in seconds.

Thanks for that, I will check the CFG file for those values.

A Couple things.
If there's a max_design_mp =45, but you have a detonation_onset = 40, for example, and with WEP you multiply that by 0.2901 you'll be around 58", and as long as power is kept up there, damage will accrue. (If engine damage is on within settings).

Now, the trick is, that this only kicks in at maximum power. So you'd have to use some creative liberty to ensure that the throttle input didn't reach full stage, until you're switch was activated. The XML would be written as such so that throttle was at x% until the switch is active, then 100%. You might have to run an event logger to determine when variable RECIP ENG EMERGENCY BOOST ACTIVE:index starts. (At what % of throttle)

The other way to do this would be to simulate the WEP with Nitrous in combination with ADI. Nitrous can be triggered with a simple key event. (Note won't work in the obscure case that someone was using an old version of FSX, without Acceleration)


Let me know what you come up with.

Of course if you are writing a gauge through simconnect, you could call the RECIP ENG EMERGENCY BOOST directly, I believe.

Darn, I was hoping there was just an existing switch code to activate this. I am not the best XML coder and have no clue with SimConnect. I'm still hoping someone may have working code for this as I'm sure it's been done before as it was certainly available in FS2004 (and earlier) via a 2D gauge. I was hoping to use 3D switches (hence the need for switch code) but if the worst comes to the worst I guess I could add a 2D switch for the WEP and use the old gauge in the panel folder.
 
Last edited:
If not does anyone have any working code they'd be willing to share? I'm looking for WEP on engine 1 and engine 2 (or even one switch for all engines which might be better) with a duration time of about 5 minutes and with auto shut-off.

I do have a working WEP 2D gauge from FS2004 (or earlier) that runs extra power for 5 minutes and then shuts off but it's a .gau gauge so I can't look at the code to see how it was written in order to try to write my own.
If by chance you are referring to the XML_WarEmerPower.gau that I coded back in 2005, I only released that because in FS9 there was no XML command to trigger WEP at all! Oddly enough, there's no such command in FSX either... :yikes:

The original release was discussed at AVSIM back in 2005:
http://www.avsim.com/topic/72992-xml-wep-control-gauge/?hl=+war++emergency++power#entry509736

The actual source code for the WEP Boost gauge is below. Note that although this is an "invisible" gauge, a character string must be 'printed' in order for it to work:
Code:
char WEP_gauge_name[]  = GAUGE_NAME;
extern PELEMENT_HEADER   WEP_list;
PELEMENT_STATIC_IMAGE bg_element =NULL;
extern MOUSERECT     WEP_mouse_rect[];
GAUGE_CALLBACK     gaugecall;
GAUGE_HEADER_FS700(GAUGE_W, WEP_gauge_name, &WEP_list, WEP_mouse_rect, gaugecall, 0, 0, 0);

#define GAUGE_CHARSET2           DEFAULT_CHARSET
#define GAUGE_FONT_DEFAULT2          "Arial"
#define GAUGE_WEIGHT_DEFAULT2     FW_NORMAL

int WEP_Active=0;
ID WEP_Active_id;

void FSAPI gaugecall(PGAUGEHDR pgauge, int service_id, UINT32 extra_data)
{
    switch(service_id)
    {
        case PANEL_SERVICE_PRE_INITIALIZE:
            bg_element = (PELEMENT_STATIC_IMAGE)pgauge->elements_list[0];
            register_named_variable ( "WEP_Boost" );
        break;

        case PANEL_SERVICE_PRE_KILL:
        break;

        case PANEL_SERVICE_PRE_UPDATE:
            WEP_Active_id = check_named_variable ( "WEP_Boost" ) ;
            WEP_Active = get_named_variable_value (WEP_Active_id);

            if (WEP_Active == 1 )
            {
                trigger_key_event (KEY_WAR_EMERGENCY_POWER,0) ;
                WEP_Active = 0 ;
            }
            set_named_variable_value(WEP_Active_id, WEP_Active) ;
        break;

        case PANEL_SERVICE_PRE_DRAW:
        break;

        case PANEL_SERVICE_PRE_INSTALL:
        break;
    }
}
BOOL FSAPI mouse_cb0( PPIXPOINT relative_point, FLAGS32 mouse_flags)
{
    trigger_key_event (KEY_WAR_EMERGENCY_POWER,0) ;
    return FALSE;
}

MOUSE_BEGIN(WEP_mouse_rect,0,0,0)
    MOUSE_CHILD_FUNCT(0,0,18,18,CURSOR_UPARROW,MOUSE_LEFTSINGLE,mouse_cb0)
MOUSE_END


FLOAT64 FSAPI callback2( PELEMENT_STRING pelement)
{
    float rwert=pelement->source_var[0].var_value.n;
    sprintf(pelement->string,"%.0f",rwert);
    return 0;
}

MAKE_STRING(String2,NULL,fail2,IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | BIT7,0,0,0,18,18,1000000,
            RECIP_ENGINE1_EMERGENCY_BOOST_ACTIVE,
            MODULE_VAR_NONE,
            MODULE_VAR_NONE,
            RGB(255,255,255),
            RGB(0,0,0),
            RGB(0,0,0),
            GAUGE_FONT_DEFAULT2,
            GAUGE_WEIGHT_DEFAULT2,
            GAUGE_CHARSET2,
            0,
            0,
            NULL,
            callback2)
PELEMENT_HEADER ElementList2[] = {
                                    &String2.header,
                                    NULL
                                };

MAKE_STATIC(Static1,Rec0,&ElementList2,fail1,IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | BIT7,0,0,0)

PELEMENT_HEADER WEP_list = &Static1.header;
 
Actually Bill I didn't even know you'd made one. The one I've used in the past is named 'MAPE_WEP.gau' and I have no idea who authored it originally.

I take it there is no easy way to achieve this in 3D XML code for FSX then? I wanted to use a 3D toggle switch to activate it but if that won't work I guess I'll have to stick a gauge poly in front of the box in the VC and throw a 2D switch on it and use my existing gauge. Not an ideal solution but it will work in a pinch.
 
The entire purpose of my tiny "XML_Wedge" project was to create a custom L:var for precisely the use you've described! Simply create an entry for my gauge in the VC panel.cfg file, then use the (L:WEP_Boost,bool) variable to control your 2d or 3d switch...

My wedge monitors that custom L:var and when detected, will issue the C command trigger_key_event (KEY_WAR_EMERGENCY_POWER,0). This is the command that has no XML equivalent, hence the reason for this little wedge.
Code:
  <PartInfo>
    <Name>WEP_Boost</Name>
    <AnimLength>5</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:WEP_Boost,bool) 5 *
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:WEP_Boost,bool) ! (>L:WEP_Boost,bool) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 

Attachments

Last edited:
Hi Bill, thanks for that. I just tried it but ran into issues. :eek:

I added your gauge to the panel folder and the entries to the panel.cfg per the read me in the zip file. I then added your xml code to my modeldef file and went to apply it to the model parts. The animation section appeared in the animation manager as expected but for some reason when I tried to add the mouse rectangle it was nowhere to be found in the attachpoint tool drop-down. :(

In you code above you have:

Code:
if{ (L:WEP_Boost,bool)) ! (>L:WEP_Boost,bool) }

Is the second close bracket in the first statement a typo or should it be there? I have tried it both ways but it still won't show up in the attachpoint tool.

Just for reference here's my entire code block (and yes I did add the definition for it at the start of the file):

Code:
<PartInfo>
  <!-- Needs 'XML_WarEmerPower.gau' in panel folder plus entry in panel.cfg VC section. -->
    <Name>Boxcar_WEP_Boost</Name>
    <AnimLength>5</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:WEP_Boost,bool) 5 *
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:WEP_Boost,bool)) ! (>L:WEP_Boost,bool) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

Any ideas why it's not showing in the attachpoint tool.
 
Last edited:
Yes, the second ) is a typo. I've corrected the script above to fix this. As for the other issue of not showing up in the attachpoint tool's dropdown list, I have no idea.

First, neither <Visibility> or <MouseRect> entries require the <Animation> definition at the top of the file. Only <Animation> scripts use the GUID and assorted other data.

You might try changing the mouse callback to simply this, since there aren't any other conditions required:
Code:
      <CallbackCode>
        (L:WEP_Boost,bool) ! (>L:WEP_Boost,bool)
      </CallbackCode>
 
Well I have something working now but still work to do!

I tried your code change Bill and it still didn't show up in the attachpoint tool so just out of pure whimsy I took the REM statement out from immediately after the PartInfo header and pasted it after the Name section (on the same line) and it showed up in the attachpoint tool. :rolleyes:

So now I have a click-able toggle switch in the VC and it animates but I see no boost in MP when active so I am now assuming I have something wrong in the [Piston Engine] section of the aircraft.cfg file (which is entirely possible seeing as I've never set up a WEP equipped aircraft before) or I don't have your gauge set up correctly in the panel folder or panel.cfg file.

Here is my [Piston Engine] section from the aircraft.cfg file:

[piston_engine]
power_scalar =1.00000 //Piston power scalar
cylinder_displacement=186.11000 //Cubic inches per cylinder
compression_ratio=6.85000 //Compression ratio
number_of_cylinders=18 //Number of cylinders
max_rated_rpm=2900.00000 //Max rated RPM
max_rated_hp=3500.00000 //Max rated HP
fuel_metering_type=1 //0=Fuel Injected, 1=Gravity Carburetor, 2=Aerobatic Carburetor
cooling_type=0 //0=Cooling type Air, 1=Cooling type Liquid
normalized_starter_torque=0.03282 //Starter torque factor
turbocharged=1 //Is it turbocharged? 0=FALSE, 1=TRUE
max_design_mp=61.00000 //Max design manifold pressure, (inHg)
min_design_mp=2.99200 //Min design manifold pressure, (inHg)
critical_altitude=17900.00000 //Altitude to which the turbocharger will provide max design manifold pressure (feet)
emergency_boost_type=3 //0=None, 1=Water Injection, 2=Methanol/Water injection, 3=War Emergency Power
emergency_boost_mp_offset=0.00000 //Additional manifold pressure supplied by emergency boost
emergency_boost_gain_offset=0.2901 //Multiplier on manifold pressure due to emergency boost
fuel_air_auto_mixture=0 //Automixture available? 0=FALSE, 1=TRUE
auto_ignition=0 //Auto-Ignition available? 0=FALSE, 1=TRUE
max_rpm_mechanical_efficiency_scalar=1.00000 //Scalar on maximum RPM mechanical efficiency
idle_rpm_mechanical_efficiency_scalar=1.00000 //Scalar on idle RPM mechanical efficiency
max_rpm_friction_scalar=1.00000 //Scalar on maximum RPM friction
idle_rpm_friction_scalar=1.00000 //Scalar on idle RPM friction
emergency_boost_duration=300.00000
BestPowerSpecificFuelConsumption=0.50000
detonation_onset=67.10000

...and this is my entry in the [Vcockpit01] section of the panel.cfg file:

gauge42=c119!XML_WarEmerPower, 0,0,100,1,1 //0,0,1,1 to "hide it."

The XML_WarEmerPower.gau gauge is located in the c119 folder inside the panel folder (the folder is not compressed into a CAB file yet).

At full power my manifold pressure gauges are reading 61" and activating the WEP switch shows no increase in power.

Anyone have any ideas on how to get this working from here?
 
Try changing this line to something other than 0?

emergency_boost_mp_offset=0.00000 //Additional manifold pressure supplied by emergency boost
 
Thanks Tom, I did try that yesterday as it happens and still no joy. I also noticed a typo in the panel.cfg line which I corrected and still no joy. One of my beta testers tried out the old 2D wep gauge that we use in the Round the World Race aircraft and that works perfectly without having to change anything in the aircraft.cfg file. If only I could find a way of triggering that gauge from a 3D switch in the VC we'd be laughing!
 
W
...and this is my entry in the [Vcockpit01] section of the panel.cfg file:

gauge42=c119!XML_WarEmerPower, 0,0,100,1,1 //0,0,1,1 to "hide it."

The XML_WarEmerPower.gau gauge is located in the c119 folder inside the panel folder (the folder is not compressed into a CAB file yet).

At full power my manifold pressure gauges are reading 61" and activating the WEP switch shows no increase in power.

Anyone have any ideas on how to get this working from here?

Bill,
What is the correct panel.cfg syntax for your wedge gauge? I'm guessing that is the problem here.
 
I think there were a number of issues in that line I posted Doug. :oops:

I have since tried it with the .gau file in the gauge folder instead of the panel folder and that didn't work either. :(

At the moment I have the .gau file in the panel folder and a copy in the main gauge folder (just in case) and this is my gauge line from the VC01 section of the panel.cfg file:

gauge42=XML_WarEmerPower, 0,0,100 //0,0,1,1 to "hide it."

(the above should be calling the version in the main gauge folder)

If 0,0,1,1 'hides' it then I would assume that there should be something to display as a confirmation that it is working perhaps but I see nothing.

At the moment I'm guessing that the 3D switch code in the modeldef file is not talking to the gauge and therefore nothing is happening.

Here's my modeldef code as it stands now:

Code:
<PartInfo>
    <Name>Boxcar_WEP_Boost</Name> <!-- Needs 'XML_WarEmerPower.gau' in panel folder plus entry in panel.cfg VC section. -->
    <AnimLength>5</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:WEP_Boost,bool) 5 *
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle</MouseFlags>
      <CallbackCode>
        (L:WEP_Boost,bool) ! (>L:WEP_Boost,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Bill,
What is the correct panel.cfg syntax for your wedge gauge? I'm guessing that is the problem here.
Yes, that is indeed the problem, but I neglected to provide full information. It's been eleven years since I even thought about this little project. :oops:

The "main" name of this gauge is of course XML_WarEmerPower. The sub-gauge (internal) is XML_WEP. Both must be specified with the ! linking them in the statement.

The .gau file can be either in the ..\Gauges folder or the local aircraft's ..\panel folder, however one desires. The correct entry in panel.cfg is:
Code:
gaugexx=XML_WarEmerPower!XML_WEP, 0,0,1,1
Since the 'background' of this gauge is invisible (0,0,0) there's nothing to see!

However, if you want to know if it is working properly, you can display the state of the WEP via any XML gauge you have handy, by looking at the
Code:
(A:RECIP ENG EMERGENCY BOOST ACTIVE:index, bool)
where index is the engine number of course.
 
Last edited:
UPDATE: I have some success but it is very weird!:eek:

I was just checking out some other changes in the sim and as my mouse passed over the WEP toggle switch area in the VC I noticed a change in the pointer shape. It went from a regular pointer to the hand shape with a + sign that indicates a clickable object (as typically seen on 2D gauge click-spots). The thing is I wasn't actually on the 3D WEP switch but slightly to one side and up a bit. If I click where I get the hand I get a 10" boost on my MP gauge and I get a text message on screen that says 'War Emergency Power Engaged'. If I click again it says 'War Emergency Power Disengaged' and the MP drops to normal full power rates. However, if I actually click on the WEP toggle switch (the thing I actually want to control the WEP gauge) the switch actuates but it's obviously not talking to the gauge as I get no increase in MP.

It's very strange and now has me even more baffled than before!

Ideas anyone?
 
On a hunch I tried something while helping Larry this eve.
Fr.Bill had in his C source -
trigger_key_event (KEY_WAR_EMERGENCY_POWER,0)
Oddly enough, there's no such command in FSX either... :yikes:
So gave a shot and converted it to XML "style"... VOILA! It works without any C type intervention! (FSX Boxed Accel & Steam - Not FS9!)
Code:
(>K:WAR_EMERGENCY_POWER)

Some other notes -
For emergency_boost_type= 1 or 2 the SDK is incorrect from testing emergency_boost_duration= (seconds) . What I got is -
300 = 7:30
200 = 7:00
100 = 5:00
 
Last edited:
We could probably use this on the A-20 Havoc Roman. :) But, the performance is built into the flight model, so maybe not. LOL
 
Thanks to Roman working his magic :wizard: I now have a functional engine boost! I won't call it WEP because we went with a different method using the water injection system but the end result is a 10" gain in MP for 5 minutes across the entire power range.

Job done! :)
 
Well I'll be darned! Sorry to have led you down a rabbit hole Larry, but am delighted that you at last have something working... :oops:
 
Back
Top