Scientific Computing

Matlab POLYBOOL contours

Matlab polybool has external and internal contours.

External contour
the vertices describing the outer edge of a polygon–the outside of a donut, for example. These vertices must be given in CLOCKWISE order.
Internal contour
the vertices describing an area in which the convex hull is hollow (the donut hole). These vertices must be given in COUNTERclockwise order.

Switch between OpenMPI and Intel MPI

Run an MPI program like:

mpiexec -np 4 ./myprog <parameters>
-np 4
run 4 parallel processes via MPI.

Pick an -np number suitable for your system (e.g. number of CPU cores)


If you also have Intel MPI installed, you might also want to try your program on OpenMPI for validation and sharing your program with a wider set of non-Intel MPI users. Of course, you must compile your program with the appropriate MPI library.

Set up a pair of scripts:

#!/bin/sh

LD_LIBRARY_PATH= /usr/bin/mpiexec.openmpi -np 4 ./myprog_openmpi

and

#!/bin/sh

mpiexec -np 4 ./myprog_intelmpi

The “LD_LIBRARY_PATH= " (notice the blank space) wipes out the Intel MPI libraries from interfering with OpenMPI (only for this Bash script scope).

Autoscaling imagesc plot and imshow plots

Matlab / GNU Octave default axis scaling scales “x” and “y” axes proportionally to the axes values. If one axis values span a much wider range than the other axis, the smaller span axis gets very thin and almost invisible.

Fix invisible axis in plot by axis('square') after imagesc()

rdat = rand(1000,10);
imagesc(rdat)

axis('square')

Axes representing actual data size has the axes to be representative of number of data elements (skinny images appear skinny)–insert axis('equal') after imagesc().

rdat = rand(1000,10);
imagesc(rdat)

axis('equal')

In Python Matplotlib, the same issue can be overcome with aspect='auto' property of ax.imshow().

Conversely allow the “true” axes ratio driven by the actual data aspect='equal'

Set this after the plot is created in axes ax by

import numpy as np
import matplotlib.pyplot as plt

rdat = np.random.rand(1000,10)

fg = plt.figure(layout='constrained')
ax = fg.gca()
ax.imshow(rdat)

# %% pick ONE of the following

# non-shared axes
ax.set_aspect('equal','box')

# shared axes only (e.g. subplots(sharex=True))
ax.set_aspect('equal','box-forced')

plt.show()

Bloomberg LPFM coverage

In July 2017, Bloomberg Radio in Boston moved from 1200 kHz AM to 1330 kHz WRCA-AM, and simultaneously enabled FM translator W291CZ-FM on 106.1 MHz. The 255 meter elevation afforded by the 200 Clarendon building (former John Hancock building) in Back Bay gives a commanding view of the Boston area, just far enough from downtown so as not to be in the elevation null of the transmitting antenna. In-building portable radio coverage of W291CZ to the west is remarkable, working well in the high-population business offices important to Bloomberg Radio.

Bloomberg 106.1 FM coverage Boston

WCOD interferes with W291CZ to the east and south of 200 Clarendon, including at least through Dorchester, WCOD covers up Bloomberg Radio so much that it’s unlistenable. WCOD covers up Bloomberg in the vicinity of South Station, Back Bay, and so on until one block east of TD Garden, west of which the Bloomberg signal is OK.

The WRCA-AM broadcast originates 13 km from downtown Boston from the same tower complex and with similar power/antenna configuration as the former Bloomberg Radio broadcast from WXKS-AM on 1200 kHz.

FM Translator co-channel interference can be considerable vs. legacy high-power FM stations. Heading to the South Shore / Cape Code on I-93, after Exit 7 on I-93 onto MA-3, the 50 kW Cape Cod station WCOD covers up Bloomberg on 106.1 FM. FM translator permits for 106.1 FM have been issued for Fitchburg, MA and Worcester, MA further limiting DX coverage to the west and northwest.

The wide bandwidth of broadcast FM contributes to a very low capture ratio, so you’ll jump flip between music and talk radio without too much racket. WRCA / WXKS-AM share a 5-tower transmitter plant.

Considering FM Translator coverage vs. AM coverage, the notional coverage contour map of W291CZ-FM is optimistic for in-building coverage, but representative for automobile radio. The corresponding daytime coverage contour map for WRCA-AM and nighttime coverage contour map for WRCA-AM are also optimistic for in-building AM, yet show comparable coverage except for the South Shore (toward Quincy and Hingham).

FM Translators are useful to indirectly overcome AM interference. Over the past 5 years that AM radio has become increasingly unusable even in suburban settings and hotel clock-radios are increasingly FM only. Quality LED lighting interferes at least as much with AM radio as the compact fluorescent ballasts did. The only time I can make serious use of AM radio from home is during power outages!

