Proektsoftbg / Calcpad

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

Calcpad hangs #244

Closed BasilioPV closed 6 months ago

BasilioPV commented 6 months ago

When I selected one of them:

image

and then press calculation the calcpad stop and close.

Hull Girder Design - DNV V0.zip

Thanks,

Proektsoftbg commented 6 months ago

Hi!

Thank you for reporting this. Nice worksheet! I will check why crashing and not just handling this exception and showing a message.

However, the reason is that you have two selection boxes with name "Selection2" on lines 79 and 196. Also, enclose selections with the preceding text in paragraphs, by adding <p> and </p> before and after. I fixed these things for you and attached the worksheet bellow. It works now:

Hull Girder Design - DNV V0 - ned.zip

Also, some things can be made in easier ways: f_r = switch(Option ≡ 0; 1; Option ≡ 1; 0.9; Option ≡ 2; 0.8; Option ≡ 3; 0.7; Option ≡ 4; 0.6; Option ≡ 5; 0.5)

This works, but you can use the 'take' function instead: f_r = take(Option + 1; 1; 0.9; 0.8; 0.7; 0.6; 0.5)

'+ 1' is needed because the indexes of the 'take' functions start from 1. But if you start 'Option' from 1, like on line 205: k = switch(Option ≡ 1; 1; Option ≡ 2; 0.78; Option ≡ 3; 0.72; Option ≡ 4; 0.66; Option ≡ 5; 0.62)

it will get even simpler: k = take(Option; 1; 0.78; 0.72; 0.66; 0.62)

Also, I noticed you have many switches, where you are interpolating inside. I could not go deeper in this, but if these are some empirical nomograms in the code, you can consider using the ready made line interpolation function in Calcpad: y = line(x; y1; y2; y3...)

You can check this example for interpolating wind load above ground: https://github.com/Proektsoftbg/Calcpad/blob/main/Examples/Demos/Interpolation.cpd

I hope the above recommendations will be useful for you. I wish you success! :)

Proektsoftbg commented 6 months ago

Hi! I also managed to find where the crash happened and fixed it. You can reinstall the program from this link: https://github.com/Proektsoftbg/Calcpad/releases/download/v6.2.0/calcpad-setup-en-x64.exe

If you already have installed version 6.2.0. Install it first to make sure that everything will be replaced properly. I am sorry for the inconvenience, my mistake.

Also, you can already use the new #split and #wrap options to break long equations instead of the macro. This will make the program simpler and cleaner.

BasilioPV commented 6 months ago

Hi! Thanks for your support and all the recommendations!! Best regards!