Let's start with the simplest structure we can think of, a steel cantilever with a point load at its tip. You can analyse it on the back on an envelope, and that's exactly why we've chosen it. All of our attention in this step can go on the Calc Sheet itself. We'll open the sheet beside the model, read how it's made up of Markdown and Python cells, and see how Python reads the model's length and load as quantities with units. Then we'll work out the moment and shear at the support in Python and compare them with the reactions from the solve.
Remember, if you're not a member, you can't copy this model into one of your own projects to work on a live Jupyter notebook. So you'll only see a static version of the notebook here. But you'll still get the gist of how the Calc Sheet works.
A 3 m cantilever, a UB 203 x 133 x 25 fixed at one end, under a 10 kN point load at its tip. Orbit, read the results and hover the members; nothing you do here changes the model.
Members can copy this model into their own projects and work the step in it. Join or sign in.
1.0 The idea
A Calc Sheet is a Jupyter notebook that's saved with the model. If you've used Jupyter Notebooks before, it will look familiar. If you haven't, a notebook is simply a list of cells, one under the other. A Markdown cell holds text, with headings, bold, lists and LaTeX maths, and it's where we explain what the calculation is doing. A code cell holds Python, and when we run it, whatever it prints appears directly underneath it as its output. This means that a notebook, read from the top, sets out a calculation with all of its working shown, much as you'd set it out on paper.
What makes a Calc Sheet different from a notebook on your own computer is that it's connected to the model. Three objects are already defined in every sheet. v holds the model's variables, such as its parameters. sb gives a cell access to the model itself, including its members, sections and materials and the results of the last solve. And holds the units, which we'll meet later. Every number with a unit arrives in Python as a , a number with its unit attached, and the unit is carried through the arithmetic for us.
u
quantity
The cells are part of the model document. They're saved when you save the model, they appear in its version history, and Undo takes back an edit to a cell in the same way as any other change. Each output is kept too, along with the solve it came from. We'll see why this matters in step 4.
2.0 The model
Our model consists of two nodes and one member, a 3 m UB 203 x 133 x 25 in S355 steel. The left node is fixed and the right node carries a 10 kN point load, acting downwards, in a load case called Tip load. The model has two parameters, the length L (3 m) and the load P (10 kN), and the node position and the load magnitude are bound to them. This means that if you change L in the Parameters tab, the cantilever gets longer, and if you change P, the load changes.
The largest bending moment in a cantilever is at its fixed end, and the shear force is the same everywhere between the load and the support. So we expect,
M=PLV=P
3.0 Opening the sheet
Press Load the model. The model opens beside this page with the Calc Sheet pane on the right, already showing the sheet Cantilever check. The Calc Sheet button, near the right of the toolbar, opens and closes this pane, and in the editor you'll find it just after Explore. You can drag the pane's left edge to make it wider or narrower (double-click the edge to reset it).
In the frame beside this page, and in your own copy, the left side panel starts folded beside the canvas. To open it, click a tab on its rail, such as Build, Results or Parameters.
Along the top of the right pane is the sheet picker, which you use to choose the sheet. This model has only one sheet. In your own models, the buttons beside the picker make a New sheet, Rename, Duplicate or Delete the current one, Import a Jupyter notebook as a new sheet and Export the current one. A model with no sheets yet shows a single button, Start a sheet.
Under the header is the Variables panel. It lists every value a cell can read, and a cell reads each one as v.<name>. In the frame beside this page the panel starts folded as Variables (4), so click it to open it.
There are four entries. Two are the model's parameters, L and P. The other two are observables: the bending moment and the vertical reaction at the fixed end. The parameters already have Python names, but the observables don't yet, so each one reads unnamed. We'll name them in step 2.
In the frame, the names are just labels. In your own copy, clicking a name drops it into the cell you're writing, and each unnamed observable has a Name it button beside it.
3.1 The first two cells
The sheet opens with a Markdown cell that states the problem and the two formulas. Below it, the first code cell does the arithmetic,
Python
M=v.P*v.LV=v.Pprint(f"M = PL = {M.to('kN*m'):~.2f}")print(f"V = P = {V.to('kN'):~.2f}")
Let's take it line by line. v.P is the parameter P, a force of 10 kN, and v.L is the parameter L, a length of 3 m. Multiplying them gives M, and because each one carries its unit, M is already a moment in kNm. The second line simply gives the shear V the value of the load.
The two print lines use an f-string, a string with an f in front of its opening quote. Anything inside curly brackets is worked out and written into the text. Inside the brackets, M.to('kN*m') converts the moment to kNm (it's already in kNm here, so this only fixes the unit on the page), and the :~.2f after it is the format. The .2f means two decimal places. The ~ asks for the unit in its short form. The sheet already prints units that way, so the ~ doesn't change anything here, but you'll see it in most of the prints in this pathway. The cell prints,
Text
M = PL = 30.00 kNm
V = P = 10.00 kN
3.2 The solve's reactions
A short Markdown cell says what comes next, and then the second code cell reads the reactions from the solve,
Python
support=sb.results["Tip load"].reaction("n1")print(f"Moment reaction at the support: {abs(support['Mz']):~.2f}")print(f"Vertical reaction at the support: {support['Ry']:~.2f}")
sb.results holds every result set of the last solve, and the square brackets pick one out by its name, here the load case Tip load. .reaction("n1") reads the reactions at node n1, the fixed support. It gives back the three components of the reaction, Rx, Ry and Mz, each read with its name in square brackets. We wrap the moment in abs(), Python's absolute value, so that the sheet prints its size whatever its sign. The cell prints,
Text
Moment reaction at the support: 30.00 kNm
Vertical reaction at the support: 10.00 kN
If you're a member, press Copy to my projects. Your copy opens in the editor with the same sheet in its Calc Sheet pane, but without the outputs, because a copy doesn't carry them.
Things to try
Press Solve. The first time, Python takes about ten seconds to start while it downloads, and after that it comes from your browser's cache. Wait until the status line Loading the model into Python has gone, then press Run all to run the sheet in your copy. Run all runs every cell of the sheet in order, from the top, and the four lines in the checkpoint below print under their cells.
Click below the last cell and add a new code cell (press B while the cell is selected but not being edited, or use the + button in the sheet's toolbar). Type print(v.L.to("mm")) and press Shift+Enter to run it. It prints 3000.0 mm, the same length in another unit.
In a new cell, type v. and press Tab. A list of everything that can follow the dot appears, with L and P among the names. This is the quickest way to find a name without leaving the cell.
In the Variables panel, press Name it beside Moment at the fixed end. The name box opens with a suggested name, so replace it with M_base and press Name. In a new cell, run print(f"{v.M_base:~.2f}"), and it prints 30.00 kNm, the solve's moment reaction read through the observable.
Read the tip deflection from the solve. Run tip = sb.results["Tip load"].displacement("n2")["uy"] and then print(f"Tip deflection: {tip:~.2f}"), and it prints Tip deflection: -18.32 mm. The minus sign means the tip moves downwards. We'll check this number by hand below.
In the Parameters tab, change L to 4 and press Solve. Every cell that ran before the solve is now marked as out of date, because it ran on an earlier version of the model. Press Run all again. The moment becomes M = PL = 40.00 kNm and the moment reaction is also 40.00 kNm, while the shear stays at 10.00 kN. The tip deflection grows to -43.41 mm, because a cantilever's tip deflection grows with the cube of its length, and (4/3)3=2.37.
4.0 What you'll see
The cantilever, read by the sheet
The sheet prints
By hand
Moment at the fixed end
M = PL = 30.00 kNm
PL=10×3=30 kNm
Shear
V = P = 10.00 kN
P=10 kN
Moment reaction from the solve
30.00 kNm
the same 30 kNm
Vertical reaction from the solve
10.00 kN
the same 10 kN
The sheet's two formulas and the solve's two reactions agree, which is what we'd expect for a statically determinate cantilever. More importantly, we never typed 3 or 10 into the sheet, and we never had to convert kN times m into kNm. The cell reads the length and the load from the model, so the calculation is still correct after the model changes, as you'll see when you change L in your copy.
Hand check
The support. Taking moments about the fixed end, the 10 kN load acts 3 m away, so the moment reaction is,
M=PL=10×3=30 kNm
and resolving vertically, the vertical reaction is V=P=10 kN. Both agree with the sheet's 30.00 kNm and 10.00 kN, and with the solve's reactions.
The units. In the cell, v.P is 10 kN and v.L is 3 m, so v.P * v.L is 30 kNm. Python carried the unit through the multiplication, and .to('kN*m') only chose which unit to print it in.
The tip deflection. The deflection at the tip of a cantilever with a point load at its end is PL3/3EI. With E=210 GPa and the catalogue's I= cm m for the UB 203 x 133 x 25,
δ=3EIPL3
which agrees with the -18.32 mm the solve returns at node n2.
5.0 Where the Python runs
Python in your browser, on a separate site
When you run a cell, the Python runs in your own browser. The first run takes about ten seconds to start while Python downloads. A sheet reads the model, but it doesn't send anything to the solver unless a cell runs a solve, which we'll do in step 8. A sheet computes only what you write in it. Structure Bench supplies the model's numbers, but the formulas are yours, so check them as you'd check any calculation.
6.0 What to take from this step
A Calc Sheet is simply a Jupyter notebook that's saved with the model. You write the explanation in Markdown cells and do the arithmetic in code cells. To get access the model's data from the Calc Sheet, we use v for its parameters and sb.results for the results of the last solve. Every number comes with its unit attached, so we're always working with quantities rather than bare numbers.
Because a cell reads its values from the model instead of numbers you've typed in, it stays correct when the model changes. Change L, run the cell again, and the answer follows.
Next, we'll read a continuous beam's results through named observables, and see what the sign of a moment means in a sheet.