Could Indian Railways be Solar self sufficient?

Indian Railways is one of the largest consumer of both diesel oil and electricity in India. It uses 2.7 billion litres of diesel and around 20 billion KWh of electricity per year for traction purpose. Additionally another 2.5 billion KWh is used for non-traction related usages like powering stations and other things. This 2.7 billion litres of diesel could typically provide around 9 billion KWh electricity assuming 35 percent diesel generator efficiency. That way altogether the energy requirement of Indian Railways could be around 32 billion KWh of electricity.

As far as land is concerned, the total land available with the Indian Railways is 4780 sqkm, out of which 510 sqkm land is vacant. This is a huge amount of land which could be more than some of the smallest states in India. For example that is 322% of NCT Delhi, 129% of Goa and 67% of Sikkim.

Indian Railways manages the third largest railway network in the world. This is with a route length of 67956 km. If double lines and other multiple parallel lines are counted the running track length comes to 99235 km. If all other tracks including yards, multiple platform loops in stations etc are counted then the total track length would come to 126366 km. Lion share of that meaning 94.1% of all the route is Indian broad gauge. That is 1676 mm or 5 ft 6 inches gauge.

What is the total land used by tracks?

The minimum loading gauge of the broad gauge track is 3.25 metres. But, let us assume a width of 4 metres for easy calculation. Considering 125000 kms, then the total area would come to 500 sqkm.

When railway lines are covered with panels how many MW of solar panels could be installed?

Assuming 2m x 1m panel producing 350 Watts, then nearly 3000 panels would be required to get an installed capacity of 1 MW. With 4 metre track width two parallel panels could be used. That way, with 1.5 km of track length 1 MW of installation could be achieved.

Considering, 126366 km of track length, 84000 MW could be installed. But, that is impractical as 100 percent track could not be covered, because of different reasons – solar insolation, loading gauge, bridges, tunnels, trees, stations and many more.

How many KWh could be generated?

In India 1 KW system could generate around 4 KWh to 4.5 KWh of electricity per day, so we can assume that 1 MW system generates 1500 MWh of electricity annually. With 84000 MW of installation, 126 TWh or 126 billion KWh of electricity could be generated.

With all these considerations, even if 25 percent of the railway tracks could be covered with solar panels, there is a potential to generate more than 30 billion KWh of electricity so that the whole Indian Railways could be powered.

Here we are only talking about the 500 sqkm of land on top of the railway tracks. Another 510 sqkm is vacant. Apart from that there are huge amount of covered spaces like stations, platforms, sheds, car and bike parking etc. which could be covered with solar panels.

Solar Electricity in India

As of 2021, total solar installed capacity in India is 47700 MW and total solar electricity generation was 60.4 billion KWh.

That way, the Indian Railways could not only become self sufficient but they could become the largest solar producer to the national grid also.

References

Railway Land Usage

https://pib.gov.in/PressReleasePage.aspx?PRID=1593895

Evaporative Cooler and Tonnage

Evaporative coolers are very useful in dry and hot climate. Pour a lot of water and run the fan, and get the cool moist breeze. It is a simple device and it is good for what it provides – fresh cool air. For a long time I have been thinking how to compare the evaporative cooler with a standard air conditioner.

Tonnage is one of the most commonly used words used in Air Conditioning and Refrigeration industry. It is typically used for all vapor compression refrigeration systems and for the bigger chiller based systems. For evaporative coolers, people use the amount of area that could be cooled (sqft or sq metre), amount of air pushed (CFM or CMM) or even simply the water capacity of the tank. Tonnage is typically never used for evaporative cooling systems. Even though both systems are used for cooling purpose, their performance metrics are different. Is there anyway to relate the two?

Before finding any relation, let us find what is the meaning of a tonnage. In simple words that is the latent heat of fusion of one short ton of ice. One short ton is 2000 lbs or 907kg. That means the amount of heat energy absorbed when one short ton of ice at 0 °​C becomes water at 0 °​C. The catch is that it is time bound, and the time frame given to melt this ice is 24 hours. So the unit of tonnage transforms into a unit of power.

To give some calculations, the latent heat of fusion for water is 334 KJ/kg. In English units it is 144 BTU/lb. So for 2000 lbs that would become 288000 BTUs in a time limit of 24 hours. Then the effective rate is 12000 BTU per hour. And this 12000 BTU per hour is taken as the definition of one ton of cooling.

In terms of SI units that would be 303 MJ or 84.4 KWh of heat absorbed in a day. That effectively becomes 3517W. To understand that, suppose this short ton of ice is in a thermally sealed room and we keep an electric heater of 3517W, then at 24 hours the ice would have just melted. Both BTU and MJ are the units of energy, but when the time limit of 24 hour is applied then it would become the unit of power consumed or transferred. In olden times, there used be ice houses, special buildings to store tons of ice. People used to move the ice accumulated during winter and store it inside these ice houses to use for cooling purpose in the summer. That is the real history of tonnage.

Until now, we have seen the story of fusion. But evaporative coolers use vaporization instead. The latent heat of vaporization of water is even more. It is 970.4 BTU/lb or 2260 KJ/kg. So when 1 Litre that is roughly 1 kg of water got evaporated from a wet cloth, it would have cooled the surroundings by absorbing 2260 KJ of heat from the atmosphere. Just doing some calculations we can see that 134 Litres of water could absorb the same 303 MJ of energy. As latent heat of vaporization is 6.76 times that of latent heat of fusion, then the requirement of water also gets reduced. That way 134 kg of water could provide the same cooling power as 907 kg of ice.

