Elecraft P3 1 Side of Pile Up

Elecraft P3 - Commands for 1 side of pileup view

I have recently taken delivery of an Elecraft P3-Panadapter - sort of a Wideband view of the band.

It is very nice - but for breaking pile-ups - or handling one, I need it to do something slighly different.

By default the P3 display +/- n Khz from you VFO-A frequency.

Pileup Problems

P5/7Oxxxx is active (Yemeni in North Korea !! You have more chance than finding droppings from a Rocking-Horse) ... the DX Cluster says "On 14.025 - up 2"

So you swing the VFO-A to 14.025 - push the function button on the Pan adapter to a 2 Khz Resolution - and guess what !!! You see P5/T0xxx in the middle of the P3 Display - and you see no obvious signs of the thousands of calls being made.

Why ??

  • the P3 was set to a narrow 2Khz Span
  • The P3 however centers on the VFO-A
    • Thats 14.025 +/- 1 Khz
    • 14.024 to 14.026
    • the DX is listening around 14.027 (+2 remember)
  • The Split it 2 Khz ... you see nothing

Increase Split Size

That will work - but you are now trying to see the lucky caller in this pile-up with a larger SCAN size in only half of the available display.... This is not optimal.

Solution

Using some nifty Macro's move the DX to the Left hand side of the P3 - whilst giving the P3 only the Positive Offset from the carrier frequency (i.e. only show 14.025 - 14.027)

Now before I show you this script - some thanks....

  • Dave - NK7Z he pointed out a certain path for development.

Dave: NK7Z has lots of interesting stuff on his web page - which is well worth a look - it is found at http://nk7z.net.

Alas this will not work as a single keypress (yet)

But it will work if you have 2 devices that are capable of communicating with the K3/P3

from serial import Serial
import time

#Note the Mac has 2 devices
#tty.* and a cu.*.
#So, what's the difference?
#Well, TTY devices are for calling into UNIX systems,
#whereas CU (Call-Up) devices are for calling out from them (eg, modems).
#We want to call-out from our Mac, so /dev/cu.* is the correct device to use.
#Note my Logger is using the TTY Interface


p3_plus_mode = [('#FXT0;#FXA0;','P3 reset Tracking Mode'),
                ('#SPN000022;', 'P3 2.2Khz mode'),
                ('UP4;', 'K3 VFO-A DOWN 1 Khz'),
                ('#FXT1;#FXA3;', 'P3 into sticky mode'),
                ('DN4;', 'K3 VFO-A UP 1 Khz')]

sp = Serial('/dev/cu.usbserial-A7004VW8', 38400, timeout=1)
for a in p3_plus_mode:
    cmd = a[0]
    what = a[1]
    print(str.format("Command {:30} ", what), end='')
    rv = sp.write(bytes(cmd, 'utf-8'))
    if int(rv) == len(cmd):
        print("\t\t\tOK")
    else:
        print("\t\t\tProblem")
    time.sleep(1)

Elecraft P3 Function keys

ELECRAFT P3 - Function Buttons

I just took delivery of an Elecraft P3 panadapter. For the past 2 hours I have been playing with it - trying to get used to the facilities it has to offer.

Being naturally curious - I want to try and get as much automation working in the device as possible - so I was looking at programming the function Keys....

And looking... and looking...

After a little while I finally figured it out

Assign FN1 to Scope Width +/-10 Khz

Lets have a fairly wide view of the band...

Assumptions

  • k3 / rig powered on
  • p3 powered on
  • recent firmware installed

Adjust out Scope Span to +/-10 Khz

Press the following keystrokes

  • SPAN (tap)
  • Turn the SELECT knob so you see the +10.0 in the top right hand side of the screen (-10.0 will also be in the top left hand side)
  • SPAN (tap)

At this point we have set the Scope width to the level we want.

Set this setting to FN1

Press the following keystrokes

  • MENU (tap)
  • Turn the SELECT knob so you see "Span Set" in the middle line.
  • FN1 (tap)
  • MENU (tap)

My Settings

Key Setting
FN1 Scope Width +/- 3.5 Khz
FN2 Scope Width +/- 10 Khz
FN3 Scope Width +/- 20 Khz
FN4 Scope Width +/- 25.5 Khz
FN5 Knob Tap (QSY)
FN6 Fixed Mode
FN7 Waterfall Size
FN8 Unused !!
------------------------ ---------

