w7sst / MorseRunner

Morse Runner Community Edition
Mozilla Public License 2.0
68 stars 12 forks source link

refactor - introduce Sent and Received Exchange types #94

Closed w7sst closed 2 years ago

w7sst commented 2 years ago

Summary

While working on the ARRL DX Contest, I realized (thanks to insight from Larry, F6FVY) that we need to support dynamic exchange field types. Specifically, in the ARRL DX Contest, the second exchange field can be either State/Province for US/Canada stations, and Power for non-US/Canada stations.

This issue will focus on introducing the storage mechanism and a basic protocol for supporting dynamic exchange types.

Motivation

Several contests require support for dynamic exchange fields. Some contests will change type based on the station you are working (e.g. ARRL 10m contest has five different exchange types, depending on station location).

Detail

  1. A record type, TExchTypes, will hold field types:

    // Exchange Field types
    TExchTypes = record
    Exch1: TExchange1Type;  // Exchange field 1 type
    Exch2: TExchange2Type;  // Exchange field 2 type
    
    class operator Equal(const a,b: TExchTypes) : Boolean;
    end;
  2. The sent exchange types are added as TStation.SentExchTypes. The motivation here is any station will know what type of exchange it will send. This includes both TMyStation and TDxStation.
  3. The received exchange types are added as TMainForm.RecvExchTypes. In this simulation, only the TMainForm is entering received exchange information. The received exchange types are stored on the TMainForm only.
  4. Methods are introduced to show the basic protocol. These include TContest.GetSentExchTypes() and TContest.GetRecvExchTypes().
  5. The notion of a station kind, type TStationKind, will be used to separate the kind-of-station participating in the contest (either MyStation or DxStation).
    // TStationKind  identifies whether the station is the simulated home
    // station or a remote DX station within the context of the simulation.
    TStationKind = (skMyStation, skDxStation);
  6. Details will evolve as development continues on ARRL DX and ARRL 10m contests. The first contest to use dynamic exchange types is ARRL DX Contest.

Example using ARRL 10m Contest

Below are the dynamic exchange types for stations participating in the ARRL 10m Contest. Each station will send the appropriate exchange type based on it's location relative to the contest. Location is determined using their callsign and the DXCC file.

Station location Exchange Type exchange field 2 type
W/VE stations, including Alaska and Hawaii send state or province etStateProv
District of Columbia send “DC” etDistOfCol
Mexican stations send their state or province etStateProvXE
DX stations send a serial number etSerialNum
Maritime mobile stations send ITU Region (1-3) etITURegion

As the user enters remote callsigns, MorseRunner will determine the remote station's location (based on callsign) and assign the associated exchange 2 field type. The simulation will use this type when sending the exchange and the logging section will use this type when validating the exchange after the QSO is completed.

w7sst commented 2 years ago

Hi Larry, Thanks again for the tip on exchange fields changing by callsign for various contests. This issue introduces my preliminary solution to this problem. I'm calling it dynamic exchange types. I wrote up some of the description here in this issue. I will get some preliminary code in code review for you to see within a few days. I thought I'd let you read this first and give any early feedback.

I am currently coding ARRL DX Contest #62. I have it running, and am now working on getting it checked in. However, these refactoring steps are necessary first.

73, Mike W7SST @f6fvy

w7sst commented 2 years ago

Email response from Larry, F6FVY, dated 11/8...

Hi Mike

I'm sorry, I can't really test your code right now, but I read your extended description and the various files modifications and it all seems good to me. Congrats and tnx for your work. I will approve the PR shortly.

I believe the next step would be to "cast" the Exch1 and Exch2 variables into an array so it can be extended to a variable number of exchanges, depending on the contest and the "StationKind", as we discussed earlier. I understand that modifying the UI will probably become "delicate" as for now everything relies on two exchanges (input fields and output log), but I think "the sooner the better".

For the record, I passed the information on this new version to many F contesters friends, and all of them are really enthusiastic by your work ! And I immediately got asked regarding simulations of different other contests ;-)

Thanks again and 73

Larry - F6FVY