Now coming back to the original question. If our Evaporative Cooler consumes 134 Litres of water, then it has provided us with one ton of cooling.

The story of water from two continents: the Amazon River and Lake Baikal

Let us start with two tricky questions. Pause here and take a wild guess.

Q1: Suppose the entire Lake Baikal is drained on Russia, how deep a water pool would it create?

Q2: Suppose the water flowing in the Amazon river is used to fill an equivalent of Lake Baikal, how much time it would take to fill?

Do remember these questions, we would discuss the answer at the bottom.

Every civilization has a relation to a river. One of the world famous destinations in the continent of South America is Machu Picchu and the sacred valley of the Incas, situated in the Peruvian Andes range. Peru is a country located on the Pacific west coast of South America. For the Inca civilization, the Urubamba river is the main river in their valley. Their empire extended between the Pacific coast and the Andean highlands with Cuzco as the capital. But, the rainwater from this valley does not go to the Pacific Ocean, instead it finally reaches the Atlantic Ocean more than 6000km away. This is because the Urubamba river is one of the headstream tributaries of the mighty Amazon river. The west most tributary of the Amazon river is Río Marañón which originates only around 100km away from the Pacific Ocean in Peru itself. It is not far away from Lima, the Peruvian Pacific coastal capital city.

Coming to the water volume, the Amazon’s average discharge is 209000 cubic metres per second. That is the equivalent of draining 84 Olympic size swimming pools in every second.!!! This discharge is so powerful that freshwater could be seen at around 100 kilometres away from the mainland in open Atlantic Ocean. The Amazon river discharges more water than the next 7 largest rivers combined together. If we combine Orinoco in South America, Mississippi in the US, Congo and the Nile in Africa, Ganga, Brahmaputra, Padma together in India, Yangtze in China, Yenisei in Siberia, Volga in European Russia and Danube in Europe together, still it would be less than the Amazon in terms of flow volume.

For a comparison, current world oil production is 1/1100 of this rate, that is around 95 million barrels per day or 176 cubic metres per second.

Now consider the other side of the world. From the Amazon rain forest to the Taiga forest in the Russian Siberia. Lake Baikal is the largest lake in Siberia and in Russia. It is located between the federal subjects of Irkutsk Oblast and the Republic of Buryatia. Mainly 3 rivers flow into the Lake. They are Selenga, Barguzin and Upper Angara. Whereas, the main Angara river originates from the Lake and it is one of the main tributaries of the Yenisei river ecosystem.

The areas surrounding the Lake are very sparseley populated and it is extremely beautiful. The Trans Siberian railway section between Irkutsk and Ulan-Ude goes through the shores of the Lake. Also there is the picturesque 89km long Circum-Baikal raiway around the South West shore of the lake. Republic of Buryatia is famous for their Tibetan Buddhist culture and heritage.

Looking at the surface area, Lake Baikal is the 7th largest in the world with an area of 31500 square kilometers. It is the deepest lake with a maximum depth of 1642m. With 23600 cubic kilometres of water, it is the largest freshwater lake by volume. It has more water volume than the entire five American Great Lakes combined together, even though individually Superior, Michigan and Huron are larger in area. Lake Tanganyika in Africa comes second in terms of both depth and water volume. No wonder, Lake Baikal holds 22 percent of world’s surface freshwater.
For a comparison, the largest man made reservoir, the Lake Kariba in Africa has a capacity of 180 cubic kilometres.

Now back to our original question.
Russia is the largest country in the world with an area of 17.1 million square kilometres. If we drain Lake Baikal on Russia the entire country would be covered with 1.38 meter deep water. The Amazon River would take 1307 days, which is 3.5 years to fill Lake Baikel.

Fresh water is a very precious natural resource, let us conserve it.

Building Android App without IDE from the command line

Recently I got the source code of one particular Android App from github and I wanted to build that on my Debian Unstable latest.  I was just trying to see how I could build without installing the IDE.  This is what I did.
`apt-get install default-jdk`

` commandlinetools-linux-6609375_latest.zip gradle-6.5.1-all.zip `
I chose to install it in the larger partition which is mounted as /media/data so I created a new directory /media/data/android_sdk
Then unzipped the above two zip files there.

There was a java error while using the sdkmanager.
``` Warning: Could not create settings java.lang.IllegalArgumentException ```

After searching a bit, I found a solution for that. We need to create a directory “cmdline-tools”. So I created it and moved the tools directory there. Effectively, the sdkmanager could be located at
`/media/data/android_sdk/cmdline-tools/tools/bin/sdkmanager`
Now we need to make sure that the sdkmanager and gradle are in the PATH. I only wanted to include them during App building. So, wrote a simple function and placed it in \${HOME}/.bashrc
``` setpath_android() { export PATH=/media/data/android_sdk/cmdline-tools/tools/bin:/media/data/android_sdk/gradle-6.5.1/bin export ANDROID_SDK_ROOT=/media/data/android_sdk echo \${PATH} } ```

