அண்ணத்துரையின் திருமண பத்திரிக்கை

September 15th, 2013 No comments

 

Annadurai's Wedding Invitation

Tags:

Coupons

September 15th, 2013 No comments

Here I shall put unused coupons.  You can use them, but please put a comment that you have used it so that I can remove it from the list.

Ebay.com

Mar 31    EBAY.in 7% discount or 750Rs, whichever is minimum      4S05ZKKSSI

Tags:

சுயநலவாதம்

September 13th, 2013 No comments

வான் துறந்து வலி துறந்த மனமோ,
ஊண் துறந்து உயிர் துறந்த இருப்போ;
கோண் துறந்து கொடை துறந்த உலகோ,
கோல் துறந்து கொள்கை துறந்த இருப்போ;
இவ்விரு இருப்புமே சுயநலவாதந்தானே!

 
முதலிரண்டு அடிகளில், உள்நோக்கிய பயணத்தினால் ஏற்படக்கூடிய சுயநலத்தை அறியமுடியும். இப்பயணத்தில் தன்னை அறிய முற்படும்போது ஒருமை மட்டுமே தெரியும். “நான்” என்ற எண்ணம் மட்டுமே தெரியும். மேற்கொண்டு பயணப்படும்போது, “நான்” என்ற எண்ணமும் மறையும். அப்போது ஒருமையும் கூட இருக்காது. பயணப்படுபவர் மற்றவர் பார்வையில் சுயநலவாதியாகவே தெரிவார், ஏனெனில் உணர்ச்சியற்ற சமாதி நிலையில் இருப்பவரிடம் அன்பு மட்டுமே கிட்டும்; பாசமோ, பற்றோ, ஆசையோ, அச்சமோ, கோபமோ, வெட்கமோ, பயமோ, ஏதும் இருக்காது!
 
அடுத்த இரண்டடிகளில், உலக வாழ்வில் ஏற்படும் சுயநலத்தை பற்றி அறியமுடியும். இங்கும் “நான்” என்ற எண்ணம் மேலோங்கி இருப்பது திண்ணம். அதில் சிறப்பு என்னவென்றால், “நான் மட்டுமே” என்ற எண்ணம் இருப்பதே அனைத்து துயருக்கும் அடிகாலாக அமைகிறது.
 
இரண்டுமே சுயநலவாதம் தான், ஆனால் வெவ்வேறு விதம். முதலில் உணரப்படுவது பிறநிலையால், இரண்டாவதில் உணரப்படுவது தன்நிலையால்.
Tags:

ஒரு புலம்பல்!

September 13th, 2013 2 comments

தேடிய திரவியம் பக்கத்திலே
ஆடுது பாருங்க விட்டத்திலே
மூடிய வெண்பனி மொத்தத்திலே
வாடுது கண்மணி நட்டத்திலே.

வருவதும் வந்ததும் என்னது இல்லே
போவதும் போனதும் யாருதும் இல்லே
இருப்பதும் இருந்ததும் அறியரது இல்லே
வருவதும் போவதும் புரியரது இல்லே

Tags:

How fast is integer arithmetic than floating point arithmetic?

June 19th, 2013 No comments
You may already know that integer arithmetic is faster than floating point arithmetic. But how fast? I had the same question in my mind. So created the following script to test the “fastness” for each data type.

#include <vector>
#include <iostream>
#include <cstdlib>
#include “Stopwatch.hpp”

template <typename T>
void test( size_t inArraySize, size_t inCorpusSize )
{
    typedef std::vector<T> array_t;
    typedef std::vector<array_t> arrays_t;

    std::cout << “constructing the corpus…”;

    Stopwatch sw;
    sw.Start();
    arrays_t corpus( inCorpusSize + 1);
    for ( size_t i = 0; i < inCorpusSize+1; ++i )
    {
        array_t &array = corpus[i];
        array.resize( inArraySize );
        for ( size_t j = 0; j < inArraySize; ++j )
        {
            array[j] = (T)( rand() );
        }
    }

    sw.Stop();
    std::cout << sw.Elapsed() << ” secs” << std::endl;

    std::cout << “scored in … “;
    sw.Start();
    array_t scores( inCorpusSize );
    const array_t &query = corpus[0];
    for ( size_t i = 1; i < inCorpusSize+1; ++i )
    {
        const array_t &array = corpus[i];

        register T &score = scores[i1];
        score = 0;
        for ( size_t j = 0; j < inArraySize; ++j )
        {
            score += array[j]*query[j];
        }
    }

    sw.Stop();
    std::cout << sw.Elapsed() << ” secs” << std::endl;

}

