From: ian Date: Sun, 10 Feb 2008 18:03:17 +0000 (+0000) Subject: details of shinkansen and santafe X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=3bf1983c58e767a88f9fa9449de957d444556f37;p=trains.git details of shinkansen and santafe --- diff --git a/hostside/analyse-speeds b/hostside/analyse-speeds index 541ce44..22694db 100755 --- a/hostside/analyse-speeds +++ b/hostside/analyse-speeds @@ -19,6 +19,16 @@ o=$train.speeds >$o.all.tmp +acceltime=100000 +deceltime=30000 + +. $train.manual +for f in address length nondetfore nondetrear acceltime deceltime; do +# [mm] [mm] [mm] [ms] [ms] + eval "v=\$$f" + if [ "x$v" = x ]; then echo >&2 "missing $train $f"; exit 1; fi +done + for f in $train-*.speeds; do this="'$f'" if head -1 $f | grep '^[A-Za-z]' >/dev/null; then @@ -34,8 +44,8 @@ set terminal postscript set key top left set xrange [0:127] set output '$o.ps.tmp' -#set ylabel "speed [m/s]" -#set xlabel "nmra speed step 1..126" +set ylabel "speed [m/s]" +set xlabel "nmra speed step 1..126" plot '$o.all.tmp' smooth sbezier notitle $each END @@ -61,17 +71,42 @@ plot '$o.all.tmp' smooth sbezier END perl <$o.table.tmp >$o.record.tmp -ne ' - BEGIN { $nxt= 1; } + BEGIN { + $nxt= 1; + $max= 0; + $speed[0]= 0; + } next if m/^\#/; next unless m/\S/; die unless m/^\s*(\d+)\s+([0-9.]+)\s/; - $step= $1; - $speed= int($2*1e6+0.5); + ($step,$speed) = ($1,$2); die "$step $nxt" unless $step==$nxt; - print "train '$train' step $step=$speed ?/?\n" or die $!; + $speed[$step]= $speed; + die "decrease $step $nxt $max" if $speed < $max; + $max= $speed; $nxt++; - END { warn "warning: '$train': expected 126 steps, found ". - ($nxt-1)."\n" - unless $nxt==127; } + END { + $steps= $nxt-1; + warn "warning: '$train': expected 126 steps, found $steps\n" + unless $steps==126; + print "train '$train' is '$address'". + " '$nondetfore'". + "+'$(( $length - $nondetfore - $nondetrear ))'". + "+'$nondetrear'\n" + or die $!; + sub calcwait ($$) { + my ($step,$wholetime) = @_; + return 0 if $step<0 || $step>=$steps; + return $wholetime * 1000.0 * + ($speed[$step+1] - $speed[$step]) / $max; + } + for ($step=0; $step<$nxt; $step++) { + printf "train %s step %d=%d %d/%d\n", + "'$train'", $step, $speed[$step]*1e6, + calcwait($step-1,'$acceltime'), + calcwait($step,'$deceltime') + or die $!; + } + } ' rm $o.all.tmp diff --git a/hostside/santafe.manual b/hostside/santafe.manual new file mode 100644 index 0000000..165606b --- /dev/null +++ b/hostside/santafe.manual @@ -0,0 +1,4 @@ +address=2 +length=116 +nondetfore=20 +nondetrear=20 diff --git a/hostside/shinkansen.manual b/hostside/shinkansen.manual new file mode 100644 index 0000000..4b30866 --- /dev/null +++ b/hostside/shinkansen.manual @@ -0,0 +1,4 @@ +address=1 +length=1119 +nondetfore=29 +nondetrear=29