Just run “setpath_android” from the Bash whenever we want to build.
Now, we have to install the platform-tools, build-tools and related packages. As my phone is Android Oreo 8.1.0, I wanted to install API Level 27.
``` sdkmanager --version sdkmanager --update sdkmanager --licenses sdkmanager --list sdkmanager --install "platforms;android-27" sdkmanager --install "build-tools;27.0.3" sdkmanager --install "extras;android;m2repository" "extras;google;m2repository" sdkmanager --install "cmdline-tools;latest" ```
Now, goto the directory of the Application which was cloned from github. Let us say it is myapp
``` cd /path/to/myapp gradle build -x test ```

With this much, I could build the application without having the IDE and completely from the command line

1. Motion of the Earth, Celestial Sphere

These are a few things we learn from primary school times.  Our Earth revolves around the Sun in one year. At the same time, it also rotates around its own axis in 24 hours. But are we revolving or rotating in Clockwise or Counter Clockwise direction?  The answer to that depends only upon where we look from.!! If you look from the North Pole of the Sun or the Earth, both our daily and years rotations are in Counter Clockwise direction.  But, if you go to the South Pole then both would be in Clockwise direction.

When we look at the sky throughout the year, we could feel that the sky is a sphere covering our Earth. If we extend our Equator to the sky, that plane is called the “Celestial Equator”. Similarly, if we draw a line through our Axis, that would pass through both N/S Poles and extend to the sky. Those two points are called the “Celestial Poles”. All the Northern stars appear to revolve around the Celestial North Pole and all the Southern stars appear to revolve around the Celestial South Pole. The stars on or near the Celestial Poles appear to remain constant. For example, Polaris/North Pole star does not look like moving at all.

2. Motion of the Sun, the Ecliptic

Now, coming to the motion of the Sun. As our Earth is revolving, we get a feeling that the Sun’s position is changing and it is moving through the sky.  It is apparently moving through the Celestial Sphere and completes one full circle in one year. That means the Sun moves “through” the stars every day. That motion is just nearly 1 degree (360/365.25 exactly) per day. On the contrary, the position of the stars changes everyday night. Assuming that we look at one particular star at 9PM one day. The same star would have moved around 1 degree to the West at 9PM on the next day. So, after one month, the same star would appear 30 degrees to the West at the same time.  In another word, the star would star rising early.

Because of the Earth’s axial tilt of 23.5 degrees, the Sun appears to go North and South during the course of one year and because of that, we have seasons. The Sun crosses the Celestial Equator on two days, March 21 and September 22. These two days are called Vernal (Spring) Equinox and Autumnal Equinox. On both of these days, there would be 12-hour equal day and night. The Sun reaches a maximum of 23.5 degrees North on June 22 and 23.5 degrees South on December 22 and these two days are called Summer Solstice and Winter Solstice respectively. Of course all from Northern hemisphere, in Southern hemisphere, it would be the opposite. So, if we draw the Sun’s motion throughout the Celestial Sphere, it follows a Sinusoidal motion, crossing the Equator on both Equinoxes and peaking on Solstices. The apparent path followed by the Sun is called the Ecliptic.

3. Nakshatras and Rashis

There are 12 Rashis and they are named Mesha (Aries) to Meena (Pisces). There are 27 Nakshatras with names, Ashwini to Revati.   Both Rashis and Nakshatra are used to divide the Ecliptic, that means the apparent path of the Sun in a year. Each Rashi corresponds to 30 degrees of arc (360/12) and each Nakshatra corresponds to 13 degrees 20 minutes (360/27) of arc. That way, each Rashi has 2.25 (30/12) Nakshatra. That is how you get Ashwani, Bharani and Kruttika first Quarter to be in Mesha Rashi and so on.

Moon takes 27.3 days to revolve around the Earth, so typically the Moon passes through each Nakshatra in a day and it takes 2.25 days to pass through each Rashi. Whereas, the Sun takes a year to go through the Ecliptic. That means, the Sun stays in each Rashi for around 1 month and it stays in one Nakshatra for around 13.5 days. So, when we say current Nakshatra and Rashi, it means that the moon is near to that particular Nakshatra and the Sun is in that particular Rashi and typically that is 1 day and 1 month respectively.

4. Sidereal Year, Tropical Year and the Precession of the Equinox

What is the meaning of a Year? We say that it is time for the Earth to complete one revolution around the Sun. It also means that the time taken to complete one full year cycle of the seasons. Now consider that our Earth’s axis is fixed with an axial tilt of 23.5 degrees and it is pointing at the North Pole star named the Polaris, all the time throughout the year, millennia after millennia. That is not entirely correct. Now, imagine a spinning top, what children used to play. The top spins very fast, but the axis also rotates very slowly. Many times, the axis rotates in the opposite direction of the motion.  Exactly the same is happening to our Earth also.

The axis of the Earth is rotating in the opposite direction of the motion at an extremely slow rate. One full rotation takes around 25920 years to complete. Now, let us start counting from an Equinox with exact day-night match, say March 21. One sidereal year is the time taken for our Earth to complete one full cycle, that is 360 degrees, that means the Sun seen at one particular star to the Sun seen at the same star after a year. Since the axis is rotating in the opposite direction, the next Equinox comes slightly before the Earth completes a 360-degree cycle. That means the seasons complete one full cycle, just slightly before the Earth completes one full circle of revolution around the Sun. One full cycle of the seasons is called the Tropical year.  The Tropical year takes 359 degrees 59 minutes and 10 seconds of Arc around the Sun and the difference is 50 Arcseconds.

That is the difference between the Sidereal and the Tropical year. One denotes the cycle of the motion around the Sun and the other denotes the cycle of the seasons.
Sidereal Year = 365 days 6 hours 9 minutes
Tropical Year = 365 days 5 hours 48 minutes.
Difference = 20 minutes 24 seconds in one year, or 50 Arc-Second of circle per year.

This seems to be small, but over a period of time, it could add up a lot. It could be

1 Day in every 71 years
1 Degree in every 72 years
1 Month in every 2160 years
1 extra Year in 25772 years (between 25700 to 26000 years)
Considering Rashi and Nakshatra, it could be
1 Rashi in 2160 Years (25920/12)
1 Nakshatra in 960 Years (25920/27)

In the Indian system, Ayanamsa is the Sanskrit term used to denote the Precession of the Equinox.

5. Solar and Lunar Calendar

We definitely would have heard about the Solar and the Lunar Calendars. Lunar calendars start either on a Full Moon or a New Moon day. Since 12 Lunar months fall short of the Solar year by around 12 days, all these calendars use some kind of Intercalcation or leap months in every 2 or 3 years. So, in fact, all Lunar Calendars followed in India are LuniSolar, means they get synchronized to the Solar Calendar.

Within the Solar Calendar system, there are also two subtypes – using either the Sidereal or the Tropical year. Most of the Indian systems, both the Solar and the Lunar (or Lunisolar) calendars finally get synchronized to the Sidereal year. Whereas the “Indian National Calendar” or the Shalivahana Shaka Calendar standardised by the Government of India uses the Tropical year starting on the Vernal Equinox, that is on March 21.

Normally Vikram Samvat calendar is used in North and West India, where the Lunar month starts on a Full Moon day. In Karnataka, Andhra, Maharashtra, and Bengal, the Lunar month stats on a New Moon day. Calendars used in Tamil Nadu and Kerala are pure Solar Calendar, where the month starts on a Sankranti day.

In India, we use 27 Nakshatras and 12 Rashis (Zodiac Signs). The 27 Nakshatras are from Ashwini to Revati, the 12 Rashis are from Mesha (Aries) to Meena (Pisces). The 12 Indian Lunar month names are from Chaitra to Phaalguna. These month names are derived from a Nakshatra name in such a way that the Fullmoon happens on that particular Nakshatra. For example, In Chaitra, the full moon is on Chitra Nakshatra and in Phaalguna, the full moon is on Uttara Phaalguni Nakshatra.

On the contrary, the Gregorian calendar or the common calendar we use now internationally is a Tropical Calendar where the Vernal Equinox is generally fixed on March 21 itself.

6. Types of Zodiac

The Zodiac is the portion of the sky through which the Ecliptic passes through. All the 12 Zodiac Signs or Rashis are present in this portion of the sky. Both Sidereal and Tropical year are explained in the previous section, considering the revolution of the Earth. As we observe the Zodiac, the Sidereal year means the Sun completing one full cycle and re-entering the same Sign back. Whereas the full cycle time taken for the Sun to cross the Celestial equator back is called the Tropical year. We have also seen that these are not the same because of the Precession of the Equinox. There is an inevitable drift of 1 degree happening in every 72 years.

In our Indian tradition, the North-South movement of the Sun is named as Ayana. There are two namely Uttarayana and Dakshinayana corresponding to the North and the South movement respectively.  Uttarayana starts at the peak of the winter and Dakshinayana starts at the peak of the summer.

The Zodiac could be divided into the 12 Signs considering either of the two types of year. In the first method, a well known Constellation had been selected as the beginning Sign, that is Aries or Mesha Rashi.   In the second method, the point where the Sun crosses the Celestial Equator towards North is considered as the beginning. The first method is known as the Nirayana system meaning “Without Motion” and the second method is known as the Sayana system meaning “With Motion”.

In India, we follow the Nirayana system with the fixed zodiac and the related Sidereal year, whereas Europeans follow Sayana system with moving zodiac and the Tropical year.

7. Effect of the Precession of the Equinox

As explained before, the Precession of the Equinox causes two types of years and zodiacs. Because of these two types, certain confusions also could arise.  The Vernal Equinox is taking place always on March 21. Currently, that is when the Sun is aligned to Uttara Bhadrapada (Uthrattathi) Nakshatra in Meena Rashi (Pisces). In another 500 years, that would get drifted to Aquarius, that means at the time of the Equinox the Sun would be in Kumbha Rashi. Around 1800 years before, when all the Calendars got synchronized the Vernal Equinox was aligned to Ashwini Nakshatra in Mesha Rashi (Aries).  Currently, the North Celestial Pole is very near to the star Polaris (Alpha Ursa Minoris) or Dhruva.  In another 12500 years from now or 12500 years before, the North Celestial Pole would be near the star Vega (Alpha Lyrae) or Abhijit.  Even the axial tilt of 23.5 degrees is not fixed.  It oscillates between 22.1 and 24.5 degrees on a cycle of 41000 years.

Following the Sidereal year and fixed Nirayana zodiac – The seasonal nature of our important days could drift away.

