def memory_chart(last_seconds = 0): time, usage = agros2d.memory_usage() if (last_seconds == 0): pythonlab.chart(time, usage, "t (s)", "Mem (MB)") else: pythonlab.chart(time[-(last_seconds+1):], usage[-(last_seconds+1):], "t (s)", "Mem (MB)")
def memory_chart(last_seconds=0): time, usage = agros2d.memory_usage() if last_seconds == 0: pythonlab.chart(time, usage, "t (s)", "Mem (MB)") else: pythonlab.chart(time[-(last_seconds + 1) :], usage[-(last_seconds + 1) :], "t (s)", "Mem (MB)")
step = 2.0 space = list() density = list() energy = list() torque = list() phi = 0.0 while phi <= 90.0: Jext = get_density(phi) Wm = get_energy(step * bool(phi), Jext) print('phi: {0}; Jext : {1}, Wm : {2}'.format(phi, Jext, Wm)) space.append(phi) density.append(Jext) energy.append(Wm) phi = phi + step for i in range(0, len(energy)): if (i != len(energy) - 1): step = space[i + 1] - space[i] torque.append(-(energy[i + 1] - energy[i]) / (step / 180.0 * pi)) else: torque.append(torque[0]) if (torque[-1] > 0.0): torque[-1] = 0.0 pythonlab.chart(space, energy, 'phi (deg.)', 'Wm (J)') pythonlab.chart(space, torque, 'phi (deg.)', 'T (Nm)')
return Jext step = 2.0 space = list() density = list() energy = list() torque = list() phi = 0.0 while phi <= 90.0: Jext = get_density(phi) Wm = get_energy(step * bool(phi), Jext) print('phi: {0}; Jext : {1}, Wm : {2}'.format(phi, Jext, Wm)) space.append(phi) density.append(Jext) energy.append(Wm) phi = phi + step for i in range(0, len(energy)): if (i != len(energy)-1): step = space[i+1] - space[i] torque.append(-(energy[i+1] - energy[i]) / (step/180.0 * pi)) else: torque.append(torque[0]) if (torque[-1] > 0.0): torque[-1] = 0.0 pythonlab.chart(space, energy, 'phi (deg.)', 'Wm (J)') pythonlab.chart(space, torque, 'phi (deg.)', 'T (Nm)')