Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help to find a command
#8
(Feb-04-2019, 09:49 AM)perfringo Wrote:
(Feb-04-2019, 08:01 AM)andre_fermart Wrote: In the bellow example, the break will stop when the is a gap bigger than 10 between 2 link strength.
For example: [[77, 2], [16, 5], [36, 11], [7, 12], [93, 15], [42, 17], [82, 18], [33, 33], [79, 42], [94, 43]]
the result would be:
[[77, 2], [16, 5, 1], [36, 11], [7, 12, 1], [93, 15], [42, 17], [82, 18], [33, 33], [79, 42], [94, 43]]

What constitutes a gap? If I look at two list in bold I don't see any corresponding values where gap is bigger than ten (16 - 7 = 9; 12 - 5 = 7).

I do see 36 - 16 > 10. Does it mean that 1 should be appended to next element after the element where gap is larger than 10?

I still don't get this tension stuff. Why should you iterate below min value of strength? Nothing happens while doing it.

I also noticed that you sorted list. Does it mean that order is not important?

A gap in strength between two links.
The first number is the link strength the the second is its position. A gap comparing only link[0]. I sorted by position. Maybe the link example is becoming limited. Let´s use the fiber with flaw.
The fiber is 50 mm long and had 100 flaws in it(random strength and location along the 50 mm). As below.
The fiber strength is driven by the flaw strength at the position the flaw is. Where there is no flaw, the strength is so high that it will never fail and I do not take into consideration in my study.


for x in range (10):
    link = []
    s = random.randint (0, 100)
    link.append (s)
    l = random.randint (0, 50)
    link.append (l)
    chain.append (link)


I need to apply tensile stress in the fiber (it is embedded in a polymer matrix and for that reason it continue to break even after the first flaw failure). The matrix keep transferring stress to the fiber that keep failing as soon as the stress reach the flaw strength.

I need to make a loop of "increasing the stress" (MPa is the unit) and at each increment I need to check if any flaw failed. If so I will need to apply a stress function for the neighbors (imagine a situation that the neighbor will now require a higher stress to fail) but this is something I need to do consider in future, next thing to learn how to do. Not important now.

This loop, in order to do not go to infinite, I set to stop after a certain amount of increment without failure (I used 10 as example).

Does it make sense now?

Comming back to the links. There are 50 links (positions) but just some of them I will analyse (random location). I increment the stress 1 by 1.
Stress = 1 MPa, did any link break? No
Stress = 2...
Stress = 7, Yes (the link at position 12 with 7 strength broke, then [7, 12, 1]
At this stage count = stress = 7 but now cont = 0 and stress = 7
Stress = 8, cont = 1
Stress = 16, cont = 9..the link at position 5 broke; [16, 5, 1]
stress = 16 and cont = 0
Stress = 26 and cont = 10 program stops as count reached 10

I thought that my scrip below would run as the example above.

while (cont < 10):  
    for link in chain:
        if tension > link[0]:
            link.append(1)
            cont = 0
        else:   
            cont += 1
    tension += 1
Reply


Messages In This Thread
Help to find a command - by andre_fermart - Feb-02-2019, 08:06 AM
RE: Help to find a command - by stullis - Feb-02-2019, 04:15 PM
RE: Help to find a command - by perfringo - Feb-02-2019, 11:47 PM
RE: Help to find a command - by perfringo - Feb-03-2019, 12:51 PM
RE: Help to find a command - by andre_fermart - Feb-04-2019, 08:01 AM
RE: Help to find a command - by perfringo - Feb-04-2019, 09:49 AM
RE: Help to find a command - by andre_fermart - Feb-05-2019, 05:47 AM
RE: Help to find a command - by perfringo - Feb-05-2019, 09:01 AM
RE: Help to find a command - by perfringo - Feb-05-2019, 12:15 PM
RE: Help to find a command - by andre_fermart - Feb-12-2019, 02:34 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020