def first (dst, d, v, stat): if dst > 360.+stat["d_ca"]+stat["tr"]: d = d + [360., dst-360.-stat["d_ca"]-stat["tr"], stat["d_ca"], stat["tr"]] v = v + [stat["v_a"], stat["v_a"], stat["v_c"], stat["v_c"]] elif dst > stat["tr"]+stat["d_0c"]: d1 = (stat["v_c"]*stat["v_c"] + 2*stat["a"]*(dst-stat["tr"]))/(4*stat["a"]) d2 = dst-d1-stat["tr"] new_v = kn.find_v({"v0": 0., "a": stat["a"], "d": d1}) d = d + [d1, d2, stat["tr"]] v = v + [new_v, stat["v_c"], stat["v_c"]] elif dst > stat["d_0c"]: d = d + [stat["d_0c"], dst-stat["d_0c"]] v = v + [stat["v_c"], stat["v_c"]] else: new_v = kn.find_v({"v0": 0., "a": stat["a"], "d": dst}) d = d + [dst] v = v + [new_v] return (d, v)
def last_straight (dst, d, v, stat): if dst > 360.: d = d + [360., dst-360.] v = v + [stat["v_a"], stat["v_a"]] else: new_v = kn.find_v({"v0": 0., "a": stat["a"], "d": dst}) d = d + [dst] v = v + [new_v] return (d, v)
def first_straight (dst, d, v, stat): if dst > 360.: d = d + [dst-360., 360.] v = v + [stat["v_a"], 0.] else: print("Please enter door slowly.") new_v = kn.find_v({"v0": 0., "a": stat["a"], "d": dst}) d = d + [dst] v = [new_v, 0.] return (d, v)
def middle_straight (dst, d, v, stat): if dst > 2*360.: d = d + [360., dst-2*360., 360.] v = v + [stat["v_a"], stat["v_a"], 0.] else: dst2 = dst/2 new_v = kn.find_v({"v0": 0., "a": stat["a"], "d": dst2}) d = d + [dst2, dst2] v = v + [new_v, 0.] return (d, v)
def last_end (dst, d, v, stat): if dst > stat["tr"]+stat["d_ca"]: d = d + [stat["tr"], stat["d_ca"], dst-stat["tr"]-stat["d_ca"]] v = v + [stat["v_c"], stat["v_a"], stat["v_a"]] elif dst > stat["tr"]: new_v = kn.find_v({"v0": stat["v_c"], "a": stat["a"], "d": dst-stat["tr"]}) d = d + [stat["tr"], dst-stat["tr"]] v = v + [stat["v_c"], new_v] else: d = d + [dst] v = v + [stat["v_c"]] return (d, v)
def first_start (dst, d, v, stat): if dst > stat["d_ca"]+stat["tr"]: d = d + [dst-stat["d_ca"]-stat["tr"], stat["d_ca"], stat["tr"]] v = v + [stat["v_a"], stat["v_c"], stat["v_c"]] elif dst > stat["d_ca"]: d = d + [dst-stat["d_ca"], stat["d_ca"]] v = v + [stat["v_a"], stat["v_c"]] else: print("Please enter door slowly.") d = d + [dst] new_v = kn.find_v({"v0": stat["v_c"], "a": stat["a"], "d": dst}) v = [new_v, stat["v_c"]] return (d, v)
def middle (lengths, d, v, stat): for i in range(1, len(lengths)-1): dst = lengths[i] if dst > 2*(stat["d_ca"]+2*stat["tr"]): d = d + [stat["tr"], stat["d_ca"], dst-2*(stat["d_ca"]+stat["tr"]), stat["d_ca"], stat["tr"]] v = v + [stat["v_c"], stat["v_a"], stat["v_a"], stat["v_c"], stat["v_c"]] elif dst > 2*stat["tr"]: dst2 = (dst-2*stat["tr"])/2 new_v = kn.find_v({"v0": stat["v_c"], "a": stat["a"], "d": dst2}) d = d + [stat["tr"], dst2, dst2, stat["tr"]] v = v + [stat["v_c"], new_v, stat["v_c"], stat["v_c"]] else: d = d + [dst] v = v + [stat["v_c"]] return (d, v)
def last (dst, d, v, stat): if dst > stat["tr"]+stat["d_ca"]+360.: d = d + [stat["tr"], stat["d_ca"], dst-stat["tr"]-stat["d_ca"]-360., 360.] v = v + [stat["v_c"], stat["v_a"], stat["v_a"], 0.] elif dst > stat["tr"]+stat["d_0c"]: d2 = (stat["v_c"]*stat["v_c"] + 2*stat["a"]*(dst-stat["tr"]))/(4*stat["a"]) d1 = dst-d2-stat["tr"] new_v = kn.find_v({"v0": stat["v_c"], "a": stat["a"], "d": d1}) d = d + [stat["tr"], d1, d2] v = v + [stat["v_c"], new_v, 0.] elif dst > stat["d_0c"]: d = d + [dst-stat["d_0c"], stat["d_0c"]] v = v + [stat["v_c"], 0.] else: d = d + [dst] v = v + [0.] return (d, v)
def v_crl(self): return kn.find_v({"v0": self.type["v_rl"], "a": -1*self.type["a_rl"], "d": 360-self.type["tr"]}) def lift_nl(self): return self.type["lift_nl"]