I hope that helps.....

Elecraft Macros

Elecraft Macros and Memories

I am starting to get to grips with some of the slightly less than obvious

Before I try and explain my Macros - which I should admit I have modified for my purposes from information on the Net - You should be aware of the K3-Utility software program. This is how you can keep your K3 up-to-date with the latest firmware as well as programming Macro's.

I have no clue if XXX Logging product does this. I prefer to use the Manufacture's utilities when messing around with some internal commands.

Assuming now that you have the K3 Utility software - you can test these commands out using the command/tester macros tab of the software.

  • Note I am using the phrase K3 to refer to KS, K3-S and KX-3

Useful Macros

Code Means
SWT-11 Switch VFO-A to B (Or Visce-Versa)

MACRO TO WORK A DX STATION WHO IS CALLING

You hear P5/Y5abc - he is saying "Up" - so lets get a split setup quickly.

The Macro command I currently use is

SWT13;SWT13;LK1;FT1;UPB4;RT0;XT0;SWT11;BW0045;SWT11;

Which means

Code Means
SWT13 Switch-Tap 1 Freq VFO-a to VFO-b
SWT13 Switch-Tap 2 Settings VFO-a to VFO-b
LK1 LOCK VFO-A
FT1 Split Mode
UPB4 Mode VFO-B up 1 Khz
RT0 Disable RIT
XT0 Disable XIT
SWT11 MOVE FROM VFO-A TO VFO-B
BW0045 Set Bandwidth 450 hz
SWT11 MOVE FROM VFO-A TO VFO-B

Now lets be clear what this does

  • Sets up a Split
  • Puts Offset of 1Khz between Tx and Rx
  • Locks Your RX Frequency to the DX station
  • Allows you using VFO-B to vary TRANSMIT

You are the DX Station

In a contest are operating as P5/???? you become DX... and you decide that a simple split is the solution.

SWT13;SWT13;LK1;FT1;UPB4;RT0;XT0;SWT11;BW0045;

Yikes what does this mean ?

Code Means
SWT13 Switch-Tap 1 Freq VFO-a to VFO-b
SWT13 Switch-Tap 2 Settings VFO-a to VFO-b
LK1 LOCK VFO-A
FT1 Split Mode
UPB4 Mode VFO-B up 1 Khz
RT0 Disable RIT
XT0 Disable XIT
SWT11 MOVE FROM VFO-A TO VFO-B
BW0045 Set Bandwidth 450 hz

Now lets be clear what this does

  • Sets up a Split
  • Puts Offset of 1Khz between Tx and Rx
  • Locks Your TX Frequency
  • Allows you using VFO-A to vary RECEIVE frequency

Implementing Macro's on the K3

I believe this will work for the K3 (I have not yet tried on my KX3 - but I will)...

Steps

  • Develop a Macro in the K3-Utility program
  • Test the Macro
  • Save the Macro
    • To your Configuration on the PC
    • Write to the K3 (Edit Macro -> Send Macro to K3)

Ok so if you have done that you are probably now wondering what now ?

We need to modify the settings on the K3...

##Implementing Macros

On the K3

  • Config Menu
    • Find the Function sub-menu
    • Press Keypad 1
    • Press and HOLD RIT (sub option PF1)
      • You Should see PF1 Set

What did you just do....

  • The Macro you created Numbered Macro-1
  • Was assigned with the Name you gave it in the K3-Utility software to key-press PF1 (which is HOLD RIT)

To add a different Macro say Macro-5 (this is your number from the K3-Utility list) to key M1

  • Config Menu
    • Find the Function sub-menu
    • Press Keypad 5
    • Press and HOLD M1

Whats next ?

Time to marvel and the joy of a super well designed Rig... and get on the Air ASAP !!

RedRock Nevada

Despite the blue skies and sun - there was a cold wind - but it did not dampen our spirits at all.

Wonderful Scenary

alt textalt textalt text

As someone where I grew up would say "Real John Wayne Country"

alt text

Burros (Donkeys !!)

Just as in Oman - here in Nevada the humble Donkey used to be a valued method of transport. Times however have changed - but despite roads and the 21st Century the Donkeys are still surviving.

alt textalt textalt textalt textalt textalt textalt textalt textalt text

Juliet Parents

Despite the cold Juliets parents - seemed to be having a good time.

alt textalt textalt textalt text

Some very clean Bikes

alt textalt text

