Archive for April, 2020

COVID, government response to economic situation, etc

Monday, April 20th, 2020

So, I notice the government is still thinking of economic stimulus in terms of let’s keep those dollars circulating. This makes sense because if all the dollars end up in the hands of the billionares, the dollars are suddenly worth nothing at all and the rest of us will create a new currency. However, in terms of keeping us all alive and healthy during this pandemic, passing out money is not the right thing to do.

We have no idea if the USD is even going to be worth the paper it is printed on when this oil war is over, and certainly if the government keeps printing money idiot economists are going to tell us it should be worthless. (There is some level at which this is true, but we’re obviously nowhere near that level if we’re having to loan money into existence)

Anyway, the right solution is to hand out ration booklets, a la WWII. Except, no money changes hands. You’ve got coupons for N calories of food – you can choose whatever food you want, we probably would exclude luxuries like lobster which would still be paid for in USD, but for the most part anything we can cheaply and easily mass produce goes on the list of things you can buy with your coupons. You’ve got coupons for N kwh of electricity, N cubic feet of water, N gallons of gasoline. We have some sort of arrangement via which you can barter the ones you don’t need for the ones you do, and we also give out more resources to the essential workers than to the folks just staying home.

We combine this with rent and mortgage forgiveness for your primary residence, and 0% interest on all outstanding secured debt until the emergency is over.

You see what I’m doing? I’m putting us on the bucketed currency system. *This will work* much in the way that printing checks for $2000 a person per month will simply result in the price of rent becoming $2001 for each person. Essentially this recognizes that capitalism is flawed, and very poorly suited to deal with this type of situation, but we shouldn’t starve to death in the midst of plenty, so let’s temporarily use production for use instead.

Of course, the powers that be won’t do this. They’re not smart enough, or they wouldn’t want to be in charge of things. They also lack mental agility, and even if they didn’t most of our citizens lack the mental agility to consider this situation a war, and know that we need to use different approaches during wartime than we do during peacetime.

Perl module for decoding tekpower TP4000ZC

Tuesday, April 7th, 2020

I didn’t see one of these lying around so I banged this together in a few minutes to be able to use the TP4000ZC with a raspberry pi.. the intention is to use this to monitor the main bus voltage of my solar array.

This is provided, obviously, with no warranty, and is based on information found at tek’s web site. It seems to match the display.


package tekpower;

use Device::SerialPort;
use Data::Dumper;
use strict;

sub new {
my $self = {};
my $type = shift;
my $port = shift;

$self->{'debug'} = 0;
$self->{'port'} = $port;
$self->{'dev'} = Device::SerialPort->new($port, 1) || die "Failed to open $port";
$self->{'dev'}->baudrate(2400);
$self->{'dev'}->parity('none');
$self->{'dev'}->databits(8);
$self->{'dev'}->stopbits(1);
$self->{'dev'}->dtr_active(1);

$self->{'dev'}->debug($self->{'debug'}) if($self->{'debug'});
$self->{'dev'}->write_settings;
$self->{'dev'}->read_const_time(3000);
my $r = bless($self, $type);

return $r;
}