int main( int argc, char **argv )
{
    if ( argc < 2 )
        return 1;

    int csize = atoi(argv[1]);
    int asize = atoi(argv[2]);

    std::cout << “testing float..” << std::endl;
    test<float>( asize, csize );

    std::cout << “testing double..” << std::endl;
    test<double>( asize, csize );

    std::cout << “testing long double..” << std::endl;
    test<long double>( asize, csize );

    std::cout << “testing int..” << std::endl;
    test<int>( asize, csize );

    std::cout << “testing unsigned int..” << std::endl;
    test<unsigned int>( asize, csize );

    std::cout << “testing short..” << std::endl;
    test<short>( asize, csize );

    std::cout << “testing unsigned short..” << std::endl;
    test<unsigned short>( asize, csize );

    std::cout << “testing char..” << std::endl;
    test<char>( asize, csize );

    std::cout << “testing unsigned char..” << std::endl;
    test<unsigned char>( asize, csize );

    std::cout << “testing long long..” << std::endl;
    test<long long>( asize, csize );

    std::cout << “testing unsigned long long..” << std::endl;
    test<unsigned long long>( asize, csize );

    return 0;
}

Syntax highlighting done by: /usr/bin/highlight -O html -t 4 -I -S cpp Main.cpp –inline-css -o /tmp/m.html

The result of running this script with vector size = 100 and corpus size = 1 million is shown below:
sudar@kiriya /opt/testing/bin $ ./tester 1000000 100
testing float..
constructing the corpus…1.447 secs
scored in … 1.731 secs

testing double..
constructing the corpus…1.543 secs
scored in … 1.836 secs

testing long double..
constructing the corpus…2.135 secs
scored in … 2.614 secs

testing int..
constructing the corpus…1.454 secs
scored in … 1.657 secs

testing unsigned int..
constructing the corpus…1.41 secs
scored in … 1.615 secs

testing short..
constructing the corpus…1.394 secs
scored in … 1.59 secs

testing unsigned short..
constructing the corpus…1.347 secs
scored in … 1.542 secs

testing char..
constructing the corpus…1.313 secs
scored in … 1.507 secs

testing unsigned char..
constructing the corpus…1.328 secs
scored in … 1.522 secs

testing long..
constructing the corpus…1.553 secs
scored in … 1.767 secs

testing unsigned long..
constructing the corpus…1.548 secs
scored in … 1.761 secs

  1. If you observe carefully, floating point calculations have taken more time than the fixed point calculations.
  2. Long Double took the longest time and it is the slowest.
  3. The reverse climax is that 64bit fixed calculation is slower than single-precision arithmetic.  An interesting read on multiplication is here.  The reason could be overflow due to the size of product register being 64 bits.
  4. The fastest is 8 bit calculation.  But unsigned 8 bit arithmetic is slower than signed.  Can’t explain why!
  5. For fixed point, unsigned calculations take less time than signed calculations, which can be understood by the additional time taken for 2’s complement arithmetic.
  6. Results can be different with different CPUs / Operating Systems, so infer accordingly.

Upgrade version of the testing application.
#include <vector>
#include <iostream>
#include <cstdlib>
#include “Stopwatch.hpp”
#include <string>
#include <map>

template <typename T>
double test( size_t inArraySize, size_t inCorpusSize )
{
     typedef std::vector<T> array_t;
     typedef std::vector<array_t> arrays_t;

     arrays_t corpus( 2 );
     for ( size_t i = 0; i < 2; ++i )
     {
          array_t &array = corpus[i];
          array.resize( inArraySize );
          for ( size_t j = 0; j < inArraySize; ++j )
          {
               array[j] = (T)( rand()%1000 );
          }
     }

     Stopwatch sw;
     sw.Start();
     const array_t &query = corpus[0];

     array_t scores( inCorpusSize );
     for ( register size_t i = 0; i < inCorpusSize; ++i )
     {
          const array_t &docu = corpus[1];
          T & score = scores[i];
          score = 0;
          for ( register size_t j = 0; j < inArraySize; ++j )
          {
               score += docu[j]*query[j];
          }
     }

     sw.Stop();
     return sw.Elapsed();
}

