version = 4.2

//
// Saved by sw version: 2024.4
//

model "adc_sampling" {
    configuration {
        hil_device = "HIL404"
        hil_configuration_id = 1
        simulation_method = exact
        simulation_time_step = auto
        simulation_discret_scaling = 1.0
        dsp_timer_periods = 100e-6, 50e-3
        ss_calc_method = "systematic elimination"
        enb_pole_shift = True
        enb_gds_oversampling = True
        show_modes = False
        device_ao_limit_enable = False
        reset_analog_outputs_on_sim_stop = True
        reset_analog_outputs_on_sim_stop_mode = Offset values
        reset_digital_outputs_on_sim_stop = True
        vhil_adio_loopback = False
        cpl_stb = False
        enb_dep_sw_detect = False
        code_section = "internal memory"
        data_section = "internal memory"
        sys_sp_rate_1 = 0.0001
        sys_sp_rate_2 = 0.05
        sys_real_type_precision = "default"
        user_real_type_precision = "default"
        sys_cpu_optimization = "high"
        user_cpu_optimization = "high"
        user_cpu_part_option = "default"
        matrix_based_reduction = True
        cpl_dynamics_analysis = False
        export_ss_to_pickle = False
        ground_scope_core = False
        dss_num_tol = 1e-15
        cce_platform = "launchxl-f28379d"
        cce_use_relative_names = False
        cce_type_mapping_real = "launchxl-f28379d"
        cce_type_mapping_uint = "unsigned int"
        cce_type_mapping_int = "int"
        cce_platform = "launchxl-f28379d"
        cce_use_relative_names = False
        cce_type_mapping_real = "launchxl-f28379d"
        cce_type_mapping_uint = "unsigned int"
        cce_type_mapping_int = "int"
        cce_directory = ""
        cce_custom_type_int = ""
        cce_custom_type_uint = ""
        cce_custom_type_real = ""
        tunable_params = "component defined"
        sp_compiler_type = "C compiler"
        sig_stim = "off"
        export_resource_list = ""
        export_dependency_list = ""
        excluded_resource_list = ""
        excluded_component_from_locking_list = ""
        export_out_file = ""
        export_lock_top_level = True
        export_encrypt_library = True
        export_encrypt_resources = True
        solver_type = "DAE"
        integration_method = "BDF"
        max_sim_step = 1e-4
        simulation_time = 1.0
        abs_tol = 1e-3
        rel_tol = 1e-3
        init_sim_step = 1e-6
        r_on_sw = 1e-3
        v_on_diode = 0.2
        data_sampling_rate = 0
        feedthrough_validation_error_level = error
    }

    component Subsystem Root {
        component "TI C2000 Toolbox/TI C2000 Setup" "TI C2000 Setup1" {
            build_and_deploy_action = "False"
            c2000ware_root_path = "C:\ti\C2000Ware_5_04_00_00"
            ccs_project_name = "adc"
            ccs_project_path = "D:/Milan/trac_reporting"
            ccs_root_path = "C:\ti\ccs1281"
            exp_subsys_name = "adc"
            scheduling = "ADCA Interrupt"
        }
        [
            position = 8276, 8072
            size = 64, 64
        ]

        component "core/Voltage Source" Vs1 {
            init_frequency = "60"
            init_rms_value = "40.82"
            init_source_nature = "Sine"
        }
        [
            position = 7788, 8424
            rotation = right
        ]

        component "core/Resistor" R1 {
        }
        [
            position = 8012, 8424
            rotation = right
        ]

        component "core/Current Measurement" Ia1 {
        }
        [
            position = 7892, 8360
            size = 64, 32
        ]

        component Subsystem adc {
            layout = dynamic
            component "TI C2000 Toolbox/ADC (Generic)" "ADC (Generic)1" {
                conv_trigger = "ePWM1"
                execution_rate = "Ts"
                inten = "True"
                offset = "1.5"
                scaling = "40"
            }
            [
                position = 7984, 8228
                size = 127, 63
            ]

            component "TI C2000 Toolbox/ePWM (Generic)" "ePWM (Generic)1" {
                soc_en = "True"
            }
            [
                position = 8424, 8276
                size = 127, 63
            ]

            component "core/Gain" Gain1 {
                gain = "1/120"
            }
            [
                position = 8280, 8276
            ]

            component "core/Sum" Sum1 {
            }
            [
                position = 8192, 8276
            ]

            component "core/Constant" Constant1 {
                execution_rate = "Ts"
                value = "60"
            }
            [
                position = 8112, 8284
                hide_name = True
            ]

            component "core/Probe" ao1_sample {
            }
            [
                position = 8188, 8168
            ]

            junction Junction1 sp
            [
                position = 8108, 8228
            ]

            connect Sum1.in1 Constant1.out as Connection5
            connect Sum1.out Gain1.in as Connection7
            connect "ePWM (Generic)1.In1" Gain1.out as Connection8
            connect "ADC (Generic)1.Out" Junction1 as Connection9
            connect Junction1 Sum1.in as Connection10
            connect ao1_sample.in Junction1 as Connection11
        }
        [
            position = 8280, 8168
            size = 48, 48
        ]

        component "core/PWM Analyzer" "PWM Analyzer1" {
            execution_rate = "10e-6"
        }
        [
            position = 8240, 8408
        ]

        component "core/Probe" val {
        }
        [
            position = 8548, 8416
        ]

        component "core/Gain" Gain1 {
            gain = "120"
        }
        [
            position = 8380, 8376
            hide_name = True
        ]

        component "core/Sum" Sum1 {
            signs = "+-"
        }
        [
            position = 8460, 8416
        ]

        component "core/Constant" Constant1 {
            execution_rate = "10e-6"
            value = "60"
        }
        [
            position = 8380, 8424
            hide_name = True
        ]

        component "core/Output Settings" "Output Settings1" {
            analog_outputs = "[\'AO1;..Va1.Mask@top.voltage;40;1.5;False;-10;10\']"
        }
        [
            position = 7900, 8208
        ]

        component "core/Voltage Measurement" Va1 {
        }
        [
            position = 7676, 8424
            rotation = right
            size = 64, 32
        ]

        junction Junction1 pe
        [
            position = 7788, 8480
        ]

        junction Junction2 pe
        [
            position = 7788, 8360
        ]

        connect R1.p_node Ia1.n_node as Connection2
        connect Sum1.in1 Constant1.out as Connection4
        connect Sum1.out val.in as Connection5
        connect Gain1.out Sum1.in as Connection6
        connect "PWM Analyzer1.duty_cycle" Gain1.in as Connection7
        connect Junction1 Va1.n_node as Connection8
        connect Junction1 R1.n_node as Connection9
        connect Junction1 Vs1.n_node as Connection10
        connect Junction2 Va1.p_node as Connection11
        connect Junction2 Ia1.p_node as Connection12
        connect Junction2 Vs1.p_node as Connection13
    }

    default {
        "core/Constant" {
            value = "1"
            signal_type = "real"
            execution_rate = "100e-6"
            _tunable = "False"
        }

        "core/Gain" {
            gain = "1"
            multiplication = "Element-wise(K.*u)"
            _tunable = "False"
            execution_rate = "inherit"
        }

        "core/Output Settings" {
            analog_outputs = "[]"
            digital_outputs = "[]"
            hil_id = "0"
            signal = ""
        }

        "core/PWM Analyzer" {
            input1 = "1"
            input1_logic = "active high"
            sec_ch_en = "False"
            input2 = "2"
            input2_logic = "active high"
            cross_ch_analysis = "None"
            angle_unit = "Degrees"
            min_max_en = "False"
            channel = "0"
            execution_rate = "100e-6"
            _supported_platforms = "[\'hil\', \'vhil\']"
        }

        "core/Probe" {
            signal_access = "inherit"
            addr = "0"
            override_signal_name = "False"
            signal_name = ""
            signal_type = "generic"
            streaming_en = "False"
            streaming_er_idx = "0"
            execution_rate = "inherit"
        }

        "core/Resistor" {
            resistance = "1"
            param_set = ""
        }

        "core/Sum" {
            signs = "2"
            execution_rate = "inherit"
        }

        "core/Voltage Source" {
            sig_input = "False"
            type = "signal generator"
            param_set = "1phase"
            parent_label = ""
            dtsm_switch_name = ""
            addr = "0"
            spc_nb = "0"
            execution_rate = "100e-6"
            cpd_visible = "True"
            enable_snb = "False"
            snb_type = "R2"
            R2 = "0.0"
            L1 = "0.1"
            override_signal_name = "False"
            signal_name = ""
            init_source_nature = "Constant"
            init_const_value = "0.0"
            init_rms_value = "0.0"
            init_frequency = "50.0"
            init_phase = "0.0"
        }

        "TI C2000 Toolbox/ADC (Generic)" {
            hil_ao_nr = "1"
            interface_type = "HIL TI Launchpad Interface"
            controller_index = "1"
            scaling = "1"
            offset = "0"
            execution_rate = "100e-6"
            conv_trigger = "Software Only"
            inten = "False"
        }

        "core/Current Measurement" {
            signal_access = "inherit"
            bw_limit = "False"
            frequency = "10e3"
            comparator_enable = "False"
            operator = "greater"
            threshold = "0"
            cmp_abs_value = "False"
            feed_forward = "false"
            sig_output = "False"
            sig_output_filt_and_full_bw = "False"
            execution_rate = "100e-6"
            addr = "0"
            nd_msr_estimation = "false"
            dev_cpl_msr = "false"
            host_device = "0"
            output_to_device = "0"
            dev_cpl_index = "0"
            dev_cpl_var_nb = "0"
            visible = "True"
            override_signal_name = "False"
            signal_name = ""
        }

        "TI C2000 Toolbox/TI C2000 Setup" {
            build_and_deploy = "Build and deploy"
            build_and_deploy_action = "0"
            create_ccs_project = "Create CCS Project"
            create_ccs_project_action = "False"
            export = "Export code"
            export_action = "False"
            build = "Build"
            build_action = "False"
            flash = "Flash target"
            flash_action = "False"
            ex_rate_test = "Perform execution rate test"
            ex_rate_test_action = "False"
            exp_subsys_name = ""
            ccs_project_name = ""
            model_path_en = "True"
            ccs_project_path = "c:\git\t_mdl\010_ti_rcp_lib\ti_rcp_lib_v1"
            target_platform = "LAUNCHXL-F28379D"
            execution_rate = "100e-6"
            ccs_root_path = "C:\User Programs\ti"
            c2000ware_root_path = "C:\ti\C2000Ware_5_02_00_00"
            write_settings = "Write settings"
            scheduling = "CPU Timer Based Scheduler"
        }

        "core/Voltage Measurement" {
            signal_access = "inherit"
            bw_limit = "False"
            frequency = "10e3"
            comparator_enable = "False"
            operator = "greater"
            threshold = "0"
            cmp_abs_value = "False"
            feed_forward = "false"
            sig_output = "False"
            sig_output_filt_and_full_bw = "False"
            execution_rate = "100e-6"
            addr = "0"
            nd_msr_estimation = "false"
            dev_cpl_msr = "false"
            host_device = "0"
            output_to_device = "0"
            dev_cpl_index = "0"
            dev_cpl_var_nb = "0"
            visible = "True"
            override_signal_name = "False"
            signal_name = ""
        }

        "TI C2000 Toolbox/ePWM (Generic)" {
            hil_di_nr = "1"
            hil_di_nr_b = "2"
            interface_type = "HIL TI Launchpad Interface"
            controller_index = "1"
            nr_of_channels = "1"
            freq_op_mode = "Fixed carrier frequency"
            frequency = "10e3"
            phase_op_mode = "Fixed carrier phase offset"
            carr_ph_offset = "0"
            dead_time = "5e-7"
            load_mode = "on min"
            clock_time_ti = "5e-9"
            clock_time_emulator = "5e-9"
            soc_en = "False"
            soc_timing = "Counter equals zero"
            soc_period = "Every event"
            int_en = "False"
            int_timing = "Counter equals zero"
            int_period = "Every event"
        }
    }

    CODE model_init
        # Numpy module is imported as 'np'
        # Scipy module is imported as 'sp'
        # The Schematic API is imported as 'mdl'
        # To get the model file path, use 'mdl.get_model_file_path()'
        # To print information to the console, use info()
        Ts = 100e-6
    ENDCODE
}
