Tuesday, 26 January 2021

How to make breaking a simple substitution cipher harder

 



As you may be aware, simple substitution ciphers can be cracked quite easily, especially if your text is long. Still, there are ways to make things a little difficult for any potential code breakers trying to crack it.

Strategy one: Hide the spaces

Letter lengths can clue someone in on standalone letters like ‘a’ and ‘I’, or common doubles and triples such as ‘so’, ‘to’, ‘on’, ‘the’, etc. One way to obscure these is to hide your spaces. One option is to remove them completely, but it can lead to ambiguity, as you don't know where one word ends and the other begins. This is especially true with complicated words and place names.

You can also hide them in the ciphertext by replacing spaces with an uncommon letter, say, z in plaintext, likezthis.zIfzyouzarezwritingzinzEngllish,zthezletterszZzandzQzarezsuitablezforzthis.

Once you cipher it, you'll get a solid block of text. This will make short words less obvious visually. However, it can be cracked, because when you do the frequency count, guess what will be the most numerous? The character you replaced space with. For example, this paragraph has fifty eight spaces and thirty five examples of the character E.

In addition to that, when it comes to doubles and triplets, there is statistical data available on the most common pairs and triples in the English language. This data can also be used to break the cipher, again, provided your ciphertext is long enough.

Strategy two: Change your alphabet

What we’ve done so far uses just the 26 letters of the English alphabet. You can mix it up by separating upper and lowercase letters like so:





You can make it even more complicated with numbers and punctuation, or even the space character. Or you could include symbols and Greek letters. I won't judge you.

There are two reasons this approach works. One, the alphabet is larger, which means that the probability distribution has to be calculated over a larger number of characters. Often, these frequency tables are harder to obtain if not impossible. If you throw a few numbers and punctuation into the mix, it’s all but impossible.

The second is, a larger number of possible characters also means you need more text for the typical distribution of letters to show up.

At the end of the day, though, you’re still working with a simple substitution cipher. The most numerous character will be space, followed by lowercase e. Based on that, you can crack the rest. That's a weakness of simple substitution ciphers in general. You could complicate things by replacing characters, but there is a limit to what they can do to secure your cipher.

If you have any other strategies to make breaking the cipher harder, please tell me more in the comments. 

You can follow me on Facebook here or on YouTube here.

See you next time!


Wednesday, 20 January 2021

Is 'said' a good dialogue tag?

 



To make my stance on the issue clear – I prefer a mixture of no dialogue tags and ‘said’. I know not everyone agrees with me, and in fact, I know most of my English teachers do not agree with me, but hear me out.

I’ll start with an example. 

Example 1: Anything but said

It’s the same dialogue, written in four different ways. The first: Here, dialogue tags are used every time, but if ‘said’ can be avoided, it is avoided.


This may not be the best representation of that kind of writing, but that’s mostly because I actively dislike this type of writing. My problem with it is that it leaves nothing to the reader’s imagination. It treats the reader like an idiot. On top of that, it adds emphasis everywhere, dulling the effect for when you really need to hammer the point home.

Example 2: Always said

Here, too, the speaker is indicated every time, and ‘said’ is used except when it’s necessary to use a different dialogue tag.



As far as I am concerned, this is actually better than the previous one. True, it doesn’t demonstrate your superior vocabulary, but the dialogue tag is mostly invisible here. More importantly, the reader can fill in some of the nuance themselves and the text isn't screaming at them all the time.

There is still not perfect, or as perfect as a writing style can be. It’s necessary to indicate the speaker every time. Besides, even an invisible word can start to stand out if it’s overused.

Example 3: Said + no dialogue tags

The third: this avoids dialogue tags when possible, but uses said when you need a dialogue tag to indicate the speaker.


Full disclosure, this is my preferred method. The reader has quite a lot they can fill in, but the gaps in information aren’t so large that they can’t be bridged. I, for one, like to assume that my readers are paying some attention and are intelligent. 

When you need a dialogue tag, you can use something fairly innocuous, like said. When there’s a back and forth between two people and it’s clear that it is the case, you can avoid dialogue tags for, say, a few lines.

But please, for the sake of whatever you believe in, do not have a back and forth conversation of three pages with no reminder of who’s saying what.

About that,

Example 4: There are no dialogue tags

This avoids dialogue tags altogether, instead using action and the rhythm of the conversation to indicate who’s speaking.



This one works too, but it requires quite a bit of work on the reader’s part in order to make sense of what is going on. The reader needs to be paying attention all the time - face it, no writer is that good at pacing. Besides, it’s fine for a ~100 word conversation, but with longer texts, it's easy to lose track of who's saying what. That ambiguity can change the interpretation of a scene completely.

That was my two cents on the topic. Do let me know what you think of it in the comments. 

You can follow me on Facebook here or on YouTube here.

See you next time!

