Proektsoftbg / Calcpad

Free and open source software for mathematical and engineering calculations.
https://calcpad.eu
MIT License
363 stars 43 forks source link

Select Data Target #24

Closed hildebrandopsj closed 2 years ago

hildebrandopsj commented 2 years ago

Hi,

I trying to create a selection list to a variable called fck, but indepent of the selection made it bring the results of previous variables:

image image

Here is the code:

'<h3> Dimensionamento de Seções</h3>'
'<hr />
'<h4>Materiais</h4>'
'<h5>Coeficientes de Ponderação</h5>'
'Coeficiente de minoração do aço
γ_s = ? 
'Coeficiente de minoração do concreto
γ_c = ? 
'<h4>Concreto</h4>'
#pre
'<p>Escolha o fck - 
'<select data-target="fck">
'<option value=15>C15</option>
'<option value=18>C18</option>
'<option value=20>C20</option>
'<option value=25>C25</option>
'<option value=30>C30</option>
'<option value=35>C35</option>
'<option value=40>C40</option>
'<option value=45>C45</option>
'<option value=50>C50</option>
'<option value=55>C55</option>
'<option value=60>C60</option>
'<option value=65>C65</option>
'<option value=70>C70</option>
'<option value=75>C75</option>
'<option value=80>C80</option>
'<option value=85>C85</option>
'<option value=90>C90</option>
'</select></p>
#post
'<table id="fck">
'<tr><td>'f_ck = ? '</td></tr>
'</table>
f_cd = f_ck/γ_c
α_v2 = 1 - f_ck/250
#if f_ck ≤ 50
f_ctm = 0.3*f_ck^(2/3)
#else
f_ctm = 2.12*ln(1 + 0.11*f_ck)
#end if

Someone can tell me what i'm doing wrong?

Best regards

GreatApo commented 2 years ago

Someone can tell me what i'm doing wrong?

The input needs to be created in the pre state so that the value is assigned, then you need to start the post process

#show
'<table id="fck">
'<tr><td>'f_ck = ? '</td></tr>
'</table>
#post
Proektsoftbg commented 2 years ago

You'd better also put the id in the immediately enlosing element, which is td in your case:

#show
'<table>
'<tr><td id="fck">'f_ck = ? '</td></tr>
'</table>
#post

You can even just use a paragraph element. If you wan't to hide it so that that the user would not put any other values add also display:none style:

#show
'<p id="fck" style="display:none;">'f_ck = ? '</p>
#post
hildebrandopsj commented 2 years ago

Thank you all for the answers, i create another simple code to verify punching with our national code and the problem is similar.

After one calculation, if i try to do it again, all the variables change. see the figure below:

Firts time calculation:

image

Results:

image

If i press the calculation button again

image

Here is the code: ``

#Pre
'<h3>Verificação à Punção</h3>'
'<hr />
'<h4>Coeficientes de Ponderação dos materiais</h4>'
'Coeficiente de minoração do aço:     'γ_s = ? 
'Coeficiente de minoração do concreto:'γ_c = ? 
'<h4>Materiais</h4>'
'<h5>Concreto</h5>'
'Resistência característica do concreto à compressão:'
f_ck = ? MPa
#hide
'Resistência de projeto do concreto à compressão:'
f_cd = f_ck/γ_c
'Fator de eficiência:'
'Conversão de fck para adimensional
f_ck = f_ck/MPa
α_v2 = 1 - f_ck/250
#Pre
'<h5>Esforços Solicitantes</h5>'
F_sd = ? kN
M_sd,x = ? kNm
M_sd,y = ? kNm
'<h5>Dados da seção</h5>'
'Altura da laje'h = ? cm
'Altura útil da laje'd = ? cm
'Dimensão x do pilar'hx = ? cm
'Dimensão y do pilar'hy = ? cm
#Post
'<h3>Verificação à Punção</h3>'
'<hr />
'<h4>Coeficientes de Ponderação dos materiais</h4>'
'Coeficiente de minoração do aço:     'γ_s
'Coeficiente de minoração do concreto:'γ_c
'<h4>Materiais</h4>'
'<h5>Concreto</h5>'
'Resistência característica do concreto à compressão:'
f_ck'MPa
'Resistência de projeto do concreto à compressão:'
f_cd|MPa
'Fator de eficiência:'
α_v2 = 1 - f_ck/250
'<h5>Esforços Solicitantes</h5>'
F_sd|kN
M_sd,x|kNm
M_sd,y|kNm
'<h5>Dados da seção</h5>'
'Altura da laje'h|cm
'Altura útil da laje'd|cm
'Dimensão x do pilar'hx|cm
'Dimensão y do pilar'hy|cm
'<h4>Verificação do contorno C:</h4>'
'<hr />
'Perímetro crítico
u = 2*(hx + hy)
'Tensão solicitante na superfície crítica
τ_Sd = F_sd/(u*d)|MPa
'Tensão resistente na superfície crítica
τ_Rd2 = 0.27*α_v2*f_cd|MPa
'Aproveitamento da seção
τ_Sd/τ_Rd2
'<h4>Verificação do contorno C'"': </h4 > 
'<hr />
'Dimensão Perpendicular ao Momento
c_1 = hx
'Dimensão Paralela ao Momento
c_2 = hy
'Perímetro Crítico
a_1 = min(1.5*d; 0.5*hx)
a_2 = min(1.5*d; 0.5*hy)
u = a_1 + a_2 + π*d|cm
'Fator de escala
k = min(2; 1 + sqrt(20cm/d))
'Tensão Normal
σ_cp = ? 'MPa
'Taxa de armadura
ρ = ? /100
'Tensão resistente na superfície crítica sem armadura de punção
τ_Rd1 = 0.13*k*(100*ρ*f_ck)^(1/3) + 0.10*σ_cp
'Excentricidade do perímetro crítico:
e_a = (c_1*a_1 - a_1^2 + a_2*c_1 + 4*a_2*d + 8*d^2 + π*d*c_1)/(2*(a_1 + a_2 + π*d))
'Momento resultante da excentricidade do perímetro crítico:
M_sd,a = F_sd*e_a|kNm
'Momento de cálculo resultante:.
#if abs(M_sd,y) - M_sd,a ≤ 0kNm
M_sd = 0kNm
#else
M_sd = abs(M_sd,y) - M_sd,a
#end if
'Módulo de resistência plástica na direção perpendicular à borda livre:
e_c,linha = (0.5*c_1^2 + c_1*c_2 + 2*d*c_2 + π*d*c_1 + 4*d^2)/(c_1 + c_2 + π*d)
#if e_c,linha ≤ c_1
W_p1 = e_c,linha^2
#else if (c_1 < e_c,linha)*(e_c,linha ≤ c_1 + 4*d/π)
W_p1 = c_1*(e_c,linha - c_1/2) + π*d*(c_1 + (4*d)/π - e_c,linha) + c_2*(c_1 + 2*d - e_c,linha)
#else
W_p1 = c_1*(e_c,linha - c_1/2) + π*d*(e_c,linha - c_1 - (4*d)/π) + c_2*(c_1 + 2*d - e_c,linha)
#end if
'Coeficiente que fornece a parcela de Msd transmitida ao pilar por cisalhamento:
c_1/c_2
k_1 = 0.1885*ln(c_1/c_2) + 0.5857
'Tensão solicitante na superfície crítica:
t_Sd = F_sd/(u*d) + k_1*M_sd/(W_p1*d)|MPa
'Aproveitamento da seção
#hide
τ_Rd1 = τ_Rd1*1MPa
#Post
τ_Sd/τ_Rd1
'Conclusão da análise:
#if τ_Sd/τ_Rd1 > 1
 '<span class="err"> Reprovado!</span>'
