ronkok / Hurmet

Rich text editor on the web, featuring live calculations.
https://hurmet.org/
149 stars 1 forks source link

Reusing columns from previously defined table #34

Closed swopnil123 closed 3 weeks ago

swopnil123 commented 1 month ago

Is there a way of reusing columns from previously defined tables in Hurmet Spreadsheets without having to retype everything?

image

In this example, I want to define a new table for diaphragm force distribution and want to use the columns from previously defined table. Is there a way to achieve this? The dittto will behave like a constant.

¢format ="h2"

¢k = 1

¢V_base = 500kips

: Table1 Seismic Force Distribution +--------+----------+---------+----------+-----------+--------------+--------+----------------+ | Floor | Weight\ | Height\ | w × h^k^ | C~vs~ | Force\ | Shear\ | Overturning\ | | | kips | ft | | | kips | kips | kip·ft | +========+:========:+:=======:+:========:+:=========:+:============:+:======:+:==============:+ | roof | 950 | 70 | =B1×C1^k | =D1/D_end | ==E1× V_base | =F1 | 0 | +--------+----------+---------+----------+-----------+--------------+--------+----------------+ | fifth | 1,250 | 56 | " | " | " | =G1+F2 | =H1+G1×(C1-C2) | +--------+----------+---------+----------+-----------+--------------+--------+----------------+ | fourth | " | 42 | " | " | " | " | " | +--------+----------+---------+----------+-----------+--------------+--------+----------------+ | third | " | 28 | " | " | " | " | " | +--------+----------+---------+----------+-----------+--------------+--------+----------------+ | second | " | 14 | " | " | " | " | " | +--------+----------+---------+----------+-----------+--------------+--------+----------------+ | total | =sum(up) | 0 | =sum(up) | | =sum(up) | =F_end | " | +--------+----------+---------+----------+-----------+--------------+--------+----------------+ {#Table1 ."four-rules spreadsheet" colWidths="70 71 62 73 88 74 76 null"}

¢Table1.Weight=??kips

: Table2 Diaphragm Force Distribution +--------------------+---------------------+---------------------+ | Floor | Weight\ | Height\ | | | kips | ft | +====================+=====================+=====================+ | =Table1.Floor.roof | =Table1.roof.Weight | =Table1.roof.Height | +--------------------+---------------------+---------------------+ | “ | “ | “ | +--------------------+---------------------+---------------------+ {#Table2 ."grid spreadsheet" colWidths="163 159 null"}

ronkok commented 1 month ago

Interesting. I need to think about this one. It will be a day or two before I can respond.

ronkok commented 1 month ago

I've worked up an example to calculate diaphragm forces. You can copy the text below and then invoke the Hurmet command 𝐌▾ | Paste from Markdown.

It seems to me that this works reasonably well. I'd like your comments. I may take the time to work up the example with up-to-date code references and more plausible engineering numbers. The result may make a decent Hurmet guide for diaphragm and collector design.

¢` format = "h4" `

#### Vertical Distribution of Seismic Force

From earlier analysis

::: indented
¢` S_DS = 1.0 `          ¢` I = 1.0 `

¢` V_base = 400kips `, base shear        ¢` T = 0.75 sec `, fundamental period
of the structure
:::

From ASCE-16 section 12.8.3, Equivalent Lateral Procedure

::: indented
¢` k = {   1 if T ≤ 0.5;   2 if T ≥ 2.5;   1 + (T - 0.5) // 2 otherwise } = ? `

¢` C_vs = (w × h^k) / (Σ (w × h^k)) `, vertical distribution coefficient, Eq.
12.8-12

¢` F = C_vs V_base `, local force, Eq. 12.8-11
:::

¶

: dist: Vertical Distribution of Seismic Force
+--------+----------+---------+----------+-----------+--------------+--------+
| Floor  | Weight\  | Height\ | w × h^k^ | C~vs~     | Force\       | Shear\ |
|        | kips     | ft      |          |           | kips         | kips   |
+========+:========:+:=======:+:========:+:=========:+:============:+:======:+
| roof   | 950      | 70      | =B1×C1^k | =D1/D_end | ==E1× V_base | =F1    |
+--------+----------+---------+----------+-----------+--------------+--------+
| fifth  | 1,250    | 56      | "        | "         | "            | =G1+F2 |
+--------+----------+---------+----------+-----------+--------------+--------+
| fourth | "        | 42      | "        | "         | "            | "      |
+--------+----------+---------+----------+-----------+--------------+--------+
| third  | "        | 28      | "        | "         | "            | "      |
+--------+----------+---------+----------+-----------+--------------+--------+
| second | "        | 14      | "        | "         | "            | "      |
+--------+----------+---------+----------+-----------+--------------+--------+
| total  | =sum(up) | 0       | =sum(up) |           | =sum(up)     | =F_end |
+--------+----------+---------+----------+-----------+--------------+--------+
{#dist ."four-rules spreadsheet" colWidths="NaN NaN NaN NaN NaN NaN NaN"}

Next, let’s find the design diaphragm forces.

::: indented
¢` F_pxTrial = (∑F_(i=1)^n) / (∑W_(i=1)^n) W_i `, Eqn 12.10-1

¢` F_pxMin = 0.2 S_DS I w_px `. This usually controls.

¢` F_pxMax = 0.4 S_DS I w_px `
:::

: fram: Diaphragm Forces
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
| Floor  | Weight\  | ΣW\    | F\       | ΣF\      | F~pxTrial~\ | F~pxMin~\      | F~pxMax~\ | F~px~\              |
|        | kips     | kips   | kips     | kips     | kips        | kips           | kips      | kips                |
+:======:+:========:+:======:+:========:+:========:+:===========:+:==============:+:=========:+:===================:+
| roof   | 950      | =B1    | =dist.F1 | =dist.G1 | =E1/C1×B1   | =0.2×S_DS×I×B1 | =2×G1     | =min(max(F1,G1),H1) |
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
| fifth  | 1,250    | =C1+B2 | "        | "        | "           | "              | "         | "                   |
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
| fourth | "        | "      | "        | "        | "           | "              | "         | "                   |
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
| third  | "        | "      | "        | "        | "           | "              | "         | "                   |
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
| second | "        | "      | "        | "        | "           | "              | "         | "                   |
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
| total  | =sum(up) | =B_end | "        | "        |             |                |           |                     |
+--------+----------+--------+----------+----------+-------------+----------------+-----------+---------------------+
{#fram ."four-rules spreadsheet" colWidths="69 71 NaN NaN NaN 83 64 NaN NaN"}
ronkok commented 1 month ago

Also, while working through this, I found a bug in the parser that breaks on spaces in some spreadsheet formulas. I'm working on a fix.

swopnil123 commented 1 month ago

Thank you for your quick response. Give me some time to review it. I'm little busy this week.

swopnil123 commented 1 month ago

One question

image

Why does first column i.e. Floor doesn't work if we use ditto to get floor names?

image

ronkok commented 1 month ago

That was a bug. Fixed now. Thank you for pointing it out.

ronkok commented 3 weeks ago

My comment above described how to import one spreadsheet column into a second spreadsheet's column. I am closing the comment as completed.

swopnil123 commented 3 weeks ago

One more thing I noticed. If we use ditto to access the first column from previously defined table then then summation in the second column will go wrong.

image

image

Can you see this?