PMDG - Fuel Warning & General Question (SOLVED)

Forum for the OC4BA v2/v3 and OC4BAConfig including the OCP4NGX driver
AZWildk4t
Posts: 15
Joined: Mon Mar 09, 2015 10:25 pm

PMDG - Fuel Warning & General Question (SOLVED)

Post by AZWildk4t »

Hi Roar,

I am using the PMDG 737ngx. When the NGX is loaded and parked at a gate, I launch with FS2CREW and once the aircraft has power, I enter fuel and payload via the CDU. I then load your software and immediately notice the FUEL WARNING light goes on. Fuel quantity hasn't changed but the warning prevents VNAV and AT ARM from happening. Any suggestions?

Also a general question... i use Leo Bodnar cards for my EFIS and the MCP encodes and switches. I think your SIOC scripts looks for the status of those switches on the OC IOCards. Is that correct? Can the script just look for the state of the switch in the PMDG rather than a specific IO connection?

Thanks,
Steve
Last edited by AZWildk4t on Sun Mar 29, 2015 3:20 pm, edited 1 time in total.
mvr1918
Site Admin
Posts: 1703
Joined: Thu Aug 30, 2012 3:35 pm

Re: PMDG - Fuel Warning & General Question

Post by mvr1918 »

Hi,

I haven't seen this fuel issue. Will test it later, but have you tried to start OC4BA before entering the fuel in CDU. What happens then?

I do not remember all SDK variables, but if there exist a variable for a switch position it can be read and transmitted to SIOC.

Here is the EFIS and MCP variables taken from the SDK doc.




// EFIS control panels
bool EFIS_MinsSelBARO[2];
bool EFIS_BaroSelHPA[2];
unsigned char EFIS_VORADFSel1[2]; // 0: VOR 1: OFF 2: ADF
unsigned char EFIS_VORADFSel2[2]; // 0: VOR 1: OFF 2: ADF
unsigned char EFIS_ModeSel[2]; // 0: APP 1: VOR 2: MAP 3: PLAn
unsigned char EFIS_RangeSel[2]; // 0: 5 ... 7: 640

// Mode control panel
unsigned short MCP_Course[2];
float MCP_IASMach; // Mach if < 10.0
bool MCP_IASBlank;
bool MCP_IASOverspeedFlash;
bool MCP_IASUnderspeedFlash;
unsigned short MCP_Heading;
unsigned short MCP_Altitude;
short MCP_VertSpeed;
bool MCP_VertSpeedBlank;

bool MCP_FDSw[2];
bool MCP_ATArmSw;
unsigned char MCP_BankLimitSel; // 0: 10 ... 4: 30
bool MCP_DisengageBar;

bool MCP_annunFD[2];
bool MCP_annunATArm;
bool MCP_annunN1;
bool MCP_annunSPEED;
bool MCP_annunVNAV;
bool MCP_annunLVL_CHG;
bool MCP_annunHDG_SEL;
bool MCP_annunLNAV;
bool MCP_annunVOR_LOC;
bool MCP_annunAPP;
bool MCP_annunALT_HOLD;
bool MCP_annunVS;
bool MCP_annunCMD_A;
bool MCP_annunCWS_A;
bool MCP_annunCMD_B;
bool MCP_annunCWS_B;

With the OCP4NGX 253 driver you will find the MCP variables in SIOC via IOCPConsole
Here is the MCP variables witht he SIOC vars ( EFIS is not transmitted in the 253 version)

