[REL] rFactor2 Weather Tool

Discussion in 'Other' started by Gerald Jacobson, Mar 30, 2013.

  1. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    NEWS: Now, there are 3 tools
    - The original rFactor2 Weather Tool (to update WET files using historical and forecast data)
    - The Weather Server (used to inject directly weather into a rF2 dedicated server) - Support "Realtime (Live) weather" and "User weather"
    - The Weather Control Plugin (who is the client of the Weather Server)
    Donwload last version

    Note: If you use it,like it and want/can, you can Donate to support.

    As some people have trouble making a custom network setting for Plugin and Weather Server, here an exemple with detail:
    Green info must be equals. Green & Orange must be different
    Weather Server . ini:
    Code:
    // Weather Server ini file
    [RFACTOR2]
    // The directory containing the "core" directory
    CorePath=C:\Games\rFactor 2 Install 3
    // The directory where GDB/AIW will be extracted
    GDBExtractPath=C:\Games\rFactor 2 Install 3\Plugins\TrackMap\Tracks
    
    [SERVER]
    [B][COLOR="#008000"]Port=666[/COLOR][/B]
    DefaultWeatherUndergroundAPIKey=043xxxxxxx
    
    [Plugins]
    count=0
    
    Weather plugin .ini (located in userdata folder):
    Code:
    //
    [Plugin]
    [B][COLOR="#FF8C00"]Port=34297[/COLOR][/B]
    
    [Server]
    Address=localhost
    [B][COLOR="#008000"]Port=666[/COLOR][/B]
    
    ------------------------------------------------------- rFactor2 Weather Tool --------------------------------------------------
    Hello,
    This application allow you to retrieve weather condition (historic and forecast) and then update a given rFactor2 circuit with this meteo.

    So, you can play your rFactor2 session (practice/qualifying/race) in the same weather condition as a real race.

    This application use a configuration file named "WeatherConfig.xml" containing the folowwing informations:
    - rFactor2 data directory location
    - Proxy credentials (optional)
    - rFactor2 profiles list
    - Weather providers
    - rFactor2 locations (Circuits)
    - list of directories for this location (some circuits have several configurations -> several directories under "Settings")
    - List of parameters for each weather provider used for this circuit (those parameters allow each provider to know the location of the circuit)


    This application come from a preexisting configuration file containing:
    - A forecast weather provider (7timer!)
    - An Historic weather provider (The Weather Channel)
    - 5 circuits
    - Brianza
    - Croft
    - Poznan
    - Sebring
    - Spa

    >> Download the last version of the application:
    http://dl.dropbox.com/u/15864065/rFactor2WorldWeather.zip

    >> Download the last version of the XML file (cloud community file)
    https://docs.google.com/document/d/1vwx2M5jZXVPQZqzhTVIq1d7XVITqfyb_GPB5kHpDCss/export?format=txt

    Here a community contribution initiated by BrokkelPiloot (Thanks to him), to centralize the addition of new tracks and provider parameters on the XML file. So you can download the XML from google drive to have the lastest (most complete) XML file at any time (and add your own data if it does not exists yet in the file, by editing the XLS and XML files).


    Here a screen shot of the tool, and after you will find the ReadMe file content (how to install, use and configure)
    View attachment 6973


    Installation:
    - Prerequisite: .Net Framework 4
    - If you copy the rFactor2WorldWeather.exe and WeatherConfig.xml file directly under the rFactor2 data directory, you can directly launch the application.
    - If you copy elsewhere, please update the WeatherConfig.xml file to set the game dataPath to the rFactor2 data directory
    For exemple: C:\Users\<username>\Documents\rFactor2
    Note: The rFactor2 data directory is the one containing "UserData", "package", "player", etc...


    How To Use:
    - Launch rFactor2WorldWeather.exe
    - Select a profile
    - Select a circuit
    - Select a session type
    - Define the date, start time and duration of the session
    - Choose the weather provider (historic if the session is in the past, forcast if in future)
    - Click to collect the weather
    - Click on the Save button to update the weather file of your rFactor2

    Since v2, you can use it also via command line
    Usage: rFactor2WorldWeather.exe <Parameters>
    example: rFactor2WorldWeather.exe -prf 1 -prv 1 -c Belgium1966 -R_nbSeg 12 -R_Toffset 3 -R_date 2009-03-25 -R_start 06:12 -R_dur 03:24

    Mandatory Parameters:
    -prf <id> : profile id, example -prf 1
    -c <name> : circuit name, example -c "Istanbul Park"
    -prv <id> : provider id, example -prv 1

    Optional Parameters:
    -PLR : update the PLR file

    Optional Parameters (Practice):
    -P_nbSeg <num> : Number of weather segment
    -P_Toffset <num> : Temperature offset
    -P_date <YYYY-MM-DD> : Date of the session
    -P_start <HH:mm> : Time of the session
    -P_dur <HH:mm> : Duration of the session

    Optional Parameters (Qualify):
    -Q_nbSeg <num> : Number of weather segment
    -Q_Toffset <num> : Temperature offset
    -Q_date <YYYY-MM-DD> : Date of the session
    -Q_start <HH:mm> : Time of the session
    -Q_dur <HH:mm> : Duration of the session

    Optional Parameters (Race):
    -R_nbSeg <num> : Number of weather segment
    -R_Toffset <num> : Temperature offset
    -R_date <YYYY-MM-DD> : Date of the session
    -R_start <HH:mm> : Time of the session
    -R_dur <HH:mm> : Duration of the session


    Important:
    As rFactor2 read the file when a circuit is selected and write the file when you change the circuit or quit the game, it is not possible to update the weather data for an in-use circuit.
    We recommend to use this software when the game is not launched or if in use on another circuit.



    ----------------------------------- How to find parameter(s) value for each weather provider ------------------------------
    ---------------------------------------------------------------------------------------------------------------------------
    1) The Weather Channel
    Open a web browser and go to the url: http://uk.weather.com/
    In the search field, enter the address of the circuit, and click the search icon. Ex: "Monte-Carlo, Monaco"
    Now the URL in your browser is something like:
    http://uk.weather.com/weather/today-Monte-Carlo-MNXX0001?fromSearch=true

    The "Location" parameter of this provider is the code MNXX0001 for this exemple.

    So for the Monaco circuit, you will put this XML fragment in the WeatherConfig.xml file:
    <Provider id="1">
    <Parameters>
    <Parameter name="Location" value="MNXX0001"/>
    </Parameters>
    </Provider>


    2) 7Timer!
    Open a web browser and go to the url: http://7timer.y234.cn/
    In the search field, enter the address of the circuit, and click "Search on map". Ex: "Monte-Carlo, Monaco"
    Now mouve your mouse over the orange map pin, a popup is displayed, so click on the "CIVIL" link
    Now the URL in your browser is something like:
    http://7timer.y234.cn/index.php?product=civil&lon=7.42722219999996&lat=43.7397222&lang=en&tzshift=0

    The "Longitude" is the value of the "lon" url parameter value, and the "Latitude" is the "lat" url parameter value.

    So for the Monaco circuit, you will put this XML fragment in the WeatherConfig.xml file:
    <Provider id="2">
    <Parameters>
    <Parameter name="Longitude" value="7.42722219999996"/>
    <Parameter name="Latitude" value="43.7397222"/>
    </Parameters>
    </Provider>


    ------------------------------------------ How To Use the XML configuration file ------------------------------------------
    ---------------------------------------------------------------------------------------------------------------------------

    1) Structure
    <WeatherConfig>
    <Game/>
    <Proxy/>
    <Providers>
    <Provider/> // This tag can be added several times
    </Providers>
    <Profiles>
    <Profile/> // This tag can be added several times
    </Profiles>
    <Locations>
    <Location> // This tag can be added several times
    <Providers>
    <Provider> // This tag can be added several times
    <Parameters>
    <Parameter/> // This tag can be added several times
    </Parameters>
    </Provider>
    </Providers>
    <Directories>
    <Directory/>
    </Directories>
    </Location>
    </Locations>
    </WeatherConfig>

    2) Tag detail
    2.1) WeatherConfig
    It is the root tag. The is no additionnal information on it.

    2.2) WeatherConfig/Game
    This tag is used to reference the rFactor2 directory
    2.2.1) dataPath attribut
    This attribut allow you to point the rFactor2 data directory (not the core directory)
    If you let the default value ".", you must copy the exe and the xml file directly under the rFactor2 data directory

    2.3) WeatherConfig/Proxy
    You need to uncomment this tag only if you are beyound a securized proxy. This tag contains several attributs:
    - "user" : The username account
    - "password" : The password account
    - "domain" : The domain account

    2.4) WeatherConfig/Providers
    It is only a container tag. It contains the list of supported weather Provider

    2.5) WeatherConfig/Providers/Provider
    This tag define a supported provider.
    You CANNOT add your own providers, at least for now, as each provider need a corresponding software implementation. Please look the comment of each Provider in the XML file to know which parameters are expected.
    This tag contains several attributs:
    - "id" : an identifier used later in the XML to reference this provider (see WeatherConfig/Location/Providers/Provider@id)
    - "class" : The implementation class to use

    2.6) WeatherConfig/Profiles
    It is only a container tag. It contains the list of existing game Profile

    2.7) WeatherConfig/Profiles/Profile
    This tag define a game profile. By default, rFactor2 create a unique profile named "player". Many rFactor2 game settings are stored by game profile.
    You can add as many xml Profile tag as you have rFactor2 game profile.
    This tag contains several attributs:
    - "id" : an identifier used later in the XML to reference this profile (see WeatherConfig/Location@inProfiles)
    - "name" : the displayed name of this profile
    - "path" : the directory name of this profile

    2.8) WeatherConfig/Locations
    It is only a container tag. It contains the list of existing Location (circuit)

    2.9) WeatherConfig/Locations/Location
    This tag define a game circuit and all data needed to retrieve and apply weather on it.
    You can add as many xml Location tag as you have rFactor2 circuit.
    This tag contains several attributs:
    - "name" : the displayed name
    - "inProfiles" : a comma separated list of game Profile "id" where this circuit exists

    2.10) WeatherConfig/Location/Providers
    It is only a container tag. It contains the list of available weather Provider and there parameters for this circuit.

    2.11) WeatherConfig/Location/Providers/Provider
    This tag allow you to define wich provider can be used with this circuit.
    You can add as many xml Provider tag as you have weather Provider defined.
    This tag contains one attribut:
    - "id" : reference the id of one defined weather Provider

    2.12) WeatherConfig/Location/Providers/Provider/Parameters
    It is only a container tag. It contains the list of available Parameter for the weather provider. (generally, the parameters are used to define the location of the circuit in the weather provider coordinate)

    2.13) WeatherConfig/Location/Providers/Provider/Parameters/Parameter
    This tag define a key/value pair used to configure the provider for this circuit.
    You can add as many xml Parameter tag as the selected provider need
    This tag contains several attributs:
    - "name" : the name of the parameter
    - "value" : the value of the parameter

    Generally those parameters are used to build the URL used to request the weather data

    2.14) WeatherConfig/Location/Directories
    It is only a container tag. It contains the list of directories for this circuit. Indeed, sometimes a given circuit exist in several configuration, and each configuration are stored in a dedicated directory.

    2.15) WeatherConfig/Location/Directories/Directory
    This tag allow you to define the directory path for this circuit.
    You can add as many xml Directory tag as you have variant of a given circuit.
    This tag contains one attribut:
    - "path" : the name of the directory for this variant
     
    Last edited by a moderator: Jun 30, 2014
    DA, lagg, wrxxy and 1 other person like this.
  2. BrokkelPiloot

    BrokkelPiloot Registered

    Joined:
    May 19, 2012
    Messages:
    188
    Likes Received:
    1
    Awesome job! I will try it sometime this weekend. I think a lot of people have actually been thinking about a feature like this. Very nice that you actually took the effort to build this tool. Thanks!
     
  3. LabR4t

    LabR4t Registered

    Joined:
    Feb 18, 2012
    Messages:
    110
    Likes Received:
    1
    What a great idea gonna give this a try later.
    Thank you :)
     
  4. jomardi

    jomardi Registered

    Joined:
    Apr 18, 2011
    Messages:
    82
    Likes Received:
    1
    very interesting. I will try later THX.
     
  5. Woodee

    Woodee Registered

    Joined:
    Oct 4, 2010
    Messages:
    4,004
    Likes Received:
    1,058
    This needs to be an ingame feature! Well done creating this, will give it a try some time soon.
     
  6. Spadge

    Spadge Registered

    Joined:
    Oct 4, 2010
    Messages:
    311
    Likes Received:
    7
    Nice work!

    :)
     
  7. GauchoRS

    GauchoRS Registered

    Joined:
    Nov 23, 2011
    Messages:
    471
    Likes Received:
    9
    Gonzo (from ISI) confirmed in another thread, that it is possible to implemt ``unlimited`` definition (limitation to 5 has UI reasons).
    But he recommends to create them raisonably.
     
  8. PLAYLIFE

    PLAYLIFE Registered

    Joined:
    Dec 26, 2010
    Messages:
    743
    Likes Received:
    126
    Excellent work Gerald, and thank-you for sharing.

    On execution and when trying to update the session start time and duration, I keep getting this warning message:
    Please launch at least one time this circuit in rFactor to create the original file.
    File not found:


    It doesn't however list a file.
    It is in the root data directory as you've stipulated.

    Any idea what's causing this issue? I have run those circuits multiple times. What 'original file' is it looking for?

    Cheers
     
    Last edited by a moderator: Mar 30, 2013
  9. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    You need to have the file with the .wet extension already created in the settings/circuit directory. So launch the game and select this circuit, so rFactor2 will create the .wet file.
     
  10. PLAYLIFE

    PLAYLIFE Registered

    Joined:
    Dec 26, 2010
    Messages:
    743
    Likes Received:
    126
    Thanks Gerald will give that a shot!
     
  11. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    v1.0.2 available.

    Just adding a more explicit message when the .wet file is not found. (Linked to PLAYLIFE issue)
     
  12. hdj

    hdj Registered

    Joined:
    Feb 6, 2012
    Messages:
    50
    Likes Received:
    0
    This looks great!

    Any idea where to get historical weather data from 60's and 70's, the uk weather.com site doesn't go back that far?

    Thnx
     
  13. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    I can check on local provider instead of worldwide. Which circuit do you want in priority ?
     
  14. hdj

    hdj Registered

    Joined:
    Feb 6, 2012
    Messages:
    50
    Likes Received:
    0
  15. Woodee

    Woodee Registered

    Joined:
    Oct 4, 2010
    Messages:
    4,004
    Likes Received:
    1,058
    For circuits like Spa, is there support for it to rain on one part of the circuit and be dry on the other?
     
  16. MaD_King

    MaD_King Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,827
    Likes Received:
    611
  17. Gerald Jacobson

    Gerald Jacobson Registered

    Joined:
    Jan 26, 2013
    Messages:
    827
    Likes Received:
    18
    Hello,
    I have started with wunderground but in the majority of meteo station, the is no weather condition and/or wind. So it is not enough accurate.

    tutiempo does not seem to provide hourly historical data; and there is no information about wind direction.

    I will try to find other providers

     
  18. wollo

    wollo Registered

    Joined:
    Mar 5, 2013
    Messages:
    28
    Likes Received:
    0
    Great addition to the sim, I am looking forward to running modern circuits with the current weather. That was a feature I loved with FSX when i used that. Many thanks to the OP
     
  19. costamesa

    costamesa Registered

    Joined:
    Jan 12, 2012
    Messages:
    108
    Likes Received:
    0
    </Location>
    <Location name="Canberra400" inProfiles="1">
    <Providers>
    <Provider id="1">
    <Parameters>
    <Parameter name="Location" value="ASXX0023"/>
    </Parameters>
    </Provider>
    </Providers>
    <Directories>
    <Directory path="Canberra400"/>
    </Directories>

    When i add these lines to xml file, it just crashes. well actually it doesnt even start...
     
  20. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    @costamesa: Looks like that XML isn't valid. The </Location> tag should be at the end, not at the beginning. (Unless it's an excerpt from a bigger file of course)
     

Share This Page