Setting the simulation time of day, date of year

DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Postby DevSim » Wed Dec 21, 2011 5:17 am

Dear Support Forum,



I am having troubles setting the simulation time via SimConnect from a remote machine. I am using the SDK 1.2. I send those values and the time of day is not changing at all.



Code snippet:



int todHours = 23;

int todMinutes = 59:

hr = SimConnect_TransmitClientEvent( _simHandle.simConnectHandle, 1, EVENT_KEY_CLOCK_HOURS_SET, todHours, GROUP_1, SIMCONNECT_EVENT_FLAG_DEFAULT);

hr = SimConnect_TransmitClientEvent( _simHandle.simConnectHandle, 1, EVENT_KEY_CLOCK_MINUTES_SET, todMinutes, GROUP_1, SIMCONNECT_EVENT_FLAG_DEFAULT);



Can I debug this somehow on the machine where P3D is running?



Regards,



DevSim




DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Postby DevSim » Wed Dec 21, 2011 5:55 am

From the SimConnect.log debug output on the Prepar3d machine, I get:



> 1853.50712 [ 0, 1394]TransmitClientEvent:ObjectID=1, EventID=10, dwData=23, GroupID=0, Flags=0

< 1853.50732 [0] >>>>> EXCEPTION=1, SendID=1394, Index=2 <<<<<

> 1853.50740 [ 0, 1395]TransmitClientEvent:ObjectID=1, EventID=11, dwData=59, GroupID=0, Flags=0

< 1853.50762 [0] >>>>> EXCEPTION=1, SendID=1395, Index=2 <<<<<



So the new time of day is obviously causing exceptions.


DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Postby DevSim » Thu Dec 22, 2011 3:26 am

And I figured out why the exceptions occured - the mapping of the event was wrong (forgot to omit the KEY_ prefix):



With:

hr = SimConnect_MapClientEventToSimEvent(_simHandle.simConnectHandle, EVENT_KEY_CLOCK_HOURS_SET, "CLOCK_HOURS_SET" );



I don't get exceptions during the mapping of the client to sim event.

I also don't get exceptions during transmiting the client event.



The time of day, however, doesn't change.



Regards,

DevSim


DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Postby DevSim » Tue Jan 10, 2012 12:15 pm

Does anyone have a recommendation how to set the time via SimConnect?



Thanks,

DevSim

DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Postby DevSim » Wed Jan 11, 2012 8:39 am

Looks like the culprit was the '1' within TransmitClientEvent() instead of 0. With zero, it works with ZULU_HOURS_SET. However, once the hour is changed, the "Loading..." dialog appears and the scenery reloads.



Better ideas, anyone?



Regards,

DevSim

N4GIX
Posts: 596
Joined: Wed Dec 08, 2010 6:52 pm

Postby N4GIX » Wed Jan 11, 2012 1:17 pm

That is normal behavior. Whenever the time changes +/- a certain few minutes, the entire scenery needs to reload/refresh.
Bill Leaming
Modeler and Programmer
Military Visualizations

Adam Breed
Lockheed Martin
Posts: 1385
Joined: Mon Sep 20, 2010 6:17 pm

Postby Adam Breed » Thu Jan 12, 2012 10:08 am

Hi DevSim,



N4GIX is correct. Whenever the time is changed using SimConnect you will end up experiencing the ‘Loading…’ screen for a brief moment. This is the same functionality that occurs when you change the time using the ‘Time and Seasons’ settings in application.
Prepar3D® Engineering Project Manager

DevSim
Posts: 141
Joined: Thu Jul 07, 2011 12:45 pm

Postby DevSim » Thu Jan 12, 2012 10:11 am

Thanks Adam,



For the record: The same behaviour applies for the day of the year.

"Brief moment" is of course dependant on your scenery complexity and your hardware configuration and available powert ;)



Regards,

DevSim


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 9 guests