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

Simulation rate awkward

jimkeir

Resource contributor
Messages
93
Country
unitedkingdom
Hi,

It seems to me that there's no direct way of setting the simulation rate via SimConnect. The "SIMULATION RATE" variable is read-only, and there's no "SIM_RATE_SET" event.

I've faked it by getting the "SIMULATION RATE" value and then working out how many "SIM_RATE_PLUS" or "SIM_RATE_MINUS" events I need to get it to a given value, but this seems clunky. Am I missing something?

Cheers
Jim
 
It seems to me that there's no direct way of setting the simulation rate via SimConnect. The "SIMULATION RATE" variable is read-only, and there's no "SIM_RATE_SET" event.

There's one it the CONTROLS.DLL tables, definable as follows in Gauges.h terms:

#define KEY_SIM_RATE_SET (KEY_ID_MIN + 505)

However, it doesn't work. I reported this before FSX's release and it's been in the "to be fixed" bug list ever since. Just never made it near implementation priority I guess -- probably only me complaining about it.

I've faked it by getting the "SIMULATION RATE" value and then working out how many "SIM_RATE_PLUS" or "SIM_RATE_MINUS" events I need to get it to a given value, but this seems clunky. Am I missing something?

No, that's the way FSUIPC has to do it too.

Pete
 
What function do you call to decrease or increase the simulation rate? Or how can you send an event to tell the simulation to pause? I couldn't find anything about it in the SDK documentation... :(
 
Last edited:
Hi,

It's all done using events - there's a link at the top of the SimConnect page in the SDK. You need to send an event to the sim; there are separate events for SIM_RATE_INCR and SIM_RATE_DECR, and another called PAUSE_ON.

Something like this:
Code:
SCn_MapClientEventToSimEvent(hSimConnect, EVENT_SRPLUS, "SIM_RATE_INCR");
SCn_MapClientEventToSimEvent(hSimConnect, EVENT_SRMINUS, "SIM_RATE_DECR");
SCn_MapClientEventToSimEvent(hSimConnect, EVENT_SET_PAUSE,"PAUSE_ON");
...
// Increase the sim-rate
SCn_TransmitClientEvent(hSimConnect,SIMCONNECT_OBJECT_ID_USER,
                  EVENT_SRPLUS,0,
                  SIMCONNECT_GROUP_PRIORITY_DEFAULT,
                  SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
// Pause
SCn_TransmitClientEvent(hSimConnect, 0, EVENT_SET_PAUSE, 0,
                  SIMCONNECT_GROUP_PRIORITY_DEFAULT,
                  SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);

Cheers,
Jim
 
I am trying to track the simulation rate, but the value seems to hit a ceiling of "4" when the simulator is set to 8x or more. This is unfortunate, because I wanted to detect 8x specifically as the event at which AI stops being simulated. All values below 8x are reported just fine.

In manged code, this is what I do:
Code:
_simconnect.AddToDataDefinition(DATA_DEFINITIONS.SIMULATION_RATE, "SIMULATION RATE", "number", SIMCONNECT_DATATYPE.INT32, 1.0f, SimConnect.SIMCONNECT_UNUSED);

_simconnect.RegisterDataDefineStruct<INTEGER_SINGLETON>(DATA_DEFINITIONS.SIMULATION_RATE);

_simconnect.RequestDataOnSimObject(DATA_REQUEST.SUMUATION_RATE, DATA_DEFINTION.SIMULATION_RATE, 0, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);

Notes:
1) Using Doubles instead of integers to retrieve the data shows the same problem.
2) INTEGER_SINGLETON is a struct that contains just a single integer value.

If you have this working, even if it is C rather than C#, I'd be glad to see an example.

Thanks
Simon
 
I am trying to track the simulation rate, but the value seems to hit a ceiling of "4" when the simulator is set to 8x or more.
I'm reading the correct value (to populate offset 0C1A (the old FS98 offset)) in FSUIPC4.

I am using the fSimSpeed value returned with the frame event, in the SIMCONNECT_RECV_EVENT_FRAME structure. You also get the FS frame rate (fFrameRate) with that event.

Regards

Pete
 
Back
Top