Ejemplo n.º 1
0
    def run(self):
        '''Fonction executee quand l'utilisateur clique sur "Run".'''
        self.stopped = False
        # Creation de l'echantillon en testant la validite des parametres
        # fournis par l'utilisateur
        try:
            rs = RockSample(self.L.get_val(), self.C.get_val(),
                            self.leq0.get_val(), self.Rl.get_val(),
                            self.A0.get_val(), self.Ka.get_val(),
                            self.E0.get_val(), self.Ke.get_val(),
                            self.F0cr.get_val(), self.D.get_val())
            #rs.debug = True
            print(rs)

            cpr = Compression(rs, self.F0x.get_val(), self.Kbc.get_val(),
                              self.d0.get_val(), self.delt_d.get_val(),
                              self.max_comp.get_val())
            delta_comp_rate = self.delta_comp.get_val()
        except:
            # si une erreur dans les parametres est detectee, soulever
            # l'erreur pour interrompre le programme
            raise

        def draw_sample():
            "fonction d'affichage de l'echantillon"
            DisplayRS(rs, scale = self.scale.get_val(), d = cpr.d)

        iteration = 0
        dFy = DisplayCurve(parent=self, xlegend="\u03B5(%)", ylegend="Fy",
                           yscale = 10000, ymax = 0.05)
  
        cpr.d += cpr.delt_d
        strain = cpr.d / rs.h0 * 100
        comp_rate = rs.comp_count / rs.nsprings * 100
        comp_rate_next_display = 0

        first_compacted_displayed = False

        # Commencer la compression
        while comp_rate < cpr.max_comp:
            if self.stopped:
                print("Stopped.")
                return
            iteration += 1

            cpr.solve()

            test_comp_count = rs.comp_count
            comp_rate = rs.comp_count / rs.nsprings * 100

            # Affichage
            dFy.add_point(strain, cpr.Fy)
            if not first_compacted_displayed and comp_rate > 0.:
                threading.Thread(target=draw_sample).start()
                first_compacted_displayed = True
                time.sleep(2)
            if comp_rate >= comp_rate_next_display:
                threading.Thread(target=draw_sample).start()
                comp_rate_next_display += delta_comp_rate
                time.sleep(2)

            print("\nIteration %5d: " % iteration)
            print("\tCompaction rate:", comp_rate)

            # Incrementer le deplacement si aucun ressort n'a ete compacte
            if cpr.rs.comp_count == test_comp_count:
                cpr.d += cpr.delt_d
                strain = cpr.d / rs.h0 * 100
                print("\tStrain: %f" % strain)

        threading.Thread(target=draw_sample).start()
        time.sleep(2)
        print("Done.")
Ejemplo n.º 2
0
dFy = DisplayCurve(xlegend="\u03B5(%)", ylegend="Fy",
                   yscale = 10000, ymax = 0.05)

cpr.d += cpr.delt_d
strain = cpr.d / rs.h0 * 100
comp_rate = rs.comp_count / rs.nsprings * 100
comp_rate_next_display = 0

first_compacted_displayed = False

# Commencer la compression
while comp_rate < cpr.max_comp:
    iteration += 1

    test_comp_count = rs.comp_count
    cpr.solve()
    comp_rate = rs.comp_count / rs.nsprings * 100

    # Affichage
    dFy.add_point(strain, cpr.Fy)
    if not first_compacted_displayed and comp_rate > 0.:
        threading.Thread(target=draw_sample).start()
        first_compacted_displayed = True
        time.sleep(2)
    if comp_rate >= comp_rate_next_display:
        threading.Thread(target=draw_sample).start()
        comp_rate_next_display += delta_comp_rate
        time.sleep(2)

    print("\nIteration %5d: " % iteration)
    print("\tCompaction rate:", comp_rate)
Ejemplo n.º 3
0
iteration = 0
dFy = DisplayCurve(xlegend="\u03B5(%)", ylegend="Fy", yscale=10000, ymax=0.05)

cpr.d += cpr.delt_d
strain = cpr.d / rs.h0 * 100
comp_rate = rs.comp_count / rs.nsprings * 100
comp_rate_next_display = 0

first_compacted_displayed = False

# Commencer la compression
while comp_rate < cpr.max_comp:
    iteration += 1

    test_comp_count = rs.comp_count
    cpr.solve()
    comp_rate = rs.comp_count / rs.nsprings * 100

    # Affichage
    dFy.add_point(strain, cpr.Fy)
    if not first_compacted_displayed and comp_rate > 0.:
        threading.Thread(target=draw_sample).start()
        first_compacted_displayed = True
        time.sleep(2)
    if comp_rate >= comp_rate_next_display:
        threading.Thread(target=draw_sample).start()
        comp_rate_next_display += delta_comp_rate
        time.sleep(2)

    print("\nIteration %5d: " % iteration)
    print("\tCompaction rate:", comp_rate)
Ejemplo n.º 4
0
    def run(self):
        '''Fonction executee quand l'utilisateur clique sur "Run".'''
        self.stopped = False
        # Creation de l'echantillon en testant la validite des parametres
        # fournis par l'utilisateur
        try:
            rs = RockSample(self.L.get_val(), self.C.get_val(),
                            self.leq0.get_val(), self.Rl.get_val(),
                            self.A0.get_val(), self.Ka.get_val(),
                            self.E0.get_val(), self.Ke.get_val(),
                            self.F0cr.get_val(), self.D.get_val())
            #rs.debug = True
            print(rs)

            cpr = Compression(rs, self.F0x.get_val(), self.Kbc.get_val(),
                              self.d0.get_val(), self.delt_d.get_val(),
                              self.max_comp.get_val())
            delta_comp_rate = self.delta_comp.get_val()
        except:
            # si une erreur dans les parametres est detectee, soulever
            # l'erreur pour interrompre le programme
            raise

        def draw_sample():
            "fonction d'affichage de l'echantillon"
            DisplayRS(rs, scale=self.scale.get_val(), d=cpr.d)

        iteration = 0
        dFy = DisplayCurve(parent=self,
                           xlegend="\u03B5(%)",
                           ylegend="Fy",
                           yscale=10000,
                           ymax=0.05)

        cpr.d += cpr.delt_d
        strain = cpr.d / rs.h0 * 100
        comp_rate = rs.comp_count / rs.nsprings * 100
        comp_rate_next_display = 0

        first_compacted_displayed = False

        # Commencer la compression
        while comp_rate < cpr.max_comp:
            if self.stopped:
                print("Stopped.")
                return
            iteration += 1

            cpr.solve()

            test_comp_count = rs.comp_count
            comp_rate = rs.comp_count / rs.nsprings * 100

            # Affichage
            dFy.add_point(strain, cpr.Fy)
            if not first_compacted_displayed and comp_rate > 0.:
                threading.Thread(target=draw_sample).start()
                first_compacted_displayed = True
                time.sleep(2)
            if comp_rate >= comp_rate_next_display:
                threading.Thread(target=draw_sample).start()
                comp_rate_next_display += delta_comp_rate
                time.sleep(2)

            print("\nIteration %5d: " % iteration)
            print("\tCompaction rate:", comp_rate)

            # Incrementer le deplacement si aucun ressort n'a ete compacte
            if cpr.rs.comp_count == test_comp_count:
                cpr.d += cpr.delt_d
                strain = cpr.d / rs.h0 * 100
                print("\tStrain: %f" % strain)

        threading.Thread(target=draw_sample).start()
        time.sleep(2)
        print("Done.")