Function in line odd behavior

Function in line odd behavior - When a function is placed in a 'line' it provides an error - Сообщения

#1 Опубликовано: 02.04.2015 12:45:37
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Attached is a long calc, but I you will see a section toward the middle where I have pulled a function out of a line. I have a trace error on the input parameter H.T# which assigns itself to itself and thus causes an error message. Can anyone help explain. If the file if clouding my problem I can try to reduce this later.

Thanks in advance!!
ER - Braced Excavation test_3.sm (154 КиБ) скачан 43 раз(а).
#2 Опубликовано: 05.04.2015 22:34:47
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Attached is the function removed from the rest of the calculation. I just can't seem to figure this out. When the function is in a "line" it returns that H.T# is not defined. If you take the function out of the line it seems to operate fine. This is driving me nuts
Function Error.sm (14 КиБ) скачан 35 раз(а).
#3 Опубликовано: 06.04.2015 13:58:08
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Ioan -> thanks for your response!

I used to do as you describe. However, I noticed Martin had used the function parameters for input and output. See here for his explanation.

However it seems to be causing me problems for some reason I don't understand. Attache is another example.

Is it possible for me to edit the name of this thread? It should really be function input/output parameter error or something along those lines.
Function with output parameter.sm (43 КиБ) скачан 36 раз(а).
#4 Опубликовано: 06.04.2015 16:35:47
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Very odd that I still get a result when I put the function back into a "Line".
See attached
Function in line error.sm (44 КиБ) скачан 37 раз(а).
#5 Опубликовано: 06.04.2015 18:34:38
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Back to my original problem.. I just can't seem to get this one.
ER - Braced Excavation_1.sm (853 КиБ) скачан 38 раз(а).
#6 Опубликовано: 07.04.2015 11:37:08
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Ioan -> I really appreciate you taking a look at this. thank you.

Regarding my "in-line" problem:
Цитата

The second one has errors in its body. ---> for 2,...


The only time that function should run is if there is 2 or more rows. Due to the d.brc = 1 if statement check. However disregarding this. I don't understand why the functions when separated work fine. However when put on the same "line" they do not work. See attached.


Цитата

I propose you to operate, by your self, a full program refactoring, keeping it simply, readable, to test each function individually and to assembly them after.


Yes this is very true, I do need to get a function started, working, then keep it working. I do though normally start with the program as not a function, such as this one and it was working. Then when I assembled it, I started having issues.

Цитата

use of illicit matrix definition: MK.a#:matrix(0,6)


How else do you build functions? I adapted this technique from Martins FEA Beam Prepocessor. It is a way to "build" matrices. I had thought it was good practice to define a Matrix of zero size then fill it with the necessary information, no?

Цитата

unnecessarily (only cosmetic) programming lines; for me it is not very clear the work of unnecessarily "programming lines"


Could you elaborate on this? I do want to improve this.

I will try to re-write this. I don't mean to be risky...
Functionerror bis - in-line error.sm (30 КиБ) скачан 34 раз(а).
#7 Опубликовано: 07.04.2015 19:27:42
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Thanks ioan.

I have retooled and now it seems to be working. Although there are nested functions. Is this ok?
I still think I like the idea of 0 matrix, but if there is a better way to build matrices securely, I'm all ears.
ER - Braced Excavation.sm (145 КиБ) скачан 39 раз(а).
#8 Опубликовано: 09.04.2015 11:01:03
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Ioan -> No, not intrusive at all, you have great advice.

I like the idea of initializing a "zero matrix" because it ensures that the variable is empty and now I can add to it. Although maybe this is poor thinking. I like the idea of functions because I can keep calculations all one page in a condensed format and not have to worry too much about global vs local variables.

I still am not sure what you are referring to as cosmetic treatment.

thanks again!
#9 Опубликовано: 10.04.2015 10:12:42
Ryan Freund

Ryan Freund

19 сообщений из 339 понравились пользователям.

Группа: User

Thanks Ioan, I understand now. The term "cosmetics" does make sense. However, those lines help me keep my mind organized

I
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений