Jump to content
The simFlight Network Forums

A2A B377 and mixture levers


Recommended Posts

My configuration:
- Win 7 x64, FSX SP2, paid FSUIPC 4.939.
- 2 mixture levers controlling the pots of a USB joystick embedded in a home-made pedestal, no specific driver.

I have always been using the 2 mixture levers by assigning them to Mixture1 and Mixture2 in FSX and calibrating them in the relevant FSUIPC tab (section 4 of 11: Separate mixture controls), with the checkBox 'Map 1->12, 2->34' checked.
This is fine for all 2 or 4-engine aircrafts I know, except for the A2A Boeing 377 StratoCruiser; in that case, the virtual cockpit levers won't move.

I made some tests:
- remove assignments from FSX and make assignments in FSUIPC => same.
- uncheck 'Exclude MIXTUREn_SET' => same.
- reset FSUIPC calibrations and uncheck 'Map 1->12, 2->34' => lever 1 controls mixture 1, lever 2 controls mixture 2, mixtures 3 and 4 not controlled, as expected.
- reset FSUIPC calibrations but leave 'Map 1->12, 2->34' checked => lever 1 controls mixtures 1, 2 and 4, lever 2 controls mixtures 2 and 4, mixture 3 not controlled.

Note that while the virtual cockpit levers don't move, the pedestal levers actually have effects: for instance, moving a lever back and forth, I can almost stall an engine and then hear the crew announcing that the oil pressure rises. Also, I spied the SimConnect variables 'GENERAL ENG MIXTURE LEVER POSITION:i' and could see noisy values, presumably due to conflicts between the pedestal and virtual cockpit lever positions.

Can someone help?

Link to comment
Share on other sites

First off, make certain that you have the latest A2A Core Update installed. I seem to recall some time ago

that there were some changes/fixes made to the 377 code. In any case you want to be running the latest

version.

 

The B-377 mixture and engine performance 'accu-simulation' is done pretty much outside of the FSX realm and is not just the 'standard' FSX mixture variables. Just have a look at the L:Variables that are used in the code:

L:MixtureRatioLever1Position = 3.000000
L:MixtureRatioLever2Position = 3.000000
L:MixtureRatioLever3Position = 3.000000
L:MixtureRatioLever4Position = 3.000000
L:MixtureLock = 0.000000
L:MixtureRatioLever1 = 75.000000
L:MixtureRatioLever2 = 75.000000
L:MixtureRatioLever3 = 75.000000
L:MixtureRatioLever4 = 75.000000

L:MixtureRatioLever1Ini = 1.000000
L:MIXTURE1_LAST = 8769.491050
L:MIXTURE1_SET = 8769.491050
L:MixtureRatioManual1 = 0.000000
L:MixtureRatioFactor1 = 0.000000
L:AutoMixtureCurve1 = 0.072000
L:AutoMixture1Diff = 1.000056
L:MixtureINI = 1.000000

L:MixtureRatioLever2Ini = 1.000000
L:MIXTURE2_LAST = 8769.491050
L:MIXTURE2_SET = 8769.491050
L:MixtureRatioManual2 = 0.000000
L:MixtureRatioFactor2 = 0.000000
L:AutoMixtureCurve2 = 0.072000
L:AutoMixture2Diff = 1.000056

L:MixtureRatioLever3Ini = 1.000000
L:MIXTURE3_LAST = 8769.491050
L:MIXTURE3_SET = 8769.491050
L:MixtureRatioManual3 = 0.000000
L:MixtureRatioFactor3 = 0.000000
L:AutoMixtureCurve3 = 0.072000
L:AutoMixture3Diff = 1.000056

L:MixtureRatioLever4Ini = 1.000000
L:MIXTURE4_LAST = 8769.491050
L:MIXTURE4_SET = 8769.491050
L:MixtureRatioManual4 = 0.000000
L:MixtureRatioFactor4 = 0.000000
L:AutoMixtureCurve4 = 0.072000
L:AutoMixture4Diff = 1.000056