IOCP.sendVarData(1270, sPmdgData.MCP_Altitude);
IOCP.sendVarData(1291, sPmdgData.MCP_annunALT_HOLD);
IOCP.sendVarData(1290, sPmdgData.MCP_annunAPP);
IOCP.sendVarData(1282, sPmdgData.MCP_annunATArm);
IOCP.sendVarData(1293, sPmdgData.MCP_annunCMD_A);
IOCP.sendVarData(1295, sPmdgData.MCP_annunCMD_B);
IOCP.sendVarData(1294, sPmdgData.MCP_annunCWS_A);
IOCP.sendVarData(1296, sPmdgData.MCP_annunCWS_B);
IOCP.sendVarData(1280, sPmdgData.MCP_annunFD[0]);
IOCP.sendVarData(1281, sPmdgData.MCP_annunFD[1]);
IOCP.sendVarData(1287, sPmdgData.MCP_annunHDG_SEL);
IOCP.sendVarData(1288, sPmdgData.MCP_annunLNAV);
IOCP.sendVarData(1286, sPmdgData.MCP_annunLVL_CHG);
IOCP.sendVarData(1283, sPmdgData.MCP_annunN1);
IOCP.sendVarData(1284, sPmdgData.MCP_annunSPEED);
IOCP.sendVarData(1285, sPmdgData.MCP_annunVNAV);
IOCP.sendVarData(1289, sPmdgData.MCP_annunVOR_LOC);
IOCP.sendVarData(1292, sPmdgData.MCP_annunVS);
IOCP.sendVarData(1277, sPmdgData.MCP_ATArmSw);
IOCP.sendVarData(1278, sPmdgData.MCP_BankLimitSel);
IOCP.sendVarData(1256, sPmdgData.MCP_Course[0]);
IOCP.sendVarData(1258, sPmdgData.MCP_Course[1]);
IOCP.sendVarData(1279, sPmdgData.MCP_DisengageBar);
IOCP.sendVarData(1275, sPmdgData.MCP_FDSw[0]);
IOCP.sendVarData(1276, sPmdgData.MCP_FDSw[1]);
IOCP.sendVarData(1268, sPmdgData.MCP_Heading);
IOCP.sendVarData(1264, sPmdgData.MCP_IASBlank);
IOCP.sendVarData(1265, sPmdgData.MCP_IASOverspeedFlash);
IOCP.sendVarData(1266, sPmdgData.MCP_IASUnderspeedFlash);
IOCP.sendVarData(1272, sPmdgData.MCP_VertSpeed);
IOCP.sendVarData(1274, sPmdgData.MCP_VertSpeedBlank);
AZWildk4t
Posts: 15
Joined: Mon Mar 09, 2015 10:25 pm

Re: PMDG - Fuel Warning & General Question

Post by AZWildk4t »

Hi Roar,

It looks like the Fuel issue is fixed by running OC4BA before powering up the aircraft.

Thanks for providing the SDK info. Can you help me understand the following?

IOCP.sendVarData(1270, sPmdgData.MCP_Altitude);

Where does IOCP.sendVarData send output to? The OC Input card?

I might switch out using the Leo Bodnar card for the OC input card so I don't have to rewrite the SIOC script to check if the switch is on or not.
mvr1918
Site Admin
Posts: 1703
Joined: Thu Aug 30, 2012 3:35 pm

Re: PMDG - Fuel Warning & General Question

Post by mvr1918 »

IOCP.sendVarData(1270, sPmdgData.MCP_Altitude);
Here the driver software sends the PMDG SDK variable MCP.Altitude to SIOC variable 1270.

The value of SIOC Var 1270 is then by the OCP4NGX_PP_1.2.ssi script linked to a Display card output

The whole script code of the Altitude function is in the script below.

As you can see there is a quite complicated coding to get everything working and this is just for the Altitude variable.

Breaking it up, it consists of the following main parts.

1. Definition of Display digits and Alt variables in both directions
2. The ALT rotary function
3. The ALT display function


Coding for SWITCHES and LEDS are much more simple.


If you start SIOC.exe and click Edit_Script and then export to text you will have the whole script code in plain text.

Then you can see how everything is coded.

You should also read the http://www.lekseecon.nl/howto.html to get a good understanding of how to do SIOC scripting.



///////// MCP_ALTITUDE_SELECTOR *************************
Var 132 name D_ALT Link IOCARD_DISPLAY Device 15 Digit 9 Numbers 3
Var 133 name D_ALTL00 Link IOCARD_DISPLAY Device 15 Digit 12 Numbers 1
Var 134 name D_ALTL0 Link IOCARD_DISPLAY Device 15 Digit 13 Numbers 1
Var 137 name ROTACTIVE_ALT
Var 2524 Static name ALTtoNGX // ALT to NGX

var 220 name tempalt

Var 1270 Static name ALTfromNGX // ALT from NGX

{
if v137 = 0
{
L0 = v1270
&tempalt = DIV L0 100
&ALTtoNGX = v1270
CALL &ALTtMCPw // This line was edited in due to lack of feedback when turning ALT knob in virtuel MCP
}
}

Var 131 name ROTARY_ALT Link IOCARD_ENCODER Device 15 Input 2 Aceleration 4 Type 2
{
IF &MCP_POWER_ON > 0
{
v137 = 1
L0 = &ROTARY_ALT * -1 // turning right should be plus
&tempalt = LIMIT 0 640 L0
L2 = &tempalt * 100
&ALTtoNGX = L2
CALL &ALTtMCPw
v137 = DELAY 0 500
}
}
Var 135 name ALTtMCPw Link SUBRUTINE
{
IF &MCP_POWER_ON > 0
{
L0 = &ALTtoNGX
IF L0 >= 10000
{
&D_ALTL0 = DIV L0 10000
L1 = MOD L0 10000
&D_ALTL00 = DIV L1 1000
&D_ALT = MOD L0 1000
}
ELSE
{
&D_ALTL0 = -999999
IF L0 >= 1000
{
&D_ALTL00 = DIV L0 1000
&D_ALT = MOD L0 1000
}
ELSE
{
&D_ALTL00 = -999999
&D_ALT = L0
}
}
}
}
AZWildk4t
Posts: 15
Joined: Mon Mar 09, 2015 10:25 pm

