Home‎ > ‎

Misc - other

LED lamp stand (using PVC pipe)

10 watt LED lamp (right) is mounted in a Cantex 4" x 4" x 4" electrical junction box (left):

Lamp stand pointing upwards.

Anderson power poles for 12VDC power:

Lamp pointing horizontally.

Lamp stand with PVC pipe fitted (without glue):

A photographic studio white umbrella (not shown) can be put on top of the fitted pipe extension for emergency area lighting.



Mounting a GPS unit on bicycle handlebar

Cable ties secure a Pelican 1010 case (with a Garmin Nuvi 260 receiver inside) to the bicycle handlebar. Holes are drilled in the case where the cable ties feed through. Some portion of the rubber liner insert was removed to make the GPS unit fit inside when the cover is closed.



Telephone LED ringer

Circuit Diagram

Telephone ring LED circuit:     P. Chow   Oct. 24, 2008


           ||

    O------||-----------------+-----+

           ||                 |    _|_

 90 VAC   ~1uf       1N4003  ---   \ / ~ ~ ~ ~

 20 HZ    250V     200V PIV  /_\   ---  LED

                              |     |   ~10-15mA

    O--------------/\/\/------+-----+

                   8K 2W


   The 1N4003 diode is to prevent the 90V ringing voltage from damaging the LED, otherwise the LED's PIV (peak inverse voltage) would be exceeded during AC ringing.


   The diode and capacitor should be rated at least 200V, preferably 300 or 400 volts.  e.g. an 1N4004 with PIV of 400V can be used instead.





LED ringer board:



Universal Scalability Law (Gunther) analysis with R

R script to determine USL coefficients, sample R plot below using examples in sections 5.7.2 & 5.7.3 of Guerrilla Capacity Planning, (Google Books preview), Neil J. Gunther, 2007. Springer. Note: Deviation solve seems to be more accurate than USL solve.  OpenOffice spreadsheet for USL analysis of measured data.


R script to determine USL coefficients

# Universal Scalability Law (USL) analysis using R

# Peter Chow    Nov. 9, 2010

# Ref: Guerrilla Capacity Planning, Neil J. Gunther 2007

# http://www.springer.com/computer/communication+networks/book/978-3-540-26138-4

# http://books.google.com/books?id=RDLY5uUC3gYC&printsec=frontcover&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false

#

# R usage:  filenm <- "(2-column_data_file)"

#           source("usl.r")


graphics.off()                        # close any open graphics windows

data <- read.table(filenm,header=F)[c(1,2)]  # read first 2 columns of data file, w/o headers

if (data[1,1] > 1) data <- rbind(c(1,data[1,2]/data[1,1]), data)  # estimate X(1) if missing

p <- data[,1]                         # x-axis: physical processors, or parallel substasks

if (length(p) < 4) stop("--> need more than 3 data points for analysis!")

x11(width=9, height=6, pointsize=12)  # make a larger (X11) plot window

### par(mfrow=c(2,1))                     # make room for multiple plots

### par(mar=c(4.5, 4.5, 1, 1))            # adjust margin around the plots


# 1st plot - measurement data, and calculated throughput derived from USL

plot(data,type="o",axes="T",xlab="p  [CPUs, cards, etc.]",

  ylab="X(p) = C(p) * X(1)  [Throughput]",

  xlim=c(0,max(data[,1])),ylim=c(0,max(data[,2] * 1.2)))

title("Universal Scalability Law [Gunther]",filenm)

text(0,0,paste(date()),adj=0)

### plot: log="x"                         # set logorithmic plot for x-axis

### axis(1,at=2^(0:16))                   # label x-axis with power of 2

### box()                                 # draw axis lines


# assumes 1st entry in data file is 'p' unit measure of 1:

relcap <- data[,2] / data[1,2]        # relative capacity (normalized throughput) C=X(p)/X(1), eq. 4.20

### eff <- relcap / data[,1]              # efficiency C/p, eq. 5.5

### inveff <- 1 / eff                     # inverse efficiency p/C, eq. 5.6

### dv8 <- inveff - 1                     # deviation (p/C)-1, eq. 5.8

dv8 <- (p / relcap) - 1               # deviation (p/C)-1, eq. 5.8

x <- p - 1                            # linearity p-1, quadratic x term, eq. 5.9