Most of the new years celebrated in India are just after the Vernal Equinox. In another 12500 years from now or 12500 years before, these new years would get so much drifted away so that it would be in the month of September where Autumnal equinox happens. Festivals like Makara Sankranti and Pongal would take place in June and they would no longer be aligned with the beginning of Uttarayana.  Even now itself, the actual Uttarayana starts on the Winter Solstice day, 23 days earlier to Makara Sankranti and in another 500 years, it would be aligned to Dhanu Sankranti day.

Similarly, Deepavali is celebrated on Kartika Amavasya, in Tula Rashi now, at the beginning of the winter.  Considering precession, 12500 years before or after, Deepavali would be at the beginning of the summer.

Following the Tropical year and moving Sayana Zodiac – The names of the Zodiac signs would really lose their meaning.

As per the Tropical European system, Aries sign starts always on March 21, the day of the Equinox.  Now itself due to the moving zodiac, the Sun is really in Pisces when the Aries sign starts. In another 12500 years from now or 12500 years before, the Vernal Equinox would happen when the Sun is actually in Libra. As per the Tropical system that would mark the beginning of the Aries sign.

Similarly, Christmas and New Year (January 1) is celebrated at the peak of the winter when the Sun is in Sagittarius.  This also would get shifted back to Libra and so on.

Some of the Indian calendars like the official Shaka calendar has been recalibrated to follow the Tropical year, but the month names remain the same as Chaitra to Phaalguna.  These months also would lose their actual meaning.  Chaitra month of Shaka calendar would not be aligned to having the full moon on Chitra Nakshatra day.

Basically, the astronomical meaning of these important days would get changed.  After all, Astronomy and Astrology originated from the Greek word Astron meaning star.  The corresponding Sanskrit word Jyotisha also originated from the light from the stars.  Anything to do with stars automatically gets aligned to the Sidereal than the Tropical method.

8. To sum it all up

If fixed zodiac is followed, then the seasonal nature of festivals would go away.  Similarly, if moving zodiac is followed astronomical nature of festivals also would go away.  These are inevitable because of the difference between the Sidereal and the Tropical year. We could only follow one system and there are a few effects associated with that.

gstreamer pipeline to stream raw audio over network

Normally all audio pipelines use an audio codec and RTP encapsulation. I searched a lot for a raw audio pipeline, but I could not find much information. Then, I tried different options and came up with the following.

`gst-launch-1.0 -v filesrc location=/tmp/musicfile.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! audio/x-raw, rate=16000, channels=1, format=S16LE ! audiomixer blocksize=320 ! udpsink host=192.168.1.10 port=10000`

This above pipeline takes audio from an MP3 file, decodes it, changes the format to 16 KHz mono, and then sends it to the network using UDP. Audio mixer is used just to send the frame size of 10 msec amounting to 320 bytes of data.

`gst-launch-1.0 -v udpsrc port=10000 ! rawaudioparse use-sink-caps=false format=pcm pcm-format=s16le sample-rate=16000 num-channels=1 ! queue ! audioconvert ! audioresample ! autoaudiosink`

To play the same from network the above pipeline could be used.

Petroleum to Biofuel: How much land is required

One of the primary uses of petroleum is as fuel. As the average carbon dioxide levels have already gone above 400 ppm and global warming is taking place, there have been many calls to reduce the usage of petroleum by substituting it with renewable energy. Biofuels stand very distinct among all other renewables because they could be easily used as a drop in replacement for petroleum based fuels.

Petroleum usage

Around 84 percent of the distillates are used as fuels including diesel, gasoline(petrol), kerosene, LPG etc. Considering the oil usage at 94 million barrels per day, this amounts to 4585 billion litres per year.

Biofuel yield

Different biofuel crops have different yields. Typical values are given below.

Land Requirement to replace the entire petroleum based fuel

Considering the above yield and the amount of petroleum used as fuel, total land usage of different crops to replace the entire petroleum based fuel could be calculated. For comparison two forms of other data is also provided. 1) Total arable and agricultural land available. 2) Land area of some of the larger countries in the world.

Could Brazil increase the ethanol production 100 times utilizing the entire area of Brazil itself? Otherwise could the entire Sahara Desert or the United States be used for producing palmoil based biodiesel? Could any of these options be possible without touching the remaining tropical rainforests in the world?

As far as land usage is concerned, algae is the only source with a potential to replace the entire petroleum usage. But it is still a reasearch topic for many years, far away from being commerically available.

Compiling ffmpeg and vlc from source

Both ffmpeg and vlc are two of the important applications in free software media processing. I wanted to compile both to incorporate latest codecs, x264 and libvpx for video along with aac and libopus for audio. This is what I have done on Debian unstable.

For my purpose, I was compiling these codecs from source. To use the development libraries and headers given by Debian, one has to install the following packages, sudo is used to denote usage of root
``` sudo apt-get install libfaad-dev libfaac-dev libx264-dev libvpx-dev libopus-dev ```

Instead of using the development pacakges provides by Debian, I was compiling and installing these libraries to /opt. To use proper package config paths for both ffmpeg and vlc, one has to do export PKG_CONFIG_PATH or alternatively supply then to the configure script.
``` export PKG_CONFIG_PATH=/opt/lib/pkgconfig ```