Re: PMDG - Fuel Warning & General Question

Post by AZWildk4t »

Thanks Roar for the info.

I think I'll move from the Leo Bodnar card to OC Card for the MCP. I can use the Bodnar card for other areas of the cockpit.
mvr1918
Site Admin
Posts: 1703
Joined: Thu Aug 30, 2012 3:35 pm

Re: PMDG - Fuel Warning & General Question

Post by mvr1918 »

If you plan to do a MCP based on Expansion/Master cards, you will also need Display cards to be able to get CRS, IAS, HDG, ALT and VS info.
You will also need switches, buttons, Leds, resistors, and 7- segments display digits.

I built a MCP based on these as the first module when I started with Opencokcpits, but it took a long time.

I think it is much better to buy the ready assembled MCP. Building from scratch will almost cost you the same and the time spent on building will be huge.

But, the good thing is that you will learn a lot about SIOC when building from IOCards and components.
AZWildk4t
Posts: 15
Joined: Mon Mar 09, 2015 10:25 pm

Re: PMDG - Fuel Warning & General Question

Post by AZWildk4t »

Hi Roar,

I've read through Nico's SIOC info but still unsure about testing for the status of a switch. I edited the OCP4NGX_v3.1.txt and copied anything related to VNAV. In addition, I added the IOCP.sendVarData you provided earlier. So where do I insert the IOCP.sendVarData.... Does it replace "Var 1285, name VNAV, status"? It still looks like I need to declare a variable to set it to the value of 1285.

IOCP.sendVarData(1285, sPmdgData.MCP_annunVNAV);


Var 2552, name VNAV_SW, static, Link IOCARD_SW, Device 15, Input 30, Type P


Var 1285, name VNAV, static
{
IF &LightsSel = 0
{
}
ELSE
{
&OannunVNAV = &VNAV
}
}

Var 0495, name OannunVNAV, Link IOCARD_OUT, Device 15, Output 25
mvr1918
Site Admin
Posts: 1703
Joined: Thu Aug 30, 2012 3:35 pm

Re: PMDG - Fuel Warning & General Question

Post by mvr1918 »

Hi,

IOCP.sendVarData(1285, sPmdgData.MCP_annunVNAV);

The aobe line is a part of the C++ code in the OCP4NGX driver. It is not a script code for the OCP4NGX_v3.1.ssi script.

You should not use these lines.

I try to explain what happens when the SIOC script code below is executed by SIOX

Var 2552, name VNAV_SW, static, Link IOCARD_SW, Device 15, Input 30, Type P
// This line defines that the button connected to MCP( device 15)'s input 30 is linked to SIOC variable 2552
// When this button is pushed a 1/0 is send from SIOC via OCP4NGX driver to PMDG B737 ( where the VNAV button is pushed)

Var 1285, name VNAV, static
// Here SIOC receives the VNAV annunciators status via OCP4NGX driver from PMDG B737
// This will either turn off or on the MCP hardware VNAV Led

{
IF &LightsSel = 0
{
}
ELSE
{
&OannunVNAV = &VNAV
}
}

Var 0495, name OannunVNAV, Link IOCARD_OUT, Device 15, Output 25
// This is the VNAVannunciator LED definition for the MCP on output 25
AZWildk4t
Posts: 15
Joined: Mon Mar 09, 2015 10:25 pm

Re: PMDG - Fuel Warning & General Question

Post by AZWildk4t »

Thanks Roar,

If I understand this then, would I simply comment out the following line?

Var 2552, name VNAV_SW, static, Link IOCARD_SW, Device 15, Input 30, Type P

Then I would use the value from variable 1285 to determine if the LED should be on/off.

I am using the Leo Bodnar card for my switches because the PCB from Hispapanels doesn't work with OC Master Card or Input Connection Box. I thought you suggested I use the IOCP.sendVarData to determine the status of VNAV directly from the PMDG.

Thanks,
Steve
mvr1918
Site Admin
Posts: 1703
Joined: Thu Aug 30, 2012 3:35 pm

Re: PMDG - Fuel Warning & General Question

Post by mvr1918 »

Hi,

You do not need to comment out the line, but it doesn't hurt.

Yes, the status of the VNAV LED is in the Var 1285
Post Reply