def test_three_ph_3w_ydd_transformer(load_cpd, contactor_state1, contactor_state2, expected_values, contactor_name1, contactor_name2, measurement_names): # Set switch state hil.set_contactor(contactor_name1, swControl=True, swState=contactor_state1) hil.set_contactor(contactor_name2, swControl=True, swState=contactor_state2) # Start capture sim_time = hil.get_sim_time() capture.start_capture(duration=0.1, signals=measurement_names, executeAt=sim_time + 1.5) # Data acquisition cap_data = capture.get_capture_results(wait_capture=True) measurements = cap_data # Tests for i, expected_value in enumerate(expected_values): sig.assert_is_constant(measurements[measurement_names[i]], at_value=around(expected_value, tol_p=0.001))
def test_3ph_w1w2_transformer(load_cpd, source_value, contactor_state, expected_value, source_name, contactor_name, measurement_name): # Set source value. hil.set_source_sine_waveform(name=source_name, rms=source_value / np.sqrt(3), frequency=50) # Set switch state hil.set_contactor(name=contactor_name, swControl=True, swState=contactor_state) # Start_capture sim_time = hil.get_sim_time() capture.start_capture(duration=0.1, signals=[measurement_name], executeAt=sim_time + 2) # Data acquisition cap_data = capture.get_capture_results(wait_capture=True) measurement = cap_data[measurement_name] # Tests sig.assert_is_constant(measurement, at_value=around(expected_value, tol_p=0.001))
def test_pv_pvanel(convert_compile_load): # Start capture sim_time = hil.get_sim_time() start_capture(duration=0.1, signals=["I1"], executeAt=sim_time + 0.5) # Data acquisition cap_data = get_capture_results(wait_capture=True) measurement = cap_data # Tests sig.assert_is_constant(measurement["I1"], at_value=around(5.21, tol_p=0.001))
def test_coupled_inductors(convert_compile_load, expected_values, measurement_names): # Start capture sim_time = hil.get_sim_time() start_capture(duration=0.1, signals=measurement_names, executeAt=sim_time + 0.5) # Data acquisition cap_data = get_capture_results(wait_capture=True) measurement = cap_data # Tests for i, expected_value in enumerate(expected_values): sig.assert_is_constant(measurement[measurement_names[i]], at_value=around(expected_value, tol_p=0.001))
def test_three_ph_3w_ydd_transformer(load_cpd, ss_ydd2, ss_ydd3, expected_values): measurement_names = ['Vydd2', 'Vydd3', 'Iydd2', 'Iydd3'] # Set switch state hil.set_contactor('ss_ydd2', swControl=True, swState=ss_ydd2) hil.set_contactor('ss_ydd3', swControl=True, swState=ss_ydd3) # Start capture sim_time = hil.get_sim_time() capture.start_capture(duration=0.1, signals=measurement_names, executeAt=sim_time + 1.5) # Data acquisition cap_data = capture.get_capture_results(wait_capture=True) # Tests for i,expected_value in enumerate(expected_values): sig.assert_is_constant(cap_data[measurement_names[i]], at_value=around(expected_value, tol_p=0.001))
def test_3ph_dy_transformer(load_cpd, Vsin_dy, f, SS_dy, expected_values, measurement_names): # Set source value. hil.set_source_sine_waveform(name='Vsin_dy', rms=Vsin_dy / np.sqrt(3), frequency=f) # Set switch state hil.set_contactor('SS_dy', swControl=True, swState=SS_dy) # Start_capture sim_time = hil.get_sim_time() capture.start_capture(duration=0.1, signals=measurement_names, executeAt=sim_time + 1.5) # Data acquisition cap_data = capture.get_capture_results(wait_capture=True) # Tests for i, expected_value in enumerate(expected_values): sig.assert_is_constant(cap_data[measurement_names[i]], at_value=around(expected_value, tol_p=0.001))