Thursday, 14 January 2021

Introduction to airships


 


This is a follow up from the article on types of flight. Here, we’ll be taking a further look at airships. 

I’m sure most of you know what an airship is already. You might be familiar with advertising blimps. You may have seen old photos. Perhaps, you’ve encountered the Hindenburg disaster in your physics lesson about electricity (that’s how I encountered it).

These are pretty interesting, actually, because they are almost ridiculously efficient in terms of energy requirement. That’s mainly why it looks like they will make a comeback. To be precise, it’s hybrid airships making a comeback, but they are a topic for another time. The main focus here is your traditional airship.

First things first, we’ll look at a diagram of an airship.



The big balloon on top (blue) is the envelope. That is a large balloon-like structure filled with a gas lighter than air. This is what keeps the airship airborne.

The gas inside the envelope is called the lifting gas. As it is lighter than air and because there is such a lot of it relative to the rest of the structure, it makes the overall structure less dense than air. This means it experiences an upthrust that is higher than its weight, making in float. This happens until the upthrust and weight balance. As air gets less dense with altitude, you will reach an altitude where the upthrust that the airship experiences is the same as its weight, and that will be where your airship floats.

The gas itself is usually Helium on modern airships. It is very light and extremely safe, but our supply of helium is limited. As a result, it’s expensive.

Hydrogen has been used historically. The problem with hydrogen is that it is flammable when mixed with air, so if the envelope leaks and something sets the mixture on fire, the whole airship can burn up. However, pure hydrogen is not flammable, so if you have a spark inside a container of pure hydrogen, nothing with happen. Preventing leaks completely on a moving ship, especially one with a mostly flexible, thin exterior can be very difficult if not impossible. That is why it’s not used in great quantities anymore.

Another option is hot air. You can use a burner to heat air inside the envelope. Air expands when heated, which reduces its density, essentially making it lighter than the air outside the envelope. Air is not a limited resource, and here, the lifting gas itself is not flammable. The problem here is that you will need a fuel supply. You can burn a fuel like kerosene, or you can use electric heaters inside the balloon.

With this method, the fuel weight can become significant. This can be true for batteries or solar panels as well. Besides, if you’re burning your fuel, you’ll be losing fuel weight throughout the journey, making the balloon lighter throughout the journey. You will have to compensate for that when flying. Besides, the fuel itself can be flammable, or in the case of batteries, explosive.

All said, however, it’s a happy medium, as long as all the risks are managed.

For a writing project, you can always make up a lifting gas (provided you’re writing fantasy), along with its properties, availability, price, and all that. Another possibility is using a vacuum. It will lift the airship alright, but the envelope will have to be very strong, and altitude control will be a bit of a problem. I will probably discuss this in detail later. (Look, I’m a flying obsessed mechatronics engineer, what else do you expect?)

Going back to the diagram, the small section below the envelope (green) is your gondola. That’s the section for passengers, crew, storage, and fuel. The gondola can be quite roomy for the number of passengers it can carry (due to the need to maintain a low weight). It also means the gondola needs some form of communication between its various areas. It’s probably a bit like being on a ship.

You may have noticed the engine (yellow) on the diagram. That is what provides power for forward motion. Usually, they would be fitted with a propeller, as few other types of propulsion make sense for the speed an airship flies at. The actual engine type can be pretty much anything you’d see on a propeller-driven plane. I’ll elaborate on this later. The engines are usually fitted on the sides of the gondola to allow differential thrust for steering.

The fuel for the engines can be pretty much anything. You could use an electric motor, powered by a battery or even solar power. You can use a conventional fuel like diesel or petrol or even biogas.  

The airship in the diagram has a vertical stabilizer and rudder, as well as horizontal control surfaces. These will be covered in more detail in later as I would go off on a 20,000 word tangent if I tried to cover it here.

The main disadvantages of an airship, compared to a conventional airplane, are,

  •      Lower speeds, as the envelope’s enormous cross-section produces a lot of drag (I’ll explain it in more detail, I promise. I am aware it’s a lot of things to explain later).
  •      Lower service ceiling in general. This is dependent on the difference in density between the lifting gas and the surrounding air, how much lifting gas there is, and the weight of the airship overall. As a result, it’s capped by the possible size of the envelope.
  •      Properties of the lifting gas can make it a fire hazard.
  •      Huge, slow moving target if anyone wants to take a pot shot at it. This can be especially dangerous if the lifting gas is flammable.
  •    Susceptible to weather, as it is large and slow moving.

Advantages are:

  •      Lower fuel requirement, as there is no energy needed to provide lift (under most circumstances).
  •     Can stay aloft forever (there will be some gas leakage, but well, for a very long time). Is great for sightseeing and observation as a result.
  •     Not so easily brought down by enemy fire, unless it catches fire. A bullet hole will produce a hole that is so small that it can take hours for the envelope to deflate completely, giving enough time for a safe landing.
  •      If used for passenger transport, the sheer amount of space on it compared to an airliner. You wouldn’t be cramped into one seat for eight hours, instead you can walk around, sleep, eat, and enjoy the view for two days. It’s up to you whether it’s actually an advantage, honestly.