#else
'Aprovado
#end if

Normally, i use smath studio to do calcs, but calcpad is really fast and don't consume so much time to create a readeble report. So i want to move out from smath.

Congratulations for the great software!

Proektsoftbg commented 2 years ago

Hi! Thank's a lot! Great code BTW! :) The problem is that you have input fields "?" in the #post section:

'Tensão Normal
σ_cp = ? 'MPa
'Taxa de armadura
ρ = ? /100

You can simply add #show before and it will become like this:

#show
'Tensão Normal
σ_cp = ? 'MPa
'Taxa de armadura
ρ = ? /100
#post

To avoid this problem, always make sure that all question marks are in #show or #pre sections so that to appear in the input stage. In future versions we can make the parser to detect such cases automatically and report them as errors to the user.

Your code is very similar to what we do here to Eurocodes. :)

hildebrandopsj commented 2 years ago

Someone can tell me what i'm doing wrong?

The input needs to be created in the pre state so that the value is assigned, then you need to start the post process

#show
'<table id="fck">
'<tr><td>'f_ck = ? '</td></tr>
'</table>
#post

Hi! Thank's a lot! Great code BTW! :) The problem is that you have input fields "?" in the #post section:

'Tensão Normal
σ_cp = ? 'MPa
'Taxa de armadura
ρ = ? /100

You can simply add #show before and it will become like this:

#show
'Tensão Normal
σ_cp = ? 'MPa
'Taxa de armadura
ρ = ? /100
#post

To avoid this problem, always make sure that all question marks are in #show or #pre sections so that to appear in the input stage. In future versions we can make the parser to detect such cases automatically and report them as errors to the user.

Your code is very similar to what we do here to Eurocodes. :)

I get it now! Thank you guys!

@Proektsoftbg our national code have a great influence from Eurocode, personally i use eurocode when some things are missing or need to be clarifyied.

Now i have three last questions:

1) How can i donate to this project? 2) How can i contribute to this project? 3) We have a forum or anything similar to share codes, examples, tutorials?

Proektsoftbg commented 2 years ago

Hi, I am glad you have managed. :) Thank you for your questions. You are so kind!

  1. I have not enabled sponsorship yet but I can do it if there is any interest.
  2. Any contributors are welcomed. There are a lot of things that need to be done, that require different skills. The general method is to clone the repository make changes and place pull requests. But it is good to coordinate the work. I can open a discussion for that purpose: https://github.com/Proektsoftbg/Calcpad/discussions.
  3. There are some external forums currently:
hildebrandopsj commented 2 years ago

Great!

1) So, open the sponsorship, i can made some small donations when possible, you won't get rich, but you can buy a coffee :) 2) Great! I can try to help, i'm still learning C#, not gonna lie, my first language is Pascal (i know, that's old) but i have acess to some professors in the university where i teach that can be helpful, plus i really like to program. 3) I almost concluded some scripts, i will post in github soon.