``` # faac wget -c http://downloads.sourceforge.net/faac/faac-1.28.tar.gz # faad wget -c http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz # x264 git clone git://git.videolan.org/x264.git # libvpx git clone https://chromium.googlesource.com/webm/libvpx # opus git clone http://git.xiph.org/opus.git # ffmpeg git clone git://source.ffmpeg.org/ffmpeg.git # vlc git clone git://git.videolan.org/vlc.git ```

As I mentioned above, I was using /opt as the prefix. These are the compilation commands used. Replace the number of CPU cores with “-jN” option of make.
``` # faac ./configure --prefix=/opt # comment out line 126 of faac-1.28/common/mp4v2/mpeg4ip.h # strcasestr in case of any compilation error make -jN sudo make install # faad ./configure --prefix=/opt make -jN sudo make install # x264 sudo apt-get install yasm # install dependencies ./configure --prefix=/opt --enable-shared make -jN sudo make install # libvpx sudo apt-get install yasm #install dependencies ./configure --prefix=/opt --enable-vp8 --enable-vp9 --enable-shared make -jN sudo make install # libopus ./autogen.sh ./configure --prefix=/opt make -jN sudo make install ```

ffmpeg

``` # install these extra package dependencies: sudo apt-get install libopenjpeg-dev libvorbis-dev libschroedinger-dev libvpx-dev libopus-dev ./configure --prefix=/opt --extra-cflags='-Wall -g -I/opt/include/' --extra-ldflags='-L/opt/lib/' --enable-avfilter --enable-libschroedinger --enable-libvpx --enable-libspeex --enable-libtheora --enable-libopus --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --enable-runtime-cpudetect --enable-libfaac --enable-libx264 --enable-postproc --enable-swscale --enable-x11grab --enable-libopenjpeg --enable-shared --enable-gpl --enable-nonfree --disable-static --disable-stripping --disable-altivec --disable-armv5te --disable-armv6 --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages make -jN sudo make install ```

vlc

``` # package dependencies: apt-get install libtool gettext cvs libfaad-dev libfaac-dev libswscale-dev libpostproc-dev libqt4-dev libgcrypt20-dev libdbus-1-dev lua5.2 liblua5.2-dev libproxy-dev libdvbpsi-dev liblivemedia-dev libnotify-dev libshout3-dev libdca-dev libflac-dev libmpeg2-4-dev libmpeg3-dev libsdl2-dev libgnutls28-dev libavc1394-dev libsmbclient-dev libtwolame-dev liba52-0.7.4-dev libfribidi-dev libjack-dev libmad0-dev # a few more extra dependencies: apt-get install libcdio-dev libvcdinfo-dev libpulse-dev libxml2-dev libmodplug-dev libnotify-dev libcaca-dev libncursesw5-dev libxpm-dev libxcb-shm0-dev libxcb-xv0-dev libxcb-keysyms1-dev libxcb-randr0-dev libx11-xcb-dev libxcb-composite0-dev ./bootstrap ./configure --prefix=/opt --disable-update-check --disable-gnome --disable-gtk --disable-familiar --disable-fb --enable-sdl --enable-esd --enable-mad --enable-arts --disable-jack --enable-pulse --enable-lirc --enable-a52 --enable-aa --enable-dvbpsi --without-dv-raw1394 --disable-dc1394 --disable-kde --enable-mp4 --enable-dvb --disable-satellite --enable-ogg --enable-vorbis --enable-shout --enable-qt4 --disable-slp --enable-flac --disable-skins --disable-basic-skins --enable-skins2 --enable-freetype --enable-mkv --enable-speex --enable-caca --enable-live555 --enable-libmpeg2 --enable-fribidi --enable-cdio --enable-mod --enable-theora --enable-modplug --enable-gnutls --enable-ffmpeg --enable-ncurses --enable-smb --disable-gnomevfs --enable-bonjour --enable-mpc --enable-vcd --enable-vcdx --enable-twolame --enable-x264 --enable-faad -enable-faac --enable-vpx --enable-opus --enable-xcb --disable-zvbi --enable-telx --enable-mediacontrol-bindings --disable-atmo --enable-taglib --enable-libass --enable-libdca --enable-alsa --disable-dv --disable-dvdnav --disable-notify --enable-v4l --enable-v4l2 --enable-pvr --enable-dvd --without-dvdcss CPPFLAGS='-I/opt/include' CFLAGS='-g -O2 -I/opt/include' LDFLAGS='-L/opt/lib -Wl,--as-needed' CXXFLAGS='-g -O2' PKG_CONFIG_PATH='/opt/lib/pkgconfig:/usr/lib/pkgconfig' make -jN sudo make install ```

Airtel 3G modem E1731 Linux Configuration – Complete guide

Recently I bought an Airtel 3G connection using Huawei E1731Bu-1 USB modem. As usual, I wanted to get it working in Debian GNU/Linux amd64 version. As a first step, installed the following packages using apt-get.

`sudo apt-get install ppp pppconfig wvdial`

Normally this modem is detected properly, but I was curious to know the extra modules loaded when it is connected. So, I tried lsmod before and after connecting the device and found the following extra modules.

cdc_ether, mii, option, usbnet, usbserial, usb_storage, usb_wwan

WvDial

