コード例 #1
0
ecu_spec = RegularECUSpec(["My_Test_ECU_2", "My_Test_ECU_3"], 20000, 20000)
ecu_group_3 = api.set_ecus(sim_env, 2, 'MyProtocolECU', ecu_spec)

# create 3 ECUs with specification C (here: same as A)
ecu_spec = RegularECUSpec(["My_Test_ECU_4", "My_Test_ECU_5", "My_Test_ECU_6"], 20000, 20000)
ecu_group_4 = api.set_ecus(sim_env, 3, 'MyProtocolECU', ecu_spec)
 
#===============================================================================
#     Creating Gateways
#===============================================================================

# create the Gateway specification
ecu_spec = SimpleBusCouplerSpec([])

# set gateway delay to 0.000002 seconds
ecu_spec.set_ecu_setting('t_transition_process', 0.000002)

# create the gateway
gateway_group_1 = api.set_ecus(sim_env, 1, 'CANGateway', ecu_spec)

# create another gateway with same specification
gateway_group_2 = api.set_ecus(sim_env, 1, 'CANGateway', ecu_spec)

 
#===============================================================================
#     Create Architecture
#===============================================================================
 
# create the bus specifications
bus_spec = SimpleBusSpec(['CAN_0', 'CAN_1', 'CAN_2'])
bus_group = api.set_busses(sim_env, 3, 'StdCANBus', bus_spec)
コード例 #2
0
ファイル: main.py プロジェクト: PhilippMundhenk/IVNS
 
# register_ecu_classes(r"C:\Users\artur.mrowca\workspace\ECUSimulation\components\base\gateways")
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)
my_env = api.create_environment(180)
 
# Simple ECU CREATION
# ecu_spec = SimpleECUSpec([], 200, 200)
# set_settings_ecu(ecu_spec)
# ecu_group_0 = api.set_ecus(my_env, 7, 'SecureECU', ecu_spec)
 
# Sending ECU: Sends data in fixed intervals 
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 2000, 2000)
set_settings_ecu(ecu_spec)
 
ecu_spec.set_ecu_setting('p_stream_hold', False)  # Define holding behavior per ECU
ecu_spec.set_ecu_setting('p_stream_req_min_interval', 5)
 
ecu_spec.add_sending_actions(150, 0.6, can_registration.CAN_TEST_MSG, "TEST STRING A", 50)
ecu_spec.add_sending_actions(150, 0.3, 16, "TEST STRING B", 50)  # sends at 300, 308, 316, ...
 
ecu_group_1 = api.set_ecus(my_env, 1, 'RegularSecureECU', ecu_spec)
 
 
ecu_spec = SimpleECUSpec(['SEC 1'], 2000, 2000)
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_process', 100)  
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_intervall', 1000)  
 
set_settings_sec_mod(ecu_spec)
sec_mod_group = api.set_ecus(my_env, 1, 'SecLwAuthSecurityModule', ecu_spec)
 
コード例 #3
0
ファイル: main_tesla.py プロジェクト: PhilippMundhenk/IVNS
  
ecu_spec = RegularECUSpec(["TEST ECU 9", "TEST ECU 10"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
# ecu_spec.set_ecu_setting('t_prf_for_key_legitimation', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
# ecu_spec.set_ecu_setting('t_generate_compare_mac', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
ecu_group_3 = api.set_ecus(sim_env, 2, 'TeslaECU', ecu_spec)
 
ecu_spec = RegularECUSpec(["TEST ECU 11", "TEST ECU 12"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
# ecu_spec.set_ecu_setting('t_prf_for_key_legitimation', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
# ecu_spec.set_ecu_setting('t_generate_compare_mac', 0)  # NOTE: If this value has a realistic value this is not working or better to say it works with a extreme delay
ecu_spec.add_sending_actions(250, 0.2, can_registration.CAN_TEST_MSG_2, "TEST STRING A", 80)
ecu_group_4 = api.set_ecus(sim_env, 2, 'TeslaECU', ecu_spec)

# create gateways
ecu_spec = SimpleBusCouplerSpec([])
ecu_spec.set_ecu_setting('t_transition_process', 2)
gateway_group_1 = api.set_ecus(sim_env, 1, 'CANGateway', ecu_spec)
gateway_group_2 = api.set_ecus(sim_env, 1, 'CANGateway', ecu_spec)
 
# create buses and connect ECUs
bus_spec = SimpleBusSpec(['CAN_0', 'CAN_1', 'CAN_2'])
bus_group = api.set_busses(sim_env, 1, 'StdCANBus', bus_spec)
api.connect_bus_by_obj(sim_env, 'CAN_0', ecu_group_1 + ecu_group_3 + ecu_group_4) 

# set timing functions
t_set2 = TimingFunctionSet() 
ecu_func_set = StdTeslaECUTimingFunctions(main_library_tag='CyaSSL') 
for ecu in api.ecu_list_from_groups([[ecu_group_1 + ecu_group_3 + ecu_group_4]]):
    t_set2.set_mapping_from_function_set(ecu.ecu_id, ecu_func_set) 
    api.apply_timing_functions_set(sim_env, ecu.ecu_id, t_set2)
コード例 #4
0
ファイル: main_lwa_preset.py プロジェクト: sadrux/IVNS
# create an empty environment specification for the environment
sim_env = api.create_environment(200)

#===============================================================================
#     Creating ECUs
#=============================================================================== 

# create the ECU specification
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 20000, 20000)

# adjust the specification
ecu_spec.set_apply_jitter(0.000001)

# further settings can be found in the set_settings method of each component e.g. see RegularSecureECU class
ecu_spec.set_ecu_setting('p_stream_hold', False)
ecu_spec.set_ecu_setting('p_stream_req_min_interval', 5)
LWASpecPresets().apply_spec(ecu_spec, 'ecu')

# for a RegularECUSpec define sending actions of the ECU
ecu_spec.add_sending_actions(10, 0.25, can_registration.CAN_TEST_MSG, "TEST STRING A", 50)
ecu_spec.add_sending_actions(10, 0.5, 16, "TEST STRING B", 50)  # sends at 300, 308, 316, ...

# set the ECU already authenticated
ecu_spec.set_authenticated(True)

# generate a ECU group from the specification
ecu_group_1 = api.set_ecus(sim_env, 1, 'RegularSecureECU', ecu_spec)
 
# create further ECU groups
ecu_spec = RegularECUSpec(["RegularSecureECU_1", "RegularSecureECU_10"], 20000, 20000)
コード例 #5
0
ecu_group_1 = api.set_ecus(sim_env, 1, "TeslaECU", ecu_spec)

ecu_spec = RegularECUSpec(["TEST ECU 9", "TEST ECU 10"], 20000, 20000)
TeslaSpecPresets().apply_spec(ecu_spec)
ecu_spec.set_apply_jitter(0.0000001)
ecu_group_3 = api.set_ecus(sim_env, 2, "TeslaECU", ecu_spec)

ecu_spec = RegularECUSpec(["TEST ECU 11", "TEST ECU 12"], 20000, 20000)
ecu_spec.set_apply_jitter(0.0000001)
TeslaSpecPresets().apply_spec(ecu_spec)
ecu_spec.add_sending_actions(250, 0.2, can_registration.CAN_TEST_MSG_2, "TEST STRING A", 80)
ecu_group_4 = api.set_ecus(sim_env, 2, "TeslaECU", ecu_spec)

# create gateways
ecu_spec = SimpleBusCouplerSpec([])
ecu_spec.set_ecu_setting("t_transition_process", 2)
gateway_group_1 = api.set_ecus(sim_env, 1, "CANGateway", ecu_spec)
gateway_group_2 = api.set_ecus(sim_env, 1, "CANGateway", ecu_spec)

# create buses and connect ECUs
bus_spec = SimpleBusSpec(["CAN_0", "CAN_1", "CAN_2"])
bus_group = api.set_busses(sim_env, 1, "StdCANBus", bus_spec)
api.connect_bus_by_obj(sim_env, "CAN_0", ecu_group_1 + ecu_group_3 + ecu_group_4)

# set timing functions
t_set2 = TimingFunctionSet()
ecu_func_set = StdTeslaECUTimingFunctions(main_library_tag="CyaSSL")
for ecu in api.ecu_list_from_groups([[ecu_group_1 + ecu_group_3 + ecu_group_4]]):
    t_set2.set_mapping_from_function_set(ecu.ecu_id, ecu_func_set)
    api.apply_timing_functions_set(sim_env, ecu.ecu_id, t_set2)
コード例 #6
0
ファイル: main.py プロジェクト: xding/IVNS
# register_ecu_classes(r"C:\Users\artur.mrowca\workspace\ECUSimulation\components\base\gateways")
api_log_path = os.path.join(os.path.dirname(__file__), "logs/api.log")
api.show_logging(logging.INFO, api_log_path, True)
my_env = api.create_environment(180)

# Simple ECU CREATION
# ecu_spec = SimpleECUSpec([], 200, 200)
# set_settings_ecu(ecu_spec)
# ecu_group_0 = api.set_ecus(my_env, 7, 'SecureECU', ecu_spec)

# Sending ECU: Sends data in fixed intervals
ecu_spec = RegularECUSpec(["RegularSecureECU_15"], 2000, 2000)
set_settings_ecu(ecu_spec)

ecu_spec.set_ecu_setting('p_stream_hold',
                         False)  # Define holding behavior per ECU
ecu_spec.set_ecu_setting('p_stream_req_min_interval', 5)

ecu_spec.add_sending_actions(150, 0.6, can_registration.CAN_TEST_MSG,
                             "TEST STRING A", 50)
ecu_spec.add_sending_actions(150, 0.3, 16, "TEST STRING B",
                             50)  # sends at 300, 308, 316, ...

ecu_group_1 = api.set_ecus(my_env, 1, 'RegularSecureECU', ecu_spec)

ecu_spec = SimpleECUSpec(['SEC 1'], 2000, 2000)
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_process', 100)
ecu_spec.set_ecu_setting('t_ecu_auth_trigger_intervall', 1000)

set_settings_sec_mod(ecu_spec)
sec_mod_group = api.set_ecus(my_env, 1, 'SecLwAuthSecurityModule', ecu_spec)