Missing his tractora ?

alt text

Gallery

A full gallery is available at Gallery

Freemont Street

Lets go to a new place

After some suggestions from my friends Mike and Amanda - I had decided that today would be a good day to go to a new place - Freemont Street.

What a fun place - great suggestion guys.

Freemont Street

A pedestrian only street - which was the "old strip". It was certainly busy when we arrived - although the taxi driver did indicate it was early and a quiet day of the week.

alt textalt text

Neon everywhere

It has been many years since I was in New York at Times Square, but this place feels like it has more light bulbs than any place I have ever been too.

alt textalt text

Snack Time

As we had not been to a Diner on the trip so far - the Denny's seemed a good bet - and indeed it was.

alt text

Beef Beer Broards

Mike and Amanda did mention an hotel with an interesting list of attractions - I did not go and check it out.

alt text

Awesome Roof

Some Short videos of the atmosphere in Freemont Street

Hourly Screen show - Amazing

Rock Bands

Gallery

A full gallery is available at Gallery

Las Vegas 2

After quite a long day at the conference (Mandalay Bay) - I ventured out again with my camera - it had been raining a little at 5pm - so I was hoping to find some wet pavements - and to get some reflections of the lights on the pavement also. Alas - there was not enough rain - or Las Vegas has somehow magically cleaned up the pavements.

Not too many pics - as I went to the same area as the day before.

Aria Hotel

Just next to where I am staying

alt textalt text

Inside a Casino

One of the rather annoying things here in Vegas is the routing of you via Casino's all the time. It is simply not possible to walk from A to B (in the strip area) without being channeled through a Casino.

Initially this is quite exciting - however it soon becomes just a navigation exercise.

alt text

Some more of the French attractions are also here :)

alt textalt text

Emergency Services

The local ambulance service was fund raising outside Hard Rock Cafe - nothing untoward had happened.

alt text

Gallery

A full gallery is available at Gallery

Las Vegas 2015

Welcome to Vegas

Well after many tries - my company finally got me to go to Las Vegas - for an IBM conference, sorry I should really say '''the IBM''' conference.

Well after several years of trying my company finally managed to get me on the place to Las Vegas, to attend an IBM conference - I should probably write the IBM conference; I suppose it rather depends if Big Data and Analytics are your thing.

Anyway this post is not about that - it is more about what the lights of Vegas are like.

Please find some quick photos - that I literally snapped last night using my Nikon D600 - no Tripod. Lense is the 15-36MM F4 - all images were shot handheld - using image stabalisation.

There has been no photoshop.

Aria Hotel

Just next to where I am staying

alt text

alt text

The Strip

Most Harley owners should try riding through a brick wall - alas here it is a Cafe.

alt textalt text

Moon Time

Away from the strip things get very quiet, very quickly.

alt text

Gallery

A full gallery is available at Gallery

Eid 2015

Eid 2015

With the purchase of a nice shiny new four-wheel-drive a few weeks ago, it was decided that the time to scratch it and to dent it had finally come (1,400 kms on the clock) - Alas such as the fate of four-wheel-drive vehicles.

Eid holiday this year did not seem as generous as they have been in the past, when holidays of up to 10 days were not that uncommon. However a four day break which was not going to cost me any leave is always very welcome.

Not having gone camping for several years I have to say we were a little bit rusty in our preparation and packing-but the vehicle was quickly loaded and we set off with goodtime.

Secret campsite

I'm sure most people who go camping have a "special" site - for me this is ....... , actually I can't tell you because it is my secret campsite, but let's say it is several hours south of Muscat. I have been using this campsite for the last 7 years, it is wonderfully secluded, has great views and most importantly nobody else goes there.

After a few hours on the blacktop (tarmac) we then had a gentle 25 km off-road to the campsite, however the time was now about 30 minutes before sunset-it is a difficult time to drive normally, more so however off-road.

The last three years have not been kind to the roads in this area, and we soon started having to skirt washed out access roads. At times some of the locals had made a small path is around them; when we could see none I just created our own.

All was going well until we got within 1 km of the final campsite, then at least 40 m of the road was missing, with a significant drop Down into a very rough wadi bed.

Campsite near Secret campsite

With failing light and the desire not to pull one of the wheels off the car, I sensibly turned around and found an alternative place to camp. It was not as grand, Secret, well known or as secure - but it was the best we could do at the time.