int main( int argc, char **argv )
{
     typedef double (*fun_t)( size_t, size_t );

     typedef std::pair < std::string, fun_t > named_fun_t;
     std::vector< named_fun_t > functions;

     functions.push_back( named_fun_t( “float”, test<float>) );
     functions.push_back( named_fun_t( “double”, test<double>) );
     functions.push_back( named_fun_t( “long double”, test<long double>) );
     functions.push_back( named_fun_t( “int”, test<int>) );
     functions.push_back( named_fun_t( “unsigned int”, test<unsigned int>) );
     functions.push_back( named_fun_t( “short”, test<short>) );
     functions.push_back( named_fun_t( “unsigned short”, test<unsigned short>) );
     functions.push_back( named_fun_t( “long long”, test<long long>) );
     functions.push_back( named_fun_t( “unsigned long long”, test<unsigned long long>) );
     functions.push_back( named_fun_t( “char”, test<char>) );
     functions.push_back( named_fun_t( “unsigned char”, test<unsigned char>) );

     if ( argc < 4 )
     {
          std::cout << argv[0] << ” <corpus_size> <array_size> <repeats>” << std::endl;
          return 1;
     }

     int csize = atoi(argv[1]);
     int asize = atoi(argv[2]);
     int iters = atoi(argv[3]);

     typedef std::map<std::string, double> timings_t;
     timings_t timings;

     for ( size_t j = 0; j < iters; ++j )
     {
          std::cout << \niteration #” << j+1 << std::endl;
          for ( size_t i = 0; i < functions.size(); ++i )
          {
               std::string name = functions[i].first;
               double timetaken = functions[i].second(asize, csize);

               timings[name] += timetaken;
               std::cout << “testing “ << name << “….” << timetaken << std::endl;
          }
     }

     std::string minstring;
     double minvalue = 99999.9;
     std::cout << \naverages” <<std::endl;
     for ( timings_t::iterator iter = timings.begin(), end = timings.end(); iter != end; ++iter )
     {
          iter->second /= (double)iters;
          std::cout << “average time for “ << iter->first << “: “ << iter->second << std::endl;

          if ( iter->second < minvalue )
          {
               minvalue = iter->second;
               minstring = iter->first;
          }
     }

     std::cout << “minimum timing is for “ << minstring << “: “ << minvalue << std::endl;
}

The result of running this script with vector size = 500 and corpus size = 1 million with 20 iterations is shown below:

iteration #1
testing float….1.473
testing double….1.469
testing long double….2.025
testing int….1.024
testing unsigned int….1.069
testing short….0.996
testing unsigned short….0.993
testing long long….1.004
testing unsigned long long….1.004
testing char….0.991
testing unsigned char….0.991

iteration #2
testing float….1.449
testing double….1.459
testing long double….2.011
testing int….1.002
testing unsigned int….1
testing short….0.985
testing unsigned short….0.99
testing long long….0.993
testing unsigned long long….0.993
testing char….0.983
testing unsigned char….0.992


..
iteration #20
testing float….1.448
testing double….1.45
testing long double….1.975
testing int….0.99
testing unsigned int….0.991
testing short….0.989
testing unsigned short….0.986
testing long long….0.997
testing unsigned long long….0.992
testing char….0.992
testing unsigned char….0.988

averages
average time for char: 0.99575
average time for double: 1.4665
average time for float: 1.4676
average time for int: 1.0046
average time for long double: 2.00115
average time for long long: 1.00585
average time for short: 0.99985
average time for unsigned char: 0.9945
average time for unsigned int: 1.0085
average time for unsigned long long: 1.0025
average time for unsigned short: 0.9963
minimum timing is for unsigned char: 0.9945

So, even in this test, char is the best choice!!

Tags:

LED Emergency Lamp

June 16th, 2013 No comments

Here is the LED emergency lamp that’s being sold for few hundreds in the market.  See below for the pictures.  This lamp comes with 60+ LED lamps adding upto a power of ~4.5W.

I have attempted to reverse engineer the circuitry and drawn the circuit using ExpressSCH tool. Click on the image to see the full sized circuit.