sub read {
my $self = shift;
$self->{'dev'}->reset_error;
my ($count,$buf) = $self->{'dev'}->read(64);
print "count: $count\n" if($self->{'debug'});
my @array = split(//,$buf);
my $notOk = 1;
while($notOk && @array) {
my $z = shift(@array);

print "z: " . ord($z) if($self->{'debug'});

my $checksum = (ord($z) & 0xF0) >> 4;
print "checksum: $checksum\n" if($self->{'debug'});
if($checksum == 1) {
unshift(@array,$z);
$notOk = 0;
}
}
my @v_array;
# first check high order bits
my ($i, $checksum);
for($i=0;$i<14;$i++) { $checksum = ord($array[$i]) & 0xF0; $v_array[$i] = ord($array[$i]) & 0x0F; $checksum = $checksum >> 4;
if($checksum != ($i+1)) {
print "Checksum mismatch at $i ($checksum)\n" if($self->{'debug'});
return undef;
}

}

# second decode reading;
my $mode;

$self->{'smode'} = "AC" if($v_array[0] & 8);
$self->{'smode'} = "DC" if($v_array[0] & 4);
# bit 2 is auto ranging, do we care?
# bit 1 is RS232, um, if you don't know that, what are you doing here?
$self->{'sign'} = "+";
$self->{'sign'} = "-" if($v_array[1] & 8);
$self->{'digit1'} = $self->convert_digit($v_array[1], $v_array[2], 0 );
$self->{'digit2'} = $self->convert_digit($v_array[3], $v_array[4], 1 );
$self->{'digit3'} = $self->convert_digit($v_array[5], $v_array[6], 1 );
$self->{'digit4'} = $self->convert_digit($v_array[7], $v_array[8], 1 );

$self->{'number'} = $self->{'sign'} . $self->{'digit1'} . $self->{'digit2'} . $self->{'digit3'} . $self->{'digit4'};

$self->{'range'} = 'u' if($v_array[9] & 8);
$self->{'number'} *= 0.000001 if($v_array[9] & 8);

$self->{'range'} = 'n' if($v_array[9] & 4);
$self->{'number'} *= 0.000000001 if($v_array[9] & 4);
$self->{'range'} = 'k' if($v_array[9] & 2);
$self->{'number'} *= 1000 if($v_array[9] & 2);

# 1 is diode, do we care?
$self->{'range'} = 'm' if($v_array[10] & 8);
$self->{'number'} *= 0.001 if($v_array[10] & 8);

$self->{'range'} = '%' if($v_array[10] & 4);
$self->{'range'} = 'M' if($v_array[10] & 2);
$self->{'number'} *= 1000000 if($v_array[10] & 2);

$self->{'mode'} = "farad" if($v_array[11] & 8);
$self->{'mode'} = "ohm" if($v_array[11] & 4);
$self->{'mode'} = "delta" if($v_array[11] & 2);

# bit 1 is hold, do we care?

$self->{'mode'} = "amps" if($v_array[12] & 8);
$self->{'mode'} = "volts" if($v_array[12] & 4);
$self->{'mode'} = "hz" if($v_array[12] & 2);

return $self->{'smode'} . ' ' . $self->{'mode'} . " " . $self->{'sign'} . " " . $self->{'digit1'} . $self->{'digit2'} . $self->{'digit3'} . $self->{'digit4'} . ' ' . $self->{'range'};

}

sub convert_digit {
my $self = shift;
my $lhs = shift;
my $rhs = shift;
my $include_decimal = shift;
my $decimal;

if($include_decimal) {
if($lhs & 8) {
$decimal = ".";
} else {
$decimal = "";
}
}

$lhs = $lhs & 7;

my $d;

# 000 0101 = 1
if($lhs == 0 && $rhs == 5) {
$d = 1;
# 101 1011 = 2
} elsif($lhs == 5 && $rhs == 11) {
$d = 2;
# 001 1111 = 3
} elsif($lhs == 1 && $rhs == 15) {
$d = 3;
# 010 0111 = 4
} elsif($lhs == 2 && $rhs == 7) {
$d = 4;
# 011 1110 = 5
} elsif($lhs == 3 && $rhs == 14) {
$d = 5;
# 111 1110 = 6
} elsif( $lhs == 7 && $rhs == 14) {
$d = 6;
# 001 0101 = 7
} elsif($lhs == 1 && $rhs == 5) {
$d = 7;
# 111 1111 = 8
} elsif($lhs == 7 && $rhs == 15) {
$d = 8;
# 011 1111 = 9
} elsif($lhs == 3 && $rhs == 15 ) {
$d = 9;
# 111 1101 = 0
} elsif($lhs == 7 && $rhs == 13 ) {
$d = 0;
} elsif($lhs == 6 && $rhs == 8) {
$d = "L";
} else {
return undef;
}

my $v = $decimal . $d;
print "V: $v\n" if($self->{'debug'});
return $v;
}

1;

Solar

Saturday, April 4th, 2020

So, i’ve decided to stop waiting for the government to make some sort of ‘green new deal’ happen and put my money where my mouth is. It also helps reduce my paranoia to know that I will have backup water and power supplies if the government (who provides both things in the city of Seattle) experiences some sort of outage or other difficulties. So, I’m putting out 3.5kW divided as 1.6kW of monocrystalline and the rest amphorous (the idea here is to make power in both sunny and cloudy conditions). Realistically I expect to see maybe 1kW output except high noon on the brightest parts of summer, but that is still enough to keep my fridge and freezer running, and I can also add a grid intertie inverter to reduce my power bills when I’m not using the array for backup power or to charge my electric car.

I’m also putting in 10kW of backup energy storage, which can be charged either via the grid (I’ve got a 40 amp charger) or via the solar array. I will likely also experiment with solar towers and solar tracking. Those of you who know me know I often have hobbies-for-a-year – this is my hobby for 2020.

I am also adding numerous rain barrels to store rainwater and a 12 volt pumping system that can be used to pressurize my pipes via a water filter from the rainwater, as well as some 12 volt emergency lighting.

Companies, stop being so shortsighted

Friday, April 3rd, 2020

So, one of the problems I keep running into with $COMPANY is that they are making decisions which make short term profit at the cost of long term profit. They keep encouraging their employees to sell .. with increased commissions.. while not having equipped all the employees to sell online or having prohibited in person events. This is a really dumb thing to do, but it reminds me of my conversation with a carny who was setting up a ride at the Prince William County Fair.

He was being really intent, carefully checking every bolt, every cotter pin, and he told me “Kid, you never want to kill a mark. You want them to come back next year so you can fleece them. Kill one mark, and a thousand marks won’t come next year because they will be too afraid. I check my ride until I’d be willing to let my own kids ride on it.”

The logic which doesn’t escape carnies but does seem to escape $COMPANY is that encouraging selling right now if it risks in person interfacing is potentially killing both customers and employees and therefore costing long term profits. I understand that we are not mentally adaptable enough to switch to a alternate RAS just for this emergency and then switch back – that we’d literally rather die than do anything that smacks of collectivism. All I can do is sit back and watch the carnage. Lately I’m thinking the USA will be 5x the deaths of the nearest competitor.