FM translator can be used to switch AM broadcast to all-digital. Thus I welcome the 106.1 FM broadcast of Bloomberg Radio as an efficient use of spectrum. An even more efficient use of the AM spectrum would be for the FCC to expedite all digital AM-band broadcasting, as in urban areas increasingly the AM stations are just used for their 60 dBu contour within which to place FM translator coverage.

What can a harmonic radar do?

Some of the first considerations for a harmonic radar application are discussed.

Maximum harmonic radar tag range: a 917 MHz radar using uncoded or pulsed CW may get about 10-15 meters range using 10 dBi antennas on the radar and 5 dBi passive tags. Shifting up in frequency increases the gain, narrows directivity (beamwidth) of the antennas, yielding more angular selectivity for a given antenna size.

Active (powered) tags are required for extended ranges into 100+ meters standoff distance. Many years of battery life are possible for such tags, and power harvesting methods and other modern semiconductor techniques may be applied to approach batteryless or battery-assisted tags for decadal service lifetimes.

How long do tags last

Depending on the application (what you’re sensing) and the environment the tag is in, the tag could last from a month to a decade or more. Tag lifetime is very system dependent.

Distinguish tags from one another

This is a topic covered by patents and the open literature, including technology SciVision, Inc. has modeled and brought to fruition. At a high-level, this is a key design parameter of the system. Will classic angular selectivity (antenna beamwidth) be enough? The 3 dB beamwidth might be > 60 degrees, and the 20 degree beamwidth (more important for discrimination) might be well in excess of 90 degrees. Larger antennas, antenna arrays, or networks of radar antennas help increase angular/spatial target discrimination.

The classical multiplexing methods of TDMA, CDMA and FDMA may also be applied in various scenarios, particularly for active tags.

Differences between a passive tag and active tag

Active tags require a DC power source to bias the diode (or whatever semiconductor structure is chopping or otherwise frequency translating the input RF waveform). This DC bias may well come from power harvesting or trapped charge FETs or the like. Just a wee bit of bias gives a lot of signal gain (via reduced loss) thanks to the non-linear response of the diodic junction that creates the harmonics.

Passive tags inherently get their bias from the exciting RF waveform. Intrinsic power harvesting, to abuse a term (much like how everything is AI/machine learning these days).

Model performance of a harmonic radar system

To predict performance of a harmonic radar requires a bit of knack and experience at RF systems performance. You might engage with a consultant from SciVision, Inc., which has helped build valuations for several clients to impressive sums via custom model-based designs. Likewise, unfeasible projects were shot down early by modeling and early prototyping.

LTE band 26 is 800 MHz ESMR

The wavelengths in the general vicinity of LTE Band 26 & 5 (850 MHz cellular) are ideal for building penetration (phone indoors). Akin to LTE bands 12,13 and 14 in the low bands (700 MHz), LTE band 26 at 806-861 MHz gives better long range coverage. LTE carriers use carrier aggregation and at least LTE on the low-frequency (long-range) band as well as the high frequency band.

Clear WiMAX shutdown: LTE 2.5GHz Band 41 WiMAX termination drivers included 10x LTE spectral efficiency. The need to pair high-frequency LTE Band 41 good for short range, high density use with band 26 good for suburban/rural is essential to modern mobile network operations. Early WiMAX 4G adopters suffered coverage issues due to the simpler base station antennas of the time. This was not the fault of WiMAX, rather it was because of the 2.5 GHz wavelength and free space loss.

Reasons to abandon Clear’s 2.5 GHz WiMAX may have included:

  1. short wavelength no good for standalone carrier (best blended with longer wavelength bands for less dense areas)
  2. LTE is more spectrally efficient.

Vornado Flippi fan failure

The Vornado Flippi fan series gets a number of bad reviews associated with short lifetime, some claiming days or weeks, prompting a return of the fan to the retailer. This Vornado Flippi V6 fan failed because a 120 Vac wire going from the fan base to the fan blade motor failed, possibly due to fatigue due to the oscillating motion of the fan head. This blue wire luckily was the neutral wire, and was of type AWM 1430 with VW-1 rating, 22 AWG. The wire manufacturer/model is Lee Yuen. The Flippi oscillating fan had an excessive amount of grease inside–not what one would expect from Vornado.

Broken wires inside Vornado Flippi fan base.

The 120Vac wire is broken off inside the Vornado Flippi fan base.


iFixit Vornado Flippi teardown

Bluetooth speaker with FM radio

The Simpowel V8 Bluetooth stereo speaker costs less than $40, has been around for over 3 years (updated in 2016 to Bluetooth 4.0) and despite not having aptX, has adequate quality and sufficiently loud audio. Even in the stands of a baseball game, the Simpowel V8 is loud enough to hear the FM radio commentators for me and the person(s) sitting next to me, albeit set near maximum volume.

