Räkna på energiåtgång varmvatten

I grunden är det ganska enkelt att räkna på hur mycket energi som går åt när vi gör av med varmvatten. Det finns några grundbitar man behöver ha koll på.

Vattnets specifika värmekapacitivitet i flytande form är 4.2 kJ per grad och liter vatten. Nästa steg är att förstå hur mycket vatten som går åt för aktiviteten. I fallet duschning i gammal hederlig dusch som inte snålspolar kanske det går åt ca 12 liter på en minut.

Om vi duschar i 20 minuter blir det totalt en vattenmängd på
12 liter / minut gånger 20 minuter = 240 liter vatten.

Energin vi söker är alltså den energi som åtgår för att värma 240 liter vatten. Nu behöver vi räkna ut hur många grader som vi skall värma vattnet. Om vi antar att vattnet till duschen håller 40°C och vattnet som kommer in i huset håller 6°C vilket inte är helt orimliga värden behöver vattnet värmas 40 – 6 = 34 grader.

Energin för att värma vattnet blir då följande:
240 liter vatten · 36 grader · 4.2 kJ = 36 288 kJ

Joule är samma sak som wattsekunder så för att få det till kilowatttimmar delar vi helt enkelt med 3600 som är antal sekunder i en timme:

36 288 / 3600 = 10.08 kWh

Så nu vet vi att förbrukningen ligger på avrundat 10 kWh för denna duschning. Nästa steg är att beräkna vad det kostar utifrån dagens elpris. Elpriset på nordpool är elhandelspriset, dvs vad elbolaget köper elen för och varierar timme för timme. Under en viss timme kan detta vara t.ex. 460 öre/kWh.

För konsumenten tillkommer sedan alltid elöverföringsavgiften som är oftast 24 eller 30 öre beroende på var man bor, vi kan anta att det är 30 öre i det här fallet. Sedan tillkommer en energiskatt om 36 öre per kWh som staten ska ha in. På det finns också det eventuella påslag som energibolaget gör men det är oftast inte jättestort. Vi kan för formens skull tänka oss 20 öre/kWh. Till sist tillkommer moms med 25 % på hela beloppet. Vi får då:

460 + 30 + 36 = 526 öre/kWh före moms
526 · 1.25 = 657,5 öre/kWh med moms

Vi kan avrunda det till 6 kr och 58 öre för 1 kWh med detta höga priset. Kostnaden för duschningen får vi så genom att multiplicera pricet med antal förbrukade kWh som var 10 stycken:

6:58 kr/kWh · 10 kWh = 65:80 kr

Man kan ganska enkelt göra ett Excelblad över detta om man vill och leka med lite olika siffror för att se vad det blir. Kolla också din senaste elräkning kan du se vad du har för faktiskt överföringsavgift.

After cloning a Ubuntu 22.04 server

Many things have changed from the oh so abundant 18.04 server and there are a few surprises that one needs to be aware of. One thing that has changed is that changing the MAC address no longer changes the ID when the server requests a new IP from a DHCP server.

This means that cloning a server into a new server they will start competing for the same IP address if they are on the same network so there are a few things you need to do before you deploy the new close.

Fix the IP address of the clone

  1. First release the DHCP address the machine has by issuing the command ”dhcpd -r” which should take care of this.
  2. Change the mac address, if you are using bridged network in particular there should not be two network interfaces on the same segment with the same MAC address. This is done in the virtual machine software.
  3. Change the machine-id of the clone. This is done by deleting the file /etc/machine-id and then running the script systemd-machine-id-setup which will create a new one.
  4. Optional: If you would like the system to change the network ID when you change mac address on the NIC then you need to change the following file(s) /etc/netplan/*.yaml and edit this to insert under each of the network interfaces you want to use MAC address as their ID ”dhcp-identifier: mac” then run sudo netplan apply.

Now shutdown the host, change the networking to whatever is needed (bridged most usually) and then restart the system and it should now be assigned a new IP address.

Fix the SSH keys of the clone

Next step is of course to change the cloes SSH keys which is done by deleting the keys in /etc/ssh by issuing the command ”rm /etc/ssh/ssh_host_*” which would delete all of them.

Then regenerate new keys from using the command ”dpkg-reconfigure openssh-server” which will generate all needed keys as if it was fresly installed.

Bevingade ord

Sleep resume in Ubuntu screws up mouse pad

I found that my Lenovo laptops did not always get the mousepad right when coming out of sleep or hibernate. After a bit of research I found that a modprobe remove and insert of the psmouse kernel module did the trick.

To automatize this you can insert a file in the systemd control structure to fix the problem yourself (if you are experiencing it). Below is a block of code. Save this to a file in /lib/systemd/system-sleep/touchpad


#!/bin/bash
# 2019 Täpp-Anders Sikvall
# Reinsert kernel module for mouse pad on lenovo after waking up
# from a sleep or a suspend so that things like gestures work 
# properly
# bugs to anders@sikvall.se
 
case "$1" in
   pre)
     exit 0                  # Do nothing just return
     ;;
   post)
     sleep 3                 # Wait for system to stabilize
     modprobe -r psmouse     # Remove psmouse from kernel
     modprobe psmouse        # Reinsert psmouse to kernel
     exit 0                  # Return no error
     ;;
   *)
     exit 1                  # Normally we should not be here
     ;;                      # but if we are, return error
 esac

Ubuntu Linux kernel 4.0.15-29 diasbles keyboard on Lenovo T420s

Recent update to one of my laptops made the keyboard completely stop working. While rebooting to the previous kernels made it work again.

The kernel that’s the culprit is the generic kernel 4.0.15-29 which does not even work in recovery mode. I have disabled this kernel on my system but could not find information out there about others with similar symptoms so I am writing this here in order to quickly get something out.

Ingefärsshot

Jag gillar ingefära och här kommer mitt recept på ingefärsshot.

1 st rot ingefära
1 liter vatten
1/2 pkt konc. äppeljos
1/2 st citron

Kaffefilter
Hållare för kaffefilter

Börja med att riva ingefärsroten i en skål. Använd grova sidan på rivjärnet, det duger gott åt detta.

Slå i ca 1/3 av vattnet. Knåda den rivna roten och pressa ur saften i vattnet. Häll vattnet genom kaffefiltret till en flaska. Fortsätt med de andra delarna av vattnet på samma sätt. Krama ur all vätska som går ur den rivna roten med händerna.

Tillsätt ca 1/2 paket koncentrerad äppeljuice.
Tillsätt 1/2 citron eller 3-5 msk färdig citronsaft

Skaka om, ställ på kylning.

Lagom är ungefär 2-4 cl. Det kan vara ganska starkt.

Photos and other rants