All the components listed in the circuit are available in common electronics spares shops. 

Tags:

Clicking noise from HDD??

April 22nd, 2013 No comments

Have you wondered replaced your hard drives (HDD), when there is “clicking” noise from the HDD?  When you hear that noise, it means the drive is performing a “hard-reset” internally.   I have always thought that the disk is a goner, when there is too much clicking noise from the HDD.

Lately, it was found that when the gave the HDD the 5 pin power cord, the clicking noise is gone.  In general, 4 pin power has <+12v, 0v, 0v, +5> and the 5 pin power cord has an additional 3.3v orange line.  Another discovery recently is that, the clicking noise is gone when I changed the SMPS.  When the SMPS is over loaded or so, I think it is not able to supply the current that the HDDs want, which in turn makes the HDDs to perform a hard reset internally.

So, before applying for a replacement HDD, please do try changing the power cord to a 5pin cord and when you cannot try replacing the SMPS.  Typically, when you have lot of devices in your machine, ensure you use a reasonably powerful SMPS to avoid outages.

Tags:

1.5KWp Solar Power Plant

April 22nd, 2013 3 comments

Another Solar Power Plant project @Mogappair, Chennai

This time, I have helped a friend of mine to setup up the power plant for his home.  He had given a requirement to run everything in his home except the heavy duty equipment like A/C, Microwave Oven, Water heater & Washing machine. While measuring the load requirements, he had a peak load of about 1.5KW and an average load of ~600W and at nights the load was <200W average.

This time, I wanted to get a simplified inverter solution that does not require and interaction per se for the end user. So, we have procured a 2KW ESU inverter from Emerson, which was priced as Rs 55000/-.This inverter model comes with an inbuilt 48V/35A MPPT controller and a unity PF 2KW power inverter.  So, for these models of Emerson 2KVA is 2KW as the PF is 1.

Although Emerson has a good track record of quality products, their service customer care is outsourced, who do not function very well. Also the delivery time for the inverter is 5-6 weeks, but on paper they say 4 weeks. For the Mogappair area, the service is handled by Sri Nandees Technologies, who technicians on call are pretty good and responsive.

As usual, we procured the batteries (4x180Ah) from Sharana batteries for Rs 54000. Since my last installation, the price of batteries went up by ~5% for all the battery brands.  And the panels (24v/250Wp x 6) were procured from Akshaya Solar @42/watt for Rs 63000 and the structures for planting the panels were also got from Akshaya Solar for additional ~Rs 10000. And for the electrical works and civil works, we spent another Rs 18000.  Overall, we have finished the entire project for Rs 200,000 all inclusive.

Thanks to our electrician Mr. Raja  & vendors (Mr. Raju @Akshaya Solar, Mr. Aruldass @Sharana batteries, Mr. Karthik @Sreenandees, Mr. Jayaraj @Emerson) who helped us see this project through.  Incidently, this is the only domestic installation in the 1.5KWp range in the entire Ambattur, Avadi, Mogappair, Padi, Anna Nagar range AFAIK. 🙂

Tags:

பாடல்கள் கேட்கும்போது காதலுணர்வு வருமா?

April 16th, 2013 No comments
புறத்தே புலனால் அரும்பும் காமம்;
அகத்தே ஆழத்தே ஊறும் அன்பு;
காமத்தோடு இசைந்த அன்பு காதலாகிவிட,
செவியோடு கசியும் இனிய பாடல் ஒன்று
அக்காதலை தூண்டுவது நியாயம்தானே!
Tags:

1KWp Solar Power Plant

January 30th, 2013 22 comments

Phew! What a relief!

I have just finished installing a 1KWp solar power plant in my apartment.  It was an wonderful and tiring experience getting everything to work together, ofcourse with the help of several kind people who helped moving on with the work.  I think, my installation is the first domestic installation for a capacity >1KWp in my entire area, that is Thirumullaivoyil; may be the first in Ambattur + Avadi townships.  Whatever be it, I am very happy that I could get it up and running as per the plan.  The power plant can produce upto 4-5KWh everyday in winter+sunny and may be 5-6KWh in summer.  I have been able to attach everything in my home except for Fridge, Ovens, Water heater, A/C and washing machine.  Yeah! Mixie, Coffee Maker, Wet Grinder, Computers, Water purifier run in solar at my home!  I tried attaching Fridge to the unit, but the backup time in the nights drastically reduced.  By the way, the solar power supply is 24hours through out.  The secret is that the excess power produced in the day are backed up in huge batteries, so that the saved energy is dispensed through out the night for powering my bed room and other low power night utilities.