We quickly unpacked and assembled our tent and I'm now spitting out sand. The slightly unorthodox use of two surfboards cut down the amount of swirling sand to manageable levels. After suitable food and refreshments we sat back to listen to the sound of the desert - absolute silence.

alt text

Day 2

A rather last-minute purchase in the form of a new camping mat had transformed what can be uncomfortable night, into a pleasant relaxed nights sleep. I promised Juliet I would buy her one next time (joking she already has one); but a rising sun will always awaken the camper, and at 0600 we were treated to a sunrise through cloud and some local mist.

alt text

In order to get going quickly we packed up and returned to a Pakistani truck restaurant close to the main road we had spotted the night before. The dahl and omelette were both excellent and the price of three dollars fitted our budget also.

Southern Oman

Our normal camping area in the Mahout region has become rather less unique over the years, due to better roads and more development closer to Muscat. So today we were going to try and find another new camping area.

About an hour later we were parked on top of what will be possibly the best site for house we have ever seen. Perched about 100 m above the sea with at least 180° views this will make a spectacular property.

alt text

Rather thrilled with our initial discovery, we pressed on to try and find a new secluded beach.

Beaches Galore

We did not just find one beach we found about 15 km of secluded beach, however of course there was a slight catch.

The beaches here are extremely soft when it comes to driving on-And being on our own I cannot take the risk of getting stuck. I was however able to find some hard sand and make our way to another set of beaches. By using some hard sand and some careful driving we were able to find campsite less than 7 m from the waters-edge.

There was a significant surf pounding in out to sea-but rather ominously there seem to be a large number of rocks.

Rocky Coast

As the high tide fell the number of rocks multiplied, Leaving a small lagoon which seem to be continually occupied by wading birds and several small turtles.

We did manage to get into the sea and to find some sandbanks from which we played in the waves - the refreshing chill of the sea was very pleasant after the heat of the land.

Gallery

A full gallery is available at Gallery

Mysql Speed and Performance

MySQL

I need to investigate speeding up a Mysql Database for the office. So this is how will setup and test.

  • Install and Test Mysql
  • Create Tables
  • Create Data sets to load
  • Develop similar load
  • Record the timings

Next

Try and Improve things using

  • Indexes
  • Transactions
  • Something else ????....

Sounds like a plan .... Let's go

Install

As I am doing this on Ubuntu 14

So

    apt-get install mysqld

Then put my Db commands into 1_Create.sql

drop database pt;

Create database pt;
use pt;

create table customers ( ID INT, NAME varchar(20), Address Varchar(80), Phone Va
rchar(30), Custtype int );

create table customers_update ( ID INT, NAME varchar(20), Address Varchar(80), P
hone Varchar(30), Custtype int );

create unique index customers_U_id on customers (ID);
create index customers_name  on customers (NAME);
create index customers_custtype on customers (Custtype);

Now create the Db - like this

mysql <1_Create_db.sql

As I am on private machine I am not using username and password !!! Do not do this on an internet connected machine

Db Created.

Load Table

I am lazy - so as I need several 000's of records - I am going to write a small data generator.

#!/bin/python
#ID,NAME,Address,Phone,Custtype


import sys
items=int(sys.argv[1])
for n in range (1,items):
   print ("%d,NAME%d,Adress Street %d,44123%d,%d"%(n,n,n,n,n%4))

Test it like this

python Gen_Data.py 5

And I see

1,NAME1,Adress Street 1,441231,1
2,NAME2,Adress Street 2,441232,2
3,NAME3,Adress Street 3,441233,3
4,NAME4,Adress Street 4,441234,0

Which is what I want - to put it in a file just do

python Gen_Data.py 5 > customers.csv

Note the file name is important

Load the Customers Table

Using mysqlimport

mysqlimport pt customers.csv -L --fields-terminated-by=','

A quick select * from customers; gives

+------+-------+-----------------+--------+----------+
| ID   | NAME  | Address         | Phone  | Custtype |
+------+-------+-----------------+--------+----------+
|    1 | NAME1 | Adress Street 1 | 441231 |        1 |
|    2 | NAME2 | Adress Street 2 | 441232 |        2 |
|    3 | NAME3 | Adress Street 3 | 441233 |        3 |
|    4 | NAME4 | Adress Street 4 | 441234 |        0 |
+------+-------+-----------------+--------+----------+

To Load data into customers_update