L:Mixture1_CHT_Change = 1.024012
L:Mixture2_CHT_Change = 1.024012
L:Mixture3_CHT_Change = 1.024012
L:Mixture4_CHT_Change = 1.024012

For my control of the mixture, I simply use the 4 'set' positions of the mixture using the first 4 L:Vars in the above list.

(L:MixtureRatioLeverxPosition where x = 1,2,3 or 4 and the output values are 0,1,2,or 3)

 

I have buttons assigned to increment and decrement the 'set' value from 0 to 3 in a cyclic manner using a Lua script.

 

You might try using "L:MIXTURE1_SET" and find the limits empirically, then use a lua script to scale the values.

 

I would send your mixture levers to 4 of the user-defined offsets ( 0x66C0 to 0x66FF) and have a change of

a value in the offsets trigger the lua script to read the offset, scale it as needed, and then send it on to the

appropriate "L:MIXTUREx_SET" (x=1,2,3 or 4).

 

I am a few thousand miles away from my sim computer and do not have the B-377 installed here on my

traveling gaming laptop so I can't do any testing to see if this would work.

 

You may also want to test "L:MixtureRatioLever1" using the same approach as I outlined above. Send the

axis to a user defined offset, have a change of the value in the offset trigger a lua script and then scale and

output the new vaalue to the L:Var.

 

BTW. you would need to declare the L:Vars used to FSUIPC4 via a MCRO file. A simple text file that names

the L:vars and assigns a characteristic such as SET, INC, DEC, CYCLIC. All that stuff ins in the FSUIPC4

advanced user guide pdf.

 

Here is my B-377 MCRO file. When FSUIPC4 reads the file, those L:Vars listed will show up as assignable controls.

[MACROS]
1=L:CowlFlap1=SET
2=L:CowlFlap2=SET
3=L:CowlFlap3=SET
4=L:CowlFlap4=SET
5=L:ADIPump=SET
6=L:StartersBoost=SET
7=L:StartersStart=SET
8=L:Primers=SET
9=L:OilPumpSwitch=SET
10=L:IntercoolerFlap1=SET
11=L:IntercoolerFlap2=SET
12=L:IntercoolerFlap3=SET
13=L:IntercoolerFlap4=SET
14=L:IntercoolerFlap1Switch=SET
15=L:IntercoolerFlap2Switch=SET
16=L:IntercoolerFlap3Switch=SET
17=L:IntercoolerFlap4Switch=SET
18=L:APTurn=SET
19=L:ApuStarterGenSwitch=SET
20=L:OilTankSelector=CYCLIC
21=L:RadioAltSwitchOn=TOGGLE
22=L:RadioAltRange=TOGGLE
23=L:RadioAlt2SwitchOn=TOGGLE
24=L:RadioAlt2Range=TOGGLE
25=L:RadioAltScr718On=TOGGLE
26=L:RadioAltScr718Range=TOGGLE
27=L:RMI1=TOGGLE
28=L:RMI2=TOGGLE
29=L:LandingLightExtendSwitch=TOGGLE
30=L:EmergExitLightSwitch=TOGGLE
31=L:MixtureRatioLever1Position=SET
32=L:MixtureRatioLever2Position=SET
33=L:MixtureRatioLever3Position=SET
34=L:MixtureRatioLever4Position=SET
35=L:StPrEngSelState=SET
36=L:Steering_Set=SET

Here is my lua script for my simplified push-button control of the 4 basic mixture settings:

function mixture1(offs, val)

   mixset1 = val

   if mixset1 > 0 then newmix1 = mixset1 + 1
      else newmix1 = 0
    end

   ipc.writeLvar("L:MixtureRatioLever1Position",newmix1)

end

function mixture2(offs, val)

   mixset2 = val

   if mixset2 > 0 then newmix2 = mixset2 + 1
      else newmix2 = 0
    end

   ipc.writeLvar("L:MixtureRatioLever2Position",newmix2)

end

function mixture3(offs, val)

   mixset3 = val

   if mixset3 > 0 then newmix3 = mixset3 + 1
      else newmix3 = 0
    end

   ipc.writeLvar("L:MixtureRatioLever3Position",newmix3)

