Sabrefly Posted March 19, 2018 Report Posted March 19, 2018 (edited) Hello, This is a small Lua I use for AI number and FPS display on a wideclient: -- Create the display window for 4 values, position x=800, y=400 h = display.create("My next display", 2, 800, 400, DSP_TOPMOST) -- Update the display at 500 msec intervals (see event at end) function mytimer(time) -- display 1 = frame rate fr = ipc.readUW(0x0274) if fr ~= 0 then fr = 32768/fr end fr = math.floor((fr * 10) + 0.5)/10 display.show(h, 1, "Frame Rate " .. fr .. " fps") -- display 2 = number of AI traff = ipc.readUD(0x025C) display.show(h, 2, "AI Number " ..traff) end -- Adjust timing to taste: 500 = 1/2 second event.timer(500, "mytimer") AI number display works OK, as in the past versions, but FPS display shows 1/3 of the real value. So, for example, in my scenario on the main display my current FPS count is 30, whereas Frame Rate display shows only 10 fps. This lua has worked since many versions ago, so it must be something in FSUIPC. Thanks, Edited March 19, 2018 by Sabrefly
Thomas Richter Posted March 19, 2018 Report Posted March 19, 2018 Hi, your code works correct here with FSUIPC 5.124a in P3Dv4.2 and WideClient 7.141 Thomas
Pete Dowson Posted March 19, 2018 Report Posted March 19, 2018 1 hour ago, Sabrefly said: AI number display works OK, as in the past versions, but FPS display shows 1/3 of the real value. So, for example, in my scenario on the main display my current FPS count is 30, whereas Frame Rate display shows only 10 fps. This lua has worked since many versions ago, so it must be something in FSUIPC. With the use of the P3D4 PDK now, FSUIPC does not receive the frame rate from the sim. (I've complained to L-M about this, and hope for a solution). So, in the interim FSUIPC calculates the frame rate itself based on the number of Frame calls it gets from the PDK per second, averaged every 1/6th second. Here this is quite accurate, though usually different from the one shown on screen in the Sim. It is very close though, all the time. The idea of using the PDK for Frame rate calls instead of SimConnect was to reduce the loading on SimConnect -- by that number of calls per second. It is worrying that in your case the frame rate is so different. I'd like to know why the PDK in your case only calls FSUIPC at 1/3rd of the actual frame rate. Can you describe what P3D4 is doing, what else is running? You can change back to the older method by setting UsePDK=No (see the INI file), but I'd like to know why you see such a discrepancy. If these PDK calls a so unreliable I shall have to abandon the idea. It will be affecting a lot more than just the frame rate offset value. Pete
Sabrefly Posted March 19, 2018 Author Report Posted March 19, 2018 2 minutes ago, Pete Dowson said: With the use of the P3D4 PDK now, FSUIPC does not receive the frame rate from the sim. (I've complained to L-M about this, and hope for a solution). So, in the interim FSUIPC calculates the frame rate itself based on the number of Frame calls it gets from the PDK per second, averaged every 1/6th second. Here this is quite accurate, though usually different from the one shown on screen in the Sim. It is very close though, all the time. The idea of using the PDK for Frame rate calls instead of SimConnect was to reduce the loading on SimConnect -- by that number of calls per second. It is worrying that in your case the frame rate is so different. I'd like to know why the PDK in your case only calls FSUIPC at 1/3rd of the actual frame rate. Can you describe what P3D4 is doing, what else is running? You can change back to the older method by setting UsePDK=No (see the INI file), but I'd like to know why you see such a discrepancy. If these PDK calls a so unreliable I shall have to abandon the idea. It will be affecting a lot more than just the frame rate offset value. Pete Pete, my aircraft (either FSL A320 or Default F22 or some Carenado simple a/c) are sitting on the ground, doing nothing, On and Off. The FPS count on FPS display is exactly 1/3 of the actual number. As if it needs to insert some simple factor 3 in the formula. I never had a problem or any oddities with it before v4.2 Thanks,
Sabrefly Posted March 19, 2018 Author Report Posted March 19, 2018 14 minutes ago, Pete Dowson said: You can change back to the older method by setting UsePDK=No (see the INI file), but I'd like to know why you see such a discrepancy. If these PDK calls a so unreliable I shall have to abandon the idea. It will be affecting a lot more than just the frame rate offset value. Under which section in FSUIPC should I need to add this Switch? Just curious what will change? Thanks,
Thomas Richter Posted March 19, 2018 Report Posted March 19, 2018 Hi, you place it in the [General] section. I forgot I have that line still in, that's why your code worked here OK. Thomas Later: Just tried with UsePDK=Yes and it works OK as well, shows the correct FPS rate.
Sabrefly Posted March 19, 2018 Author Report Posted March 19, 2018 27 minutes ago, Thomas Richter said: Just tried with UsePDK=Yes and it works OK as well, shows the correct FPS rate. Thomas, I couldn't find UsePDK= line anywhere in FSUIPC pdf files, where did you get it from? Do you run WideClient on a networked PC, don't you? This is really very odd in my case, as the counter shows exactly 1/3 of the actual FPS. I have 3 client PCs Win10 and 2xWin7, they all show 1/3 of the actual FPS.
Sabrefly Posted March 19, 2018 Author Report Posted March 19, 2018 I confirm: UsePDK=No fixes FPS Display, now it shows 30 as it should. I'm not sure if this is a good news for Pete though. Thanks.
Thomas Richter Posted March 19, 2018 Report Posted March 19, 2018 Hi, 39 minutes ago, Sabrefly said: Do you run WideClient on a networked PC, don't you? actually on the same PC but inside WideClient in a different classinstance. Just to confirm you use FSUIPC5.124a ? Thomas
Sabrefly Posted March 19, 2018 Author Report Posted March 19, 2018 6 minutes ago, Thomas Richter said: Hi, actually on the same PC but inside WideClient in a different classinstance. Just to confirm you use FSUIPC5.124a ? Thomas Affirm, 5.124a Try to run on a networked PC if you have one. Something tells me you'll see my result 100%. Thanks.
Pete Dowson Posted March 19, 2018 Report Posted March 19, 2018 36 minutes ago, Sabrefly said: I'm not sure if this is a good news for Pete though. Well, I could rip a bit of code out, though I won't pending L-M one day providing the Frame Rate as a proper data item like others, instead of just part of data supplied only by the frame event from SimConnect. Strange though, it is okay here, both on the same PC and on a true WideClient. I don't see why it should be different for you, and a factor of 3 does seem very suspicious. I'll probably just default UsePDF=No in a subsequent update. The only penalty is back to many more SimConnect calls per second, which is only really a possible penalty for those with several heavy SimConnect users (PMDG aircraft, ChasePlane, ProATC, ProSim, etc ... they all add up). The fact that folks may not have noticed any adverse effect of the loading helps, but I like things to be as efficient as possible nonetheless. Pete
Pete Dowson Posted March 19, 2018 Report Posted March 19, 2018 1 minute ago, Sabrefly said: Try to run on a networked PC if you have one. Something tells me you'll see my result 100%. No, I've tested on my cockpit system with many separate PC clients. There's no way in the code that having clients driven by the WideServer code has anything to do with the small calculating code called by the PDK frame event. Pete
Sabrefly Posted March 19, 2018 Author Report Posted March 19, 2018 I have no problem making calculations in my head (10x3), and you mentioned it (UsePDK=Yes) was more efficient. Thanks!
Pete Dowson Posted March 26, 2018 Report Posted March 26, 2018 On 3/19/2018 at 6:12 PM, Pete Dowson said: No, I've tested on my cockpit system with many separate PC clients. There's no way in the code that having clients driven by the WideServer code has anything to do with the small calculating code called by the PDK frame event. I can get your result, the PDK computed frame rate 1/3rd of the correct one, but only with P3D4.1. Not at all with 4.2. Can you double check the P3D version, that it is 4.2.21, please? It is a puzzle nonetheless, but easier for me to deal with efficiently if I know it's a problem only with 4.1. Pete
Sabrefly Posted March 26, 2018 Author Report Posted March 26, 2018 Pete, most definitely my P3Dv4 is v4.2.21.24048 with FSUIPCv5.124a WideClient v7.141. The only legacy settings file from P3Dv3.4 I have is FSUIPC.ini below: [General] UpdatedByVersion=5124a History=6BOSQ8YIH6YDP2QJY0UF7 InitDelayDevicesToo=No PMDG737offsets=Auto PMDG747offsets=Auto PMDG777offsets=Auto Annotate=Yes NewInterceptTextMenu=No UseSystemTime=No UseMidMouseBtn=Yes MouseWheelMove=No MouseWheelTrim=No MouseWheelTrimSpeed=1 JoystickTimeout=20 FixControlAccel=No RestoreSimcWindows=No FixMachSpeedBug=No AutoScanDevices=Yes DisconnTrimForAP=No ZeroElevForAPAlt=No ThrottleSyncAll=No WhiteMessages=No ShowPMcontrols=No SpoilerIncrement=512 MagicBattery=Yes RudderSpikeRemoval=No ElevatorSpikeRemoval=No AileronSpikeRemoval=No ReversedElevatorTrim=No ClockSync=No ClockSyncMins=5 ClearWeatherDynamics=No TimeForSelect=4 LoadFlightMenu=No LoadPlanMenu=No PauseAfterCrash=No BrakeReleaseThreshold=75 SaveDataWithFlights=No ZapSound=firework ShortAircraftNameOk=Substring UseProfiles=Yes EnableMouseLook=No DelayedMouseLookZoom=No WideLuaGlobals=Yes AxesWrongRange=No TCASid=Flight TCASrange=40,3 AxisCalibration=No DirectAxesToCalibs=No ShowMultilineWindow=Yes SuppressSingleline=No SuppressMultilineFS=No AxisIntercepts=No DontResetAxes=No ThreadAffinityMask=x0 LuaAffinityMask=x0 InitDelay=0 GetNearestAirports=Yes LogOptionProtect=Yes TimeForLuaClosing=2 WeatherReadFactor=2 WeatherRewriteSeconds=1 CustomWeatherModify=No SimConnectStallTime=1 InitialStallTime=10 NormalStallTime=1 LuaRerunDelay=66 Console=No UsePDK=Yes FSVersionUsed="Lockheed Martin® Prepar3D® v4",4.2.21.24048 SimConnectUsed=4.2.0.0 [Traffic Limiter] AirportPreference=0 PlannedAirportsPreference=0 GroundPreference=0 NearerPreference=0 TargetFrameRate=0 TrafficLimit=0 [JoyNames] AutoAssignLetters=Yes 0=Saitek P8000 0.GUID={D5AF72A0-D7BF-11E7-800D-444553540000} 1=F16 MFD 1 1.GUID={D6013C20-D7BF-11E7-8011-444553540000} A=Saitek P8000 A.GUID={D5AF72A0-D7BF-11E7-800D-444553540000} B=F16 MFD 1 B.GUID={D6013C20-D7BF-11E7-8011-444553540000} C=CH Control Manager Device 2 C.GUID={F6CE4100-D7C9-11E7-8001-444553540000} D=CH Control Manager Device 3 D.GUID={F6CE6810-D7C9-11E7-8002-444553540000} E=CH Control Manager Device 4 E.GUID={F6CE6810-D7C9-11E7-8003-444553540000} F=CH Control Manager Device 1 F.GUID={F6CE6810-D7C9-11E7-8004-444553540000} G=CH Throttle Quadrant USB G.GUID={D6016330-D7BF-11E7-8013-444553540000} H=CH Pro Pedals USB H.GUID={D6016330-D7BF-11E7-8014-444553540000} J=CH Fighterstick USB J.GUID={D6016330-D7BF-11E7-8015-444553540000} K=CH Pro Throttle USB K.GUID={D6016330-D7BF-11E7-8016-444553540000} L=CH Throttle Quadrant USB L.GUID={D6018A40-D7BF-11E7-8017-444553540000} 2=CH Control Manager Device 2 2.GUID={F6CE4100-D7C9-11E7-8001-444553540000} 3=CH Control Manager Device 3 3.GUID={F6CE6810-D7C9-11E7-8002-444553540000} 4=CH Control Manager Device 4 4.GUID={F6CE6810-D7C9-11E7-8003-444553540000} 5=CH Control Manager Device 1 5.GUID={F6CE6810-D7C9-11E7-8004-444553540000} [Axes] PollInterval=10 RangeRepeatRate=10 0=CZ,256,D,4,0,0,0 -{ DIRECT: Throttle }- 1=EX,256,D,7,0,0,0 -{ DIRECT: LeftBrake }- 2=EY,256,D,8,0,0,0 -{ DIRECT: RightBrake }- 3=EZ,256,D,3,0,0,0 -{ DIRECT: Rudder }- 4=ES,256,F,66818,0,0,0 -{ TO SIM: STEERING_SET }- 5=FX,2065,D,1,0,0,0 -{ DIRECT: Aileron }- 6=FY,2588,D,2,0,0,0 -{ DIRECT: Elevator }- [Buttons] PollInterval=25 ButtonRepeat=20,10 1=RF,0,C65588,0 -{BRAKES}- 2=UF,0,C3,0 -{Custom control: <3>}- 3=RF,2,Cx32000BC0,x3FFF0080 -{offset sword increment, offset 0BC0 (Incr=128, Limit=16383)}- 4=RF,4,Cx42000BC0,xC0010080 -{offset sword decrement, offset 0BC0 (Decr=128, Limit=-16383)}- 7=PE,0,C66066,0 -{SPOILERS_ARM_ON}- 8=PE,1,C66067,0 -{SPOILERS_ARM_OFF}- 9=PD,3,C66064,0 -{SPOILERS_ON}- 10=PC,6,C66065,0 -{SPOILERS_OFF}- 11=PC,3,K123,10 -{Key press: ctl+F12}- 13=PA,11,C65584,0 -{BAROMETRIC}- 14=PA,12,C66846,0 -{BAROMETRIC_STD_PRESSURE}- 15=PA,20,C1079,0 -{traffic zapper}- 16=PA,27,C1085,0 -{traffic zapall}- 17=PA,8,K49,11 -{Key press: ctl+shft+1}- 18=PA,9,K50,11 -{Key press: ctl+shft+2}- 19=PA,10,K51,11 -{Key press: ctl+shft+3}- 20=PA,15,K52,11 -{Key press: ctl+shft+4}- 21=PA,16,K53,11 -{Key press: ctl+shft+5}- 22=PA,17,K54,11 -{Key press: ctl+shft+6}- 23=PA,23,K56,11 -{Key press: ctl+shft+8}- 24=PA,24,K57,11 -{Key press: ctl+shft+9}- 25=PA,25,K48,11 -{Key press: ctl+shft+0}- 26=PA,22,K55,11 -{Key press: ctl+shft+7}- 27=PA,7,K82,11 -{Key press: ctl+shft+R}- 28=PA,0,K74,10 -{Key press: ctl+J}- [AutoSave] Next=1 Interval=60 Files=10 SaveOnGround=No AutoSaveEnabled=No [GPSout] GPSoutEnabled=No Port=COM1 Speed=4800 Interval=2000 PosTo6Decimal=No SimModeIndicator=No Sentences= [GPSout2] GPSoutEnabled=No Port=<none set> Speed=4800 Interval=2000 PosTo6Decimal=No SimModeIndicator=No Sentences= [WideServer] WideFSenabled=Yes AdvertiseService=1 Port=8002 Port2=9002 [Sounds] Path=F:\Lockheed Martin\Prepar3D v4\Sound\ Device1=Primary Sound Driver Device2=???????? (Realtek High Definition Audio) Device3=Realtek Digital Output (Realtek High Definition Audio) [JoystickCalibration] AllowSuppressForPFCquad=Yes ExcludeThrottleSet=Yes ExcludeMixtureSet=Yes ExcludePropPitchSet=Yes SepRevsJetsOnly=No ApplyHeloTrim=No UseAxisControlsForNRZ=No FlapsSetControl=0 FlapDetents=No ReverserControl=66292 Reverser1Control=66422 Reverser2Control=66425 Reverser3Control=66428 Reverser4Control=66431 MaxThrottleForReverser=256 AileronTrimControl=66731 RudderTrimControl=66732 CowlFlaps1Control=66162 CowlFlaps2Control=66163 CowlFlaps3Control=66164 CowlFlaps4Control=66165 SteeringTillerControl=0 MaxSteerSpeed=60 LeftBrake=-16384,11903/16 RightBrake=-16254,11903/16 SteeringTiller=-16254,-512,512,16254/16 Aileron=-16384,-512,512,16127 Elevator=-16384,-512,512,16255 Rudder=-16384,-512,512,16127 Throttle=-16254,16383 SlopeRudder=5 [Profile.F22] 1=F-22 Raptor - 525th Fighter Squadron [LuaFiles] 1=ipcReady 2=linda [VRInsight] 1=com3 [Window.SimConnect Message Window] NewDocked=156, 94, 2248, 63 [Window.Message Window] NewDocked=20, 47, 2520, 17 [Traffic Limiter] TrafficLimit=150 AirportPreference=0 GroundPreference=75 NearerPreference=1 TargetFrameRate=22 PlannedAirportsPreference=1 [Profile.FSL A320X] 1=FSLabs A320X IAE - British Airways (G-EUUE) 2=FSLabs A320X IAE - British Airways G-EUUE [Buttons.FSL A320X] 0=PF,5,K188,8 -{Key press: ,<key}- 1=PC,1,C1073,0 -{advdisplay toggle}- [Axes.FSL A320X] RangeRepeatRate=10 0=CZ,256,D,4,0,0,0 -{ DIRECT: Throttle }- 1=EX,256,D,7,0,0,0 -{ DIRECT: LeftBrake }- 2=EY,256,D,8,0,0,0 -{ DIRECT: RightBrake }- 3=EZ,256,D,3,0,0,0 -{ DIRECT: Rudder }- 4=ES,256,F,66818,0,0,0 -{ TO SIM: STEERING_SET }- 5=FX,256,D,1,0,0,0 -{ DIRECT: Aileron }- 6=FY,256,D,2,0,0,0 -{ DIRECT: Elevator }- [ClientNames] 1=KAT 2=F4N 3=WIN10 [Window.SimConnectWindow] NewDocked=1030, 595, 500, 239 [Monitor] [Profile.C337] 1=C337 Skymaster BLUE [Buttons.C337] 0=PF,5,K188,8 -{Key press: ,<key}- 1=PC,1,C1073,0 -{advdisplay toggle}- [Axes.C337] RangeRepeatRate=10 0=CZ,256,D,4,0,0,0 -{ DIRECT: Throttle }- 1=DS,256,D,5,0,0,0 -{ DIRECT: PropPitch }- 2=DT,256,D,6,0,0,0 -{ DIRECT: Mixture }- 3=EX,256,D,7,0,0,0 -{ DIRECT: LeftBrake }- 4=EY,256,D,8,0,0,0 -{ DIRECT: RightBrake }- 5=EZ,256,D,3,0,0,0 -{ DIRECT: Rudder }- 6=ES,256,F,66818,0,0,0 -{ TO SIM: STEERING_SET }- 7=FX,256,D,1,0,0,0 -{ DIRECT: Aileron }- 8=FY,256,D,2,0,0,0 -{ DIRECT: Elevator }- [Keys.FSL A320X] 1=19,8,65602,0,65604,0 -{Paus: Press=THROTTLE_DECR, Release=THROTTLE_CUT }- [Profile.RV7A] 1=VansRV7A N420HA [Buttons.RV7A] 0=PF,5,K188,8 -{Key press: ,<key}- 1=PC,1,C1073,0 -{advdisplay toggle}- [Axes.RV7A] RangeRepeatRate=10 0=CZ,256,D,4,0,0,0 -{ DIRECT: Throttle }- 1=DS,256,D,5,0,0,0 -{ DIRECT: PropPitch }- 2=DT,256,D,6,0,0,0 -{ DIRECT: Mixture }- 3=EX,256,D,7,0,0,0 -{ DIRECT: LeftBrake }- 4=EY,256,D,8,0,0,0 -{ DIRECT: RightBrake }- 5=EZ,256,D,3,0,0,0 -{ DIRECT: Rudder }- 6=ES,256,F,66818,0,0,0 -{ TO SIM: STEERING_SET }- 7=FX,256,D,1,0,0,0 -{ DIRECT: Aileron }- 8=FY,256,D,2,0,0,0 -{ DIRECT: Elevator }- Thanks!
cellular55 Posted March 27, 2018 Report Posted March 27, 2018 Hi, I show the FPS through a networked app I wrote that uses Wideclient 7.14a and FSUIPC 5.124a on P3D 4.2 with the option UsePDK=Yes. I can confirm that the FPS shown are correct. KR Joe
Pete Dowson Posted March 27, 2018 Report Posted March 27, 2018 1 hour ago, cellular55 said: I show the FPS through a networked app I wrote that uses Wideclient 7.14a and FSUIPC 5.124a on P3D 4.2 with the option UsePDK=Yes. I can confirm that the FPS shown are correct. Yes, seems it is okay for most. But I do see the 1/3rd value with 4.1. If it were okay with 4.2 but not 4.1 I'd just check "why" with L-M and merely disable the PDK use before 4.2. But it seems it is more complicated than that. Anyway, in the next interim update for FSUIPC5 I have SimConnect frame events used, but only to get the Frame Rate, and the PDK used for all the other actions FSUIPC needs to do per frame. I have asked L-M for either a PDK facility to get the Frame Rate, or, more consistently with other data, make it a regular Sim Var. Pete 1
Sabrefly Posted March 28, 2018 Author Report Posted March 28, 2018 (edited) On 3/27/2018 at 8:48 AM, cellular55 said: Hi, I show the FPS through a networked app I wrote that uses Wideclient 7.14a and FSUIPC 5.124a on P3D 4.2 with the option UsePDK=Yes. I can confirm that the FPS shown are correct. KR Joe Joe, could you share your app to see if it will work 1:1 on my rig? Thanks Edited March 28, 2018 by Sabrefly
cellular55 Posted March 28, 2018 Report Posted March 28, 2018 Hi Sabrefly, not so easy: my app is a compiled VB application that I use to manage my cockpit and my personal ATC flight guidance. It can run in right way only with my specific configurations and configuring in FSUIPC some special free offsets that manage different devices and switches. One of the many functions I have developed there, is the monitoring of the FPS. By the way nothing really special for that specific function: I read and show the offset 274 in VB: Call FSUIPC_Read1(&H274, 2, VarPtr(FPS), dwresult1) Call FSUIPC_Process1(dwresult1) Let me know if you want that I do for you an 'extract' of my app to only calculate,, following the VB method, the FPS. KR Joe
Sabrefly Posted March 28, 2018 Author Report Posted March 28, 2018 46 minutes ago, cellular55 said: Hi Sabrefly, not so easy: my app is a compiled VB application that I use to manage my cockpit and my personal ATC flight guidance. It can run in right way only with my specific configurations and configuring in FSUIPC some special free offsets that manage different devices and switches. One of the many functions I have developed there, is the monitoring of the FPS. By the way nothing really special for that specific function: I read and show the offset 274 in VB: Call FSUIPC_Read1(&H274, 2, VarPtr(FPS), dwresult1) Call FSUIPC_Process1(dwresult1) Let me know if you want that I do for you an 'extract' of my app to only calculate,, following the VB method, the FPS. KR Joe Joe, thanks, no worries. This is all too specialized for my simple task to check why I'm getting exactly 1/3 of the actual FPS.
Pete Dowson Posted March 28, 2018 Report Posted March 28, 2018 4 hours ago, Sabrefly said: This is all too specialized for my simple task to check why I'm getting exactly 1/3 of the actual FPS. Don't forget I am getting that with P3D4.1, and I cannot see any possible reason for it. It is bazaar. But life is too short. I will abandon my own calculations and awat L-M's addition of FR as a proper variable like everything else. Pete 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now