x2 <- x^2                             # quadratic x^2 term, eq. 5.10


# deviation solve, using nls()

nlsfit <- nls(dv8 ~ (kpa * x2) + ((sig + kpa) * x), start = list(kpa = 0.0, sig = 0.0),

  alg = "port", lower = list(kpa = 0.0, sig = 0.0), trace = F)  # eq. 5.10

kpa <- coef(nlsfit)[1]                # USL kappa coefficient

sig <- coef(nlsfit)[2]                # USL sigma coefficient

ser <- sig * 100                      # serialization percentage

coh <- kpa * 100                      # coherency percentage

cap <- p / (1 + (sig * x) + (kpa * p * x))  # USL, eq. 4.31

tput <- cap * data[1,2]               # throughput = C(p) * X(1)

pmax <- floor(sqrt((1 - sig) / kpa))  # eq. 4.33 & 5.15

xmax <- (pmax / (1 + (sig * (pmax - 1)) + (kpa * pmax * (pmax - 1)))) * data[1,2]

lines(p,tput,lty=3)                   # plot derived throughput (from capacity)

abline(v=pmax,lty=3)                  # draw vertical line at calculated p*

legend("bottomright", legend=c(eval(parse(text=sprintf(

   "expression(sigma == %.7f, kappa == %.4e, 'p*' == %.0f, '%% serialization' == %.1f,

   '%% coherency' == %.1f, 'X*' == %.0f)",

   sig, kpa, pmax, ser, coh, xmax)))), ncol=2, title = "USL linear deviation solve:")


savePlot(filename=paste(c(filenm,"-usl.jpg"),collapse=""), type="jpeg")


stop("... ignore this error message ...")  # an ugly way to quit the R script here


# USL solve, using nls() - inaccurate?

nlsfit <- nls(relcap ~ p/(1 + (sig * x) + (kpa * p * x)), start = list(kpa = 0.0, sig = 0.0),

  alg = "port", lower = list(kpa = 0.0, sig = 0.0), trace = F)  # eq. 4.31

kpa <- coef(nlsfit)[1]                # USL kappa coefficient

sig <- coef(nlsfit)[2]                # USL sigma coefficient

cap <- p / (1 + (sig * x) + (kpa * p * x))  # USL, eq. 4.31

tput <- cap * data[1,2]               # throughput = C(p) * X(1)

pmax <- floor(sqrt((1 - sig) / kpa))  # eq. 4.33 & 5.15

lines(p,tput,lty=2)                   # plot derived throughput (from capacity)

abline(v=pmax,lty=2)                  # draw vertical line at calculated p*

legend("bottomright", legend=c(eval(parse(text=sprintf(

   "expression(sigma == %.7f, kappa == %.4e, 'p*' == %.2f)",

   sig, kpa, pmax)))), ncol=2, title = "direct USL solve:")


# 2nd plot - Deviation from Linearity

plot(x,dv8,type="o")                  # plot deviation

abline(nlsfit)                        # show linear line through data

text(0,max(dv8)*2/3,paste(c("C(p): sigma | alpha=",signif(sig,5),", kappa | beta=",signif(kpa,5)),collapse=" "),adj=0)

title("Deviation from Linearity")


# use the lm() method - linear regression on Deviation from Linearity

lmfit <- lm(dv8 ~ x + x2)             # derive quadratic coefficients, eq. 5.10

sigkpa <- coef(lmfit)[2]              # sigma + kappa coefficient (x term in eq. 5.10)

kpa <- coef(lmfit)[3]                 # USL kappa coefficient (x^2 term in eq. 5.10)

sig <- sigkpa - kpa                   # USL sigma coefficient, eq. 5.12

cap <- p / (1 + (sig * x) + (kpa * p * x))  # USL, eq. 4.31

tput <- cap * data[1,2]               # throughput = C(p) * X(1)

pmax <- floor(sqrt((1 - sig) / kpa))  # eq. 4.33 & 5.15

lines(p,tput,lty=2)                   # plot throughput derived from coefficients (capacity)

abline(v=pmax,lty=3)                  # draw vertical line at calculated p*

text(0,max(tput)/2,paste(c("R-Squared= ",signif(summary(lmfit)$r.squared,5)),collapse=" "),adj=1)


#### end ####