First, I tried to configure wvdial since that seems to be the easiest thing to try. Google gave me reference to PJP’s website.

p://pjps.wordpress.com/tag/linux/

He was kind enough to answer my questions also.

Pon and Poff

WvDial is great. But, I wanted to try Pon and Poff also. They offer a few advantages over wvdial. As an “original” command, many distributions support them out of the box where as wvdial has to be installed separately. There used be a lot of problems in using WvDial on ARM based systems because of getcontext/setcontext support on ARM.

Already I experienced that while using EC1261 Tata Photon, posted the following on Debian forum.

http://forums.debian.net/viewtopic.php?f=7&t=54131

http://forums.debian.net/viewtopic.php?f=5&t=50197

For my Debian desktop, I used pppconfig with the following configuration. But, it did not create a proper /etc/chatscripts/airtel. So, I had to update it to the one given at bottom.

Change 98xxxxxxxx to the mobile number associated with the modem.

pppconfig options

```******************** Create Create a connection```

``` Provider Name: airtel Configure Nameservers (DNS): None Authentication Method for airtel: Peer Authentication Protocol User Name: 98xxxxxxxx Password: 98xxxxxxxx Speed: 460800 Pulse or Tone: Tone Phone Number: *99# Choose Modem Config Method: No Manually Select Modem Port: /dev/ttyUSB0 ```

```Finished Write files and return to main menu. ********************```

For the Debian laptop, instead of using pppconfig, I just copied the following generated files from desktop, set the ownership and permissions properly.

``` cp /path/to/chatscripts/airtel /etc/chatscripts/airtel chown root:dip /etc/chatscripts/airtel chmod 640 /etc/chatscripts/airtel```

``` cp /path/to/ppp/pap-secrets /etc/ppp chown root:root /etc/ppp/pap-secrets chmod 600 /etc/ppp/pap-secrets ```

```cp /path/to/ppp/peers/airtel /etc/ppp/peers/airtel chown root:dip /etc/ppp/peers/airtel chmod 640 /etc/ppp/peers/airtel ```

That is all. You could use pon/poff to connect and disconnect to the network.

```pon airtel poff airtel```

MobilePartner Application

Surprisingly, I could get Airtel application to work. Note that we absolutely do not require this to connect to the network. But, it is good to have it, since it is easy to check 3G Balance using *123*11#. It is also helpful while sending and receiving SMS.

There is a CDROM device associated with the modem. It could be found using the “dmesg” command.

```sr1: scsi-1 drive sr 12:0:0:0: Attached scsi CD-ROM sr1```

That means the device is /dev/sr1. Just mount it and install it.

```sudo mount /dev/sr1 /media/cdrom cp -fr /media/cdrom/Linux /tmp cd /tmp/Linux sudo ./install```

You may find a few errors because it is trying to install “NDIS” driver, but it could be ignored since we are not planning to use NDIS driver to connect to the network. By default it is installed in /usr/local/airtel directory. Start the “/usr/local/airtel/MobilePartner” application.

Configurations

These are the Configurations I used.

/etc/wvdial.conf

```cat /etc/wvdial.conf [Dialer Defaults] Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","airtelgprs.com" Modem Type = Analog Modem ISDN=0 Phone = *99# Username = 98xxxxxxxx Password = 98xxxxxxxx New PPPD = yes Modem = /dev/ttyUSB0 Baud = 460800 Stupid Mode = 1 ```

/etc/chatscripts/airtel

```cat /etc/chatscripts/airtel # This chatfile was generated by pppconfig 2.3.18. # Please do not delete any of the comments. Pppconfig needs them. # # ispauth PAP # abortstring ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED```

``` REPORT CONNECT # modeminit '' ATZ OK 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0' OK 'AT+CGDCONT=1,"IP","airtelgprs.com"' # ispnumber OK-AT-OK "ATDT*99#" # ispconnect CONNECT \d\c # prelogin # ispname # isppassword # postlogin ```

```# end of pppconfig stuff ```

/etc/ppp/pap-secrets

```cat /etc/ppp/pap-secrets # # /etc/ppp/pap-secrets # # This is a pap-secrets file to be used with the AUTO_PPP function of # mgetty. mgetty-0.99 is preconfigured to startup pppd with the login option # which will cause pppd to consult /etc/passwd (and /etc/shadow in turn) # after a user has passed this file. Don't be disturbed therefore by the fact # that this file defines logins with any password for users. /etc/passwd # (again, /etc/shadow, too) will catch passwd mismatches. # # This file should block ALL users that should not be able to do AUTO_PPP. # AUTO_PPP bypasses the usual login program so it's necessary to list all # system userids with regular passwords here. # # ATTENTION: The definitions here can allow users to login without a # password if you don't use the login option of pppd! The mgetty Debian # package already provides this option; make sure you don't change that.```

``` # INBOUND connections # Every regular user can use PPP and has to use passwords from /etc/passwd * hostname "" * # UserIDs that cannot use PPP at all. Check your /etc/passwd and add any # other accounts that should not be able to use pppd! guest hostname "*" - master hostname "*" - root hostname "*" - support hostname "*" - stats hostname "*" - # OUTBOUND connections # Here you should add your userid password to connect to your providers via # PAP. The * means that the password is to be used for ANY host you connect # to. Thus you do not have to worry about the foreign machine name. Just # replace password with your password. # If you have different providers with different passwords then you better # remove the following line. # * password ```