That’s it for a brief introduction. I promise I will follow up on everything I promised to follow up, but that’s all for now. 


The painting in the video is available here. 

You can follow me on Facebook here or on YouTube here.


 See you next time!

Friday, 8 January 2021

How to break a simple substitution cipher

 



G KWTB UNNH NUEWSO BNZB TE BOPB BON VNBBNMT PMN HGTBMGAWBNH GU P IPUUNM BJFGYPV ED

BON NUSVGTO VPUSWPSN TE BOPB GB YPU AN AMEQNU WTGUS TBPBGTBGYPV INBOEHT.

UNNHVNTT BE TPJ, FPMPSMPFOT BOPB PREGH P FPMBGYWVPM VNBBNM XGVV AN IEMN

YEIFVGYPBNH.

BON VEUSNM JEWM BNZB, BON IEMN EARGEWT BONTN FPBBNMUT XGVV ANYEIN. DEM

NZPIFVN, GD JEW XNMN BE PUPVJTN PU NUBGMN AEEQ, JEW XGVV TNN P RNMJ

BJFGYPV HGTBMGAWBGEU.


Look at the text above. You are given that it is in English, and that it is a simple substitution cipher. The text is in the description below.

Here, the focus is on breaking the cipher. Do take a look at the video above for an explanation. 

Breaking the cipher means we’re not starting with the key. i.e., we don’t know which letter maps to which.

There are several ways to start with this. One of the easiest is to start with statistics – just count the number of times a particular letter appears in a text.

You can find this information on Wikipedia – go to the article on letter frequency. It shows you the relative frequency of letters in English. There are two sets of statistics, for texts and for dictionaries. We need to look at texts, because we are trying to decipher a paragraph.

What we see right away is that the letter with the highest frequency is E, which accounts for 13% of texts. The next highest are A and T, which accounts for 8.2% and 9.1% of texts respectively.

In order to apply this information, let’s put our text into a frequency counter. You can find several of these online, or you can make your own. Or you can count it yourself, I won’t judge.

The frequencies I get are show on the screen:

A

8

N

44

B

38

O

12

C

0

P

28

D

3

Q

2

E

23

R

3

F

8

S

7

G

23

T

20

H

8

U

17

I

7

V

19

J

8

W

11

K

1

X

4

L

0

Y

8

M

20

Z

3

 

As you can see, N has the highest frequency. So a safe bet would be to assume that it is E.

G KWTB UeeH eUEWSO BeZB TE BOPB BOe VeBBeMT PMe HGTBMGAWBeH GU P IPUUeM BJFGYPV

ED BOe eUSVGTO VPUSWPSe TE BOPB GB YPU Ae AMEQeU WTGUS TBPBGTBGYPV IeBOEHT.

UeeHVeTT BE TPJ, FPMPSMPFOT BOPB PREGH P FPMBGYWVPM VeBBeM XGVV Ae IEMe

YEIFVGYPBeH.

BOe VEUSeM JEWM BeZB, BOe IEMe EARGEWT BOeTe FPBBeMUT XGVV AeYEIe. DEM

eZPIFVe, GD JEW XeMe BE PUPVJTe PU eUBGMe AEEQ, JEW XGVV Tee P ReMJ

BJFGYPV HGTBMGAWBGEU.

Yes, I did a case sensitive search and replace, which you should be able to do with any good word processor.

One thing you might notice immediately is the triplet BOe. It appears four times in the short text. It could be ‘THE’, In order to confirm that, we can look at our letter frequencies. As expected, B has a frequency of 38, and is the second most numerous letter. It would be safe to assume B = T, and therefore, that BOe = the. Let’s replace B with T and O with H.

G KWTt UeeH eUEWSh teZt TE thPt the VetteMT PMe HGTtMGAWteH GU P IPUUeM tJFGYPV

ED the eUSVGTh VPUSWPSe TE thPt Gt YPU Ae AMEQeU WTGUS TtPtGTtGYPV IethEHT.

UeeHVeTT tE TPJ, FPMPSMPFhT thPt PREGH P FPMtGYWVPM VetteM XGVV Ae IEMe

YEIFVGYPteH.

the VEUSeM JEWM teZt, the IEMe EARGEWT theTe FPtteMUT XGVV AeYEIe. DEM

eZPIFVe, GD JEW XeMe tE PUPVJTe PU eUtGMe AEEQ, JEW XGVV Tee P ReMJ

tJFGYPV HGTtMGAWtGEU.

 