Key features of the Simpowel V8 Bluetooth speakers

  • loud audio (baseball stadium tested)
  • FM Radio
  • micro SD card
  • 3.5 mm input
  • can run without battery installed
  • battery is common and trivially replaceable
  • multi-room Bluetooth coverage
  • NFC “tap to pair” and “tap to disconnect”

Getting started with Intel Edison

Procedure based on Yocto Complete Image 3.5 with Linux laptop, using non-Arduino Intel Edison Mini Breakout board model EDI1BB.AL.K

Add your username to the appropriate groups on your laptop

adduser $(whoami) dialout
adduser $(whoami) plugdev

Logout and login on your laptop (reboot not required). On laptop:

dmesg

messages will stream to the laptop from Edison once it’s powered on.

Connect to Intel Edison via two microUSB Type B cables. Micro-USB type B are the common connectors everyone uses for phones etc.

Edison jack Purpose
J16 (OTG) Powers the Edison, mounts 805MB FAT32 partition Edison
J3 internal serial to USB converter

Assuming Edison comes up on laptop as /dev/ttyUSB0 when both J16 and J3 are connected,

screen /dev/ttyUSB0 115200

Or use PuTTY.

Press Enter for login prompt. Login as root. There’s no password unless you set one previously.

See notes at bottom of this page for connection troubleshooting.

Software Update

It’s handy to be connected with PuTTY to the Edison, to see a much more detailed progress report.

Note this procedure erases everything on the Edison including data and configuration settings

On laptop, download latest Yocto Poky Complete Image. On laptop:

apt install dfu-util

Extract the Poky Complete Image, and from the extracted directory:

./flashall.sh

If you get a message

otaupdate.scr not found

upon Edison rebooting, the update is probably not going through. The process will take about five minutes (much longer than a normal reboot).

Confirm the proper version is uploaded by typing on Edison

cat /etc/version

201606061707

and at login you’d see with Yocto 3.5:

Poky (Yocto Project Reference Distro) 1.7.3

The Edison used space upon Yocto install was 76%. 319 MB free of 1.4 GB on a 2 GB Edison.

df -h

Intel Edison Configuration on first startup

from PuTTY window connected to Edison:

configure_edison --setup

Intel Edison Wifi can connect to WPA2 Enterprise as well as typical home WPA2 access points.

Unofficial Intel Edison Repository

On the Edison, add to /etc/opkg/base-feeds.conf

src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

Update repo cache

opkg update

The core2-32 opkg directory holds programs commonly used.

Troubleshooting

Both (two) green LEDs on the breakout board must be on and steady. If they are cycling on and off every several seconds, your USB port may not be providing enough power to J16. Maybe that USB cable is bad.

  • Alternatively, the Edison eMMC flash memory could be corrupted, which requires reflashing

On laptop, unplug and plugin both USB cables, then type

dmesg

you should see

New USB device found, idVendor=8087, idProduct=0a99

FTDI USB Serial Device converter detected
Detected FT232RL
FTDI USB Serial Device converter now attached to ttyUSB0

If not, try being sure you are NOT plugged into a USB 3.0 port (has SS logo or blue colored inside). Try swapping cables at the Edison end–maybe one of them has the pins a little worn out. Poweroff and Power on your PC. Try another PC. If you don’t see these lines output by dmesg upon plugin, no other steps will work. You have to fix this first.

Type in your laptop

lsusb

you should see a line with

ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

Type in your laptop

ls /dev/ttyUSB*

you should see

/dev/ttyUSB0

Intel Edison USB voltage on breakout board

The red arrow points to the side of the “74” diode that comes right off the micro USB connector. With 5.00 volt input, downstream of the diode measured 4.72 V with the Edison idling. This voltage drop is expected due to the forward bias diode voltage drop.

Edison power measurement points

Under 100% of one core CPU load measured 4.98 V on the USB side, and 4.66 V on the Edison side of this diode while powering from the USB port on the Verbatim 97928. The minuscule apparent 20mV voltage drop on the battery/USB side of the diode is likely to come from ohmic losses in the USB connector and cable.

Intel Edison alkaline battery life estimate is based on:

  • Intel Edison measured power consumption
  • assuming 2000 mAh for an AA battery

We estimate 10-12 hours of battery life on four AA alkaline batteries assuming continuous 100% CPU of one of the two CPU cores (other core idle). Normally the Edison will be mostly resting, drawing perhaps 100 mW.

Thus with mixed use, I might expect up to 4-5 days of continuous mixed use operation on 4xAA batteries for the Intel Edison.