Things to procure for this DYI project:

  1. Solar Panels: There are several variety of panels available, but always choose polycrystalline (aka multi-crystalline) panels, as there are very efficiently within 30 degree deviation of sunlight inclination angle.  If you go for monocrystalline, they are efficient only when the sun is right on top of them, so you are forced to install a solar tracking device for an additional cost.  I had procured MNRE approved panels for Rs 46/watt including transportation and taxes from Akshayasolar.  My setup has 12V 150Wp x 6 and 100Wp x 2, put together 1100Wp of bright power.
  2. Inverter: There are several varieties of inverters available in the market. Solar Inverters are the ideal choice here, but for my specification I could not get a solar inverter within my budget.  Typically solar inverters are priced around Rs 30000 for a 1KW capacity.  So, I had decided to go to regular sine-wave inverters and convert that to a solar inverter myself.  To convert an inverter to a solar inverter, I had to get a solar charge controller and fabricate a control circuitry.  I have bought a 24V, 1.4KVA Amaron Inverter for Rs 7000, with 2 years warranty.  A typical inverter has a power-factor of 0.7 to 0.8, so I could load upto 1000W comfortably without frying the inverter.
  3. Batteries: This is the most critical part of any ESU (Energy Storage Unit), where the power is stored during surplus and released when solar incoming reduces.  On the contrary, there are EEU (Energy Export Unit), which directly converts the energy derived by the solar panels into useful power for consumption or resale back to the grid.  TANGEDCO does not buy from installations less than 1MWp, so ESU is my only option.  So storing the power, the popular choice is Exide Solar Tubular batteries.  But, I chose Sharana Batteries because their manufacturing unit is in Ambattur Industrial Estate, and their service guarantee was better than what Exide offered.  While buying batteries, one should be very careful about the capacity rating of the batteries.  By capacity, the common misnomer is the AH rating.  AH rating tells the current limits of a battery, but the capacity rating is mentioned as Cxx (eg: C10, C20, etc).  Typically, a 180AH/C20 battery is same as the 150AH/C10 battery or 100AH/C5.  In C20 rating, if the drain current should be 9A, the battery would supply energy for 20 hours.  The same battery would serve for 8.33 hours only if the drain current is 18A, but you would expect it to serve for 10 hours.  Likewise, the same battery would serve only for 2.77 hours, if the drain current was 36A where you would expect a backup time of 5 hours (see here the capacity has halfed!!).  I have purchased 2x180AH @C20 tall tubular batteries from Sharana with 2 years warranty for Rs 26000.
  4. Charge Controller: There are two types of charge controllers available namely PWM, MPPT. Solar panels, although rated as 12V, they generate voltages upto 21.6V (open-circuit).  They are optimal at around 16.4-17.4V, which is called the maximum power point.  In order to leverage the maximum power from the controller, I used MPPT charge controllers.  For 1.1KW at 24V, the Imax is 50A, but assuming 80% efficiency for panels, 40A MPPT is sufficient.  I got 40A 24V controller from Adaptek India, Adyar for Rs 13600 with 3 years warranty.
  5. Structure Fabrication: This is the messy part of the entire exercise as readymade units were not available.  Since I will be using 8 panels in total and I had to use just 100 sq.ft of space on the roof, I planned to build a two row beam structure to take the load.  The weight of a panel is roughly 10kg, to 40kgs per structure is the setting.  The design shall have a rectangular frame of size 10’x3′ made out of 1.5″ L section of steel.  The rectangular section shall be supported by two 2″x1″ C channel steel of height 1.5′, which I call the legs.  The legs shall rest on a 8″x8″ 6mm plate, which in turn shall be secured to the roof with four 10mm anchor-flush bolts.  I could get raw material and fabrication done in Mannurpet, Ambattur for Rs 8000.  The total weight of steel I had installed is about 50Kg to keep the 70Kg of panel structure load secured.

Solar Power Plant Sizing chart is here.

More to continue..

Tags: