Exemplo n.º 1
0
 def test_baku_power_sequence(self, tsm):
     daq_pins1 = ["DAQ_Pins1"]
     daq_pins2 = ["DAQ_Pins2"]
     daq_pins_out = ["TestAnalogO"]
     daq_sessions_1 = ni_daqmx.pins_to_session_sessions_info(tsm, daq_pins1)
     daq_sessions_2 = ni_daqmx.pins_to_session_sessions_info(tsm, daq_pins2)
     daq_sessions_out = ni_daqmx.pins_to_session_sessions_info(
         tsm, daq_pins_out)
     sessions_all = daq_sessions_1.sessions + daq_sessions_2.sessions
     daq_sessions_all = ni_daqmx.MultipleSessions(
         pin_query_context=daq_sessions_1.pin_query_context,
         sessions=sessions_all)
     daq_sessions_all.stop_task()
     daq_sessions_all.timing()
     daq_sessions_out.timing()
     # for s in daq_sessions_2.sessions:
     #    print(s.Task.triggers.reference_trigger.analog_edge_src)
     # daq_sessions_2.reference_digital_edge("PXI_Trig0", constant.Slope.FALLING, 10)
     output = 2.0  # configure output in NI-MAX
     error = 0.00123  # 16 bits with range 20 for both input and output
     daq_sessions_out.write_data([output, output])
     daq_sessions_all.start_task()
     data = daq_sessions_all.read_waveform_multichannel(50)
     for measure in data[16:18]:
         for value in measure:
             assert output + error > value > output - error
     daq_sessions_out.write_data([0, 0])
     print("\nAll measured values within the expected value of: ", output,
           "+-", error)
     print("\nDevice has been released: ", output, "+-", error)
     daq_sessions_out.stop_task()
     daq_sessions_all.stop_task()
Exemplo n.º 2
0
def scenario2(tsm: SMContext):
    daq_pins_in_dsa = ["TestIn"]
    daq_pins_out_dsa = ["TestOut2"]
    daq_sessions_out_dsa = ni_daqmx.pins_to_session_sessions_info(
        tsm, daq_pins_out_dsa)
    daq_sessions_in_dsa = ni_daqmx.pins_to_session_sessions_info(
        tsm, daq_pins_in_dsa)
    daq_sessions_out_dsa.timing(sampling_rate_hz=1250)  # DSA Channel
    daq_sessions_in_dsa.timing(sampling_rate_hz=10000)  # DSA Channel
    expected = 2.0  # configure expected in NI-MAX
    daq_sessions_in_dsa.start_task()
    daq_sessions_out_dsa.write_data([expected, expected])
    data2 = daq_sessions_in_dsa.read_waveform_multichannel(1000)
    value = max(data2[0])
    yield value
    daq_sessions_out_dsa.stop_task()
    daq_sessions_in_dsa.stop_task()
Exemplo n.º 3
0
def daqmx_tsm_s(tsm, tests_pins):
    """Returns LabVIEW Cluster equivalent data"""
    print(tests_pins)
    daqmx_tsms = []
    sessions = []
    for test_pin_group in tests_pins:
        print(test_pin_group)
        data = ni_daqmx.pins_to_session_sessions_info(tsm, test_pin_group)
        daqmx_tsms.append(data)
        sessions += data.sessions
    print(sessions)
    test = (tsm, daqmx_tsms)
    yield test
Exemplo n.º 4
0
 def test_baku_dsa_write_read(self, tsm):
     daq_pins_in_dsa = ["TestIn"]
     daq_pins_out_dsa = ["TestOut2"]
     daq_sessions_out_dsa = ni_daqmx.pins_to_session_sessions_info(
         tsm, daq_pins_out_dsa)
     daq_sessions_in_dsa = ni_daqmx.pins_to_session_sessions_info(
         tsm, daq_pins_in_dsa)
     daq_sessions_out_dsa.timing(sampling_rate_hz=1250)  # DSA Channel
     daq_sessions_in_dsa.timing(sampling_rate_hz=10000)  # DSA Channel
     output = 2.0  # configure output in NI-MAX
     error = 0.05  # 16 bits with range 20 for both input and output
     daq_sessions_in_dsa.start_task()
     daq_sessions_out_dsa.write_data([output, output])  # TODO missing write
     data2 = daq_sessions_in_dsa.read_waveform_multichannel(1000)
     value = max(data2[0])
     assert output + error > value > output - error
     print(value)
     print("\nAll measured values within the expected value of: ", output,
           "+-", error)
     print("\nDevice has been released: ", output, "+-", error)
     daq_sessions_out_dsa.stop_task()
     daq_sessions_in_dsa.stop_task()
Exemplo n.º 5
0
def scenario1(tsm: SMContext):
    daq_pins1 = ["DAQ_Pins1"]
    daq_pins2 = ["DAQ_Pins2"]
    daq_pins_out = ["TestAnalogO"]
    daq_sessions_1 = ni_daqmx.pins_to_session_sessions_info(tsm, daq_pins1)
    daq_sessions_2 = ni_daqmx.pins_to_session_sessions_info(tsm, daq_pins2)
    daq_sessions_out = ni_daqmx.pins_to_session_sessions_info(
        tsm, daq_pins_out)
    sessions_all = daq_sessions_1.sessions + daq_sessions_2.sessions
    daq_sessions_all = ni_daqmx.MultipleSessions(
        pin_query_context=daq_sessions_1.pin_query_context,
        sessions=sessions_all)
    daq_sessions_all.stop_task()
    daq_sessions_all.timing()
    daq_sessions_out.timing()
    output = 2.0
    daq_sessions_out.write_data([output, output])
    daq_sessions_all.start_task()
    data = daq_sessions_all.read_waveform_multichannel(50)
    yield data
    daq_sessions_out.write_data([0, 0])
    daq_sessions_out.stop_task()
    daq_sessions_all.stop_task()
Exemplo n.º 6
0
def configure(tsm: SMContext, pins: typing.List[str]):
    tsm_multi_session: ni_daqmx.MultipleSessions
    tsm_multi_session = ni_daqmx.pins_to_session_sessions_info(tsm, pins)
    # Timing Configuration
    tsm_multi_session.timing(1000, 500)
    # Trigger Configuration
    tsm_multi_session.reference_analog_edge("APFI0")
    tsm_multi_session.reference_digital_edge("PXI_Trig0",
                                             constant.Slope.FALLING, 10)
    # Configure Read Channels
    tsm_multi_session.configure_channels()
    # Get Properties
    data = tsm_multi_session.get_task_properties()
    return data
Exemplo n.º 7
0
def acquisition_multi_ch(tsm: SMContext, pins: typing.List[str]):
    tsm_multi_session: ni_daqmx.MultipleSessions
    tsm_multi_session = ni_daqmx.pins_to_session_sessions_info(tsm, pins)
    tsm_multi_session.start_task()
    yield tsm_multi_session.read_waveform_multichannel()
    tsm_multi_session.stop_task()
Exemplo n.º 8
0
def pins_to_sessions(
    tsm: SMContext,
    pins: typing.List[str],
):
    return ni_daqmx.pins_to_session_sessions_info(tsm, pins)