Here, 'thPt' looks a lot like ‘that’. You might also notice that P appears by itself quite a lot. It has a frequency of 28, which is quite high. So, P = A looks like a good assumption.

G KWTt UeeH eUEWSh teZt TE that the VetteMT aMe HGTtMGAWteH GU a IaUUeM tJFGYaV

ED the eUSVGTh VaUSWaSe TE that Gt YaU Ae AMEQeU WTGUS TtatGTtGYaV IethEHT.

UeeHVeTT tE TaJ, FaMaSMaFhT that aREGH a FaMtGYWVaM VetteM XGVV Ae IEMe

YEIFVGYateH.

the VEUSeM JEWM teZt, the IEMe EARGEWT theTe FatteMUT XGVV AeYEIe. DEM

eZaIFVe, GD JEW XeMe tE aUaVJTe aU eUtGMe AEEQ, JEW XGVV Tee a ReMJ

tJFGYaV HGTtMGAWtGEU.

The only other standalone letter that appears frequently in English is I, and the only other standalone letter in the cipher is G. The frequency is 23, which is good enough to proceed. Another interesting observation is ‘tE’, and that can only be ‘to’. Frequency for ‘E’ is 23, which is good enough. Let’s replace G with I and E with O.

i KWTt UeeH eUoWSh teZt To that the VetteMT aMe HiTtMiAWteH iU a IaUUeM tJFiYaV

oD the eUSViTh VaUSWaSe To that it YaU Ae AMoQeU WTiUS TtatiTtiYaV IethoHT.

UeeHVeTT to TaJ, FaMaSMaFhT that aRoiH a FaMtiYWVaM VetteM XiVV Ae IoMe

YoIFViYateH.

the VoUSeM JoWM teZt, the IoMe oARioWT theTe FatteMUT XiVV AeYoIe. DoM

eZaIFVe, iD JoW XeMe to aUaVJTe aU eUtiMe AooQ, JoW XiVV Tee a ReMJ

tJFiYaV HiTtMiAWtioU

‘T’ looks pretty consistent with ‘S’, as you have ‘To’, ‘Tee’, a frequency of 20, and quite a few words that begin with it. Let’s go ahead and replace it. At this point, this is mostly an art. The result is:

i KWst UeeH eUoWSh teZt so that the VetteMs aMe HistMiAWteH iU a IaUUeM tJFiYaV

oD the eUSVish VaUSWaSe so that it YaU Ae AMoQeU WsiUS statistiYaV IethoHs.

UeeHVess to saJ, FaMaSMaFhs that aRoiH a FaMtiYWVaM VetteM XiVV Ae IoMe

YoIFViYateH.

the VoUSeM JoWM teZt, the IoMe oARioWs these FatteMUs XiVV AeYoIe. DoM

eZaIFVe, iD JoW XeMe to aUaVJse aU eUtiMe AooQ, JoW XiVV see a ReMJ
tJFiYaV HistMiAWtioU.

 

Let’s take another look at the frequencies table. N and R are two high frequency letters that aren’t accounted for yet. M has a frequency of 20, and ‘aMe’ looks like a tell. Let’s assume it’s R. If you are wrong, you can always go back.

i KWst UeeH eUoWSh teZt so that the Vetters are HistriAWteH iU a IaUUer tJFiYaV

oD the eUSVish VaUSWaSe so that it YaU Ae AroQeU WsiUS statistiYaV IethoHs.

UeeHVess to saJ, FaraSraFhs that aRoiH a FartiYWVar Vetter XiVV Ae Iore

YoIFViYateH.

the VoUSer JoWr teZt, the Iore oARioWs these FatterUs XiVV AeYoIe. Dor

eZaIFVe, iD JoW Xere to aUaVJse aU eUtire AooQ, JoW XiVV see a RerJ

tJFiYaV HistriAWtioU. 

From here on, you need to see if you can spot any probable words, and start replacing letters. ‘Vetters’ could be ‘letters’, ‘D’ could be ‘f’ (‘oD’ and ‘Dor’), ‘F’ looks like it could be ‘P’, and ‘U’ could be ‘N’. Let’s replace these, and see it if makes sense.

i KWst neeH enoWSh teZt so that the letters are HistriAWteH in a Ianner tJpiYal

of the enSlish lanSWaSe so that it Yan Ae AroQen WsinS statistiYal IethoHs.

neeHless to saJ, paraSraphs that aRoiH a partiYWlar letter Xill Ae Iore

YoIpliYateH.

the lonSer JoWr teZt, the Iore oARioWs these patterns Xill AeYoIe. for

eZaIple, if JoW Xere to analJse an entire AooQ, JoW Xill see a RerJ

tJpiYal HistriAWtion.

Now, ‘S’ can be replaced with ‘G’, ‘W’ with U, and ‘Y’ with C, ‘H’ with D, and ‘X’ with W. These were based on common words you can identify from the text.

