cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Summation in if-loop

ksk_10594232
11-Garnet

Summation in if-loop

Hi

I want to create a loop that for the next interval add the results in the previous interval etc. I have made an attempt in the following program, but something is wrong. Any help is appreciated.  

 

ksk_10594232_0-1694174133870.png

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

Or you may use a more generic approach

Werner_E_0-1694196049416.png

Werner_E_1-1694196090925.png

 

View solution in original post

12 REPLIES 12

Maybe this is what you are looking for:

Werner_E_0-1694178945866.png

Because a "return" statement stops a program from running any further, you can also write

Werner_E_1-1694178987828.pngWerner_E_2-1694178995247.png

Prime 9 file attached

 

Not really, I want the diagram to look like this (Excel).

 

ksk_10594232_0-1694180198317.png

 

f(0) = 0

f(4,5) = 0 + 4,5x9 = 40,5

f(8,3) = f(4,5) + (8,3 - 4,5) x 7 = 67,1 

f(11,3) = f(8,3) + (11,3 - 8,3) x 8 = 91,1        etc...

 

Hopefully you understand what I'm looking for 🙂

 

 

You are demanding now something different compared to your initial posting.

There your wrote " that for the next interval add the results in the previous interval etc." (and your function attempt also showed additios) and now you obviously want to subtract somehow?

In your program you wrote b <-- gamma2*z + a and NOT b <-- gamma2*(z - 4.5 m) + a

Maybe you can get more clear about what you actually need!

 

So far I guess that this could be what you are looking for:

Werner_E_0-1694187411841.pngWerner_E_1-1694187423474.png

 

Werner_E
25-Diamond I
(To:Werner_E)

Or you may use a more generic approach

Werner_E_0-1694196049416.png

Werner_E_1-1694196090925.png

 

Thank you, that's what I was looking for! 🙂

Very nice, I like that generic approach! That will be useful for me in the future, thank you!

I have a further query associated to that.  The above example describes the vertical stress of a porous material saturated in water. It is common that a part of the material in above water and the other part of the material is submerged in water. Let's assume that the depth to water d=1 m and the weight above that level is 16 kN/m3 (for example). Below that water level (1 m) the conditions are as previously stated. How can I incoorporate that into your generic approach? 

 

Thank you!

I am not sure if I fully understand your new question.
Doesn't it just mean that you have to add 16 on top of the "gamma" vector and -1 on top of the "limits" vector?

 

Nevermind, I found a way to solve it 🙂

Or, if you're using Express and can't program

Fred_Kohlhepp_0-1694180818308.png

 

Werner's formula is precise and well done!

 

But this is really a simple integration,  Attached Prime 4 Express.

 

(Extension to the second problem, above the water) will require definition of sign conventions.


But this is really a simple integration,

😉 Its only simple once you found a way to automatically choose the correct gamma-value for every depth, like you did with

Werner_E_0-1694457133869.png

 

Announcements

Top Tags