Example #1
0
            u_ave = cha_u_vals.mean()
            i_ave = chb_i_vals.mean()
            r_ave = u_ave / i_ave
            u_std = cha_u_vals.std()
            i_std = chb_i_vals.std()
            r_std = u_std / i_std
            charge_val = charge_val + TIME_STEP * i_ave
            meas_time = int(time.time() - start_time)
            print("t={:4}: f={:4}  DC: U={:6.3f} V, I={:7.4f} mA  AC: U={:8.6f} V, I={:7.4f} mA, R={:5.4f} Ohm, C={:4.1f} mAh"\
            .format(meas_time, freq, u_ave, i_ave*1000, u_std, i_std*1000, r_std, charge_val))
            meas_file.write("{};{};{:.3f};{:.4f};{:.6f};{:.4f};{:.4f};{:4.1f}\n"\
            .format(meas_time, freq, u_ave, i_ave*1000,u_std, i_std*1000, r_std, charge_val))
            session.end()
            time.sleep(0.5)
        else:
            print('Programm wurde durch Return-Eingabe beendet.')
            break
    meas_file.close()
    time.sleep(2)
    # Damit M1K nach Beenden im sicheren Zustand
    CHA.mode = Mode.HI_Z_SPLIT  # Put CHA in Hi Z split mode
    CHB.mode = Mode.HI_Z_SPLIT  # Put CHB in Hi Z split mode
    CHA.constant(0.0)
    CHB.constant(0.0)
    if session.continuous:
        session.end()
    session.remove(dev)  # damit kein Problem beim erneuten Start
else:
    print('kein M1K angeschlossen')
Example #2
0
        cha_u_vals = np.asarray(cha_u_vals)
        chb_i_vals = np.asarray(chb_i_vals) - CURR_OFFSET/1000 # Offset Korrektur
        
        u_ave = cha_u_vals.mean()
        i_ave = chb_i_vals.mean()
        r_ave = u_ave / i_ave
        u_std = cha_u_vals.std()
        i_std = chb_i_vals.std()
        r_std = u_std / i_std
        charge_val = charge_val + TIME_STEP * i_ave
        meas_time = int(time.time() - start_time)
        print("t={:4}: DC: U={:6.3f} V, I={:7.4f} mA, R={:6.3f} Ohm   AC: U={:8.6f} V, I={:7.4f} mA, R={:6.4f} Ohm  C={:4.1f} mAh"\
        .format(meas_time, u_ave, i_ave*1000, r_ave, u_std, i_std*1000, r_std, charge_val))
        meas_file.write("{};{:.3f};{:.4f};{:.3f};{:.6f};{:.4f};{:.4f};{:4.1f}\n"\
        .format(meas_time, u_ave, i_ave*1000, r_ave,u_std, i_std*1000, r_std, charge_val))
        time.sleep(TIME_STEP)

    print('Programm wurde durch Return-Eingabe beendet.')
    meas_file.close()
    time.sleep(2)
    # damit M1K nach Beenden im sicheren Zustand
    CHA.mode = Mode.HI_Z_SPLIT # Put CHA in Hi Z split mode
    CHB.mode = Mode.HI_Z_SPLIT # Put CHB in Hi Z split mode
    CHA.constant(0.0)
    CHB.constant(0.0)
    if session.continuous:
        session.end()
    session.remove(dev) # damit kein Problem beim erneutem Programmstart.     
else:
    print('no devices attached')