cp customers.csv customers_update.csv
mysqlimport pt customers_update.csv -L --fields-terminated-by=','

Update

I am going to use a Transaction to do the update.

I have placed these commands in a .sql file called 2_update.sql

And I will run it using

mysql pt < 2_update.sql
start transaction;
select now(),'delete starting' from dual;
delete from customers where custtype=2;
select now(),'Insert Starting ' from dual;
insert into customers (select * from customers_update where custtype =2);
select now(),'Commit Starting ' from dual;
commit;
select now(),'Commit Done' from dual;

When I run this I get

now()   delete starting
2015-06-15 11:24:19 delete starting
now()   Insert Starting 
2015-06-15 11:24:49 Insert Starting 
now()   Commit Starting 
2015-06-15 11:25:41 Commit Starting 
now()   Commit Done
2015-06-15 11:25:41 Commit Done
operation time
Delete 30s
Insert 52s
Commit 0s

As the data should be evenly split - this is 250,000 records. Which I think is quite acceptable.

What happens to the user query time when this is happening ?

I will not create a random Query (to stope the Db Caching) - and run this as the previous update is running.

First the query code....

import mysql.connector
import random
import sys
from timeit import Timer
import datetime

#
#Query use a Primary Key
#
def Query(num):
    global cnx
    cursor = cnx.cursor()
    query = "SELECT ID,NAME,Custtype from customers WHERE ID = {0}"
    cursor.execute(query.format(num))
    for (cid, name, ctype ) in cursor:
        print("{}, {} {} ".format(
            cid, name, ctype ))
    cursor.close()

#
# Main Loop
#

loop=1+int(sys.argv[1])
#
#mysql Connect 1 time only
#
start=datetime.datetime.now()
cnx = mysql.connector.connect(user='root',database='pt')

for q in range(1,loop):
    num=random.randrange(1,1000000)
    Query(num)
    #
    #Timeit using lambda 
    #
    #t = Timer(lambda: Query(num))
    #print ("\t\t\t\t{0}".format(t.timeit(number=1)))
cnx.close()
end=datetime.datetime.now()
print("Query for %d took %d seconds"%(loop,(end-start).seconds))

You run this like....

time python Query.py 5000

You will see ....

469518, NAME469518 2 
975783, NAME975783 3 
Query for 5001 took 2 seconds

On my hardware/setup the average time for 5000 queries is 2 seconds.

Query for 5001 took 2.883825 seconds
Query for 5001 took 2.870572 seconds
Query for 5001 took 2.958822 seconds
Query for 5001 took 2.929722 seconds
Query for 5001 took 2.755262 seconds
Query for 5001 took 2.822934 seconds
Query for 5001 took 2.905826 seconds
Query for 5001 took 2.895257 seconds
Query for 5001 took 2.846605 seconds
Query for 5001 took 2.894246 seconds

Time with Update running

We need t execute two tasks at the same time - so we will use some Linux command line foo

    rm *.log
    nohup mysql pt < 2_update.sql 2>1 >> update.log&
    sleep 4s
    for a in $(seq 10);do python Query.py 5000 | grep Query; done

I placing the sleep - to make sure that the Transaction is in place.

The worst sample I found was

Query for 5001 took 2.435922 seconds
Query for 5001 took 4.502661 seconds
Query for 5001 took 3.130135 seconds
Query for 5001 took 3.333874 seconds
Query for 5001 took 2.069113 seconds
Query for 5001 took 2.094691 seconds
Query for 5001 took 2.140467 seconds
Query for 5001 took 2.011877 seconds
Query for 5001 took 2.145676 seconds
Query for 5001 took 2.175512 seconds

Which shows a slight jitter from 2.4-4.5 seconds - but is still reasonable.

Which I found surprising....

I will increase the datasize to 10M records and try and break it again.

10 Million Records

Update No Query RUnning

command time Increase
Delete 900s 30 times
Insert 430s 8 times
Commit 0 0 times

10M Instead of 1M - so you would expect 10-15 times slower. Delete seems Slow - but Insert seems in line.

Partition

After some digging around in the system and some reading - I wondered if the solution we would use with an Oracle Db would also work - partition the table.

With a loaded Table I did the following sql command.

ALTER TABLE customers 
PARTITION BY HASH(ID)
PARTITIONS 4;

I then ran the update script again. These were the figures I got.

command time Increase
Delete 360s 11 times
Insert 270s 5 times
Commit 0 0 times