```"98xxxxxxxx" airtel "98xxxxxxxx" ```

/etc/ppp/peers/airtel

```cat /etc/ppp/peers/airtel # This optionfile was generated by pppconfig 2.3.18. # # hide-password noauth connect "/usr/sbin/chat -v -f /etc/chatscripts/airtel" debug /dev/ttyUSB0 460800 defaultroute noipdefault user "98xxxxxxxx" remotename airtel ```

An environmental lesson from the Soviet Union

Ships of the desert grazing near deserted ships in Aral Sea desert

Baikonur Cosmodrome, Kazakhstan – First ever window to space. Beginning of the space age was one of the greatest achievements of mankind since the dawn of civilization. Many space scientists, explorers and researchers had gone through the arid steppes of this small Central Asian town. That list includes Sputnik scientists, Yuri Gagarin and many of the International Space Station travelers.

Double Humped Wild Bactrian Camels grazing near abandoned ships in Aral Sea desert

Just 250 km north west of Baikonur lies another small town, supposed to be on the banks of Aral Sea, named Aralsk. Aral Sea was the 4th largest lake by area and 12th largest lake by volume until 1960. It had an area of 68000 square kilometers and a volume of 1100 cubic kilometers. The lake had one third salinity of sea water at around 10g/L. It was fed by two of the largest river ecosystems of Central Asia namely Amu Darya and Syr Darya. Historically known as Oxus and Jaxtares, these two rivers were very famous throughout the Achaemenid Persian, Greek and Arab periods. Amu Darya and Syr Darya have a mean discharge of 97.4 cubic kilometers and 37 cubic kilometers respectively. Source of their water is from the glaciers of Pamir and Tian Shan mountains. Rain water could not contribute much as these steppes are extremely arid with a rainfall of around 30 cm / 12 inches. Temperature could go anywhere between -45 Degree Celsius to 45 Degree Celsius depending upon seasons.

Aral Sea is shared between both Kazakhstan and Uzbekistan. Until around 1960 two towns flourished on the banks of Aral Sea, Aralsk on the north east in Kazakhstan and Muynak on the south west in Uzbekistan. Both were important fishing towns with harbors and processing industry. Uzbekistan used to get around 60% of their fish, that is 25000 tonnes of fish from Aral Sea itself

Things started changing around 1955-1960 when Soviet Union started to improve their agriculture output. Many dams and canals were built to divert large amount of water for irrigation. This reduced the amount of water reaching Aral Sea drastically and Aral Sea started getting dried up very fast. Currently Aral sea got split up into 4 lakes including North Aral Sea and South Aral Sea with a total area of around 6800 square kilometers which is only 10% of its original size. Lake salinity got increased to around 100g/L destroying all fish in the lake.

Aral Sea: Map vs. Satellite image

Cotton Production:

Cotton production also took off like the Soviet space program during 1960s. Uzbekistan’s production increases from 300000 MT in 1950 to around 3 Million MT in mid 1980s. Most of the the cotton was cultivated as a monoculture without crop rotation. This required huge amount of pesticides and chemical fertilizers. Lots of pesticides and fertilizers reached Aral Sea due to run off. Cotton requires large amount of water and virtually all of this water is sourced from Amu Darya and Syr Darya.

Per Capital Water Usage:

Central Asian countries of Turkmenistan, Kazakhstan and Uzbekistan have the highest per capital water usages. Most of the water is sourced from Amu Darya and Syr Darya and used for irrigating cotton plantations.

Per Capital Water Usage of Countries

Environmental issues:

There are many environmental problems associated with aral sea crisis. Farming without crop rotation depletes soil of nutrients and increases the salt content in the soil. Cotton production of Uzbekistan went down by half from its peak values during 1980s.

Aralkum is the new desert appeared on the dried up seabed of Aral Sea. It is estimated that Aralkum has an area of around 55000 square kilometers. It is a mixture of sand, salt, run-off pesticides and fertilizers. About 200000 Tonnes of salt and sand are carried by the wind from Aral Sea everyday and dumped withing 300 km radius. This pollution is decreasing available agricultural area due to salt content. This increases respiratory problems in people. There have been instances of this pollution reaching as far as the Arctic north of Russia.

A view from Muynak Port in Uzbekistan: abandoned ships

Difference approaches of Kazakhstan and Uzbekistan

Out of all countries in the Amu Darya and Syr Darya region, Kazakhstan is taking some effort to restore North Aral Sea. They have created Kok Aral Dam in 2005 with the help of World Bank spending \$64 Million. This dam traps water from Syr Darya and redirect it back to North Aral Sea. Due to this water levels in North Aral Sea is increasing and its salinity is going down. Aralsk used to be around 100 km away from North Aral Sea in 2005, but after the construction of the Dam it is around 6 km away. Also area of North Aral Sea got increased from around 2550 square km in 2003 to 3300 square km in 2008.

Cranes near dried up Aral Sea in Aralsk port, Kazakhstan

On the other side, Uzbekistan has not done anything practically to restore Aral Sea. Some figures says that around 50000 people of Karakalpakstan region of Uzbekistan have already left their places due to pollution.

Hope Central Asian countries would give more importance to restoring Aral Sea to its original form.