test_channel_creation.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:nidaqmx-python 作者: ni 项目源码 文件源码
def test_create_ai_thrmstr_chan_vex(self, x_series_device, seed):
        # Reset the pseudorandom number generator with seed.
        random.seed(seed)

        ai_phys_chan = random.choice(x_series_device.ai_physical_chans).name

        with nidaqmx.Task() as task:
            ai_channel = task.ai_channels.add_ai_thrmstr_chan_vex(
                ai_phys_chan, name_to_assign_to_channel="ThermistorVexChannel",
                min_val=-50.0, max_val=300.0, units=TemperatureUnits.DEG_C,
                resistance_config=ResistanceConfiguration.FOUR_WIRE,
                voltage_excit_source=ExcitationSource.EXTERNAL,
                voltage_excit_val=2.5, a=0.001295361, b=0.0002343159,
                c=0.0000001018703, r_1=5000.0)

            assert ai_channel.physical_channel.name == ai_phys_chan
            assert ai_channel.name == "ThermistorVexChannel"
            assert numpy.isclose(ai_channel.ai_min, -50.0, atol=1)
            assert numpy.isclose(ai_channel.ai_max, 300.0, atol=1)
            assert ai_channel.ai_temp_units == TemperatureUnits.DEG_C
            assert (ai_channel.ai_resistance_cfg ==
                    ResistanceConfiguration.FOUR_WIRE)
            assert ai_channel.ai_excit_src == ExcitationSource.EXTERNAL
            assert ai_channel.ai_excit_val == 2.5

            assert ai_channel.ai_thrmstr_a == 0.001295361
            assert ai_channel.ai_thrmstr_b == 0.0002343159
            assert ai_channel.ai_thrmstr_c == 0.0000001018703
            assert ai_channel.ai_thrmstr_r_1 == 5000.0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号