end

function mixture4(offs, val)

   mixset4 = val

   if mixset4 > 0 then newmix4 = mixset4 + 1
      else newmix4 = 0
    end

   ipc.writeLvar("L:MixtureRatioLever4Position",newmix4)

end

event.offset(0x66C5,"UB","mixture1")

event.offset(0x66C6,"UB","mixture2")

event.offset(0x66C7,"UB","mixture3")

event.offset(0x66C8,"UB","mixture4")

In my FSUIPC4.ini file I assign8 switches/buttons to increment/decrement the values in those 4 offsets above:

!5=//SET 5 MIXTURE
70=B66C0=5 PD,14,Cx110066C5,x00030001 ;//INC Mixture1 through LUA routine MAX 3
71=B66C0=5 PD,15,Cx210066C5,x00000001 ;//DEC Mixture1 through LUA routine MIN 0
72=B66C0=5 PD,16,Cx110066C6,x00030001 ;//INC Mixture1 through LUA routine MAX 3
73=B66C0=5 PD,17,Cx210066C6,x00000001 ;//DEC Mixture1 through LUA routine MIN 0
74=B66C0=5 PD,18,Cx110066C7,x00030001 ;//INC Mixture1 through LUA routine MAX 3
75=B66C0=5 PD,19,Cx210066C7,x00000001 ;//DEC Mixture1 through LUA routine MIN 0
76=B66C0=5 PA,0,Cx110066C8,x00030001 ;//INC Mixture1 through LUA routine MAX 3
77=B66C0=5 PA,1,Cx210066C8,x00000001 ;//DEC Mixture1 through LUA routine MIN 0

The B66C0= portion of the coding above is my method of implementing 'modes' for my Saitek dual

throttle quadrant switches. Offset 66C0 holds the 'mode' number and when that number = 5, then

the switches listed will control the mixture. I have other assignments for those very same switches

in the modes 0 to 4 and 6, thus each switch can control 7 different functions.

 

On the note of reading an input, scaling and then output the scaled value, here is an example using

the FSX rudder trim offset 0x0BBC. In the script that follows, that could be replaced with a user-defined

offset being driven by an axis. The scaled output would get sent to the desired L:variable. note also

that I have the scaled output value displayed for 1 second, which is helpful when debugging or just

monitoring the operation of the script/assigned function.

  function Disp_Rud_Pos(control,Dummy)

   if Rud_Trim_last == nil then Rud_Trim_last = 0 end

    RTrim_in = ipc.readSW(0x0BBC)

    Rud_Trim = (round(RTrim_in/163.83))/10

	 if (Rud_Trim > (Rud_Trim_last + 0.15)) or (Rud_Trim < (Rud_Trim_last - 0.15)) then

       ipc.display("Rud Pos = "..Rud_Trim, 1)

	 end

	Rud_Trim_last = Rud_Trim

  end

-- rounds the integer
  function round(num)
	num = tonumber(num)
	if num == nil then return 0 end
    if num >= 0 then return math.floor(num+.5)
    else return math.ceil(num-.5) end
  end

event.offset(0x0BBC,"SW","Disp_Rud_Pos")

Here is an example of an user-defined offset changing and triggering a script to scale the input and send the

new value to an L:Variable. In this case it is the A2A P-51 CIV Cabin Vent control.

  function Cabin_Vent(control, Vent_in)

  Vent_Out = (Vent_in + 16383)/327.67

  ipc.writeLvar("L:CabinVent", Vent_Out)

  end

event.offset(0x66D4,"SW","Cabin_Vent")

You can have mutiple functions in a single file witha ".lua" extension as long as the fuction code is above the

calling or 'trigger' specification (event.offset for example).

 

That should give you some ideas to work with. I would get 1 mixture lever working first, then just clone the

code changing the engine number in the L:vars and the calling/trigger offsets.

 

Paul

Link to comment
Share on other sites

Hi,

 

Thank you for your quick and extensive reply!

 

As you suggested, I first upgraded the B377 installation. Unfortunatly, it did'nt change anything regarding the mixture levers.

 

So far, I have not used the Lua FSUIPC interface, nor plain Lua (I rather code in C++). I have to go through the documentation and make tests, trying also to keep the calibrations and mapping as they are currently, for the other aircrafts. It will take some time before I can come back and keep you informed.

 

Thanks again.

Link to comment
Share on other sites

  • 2 weeks later...

First, I found a workaround: rather than using 2 mixture levers assigned to Mixture1 and Mixture2, I used only 1 lever, assigned to Mixture. This actually controls the 4 VC levers, and surprisingly, even when applying a joystick calibration. There is something odd with the 2-lever configuration, maybe Pete can explain?

Then, I went through the FSUIPC and Lua documentation, which made your reply clear to me. I solved the issue by making a Lua script that acquires the 2 lever positions and controls 2 Lvars per engine "L:MixtureRatioLeverX" and "L:MixtureRatioLeverXPosition". Now,  I can see the VC mixture levers moving by pairs, and also the fuel flow gauges react accordingly.

I was quite amazed by the power of these Lua scripts and Lvar’s. So, I went on with them, and I solved another problem: the throttle levers could not control the reverse (although they are properly calibrated), only F2 keystrokes work. This time, I could not find a control Lvar, but, alternatively, I could acquire a Lvar "L:Engine1ThrottlePosition" that ranges from 50 to 100 in the reverse area; the Lua script simply sends F2’s until the lever position and the Lvar are consistent (and also F3’s when the lever goes back to Idle).

Thanks again for your helpful reply, thanks to Pete for the power of FSUIPC+Lua+Lvar’s.
 

Link to comment
Share on other sites

I have two small Lus scripts for the B-377 reverse features:

B377_Rev.lua

i = 0
   ipc.keypress(112)
   ipc.sleep(250)
while i < 14 do
   ipc.keypress(113)
    ipc.keypress(113)
	ipc.keypress(113)
   ipc.sleep(50)
   i = i + 1
end



Exit_Rev.lua

i = 0
while i < 15 do
   ipc.keypress(114)
      ipc.sleep(50)
	ipc.keypress(114)
   ipc.sleep(50)
   i = i + 1
end


I assign the B377_Rev.lua script to the detent entry of one of my 4 Saitek Throttle levers and

the Exit_Rev.lua script to the detent exit of that lever.

 

The 'loops' send the F2 and F3 controls to move the VC throttles into and out of the reverse region. Key presses

113 and 114. The revese entry script first sends the F1 Key press (112) to set the throttle to idle.

 

Once the VC throttles come out of the reverse zone. just continue operating thrust normally.

 

   Paul

Link to comment
Share on other sites

My left throttle lever has a mechanical detente, but no micro-switch associated.

 

My script polls the lever raw value cyclically:

-- get left throttle joystick axis data, and current gauge lever 1 position
joy1 = ipc.axis(4, "S")	--  left throttle
lvarEngine1ThrottlePosition = ipc.readLvar("L:Engine1ThrottlePosition")	-- 0 = max, 50 = idle, 100 = full reverse

-- reverse ?
if joy1 < -14000 then	-- reverse asked for
	desiredReverse = joy1 * aRev + bRev	-- 50 = min, 100 = max
	if desiredReverse > 100 then	-- saturate
		desiredReverse = 100
	end
	if lvarEngine1ThrottlePosition < desiredReverse then -- increase reverse
		ipc.keypress(113)	-- send F2 to engage reverse
	end
else	-- no reverse
	if lvarEngine1ThrottlePosition > 50 then -- decrease reverse
		ipc.keypress(114)	-- send F3 to stop reverse
	end
end

where aRev and bRev are calculated once forever out of the polling loop:

-- slope and offset (for reverse) for throttle 1 lever in the range [-14000, -16300]
aRev = - 1 / (-14000 + 16300) * 50
bRev = 14000 * aRev + 50

Note that this allows to adjust the reverse thrust linearly (marginally interesting, I admit).

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.