Tag Archives: spreadsheets

Calculating with units

Units

Unit conversion is one of the most tedious jobs when doing calculations. Although not very difficult, it is repetitive and time consuming.

For example, lets calculate the stress in a steel beam. Assume that span length is in meters, section dimensions are in mm, geometrical properties are in cm2 (cm3, cm4), section forces are in kN (kNm) and stress is in MPa. That requires you to include a lot of conversion factors in your formulas. So, it would be very helpful if you could write the units next to the respective values and let the software do all the conversions for you.

The most recent version Calcpad Pro 3 supports physical units in calculations. For now, only metric units (SI compatible) are included, but more units will be added in the next versions.

You can attach units to every value in an expression and obtain the result in the specified target units. The target units are added at the end, separated by a vertical bar “|”.  , Open the online calculator and try the following expression by yourself:

2m + 50 cm + 200 mm|dm

Since the target units are “dm“, the answer is 27dm (not just adding 20 + 50 + 200 = 252). That is because all values are converted automatically to the same units before the addition: 20dm + 5dm + 2dm = 27dm. If you do not specify any target units, the units of the first operand will be used.

If you want to do simple unit conversion, just write the value, followed by the source units, a vertical bar and the target units:

25m/s|km/h

The result is 90km/h, which is correct.

You can also attach units to variables and functions. If you have units in an expression that defines a variable, the result will be stored in the variable, together with the calculated units. If you specify target units at the end, they will be used instead. From this point further, the variable will be substituted always with the internally stored units. You can try the following examples:

Input Output
Example 1: Speed
'Distance -'S = 50m
'Time -'t = 2s
'Speed -'V = S/t|km/h
Distance – S = 50m
Time – t = 2s
Speed – V = S/t = 50m/2s = 90km/h
Example 2: Force
'Mass - 'M = 500t
'Acceleration - 'a = 4m/s^2
'Force -'F = M*a|kN
Mass – M = 500t
Acceleration – a = 4m/s2
Force – F = M·a = 500t·4m/s2 = 2000kN
Example 3: Stress in column
'Column load -'F = 2000kN
'Section size -'b = 500mm
'Section area -'A = b^2|cm^2
'Stress -'σ = F/A|MPa
Column load – F = 2000kN
Section size – b = 500mm
Area – A = b2 = (500mm)2 = 2500cm2
Stress – σ = F/A = 2000kN/2500cm2 = 8MPa

If you specify target units after a function definition, they will be attached permanently to this function. The result will be converted to them whenever the function is used further. However, you have to be careful to provide the proper units for the arguments. Otherwise, you can get an error.

Although Excel is still the most popular platform for engineering spreadsheets, it lacks such advantages as automated units. I think that math software is more appropriate for engineers in general, but this will be a topic for future discussions.

Read the next post to see how do units actually work. We will lift the cover and have a quick look inside the Calcpad engine, together.

Getting started

Calcpad is available for both cloud and desktop on the official website http://calcpad.net. You can use it as an online programmable calculator with support for complex numbers, variables, functions and graphing.

online calculator

You can also browse the online library and find professional worksheets for solving equations or calculating areas, volumes and mechanical properties. There is also a rich collection of structural design spreadsheets to Eurocode. You can design reinforced concrete beams, columns or plates, calculate deflections and cracks, punching shear reinforcement or check the detailing requirements for RC elements.

Some worksheets are free to use, but others require subscription. You can create your account and order a subscription plan. Credit card payments are accepted via PayPal.

Calcpad is also available as a desktop application. You can download a 30-day free trial for Windows and create your own calculation programs. The desktop subscription, allows you to download worksheets from the online library and use them on your computer.

The desktop version has basic code editing capabilities and is useful for small to medium sized programs. It supports line numbering, syntax highlighting, automated white space formatting, coping and pasting, etc.

calcpad desktop

However, it is also possible to use another, much more powerful code editor such as Notepad++. It is a free and open source text editing software, with many advanced features. Download and install Notepad++ from the official website https://notepad-plus-plus.org. You can also add the Calcpad language syntax. It is defined in the Notepad++.xml file.

notepadpp

In the next posts, you will find detailed instructions how to set up Calcpad and Notepad++ and write your own programs.

Welcome to Calcpad!

Welcome to my blog!

I am a structural engineer with almost 20 years of experience in the design of nuclear and industrial facilities, factories, residential and public buildings. I am also a fan of engineering, mathematics and programming and you will find a lot of interesting stuff about that here.

For all these years I’ve been dealing mostly with calculations. I have developed a lot of custom spreadsheets and macros to automate my job, using various tools like Excel, VBA, MathCAD, etc. Each of them had a lot of advantages, but I also stumbled upon different kinds of problems.

That is why I created Calcpad. It is a simple but powerful mathematical platform for engineering calculations:

  • It is easy to learn and use. No special programming skills are required, which makes it suitable for all engineers.
  • Calculations are automatically documented into beautiful Html reports that are easy to follow and check.
  • Calcpad spreadsheets can be published online. Web forms are generated automatically out of the source code.

It combines the simplicity of spreadsheets with the power and flexibility of programming in an elegant way. In this blog you will find detailed information about CalcPad, useful tips and tricks, sample code and solutions of variable problems.

calcpad