i Kust need enough teZt so that the letters are distriAuted in a Ianner tJpical

of the english language so that it can Ae AroQen using statistical Iethods.

needless to saJ, paragraphs that aRoid a particular letter will Ae Iore

coIplicated.

the longer Jour teZt, the Iore oARious these patterns will AecoIe. for

eZaIple, if Jou were to analJse an entire AooQ, Jou will see a RerJ

tJpical distriAution. 

From observation, we can now get ‘Z’ = X, ‘A’ = B, ‘J’ = Y, ‘K’ = J, ‘I’  =M, ‘R’ = V. Do the replacements.

i just need enough text so that the letters are distributed in a manner typical

of the english language so that it can be broQen using statistical methods.

needless to say, paragraphs that avoid a particular letter will be more

complicated.

the longer your text, the more obvious these patterns will become. for

example, if you were to analyse an entire booQ, you will see a very

typical distribution. 

By now, it’s obvious that ‘Q’ = K. Just replace it, and you have your deciphered message.

i just need enough text so that the letters are distributed in a manner typical

of the english language so that it can be broken using statistical methods.

needless to say, paragraphs that avoid a particular letter will be more

complicated.

the longer your text, the more obvious these patterns will become. for

example, if you were to analyse an entire book, you will see a very

typical distribution.

 

This method works provided your message is long enough. If your message is not in English, you need the frequency tables for the language you’re working with.

If you know you’re working with a Caesar cipher, the first letter you definitively break will give you the key right away. Use that to find your shift, and just decode the whole message normally. If you can’t find anything definitive, you can just break the whole message normally anyway.

Go ahead and try this, and let me know how it goes.

You can follow me on Facebook here or on YouTube here.

 See you next time!




Monday, 28 December 2020

How can a vehicle fly?

 

How does a flying vehicle achieve flight?

Basically, there are four main ways to do this. It's all explained in the video below. Do take a look.


A summary of the contents of the video are given below.


Method one: Lighter than air

To achieve this, a vehicle must be lighter than air. Think of, say, a helium balloon, or a hot air balloon, or an airship. This type of flight uses the Archimedes principle to be airborne. Basically, the upthrust on anything in a fluid is equal to the weight of the fluid it displaces. If a vehicles displaces more air (in terms of weight) than itself, it will float.

It’s pretty easy to accomplish, if you can find a gas that is lighter than your ambient air. Helium can be pretty expensive. Hydrogen is an option, but it’s very flammable when mixed with air. Hot air is a pretty good compromise (the gas itself is not flammable), but you need a fuel source to, well, heat the hot air.

In this type of flight, you can change altitude by changing the overall density of your vehicle. This may be by reducing the amount of your lightweight gas (to loose altitude) or dropping something heavy like basalt (to gain altitude).


Method two: The reaction from a downwards force

Here, you can direct air downwards to create an upwards force that keeps your vehicle airborne. Think helicopters and jet packs. The advantage here is you can take off from pretty much anywhere and the vehicle isn’t massive like in the previous case.

The disadvantage is fuel requirement. A helicopter is more efficient than a jet pack, but you still need to produce enough lift to counteract the vehicle’s weight.


Method three: Fixed wing

Here, you use the shape of a lifting surface (wings or the whole vehicle) to create an upwards force based on speed. This is generally more efficient than straight up producing the thrust to lift it up. Think airliners and general aviation and fighter jets. These are, unsurprisingly, fast.

You can also have the unpowered version in gliders, where you can use air currents to generate the lift you need.

The problem is landing and takeoff. You need a long, clear area to take off and land. Because of the high speeds and the proximity to the ground, landings and takeoffs can be relatively dangerous. Modern airliners and airports are designed to be very safe. However, if you’re dealing with, say, the early days of aviation or a society that is just discovering this type of flight, it could be a point you can consider.

Method four: Flapping wing

This is what’s seen in most birds (the larger ones who glide a lot mix it up with fixed with flight quite a bit, and smaller ones may be going into a completely different type of flight). 

There have been man-sized ornithopters (as they are called) as well.

It’s pretty efficient, but the problem mechanical complexity if you want to make a machine that uses this type of flight. You can take off from most places (heavier birds still need a runup), and you can change to the more efficient and faster fixed wing flight once you’ve taken off or if you want to glide.

In short...

These are not the only ways you can achieve flight, but these are the most practical methods for vehicle sized things.

Expect more flight related videos and articles in the future.

Please let me know what you think in the comments, and please ask if you have any questions.

See you next time!


Thursday, 28 November 2019

Travelling by train in office traffic in Sri Lanka - problems and a proposed solution


Travelling by train in office traffic in Sri Lanka - problems and a proposed solution


I travel by train quite regularly - that's how I go to work, in fact. I use it because it's faster than travelling by road, and is the only real practical way to get to work on time. I am sure there's quite a few people who use it for the same reason.

