# TABULA/ChurchClock

## Energy Stored in a Church Clock

Hauling on the rope to lift the heavy weight in the local church tower, Adrian Smith had a thought. His laptop computer kept time just by running idle. How much energy was stored in its battery, and how did this compare with the energy stored in the hanging weight of this ancient clock mechanism?

Quick mental calculations told him that the two were approximately the same.

The weight in the church tower was 800 kg. Its drop was 75 ft. How far should the weight be lifted to exactly equal the energy stored in his laptop battery? If this was more than the 75 ft available, then how much heavier should the weight be made?

Here's how he might have solved the problem using TABULA.

Read TABULA/TabulaGettingStarted to understand the following instructions.

This is version of TABULA/ChurchClock is obsolescent.

It follows the behavior of the old J602 version of TABULA. A new improved Qt version of TABULA is in beta, and will be released soon. Here is a draft of the updated scenario which shows how TABULA has altered. -- Ian Clark <<DateTime(2015-07-04T00:31:14Z)>>

### Preliminaries

To start a fresh t-table, click

You see:

```untitled
```

Let's start by giving our new t-table a title.

Click on the topmost line (at present it's the only line).

The contents of the line (untitled) are echoed in the input box.

Delete the contents of the input box and enter:  Church Clock

You now see:

```Church Clock
```

### Defining item 1: the height of the tower

To add the first item to the empty t-table, click

You now see:

```Church Clock
1        1.000 /   unit
```

The item just created (item 1) is dimensionless [/].

It's not a correct SI-units convention to represent a dimensionless quantity by /. There should be no units at all. But it's helpful to have a placeholder.

The item just created should be automatically selected for you. If not, click item 1 to select it.

Enter:  75 ft

This not only changes the value, but specifies new units, viz [ft].

You can change an item's units at any time. You can even change them to incompatible units unless the item is calculated, or feeds into a calculated item.

Next enter:  'height of tower

The leading apostrophe is not essential here. TABULA can guess that what you've typed is a new name for the item. But the apostrophe tells it for certain.

You now see:

```Church Clock
1 @     75.000 ft  height of tower
```

### Defining item 2: mass of hanging weight

Do the same again to define item 2.

Click

Enter:  800 kg

Enter:  'mass of weight

### Using a physical constant: earth gravity

At this stage it's good to remember a little school physics.

There's a physical constant called the acceleration due to gravity (which scientists call g). You can multiply it by the mass and the height to get the value of potential energy stored in the weight when it gets hauled up to a height of 75 ft.

TABULA has a library of constants, UUC.ijs, and a library of formulas, UUF.ijs. You can edit these scripts to add new constants and formulas.

Click tab: "consts" to show the library of constants. It is fairly long and the user (you) can add to it to make it even longer.

You needn't read it right through just now: you can thin-out the display by entering a search-string in the input field. The word "gravity" would seem a good one to try. But type it as gravit to catch the word gravitational, should it be there.

Type: gravit and press Enter.

A list of lines containing the word "gravity" appears. Among them you should be able to see the one you want.

```9.812865328 m/s^2	[grav]	acceleration; gravity
6.67428e_11 N m^2/kg^2	[G]	gravitational constant
1.622 m/s^2 [moon.g]	moon gravity unit
3.711 m/s^2 [mars.g]	mars gravity unit
```

Select the first line ([grav]) and click "Append".

A new item appears in the t-table (item 3). You'll see it has its own special "earth-gravity" units: [grav]

OBSERVATION: g might seem a better choice to name the gravitational constant. But [g] is already employed (by SI) to mean "grams".

Now multiply the three items together to get what we hope is going to be potential energy.

Select all three items, 1 2 3, and click

On the Macintosh, to select more than one line you may need to hold down the key: ⌘

At this stage the t-table looks like this:

```Church Clock
┌  1       75.000 ft          height of tower
├  2      800.000 kg          mass of weight
├  3        1.000 grav        acceleration; gravity!
└> 4 @  60000.000 ft kg grav  {1}*{2}*{3}
```

Notice that an exclamation mark: ! has appeared on the end of the name of item 3. This is called a hold. It shows the item is shielded from changes whenever backfitting takes place. We'll have reason to be grateful for it later.

Now, have you ever heard of energy units: [ft kg grav]? Be frank: no you haven't. But TABULA isn't fazed.

Click the units dropdown to see other compatible units you can convert them to. There, near the top, you see J for joules. Select it.

And while you're at it, let's show acceleration; gravity in more familiar units.

Select item 3 and click

It has a menu: Edit > Convert to SI Units and a hotkey: Ctrl+Shift+S

Now at last you can see the t-table:

```Church Clock
┌  1       75.000 ft    height of tower
├  2      800.000 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
└> 4 @    1.795E5 J     {1}*{2}*{3}
```

### A library formula for potential energy

In this case it's simple enough to multiply the three items (1, 2, 3) together to get the energy stored in the hanging weight. However, just to demonstrate the facility, let's use a library formula for the potential energy.

Select tab "functs". Enter: energy

You see this line (among others):

```9.812865328*m*h : m(kg),h(m)   [J]  potential energy; earth surface
```

Select it and press "Append".

You now see:

```Church Clock
┌  1       75.000 ft    height of tower
├  2      800.000 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
└> 4      1.795E5 J     {1}*{2}*{3}
┌  5        1.000 kg    m:feeder
├  6        1.000 m     h:feeder
└> 7 @      9.813 J     potential energy; earth surface
```

We see a separate calculation: the calculated line has brought with it its own feeders. We need to merge these with existing items.

Clearly item 5: m:feeder, needs to be merged with item 2:  mass of weight.

Select both lines 2 and 5. Click

NOTE: items are merged downwards, ie the uppermost one must have the value to be retained. Use to move one above the other (not necessary here).

You now see:

```Church Clock
┌  1       75.000 ft    height of tower
┌ ├  2      800.000 kg    mass of weight
│ ├  3        9.813 m/s²  acceleration; gravity!
│ └> 4      1.795E5 J     {1}*{2}*{3}
├    5        1.000 m     h:feeder
└>   6 @   7850.292 J     potential energy; earth surface
```

Line 2 is now feeding into the calculated item, which is now item 6.

Do the same with item 1: height of tower and item 5: h:feeder, merging them by clicking

You now see:

```Church Clock
┌ ┌  1       75.000 ft    height of tower
├ ├  2      800.000 kg    mass of weight
│ ├  3        9.813 m/s²  acceleration; gravity!
│ └> 4      1.795E5 J     {1}*{2}*{3}
└>   5 @    1.795E5 J     potential energy; earth surface
```

and lo-and-behold, calculated items 4 and 5 show the same result!

Keep whichever one you like: we don't need them both.

For the sake of the example, delete item 5.

### The energy in a laptop battery

We turn now to the energy stored in Adrian's laptop battery.

It is rated at 17 V, 3.1 amp-hours [A h]. If we multiply volts by amp-hours we get the stored electrical energy (assuming it stays at 17 V for the whole 3.1 A h we take from it -- which it won't when it's nearly discharged).

Click to create a new item.

Enter: 3.1 A h

Now enter: 'battery charge.

Click to create another new item

Enter: 17 V

Now enter: 'battery potential.

Multiply the two together as before (click ). Then convert to J (joules) by using the units dropdown.

To rename this new item, enter: 'energy stored in battery.

In the same way let's relabel item 4: 'energy stored in hanging weight.

You now see:

```Church Clock
┌  1       75.000 ft    height of tower
├  2      800.000 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
└> 4      1.795E5 J     energy stored in hanging weight
┌  5        3.100 A h   battery charge
├  6       17.000 V     battery potential
└> 7      1.897E5 J     energy stored in battery
```

### Comparing the two energy items

These are two separate calculations (except we notice that items 4 and 7 are not that different in value!). Let's connect them by forcing item 4 to take the same value as item 7.

We can do this by subtracting one from the other and then forcing the result to take the value 0.

Alternatively we could divide one by the other and force the result to take the value 1.

Select items 4 and 7, then subtract them, using

We now have a new item 8, which links the two calculations:

```Church Clock
┌  1       75.000 ft    height of tower
├  2 @    800.000 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
┌ └> 4 @    1.795E5 J     energy stored in hanging weight
│ ┌  5        3.100 A h   battery charge
│ ├  6       17.000 V     battery potential
├ └> 7      1.897E5 J     energy stored in battery
└>   8 @ -10262.319 J     {4}-{7}
```

If we now persuade item 8 to accept the value 0, then items 4 and 7 will be forced to become equal.

Select item 8 and click

```Church Clock
┌  1 @   1.788E-5 ft    height of tower
├  2 @   1.907E-4 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
┌ └> 4 @   1.020E-8 J     energy stored in hanging weight
│ ┌  5 @   7.390E-7 A h   battery charge
│ ├  6 @   4.053E-6 V     battery potential
├ └> 7 @   1.078E-8 J     energy stored in battery
└>   8 @ -5.832E-10 J     {4}-{7}
```

The result is not what we want.

Nearly all the items have changed, as shown by the @-flags, including ones we didn't want to change. And they have not changed to very sensible values, either. But the good news is that items 4 and 7 have been forced to become (very nearly) equal.

In fact all items may change unless they are held.

Click and try again. This time we will hold those items we want to stay fixed.

### Setting a permanent hold on an item

Items 5 and 6 are properties of the battery and can't be altered. So it's worth treating them the same way as earth gravity -- an unalterable physical quantity which resists backfitting.

Select item 5 and click

The trailing flag ! is toggled absent/present.

Do the same with item 6. Also item 7, although here it's not going to matter.

It's enough to hold only the "ancestors" -- those leaves of the calculation tree feeding into a calculated item.

### Setting a transient hold on an item

Now look at items 1 and 2. We don't want them both to change at the same time. So we must hold one and not the other.

The original question was: "How far should the weight be lifted to exactly equal the energy stored in [Adrian's] laptop battery?"

So let us put a transient hold on the weight. This will let the  height of tower vary.

Let's hope it won't vary enough to compel us to add more bricks to the top of the tower.

Select item 2 and Shift-click

The flag: ! appears. But it is against the item number, not at the end of the name.

This is called setting a transient hold. Both kinds of hold behave the same way. But unlike a permanent hold, a transient hold is not saved as part of the t-table when you save it.

Now select the difference item (8) and click to zero it.

The only items that change are 1, 4 and 8. Item 4 changes to become equal to item 7, and the urge to change is squeezed back along the arrows to affect item 1.

NOTE: Item 8 may become not 0 but a tiny value. A second click of will cure that.

You now see:

```Church Clock
┌  1 @     79.289 ft    height of tower
├  2!     800.000 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
┌ └> 4 @    1.897E5 J     energy stored in hanging weight
│ ┌  5        3.100 A h   battery charge!
│ ├  6       17.000 V     battery potential!
├ └> 7      1.897E5 J     energy stored in battery
└>   8 @ -1.455E-10 J     {4}-{7}
```

This answers our original question. To equalize the energies, the weight must be lifted by 79.289 ft instead of 75 ft.

But suppose we keep  height of tower fixed and let  mass of weight vary. What happens?

Click to undo the changes, then Shift-click to unhold item 2, and one more time to hold item 1.

Once again, select item (8) and click to zero it.

You now see:

```Church Clock
┌  1!      75.000 ft    height of tower
├  2 @    845.748 kg    mass of weight
├  3        9.813 m/s²  acceleration; gravity!
┌ └> 4 @    1.897E5 J     energy stored in hanging weight
│ ┌  5        3.100 A h   battery charge!
│ ├  6       17.000 V     battery potential!
├ └> 7      1.897E5 J     energy stored in battery
└>   8 @ -8.731E-11 J     {4}-{7}
```

This shows us the weight must be increased from 800 kg to 845.748 kg to equalize the two energies.

### Saving your work

Click to save the t-table as a file with a name derived from the title, viz. Church_Clock.ijs.

The name is derived by replacing all spaces and other forbidden characters in the title by Underscore (_).

Alternatively choose menu: File > Save As... to give the saved file a name of your choice.