However, that does not mean that it doesn't come with a lot - and I mean a lot of problems.

The problems


The first, of course, is overcrowding. If you ever get on a train during the office traffic - ~06:20 to 08:30 or so in the morning, and about 04:00 to 07:00 in the evening, your options would be to be packed like sardines in a can, or to hang on to dear life on the footboard.

The second is the utter inability of the system to deal with any kind of failure, and the tendency for those failures to propagate through the entire system. For instance, a train broke down on the main line on the 26th (Tuesday), resulting in delays propagating all the way to the coastal line. The same thing happened on 29th (Friday), when two trains broke down simultaneously on the main line and Puttalam line (Murphy's law, anyone?), causing delays on the coastal line, again. Both these trains were to destinations on the coastal line (Ratmalana and Panadura).

This lack of robustness is a serious problem, given that many trains in service are quite ancient.

The cause

The cause is the chaotic mess that is our railway system.

There are three types of trains - slow, express, and semi-express. The slow train stops at all stations. However, it is literally slow as signals appear to have it out for this poor creature. The express or intercity stops at a few select locations - usually rather large stations along its route. They usually have priority. The last is a breed that it increasing in numbers - the semi-express. The semi-express is a cross between the slow and the express, being express between certain stations and slow between others (say, express from fort to Veyangoda and slow beyond).

The infrastructure is as follows: there are four tracks from Fort to Maradana, and three from Maradana to Ragama. There are two tracks from Fort to Wadduwa, Ragama to Rambukkana (according to the map, but I'm not sure), and Ragama to Ja-ela. The rest, including the Kelaniweli line that runs right through Colombo, are single track.

Thanks to these limitations and a firefighting approach to passenger transport, the Sri Lankan railway system has settled into a well choreographed dance of sorts to keep all its trains moving. There are express trains to Jaffna, Kandy, and various other destinations leaving Colombo during office traffic, and these have to be sent to their destinations as fast as possible. On top of that, there are multiple office trains coming in/going out. Some of these are semi-express, so they have to be sent before the slow trains, lest the semi-express has to stop at all stations.

And, therein lies the issue. Thanks to this dance, it is nearly impossible to add more trains, as any more will take away any advantage that the semi-express and express may have. To pull off this circus, some ridiculous steps have been taken - like that one train that stops at all stations up to Panadura except four random stations, which is preceded by another to Moratuwa that stops at all stations up to Bambalapitiya and at two of the stations that the other will miss. I could not figure out the reason for this one yet. The 05:18 pm from Fort (starts somewhere on the southern line) misses Wellawatta (and only that) , in order to make way for an express that follows it.

Further, this results in more delays for slow trains. Many slow trains on the main line and Puttalam line hold at Ragama for their express or semi-express counterpart to overtake them, even if said express gets five to ten minutes late, since there is simply no way to manage the track otherwise.

The Solution


These issues can be solved using the existing infrastructure. Perhaps, you will need more trains. The solution is as follows.

1. There will be no express / semi-express trains during office traffic.

Please put the pitchforks down and hear me out.

The point about express trains is clear enough, I hope - The train to Jaffna at seven odd isn't going to get there until about mid-day, and very few people will be travelling on it with a real time constraint. The express does not have to leave at that time. It can leave after the office traffic has cleared, or it can leave before - since one can always nap on an express without any fear of missing your stop.

I, too, am a regular traveller on the semi-express. However, the amount of resources that it consumes it terms of track time is simple too much. Most of these trains are either double power sets or very long trains these days, and yet they are always filled to capacity. It's not possible to make these trains any bigger to solve the overcrowding issue. One can't simple add more of them, since they miss stops and something has to hit those stations as well. They also cost a lot in terms of robustness, since they cross several sections of track.

2. No train shall cross track sections, especially during busy hours.

What the system lacks is defined sections of track. Ideally, the sections should be: Fort to Ragama, Fort to Wadduwa, Ragama to Rambukkana (or Veyangoda, or Gampaha, depending on the number of trains available), etc. I hope you see the pattern - break track sections along the logical dividing points, based on infrastructure or traffic volume. That way, a failure at one point won't affect the entire system.

3. Slow trains at a set frequency on a loop

The final part of the solution is to run slow trains on these track sections on a loop, at a set frequency. For example, you could have a slow train from Ragama to fort every five minutes during peak hours. The same train could return (as a slow train) to Ragama, to start its next trip. You can also send an occasional express through on this track section, as you have a third track, or operate an express service between Fort an Ragama using a single train.

For two track sections, again, you can have slow trains at fixed intervals, so a train reaches any given station in both directions every five to ten minutes. There is really no way to deal with single track sections other than the way they do it now, though.

Then there is the other recurring issue - the night mail that actually turns up at seven in the morning. If that happens, the solution is simple - it will become a slow train and fall in line. It is inconvenient for that particular train, but it is for the greater good.

The theory is that there would be a train available regardless of when you actually come to the station. This will stagger the traffic, so to speak - schools start at seven thirty, and starting times for work vary from as early as eight to as late as nine thirty - and any given train will not be that crowded.

This method would also help traffic at railway crossings, especially if the two trains could be timed to arrive almost simultaneously. If a train breaks down, the two sides will have to be staggered, but could probably be managed with minimal disruption as well. Most importantly, it will not result in a cascade of delays and cancelled trains throughout the entire system.

Some final thoughts

There is a lot of room for improvement in the current system, and these are not the only issues (has anyone else gotten into a train and thought, 'this is pointed in the right direction but I wonder where it is going.'). However, this is a major issue, which is why I decided to write an article on it.

The proposed system would make my daily commute to work more complicated, true, but I believe that, overall, it will cut travel times. Travel time isn't just the time spent on the train (though under current circumstances, it is the most unpleasant), it also includes time spent at the station. All of us have been to the station as the train we aimed for was leaving, forcing us to wait another half an hour to an hour for the next train to finally show up (if it was on time).

Further, there is the sheer exhaustion caused by the journey, leaving all of us needing some time to recover before we can actually start working productively. This system would also increase the comfort level of the journey.

Ideally, it should be possible to implement this at other times as well, but the expresses still have to operate, and we have to use the infrastructure we have, at least in the short term. Still, regular trains during high-traffic times would solve the worst of the problems.

I doubt anyone will take this proposal seriously, but I suppose one can dream that one day, one's commute will be a commute instead of a test of willpower.

Tell me what you think in the comments below.

Until next time,
Falcon-15-X-C



Thursday, 28 March 2019

On giant mecha - how practical are they?


You know exactly what I am talking about. You've probably run into them at some point, be it through films or some form of animation. This article will be about their practicality, with current technology.

So, first things first, can it stand?


Let's look at some figures.
The tire pressure of an aircraft is the pressure it exerts on the ground (the surface area of the tire in contact with the ground changes depending on the weight of the aircraft, keeping the pressure constant). For most commercial aircraft, it's about 200 psi - or 1 379 000 pascals (Newtons per square meter, approximately 137 900 kg per square meter of tire surface). This is designed for the hard surface of runways and taxiways in an airport - such an aircraft can't land on soft ground and not sink into the ground at least and little.
The ground pressure (as it is called), for more everyday things - like humans - is a lot lower. A human exerts about 55 000 pascals when standing, though this can more than twice that when walking / running (source: wikipedia). A passenger can exerts about 205 000 pascals. A mountain bicycle exerts about 245 000 pascals, while a road racing bike exerts about 620 000 pascals. A stiletto heel can exert as much as 3 250 000 pascals - more than an aircraft (which is why they damage floors and many other surfaces).

Let's see what this translates to. If the ground pressure is to be the same as that of a normal vehicle, a 100 tonne mecha would have to have a surface area of (100 x 1000 x 10)/(205 000) = 4.878 m2 in contact with the ground. To stand on 1 foot (and walk), this would require a foot that is about 2 m wide and 2.43 m long. For one that's half that weight, the required area of the foot would be half of that (about 1.5 m x 1.62 m).This is assuming that pressure is distributed fairly evenly by the foot, which is highly unlikely unless it has a rubber sole (which would immediately make kicks about one third as cool). Chances are, if the mecha are made like humans, more weight would be concentrated on the back of the foot.

Still, according to these calculations, a mecha would probably be able to stand on most surfaces.

Part II - can it not collapse under its own weight?

A major issue we face here is the square-cube law: doubling an object's dimensions, which multiplies its surface area by a factor of four, also increases its mass by a factor of eight. This is a problem, because properties like tensile and compressive strength depend on an object's cross-sectional area. So, when you increase it's strength by a factor of 4, you increase its mass by a factor of 8, which means you need more strength to support the increased weight.

Let's compare some comparable structures.

Falcon 1 rocket: Height: 21.2 m, Diameter: 1.7 m, Mass: 27.67 tonnes (source)
Boeing 747-8: Length: 76.25 m, Wingspan: 68.4 m, Mass (Operating empty weight): 220.128 tonnes (source)
Rockwell B-1 Lancer: Length: 44.5 m, Wingspan: 24 m - 42 m (swing wing), Mass: 87.1 tonnes (source)
Falcon 9 rocket: Height: 70 m, Diameter: 3.7 m, Mass: 549.054 tonnes (source)

I chose the Rockwell B-1 Lancer as an example because it includes a rather large moving part - the wing sweep can be changed in flight.

As you can see, chances are, an average mecha will not crumble under its own weight - if it was standing still. So, you can build a statue of it without a problem. However, that is not what we want, we want it to be able to move, to run, to shoot lasers, and to kick other mecha in the face.

So, it needs to move...


Therein lies the problem. To accelerate a part as heavy as a mecha's legs, you are going to need some very powerful motors. For a 20 m, 50 tonne robot, we can assume that its legs are about 10 m tall - approximately half its height. If one third of its weight is in its legs, and the centre of gravity of the leg is one third of the way down the leg from the hip (both are probably conservative estimates), to swing the robot's leg, you will need a torque of (10/3)*((50 000*10)/3) = 555.56 kNm. A 100 kNm motor looks like this (look at the images this page).

In addition to that, to accommodate all that movement, the legs will have to be strong. As in, it should be able to handle being swung at something at high speed, with something heavy attached to the end of it (the foot, the lower leg, and the knee joint, and all associated actuators/sensors) without bending in the middle.

But I got ahead of myself. In order to kick something in the face, the mecha has to reach said target, and if it is, indeed, terrestrial, it has to walk or run there. Walking can be rather complex. One foot has to be taken off the ground, while the weight balances on the other momentarily, and when that foot reaches the ground, the weight must be transferred to it in order to move the other leg. Running can be more taxing still - the mecha has to generate enough force for both feet to leave the ground temporarily. Besides, running exerts a lot of force on the ground (Newton's third law).

All this means a lot of bending moment on the legs, as it balances the body over the heel like an inverted pendulum. To counter this, you need very strong materials for the legs. If you want it to stand on the ground without turning a paved road into quicksand, and if you want reasonable sized motors / actuators, you will need a light-weight material. There are few materials that meet both these requirements.

Provided we found the right material, we still have to move the individual joints. We will need fairly large motors if we are going to use motors. These motors would probably need a lot of current, which introduces a host of other problems (motor control becomes more difficult, and the wires get thicker and heavier, among other things) Another viable option is hydraulics, which will also be very large and very heavy. You will also need a full hydraulics system if you select this option, which also translates to more weight,complexity, and issues with materials. In either case, the actuator we use must be fast,responsive, and very controllable. Finding or manufacturing such actuators will not be easy.

Power?


In order to do all of this, we need a source of power. Given the space constraints and the energy requirement, nuclear might be the only really viable option, but the reactor size will probably have to decrease a little. Power isn't my area of expertise, so I can't say for sure, but I don't think the technology is there quite yet.

Controllability

And now, my favourite part the discussion - how do you make the robot work?

First, you will need to know the robot's starting configuration - how the limbs are positioned, the robot's posture, whether it's stationary or moving, etc. For this, you will need sensors, and a lot of them. You will need to know the position of each motor. You will need to know the tension on the leg beams. You will need accelerometers and gyroscopes, probably in each limb, to measure current linear and rotational acceleration. All this is available, so there is no problem there.

The next problem is judging where the robot is going to step. You can use a radar to map the contours on the ground, and you could also use images from one or more cameras to help you. A laser scanner could also help, but it could be overkill in this case. Again, we have the technology - it's expensive, and difficult to implement, but we definitely have the technology. If there is any problem here, it's creating a transparent window through the foot to get the images necessary.

This information has to be processed. That shouldn't be too hard, but a possible issue is time delays. Chances are, all control will be by a central processor, which will command lower level processors in the limbs, etc, at a high level (at least, that is the design that makes the most sense to me). In order to get it to walk, the arms, legs, torso, and head movements must be coordinated. Delays in transmitting main control commands could potentially throw the whole system out of sync if the problem is bad enough. If the feedback from the limbs, etc. are delayed, or if the data from those sensors are gibberish, that could cause a problem as well. Also, there is the problem of sensors producing readings at different rates, which can be dealt with, but it can cause problems. The long distances can make data transmission errors more likely, but that can be dealt with.

The next problem is the actuators themselves. If my experience teaches me anything, it is that this part is going to be ridiculously difficult. As I mentioned before, finding motors or other actuators that are powerful enough and quick enough would be difficult. I can't be certain about hydraulics, but with motors, controlling it is going to be difficult because finding a motor control circuit that is small enough, and won't heat too much (or burn out) with intermittent operation would be nearly impossible. The other problem is managing space when installing them (though hopefully that wouldn't be too much of a problem with hydraulics.

To summarize,

Sensing and data processing can be done - it won't be easy, but it can be done.
If you can build it, it will be able to walk without sinking a couple of metres into the ground with each step.
Finding material that can be used to build it will be a problem.
Finding a power source is likely impossible right now.
Finding suitable actuators would be very difficult.

The verdict: It's not possible right now, but maybe it will become a reality in the near future. It might not have any practical use, but it'll be an interesting experiment for nerds like us.

You can follow me on Facebook here for news and updates.

Until next time!

How to write a character who is smarter than you

We all have that one character (or few) who is significantly smarter than the writer. So, as a writer, how do you write such a character con...