Plecs { Name "PN172_MMC_SSPWM_openLoop" Version "4.5" CircuitModel "ContStateSpace" StartTime "0.0" TimeSpan "0.4" Timeout "" Solver "dopri" MaxStep "1e-3" InitStep "-1" FixedStep "0.1*Ts" Refine "1" ZCStepSize "1e-9" RelTol "1e-3" AbsTol "-1" TurnOnThreshold "1.5" SyncFixedStepTasks "2" UseSingleCommonBaseRate "2" LossVariableLimitExceededMsg "3" NegativeSwitchLossMsg "3" DivisionByZeroMsg "3" StiffnessDetectionMsg "2" MaxConsecutiveZCs "0" AlgebraicLoopWithStateMachineMsg "3" AssertionAction "1" InitializationCommands "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" "%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% Product Note PN172\n% Parameters for the 'Modu" "lar Multilevel Converter (MMC) SSPWM openLoop' system\n% Copyright imperix lt" "d, 2024\n% dev@imperix.ch\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n% That variable is used in the configuration" " block\n% to define the frequency of Clock 0.\n% By default, it corresponds t" "o the interrupt\n% and sampling frequencies. \nf_clk0 = 20e3;\n\n%% Bus-side " "parameters :\nVdc = 800; % Bus EMF (V)\n\n%% Three-phase" "-side parameters :\nVac = 230;\nVac_pk = 325; % Nominal pea" "k AC amplitude (source EMF) (V)\nf = 50; % Line frequ" "ency (Hz)\nw = 2*pi*f; \n\n%% Submodules parameters :\nN = 4; " " % Number of submodules per arm\nCsm = 5.0e-3; % S" "ubmodule capacitance (F)\nRsm = 50e-3+1.8/8; % Submodule c" "apacitor ESR (ohm)\n\n%% Branch parameters :\nRb = 60e-3; " " % Parasitic branch resistance (constant part, ohm)\nLb = 2.3e-3; " " % Branch indu ctance (self part, H)\n\n%% Time parameters:\nfs = f_cl" "k0; % Interrupt frequency [Hz]\nTs = 1/fs; " " % Interrupt period [s]\n\n%% Load parameters\nRg = 8.5;\n\n%% Simulatio" "n\n% Vsm0 = [200 25 50 21 150 50 80 120 100 60 40 160 120 119 50 20 60 90 40 " "70 60 90 110 190]; % Initial value of the cap voltages _U (V)\n" "Vsm0 = Vdc/N*ones(1,24);\nDT = 1e-6;" InitialState "1" SystemState "" TaskingMode "1" TaskConfigurations "" CodeGenParameterInlining "2" CodeGenFloatingPointFormat "2" CodeGenAbsTimeUsageMsg "3" CodeGenBaseName "" CodeGenOutputDir "" CodeGenExtraOpts "" CodeGenTarget "Generic" CodeGenTargetSettings "" ExtendedMatrixPrecision "1" MatrixSignificanceCheck "2" EnableStateSpaceSplitting "2" DisplayStateSpaceSplitting "1" DiscretizationMethod "2" ExternalModeSettings "" AlgebraicLoopMethod "1" AlgebraicLoopTolerance "1e-6" ScriptsDialogGeometry "" ScriptsDialogSplitterPos "0" Schematic { Location [23, 51; 768, 400] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Subsystem Name "Imperix controller" Show on Position [155, 165] Direction up Flipped off Frame [-60, -90; 60, 90] LabelPosition [0, 93] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" TaskingMode "1" CodeGenEnable on CodeGenSampleTime "1/f_clk0" CodeGenDiscretizationMethod "2" CodeGenTarget "Imperix Controllers" CodeGenTargetSettings "AAAAfwAAAAAlUU1hcDxRU3RyaW5nLFFNYXA8UVN0cmluZyxRU" "3RyaW5nPiA+AAAAAAEAAAAmAEkAbQBwAGUAcgBpAHgAIABDAG8AbgB0AHIAbwBsAGwAZQByAHMAAA" "ABAAAAGgBjAGEAbgBfAGIAYQB1AGQAXwByAGEAdABlAAAADgAxADAAMAAwADAAMAAw" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-60, -55] Direction left Index "1" } Terminal { Type Input Position [-60, 0] Direction left Index "2" } Terminal { Type Input Position [-60, 50] Direction left Index "3" } Terminal { Type Input Position [-60, -40] Direction left Index "4" } Terminal { Type Input Position [-60, 15] Direction left Index "5" } Terminal { Type Input Position [-60, 65] Direction left Index "6" } Terminal { Type Input Position [-60, -25] Direction left Index "7" } Terminal { Type Input Position [-60, 30] Direction left Index "8" } Terminal { Type Input Position [-60, 80] Direction left Index "9" } Terminal { Type Input Position [-60, -80] Direction left Index "10" } Terminal { Type Output Position [64, -70] Direction right Index "1" } Terminal { Type Output Position [64, -80] Direction right Index "2" } Terminal { Type Output Position [64, -60] Direction right Index "3" } Terminal { Type Output Position [64, -10] Direction right Index "4" } Terminal { Type Output Position [64, 10] Direction right Index "5" } Terminal { Type Output Position [64, 55] Direction right Index "6" } Terminal { Type Output Position [64, 75] Direction right Index "7" } Schematic { Location [35, 57; 1134, 983] ZoomFactor 0.873844 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Reference SrcComponent "Imperix_Control/Config/Configuration" Name "Configuration" Show on Position [50, 55] Direction up Flipped off Frame [-30, -30; 30, 30] LabelPosition [0, 33] LabelAlign up Parameter { Variable "clock_freq" Value "f_clk0" Show off } Parameter { Variable "phase" Value "0.5" Show off } Parameter { Variable "postscaler" Value "0" Show off } Parameter { Variable "oversampling_conf" Value "1" Show off } Parameter { Variable "oversampling_phases" Value "[0.2 0.8]" Show off } Parameter { Variable "nbr_of_oversamples" Value "3" Show off } Parameter { Variable "adc_acq_delay" Value "1" Show off } Parameter { Variable "cycle_delay" Value "5e-6" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type EventOutput Position [34, -15] Direction right } Terminal { Type EventOutput Position [34, 5] Direction right } Terminal { Type EventOutput Position [34, -5] Direction right } } Component { Type ControlTaskTrigger Name "Control Task Trigger" Show on Position [150, 40] Direction left Flipped on Parameter { Variable "CodeFcn" Value "if (Target.Family ~= \"Imperix Controllers\") then" "\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "local Require = ResourceList:new()\n" "\n" "Require:add(Target.Coder.GetCtrlTaskTrigResource(0))\n" "\n" "return {\n" "\tRequire = Require\n" "}" Show off } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vsm_A" Show on Position [190, 175] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "0" Show off } Parameter { Variable "channel" Value "0:7" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "14" Show off } Parameter { Variable "sensor_gain" Value "-0.0089" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "1" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "I_up_low_A" Show on Position [190, 245] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "0" Show off } Parameter { Variable "channel" Value "12:13" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "1" Show off } Parameter { Variable "sensor_gain" Value "0.099" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "2" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vg_A" Show on Position [190, 365] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "0" Show off } Parameter { Variable "channel" Value "14" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "1" Show off } Parameter { Variable "sensor_gain" Value "0.00246" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "4" Show off } Parameter { Variable "TargetPortIndices" Value "3" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vsm_B" Show on Position [190, 450] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "1" Show off } Parameter { Variable "channel" Value "0:7" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "14" Show off } Parameter { Variable "sensor_gain" Value "-0.0089" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "4" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "I_up_low_B" Show on Position [190, 520] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "1" Show off } Parameter { Variable "channel" Value "12:13" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "1" Show off } Parameter { Variable "sensor_gain" Value "0.099" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "5" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vg_B" Show on Position [190, 645] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "1" Show off } Parameter { Variable "channel" Value "14" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "1" Show off } Parameter { Variable "sensor_gain" Value "0.00246" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "4" Show off } Parameter { Variable "TargetPortIndices" Value "6" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vsm_C" Show on Position [190, 745] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "2" Show off } Parameter { Variable "channel" Value "0:7" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "14" Show off } Parameter { Variable "sensor_gain" Value "-0.0089" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "7" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "I_up_low_C" Show on Position [190, 815] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "2" Show off } Parameter { Variable "channel" Value "12:13" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "1" Show off } Parameter { Variable "sensor_gain" Value "0.099" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "8" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vg_C" Show on Position [190, 945] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "2" Show off } Parameter { Variable "channel" Value "14" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "1" Show off } Parameter { Variable "sensor_gain" Value "0.00246" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "4" Show off } Parameter { Variable "TargetPortIndices" Value "9" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable" Show off Position [290, 205] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vsm_A" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable1" Show off Position [285, 480] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vsm_B" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable2" Show off Position [285, 775] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vsm_C" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type SignalDemux Name "Demux" Show off Position [250, 300] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable3" Show off Position [290, 270] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Iup_A" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable4" Show off Position [290, 330] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ilow_A" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type SignalDemux Name "Demux1" Show off Position [245, 580] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable5" Show off Position [285, 550] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Iup_B" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable6" Show off Position [285, 615] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ilow_B" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable9" Show off Position [290, 365] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vg_A" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable10" Show off Position [285, 645] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vg_B" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable11" Show off Position [285, 945] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vg_C" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Goto Name "Goto" Show off Position [285, 295] Direction right Flipped off Parameter { Variable "Tag" Value "Iup_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto1" Show off Position [285, 305] Direction right Flipped off Parameter { Variable "Tag" Value "Ilow_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto4" Show off Position [280, 575] Direction right Flipped off Parameter { Variable "Tag" Value "Iup_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto5" Show off Position [280, 585] Direction right Flipped off Parameter { Variable "Tag" Value "Ilow_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalDemux Name "Demux2" Show off Position [245, 875] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable7" Show off Position [285, 845] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Iup_C" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable8" Show off Position [285, 910] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ilow_C" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Goto Name "Goto6" Show off Position [280, 870] Direction right Flipped off Parameter { Variable "Tag" Value "Iup_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto7" Show off Position [280, 880] Direction right Flipped off Parameter { Variable "Tag" Value "Ilow_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Reference SrcComponent "Imperix_Control/IOs/ADC" Name "Vdc" Show on Position [190, 90] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "0" Show off } Parameter { Variable "channel" Value "15" Show off } Parameter { Variable "sync_avg" Value "1" Show off } Parameter { Variable "adc_hist" Value "1" Show off } Parameter { Variable "adc_hist_depth" Value "2" Show off } Parameter { Variable "sensor" Value "2" Show off } Parameter { Variable "sensor_gain" Value "0.00246" Show off } Parameter { Variable "sensor_offset" Value "0.0" Show off } Parameter { Variable "analog_gain" Value "3" Show off } Parameter { Variable "TargetPortIndices" Value "10" Show off } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type EventInput Position [-30, 15] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable12" Show off Position [290, 115] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Vdc" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Gain Name "Mean_Diff" Show on Position [420, 245] Direction right Flipped off Parameter { Variable "K" Value "[0.5 0.5 ; 1 -1]" Show on } Parameter { Variable "Multiplication" Value "2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalDemux Name "Demux3" Show off Position [465, 245] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable13" Show off Position [515, 230] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ibus_A" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable14" Show off Position [515, 260] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ig_A" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Gain Name "Mean_Diff1" Show on Position [425, 520] Direction right Flipped off Parameter { Variable "K" Value "[0.5 0.5 ; 1 -1]" Show on } Parameter { Variable "Multiplication" Value "2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalDemux Name "Demux4" Show off Position [470, 520] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable15" Show off Position [520, 505] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ibus_B" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable16" Show off Position [520, 535] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ig_B" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Gain Name "Mean_Diff2" Show on Position [435, 815] Direction right Flipped off Parameter { Variable "K" Value "[0.5 0.5 ; 1 -1]" Show on } Parameter { Variable "Multiplication" Value "2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalDemux Name "Demux5" Show off Position [480, 815] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable17" Show off Position [530, 800] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ibus_C" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variable" Name "Probe variable18" Show off Position [530, 830] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "Ig_C" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Component { Type From Name "From" Show off Position [1060, 175] Direction right Flipped off Parameter { Variable "Tag" Value "Iup_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalDemux Name "Demux6" Show off Position [270, 175] Direction right Flipped on Parameter { Variable "Width" Value "[4 4]" Show off } } Component { Type Goto Name "Goto2" Show off Position [315, 170] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_up_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto3" Show off Position [315, 180] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_low_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From1" Show off Position [1060, 150] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_up_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From2" Show off Position [1060, 325] Direction right Flipped off Parameter { Variable "Tag" Value "Ilow_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From3" Show off Position [1060, 300] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_low_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalDemux Name "Demux7" Show off Position [280, 450] Direction right Flipped on Parameter { Variable "Width" Value "[4 4]" Show off } } Component { Type Goto Name "Goto8" Show off Position [315, 445] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_up_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto9" Show off Position [315, 455] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_low_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalDemux Name "Demux8" Show off Position [280, 745] Direction right Flipped on Parameter { Variable "Width" Value "[4 4]" Show off } } Component { Type Goto Name "Goto10" Show off Position [325, 740] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_up_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto11" Show off Position [325, 750] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_low_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From4" Show off Position [1060, 495] Direction right Flipped off Parameter { Variable "Tag" Value "Iup_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From5" Show off Position [1060, 470] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_up_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From6" Show off Position [1060, 645] Direction right Flipped off Parameter { Variable "Tag" Value "Ilow_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From7" Show off Position [1060, 620] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_low_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From8" Show off Position [1060, 815] Direction right Flipped off Parameter { Variable "Tag" Value "Iup_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From9" Show off Position [1060, 790] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_up_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From10" Show off Position [1060, 965] Direction right Flipped off Parameter { Variable "Tag" Value "Ilow_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From11" Show off Position [1060, 940] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_low_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto12" Show off Position [285, 90] Direction right Flipped off Parameter { Variable "Tag" Value "Vdc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Tunable parameter" Name "Tunable parameter" Show off Position [580, 115] Direction up Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "name" Value "M_inv" Show off Evaluate off } Parameter { Variable "initial_value" Value "0.3" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "max_value" Value "inf" Show off } Parameter { Variable "min_value" Value "-inf" Show off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "access_write" Value "1" Show off } Parameter { Variable "sim_output" Value "2" Show off } Parameter { Variable "step_time" Value "[0 0.2]" Show off } Parameter { Variable "step_data" Value "[0.2 0.3]" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Output Position [14, 0] Direction right } } Component { Type Subsystem Name "Inverter voltages" Show on Position [665, 125] Direction up Flipped off Frame [-40, -25; 40, 25] LabelPosition [0, 28] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-40, -10] Direction left } Terminal { Type Output Position [44, 0] Direction right } Terminal { Type Input Position [-40, 10] Direction left } Schematic { Location [181, 261; 667, 492] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "M_inv" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Eabc" Show on Position [380, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Vdc" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Transformations/RRF->3ph" Name "RRF->3ph" Show on Position [320, 95] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Terminal { Type Input Position [-15, -5] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type Product Name "Product" Show off Position [120, 85] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [200, 90] Direction right Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type Constant Name "Constant" Show on Position [155, 105] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type TriangleGenerator Name "Angle generator" Show on Position [215, 140] Direction right Flipped off Parameter { Variable "Min" Value "-pi" Show on } Parameter { Variable "Max" Value "pi" Show on } Parameter { Variable "f" Value "f" Show off } Parameter { Variable "DutyCycle" Value "1" Show off } Parameter { Variable "Delay" Value "0" Show off } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Probe variabl" "e" Name "Probe variable" Show off Position [380, 140] Direction up Flipped off Frame [-10, -15; 10, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "name" Value "theta" Show off Evaluate off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "can_tx_freq" Value "10" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "selected_ip_address" Value "1" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "eth_tx_freq" Value "10" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Input Position [-10, 0] Direction left } } Connection { Type Signal SrcComponent "M_inv" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "Vdc" SrcTerminal 1 Points [85, 115; 85, 90] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "RRF->3ph" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [180, 105; 180, 95] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "RRF->3ph" SrcTerminal 2 DstComponent "Eabc" DstTerminal 1 } Connection { Type Signal SrcComponent "Angle generator" SrcTerminal 1 Points [265, 140] Branch { Points [265, 100] DstComponent "RRF->3ph" DstTerminal 3 } Branch { DstComponent "Probe variable" DstTerminal 1 } } } } Component { Type From Name "From12" Show off Position [605, 135] Direction right Flipped off Parameter { Variable "Tag" Value "Vdc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [755, 125] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "1" Show off } } Component { Type SignalSelector Name "Cont\nSelector1" Show off Position [760, 445] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "2" Show off } } Component { Type SignalSelector Name "Cont\nSelector2" Show off Position [760, 765] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "3" Show off } } Component { Type From Name "From13" Show off Position [800, 140] Direction right Flipped off Parameter { Variable "Tag" Value "Vdc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalSelector Name "Cont\nSelector3" Show off Position [935, 275] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "2" Show off } } Component { Type SignalSelector Name "Cont\nSelector4" Show off Position [930, 125] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "1" Show off } } Component { Type From Name "From14" Show off Position [805, 460] Direction right Flipped off Parameter { Variable "Tag" Value "Vdc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalSelector Name "Cont\nSelector5" Show off Position [940, 595] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "2" Show off } } Component { Type SignalSelector Name "Cont\nSelector6" Show off Position [935, 445] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "1" Show off } } Component { Type From Name "From15" Show off Position [805, 780] Direction right Flipped off Parameter { Variable "Tag" Value "Vdc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type SignalSelector Name "Cont\nSelector7" Show off Position [940, 915] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "2" Show off } } Component { Type SignalSelector Name "Cont\nSelector8" Show off Position [940, 765] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "1" Show off } } Component { Type Subsystem Name "Modulation_A" Show on Position [850, 130] Direction up Flipped off Frame [-25, -20; 25, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, -5] Direction left } Terminal { Type Output Position [29, -5] Direction right } Terminal { Type Input Position [-25, 10] Direction left } Schematic { Location [191, 258; 677, 479] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "Emf" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "m" Show on Position [445, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Vdc" Show on Position [60, 170] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Gain Name "Gain1" Show off Position [145, 135] Direction right Flipped off Parameter { Variable "K" Value "0.5" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum" Show off Position [170, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Product Name "Divide" Show off Position [295, 80] Direction up Flipped off Parameter { Variable "Inputs" Value "*/" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Gain Name "Gain2" Show off Position [365, 80] Direction right Flipped off Parameter { Variable "K" Value "N" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [200, 55] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|-+" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [235, 75] Direction right Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type MinMax Name "Min/Max" Show off Position [205, 175] Direction up Flipped off Parameter { Variable "Operation" Value "2" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 190] Direction right Flipped off Frame [-15, -10; 15, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0.1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Divide" SrcTerminal 1 DstComponent "Gain2" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain2" SrcTerminal 2 DstComponent "m" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "Divide" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 Points [220, 55] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Gain1" SrcTerminal 2 Points [170, 135] Branch { Points [200, 135] DstComponent "Sum1" DstTerminal 3 } Branch { DstComponent "Sum" DstTerminal 3 } } Connection { Type Signal SrcComponent "Emf" SrcTerminal 1 Points [140, 80] Branch { DstComponent "Sum" DstTerminal 2 } Branch { Points [140, 55] DstComponent "Sum1" DstTerminal 2 } } Connection { Type Signal SrcComponent "Vdc" SrcTerminal 1 Points [105, 170] Branch { Points [105, 135] DstComponent "Gain1" DstTerminal 1 } Branch { DstComponent "Min/Max" DstTerminal 2 } } Connection { Type Signal SrcComponent "Min/Max" SrcTerminal 1 Points [245, 175; 245, 85] DstComponent "Divide" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [175, 190] DstComponent "Min/Max" DstTerminal 3 } } } Component { Type Reference SrcComponent "Imperix_Control/IOs/GPO" Name "precharge_relay" Show on Position [760, 980] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 28] LabelAlign up Parameter { Variable "device" Value "0" Show off } Parameter { Variable "gpo_bits" Value "0:1" Show off } Parameter { Variable "clear_when_flt" Value "1" Show off } Parameter { Variable "sim_port" Value "1" Show off } Parameter { Variable "TargetPortIndices" Value "11" Show off } Terminal { Type Input Position [-30, 0] Direction left } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Tunable parameter" Name "Tunable parameter1" Show off Position [620, 965] Direction up Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "name" Value "precharge_relay" Show off Evaluate off } Parameter { Variable "initial_value" Value "0" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "max_value" Value "inf" Show off } Parameter { Variable "min_value" Value "-inf" Show off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "access_write" Value "1" Show off } Parameter { Variable "sim_output" Value "2" Show off } Parameter { Variable "step_time" Value "0" Show off } Parameter { Variable "step_data" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Output Position [14, 0] Direction right } } Component { Type Reference SrcComponent "Imperix_Control/State and variables/Tunable parameter" Name "Tunable parameter2" Show off Position [620, 995] Direction up Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "name" Value "bypass_relay" Show off Evaluate off } Parameter { Variable "initial_value" Value "0" Show off } Parameter { Variable "signal_type" Value "1" Show off } Parameter { Variable "max_value" Value "inf" Show off } Parameter { Variable "min_value" Value "-inf" Show off } Parameter { Variable "access_read" Value "1" Show off } Parameter { Variable "access_write" Value "1" Show off } Parameter { Variable "sim_output" Value "2" Show off } Parameter { Variable "step_time" Value "0" Show off } Parameter { Variable "step_data" Value "1" Show off } Parameter { Variable "can_enabled" Value "1" Show off } Parameter { Variable "can_address" Value "0" Show off } Parameter { Variable "can_endianness" Value "2" Show off } Parameter { Variable "eth_enabled" Value "1" Show off } Parameter { Variable "eth_port" Value "2000" Show off } Parameter { Variable "eth_endianness" Value "2" Show off } Parameter { Variable "TargetPortIndices" Value "" Show off } Terminal { Type Output Position [14, 0] Direction right } } Component { Type TargetCode Name "PWM_up_A" Show on Position [1125, 175] Direction up Flipped off Frame [-40, -60; 40, 60] LabelPosition [0, 63] LabelAlign up TargetPortIndices "12" SampleTime "0" EnforceBaseTask "2" CodeFcnLang "2" CodeFcn "if (Target.Family ~= \"Imperix Controllers\") then\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "\n" "local OutputCode = StringList:new()\n" "local Require = ResourceList:new()\n" "\n" "--Get mask variables\n" "local pDeviceId = Block.Mask.pDeviceId\n" "local pActivateRT = Block.Mask.pActivateRT\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tlocal temp = 1\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "local out_conf = Block.Mask.pOutConf\n" "local temp = string.reverse(tostring(Block.Mask.pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "local strCells = string.reverse(temp1)\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Block.Mask.pModuleTopo\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Block.Mask.pGlobalActive\n" "local modulator\n" "\n" "local ss_mod_id = Target.Coder.RegisterNewSsModulator(Block.Name, pDeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Too many SS_PWM created.\"\n" "end\n" "\n" "for i = 1, nbr_cells, 1 do\n" "\tif out_conf == 1.0 then \n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\telseif out_conf == 2.0 then\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+1, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+3, pDeviceId))\n" "\t\tend\n" "\telse\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\t\tif i == nbr_cells-1 then \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(globalActive, pDeviceId))\n" "\t\tend\n" "\tend\n" "end\n" "\n" "--For activate, phase and duty, if the input is the block terminal. Reconfigu" "re them at each step\n" "if pActivateRT == 2.0 then\n" "\tOutputCode:append(\"if ((float)%s > 0) {\" % {Block.InputSignal[4][1]}) --c" "ast in float is added since this condition \"if ((float) true > 0)\" can be e" "ntered by the user\n" "\tOutputCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);}\" % {modulator," " pDeviceId})\n" "\tOutputCode:append(\"else {\")\n" "\tOutputCode:append(\"SsPwm_Deactivate((tSsModulator) %s, %s);}\" % {modulato" "r, pDeviceId})\n" "end\n" "\n" "OutputCode:append(\"SsPwm_SetModulationIndex((tSsModulator) %s, (float) %s, %" "s);\" % {modulator, Block.InputSignal[1][1], pDeviceId})\n" "\n" "\t\n" "-----------------------------------------------------------------------------" "-----\n" "\n" "return {\n" " OutputCode = OutputCode,\n" " Require = Require,\n" "}" NonDftCodeFcn "local InitCode = StringList:new()\n" "\n" "local DeviceId = Block.Mask.pDeviceId\n" "local pEnabledCellsBin =Block.Mask.pEnabledCellsBin\n" "\n" "local pSelCurrent = Block.Mask.pSelCurrent\n" "local pDeadtime = Block.Mask.pDeadtime\n" "local pGlobalActive = Block.Mask.pGlobalActive\n" "local pActivateRT = Block.Mask.pActivateRT\n" "local modulator\n" "\n" "local temp = string.reverse(tostring(pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "\n" "local pEnabledCellsDec = tonumber(string.reverse(temp1),2)\n" "local ss_mod_id = Target.Coder.GetRegisteredSsModulator(Block.Name, DeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Accessing unregistered SS_PWM block\"\n" "end\n" "\n" "\n" "--compute carrier type\n" "local carrier\n" "local stairMod = \"1\";\n" "if Block.Mask.pCarrier == 1.0 then\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "elseif Block.Mask.pCarrier == 2.0 then\n" "\tcarrier = \"INVTRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "else\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"0\"\n" "end\n" "\n" "--compute output mode\n" "local outmode\n" "if Block.Mask.pOutConf == 2.0 then\n" "\toutmode = \"COMPLEMENTARY\"\t\n" "else\n" "\toutmode = \"INDEPENDENT\"\t\n" "end\n" "\n" "--compute update rate\n" "local update_rate\n" "if Block.Mask.pUpdateRate == 1.0 then\n" "\tupdate_rate = \"SINGLE_RATE\"\t--SINGLE_RATE = 0,\n" "else\n" "\tupdate_rate = \"DOUBLE_RATE\"\t--DOUBLE_RATE = 1\n" "end\n" "\n" "--compute module topology\n" "local topo\n" "if Block.Mask.pModuleTopo == 1.0 then\n" "\ttopo = \"HALF_BRIDGE\"\t\n" "else\n" "\ttopo = \"FULL_BRIDGE\"\t\n" "end\n" "\n" "--compute sorting logic\n" "local invPolarity\n" "if Block.Mask.pSortingLogic == 1.0 then\n" "\tinvPolarity = \"0\"\t\n" "else\n" "\tinvPolarity = \"1\"\t\n" "end\n" "\n" "\t\n" "InitCode:append(\"SsPwm_ConfigureCarrier((tSsModulator) %s, %s, %s, %s);\" % " "{modulator, carrier, stairMod, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureOutputMode((tSsModulator) %s, %s, %s);\" % {" "modulator, outmode, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureUpdateRate((tSsModulator) %s, %s, %s);\" % " "{modulator, update_rate, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodules((tSsModulator) %s, %s, %s);\" % {" "modulator, pEnabledCellsDec, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureCurrentInput((tSsModulator) %s, %s, %s);\" %" " {modulator, pSelCurrent, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureInvertedSorting((tSsModulator) %s, (bool) %s" ", %s);\" % {modulator, invPolarity, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodulesTopology((tSsModulator) %s, %s, %s" ");\" % {modulator, topo, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureClock((tSsModulator) %s, (tClock) %s, %s);\"" " % {modulator, Block.InputSignal[5][3], DeviceId})\n" "\n" "if Block.Mask.pOutConf == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureDeadTime((tSsModulator) %s, (float) %s, %s" ");\" % {modulator, pDeadtime, DeviceId})\n" "elseif Block.Mask.pOutConf == 3.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateOutput((tSsModulator) %s, (tPwmOut" "put) %s, %s);\" % {modulator, pGlobalActive, DeviceId})\n" "end\n" "if pActivateRT == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateAsRealTime((tSsModulator) %s, %s);" "\" % {modulator, DeviceId})\n" "else\n" "\tInitCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);\" % {modulator, De" "viceId})\n" "end\n" "\n" "\n" "-----------------------------------------------------------------------------" "------\n" "return {\n" " InitCode = InitCode,\n" "}" MaskType "SS-PWM - Sort and Select PWM" MaskDescription "Generates PWM signals for MMC, using a Sort & Selec" "t algorithm for the balancing of N submodules.

\n" "- The 'm' input is the modulation index. In half-bridge mode, m ranges from 0" " to N. In full-bridge mode m ranges from -N to N.
\n" "- The 'sim V' input is a vector containing the submodules voltages (used only" " in simulation).
\n" "- The 'sim I' input is the arm current (used only in simulation).
\n" "- The '>' input is the clock input.
\n" "- The 'A' input allows the activation (1) or deactivation (0) of the PWM outp" "ut(s)." MaskHelp "https://imperix.ch/help/plecs/pwm/ss" MaskDisplay "local font_size = 9\n" "local function getColor(color)\n" "\tif color == \"red\" then\n" "\t\treturn 255, 26, 0\n" "\telseif color == \"white\" then\n" "\t\treturn 255, 255, 255\n" "\telse --black\n" "\t\treturn 0, 0, 0\n" "\tend\n" "end\n" "local function drawClk(x,y, color)\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x+0.5, x+5.5}, {y-3.5, y})\n" "\tIcon:line({x+0.5, x+5.5}, {y+3.5, y})\n" "end\n" "local function drawRectangle(x,y,w,h, color) --w=width, h=height\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function drawRectangleFull(x,y,w,h,color)--w=width, h=height\n" "\tIcon:color(getColor(color))\n" "\tIcon:patch({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function getOffsetX_R(a_string)\n" "\tlocal size = #a_string \n" "\tsize = size + (size*0.9) \n" "\tsize = size + 4\n" "\treturn size\n" "end\n" "local function trimeVector(a_s_vector)\n" "\tlocal s = a_s_vector\n" "\tif #a_s_vector > 9 then\n" "\t\ts = \"[...]\"\n" "\tend\n" "\treturn s\n" "end\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tfor i=0,num-1 ,1 do\n" "\t\ta[i] = 0\n" "\tend \n" "\tlocal temp = 0\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "drawRectangle(-40,-60, 80, 120)\n" "drawRectangleFull(-39, 40, 78, 19, \"red\")\n" "\n" "local bb_id = 'BB' .. tostring(Dialog:get('pDeviceId'))\n" "Icon:text(0,-52, bb_id, 'FontSize',font_size)\n" "\n" "Icon:text(0,50,'SS PWM', 'FontSize',font_size, 'Color', {getColor(\"white\")}" ")\n" "\n" "drawClk(-40,50, \"black\")\n" "\n" "local out_conf = Dialog:get('pOutConf')\n" "local strCells = Dialog:get('pEnabledCellsBin')\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Dialog:get('pModuleTopo')\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Dialog:get('pGlobalActive')\n" "local temp = 0\n" "local offset_x \n" "\n" "local mid = (8-nbr_cells)/2\n" "local midH = (8-nbr_cells*2)/2\n" "\n" "for i = 0, nbr_cells-1, 1 do\n" "\tif out_conf == \"1\" then \n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(30,-52 + 12*i+12*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\telse \n" "\t\t\tIcon:text(30,-52 + 12*temp+12*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(30,-52 + 12*(temp+1)+12*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telseif out_conf == \"2\" then\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 12*i+12*mid, outputs[i] .. \"H/L\", 'FontSize',font_" "size)\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 12*temp+12*midH, 2*outputs[i] .. \"H/L\", 'FontSize'" ",font_size)\n" "\t\t\tIcon:text(28,-52 + 12*(temp+1)+12*midH, 2*outputs[i]+1 .. \"H/L\", 'Fon" "tSize',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telse\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 11*i+11*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(i+1)+11*mid, \"(A)LN\" .. globalActive, 'Fon" "tSize',font_size)\n" "\t\t\tend\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 11*temp+11*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(28,-52 + 11*(temp+1)+11*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(temp+2)+11*midH, \"(A)LN\" .. globalActive, " "'FontSize',font_size)\n" "\t\t\tend\n" "\t\tend\n" "\tend\n" "end\n" MaskDisplayLang "2" MaskIconFrame off MaskIconOpaque off MaskIconRotates on MaskInit "if ~isreal(pDeviceId) || numel(pDeviceId) ~= 1 || any" "(pDeviceId < 0)\n" "\terror('\"Device number\" must be a positive scalar.')\n" "end\n" "\n" "if ~isreal(pDeadtime) || numel(pDeadtime) ~= 1\n" "\t\terror('\"Dead-time duration\" must be a scalar.')\n" "end\n" "\n" "cells = bin2dec(num2str(pEnabledCellsBin));\n" "pNbrCellsEnabled = sum(bitget(cells, 1:8));\n" "pNotEnabledCells = 8-pNbrCellsEnabled;\n" "\n" "if pOutConf == 1 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo;\n" "elseif pOutConf == 2 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = 2*nbr_modulators*pModuleTopo;\n" "else\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo + 1;\n" "end\n" "\n" "\n" "if pCarrier == 1 || pCarrier == 2 % triangular carrier\n" "\trate_private = pUpdateRate;\n" "\tpRoundModulation = 0;\n" "else\n" "\trate_private = 1;\n" "\tpRoundModulation = 1;\n" "end\n" "\n" "if pModuleTopo == 1\n" "\tpFullBridge = 0;\n" "else\n" "\tpFullBridge = 1;\n" "end\n" "\n" "dead_time_private = 0; % avoids NaN if out_conf is not PWM H+L\n" "out_conf_private = pOutConf;\n" "phase_compensation = 1;\n" "if pOutConf == 2 && pSimDeadtime == 2 % PWM H+L and simulate dead-time\n" "\tdead_time_private = pDeadtime;\n" "\tout_conf_private = 4;\n" "\tphase_compensation = 2; % compensate dead-time\n" "end" MaskDialogCallback "if Dialog:get(\"pActivateRT\") == \"1\" then\n" "\tBlock:showTerminal(\"A\", false)\n" "else\n" "\tBlock:showTerminal(\"A\", true)\n" "\tBlock:moveTerminal(\"A\", -40,25)\n" "end\n" "\n" "\n" "local Outmode = Dialog:get(\"pOutConf\")\n" "if Outmode == \"1\" then --single\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "elseif Outmode == \"2\" then -- dual(H and L)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", true)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", true)\n" "else -- dual (H and A)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", true)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "end\n" Parameter { Variable "pDeviceId" Prompt "Device ID [default=0]" Type FreeText Value "0" Show off Tunable off TabName "Addressing" } Parameter { Variable "pOutConf" Prompt "Output mode" Type FixedText PossibleValues {"Single", "Dual (PWM_H + PWM_L)", "Single (PWM + A" "CTIVE)"} Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pGlobalActive" Prompt "Global ACTIVE on PWM lane " Type FreeText Value "4" Show off Tunable off TabName "Addressing" } Parameter { Variable "pEnabledCellsBin" Prompt "Submodules analog input channel mask" Type FreeText Value "00001111" Show off Tunable off TabName "Addressing" } Parameter { Variable "pModuleTopo" Prompt "Submodules topology" Type FixedText PossibleValues {"Half-bridge", "Full-bridge"} Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pSelCurrent" Prompt "Current input channel (8 to 15)" Type FreeText Value "12" Show on Tunable off TabName "Addressing" } Parameter { Variable "pSortingLogic" Prompt "Invert sorting logic" Type Bool Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pCarrier" Prompt "Carrier type" Type FixedText PossibleValues {"Triangle", "Inverted triangle", "No Carrier (Stai" "rcase modulation)"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pActivateRT" Prompt "PWM activation" Type FixedText PossibleValues {"Always activated", "Use block input"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pUpdateRate" Prompt "PWM parameters update rate" Type FixedText PossibleValues {"Once per PWM period", "Twice per PWM period"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pDeadtime" Prompt "Dead-time duration [in seconds]" Type FreeText Value "DT" Show off Tunable off TabName "Complementary signal parameters" } Parameter { Variable "pSimDeadtime" Prompt "Dead-time simulation" Type FixedText PossibleValues {"Ignore dead-time during simulation", "Simulate de" "ad-time"} Value "2" Show off Tunable off TabName "Complementary signal parameters" } Terminal { Type Input Position [-40, -50] Direction left } Terminal { Type Input Position [-40, 0] Direction left } Terminal { Type Input Position [-40, -25] Direction left } Terminal { Type Input Position [-40, 25] Direction left } Terminal { Type EventInput Position [-40, 50] Direction left } Schematic { Location [0, 27; 2560, 1334] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Rounding Name "Rounding" Show off Position [175, 370] Direction right Flipped off Parameter { Variable "Operation" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Rounding Name "Rounding1" Show off Position [175, 320] Direction right Flipped off Parameter { Variable "Operation" Value "3" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [255, 350] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "+-" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [425, 470] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 446, 235] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [9, 37; 293, 204] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [415, 55; 699, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type Sum Name "Sum2" Show off Position [520, 355] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch" Show on Position [615, 350] Direction right Flipped off Parameter { Variable "Criteria" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Constant Name "Constant" Show off Position [495, 295] Direction right Flipped off Frame [-55, -10; 55, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pRoundModulation" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "m" Show on Position [80, 345] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim I" Show on Position [75, 235] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim V" Show on Position [75, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "pNbrCellsEnabled" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [145, 235] Direction right Flipped off Frame [-20, -10; 20, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Input Name "A" Show on Position [75, 55] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant1" Show off Position [240, 210] Direction right Flipped off Frame [-30, -10; 30, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pFullBridge" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant2" Show off Position [255, 180] Direction right Flipped off Frame [-45, -10; 45, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pNbrCellsEnabled" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type EventInput Name "clk" Show off Position [80, 420] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } } Component { Type CScript Name "sorter" Show on Position [390, 115] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1225 349 1195 633]" Show off } Parameter { Variable "NumInputs" Value "[8, 1]" Show off } Parameter { Variable "NumOutputs" Value "8" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "int n;\n" "float work_array[8], even[8];\n" "int indexes_even[8];\n" "bool sorting_completed;" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --" "- EDIT HERE TO _END */\n" "\n" "\n" "\n" "\n" "work_array[0] = InputSignal(0,0);\n" "work_array[1] = InputSignal(0,1);\n" "work_array[2] = InputSignal(0,2);\n" "work_array[3] = InputSignal(0,3);\n" "work_array[4] = InputSignal(0,4);\n" "work_array[5] = InputSignal(0,5);\n" "work_array[6] = InputSignal(0,6);\n" "work_array[7] = InputSignal(0,7);\n" "\n" "n = InputSignal(1,0);\n" "if(n > 8) n = 8;\n" "\n" "OutputSignal(0,0) = 0;\n" "OutputSignal(0,1) = 1;\n" "OutputSignal(0,2) = 2;\n" "OutputSignal(0,3) = 3;\n" "OutputSignal(0,4) = 4;\n" "OutputSignal(0,5) = 5;\n" "OutputSignal(0,6) = 6;\n" "OutputSignal(0,7) = 7;\n" "\n" "sorting_completed = false;\n" "while (!sorting_completed)\n" "{\n" "\tsorting_completed = true;\n" "\n" "\tfor (unsigned j = 0; j < (n / 2); j++)\n" "\t{\n" "\t\tif (work_array[2 * j] > work_array[2 * j + 1])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\teven[2 * j] = work_array[2 * j + 1];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j + 1);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\teven[2 * j] = work_array[2 * j];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j + 1];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j + 1);\n" "\t\t}\n" "\t}\n" "\n" "\tfor (unsigned j = 0; j < (n / 2 - 1); j++)\n" "\t{\n" "\t\tif (even[2 * j + 1] > even[2 * j + 2])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 2];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 1];\n" "\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 1];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 2];\n" "\t\t}\n" "\t}\n" "\twork_array[0] = even[0];\n" "\twork_array[n-1] = even[n-1];\n" "\n" "\tOutputSignal(0,0) = indexes_even[0];\n" "\tOutputSignal(0,n-1) = indexes_even[n-1];\n" "}\t\t" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Component { Type Constant Name "Constant4" Show off Position [170, 135] Direction right Flipped off Frame [-80, -10; 80, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "zeros(1, 8-pNbrCellsEnabled)" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [290, 110] Direction right Flipped off Parameter { Variable "Width" Value "[pNbrCellsEnabled pNotEnabledCells]" Show off } } Component { Type TargetOutput Name "s" Show on Position [990, 175] Direction right Flipped off Parameter { Variable "Width" Value "nbr_outputs" Show off } } Component { Type ConfigurableSubsystem Name "Activate\nsource" Show on Position [790, 55] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [-25, 0] Direction left } TerminalNames { "out", "A" } Location [0, 36; 441, 234] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Internal" Schematic { Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [240, 80] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "External" Schematic { Component { Type Output Name "out" Show on Position [260, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [145, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pActivateRT" Show off } } Component { Type LogicalOperator Name "Logical\nOperator2" Show off Position [915, 175] Direction up Flipped off Parameter { Variable "Operator" Value "1" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type ConfigurableSubsystem Name "Outmode" Show on Position [840, 180] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "A" } Location [6, 40; 395, 226] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single" Schematic { Component { Type Input Name "in" Show on Position [115, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [275, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [115, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "Dual H+L" Schematic { Component { Type Input Name "in" Show on Position [110, 75] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [180, 105] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Input Name "A" Show on Position [110, 110] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 80] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 1362, 300] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[906 498 1324 444]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [205, 105; 205, 85] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [145, 75] Branch { Points [145, 105] DstComponent "Logical\nOperator" DstTerminal 2 } Branch { DstComponent "Mux and reorder" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+A" Schematic { Component { Type Input Name "in" Show on Position [110, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [110, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 85] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [1151, 369; 1434, 537] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1183 329 792 314]" Show off } Parameter { Variable "NumInputs" Value "[pNbrCellsEnabled*pModuleTopo 1]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < WIDTH; i++)\n" "{\n" "\tOutputSignal(0, i) = InputSignal(0, i);\n" "}\n" "\tOutputSignal(0, WIDTH) = InputSignal(1, 0);" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Mux and reorder" DstTerminal 1 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 Points [175, 115; 175, 90] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+L w/ dead-time" Schematic { Component { Type Input Name "in" Show on Position [65, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [305, 75] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [65, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Delays/Turn-on Delay" Name "Dead-time\ngenerator" Show on Position [235, 75] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "DeadTimeSource" Value "1" Show off } Parameter { Variable "T_d" Value "dead_time_private" Show off } Parameter { Variable "Rounding" Value "1" Show off } Terminal { Type Input Position [-15, 0] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [135, 100] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [185, 75] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 698, 223] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1352 253 1105 683]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "Dead-time\ngenerator" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ngenerator" SrcTerminal 2 DstComponent "out" DstTerminal 1 } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [160, 100; 160, 80] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [100, 70] Branch { DstComponent "Mux and reorder" DstTerminal 1 } Branch { Points [100, 100] DstComponent "Logical\nOperator" DstTerminal 2 } } } } Parameter { Variable "Configuration" Value "out_conf_private" Show off } } Component { Type Subsystem Name "CB_PWM" Show on Position [355, 385] Direction up Flipped off Frame [-35, -45; 35, 45] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -35] Direction left } Terminal { Type Input Position [-35, 35] Direction left } Terminal { Type Output Position [39, -35] Direction right } Terminal { Type Output Position [39, 35] Direction right } Schematic { Location [5, 38; 735, 345] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Integrator Name "Integrator" Show off Position [385, 95] Direction right Flipped off Parameter { Variable "ExternalReset" Value "2" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0" Show off } Parameter { Variable "ShowStatePort" Value "1" Show off } Parameter { Variable "EnableWrapping" Value "1" Show off } Parameter { Variable "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [275, 70] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type RelationalOperator Name "Relational\nOperator" Show off Position [330, 100] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [370, 150] Direction right Flipped on Frame [-25, -10; 25, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0.5" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [335, 205] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 751, 346] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [369, 400; 653, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [1110, 345; 1394, 512] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type ConfigurableSubsystem Name "Carrier" Show on Position [450, 95] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } TerminalNames { "In1", "Out1" } Location [5, 35; 446, 233] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[0 1 0]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "Inv. triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[1 0 1]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "No carrier" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pCarrier" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [160, 70] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "[1 2]" Show off } } Component { Type Subsystem Name "Phase" Show on Position [235, 115] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } Schematic { Location [5, 36; 461, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "P" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "P'" Show on Position [390, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type ConfigurableSubsystem Name "Dead-time\ncompensation" Show on Position [205, 90] Direction up Flipped off Frame [-35, -20; 35, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -10] Direction left } Terminal { Type Output Position [39, 0] Direction right } Terminal { Type Input Position [-35, 10] Direction left } TerminalNames { "phase", "phase'", "freq" } Location [5, 39; 581, 225] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Ignore dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } } Name "Simulate dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 160] Direction right Flipped off Frame [-65, -10; 65, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "dead_time_private/2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Product Name "Product" Show off Position [260, 120] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Saturation Name "Saturation" Show off Position [325, 120] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.25" Show off } Parameter { Variable "LowerLimit" Value "0" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [225, 160; 225, 125] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "freq" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 Points [365, 120] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "phase_compensation" Show off } } Component { Type Input Name "clk" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Math Name "Math" Show off Position [320, 95] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type Constant Name "Constant" Show off Position [265, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [120, 115] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "[1]" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "Dead-time\ncompensation" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ncompensation" SrcTerminal 2 DstComponent "Math" DstTerminal 2 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [285, 110; 285, 100] DstComponent "Math" DstTerminal 3 } Connection { Type Signal SrcComponent "Math" SrcTerminal 1 DstComponent "P'" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [155, 115] DstComponent "Dead-time\ncompensation" DstTerminal 3 } } } Component { Type Subsystem Name "Compare" Show on Position [560, 155] Direction up Flipped off Frame [-30, -20; 30, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-30, -5] Direction left } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [2, 34; 496, 277] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "carrier" Show on Position [100, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [430, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "duty" Show on Position [100, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type RelationalOperator Name "Relational\nOperator1" Show off Position [185, 85] Direction right Flipped off Parameter { Variable "Operator" Value "3" Show off } } Component { Type SignalSwitch Name "Switch" Show off Position [275, 90] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "1" Show off } } Component { Type Constant Name "Constant" Show off Position [215, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant1" Show off Position [325, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch1" Show off Position [375, 95] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Gain Name "Gain" Show off Position [320, 150] Direction right Flipped off Parameter { Variable "K" Value "-1" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "11" Show off } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [140, 65; 140, 80] DstComponent "Relational\nOperator1" DstTerminal 1 } Connection { Type Signal SrcComponent "duty" SrcTerminal 1 Points [140, 105] Branch { Points [140, 90] DstComponent "Relational\nOperator1" DstTerminal 2 } Branch { Points [140, 150; 275, 150] Branch { DstComponent "Switch" DstTerminal 4 } Branch { DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [245, 110] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator1" SrcTerminal 3 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 DstComponent "Switch1" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [345, 115] DstComponent "Switch1" DstTerminal 2 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 Points [375, 150] DstComponent "Switch1" DstTerminal 4 } Connection { Type Signal SrcComponent "Switch1" SrcTerminal 1 DstComponent "PWM" DstTerminal 1 } } } Component { Type Constant Name "Constant" Show on Position [95, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "D" Show on Position [45, 205] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name ">" Show on Position [60, 70] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [650, 155] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Trig" Show on Position [650, 215] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [355, 65] DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [410, 95] Branch { DstComponent "Compare to\nConstant" DstTerminal 1 } Branch { DstComponent "Carrier" DstTerminal 1 } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "Integrator" DstTerminal 3 } Connection { Type Signal SrcComponent "Phase" SrcTerminal 2 Points [285, 115; 285, 105] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent ">" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [235, 70] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Phase" DstTerminal 3 } } Connection { Type Signal SrcComponent "Compare" SrcTerminal 2 DstComponent "PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "Phase" DstTerminal 1 } Connection { Type Signal SrcComponent "D" SrcTerminal 1 DstComponent "Configurable\nSubsystem1" DstTerminal 1 } Connection { Type Signal SrcComponent "Carrier" SrcTerminal 2 Points [500, 95; 500, 150] DstComponent "Compare" DstTerminal 1 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [335, 150; 335, 175] Branch { DstComponent "Configurable\nSubsystem1" DstTerminal 3 } Branch { Points [460, 175; 460, 215] DstComponent "Trig" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [285, 75; 285, 95] DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [500, 205; 500, 160] DstComponent "Compare" DstTerminal 3 } } } Component { Type CScript Name "balancer" Show on Position [735, 180] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[916 418 1143 834]" Show off } Parameter { Variable "NumInputs" Value "[8 1 1 1 1]" Show off } Parameter { Variable "NumOutputs" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "-1" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "#define NH 0\n" "#define NL 1\n" "#define PL 2\n" "#define PH 3\n" "\n" "unsigned int next_switch_A[8], cell_state[8];" Show off } Parameter { Variable "StartFcn" Value "for(unsigned int i = 0; i < 8; i++){\n" "\tcell_state[i] = PL;\n" "\tnext_switch_A[i] = 0;\n" "}" Show off } Parameter { Variable "OutputFcn" Value "signed int ReqLevel = InputSignal(1,0);\n" "unsigned int Ncells = InputSignal(2,0);\n" "bool full_bridge = InputSignal(3,0);\n" "bool I_negative\t\t\t = InputSignal(4,0);\n" "\n" "if (Ncells > 8) Ncells = 8;\n" "\n" "for (unsigned int k = 0; k < Ncells; k++) {\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // compute actual level\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " signed int ActualLevel = 0;\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" "\t\tif (cell_state[i] == PH) ActualLevel++;\n" " else if (cell_state[i] == NH) ActualLevel--;\n" "\t}\n" "\n" " if(ActualLevel == ReqLevel) break;\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " bool can_rise[8];\n" " bool can_fall[8];\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" " if(cell_state[i] == PH) can_rise[i] = false;\n" " else can_rise[i] = true;\n" "\n" " if(full_bridge) {\n" "\t\t\t\tif(cell_state[i] == NH) can_fall[i] = false;\n" " else can_fall[i] = true;\n" " } else {\n" " if(cell_state[i] == PH) can_fall[i] = true;\n" " else can_fall[i] = false;\n" " }\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // largest/smallest can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " int largest_can_rise;\n" " int largest_can_fall;\n" " int smallest_can_rise;\n" " int smallest_can_fall;\n" "\n" " for (unsigned int n = 0; n < Ncells; n++) {\n" " // 0 to N-1 -> smallest to largest\n" " unsigned int i = InputSignal(0,n);\n" "\n" " if(can_rise[i]) {\n" " largest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " largest_can_fall = i;\n" " }\n" "\n" " // N-1 to 0 -> smallest to largest\n" " i = InputSignal(0,Ncells-n-1);\n" "\n" " if(can_rise[i]) {\n" " smallest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " smallest_can_fall = i;\n" " }\n" " }\n" "\n" " int cell_rise;\n" " int cell_fall;\n" "\n" " if(I_negative) {\n" " cell_rise = largest_can_rise;\n" " cell_fall = smallest_can_fall;\n" " } else {\n" " cell_rise = smallest_can_rise;\n" " cell_fall = largest_can_fall;\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // transition\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " // FALL --------------------\n" "\n" " if(ReqLevel < ActualLevel) {\n" " if(cell_state[cell_fall] == PH) { // PH\n" " if(full_bridge && next_switch_A[cell_fall]) {\n" " cell_state[cell_fall] = NL; // NL\n" " } else {\n" " cell_state[cell_fall] = PL; // PL\n" " }\n" " } else {\n" " if(full_bridge) {\n" " cell_state[cell_fall] = NH; // NH\n" " }\n" " if(cell_state[cell_fall] == NL) { // NL\n" " next_switch_A[cell_fall] = true;\n" " } else {\n" " next_switch_A[cell_fall] = false;\n" " }\n" " }\n" " }\n" "\n" " // RISE --------------------\n" "\n" " if(ReqLevel > ActualLevel) {\n" " if(cell_state[cell_rise] == NH) { // NH\n" " if(full_bridge && !next_switch_A[cell_rise]) {\n" " cell_state[cell_rise] = NL; // NL\n" " } else {\n" " cell_state[cell_rise] = PL; // PL\n" " }\n" " } else {\n" " if(cell_state[cell_rise] == PL) { // PL\n" " next_switch_A[cell_rise] = true;\n" " } else {\n" " next_switch_A[cell_rise] = false;\n" " }\n" " cell_state[cell_rise] = PH; // PH\n" " }\n" " }\n" "}\n" "\n" "for (unsigned int i = 0; i < Ncells; i++)\n" "{\n" "\tif(full_bridge) {\n" "\t\tif((cell_state[i] == PH) || (cell_state[i] == PL)) {\n" "\t\t\tOutputSignal(0,i*2) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2) = 0;\n" "\t\t}\n" "\t\tif((cell_state[i] == PL) || (cell_state[i] == NH)) {\n" "\t\t\tOutputSignal(0,i*2+1) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2+1) = 0;\n" "\t\t}\n" " } else {\n" " if(cell_state[i] == PH) {\n" " \tOutputSignal(0,i) = 1;\n" " } else {\n" " \tOutputSignal(0,i) = 0;\n" " }\n" " }\n" "}\n" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "Rounding" SrcTerminal 2 Points [215, 370] Branch { Points [215, 355] DstComponent "Sum1" DstTerminal 3 } Branch { Points [215, 470] DstComponent "Configurable\nSubsystem1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Rounding1" SrcTerminal 2 Points [555, 320; 555, 345] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [475, 470; 475, 360] DstComponent "Sum2" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "sim I" SrcTerminal 1 DstComponent "Compare to\nConstant" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [265, 135; 265, 115] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [615, 295] DstComponent "Switch" DstTerminal 4 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [310, 180] Branch { Points [310, 120] DstComponent "sorter" DstTerminal 2 } Branch { DstComponent "balancer" DstTerminal 3 } } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [680, 210; 680, 190] DstComponent "balancer" DstTerminal 4 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "Activate\nsource" DstTerminal 2 } Connection { Type Signal SrcComponent "Activate\nsource" SrcTerminal 1 Points [840, 55; 840, 140] Branch { DstComponent "Outmode" DstTerminal 3 } Branch { Points [880, 140; 880, 170] DstComponent "Logical\nOperator2" DstTerminal 2 } } Connection { Type Signal SrcComponent "m" SrcTerminal 1 Points [125, 345] Branch { Points [125, 320] DstComponent "Rounding1" DstTerminal 1 } Branch { DstComponent "Sum1" DstTerminal 2 } Branch { Points [125, 370] DstComponent "Rounding" DstTerminal 1 } } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 3 DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "Outmode" SrcTerminal 2 DstComponent "Logical\nOperator2" DstTerminal 3 } Connection { Type Signal SrcComponent "sim V" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [690, 235] DstComponent "balancer" DstTerminal 5 } Connection { Type Signal SrcComponent "Logical\nOperator2" SrcTerminal 1 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "sorter" SrcTerminal 3 Points [665, 115; 665, 160] DstComponent "balancer" DstTerminal 1 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 Points [665, 350; 665, 170] DstComponent "balancer" DstTerminal 2 } Connection { Type Signal SrcComponent "balancer" SrcTerminal 6 DstComponent "Outmode" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "sorter" DstTerminal 1 } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 4 Points [425, 420] DstComponent "Configurable\nSubsystem1" DstTerminal 3 } } } Component { Type TargetCode Name "PWM_low_A" Show on Position [1125, 325] Direction up Flipped off Frame [-40, -60; 40, 60] LabelPosition [0, 63] LabelAlign up TargetPortIndices "13" SampleTime "0" EnforceBaseTask "2" CodeFcnLang "2" CodeFcn "if (Target.Family ~= \"Imperix Controllers\") then\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "\n" "local OutputCode = StringList:new()\n" "local Require = ResourceList:new()\n" "\n" "--Get mask variables\n" "local pDeviceId = Block.Mask.pDeviceId\n" "local pActivateRT = Block.Mask.pActivateRT\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tlocal temp = 1\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "local out_conf = Block.Mask.pOutConf\n" "local temp = string.reverse(tostring(Block.Mask.pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "local strCells = string.reverse(temp1)\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Block.Mask.pModuleTopo\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Block.Mask.pGlobalActive\n" "local modulator\n" "\n" "local ss_mod_id = Target.Coder.RegisterNewSsModulator(Block.Name, pDeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Too many SS_PWM created.\"\n" "end\n" "\n" "for i = 1, nbr_cells, 1 do\n" "\tif out_conf == 1.0 then \n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\telseif out_conf == 2.0 then\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+1, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+3, pDeviceId))\n" "\t\tend\n" "\telse\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\t\tif i == nbr_cells-1 then \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(globalActive, pDeviceId))\n" "\t\tend\n" "\tend\n" "end\n" "\n" "--For activate, phase and duty, if the input is the block terminal. Reconfigu" "re them at each step\n" "if pActivateRT == 2.0 then\n" "\tOutputCode:append(\"if ((float)%s > 0) {\" % {Block.InputSignal[4][1]}) --c" "ast in float is added since this condition \"if ((float) true > 0)\" can be e" "ntered by the user\n" "\tOutputCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);}\" % {modulator," " pDeviceId})\n" "\tOutputCode:append(\"else {\")\n" "\tOutputCode:append(\"SsPwm_Deactivate((tSsModulator) %s, %s);}\" % {modulato" "r, pDeviceId})\n" "end\n" "\n" "OutputCode:append(\"SsPwm_SetModulationIndex((tSsModulator) %s, (float) %s, %" "s);\" % {modulator, Block.InputSignal[1][1], pDeviceId})\n" "\n" "\t\n" "-----------------------------------------------------------------------------" "-----\n" "\n" "return {\n" " OutputCode = OutputCode,\n" " Require = Require,\n" "}" NonDftCodeFcn "local InitCode = StringList:new()\n" "\n" "local DeviceId = Block.Mask.pDeviceId\n" "local pEnabledCellsBin =Block.Mask.pEnabledCellsBin\n" "\n" "local pSelCurrent = Block.Mask.pSelCurrent\n" "local pDeadtime = Block.Mask.pDeadtime\n" "local pGlobalActive = Block.Mask.pGlobalActive\n" "local pActivateRT = Block.Mask.pActivateRT\n" "local modulator\n" "\n" "local temp = string.reverse(tostring(pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "\n" "local pEnabledCellsDec = tonumber(string.reverse(temp1),2)\n" "local ss_mod_id = Target.Coder.GetRegisteredSsModulator(Block.Name, DeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Accessing unregistered SS_PWM block\"\n" "end\n" "\n" "\n" "--compute carrier type\n" "local carrier\n" "local stairMod = \"1\";\n" "if Block.Mask.pCarrier == 1.0 then\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "elseif Block.Mask.pCarrier == 2.0 then\n" "\tcarrier = \"INVTRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "else\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"0\"\n" "end\n" "\n" "--compute output mode\n" "local outmode\n" "if Block.Mask.pOutConf == 2.0 then\n" "\toutmode = \"COMPLEMENTARY\"\t\n" "else\n" "\toutmode = \"INDEPENDENT\"\t\n" "end\n" "\n" "--compute update rate\n" "local update_rate\n" "if Block.Mask.pUpdateRate == 1.0 then\n" "\tupdate_rate = \"SINGLE_RATE\"\t--SINGLE_RATE = 0,\n" "else\n" "\tupdate_rate = \"DOUBLE_RATE\"\t--DOUBLE_RATE = 1\n" "end\n" "\n" "--compute module topology\n" "local topo\n" "if Block.Mask.pModuleTopo == 1.0 then\n" "\ttopo = \"HALF_BRIDGE\"\t\n" "else\n" "\ttopo = \"FULL_BRIDGE\"\t\n" "end\n" "\n" "--compute sorting logic\n" "local invPolarity\n" "if Block.Mask.pSortingLogic == 1.0 then\n" "\tinvPolarity = \"0\"\t\n" "else\n" "\tinvPolarity = \"1\"\t\n" "end\n" "\n" "\t\n" "InitCode:append(\"SsPwm_ConfigureCarrier((tSsModulator) %s, %s, %s, %s);\" % " "{modulator, carrier, stairMod, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureOutputMode((tSsModulator) %s, %s, %s);\" % {" "modulator, outmode, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureUpdateRate((tSsModulator) %s, %s, %s);\" % " "{modulator, update_rate, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodules((tSsModulator) %s, %s, %s);\" % {" "modulator, pEnabledCellsDec, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureCurrentInput((tSsModulator) %s, %s, %s);\" %" " {modulator, pSelCurrent, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureInvertedSorting((tSsModulator) %s, (bool) %s" ", %s);\" % {modulator, invPolarity, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodulesTopology((tSsModulator) %s, %s, %s" ");\" % {modulator, topo, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureClock((tSsModulator) %s, (tClock) %s, %s);\"" " % {modulator, Block.InputSignal[5][3], DeviceId})\n" "\n" "if Block.Mask.pOutConf == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureDeadTime((tSsModulator) %s, (float) %s, %s" ");\" % {modulator, pDeadtime, DeviceId})\n" "elseif Block.Mask.pOutConf == 3.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateOutput((tSsModulator) %s, (tPwmOut" "put) %s, %s);\" % {modulator, pGlobalActive, DeviceId})\n" "end\n" "if pActivateRT == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateAsRealTime((tSsModulator) %s, %s);" "\" % {modulator, DeviceId})\n" "else\n" "\tInitCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);\" % {modulator, De" "viceId})\n" "end\n" "\n" "\n" "-----------------------------------------------------------------------------" "------\n" "return {\n" " InitCode = InitCode,\n" "}" MaskType "SS-PWM - Sort and Select PWM" MaskDescription "Generates PWM signals for MMC, using a Sort & Selec" "t algorithm for the balancing of N submodules.

\n" "- The 'm' input is the modulation index. In half-bridge mode, m ranges from 0" " to N. In full-bridge mode m ranges from -N to N.
\n" "- The 'sim V' input is a vector containing the submodules voltages (used only" " in simulation).
\n" "- The 'sim I' input is the arm current (used only in simulation).
\n" "- The '>' input is the clock input.
\n" "- The 'A' input allows the activation (1) or deactivation (0) of the PWM outp" "ut(s)." MaskHelp "https://imperix.ch/help/plecs/pwm/ss" MaskDisplay "local font_size = 9\n" "local function getColor(color)\n" "\tif color == \"red\" then\n" "\t\treturn 255, 26, 0\n" "\telseif color == \"white\" then\n" "\t\treturn 255, 255, 255\n" "\telse --black\n" "\t\treturn 0, 0, 0\n" "\tend\n" "end\n" "local function drawClk(x,y, color)\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x+0.5, x+5.5}, {y-3.5, y})\n" "\tIcon:line({x+0.5, x+5.5}, {y+3.5, y})\n" "end\n" "local function drawRectangle(x,y,w,h, color) --w=width, h=height\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function drawRectangleFull(x,y,w,h,color)--w=width, h=height\n" "\tIcon:color(getColor(color))\n" "\tIcon:patch({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function getOffsetX_R(a_string)\n" "\tlocal size = #a_string \n" "\tsize = size + (size*0.9) \n" "\tsize = size + 4\n" "\treturn size\n" "end\n" "local function trimeVector(a_s_vector)\n" "\tlocal s = a_s_vector\n" "\tif #a_s_vector > 9 then\n" "\t\ts = \"[...]\"\n" "\tend\n" "\treturn s\n" "end\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tfor i=0,num-1 ,1 do\n" "\t\ta[i] = 0\n" "\tend \n" "\tlocal temp = 0\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "drawRectangle(-40,-60, 80, 120)\n" "drawRectangleFull(-39, 40, 78, 19, \"red\")\n" "\n" "local bb_id = 'BB' .. tostring(Dialog:get('pDeviceId'))\n" "Icon:text(0,-52, bb_id, 'FontSize',font_size)\n" "\n" "Icon:text(0,50,'SS PWM', 'FontSize',font_size, 'Color', {getColor(\"white\")}" ")\n" "\n" "drawClk(-40,50, \"black\")\n" "\n" "local out_conf = Dialog:get('pOutConf')\n" "local strCells = Dialog:get('pEnabledCellsBin')\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Dialog:get('pModuleTopo')\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Dialog:get('pGlobalActive')\n" "local temp = 0\n" "local offset_x \n" "\n" "local mid = (8-nbr_cells)/2\n" "local midH = (8-nbr_cells*2)/2\n" "\n" "for i = 0, nbr_cells-1, 1 do\n" "\tif out_conf == \"1\" then \n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(30,-52 + 12*i+12*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\telse \n" "\t\t\tIcon:text(30,-52 + 12*temp+12*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(30,-52 + 12*(temp+1)+12*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telseif out_conf == \"2\" then\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 12*i+12*mid, outputs[i] .. \"H/L\", 'FontSize',font_" "size)\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 12*temp+12*midH, 2*outputs[i] .. \"H/L\", 'FontSize'" ",font_size)\n" "\t\t\tIcon:text(28,-52 + 12*(temp+1)+12*midH, 2*outputs[i]+1 .. \"H/L\", 'Fon" "tSize',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telse\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 11*i+11*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(i+1)+11*mid, \"(A)LN\" .. globalActive, 'Fon" "tSize',font_size)\n" "\t\t\tend\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 11*temp+11*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(28,-52 + 11*(temp+1)+11*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(temp+2)+11*midH, \"(A)LN\" .. globalActive, " "'FontSize',font_size)\n" "\t\t\tend\n" "\t\tend\n" "\tend\n" "end\n" MaskDisplayLang "2" MaskIconFrame off MaskIconOpaque off MaskIconRotates on MaskInit "if ~isreal(pDeviceId) || numel(pDeviceId) ~= 1 || any" "(pDeviceId < 0)\n" "\terror('\"Device number\" must be a positive scalar.')\n" "end\n" "\n" "if ~isreal(pDeadtime) || numel(pDeadtime) ~= 1\n" "\t\terror('\"Dead-time duration\" must be a scalar.')\n" "end\n" "\n" "cells = bin2dec(num2str(pEnabledCellsBin));\n" "pNbrCellsEnabled = sum(bitget(cells, 1:8));\n" "pNotEnabledCells = 8-pNbrCellsEnabled;\n" "\n" "if pOutConf == 1 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo;\n" "elseif pOutConf == 2 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = 2*nbr_modulators*pModuleTopo;\n" "else\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo + 1;\n" "end\n" "\n" "\n" "if pCarrier == 1 || pCarrier == 2 % triangular carrier\n" "\trate_private = pUpdateRate;\n" "\tpRoundModulation = 0;\n" "else\n" "\trate_private = 1;\n" "\tpRoundModulation = 1;\n" "end\n" "\n" "if pModuleTopo == 1\n" "\tpFullBridge = 0;\n" "else\n" "\tpFullBridge = 1;\n" "end\n" "\n" "dead_time_private = 0; % avoids NaN if out_conf is not PWM H+L\n" "out_conf_private = pOutConf;\n" "phase_compensation = 1;\n" "if pOutConf == 2 && pSimDeadtime == 2 % PWM H+L and simulate dead-time\n" "\tdead_time_private = pDeadtime;\n" "\tout_conf_private = 4;\n" "\tphase_compensation = 2; % compensate dead-time\n" "end" MaskDialogCallback "if Dialog:get(\"pActivateRT\") == \"1\" then\n" "\tBlock:showTerminal(\"A\", false)\n" "else\n" "\tBlock:showTerminal(\"A\", true)\n" "\tBlock:moveTerminal(\"A\", -40,25)\n" "end\n" "\n" "\n" "local Outmode = Dialog:get(\"pOutConf\")\n" "if Outmode == \"1\" then --single\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "elseif Outmode == \"2\" then -- dual(H and L)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", true)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", true)\n" "else -- dual (H and A)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", true)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "end\n" Parameter { Variable "pDeviceId" Prompt "Device ID [default=0]" Type FreeText Value "0" Show off Tunable off TabName "Addressing" } Parameter { Variable "pOutConf" Prompt "Output mode" Type FixedText PossibleValues {"Single", "Dual (PWM_H + PWM_L)", "Single (PWM + A" "CTIVE)"} Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pGlobalActive" Prompt "Global ACTIVE on PWM lane " Type FreeText Value "4" Show off Tunable off TabName "Addressing" } Parameter { Variable "pEnabledCellsBin" Prompt "Submodules analog input channel mask" Type FreeText Value "11110000" Show off Tunable off TabName "Addressing" } Parameter { Variable "pModuleTopo" Prompt "Submodules topology" Type FixedText PossibleValues {"Half-bridge", "Full-bridge"} Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pSelCurrent" Prompt "Current input channel (8 to 15)" Type FreeText Value "13" Show on Tunable off TabName "Addressing" } Parameter { Variable "pSortingLogic" Prompt "Invert sorting logic" Type Bool Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pCarrier" Prompt "Carrier type" Type FixedText PossibleValues {"Triangle", "Inverted triangle", "No Carrier (Stai" "rcase modulation)"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pActivateRT" Prompt "PWM activation" Type FixedText PossibleValues {"Always activated", "Use block input"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pUpdateRate" Prompt "PWM parameters update rate" Type FixedText PossibleValues {"Once per PWM period", "Twice per PWM period"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pDeadtime" Prompt "Dead-time duration [in seconds]" Type FreeText Value "DT" Show off Tunable off TabName "Complementary signal parameters" } Parameter { Variable "pSimDeadtime" Prompt "Dead-time simulation" Type FixedText PossibleValues {"Ignore dead-time during simulation", "Simulate de" "ad-time"} Value "2" Show off Tunable off TabName "Complementary signal parameters" } Terminal { Type Input Position [-40, -50] Direction left } Terminal { Type Input Position [-40, 0] Direction left } Terminal { Type Input Position [-40, -25] Direction left } Terminal { Type Input Position [-40, 25] Direction left } Terminal { Type EventInput Position [-40, 50] Direction left } Schematic { Location [0, 27; 2560, 1334] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Rounding Name "Rounding" Show off Position [175, 370] Direction right Flipped off Parameter { Variable "Operation" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Rounding Name "Rounding1" Show off Position [175, 320] Direction right Flipped off Parameter { Variable "Operation" Value "3" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [255, 350] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "+-" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [425, 470] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 446, 235] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [9, 37; 293, 204] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [415, 55; 699, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type Sum Name "Sum2" Show off Position [520, 355] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch" Show on Position [615, 350] Direction right Flipped off Parameter { Variable "Criteria" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Constant Name "Constant" Show off Position [495, 295] Direction right Flipped off Frame [-55, -10; 55, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pRoundModulation" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "m" Show on Position [80, 345] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim I" Show on Position [75, 235] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim V" Show on Position [75, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "pNbrCellsEnabled" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [145, 235] Direction right Flipped off Frame [-20, -10; 20, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Input Name "A" Show on Position [75, 55] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant1" Show off Position [240, 210] Direction right Flipped off Frame [-30, -10; 30, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pFullBridge" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant2" Show off Position [255, 180] Direction right Flipped off Frame [-45, -10; 45, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pNbrCellsEnabled" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type EventInput Name "clk" Show off Position [80, 420] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } } Component { Type CScript Name "sorter" Show on Position [390, 115] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1225 349 1195 633]" Show off } Parameter { Variable "NumInputs" Value "[8, 1]" Show off } Parameter { Variable "NumOutputs" Value "8" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "int n;\n" "float work_array[8], even[8];\n" "int indexes_even[8];\n" "bool sorting_completed;" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --" "- EDIT HERE TO _END */\n" "\n" "\n" "\n" "\n" "work_array[0] = InputSignal(0,0);\n" "work_array[1] = InputSignal(0,1);\n" "work_array[2] = InputSignal(0,2);\n" "work_array[3] = InputSignal(0,3);\n" "work_array[4] = InputSignal(0,4);\n" "work_array[5] = InputSignal(0,5);\n" "work_array[6] = InputSignal(0,6);\n" "work_array[7] = InputSignal(0,7);\n" "\n" "n = InputSignal(1,0);\n" "if(n > 8) n = 8;\n" "\n" "OutputSignal(0,0) = 0;\n" "OutputSignal(0,1) = 1;\n" "OutputSignal(0,2) = 2;\n" "OutputSignal(0,3) = 3;\n" "OutputSignal(0,4) = 4;\n" "OutputSignal(0,5) = 5;\n" "OutputSignal(0,6) = 6;\n" "OutputSignal(0,7) = 7;\n" "\n" "sorting_completed = false;\n" "while (!sorting_completed)\n" "{\n" "\tsorting_completed = true;\n" "\n" "\tfor (unsigned j = 0; j < (n / 2); j++)\n" "\t{\n" "\t\tif (work_array[2 * j] > work_array[2 * j + 1])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\teven[2 * j] = work_array[2 * j + 1];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j + 1);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\teven[2 * j] = work_array[2 * j];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j + 1];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j + 1);\n" "\t\t}\n" "\t}\n" "\n" "\tfor (unsigned j = 0; j < (n / 2 - 1); j++)\n" "\t{\n" "\t\tif (even[2 * j + 1] > even[2 * j + 2])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 2];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 1];\n" "\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 1];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 2];\n" "\t\t}\n" "\t}\n" "\twork_array[0] = even[0];\n" "\twork_array[n-1] = even[n-1];\n" "\n" "\tOutputSignal(0,0) = indexes_even[0];\n" "\tOutputSignal(0,n-1) = indexes_even[n-1];\n" "}\t\t" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Component { Type Constant Name "Constant4" Show off Position [170, 135] Direction right Flipped off Frame [-80, -10; 80, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "zeros(1, 8-pNbrCellsEnabled)" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [290, 110] Direction right Flipped off Parameter { Variable "Width" Value "[pNbrCellsEnabled pNotEnabledCells]" Show off } } Component { Type TargetOutput Name "s" Show on Position [990, 175] Direction right Flipped off Parameter { Variable "Width" Value "nbr_outputs" Show off } } Component { Type ConfigurableSubsystem Name "Activate\nsource" Show on Position [790, 55] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [-25, 0] Direction left } TerminalNames { "out", "A" } Location [0, 36; 441, 234] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Internal" Schematic { Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [240, 80] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "External" Schematic { Component { Type Output Name "out" Show on Position [260, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [145, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pActivateRT" Show off } } Component { Type LogicalOperator Name "Logical\nOperator2" Show off Position [915, 175] Direction up Flipped off Parameter { Variable "Operator" Value "1" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type ConfigurableSubsystem Name "Outmode" Show on Position [840, 180] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "A" } Location [6, 40; 395, 226] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single" Schematic { Component { Type Input Name "in" Show on Position [115, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [275, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [115, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "Dual H+L" Schematic { Component { Type Input Name "in" Show on Position [110, 75] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [180, 105] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Input Name "A" Show on Position [110, 110] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 80] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 1362, 300] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[906 498 1324 444]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [205, 105; 205, 85] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [145, 75] Branch { Points [145, 105] DstComponent "Logical\nOperator" DstTerminal 2 } Branch { DstComponent "Mux and reorder" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+A" Schematic { Component { Type Input Name "in" Show on Position [110, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [110, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 85] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [1151, 369; 1434, 537] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1183 329 792 314]" Show off } Parameter { Variable "NumInputs" Value "[pNbrCellsEnabled*pModuleTopo 1]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < WIDTH; i++)\n" "{\n" "\tOutputSignal(0, i) = InputSignal(0, i);\n" "}\n" "\tOutputSignal(0, WIDTH) = InputSignal(1, 0);" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Mux and reorder" DstTerminal 1 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 Points [175, 115; 175, 90] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+L w/ dead-time" Schematic { Component { Type Input Name "in" Show on Position [65, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [305, 75] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [65, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Delays/Turn-on Delay" Name "Dead-time\ngenerator" Show on Position [235, 75] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "DeadTimeSource" Value "1" Show off } Parameter { Variable "T_d" Value "dead_time_private" Show off } Parameter { Variable "Rounding" Value "1" Show off } Terminal { Type Input Position [-15, 0] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [135, 100] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [185, 75] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 698, 223] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1352 253 1105 683]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "Dead-time\ngenerator" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ngenerator" SrcTerminal 2 DstComponent "out" DstTerminal 1 } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [160, 100; 160, 80] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [100, 70] Branch { DstComponent "Mux and reorder" DstTerminal 1 } Branch { Points [100, 100] DstComponent "Logical\nOperator" DstTerminal 2 } } } } Parameter { Variable "Configuration" Value "out_conf_private" Show off } } Component { Type Subsystem Name "CB_PWM" Show on Position [355, 385] Direction up Flipped off Frame [-35, -45; 35, 45] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -35] Direction left } Terminal { Type Input Position [-35, 35] Direction left } Terminal { Type Output Position [39, -35] Direction right } Terminal { Type Output Position [39, 35] Direction right } Schematic { Location [5, 38; 735, 345] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Integrator Name "Integrator" Show off Position [385, 95] Direction right Flipped off Parameter { Variable "ExternalReset" Value "2" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0" Show off } Parameter { Variable "ShowStatePort" Value "1" Show off } Parameter { Variable "EnableWrapping" Value "1" Show off } Parameter { Variable "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [275, 70] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type RelationalOperator Name "Relational\nOperator" Show off Position [330, 100] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [370, 150] Direction right Flipped on Frame [-25, -10; 25, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0.5" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [335, 205] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 751, 346] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [369, 400; 653, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [1110, 345; 1394, 512] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type ConfigurableSubsystem Name "Carrier" Show on Position [450, 95] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } TerminalNames { "In1", "Out1" } Location [5, 35; 446, 233] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[0 1 0]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "Inv. triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[1 0 1]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "No carrier" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pCarrier" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [160, 70] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "[1 2]" Show off } } Component { Type Subsystem Name "Phase" Show on Position [235, 115] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } Schematic { Location [5, 36; 461, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "P" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "P'" Show on Position [390, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type ConfigurableSubsystem Name "Dead-time\ncompensation" Show on Position [205, 90] Direction up Flipped off Frame [-35, -20; 35, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -10] Direction left } Terminal { Type Output Position [39, 0] Direction right } Terminal { Type Input Position [-35, 10] Direction left } TerminalNames { "phase", "phase'", "freq" } Location [5, 39; 581, 225] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Ignore dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } } Name "Simulate dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 160] Direction right Flipped off Frame [-65, -10; 65, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "dead_time_private/2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Product Name "Product" Show off Position [260, 120] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Saturation Name "Saturation" Show off Position [325, 120] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.25" Show off } Parameter { Variable "LowerLimit" Value "0" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [225, 160; 225, 125] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "freq" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 Points [365, 120] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "phase_compensation" Show off } } Component { Type Input Name "clk" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Math Name "Math" Show off Position [320, 95] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type Constant Name "Constant" Show off Position [265, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [120, 115] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "[1]" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "Dead-time\ncompensation" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ncompensation" SrcTerminal 2 DstComponent "Math" DstTerminal 2 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [285, 110; 285, 100] DstComponent "Math" DstTerminal 3 } Connection { Type Signal SrcComponent "Math" SrcTerminal 1 DstComponent "P'" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [155, 115] DstComponent "Dead-time\ncompensation" DstTerminal 3 } } } Component { Type Subsystem Name "Compare" Show on Position [560, 155] Direction up Flipped off Frame [-30, -20; 30, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-30, -5] Direction left } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [2, 34; 496, 277] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "carrier" Show on Position [100, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [430, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "duty" Show on Position [100, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type RelationalOperator Name "Relational\nOperator1" Show off Position [185, 85] Direction right Flipped off Parameter { Variable "Operator" Value "3" Show off } } Component { Type SignalSwitch Name "Switch" Show off Position [275, 90] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "1" Show off } } Component { Type Constant Name "Constant" Show off Position [215, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant1" Show off Position [325, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch1" Show off Position [375, 95] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Gain Name "Gain" Show off Position [320, 150] Direction right Flipped off Parameter { Variable "K" Value "-1" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "11" Show off } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [140, 65; 140, 80] DstComponent "Relational\nOperator1" DstTerminal 1 } Connection { Type Signal SrcComponent "duty" SrcTerminal 1 Points [140, 105] Branch { Points [140, 90] DstComponent "Relational\nOperator1" DstTerminal 2 } Branch { Points [140, 150; 275, 150] Branch { DstComponent "Switch" DstTerminal 4 } Branch { DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [245, 110] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator1" SrcTerminal 3 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 DstComponent "Switch1" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [345, 115] DstComponent "Switch1" DstTerminal 2 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 Points [375, 150] DstComponent "Switch1" DstTerminal 4 } Connection { Type Signal SrcComponent "Switch1" SrcTerminal 1 DstComponent "PWM" DstTerminal 1 } } } Component { Type Constant Name "Constant" Show on Position [95, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "D" Show on Position [45, 205] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name ">" Show on Position [60, 70] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [650, 155] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Trig" Show on Position [650, 215] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [355, 65] DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [410, 95] Branch { DstComponent "Compare to\nConstant" DstTerminal 1 } Branch { DstComponent "Carrier" DstTerminal 1 } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "Integrator" DstTerminal 3 } Connection { Type Signal SrcComponent "Phase" SrcTerminal 2 Points [285, 115; 285, 105] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent ">" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [235, 70] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Phase" DstTerminal 3 } } Connection { Type Signal SrcComponent "Compare" SrcTerminal 2 DstComponent "PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "Phase" DstTerminal 1 } Connection { Type Signal SrcComponent "D" SrcTerminal 1 DstComponent "Configurable\nSubsystem1" DstTerminal 1 } Connection { Type Signal SrcComponent "Carrier" SrcTerminal 2 Points [500, 95; 500, 150] DstComponent "Compare" DstTerminal 1 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [335, 150; 335, 175] Branch { DstComponent "Configurable\nSubsystem1" DstTerminal 3 } Branch { Points [460, 175; 460, 215] DstComponent "Trig" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [285, 75; 285, 95] DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [500, 205; 500, 160] DstComponent "Compare" DstTerminal 3 } } } Component { Type CScript Name "balancer" Show on Position [735, 180] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1069 546 422 314]" Show off } Parameter { Variable "NumInputs" Value "[8 1 1 1 1]" Show off } Parameter { Variable "NumOutputs" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "-1" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "#define NH 0\n" "#define NL 1\n" "#define PL 2\n" "#define PH 3\n" "\n" "unsigned int next_switch_A[8], cell_state[8];" Show off } Parameter { Variable "StartFcn" Value "for(unsigned int i = 0; i < 8; i++){\n" "\tcell_state[i] = PL;\n" "\tnext_switch_A[i] = 0;\n" "}" Show off } Parameter { Variable "OutputFcn" Value "signed int ReqLevel = InputSignal(1,0);\n" "unsigned int Ncells = InputSignal(2,0);\n" "bool full_bridge = InputSignal(3,0);\n" "bool I_negative\t\t\t = InputSignal(4,0);\n" "\n" "if (Ncells > 8) Ncells = 8;\n" "\n" "for (unsigned int k = 0; k < Ncells; k++) {\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // compute actual level\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " signed int ActualLevel = 0;\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" "\t\tif (cell_state[i] == PH) ActualLevel++;\n" " else if (cell_state[i] == NH) ActualLevel--;\n" "\t}\n" "\n" " if(ActualLevel == ReqLevel) break;\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " bool can_rise[8];\n" " bool can_fall[8];\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" " if(cell_state[i] == PH) can_rise[i] = false;\n" " else can_rise[i] = true;\n" "\n" " if(full_bridge) {\n" "\t\t\t\tif(cell_state[i] == NH) can_fall[i] = false;\n" " else can_fall[i] = true;\n" " } else {\n" " if(cell_state[i] == PH) can_fall[i] = true;\n" " else can_fall[i] = false;\n" " }\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // largest/smallest can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " int largest_can_rise;\n" " int largest_can_fall;\n" " int smallest_can_rise;\n" " int smallest_can_fall;\n" "\n" " for (unsigned int n = 0; n < Ncells; n++) {\n" " // 0 to N-1 -> smallest to largest\n" " unsigned int i = InputSignal(0,n);\n" "\n" " if(can_rise[i]) {\n" " largest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " largest_can_fall = i;\n" " }\n" "\n" " // N-1 to 0 -> smallest to largest\n" " i = InputSignal(0,Ncells-n-1);\n" "\n" " if(can_rise[i]) {\n" " smallest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " smallest_can_fall = i;\n" " }\n" " }\n" "\n" " int cell_rise;\n" " int cell_fall;\n" "\n" " if(I_negative) {\n" " cell_rise = largest_can_rise;\n" " cell_fall = smallest_can_fall;\n" " } else {\n" " cell_rise = smallest_can_rise;\n" " cell_fall = largest_can_fall;\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // transition\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " // FALL --------------------\n" "\n" " if(ReqLevel < ActualLevel) {\n" " if(cell_state[cell_fall] == PH) { // PH\n" " if(full_bridge && next_switch_A[cell_fall]) {\n" " cell_state[cell_fall] = NL; // NL\n" " } else {\n" " cell_state[cell_fall] = PL; // PL\n" " }\n" " } else {\n" " if(full_bridge) {\n" " cell_state[cell_fall] = NH; // NH\n" " }\n" " if(cell_state[cell_fall] == NL) { // NL\n" " next_switch_A[cell_fall] = true;\n" " } else {\n" " next_switch_A[cell_fall] = false;\n" " }\n" " }\n" " }\n" "\n" " // RISE --------------------\n" "\n" " if(ReqLevel > ActualLevel) {\n" " if(cell_state[cell_rise] == NH) { // NH\n" " if(full_bridge && !next_switch_A[cell_rise]) {\n" " cell_state[cell_rise] = NL; // NL\n" " } else {\n" " cell_state[cell_rise] = PL; // PL\n" " }\n" " } else {\n" " if(cell_state[cell_rise] == PL) { // PL\n" " next_switch_A[cell_rise] = true;\n" " } else {\n" " next_switch_A[cell_rise] = false;\n" " }\n" " cell_state[cell_rise] = PH; // PH\n" " }\n" " }\n" "}\n" "\n" "for (unsigned int i = 0; i < Ncells; i++)\n" "{\n" "\tif(full_bridge) {\n" "\t\tif((cell_state[i] == PH) || (cell_state[i] == PL)) {\n" "\t\t\tOutputSignal(0,i*2) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2) = 0;\n" "\t\t}\n" "\t\tif((cell_state[i] == PL) || (cell_state[i] == NH)) {\n" "\t\t\tOutputSignal(0,i*2+1) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2+1) = 0;\n" "\t\t}\n" " } else {\n" " if(cell_state[i] == PH) {\n" " \tOutputSignal(0,i) = 1;\n" " } else {\n" " \tOutputSignal(0,i) = 0;\n" " }\n" " }\n" "}\n" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "Rounding" SrcTerminal 2 Points [215, 370] Branch { Points [215, 355] DstComponent "Sum1" DstTerminal 3 } Branch { Points [215, 470] DstComponent "Configurable\nSubsystem1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Rounding1" SrcTerminal 2 Points [555, 320; 555, 345] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [475, 470; 475, 360] DstComponent "Sum2" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "sim I" SrcTerminal 1 DstComponent "Compare to\nConstant" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [265, 135; 265, 115] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [615, 295] DstComponent "Switch" DstTerminal 4 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [310, 180] Branch { Points [310, 120] DstComponent "sorter" DstTerminal 2 } Branch { DstComponent "balancer" DstTerminal 3 } } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [680, 210; 680, 190] DstComponent "balancer" DstTerminal 4 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "Activate\nsource" DstTerminal 2 } Connection { Type Signal SrcComponent "Activate\nsource" SrcTerminal 1 Points [840, 55; 840, 140] Branch { DstComponent "Outmode" DstTerminal 3 } Branch { Points [880, 140; 880, 170] DstComponent "Logical\nOperator2" DstTerminal 2 } } Connection { Type Signal SrcComponent "m" SrcTerminal 1 Points [125, 345] Branch { Points [125, 320] DstComponent "Rounding1" DstTerminal 1 } Branch { DstComponent "Sum1" DstTerminal 2 } Branch { Points [125, 370] DstComponent "Rounding" DstTerminal 1 } } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 3 DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "Outmode" SrcTerminal 2 DstComponent "Logical\nOperator2" DstTerminal 3 } Connection { Type Signal SrcComponent "sim V" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [690, 235] DstComponent "balancer" DstTerminal 5 } Connection { Type Signal SrcComponent "Logical\nOperator2" SrcTerminal 1 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "sorter" SrcTerminal 3 Points [665, 115; 665, 160] DstComponent "balancer" DstTerminal 1 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 Points [665, 350; 665, 170] DstComponent "balancer" DstTerminal 2 } Connection { Type Signal SrcComponent "balancer" SrcTerminal 6 DstComponent "Outmode" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "sorter" DstTerminal 1 } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 4 Points [425, 420] DstComponent "Configurable\nSubsystem1" DstTerminal 3 } } } Component { Type TargetCode Name "PWM_up_B" Show on Position [1125, 495] Direction up Flipped off Frame [-40, -60; 40, 60] LabelPosition [0, 63] LabelAlign up TargetPortIndices "14" SampleTime "0" EnforceBaseTask "2" CodeFcnLang "2" CodeFcn "if (Target.Family ~= \"Imperix Controllers\") then\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "\n" "local OutputCode = StringList:new()\n" "local Require = ResourceList:new()\n" "\n" "--Get mask variables\n" "local pDeviceId = Block.Mask.pDeviceId\n" "local pActivateRT = Block.Mask.pActivateRT\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tlocal temp = 1\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "local out_conf = Block.Mask.pOutConf\n" "local temp = string.reverse(tostring(Block.Mask.pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "local strCells = string.reverse(temp1)\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Block.Mask.pModuleTopo\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Block.Mask.pGlobalActive\n" "local modulator\n" "\n" "local ss_mod_id = Target.Coder.RegisterNewSsModulator(Block.Name, pDeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Too many SS_PWM created.\"\n" "end\n" "\n" "for i = 1, nbr_cells, 1 do\n" "\tif out_conf == 1.0 then \n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\telseif out_conf == 2.0 then\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+1, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+3, pDeviceId))\n" "\t\tend\n" "\telse\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\t\tif i == nbr_cells-1 then \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(globalActive, pDeviceId))\n" "\t\tend\n" "\tend\n" "end\n" "\n" "--For activate, phase and duty, if the input is the block terminal. Reconfigu" "re them at each step\n" "if pActivateRT == 2.0 then\n" "\tOutputCode:append(\"if ((float)%s > 0) {\" % {Block.InputSignal[4][1]}) --c" "ast in float is added since this condition \"if ((float) true > 0)\" can be e" "ntered by the user\n" "\tOutputCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);}\" % {modulator," " pDeviceId})\n" "\tOutputCode:append(\"else {\")\n" "\tOutputCode:append(\"SsPwm_Deactivate((tSsModulator) %s, %s);}\" % {modulato" "r, pDeviceId})\n" "end\n" "\n" "OutputCode:append(\"SsPwm_SetModulationIndex((tSsModulator) %s, (float) %s, %" "s);\" % {modulator, Block.InputSignal[1][1], pDeviceId})\n" "\n" "\t\n" "-----------------------------------------------------------------------------" "-----\n" "\n" "return {\n" " OutputCode = OutputCode,\n" " Require = Require,\n" "}" NonDftCodeFcn "local InitCode = StringList:new()\n" "\n" "local DeviceId = Block.Mask.pDeviceId\n" "local pEnabledCellsBin =Block.Mask.pEnabledCellsBin\n" "\n" "local pSelCurrent = Block.Mask.pSelCurrent\n" "local pDeadtime = Block.Mask.pDeadtime\n" "local pGlobalActive = Block.Mask.pGlobalActive\n" "local pActivateRT = Block.Mask.pActivateRT\n" "local modulator\n" "\n" "local temp = string.reverse(tostring(pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "\n" "local pEnabledCellsDec = tonumber(string.reverse(temp1),2)\n" "local ss_mod_id = Target.Coder.GetRegisteredSsModulator(Block.Name, DeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Accessing unregistered SS_PWM block\"\n" "end\n" "\n" "\n" "--compute carrier type\n" "local carrier\n" "local stairMod = \"1\";\n" "if Block.Mask.pCarrier == 1.0 then\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "elseif Block.Mask.pCarrier == 2.0 then\n" "\tcarrier = \"INVTRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "else\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"0\"\n" "end\n" "\n" "--compute output mode\n" "local outmode\n" "if Block.Mask.pOutConf == 2.0 then\n" "\toutmode = \"COMPLEMENTARY\"\t\n" "else\n" "\toutmode = \"INDEPENDENT\"\t\n" "end\n" "\n" "--compute update rate\n" "local update_rate\n" "if Block.Mask.pUpdateRate == 1.0 then\n" "\tupdate_rate = \"SINGLE_RATE\"\t--SINGLE_RATE = 0,\n" "else\n" "\tupdate_rate = \"DOUBLE_RATE\"\t--DOUBLE_RATE = 1\n" "end\n" "\n" "--compute module topology\n" "local topo\n" "if Block.Mask.pModuleTopo == 1.0 then\n" "\ttopo = \"HALF_BRIDGE\"\t\n" "else\n" "\ttopo = \"FULL_BRIDGE\"\t\n" "end\n" "\n" "--compute sorting logic\n" "local invPolarity\n" "if Block.Mask.pSortingLogic == 1.0 then\n" "\tinvPolarity = \"0\"\t\n" "else\n" "\tinvPolarity = \"1\"\t\n" "end\n" "\n" "\t\n" "InitCode:append(\"SsPwm_ConfigureCarrier((tSsModulator) %s, %s, %s, %s);\" % " "{modulator, carrier, stairMod, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureOutputMode((tSsModulator) %s, %s, %s);\" % {" "modulator, outmode, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureUpdateRate((tSsModulator) %s, %s, %s);\" % " "{modulator, update_rate, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodules((tSsModulator) %s, %s, %s);\" % {" "modulator, pEnabledCellsDec, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureCurrentInput((tSsModulator) %s, %s, %s);\" %" " {modulator, pSelCurrent, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureInvertedSorting((tSsModulator) %s, (bool) %s" ", %s);\" % {modulator, invPolarity, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodulesTopology((tSsModulator) %s, %s, %s" ");\" % {modulator, topo, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureClock((tSsModulator) %s, (tClock) %s, %s);\"" " % {modulator, Block.InputSignal[5][3], DeviceId})\n" "\n" "if Block.Mask.pOutConf == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureDeadTime((tSsModulator) %s, (float) %s, %s" ");\" % {modulator, pDeadtime, DeviceId})\n" "elseif Block.Mask.pOutConf == 3.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateOutput((tSsModulator) %s, (tPwmOut" "put) %s, %s);\" % {modulator, pGlobalActive, DeviceId})\n" "end\n" "if pActivateRT == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateAsRealTime((tSsModulator) %s, %s);" "\" % {modulator, DeviceId})\n" "else\n" "\tInitCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);\" % {modulator, De" "viceId})\n" "end\n" "\n" "\n" "-----------------------------------------------------------------------------" "------\n" "return {\n" " InitCode = InitCode,\n" "}" MaskType "SS-PWM - Sort and Select PWM" MaskDescription "Generates PWM signals for MMC, using a Sort & Selec" "t algorithm for the balancing of N submodules.

\n" "- The 'm' input is the modulation index. In half-bridge mode, m ranges from 0" " to N. In full-bridge mode m ranges from -N to N.
\n" "- The 'sim V' input is a vector containing the submodules voltages (used only" " in simulation).
\n" "- The 'sim I' input is the arm current (used only in simulation).
\n" "- The '>' input is the clock input.
\n" "- The 'A' input allows the activation (1) or deactivation (0) of the PWM outp" "ut(s)." MaskHelp "https://imperix.ch/help/plecs/pwm/ss" MaskDisplay "local font_size = 9\n" "local function getColor(color)\n" "\tif color == \"red\" then\n" "\t\treturn 255, 26, 0\n" "\telseif color == \"white\" then\n" "\t\treturn 255, 255, 255\n" "\telse --black\n" "\t\treturn 0, 0, 0\n" "\tend\n" "end\n" "local function drawClk(x,y, color)\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x+0.5, x+5.5}, {y-3.5, y})\n" "\tIcon:line({x+0.5, x+5.5}, {y+3.5, y})\n" "end\n" "local function drawRectangle(x,y,w,h, color) --w=width, h=height\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function drawRectangleFull(x,y,w,h,color)--w=width, h=height\n" "\tIcon:color(getColor(color))\n" "\tIcon:patch({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function getOffsetX_R(a_string)\n" "\tlocal size = #a_string \n" "\tsize = size + (size*0.9) \n" "\tsize = size + 4\n" "\treturn size\n" "end\n" "local function trimeVector(a_s_vector)\n" "\tlocal s = a_s_vector\n" "\tif #a_s_vector > 9 then\n" "\t\ts = \"[...]\"\n" "\tend\n" "\treturn s\n" "end\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tfor i=0,num-1 ,1 do\n" "\t\ta[i] = 0\n" "\tend \n" "\tlocal temp = 0\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "drawRectangle(-40,-60, 80, 120)\n" "drawRectangleFull(-39, 40, 78, 19, \"red\")\n" "\n" "local bb_id = 'BB' .. tostring(Dialog:get('pDeviceId'))\n" "Icon:text(0,-52, bb_id, 'FontSize',font_size)\n" "\n" "Icon:text(0,50,'SS PWM', 'FontSize',font_size, 'Color', {getColor(\"white\")}" ")\n" "\n" "drawClk(-40,50, \"black\")\n" "\n" "local out_conf = Dialog:get('pOutConf')\n" "local strCells = Dialog:get('pEnabledCellsBin')\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Dialog:get('pModuleTopo')\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Dialog:get('pGlobalActive')\n" "local temp = 0\n" "local offset_x \n" "\n" "local mid = (8-nbr_cells)/2\n" "local midH = (8-nbr_cells*2)/2\n" "\n" "for i = 0, nbr_cells-1, 1 do\n" "\tif out_conf == \"1\" then \n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(30,-52 + 12*i+12*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\telse \n" "\t\t\tIcon:text(30,-52 + 12*temp+12*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(30,-52 + 12*(temp+1)+12*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telseif out_conf == \"2\" then\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 12*i+12*mid, outputs[i] .. \"H/L\", 'FontSize',font_" "size)\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 12*temp+12*midH, 2*outputs[i] .. \"H/L\", 'FontSize'" ",font_size)\n" "\t\t\tIcon:text(28,-52 + 12*(temp+1)+12*midH, 2*outputs[i]+1 .. \"H/L\", 'Fon" "tSize',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telse\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 11*i+11*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(i+1)+11*mid, \"(A)LN\" .. globalActive, 'Fon" "tSize',font_size)\n" "\t\t\tend\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 11*temp+11*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(28,-52 + 11*(temp+1)+11*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(temp+2)+11*midH, \"(A)LN\" .. globalActive, " "'FontSize',font_size)\n" "\t\t\tend\n" "\t\tend\n" "\tend\n" "end\n" MaskDisplayLang "2" MaskIconFrame off MaskIconOpaque off MaskIconRotates on MaskInit "if ~isreal(pDeviceId) || numel(pDeviceId) ~= 1 || any" "(pDeviceId < 0)\n" "\terror('\"Device number\" must be a positive scalar.')\n" "end\n" "\n" "if ~isreal(pDeadtime) || numel(pDeadtime) ~= 1\n" "\t\terror('\"Dead-time duration\" must be a scalar.')\n" "end\n" "\n" "cells = bin2dec(num2str(pEnabledCellsBin));\n" "pNbrCellsEnabled = sum(bitget(cells, 1:8));\n" "pNotEnabledCells = 8-pNbrCellsEnabled;\n" "\n" "if pOutConf == 1 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo;\n" "elseif pOutConf == 2 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = 2*nbr_modulators*pModuleTopo;\n" "else\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo + 1;\n" "end\n" "\n" "\n" "if pCarrier == 1 || pCarrier == 2 % triangular carrier\n" "\trate_private = pUpdateRate;\n" "\tpRoundModulation = 0;\n" "else\n" "\trate_private = 1;\n" "\tpRoundModulation = 1;\n" "end\n" "\n" "if pModuleTopo == 1\n" "\tpFullBridge = 0;\n" "else\n" "\tpFullBridge = 1;\n" "end\n" "\n" "dead_time_private = 0; % avoids NaN if out_conf is not PWM H+L\n" "out_conf_private = pOutConf;\n" "phase_compensation = 1;\n" "if pOutConf == 2 && pSimDeadtime == 2 % PWM H+L and simulate dead-time\n" "\tdead_time_private = pDeadtime;\n" "\tout_conf_private = 4;\n" "\tphase_compensation = 2; % compensate dead-time\n" "end" MaskDialogCallback "if Dialog:get(\"pActivateRT\") == \"1\" then\n" "\tBlock:showTerminal(\"A\", false)\n" "else\n" "\tBlock:showTerminal(\"A\", true)\n" "\tBlock:moveTerminal(\"A\", -40,25)\n" "end\n" "\n" "\n" "local Outmode = Dialog:get(\"pOutConf\")\n" "if Outmode == \"1\" then --single\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "elseif Outmode == \"2\" then -- dual(H and L)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", true)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", true)\n" "else -- dual (H and A)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", true)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "end\n" Parameter { Variable "pDeviceId" Prompt "Device ID [default=0]" Type FreeText Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pOutConf" Prompt "Output mode" Type FixedText PossibleValues {"Single", "Dual (PWM_H + PWM_L)", "Single (PWM + A" "CTIVE)"} Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pGlobalActive" Prompt "Global ACTIVE on PWM lane " Type FreeText Value "4" Show off Tunable off TabName "Addressing" } Parameter { Variable "pEnabledCellsBin" Prompt "Submodules analog input channel mask" Type FreeText Value "00001111" Show off Tunable off TabName "Addressing" } Parameter { Variable "pModuleTopo" Prompt "Submodules topology" Type FixedText PossibleValues {"Half-bridge", "Full-bridge"} Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pSelCurrent" Prompt "Current input channel (8 to 15)" Type FreeText Value "12" Show on Tunable off TabName "Addressing" } Parameter { Variable "pSortingLogic" Prompt "Invert sorting logic" Type Bool Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pCarrier" Prompt "Carrier type" Type FixedText PossibleValues {"Triangle", "Inverted triangle", "No Carrier (Stai" "rcase modulation)"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pActivateRT" Prompt "PWM activation" Type FixedText PossibleValues {"Always activated", "Use block input"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pUpdateRate" Prompt "PWM parameters update rate" Type FixedText PossibleValues {"Once per PWM period", "Twice per PWM period"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pDeadtime" Prompt "Dead-time duration [in seconds]" Type FreeText Value "DT" Show off Tunable off TabName "Complementary signal parameters" } Parameter { Variable "pSimDeadtime" Prompt "Dead-time simulation" Type FixedText PossibleValues {"Ignore dead-time during simulation", "Simulate de" "ad-time"} Value "2" Show off Tunable off TabName "Complementary signal parameters" } Terminal { Type Input Position [-40, -50] Direction left } Terminal { Type Input Position [-40, 0] Direction left } Terminal { Type Input Position [-40, -25] Direction left } Terminal { Type Input Position [-40, 25] Direction left } Terminal { Type EventInput Position [-40, 50] Direction left } Schematic { Location [0, 27; 2560, 1334] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Rounding Name "Rounding" Show off Position [175, 370] Direction right Flipped off Parameter { Variable "Operation" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Rounding Name "Rounding1" Show off Position [175, 320] Direction right Flipped off Parameter { Variable "Operation" Value "3" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [255, 350] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "+-" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [425, 470] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 446, 235] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [9, 37; 293, 204] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [415, 55; 699, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type Sum Name "Sum2" Show off Position [520, 355] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch" Show on Position [615, 350] Direction right Flipped off Parameter { Variable "Criteria" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Constant Name "Constant" Show off Position [495, 295] Direction right Flipped off Frame [-55, -10; 55, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pRoundModulation" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "m" Show on Position [80, 345] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim I" Show on Position [75, 235] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim V" Show on Position [75, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "pNbrCellsEnabled" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [145, 235] Direction right Flipped off Frame [-20, -10; 20, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Input Name "A" Show on Position [75, 55] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant1" Show off Position [240, 210] Direction right Flipped off Frame [-30, -10; 30, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pFullBridge" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant2" Show off Position [255, 180] Direction right Flipped off Frame [-45, -10; 45, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pNbrCellsEnabled" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type EventInput Name "clk" Show off Position [80, 420] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } } Component { Type CScript Name "sorter" Show on Position [390, 115] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1225 349 1195 633]" Show off } Parameter { Variable "NumInputs" Value "[8, 1]" Show off } Parameter { Variable "NumOutputs" Value "8" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "int n;\n" "float work_array[8], even[8];\n" "int indexes_even[8];\n" "bool sorting_completed;" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --" "- EDIT HERE TO _END */\n" "\n" "\n" "\n" "\n" "work_array[0] = InputSignal(0,0);\n" "work_array[1] = InputSignal(0,1);\n" "work_array[2] = InputSignal(0,2);\n" "work_array[3] = InputSignal(0,3);\n" "work_array[4] = InputSignal(0,4);\n" "work_array[5] = InputSignal(0,5);\n" "work_array[6] = InputSignal(0,6);\n" "work_array[7] = InputSignal(0,7);\n" "\n" "n = InputSignal(1,0);\n" "if(n > 8) n = 8;\n" "\n" "OutputSignal(0,0) = 0;\n" "OutputSignal(0,1) = 1;\n" "OutputSignal(0,2) = 2;\n" "OutputSignal(0,3) = 3;\n" "OutputSignal(0,4) = 4;\n" "OutputSignal(0,5) = 5;\n" "OutputSignal(0,6) = 6;\n" "OutputSignal(0,7) = 7;\n" "\n" "sorting_completed = false;\n" "while (!sorting_completed)\n" "{\n" "\tsorting_completed = true;\n" "\n" "\tfor (unsigned j = 0; j < (n / 2); j++)\n" "\t{\n" "\t\tif (work_array[2 * j] > work_array[2 * j + 1])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\teven[2 * j] = work_array[2 * j + 1];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j + 1);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\teven[2 * j] = work_array[2 * j];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j + 1];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j + 1);\n" "\t\t}\n" "\t}\n" "\n" "\tfor (unsigned j = 0; j < (n / 2 - 1); j++)\n" "\t{\n" "\t\tif (even[2 * j + 1] > even[2 * j + 2])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 2];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 1];\n" "\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 1];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 2];\n" "\t\t}\n" "\t}\n" "\twork_array[0] = even[0];\n" "\twork_array[n-1] = even[n-1];\n" "\n" "\tOutputSignal(0,0) = indexes_even[0];\n" "\tOutputSignal(0,n-1) = indexes_even[n-1];\n" "}\t\t" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Component { Type Constant Name "Constant4" Show off Position [170, 135] Direction right Flipped off Frame [-80, -10; 80, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "zeros(1, 8-pNbrCellsEnabled)" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [290, 110] Direction right Flipped off Parameter { Variable "Width" Value "[pNbrCellsEnabled pNotEnabledCells]" Show off } } Component { Type TargetOutput Name "s" Show on Position [990, 175] Direction right Flipped off Parameter { Variable "Width" Value "nbr_outputs" Show off } } Component { Type ConfigurableSubsystem Name "Activate\nsource" Show on Position [790, 55] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [-25, 0] Direction left } TerminalNames { "out", "A" } Location [0, 36; 441, 234] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Internal" Schematic { Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [240, 80] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "External" Schematic { Component { Type Output Name "out" Show on Position [260, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [145, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pActivateRT" Show off } } Component { Type LogicalOperator Name "Logical\nOperator2" Show off Position [915, 175] Direction up Flipped off Parameter { Variable "Operator" Value "1" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type ConfigurableSubsystem Name "Outmode" Show on Position [840, 180] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "A" } Location [6, 40; 395, 226] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single" Schematic { Component { Type Input Name "in" Show on Position [115, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [275, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [115, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "Dual H+L" Schematic { Component { Type Input Name "in" Show on Position [110, 75] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [180, 105] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Input Name "A" Show on Position [110, 110] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 80] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 1362, 300] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[906 498 1324 444]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [205, 105; 205, 85] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [145, 75] Branch { Points [145, 105] DstComponent "Logical\nOperator" DstTerminal 2 } Branch { DstComponent "Mux and reorder" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+A" Schematic { Component { Type Input Name "in" Show on Position [110, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [110, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 85] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [1151, 369; 1434, 537] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1183 329 792 314]" Show off } Parameter { Variable "NumInputs" Value "[pNbrCellsEnabled*pModuleTopo 1]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < WIDTH; i++)\n" "{\n" "\tOutputSignal(0, i) = InputSignal(0, i);\n" "}\n" "\tOutputSignal(0, WIDTH) = InputSignal(1, 0);" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Mux and reorder" DstTerminal 1 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 Points [175, 115; 175, 90] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+L w/ dead-time" Schematic { Component { Type Input Name "in" Show on Position [65, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [305, 75] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [65, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Delays/Turn-on Delay" Name "Dead-time\ngenerator" Show on Position [235, 75] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "DeadTimeSource" Value "1" Show off } Parameter { Variable "T_d" Value "dead_time_private" Show off } Parameter { Variable "Rounding" Value "1" Show off } Terminal { Type Input Position [-15, 0] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [135, 100] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [185, 75] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 698, 223] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1352 253 1105 683]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "Dead-time\ngenerator" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ngenerator" SrcTerminal 2 DstComponent "out" DstTerminal 1 } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [160, 100; 160, 80] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [100, 70] Branch { DstComponent "Mux and reorder" DstTerminal 1 } Branch { Points [100, 100] DstComponent "Logical\nOperator" DstTerminal 2 } } } } Parameter { Variable "Configuration" Value "out_conf_private" Show off } } Component { Type Subsystem Name "CB_PWM" Show on Position [355, 385] Direction up Flipped off Frame [-35, -45; 35, 45] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -35] Direction left } Terminal { Type Input Position [-35, 35] Direction left } Terminal { Type Output Position [39, -35] Direction right } Terminal { Type Output Position [39, 35] Direction right } Schematic { Location [5, 38; 735, 345] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Integrator Name "Integrator" Show off Position [385, 95] Direction right Flipped off Parameter { Variable "ExternalReset" Value "2" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0" Show off } Parameter { Variable "ShowStatePort" Value "1" Show off } Parameter { Variable "EnableWrapping" Value "1" Show off } Parameter { Variable "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [275, 70] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type RelationalOperator Name "Relational\nOperator" Show off Position [330, 100] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [370, 150] Direction right Flipped on Frame [-25, -10; 25, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0.5" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [335, 205] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 751, 346] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [369, 400; 653, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [1110, 345; 1394, 512] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type ConfigurableSubsystem Name "Carrier" Show on Position [450, 95] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } TerminalNames { "In1", "Out1" } Location [5, 35; 446, 233] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[0 1 0]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "Inv. triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[1 0 1]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "No carrier" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pCarrier" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [160, 70] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "[1 2]" Show off } } Component { Type Subsystem Name "Phase" Show on Position [235, 115] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } Schematic { Location [5, 36; 461, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "P" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "P'" Show on Position [390, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type ConfigurableSubsystem Name "Dead-time\ncompensation" Show on Position [205, 90] Direction up Flipped off Frame [-35, -20; 35, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -10] Direction left } Terminal { Type Output Position [39, 0] Direction right } Terminal { Type Input Position [-35, 10] Direction left } TerminalNames { "phase", "phase'", "freq" } Location [5, 39; 581, 225] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Ignore dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } } Name "Simulate dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 160] Direction right Flipped off Frame [-65, -10; 65, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "dead_time_private/2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Product Name "Product" Show off Position [260, 120] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Saturation Name "Saturation" Show off Position [325, 120] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.25" Show off } Parameter { Variable "LowerLimit" Value "0" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [225, 160; 225, 125] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "freq" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 Points [365, 120] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "phase_compensation" Show off } } Component { Type Input Name "clk" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Math Name "Math" Show off Position [320, 95] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type Constant Name "Constant" Show off Position [265, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [120, 115] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "[1]" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "Dead-time\ncompensation" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ncompensation" SrcTerminal 2 DstComponent "Math" DstTerminal 2 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [285, 110; 285, 100] DstComponent "Math" DstTerminal 3 } Connection { Type Signal SrcComponent "Math" SrcTerminal 1 DstComponent "P'" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [155, 115] DstComponent "Dead-time\ncompensation" DstTerminal 3 } } } Component { Type Subsystem Name "Compare" Show on Position [560, 155] Direction up Flipped off Frame [-30, -20; 30, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-30, -5] Direction left } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [2, 34; 496, 277] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "carrier" Show on Position [100, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [430, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "duty" Show on Position [100, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type RelationalOperator Name "Relational\nOperator1" Show off Position [185, 85] Direction right Flipped off Parameter { Variable "Operator" Value "3" Show off } } Component { Type SignalSwitch Name "Switch" Show off Position [275, 90] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "1" Show off } } Component { Type Constant Name "Constant" Show off Position [215, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant1" Show off Position [325, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch1" Show off Position [375, 95] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Gain Name "Gain" Show off Position [320, 150] Direction right Flipped off Parameter { Variable "K" Value "-1" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "11" Show off } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [140, 65; 140, 80] DstComponent "Relational\nOperator1" DstTerminal 1 } Connection { Type Signal SrcComponent "duty" SrcTerminal 1 Points [140, 105] Branch { Points [140, 90] DstComponent "Relational\nOperator1" DstTerminal 2 } Branch { Points [140, 150; 275, 150] Branch { DstComponent "Switch" DstTerminal 4 } Branch { DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [245, 110] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator1" SrcTerminal 3 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 DstComponent "Switch1" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [345, 115] DstComponent "Switch1" DstTerminal 2 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 Points [375, 150] DstComponent "Switch1" DstTerminal 4 } Connection { Type Signal SrcComponent "Switch1" SrcTerminal 1 DstComponent "PWM" DstTerminal 1 } } } Component { Type Constant Name "Constant" Show on Position [95, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "D" Show on Position [45, 205] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name ">" Show on Position [60, 70] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [650, 155] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Trig" Show on Position [650, 215] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [355, 65] DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [410, 95] Branch { DstComponent "Compare to\nConstant" DstTerminal 1 } Branch { DstComponent "Carrier" DstTerminal 1 } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "Integrator" DstTerminal 3 } Connection { Type Signal SrcComponent "Phase" SrcTerminal 2 Points [285, 115; 285, 105] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent ">" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [235, 70] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Phase" DstTerminal 3 } } Connection { Type Signal SrcComponent "Compare" SrcTerminal 2 DstComponent "PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "Phase" DstTerminal 1 } Connection { Type Signal SrcComponent "D" SrcTerminal 1 DstComponent "Configurable\nSubsystem1" DstTerminal 1 } Connection { Type Signal SrcComponent "Carrier" SrcTerminal 2 Points [500, 95; 500, 150] DstComponent "Compare" DstTerminal 1 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [335, 150; 335, 175] Branch { DstComponent "Configurable\nSubsystem1" DstTerminal 3 } Branch { Points [460, 175; 460, 215] DstComponent "Trig" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [285, 75; 285, 95] DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [500, 205; 500, 160] DstComponent "Compare" DstTerminal 3 } } } Component { Type CScript Name "balancer" Show on Position [735, 180] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1069 546 422 314]" Show off } Parameter { Variable "NumInputs" Value "[8 1 1 1 1]" Show off } Parameter { Variable "NumOutputs" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "-1" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "#define NH 0\n" "#define NL 1\n" "#define PL 2\n" "#define PH 3\n" "\n" "unsigned int next_switch_A[8], cell_state[8];" Show off } Parameter { Variable "StartFcn" Value "for(unsigned int i = 0; i < 8; i++){\n" "\tcell_state[i] = PL;\n" "\tnext_switch_A[i] = 0;\n" "}" Show off } Parameter { Variable "OutputFcn" Value "signed int ReqLevel = InputSignal(1,0);\n" "unsigned int Ncells = InputSignal(2,0);\n" "bool full_bridge = InputSignal(3,0);\n" "bool I_negative\t\t\t = InputSignal(4,0);\n" "\n" "if (Ncells > 8) Ncells = 8;\n" "\n" "for (unsigned int k = 0; k < Ncells; k++) {\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // compute actual level\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " signed int ActualLevel = 0;\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" "\t\tif (cell_state[i] == PH) ActualLevel++;\n" " else if (cell_state[i] == NH) ActualLevel--;\n" "\t}\n" "\n" " if(ActualLevel == ReqLevel) break;\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " bool can_rise[8];\n" " bool can_fall[8];\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" " if(cell_state[i] == PH) can_rise[i] = false;\n" " else can_rise[i] = true;\n" "\n" " if(full_bridge) {\n" "\t\t\t\tif(cell_state[i] == NH) can_fall[i] = false;\n" " else can_fall[i] = true;\n" " } else {\n" " if(cell_state[i] == PH) can_fall[i] = true;\n" " else can_fall[i] = false;\n" " }\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // largest/smallest can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " int largest_can_rise;\n" " int largest_can_fall;\n" " int smallest_can_rise;\n" " int smallest_can_fall;\n" "\n" " for (unsigned int n = 0; n < Ncells; n++) {\n" " // 0 to N-1 -> smallest to largest\n" " unsigned int i = InputSignal(0,n);\n" "\n" " if(can_rise[i]) {\n" " largest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " largest_can_fall = i;\n" " }\n" "\n" " // N-1 to 0 -> smallest to largest\n" " i = InputSignal(0,Ncells-n-1);\n" "\n" " if(can_rise[i]) {\n" " smallest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " smallest_can_fall = i;\n" " }\n" " }\n" "\n" " int cell_rise;\n" " int cell_fall;\n" "\n" " if(I_negative) {\n" " cell_rise = largest_can_rise;\n" " cell_fall = smallest_can_fall;\n" " } else {\n" " cell_rise = smallest_can_rise;\n" " cell_fall = largest_can_fall;\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // transition\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " // FALL --------------------\n" "\n" " if(ReqLevel < ActualLevel) {\n" " if(cell_state[cell_fall] == PH) { // PH\n" " if(full_bridge && next_switch_A[cell_fall]) {\n" " cell_state[cell_fall] = NL; // NL\n" " } else {\n" " cell_state[cell_fall] = PL; // PL\n" " }\n" " } else {\n" " if(full_bridge) {\n" " cell_state[cell_fall] = NH; // NH\n" " }\n" " if(cell_state[cell_fall] == NL) { // NL\n" " next_switch_A[cell_fall] = true;\n" " } else {\n" " next_switch_A[cell_fall] = false;\n" " }\n" " }\n" " }\n" "\n" " // RISE --------------------\n" "\n" " if(ReqLevel > ActualLevel) {\n" " if(cell_state[cell_rise] == NH) { // NH\n" " if(full_bridge && !next_switch_A[cell_rise]) {\n" " cell_state[cell_rise] = NL; // NL\n" " } else {\n" " cell_state[cell_rise] = PL; // PL\n" " }\n" " } else {\n" " if(cell_state[cell_rise] == PL) { // PL\n" " next_switch_A[cell_rise] = true;\n" " } else {\n" " next_switch_A[cell_rise] = false;\n" " }\n" " cell_state[cell_rise] = PH; // PH\n" " }\n" " }\n" "}\n" "\n" "for (unsigned int i = 0; i < Ncells; i++)\n" "{\n" "\tif(full_bridge) {\n" "\t\tif((cell_state[i] == PH) || (cell_state[i] == PL)) {\n" "\t\t\tOutputSignal(0,i*2) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2) = 0;\n" "\t\t}\n" "\t\tif((cell_state[i] == PL) || (cell_state[i] == NH)) {\n" "\t\t\tOutputSignal(0,i*2+1) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2+1) = 0;\n" "\t\t}\n" " } else {\n" " if(cell_state[i] == PH) {\n" " \tOutputSignal(0,i) = 1;\n" " } else {\n" " \tOutputSignal(0,i) = 0;\n" " }\n" " }\n" "}\n" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "Rounding" SrcTerminal 2 Points [215, 370] Branch { Points [215, 355] DstComponent "Sum1" DstTerminal 3 } Branch { Points [215, 470] DstComponent "Configurable\nSubsystem1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Rounding1" SrcTerminal 2 Points [555, 320; 555, 345] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [475, 470; 475, 360] DstComponent "Sum2" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "sim I" SrcTerminal 1 DstComponent "Compare to\nConstant" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [265, 135; 265, 115] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [615, 295] DstComponent "Switch" DstTerminal 4 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [310, 180] Branch { Points [310, 120] DstComponent "sorter" DstTerminal 2 } Branch { DstComponent "balancer" DstTerminal 3 } } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [680, 210; 680, 190] DstComponent "balancer" DstTerminal 4 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "Activate\nsource" DstTerminal 2 } Connection { Type Signal SrcComponent "Activate\nsource" SrcTerminal 1 Points [840, 55; 840, 140] Branch { DstComponent "Outmode" DstTerminal 3 } Branch { Points [880, 140; 880, 170] DstComponent "Logical\nOperator2" DstTerminal 2 } } Connection { Type Signal SrcComponent "m" SrcTerminal 1 Points [125, 345] Branch { Points [125, 320] DstComponent "Rounding1" DstTerminal 1 } Branch { DstComponent "Sum1" DstTerminal 2 } Branch { Points [125, 370] DstComponent "Rounding" DstTerminal 1 } } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 3 DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "Outmode" SrcTerminal 2 DstComponent "Logical\nOperator2" DstTerminal 3 } Connection { Type Signal SrcComponent "sim V" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [690, 235] DstComponent "balancer" DstTerminal 5 } Connection { Type Signal SrcComponent "Logical\nOperator2" SrcTerminal 1 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "sorter" SrcTerminal 3 Points [665, 115; 665, 160] DstComponent "balancer" DstTerminal 1 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 Points [665, 350; 665, 170] DstComponent "balancer" DstTerminal 2 } Connection { Type Signal SrcComponent "balancer" SrcTerminal 6 DstComponent "Outmode" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "sorter" DstTerminal 1 } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 4 Points [425, 420] DstComponent "Configurable\nSubsystem1" DstTerminal 3 } } } Component { Type TargetCode Name "PWM_low_B" Show on Position [1125, 645] Direction up Flipped off Frame [-40, -60; 40, 60] LabelPosition [0, 63] LabelAlign up TargetPortIndices "15" SampleTime "0" EnforceBaseTask "2" CodeFcnLang "2" CodeFcn "if (Target.Family ~= \"Imperix Controllers\") then\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "\n" "local OutputCode = StringList:new()\n" "local Require = ResourceList:new()\n" "\n" "--Get mask variables\n" "local pDeviceId = Block.Mask.pDeviceId\n" "local pActivateRT = Block.Mask.pActivateRT\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tlocal temp = 1\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "local out_conf = Block.Mask.pOutConf\n" "local temp = string.reverse(tostring(Block.Mask.pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "local strCells = string.reverse(temp1)\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Block.Mask.pModuleTopo\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Block.Mask.pGlobalActive\n" "local modulator\n" "\n" "local ss_mod_id = Target.Coder.RegisterNewSsModulator(Block.Name, pDeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Too many SS_PWM created.\"\n" "end\n" "\n" "for i = 1, nbr_cells, 1 do\n" "\tif out_conf == 1.0 then \n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\telseif out_conf == 2.0 then\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+1, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+3, pDeviceId))\n" "\t\tend\n" "\telse\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\t\tif i == nbr_cells-1 then \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(globalActive, pDeviceId))\n" "\t\tend\n" "\tend\n" "end\n" "\n" "--For activate, phase and duty, if the input is the block terminal. Reconfigu" "re them at each step\n" "if pActivateRT == 2.0 then\n" "\tOutputCode:append(\"if ((float)%s > 0) {\" % {Block.InputSignal[4][1]}) --c" "ast in float is added since this condition \"if ((float) true > 0)\" can be e" "ntered by the user\n" "\tOutputCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);}\" % {modulator," " pDeviceId})\n" "\tOutputCode:append(\"else {\")\n" "\tOutputCode:append(\"SsPwm_Deactivate((tSsModulator) %s, %s);}\" % {modulato" "r, pDeviceId})\n" "end\n" "\n" "OutputCode:append(\"SsPwm_SetModulationIndex((tSsModulator) %s, (float) %s, %" "s);\" % {modulator, Block.InputSignal[1][1], pDeviceId})\n" "\n" "\t\n" "-----------------------------------------------------------------------------" "-----\n" "\n" "return {\n" " OutputCode = OutputCode,\n" " Require = Require,\n" "}" NonDftCodeFcn "local InitCode = StringList:new()\n" "\n" "local DeviceId = Block.Mask.pDeviceId\n" "local pEnabledCellsBin =Block.Mask.pEnabledCellsBin\n" "\n" "local pSelCurrent = Block.Mask.pSelCurrent\n" "local pDeadtime = Block.Mask.pDeadtime\n" "local pGlobalActive = Block.Mask.pGlobalActive\n" "local pActivateRT = Block.Mask.pActivateRT\n" "local modulator\n" "\n" "local temp = string.reverse(tostring(pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "\n" "local pEnabledCellsDec = tonumber(string.reverse(temp1),2)\n" "local ss_mod_id = Target.Coder.GetRegisteredSsModulator(Block.Name, DeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Accessing unregistered SS_PWM block\"\n" "end\n" "\n" "\n" "--compute carrier type\n" "local carrier\n" "local stairMod = \"1\";\n" "if Block.Mask.pCarrier == 1.0 then\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "elseif Block.Mask.pCarrier == 2.0 then\n" "\tcarrier = \"INVTRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "else\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"0\"\n" "end\n" "\n" "--compute output mode\n" "local outmode\n" "if Block.Mask.pOutConf == 2.0 then\n" "\toutmode = \"COMPLEMENTARY\"\t\n" "else\n" "\toutmode = \"INDEPENDENT\"\t\n" "end\n" "\n" "--compute update rate\n" "local update_rate\n" "if Block.Mask.pUpdateRate == 1.0 then\n" "\tupdate_rate = \"SINGLE_RATE\"\t--SINGLE_RATE = 0,\n" "else\n" "\tupdate_rate = \"DOUBLE_RATE\"\t--DOUBLE_RATE = 1\n" "end\n" "\n" "--compute module topology\n" "local topo\n" "if Block.Mask.pModuleTopo == 1.0 then\n" "\ttopo = \"HALF_BRIDGE\"\t\n" "else\n" "\ttopo = \"FULL_BRIDGE\"\t\n" "end\n" "\n" "--compute sorting logic\n" "local invPolarity\n" "if Block.Mask.pSortingLogic == 1.0 then\n" "\tinvPolarity = \"0\"\t\n" "else\n" "\tinvPolarity = \"1\"\t\n" "end\n" "\n" "\t\n" "InitCode:append(\"SsPwm_ConfigureCarrier((tSsModulator) %s, %s, %s, %s);\" % " "{modulator, carrier, stairMod, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureOutputMode((tSsModulator) %s, %s, %s);\" % {" "modulator, outmode, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureUpdateRate((tSsModulator) %s, %s, %s);\" % " "{modulator, update_rate, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodules((tSsModulator) %s, %s, %s);\" % {" "modulator, pEnabledCellsDec, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureCurrentInput((tSsModulator) %s, %s, %s);\" %" " {modulator, pSelCurrent, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureInvertedSorting((tSsModulator) %s, (bool) %s" ", %s);\" % {modulator, invPolarity, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodulesTopology((tSsModulator) %s, %s, %s" ");\" % {modulator, topo, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureClock((tSsModulator) %s, (tClock) %s, %s);\"" " % {modulator, Block.InputSignal[5][3], DeviceId})\n" "\n" "if Block.Mask.pOutConf == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureDeadTime((tSsModulator) %s, (float) %s, %s" ");\" % {modulator, pDeadtime, DeviceId})\n" "elseif Block.Mask.pOutConf == 3.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateOutput((tSsModulator) %s, (tPwmOut" "put) %s, %s);\" % {modulator, pGlobalActive, DeviceId})\n" "end\n" "if pActivateRT == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateAsRealTime((tSsModulator) %s, %s);" "\" % {modulator, DeviceId})\n" "else\n" "\tInitCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);\" % {modulator, De" "viceId})\n" "end\n" "\n" "\n" "-----------------------------------------------------------------------------" "------\n" "return {\n" " InitCode = InitCode,\n" "}" MaskType "SS-PWM - Sort and Select PWM" MaskDescription "Generates PWM signals for MMC, using a Sort & Selec" "t algorithm for the balancing of N submodules.

\n" "- The 'm' input is the modulation index. In half-bridge mode, m ranges from 0" " to N. In full-bridge mode m ranges from -N to N.
\n" "- The 'sim V' input is a vector containing the submodules voltages (used only" " in simulation).
\n" "- The 'sim I' input is the arm current (used only in simulation).
\n" "- The '>' input is the clock input.
\n" "- The 'A' input allows the activation (1) or deactivation (0) of the PWM outp" "ut(s)." MaskHelp "https://imperix.ch/help/plecs/pwm/ss" MaskDisplay "local font_size = 9\n" "local function getColor(color)\n" "\tif color == \"red\" then\n" "\t\treturn 255, 26, 0\n" "\telseif color == \"white\" then\n" "\t\treturn 255, 255, 255\n" "\telse --black\n" "\t\treturn 0, 0, 0\n" "\tend\n" "end\n" "local function drawClk(x,y, color)\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x+0.5, x+5.5}, {y-3.5, y})\n" "\tIcon:line({x+0.5, x+5.5}, {y+3.5, y})\n" "end\n" "local function drawRectangle(x,y,w,h, color) --w=width, h=height\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function drawRectangleFull(x,y,w,h,color)--w=width, h=height\n" "\tIcon:color(getColor(color))\n" "\tIcon:patch({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function getOffsetX_R(a_string)\n" "\tlocal size = #a_string \n" "\tsize = size + (size*0.9) \n" "\tsize = size + 4\n" "\treturn size\n" "end\n" "local function trimeVector(a_s_vector)\n" "\tlocal s = a_s_vector\n" "\tif #a_s_vector > 9 then\n" "\t\ts = \"[...]\"\n" "\tend\n" "\treturn s\n" "end\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tfor i=0,num-1 ,1 do\n" "\t\ta[i] = 0\n" "\tend \n" "\tlocal temp = 0\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "drawRectangle(-40,-60, 80, 120)\n" "drawRectangleFull(-39, 40, 78, 19, \"red\")\n" "\n" "local bb_id = 'BB' .. tostring(Dialog:get('pDeviceId'))\n" "Icon:text(0,-52, bb_id, 'FontSize',font_size)\n" "\n" "Icon:text(0,50,'SS PWM', 'FontSize',font_size, 'Color', {getColor(\"white\")}" ")\n" "\n" "drawClk(-40,50, \"black\")\n" "\n" "local out_conf = Dialog:get('pOutConf')\n" "local strCells = Dialog:get('pEnabledCellsBin')\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Dialog:get('pModuleTopo')\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Dialog:get('pGlobalActive')\n" "local temp = 0\n" "local offset_x \n" "\n" "local mid = (8-nbr_cells)/2\n" "local midH = (8-nbr_cells*2)/2\n" "\n" "for i = 0, nbr_cells-1, 1 do\n" "\tif out_conf == \"1\" then \n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(30,-52 + 12*i+12*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\telse \n" "\t\t\tIcon:text(30,-52 + 12*temp+12*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(30,-52 + 12*(temp+1)+12*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telseif out_conf == \"2\" then\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 12*i+12*mid, outputs[i] .. \"H/L\", 'FontSize',font_" "size)\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 12*temp+12*midH, 2*outputs[i] .. \"H/L\", 'FontSize'" ",font_size)\n" "\t\t\tIcon:text(28,-52 + 12*(temp+1)+12*midH, 2*outputs[i]+1 .. \"H/L\", 'Fon" "tSize',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telse\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 11*i+11*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(i+1)+11*mid, \"(A)LN\" .. globalActive, 'Fon" "tSize',font_size)\n" "\t\t\tend\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 11*temp+11*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(28,-52 + 11*(temp+1)+11*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(temp+2)+11*midH, \"(A)LN\" .. globalActive, " "'FontSize',font_size)\n" "\t\t\tend\n" "\t\tend\n" "\tend\n" "end\n" MaskDisplayLang "2" MaskIconFrame off MaskIconOpaque off MaskIconRotates on MaskInit "if ~isreal(pDeviceId) || numel(pDeviceId) ~= 1 || any" "(pDeviceId < 0)\n" "\terror('\"Device number\" must be a positive scalar.')\n" "end\n" "\n" "if ~isreal(pDeadtime) || numel(pDeadtime) ~= 1\n" "\t\terror('\"Dead-time duration\" must be a scalar.')\n" "end\n" "\n" "cells = bin2dec(num2str(pEnabledCellsBin));\n" "pNbrCellsEnabled = sum(bitget(cells, 1:8));\n" "pNotEnabledCells = 8-pNbrCellsEnabled;\n" "\n" "if pOutConf == 1 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo;\n" "elseif pOutConf == 2 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = 2*nbr_modulators*pModuleTopo;\n" "else\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo + 1;\n" "end\n" "\n" "\n" "if pCarrier == 1 || pCarrier == 2 % triangular carrier\n" "\trate_private = pUpdateRate;\n" "\tpRoundModulation = 0;\n" "else\n" "\trate_private = 1;\n" "\tpRoundModulation = 1;\n" "end\n" "\n" "if pModuleTopo == 1\n" "\tpFullBridge = 0;\n" "else\n" "\tpFullBridge = 1;\n" "end\n" "\n" "dead_time_private = 0; % avoids NaN if out_conf is not PWM H+L\n" "out_conf_private = pOutConf;\n" "phase_compensation = 1;\n" "if pOutConf == 2 && pSimDeadtime == 2 % PWM H+L and simulate dead-time\n" "\tdead_time_private = pDeadtime;\n" "\tout_conf_private = 4;\n" "\tphase_compensation = 2; % compensate dead-time\n" "end" MaskDialogCallback "if Dialog:get(\"pActivateRT\") == \"1\" then\n" "\tBlock:showTerminal(\"A\", false)\n" "else\n" "\tBlock:showTerminal(\"A\", true)\n" "\tBlock:moveTerminal(\"A\", -40,25)\n" "end\n" "\n" "\n" "local Outmode = Dialog:get(\"pOutConf\")\n" "if Outmode == \"1\" then --single\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "elseif Outmode == \"2\" then -- dual(H and L)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", true)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", true)\n" "else -- dual (H and A)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", true)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "end\n" Parameter { Variable "pDeviceId" Prompt "Device ID [default=0]" Type FreeText Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pOutConf" Prompt "Output mode" Type FixedText PossibleValues {"Single", "Dual (PWM_H + PWM_L)", "Single (PWM + A" "CTIVE)"} Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pGlobalActive" Prompt "Global ACTIVE on PWM lane " Type FreeText Value "4" Show off Tunable off TabName "Addressing" } Parameter { Variable "pEnabledCellsBin" Prompt "Submodules analog input channel mask" Type FreeText Value "11110000" Show off Tunable off TabName "Addressing" } Parameter { Variable "pModuleTopo" Prompt "Submodules topology" Type FixedText PossibleValues {"Half-bridge", "Full-bridge"} Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pSelCurrent" Prompt "Current input channel (8 to 15)" Type FreeText Value "13" Show on Tunable off TabName "Addressing" } Parameter { Variable "pSortingLogic" Prompt "Invert sorting logic" Type Bool Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pCarrier" Prompt "Carrier type" Type FixedText PossibleValues {"Triangle", "Inverted triangle", "No Carrier (Stai" "rcase modulation)"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pActivateRT" Prompt "PWM activation" Type FixedText PossibleValues {"Always activated", "Use block input"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pUpdateRate" Prompt "PWM parameters update rate" Type FixedText PossibleValues {"Once per PWM period", "Twice per PWM period"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pDeadtime" Prompt "Dead-time duration [in seconds]" Type FreeText Value "DT" Show off Tunable off TabName "Complementary signal parameters" } Parameter { Variable "pSimDeadtime" Prompt "Dead-time simulation" Type FixedText PossibleValues {"Ignore dead-time during simulation", "Simulate de" "ad-time"} Value "2" Show off Tunable off TabName "Complementary signal parameters" } Terminal { Type Input Position [-40, -50] Direction left } Terminal { Type Input Position [-40, 0] Direction left } Terminal { Type Input Position [-40, -25] Direction left } Terminal { Type Input Position [-40, 25] Direction left } Terminal { Type EventInput Position [-40, 50] Direction left } Schematic { Location [0, 27; 2560, 1334] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Rounding Name "Rounding" Show off Position [175, 370] Direction right Flipped off Parameter { Variable "Operation" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Rounding Name "Rounding1" Show off Position [175, 320] Direction right Flipped off Parameter { Variable "Operation" Value "3" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [255, 350] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "+-" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [425, 470] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 446, 235] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [9, 37; 293, 204] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [415, 55; 699, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type Sum Name "Sum2" Show off Position [520, 355] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch" Show on Position [615, 350] Direction right Flipped off Parameter { Variable "Criteria" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Constant Name "Constant" Show off Position [495, 295] Direction right Flipped off Frame [-55, -10; 55, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pRoundModulation" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "m" Show on Position [80, 345] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim I" Show on Position [75, 235] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim V" Show on Position [75, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "pNbrCellsEnabled" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [145, 235] Direction right Flipped off Frame [-20, -10; 20, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Input Name "A" Show on Position [75, 55] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant1" Show off Position [240, 210] Direction right Flipped off Frame [-30, -10; 30, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pFullBridge" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant2" Show off Position [255, 180] Direction right Flipped off Frame [-45, -10; 45, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pNbrCellsEnabled" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type EventInput Name "clk" Show off Position [80, 420] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } } Component { Type CScript Name "sorter" Show on Position [390, 115] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1225 349 1195 633]" Show off } Parameter { Variable "NumInputs" Value "[8, 1]" Show off } Parameter { Variable "NumOutputs" Value "8" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "int n;\n" "float work_array[8], even[8];\n" "int indexes_even[8];\n" "bool sorting_completed;" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --" "- EDIT HERE TO _END */\n" "\n" "\n" "\n" "\n" "work_array[0] = InputSignal(0,0);\n" "work_array[1] = InputSignal(0,1);\n" "work_array[2] = InputSignal(0,2);\n" "work_array[3] = InputSignal(0,3);\n" "work_array[4] = InputSignal(0,4);\n" "work_array[5] = InputSignal(0,5);\n" "work_array[6] = InputSignal(0,6);\n" "work_array[7] = InputSignal(0,7);\n" "\n" "n = InputSignal(1,0);\n" "if(n > 8) n = 8;\n" "\n" "OutputSignal(0,0) = 0;\n" "OutputSignal(0,1) = 1;\n" "OutputSignal(0,2) = 2;\n" "OutputSignal(0,3) = 3;\n" "OutputSignal(0,4) = 4;\n" "OutputSignal(0,5) = 5;\n" "OutputSignal(0,6) = 6;\n" "OutputSignal(0,7) = 7;\n" "\n" "sorting_completed = false;\n" "while (!sorting_completed)\n" "{\n" "\tsorting_completed = true;\n" "\n" "\tfor (unsigned j = 0; j < (n / 2); j++)\n" "\t{\n" "\t\tif (work_array[2 * j] > work_array[2 * j + 1])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\teven[2 * j] = work_array[2 * j + 1];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j + 1);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\teven[2 * j] = work_array[2 * j];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j + 1];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j + 1);\n" "\t\t}\n" "\t}\n" "\n" "\tfor (unsigned j = 0; j < (n / 2 - 1); j++)\n" "\t{\n" "\t\tif (even[2 * j + 1] > even[2 * j + 2])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 2];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 1];\n" "\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 1];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 2];\n" "\t\t}\n" "\t}\n" "\twork_array[0] = even[0];\n" "\twork_array[n-1] = even[n-1];\n" "\n" "\tOutputSignal(0,0) = indexes_even[0];\n" "\tOutputSignal(0,n-1) = indexes_even[n-1];\n" "}\t\t" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Component { Type Constant Name "Constant4" Show off Position [170, 135] Direction right Flipped off Frame [-80, -10; 80, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "zeros(1, 8-pNbrCellsEnabled)" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [290, 110] Direction right Flipped off Parameter { Variable "Width" Value "[pNbrCellsEnabled pNotEnabledCells]" Show off } } Component { Type TargetOutput Name "s" Show on Position [990, 175] Direction right Flipped off Parameter { Variable "Width" Value "nbr_outputs" Show off } } Component { Type ConfigurableSubsystem Name "Activate\nsource" Show on Position [790, 55] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [-25, 0] Direction left } TerminalNames { "out", "A" } Location [0, 36; 441, 234] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Internal" Schematic { Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [240, 80] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "External" Schematic { Component { Type Output Name "out" Show on Position [260, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [145, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pActivateRT" Show off } } Component { Type LogicalOperator Name "Logical\nOperator2" Show off Position [915, 175] Direction up Flipped off Parameter { Variable "Operator" Value "1" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type ConfigurableSubsystem Name "Outmode" Show on Position [840, 180] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "A" } Location [6, 40; 395, 226] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single" Schematic { Component { Type Input Name "in" Show on Position [115, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [275, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [115, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "Dual H+L" Schematic { Component { Type Input Name "in" Show on Position [110, 75] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [180, 105] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Input Name "A" Show on Position [110, 110] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 80] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 1362, 300] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[906 498 1324 444]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [205, 105; 205, 85] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [145, 75] Branch { Points [145, 105] DstComponent "Logical\nOperator" DstTerminal 2 } Branch { DstComponent "Mux and reorder" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+A" Schematic { Component { Type Input Name "in" Show on Position [110, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [110, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 85] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [1151, 369; 1434, 537] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1183 329 792 314]" Show off } Parameter { Variable "NumInputs" Value "[pNbrCellsEnabled*pModuleTopo 1]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < WIDTH; i++)\n" "{\n" "\tOutputSignal(0, i) = InputSignal(0, i);\n" "}\n" "\tOutputSignal(0, WIDTH) = InputSignal(1, 0);" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Mux and reorder" DstTerminal 1 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 Points [175, 115; 175, 90] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+L w/ dead-time" Schematic { Component { Type Input Name "in" Show on Position [65, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [305, 75] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [65, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Delays/Turn-on Delay" Name "Dead-time\ngenerator" Show on Position [235, 75] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "DeadTimeSource" Value "1" Show off } Parameter { Variable "T_d" Value "dead_time_private" Show off } Parameter { Variable "Rounding" Value "1" Show off } Terminal { Type Input Position [-15, 0] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [135, 100] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [185, 75] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 698, 223] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1352 253 1105 683]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "Dead-time\ngenerator" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ngenerator" SrcTerminal 2 DstComponent "out" DstTerminal 1 } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [160, 100; 160, 80] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [100, 70] Branch { DstComponent "Mux and reorder" DstTerminal 1 } Branch { Points [100, 100] DstComponent "Logical\nOperator" DstTerminal 2 } } } } Parameter { Variable "Configuration" Value "out_conf_private" Show off } } Component { Type Subsystem Name "CB_PWM" Show on Position [355, 385] Direction up Flipped off Frame [-35, -45; 35, 45] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -35] Direction left } Terminal { Type Input Position [-35, 35] Direction left } Terminal { Type Output Position [39, -35] Direction right } Terminal { Type Output Position [39, 35] Direction right } Schematic { Location [5, 38; 735, 345] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Integrator Name "Integrator" Show off Position [385, 95] Direction right Flipped off Parameter { Variable "ExternalReset" Value "2" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0" Show off } Parameter { Variable "ShowStatePort" Value "1" Show off } Parameter { Variable "EnableWrapping" Value "1" Show off } Parameter { Variable "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [275, 70] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type RelationalOperator Name "Relational\nOperator" Show off Position [330, 100] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [370, 150] Direction right Flipped on Frame [-25, -10; 25, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0.5" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [335, 205] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 751, 346] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [369, 400; 653, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [1110, 345; 1394, 512] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type ConfigurableSubsystem Name "Carrier" Show on Position [450, 95] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } TerminalNames { "In1", "Out1" } Location [5, 35; 446, 233] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[0 1 0]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "Inv. triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[1 0 1]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "No carrier" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pCarrier" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [160, 70] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "[1 2]" Show off } } Component { Type Subsystem Name "Phase" Show on Position [235, 115] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } Schematic { Location [5, 36; 461, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "P" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "P'" Show on Position [390, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type ConfigurableSubsystem Name "Dead-time\ncompensation" Show on Position [205, 90] Direction up Flipped off Frame [-35, -20; 35, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -10] Direction left } Terminal { Type Output Position [39, 0] Direction right } Terminal { Type Input Position [-35, 10] Direction left } TerminalNames { "phase", "phase'", "freq" } Location [5, 39; 581, 225] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Ignore dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } } Name "Simulate dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 160] Direction right Flipped off Frame [-65, -10; 65, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "dead_time_private/2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Product Name "Product" Show off Position [260, 120] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Saturation Name "Saturation" Show off Position [325, 120] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.25" Show off } Parameter { Variable "LowerLimit" Value "0" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [225, 160; 225, 125] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "freq" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 Points [365, 120] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "phase_compensation" Show off } } Component { Type Input Name "clk" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Math Name "Math" Show off Position [320, 95] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type Constant Name "Constant" Show off Position [265, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [120, 115] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "[1]" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "Dead-time\ncompensation" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ncompensation" SrcTerminal 2 DstComponent "Math" DstTerminal 2 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [285, 110; 285, 100] DstComponent "Math" DstTerminal 3 } Connection { Type Signal SrcComponent "Math" SrcTerminal 1 DstComponent "P'" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [155, 115] DstComponent "Dead-time\ncompensation" DstTerminal 3 } } } Component { Type Subsystem Name "Compare" Show on Position [560, 155] Direction up Flipped off Frame [-30, -20; 30, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-30, -5] Direction left } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [2, 34; 496, 277] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "carrier" Show on Position [100, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [430, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "duty" Show on Position [100, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type RelationalOperator Name "Relational\nOperator1" Show off Position [185, 85] Direction right Flipped off Parameter { Variable "Operator" Value "3" Show off } } Component { Type SignalSwitch Name "Switch" Show off Position [275, 90] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "1" Show off } } Component { Type Constant Name "Constant" Show off Position [215, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant1" Show off Position [325, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch1" Show off Position [375, 95] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Gain Name "Gain" Show off Position [320, 150] Direction right Flipped off Parameter { Variable "K" Value "-1" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "11" Show off } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [140, 65; 140, 80] DstComponent "Relational\nOperator1" DstTerminal 1 } Connection { Type Signal SrcComponent "duty" SrcTerminal 1 Points [140, 105] Branch { Points [140, 90] DstComponent "Relational\nOperator1" DstTerminal 2 } Branch { Points [140, 150; 275, 150] Branch { DstComponent "Switch" DstTerminal 4 } Branch { DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [245, 110] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator1" SrcTerminal 3 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 DstComponent "Switch1" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [345, 115] DstComponent "Switch1" DstTerminal 2 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 Points [375, 150] DstComponent "Switch1" DstTerminal 4 } Connection { Type Signal SrcComponent "Switch1" SrcTerminal 1 DstComponent "PWM" DstTerminal 1 } } } Component { Type Constant Name "Constant" Show on Position [95, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "D" Show on Position [45, 205] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name ">" Show on Position [60, 70] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [650, 155] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Trig" Show on Position [650, 215] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [355, 65] DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [410, 95] Branch { DstComponent "Compare to\nConstant" DstTerminal 1 } Branch { DstComponent "Carrier" DstTerminal 1 } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "Integrator" DstTerminal 3 } Connection { Type Signal SrcComponent "Phase" SrcTerminal 2 Points [285, 115; 285, 105] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent ">" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [235, 70] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Phase" DstTerminal 3 } } Connection { Type Signal SrcComponent "Compare" SrcTerminal 2 DstComponent "PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "Phase" DstTerminal 1 } Connection { Type Signal SrcComponent "D" SrcTerminal 1 DstComponent "Configurable\nSubsystem1" DstTerminal 1 } Connection { Type Signal SrcComponent "Carrier" SrcTerminal 2 Points [500, 95; 500, 150] DstComponent "Compare" DstTerminal 1 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [335, 150; 335, 175] Branch { DstComponent "Configurable\nSubsystem1" DstTerminal 3 } Branch { Points [460, 175; 460, 215] DstComponent "Trig" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [285, 75; 285, 95] DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [500, 205; 500, 160] DstComponent "Compare" DstTerminal 3 } } } Component { Type CScript Name "balancer" Show on Position [735, 180] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1069 546 422 314]" Show off } Parameter { Variable "NumInputs" Value "[8 1 1 1 1]" Show off } Parameter { Variable "NumOutputs" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "-1" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "#define NH 0\n" "#define NL 1\n" "#define PL 2\n" "#define PH 3\n" "\n" "unsigned int next_switch_A[8], cell_state[8];" Show off } Parameter { Variable "StartFcn" Value "for(unsigned int i = 0; i < 8; i++){\n" "\tcell_state[i] = PL;\n" "\tnext_switch_A[i] = 0;\n" "}" Show off } Parameter { Variable "OutputFcn" Value "signed int ReqLevel = InputSignal(1,0);\n" "unsigned int Ncells = InputSignal(2,0);\n" "bool full_bridge = InputSignal(3,0);\n" "bool I_negative\t\t\t = InputSignal(4,0);\n" "\n" "if (Ncells > 8) Ncells = 8;\n" "\n" "for (unsigned int k = 0; k < Ncells; k++) {\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // compute actual level\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " signed int ActualLevel = 0;\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" "\t\tif (cell_state[i] == PH) ActualLevel++;\n" " else if (cell_state[i] == NH) ActualLevel--;\n" "\t}\n" "\n" " if(ActualLevel == ReqLevel) break;\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " bool can_rise[8];\n" " bool can_fall[8];\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" " if(cell_state[i] == PH) can_rise[i] = false;\n" " else can_rise[i] = true;\n" "\n" " if(full_bridge) {\n" "\t\t\t\tif(cell_state[i] == NH) can_fall[i] = false;\n" " else can_fall[i] = true;\n" " } else {\n" " if(cell_state[i] == PH) can_fall[i] = true;\n" " else can_fall[i] = false;\n" " }\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // largest/smallest can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " int largest_can_rise;\n" " int largest_can_fall;\n" " int smallest_can_rise;\n" " int smallest_can_fall;\n" "\n" " for (unsigned int n = 0; n < Ncells; n++) {\n" " // 0 to N-1 -> smallest to largest\n" " unsigned int i = InputSignal(0,n);\n" "\n" " if(can_rise[i]) {\n" " largest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " largest_can_fall = i;\n" " }\n" "\n" " // N-1 to 0 -> smallest to largest\n" " i = InputSignal(0,Ncells-n-1);\n" "\n" " if(can_rise[i]) {\n" " smallest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " smallest_can_fall = i;\n" " }\n" " }\n" "\n" " int cell_rise;\n" " int cell_fall;\n" "\n" " if(I_negative) {\n" " cell_rise = largest_can_rise;\n" " cell_fall = smallest_can_fall;\n" " } else {\n" " cell_rise = smallest_can_rise;\n" " cell_fall = largest_can_fall;\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // transition\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " // FALL --------------------\n" "\n" " if(ReqLevel < ActualLevel) {\n" " if(cell_state[cell_fall] == PH) { // PH\n" " if(full_bridge && next_switch_A[cell_fall]) {\n" " cell_state[cell_fall] = NL; // NL\n" " } else {\n" " cell_state[cell_fall] = PL; // PL\n" " }\n" " } else {\n" " if(full_bridge) {\n" " cell_state[cell_fall] = NH; // NH\n" " }\n" " if(cell_state[cell_fall] == NL) { // NL\n" " next_switch_A[cell_fall] = true;\n" " } else {\n" " next_switch_A[cell_fall] = false;\n" " }\n" " }\n" " }\n" "\n" " // RISE --------------------\n" "\n" " if(ReqLevel > ActualLevel) {\n" " if(cell_state[cell_rise] == NH) { // NH\n" " if(full_bridge && !next_switch_A[cell_rise]) {\n" " cell_state[cell_rise] = NL; // NL\n" " } else {\n" " cell_state[cell_rise] = PL; // PL\n" " }\n" " } else {\n" " if(cell_state[cell_rise] == PL) { // PL\n" " next_switch_A[cell_rise] = true;\n" " } else {\n" " next_switch_A[cell_rise] = false;\n" " }\n" " cell_state[cell_rise] = PH; // PH\n" " }\n" " }\n" "}\n" "\n" "for (unsigned int i = 0; i < Ncells; i++)\n" "{\n" "\tif(full_bridge) {\n" "\t\tif((cell_state[i] == PH) || (cell_state[i] == PL)) {\n" "\t\t\tOutputSignal(0,i*2) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2) = 0;\n" "\t\t}\n" "\t\tif((cell_state[i] == PL) || (cell_state[i] == NH)) {\n" "\t\t\tOutputSignal(0,i*2+1) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2+1) = 0;\n" "\t\t}\n" " } else {\n" " if(cell_state[i] == PH) {\n" " \tOutputSignal(0,i) = 1;\n" " } else {\n" " \tOutputSignal(0,i) = 0;\n" " }\n" " }\n" "}\n" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "Rounding" SrcTerminal 2 Points [215, 370] Branch { Points [215, 355] DstComponent "Sum1" DstTerminal 3 } Branch { Points [215, 470] DstComponent "Configurable\nSubsystem1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Rounding1" SrcTerminal 2 Points [555, 320; 555, 345] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [475, 470; 475, 360] DstComponent "Sum2" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "sim I" SrcTerminal 1 DstComponent "Compare to\nConstant" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [265, 135; 265, 115] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [615, 295] DstComponent "Switch" DstTerminal 4 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [310, 180] Branch { Points [310, 120] DstComponent "sorter" DstTerminal 2 } Branch { DstComponent "balancer" DstTerminal 3 } } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [680, 210; 680, 190] DstComponent "balancer" DstTerminal 4 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "Activate\nsource" DstTerminal 2 } Connection { Type Signal SrcComponent "Activate\nsource" SrcTerminal 1 Points [840, 55; 840, 140] Branch { DstComponent "Outmode" DstTerminal 3 } Branch { Points [880, 140; 880, 170] DstComponent "Logical\nOperator2" DstTerminal 2 } } Connection { Type Signal SrcComponent "m" SrcTerminal 1 Points [125, 345] Branch { Points [125, 320] DstComponent "Rounding1" DstTerminal 1 } Branch { DstComponent "Sum1" DstTerminal 2 } Branch { Points [125, 370] DstComponent "Rounding" DstTerminal 1 } } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 3 DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "Outmode" SrcTerminal 2 DstComponent "Logical\nOperator2" DstTerminal 3 } Connection { Type Signal SrcComponent "sim V" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [690, 235] DstComponent "balancer" DstTerminal 5 } Connection { Type Signal SrcComponent "Logical\nOperator2" SrcTerminal 1 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "sorter" SrcTerminal 3 Points [665, 115; 665, 160] DstComponent "balancer" DstTerminal 1 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 Points [665, 350; 665, 170] DstComponent "balancer" DstTerminal 2 } Connection { Type Signal SrcComponent "balancer" SrcTerminal 6 DstComponent "Outmode" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "sorter" DstTerminal 1 } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 4 Points [425, 420] DstComponent "Configurable\nSubsystem1" DstTerminal 3 } } } Component { Type TargetCode Name "PWM_up_C" Show on Position [1125, 815] Direction up Flipped off Frame [-40, -60; 40, 60] LabelPosition [0, 63] LabelAlign up TargetPortIndices "16" SampleTime "0" EnforceBaseTask "2" CodeFcnLang "2" CodeFcn "if (Target.Family ~= \"Imperix Controllers\") then\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "\n" "local OutputCode = StringList:new()\n" "local Require = ResourceList:new()\n" "\n" "--Get mask variables\n" "local pDeviceId = Block.Mask.pDeviceId\n" "local pActivateRT = Block.Mask.pActivateRT\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tlocal temp = 1\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "local out_conf = Block.Mask.pOutConf\n" "local temp = string.reverse(tostring(Block.Mask.pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "local strCells = string.reverse(temp1)\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Block.Mask.pModuleTopo\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Block.Mask.pGlobalActive\n" "local modulator\n" "\n" "local ss_mod_id = Target.Coder.RegisterNewSsModulator(Block.Name, pDeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Too many SS_PWM created.\"\n" "end\n" "\n" "for i = 1, nbr_cells, 1 do\n" "\tif out_conf == 1.0 then \n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\telseif out_conf == 2.0 then\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+1, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+3, pDeviceId))\n" "\t\tend\n" "\telse\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\t\tif i == nbr_cells-1 then \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(globalActive, pDeviceId))\n" "\t\tend\n" "\tend\n" "end\n" "\n" "--For activate, phase and duty, if the input is the block terminal. Reconfigu" "re them at each step\n" "if pActivateRT == 2.0 then\n" "\tOutputCode:append(\"if ((float)%s > 0) {\" % {Block.InputSignal[4][1]}) --c" "ast in float is added since this condition \"if ((float) true > 0)\" can be e" "ntered by the user\n" "\tOutputCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);}\" % {modulator," " pDeviceId})\n" "\tOutputCode:append(\"else {\")\n" "\tOutputCode:append(\"SsPwm_Deactivate((tSsModulator) %s, %s);}\" % {modulato" "r, pDeviceId})\n" "end\n" "\n" "OutputCode:append(\"SsPwm_SetModulationIndex((tSsModulator) %s, (float) %s, %" "s);\" % {modulator, Block.InputSignal[1][1], pDeviceId})\n" "\n" "\t\n" "-----------------------------------------------------------------------------" "-----\n" "\n" "return {\n" " OutputCode = OutputCode,\n" " Require = Require,\n" "}" NonDftCodeFcn "local InitCode = StringList:new()\n" "\n" "local DeviceId = Block.Mask.pDeviceId\n" "local pEnabledCellsBin =Block.Mask.pEnabledCellsBin\n" "\n" "local pSelCurrent = Block.Mask.pSelCurrent\n" "local pDeadtime = Block.Mask.pDeadtime\n" "local pGlobalActive = Block.Mask.pGlobalActive\n" "local pActivateRT = Block.Mask.pActivateRT\n" "local modulator\n" "\n" "local temp = string.reverse(tostring(pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "\n" "local pEnabledCellsDec = tonumber(string.reverse(temp1),2)\n" "local ss_mod_id = Target.Coder.GetRegisteredSsModulator(Block.Name, DeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Accessing unregistered SS_PWM block\"\n" "end\n" "\n" "\n" "--compute carrier type\n" "local carrier\n" "local stairMod = \"1\";\n" "if Block.Mask.pCarrier == 1.0 then\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "elseif Block.Mask.pCarrier == 2.0 then\n" "\tcarrier = \"INVTRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "else\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"0\"\n" "end\n" "\n" "--compute output mode\n" "local outmode\n" "if Block.Mask.pOutConf == 2.0 then\n" "\toutmode = \"COMPLEMENTARY\"\t\n" "else\n" "\toutmode = \"INDEPENDENT\"\t\n" "end\n" "\n" "--compute update rate\n" "local update_rate\n" "if Block.Mask.pUpdateRate == 1.0 then\n" "\tupdate_rate = \"SINGLE_RATE\"\t--SINGLE_RATE = 0,\n" "else\n" "\tupdate_rate = \"DOUBLE_RATE\"\t--DOUBLE_RATE = 1\n" "end\n" "\n" "--compute module topology\n" "local topo\n" "if Block.Mask.pModuleTopo == 1.0 then\n" "\ttopo = \"HALF_BRIDGE\"\t\n" "else\n" "\ttopo = \"FULL_BRIDGE\"\t\n" "end\n" "\n" "--compute sorting logic\n" "local invPolarity\n" "if Block.Mask.pSortingLogic == 1.0 then\n" "\tinvPolarity = \"0\"\t\n" "else\n" "\tinvPolarity = \"1\"\t\n" "end\n" "\n" "\t\n" "InitCode:append(\"SsPwm_ConfigureCarrier((tSsModulator) %s, %s, %s, %s);\" % " "{modulator, carrier, stairMod, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureOutputMode((tSsModulator) %s, %s, %s);\" % {" "modulator, outmode, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureUpdateRate((tSsModulator) %s, %s, %s);\" % " "{modulator, update_rate, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodules((tSsModulator) %s, %s, %s);\" % {" "modulator, pEnabledCellsDec, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureCurrentInput((tSsModulator) %s, %s, %s);\" %" " {modulator, pSelCurrent, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureInvertedSorting((tSsModulator) %s, (bool) %s" ", %s);\" % {modulator, invPolarity, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodulesTopology((tSsModulator) %s, %s, %s" ");\" % {modulator, topo, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureClock((tSsModulator) %s, (tClock) %s, %s);\"" " % {modulator, Block.InputSignal[5][3], DeviceId})\n" "\n" "if Block.Mask.pOutConf == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureDeadTime((tSsModulator) %s, (float) %s, %s" ");\" % {modulator, pDeadtime, DeviceId})\n" "elseif Block.Mask.pOutConf == 3.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateOutput((tSsModulator) %s, (tPwmOut" "put) %s, %s);\" % {modulator, pGlobalActive, DeviceId})\n" "end\n" "if pActivateRT == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateAsRealTime((tSsModulator) %s, %s);" "\" % {modulator, DeviceId})\n" "else\n" "\tInitCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);\" % {modulator, De" "viceId})\n" "end\n" "\n" "\n" "-----------------------------------------------------------------------------" "------\n" "return {\n" " InitCode = InitCode,\n" "}" MaskType "SS-PWM - Sort and Select PWM" MaskDescription "Generates PWM signals for MMC, using a Sort & Selec" "t algorithm for the balancing of N submodules.

\n" "- The 'm' input is the modulation index. In half-bridge mode, m ranges from 0" " to N. In full-bridge mode m ranges from -N to N.
\n" "- The 'sim V' input is a vector containing the submodules voltages (used only" " in simulation).
\n" "- The 'sim I' input is the arm current (used only in simulation).
\n" "- The '>' input is the clock input.
\n" "- The 'A' input allows the activation (1) or deactivation (0) of the PWM outp" "ut(s)." MaskHelp "https://imperix.ch/help/plecs/pwm/ss" MaskDisplay "local font_size = 9\n" "local function getColor(color)\n" "\tif color == \"red\" then\n" "\t\treturn 255, 26, 0\n" "\telseif color == \"white\" then\n" "\t\treturn 255, 255, 255\n" "\telse --black\n" "\t\treturn 0, 0, 0\n" "\tend\n" "end\n" "local function drawClk(x,y, color)\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x+0.5, x+5.5}, {y-3.5, y})\n" "\tIcon:line({x+0.5, x+5.5}, {y+3.5, y})\n" "end\n" "local function drawRectangle(x,y,w,h, color) --w=width, h=height\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function drawRectangleFull(x,y,w,h,color)--w=width, h=height\n" "\tIcon:color(getColor(color))\n" "\tIcon:patch({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function getOffsetX_R(a_string)\n" "\tlocal size = #a_string \n" "\tsize = size + (size*0.9) \n" "\tsize = size + 4\n" "\treturn size\n" "end\n" "local function trimeVector(a_s_vector)\n" "\tlocal s = a_s_vector\n" "\tif #a_s_vector > 9 then\n" "\t\ts = \"[...]\"\n" "\tend\n" "\treturn s\n" "end\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tfor i=0,num-1 ,1 do\n" "\t\ta[i] = 0\n" "\tend \n" "\tlocal temp = 0\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "drawRectangle(-40,-60, 80, 120)\n" "drawRectangleFull(-39, 40, 78, 19, \"red\")\n" "\n" "local bb_id = 'BB' .. tostring(Dialog:get('pDeviceId'))\n" "Icon:text(0,-52, bb_id, 'FontSize',font_size)\n" "\n" "Icon:text(0,50,'SS PWM', 'FontSize',font_size, 'Color', {getColor(\"white\")}" ")\n" "\n" "drawClk(-40,50, \"black\")\n" "\n" "local out_conf = Dialog:get('pOutConf')\n" "local strCells = Dialog:get('pEnabledCellsBin')\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Dialog:get('pModuleTopo')\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Dialog:get('pGlobalActive')\n" "local temp = 0\n" "local offset_x \n" "\n" "local mid = (8-nbr_cells)/2\n" "local midH = (8-nbr_cells*2)/2\n" "\n" "for i = 0, nbr_cells-1, 1 do\n" "\tif out_conf == \"1\" then \n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(30,-52 + 12*i+12*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\telse \n" "\t\t\tIcon:text(30,-52 + 12*temp+12*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(30,-52 + 12*(temp+1)+12*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telseif out_conf == \"2\" then\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 12*i+12*mid, outputs[i] .. \"H/L\", 'FontSize',font_" "size)\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 12*temp+12*midH, 2*outputs[i] .. \"H/L\", 'FontSize'" ",font_size)\n" "\t\t\tIcon:text(28,-52 + 12*(temp+1)+12*midH, 2*outputs[i]+1 .. \"H/L\", 'Fon" "tSize',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telse\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 11*i+11*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(i+1)+11*mid, \"(A)LN\" .. globalActive, 'Fon" "tSize',font_size)\n" "\t\t\tend\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 11*temp+11*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(28,-52 + 11*(temp+1)+11*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(temp+2)+11*midH, \"(A)LN\" .. globalActive, " "'FontSize',font_size)\n" "\t\t\tend\n" "\t\tend\n" "\tend\n" "end\n" MaskDisplayLang "2" MaskIconFrame off MaskIconOpaque off MaskIconRotates on MaskInit "if ~isreal(pDeviceId) || numel(pDeviceId) ~= 1 || any" "(pDeviceId < 0)\n" "\terror('\"Device number\" must be a positive scalar.')\n" "end\n" "\n" "if ~isreal(pDeadtime) || numel(pDeadtime) ~= 1\n" "\t\terror('\"Dead-time duration\" must be a scalar.')\n" "end\n" "\n" "cells = bin2dec(num2str(pEnabledCellsBin));\n" "pNbrCellsEnabled = sum(bitget(cells, 1:8));\n" "pNotEnabledCells = 8-pNbrCellsEnabled;\n" "\n" "if pOutConf == 1 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo;\n" "elseif pOutConf == 2 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = 2*nbr_modulators*pModuleTopo;\n" "else\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo + 1;\n" "end\n" "\n" "\n" "if pCarrier == 1 || pCarrier == 2 % triangular carrier\n" "\trate_private = pUpdateRate;\n" "\tpRoundModulation = 0;\n" "else\n" "\trate_private = 1;\n" "\tpRoundModulation = 1;\n" "end\n" "\n" "if pModuleTopo == 1\n" "\tpFullBridge = 0;\n" "else\n" "\tpFullBridge = 1;\n" "end\n" "\n" "dead_time_private = 0; % avoids NaN if out_conf is not PWM H+L\n" "out_conf_private = pOutConf;\n" "phase_compensation = 1;\n" "if pOutConf == 2 && pSimDeadtime == 2 % PWM H+L and simulate dead-time\n" "\tdead_time_private = pDeadtime;\n" "\tout_conf_private = 4;\n" "\tphase_compensation = 2; % compensate dead-time\n" "end" MaskDialogCallback "if Dialog:get(\"pActivateRT\") == \"1\" then\n" "\tBlock:showTerminal(\"A\", false)\n" "else\n" "\tBlock:showTerminal(\"A\", true)\n" "\tBlock:moveTerminal(\"A\", -40,25)\n" "end\n" "\n" "\n" "local Outmode = Dialog:get(\"pOutConf\")\n" "if Outmode == \"1\" then --single\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "elseif Outmode == \"2\" then -- dual(H and L)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", true)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", true)\n" "else -- dual (H and A)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", true)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "end\n" Parameter { Variable "pDeviceId" Prompt "Device ID [default=0]" Type FreeText Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pOutConf" Prompt "Output mode" Type FixedText PossibleValues {"Single", "Dual (PWM_H + PWM_L)", "Single (PWM + A" "CTIVE)"} Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pGlobalActive" Prompt "Global ACTIVE on PWM lane " Type FreeText Value "4" Show off Tunable off TabName "Addressing" } Parameter { Variable "pEnabledCellsBin" Prompt "Submodules analog input channel mask" Type FreeText Value "00001111" Show off Tunable off TabName "Addressing" } Parameter { Variable "pModuleTopo" Prompt "Submodules topology" Type FixedText PossibleValues {"Half-bridge", "Full-bridge"} Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pSelCurrent" Prompt "Current input channel (8 to 15)" Type FreeText Value "12" Show on Tunable off TabName "Addressing" } Parameter { Variable "pSortingLogic" Prompt "Invert sorting logic" Type Bool Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pCarrier" Prompt "Carrier type" Type FixedText PossibleValues {"Triangle", "Inverted triangle", "No Carrier (Stai" "rcase modulation)"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pActivateRT" Prompt "PWM activation" Type FixedText PossibleValues {"Always activated", "Use block input"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pUpdateRate" Prompt "PWM parameters update rate" Type FixedText PossibleValues {"Once per PWM period", "Twice per PWM period"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pDeadtime" Prompt "Dead-time duration [in seconds]" Type FreeText Value "DT" Show off Tunable off TabName "Complementary signal parameters" } Parameter { Variable "pSimDeadtime" Prompt "Dead-time simulation" Type FixedText PossibleValues {"Ignore dead-time during simulation", "Simulate de" "ad-time"} Value "2" Show off Tunable off TabName "Complementary signal parameters" } Terminal { Type Input Position [-40, -50] Direction left } Terminal { Type Input Position [-40, 0] Direction left } Terminal { Type Input Position [-40, -25] Direction left } Terminal { Type Input Position [-40, 25] Direction left } Terminal { Type EventInput Position [-40, 50] Direction left } Schematic { Location [0, 27; 2560, 1334] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Rounding Name "Rounding" Show off Position [175, 370] Direction right Flipped off Parameter { Variable "Operation" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Rounding Name "Rounding1" Show off Position [175, 320] Direction right Flipped off Parameter { Variable "Operation" Value "3" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [255, 350] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "+-" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [425, 470] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 446, 235] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [9, 37; 293, 204] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [415, 55; 699, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type Sum Name "Sum2" Show off Position [520, 355] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch" Show on Position [615, 350] Direction right Flipped off Parameter { Variable "Criteria" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Constant Name "Constant" Show off Position [495, 295] Direction right Flipped off Frame [-55, -10; 55, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pRoundModulation" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "m" Show on Position [80, 345] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim I" Show on Position [75, 235] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim V" Show on Position [75, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "pNbrCellsEnabled" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [145, 235] Direction right Flipped off Frame [-20, -10; 20, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Input Name "A" Show on Position [75, 55] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant1" Show off Position [240, 210] Direction right Flipped off Frame [-30, -10; 30, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pFullBridge" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant2" Show off Position [255, 180] Direction right Flipped off Frame [-45, -10; 45, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pNbrCellsEnabled" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type EventInput Name "clk" Show off Position [80, 420] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } } Component { Type CScript Name "sorter" Show on Position [390, 115] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1225 349 1195 633]" Show off } Parameter { Variable "NumInputs" Value "[8, 1]" Show off } Parameter { Variable "NumOutputs" Value "8" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "int n;\n" "float work_array[8], even[8];\n" "int indexes_even[8];\n" "bool sorting_completed;" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --" "- EDIT HERE TO _END */\n" "\n" "\n" "\n" "\n" "work_array[0] = InputSignal(0,0);\n" "work_array[1] = InputSignal(0,1);\n" "work_array[2] = InputSignal(0,2);\n" "work_array[3] = InputSignal(0,3);\n" "work_array[4] = InputSignal(0,4);\n" "work_array[5] = InputSignal(0,5);\n" "work_array[6] = InputSignal(0,6);\n" "work_array[7] = InputSignal(0,7);\n" "\n" "n = InputSignal(1,0);\n" "if(n > 8) n = 8;\n" "\n" "OutputSignal(0,0) = 0;\n" "OutputSignal(0,1) = 1;\n" "OutputSignal(0,2) = 2;\n" "OutputSignal(0,3) = 3;\n" "OutputSignal(0,4) = 4;\n" "OutputSignal(0,5) = 5;\n" "OutputSignal(0,6) = 6;\n" "OutputSignal(0,7) = 7;\n" "\n" "sorting_completed = false;\n" "while (!sorting_completed)\n" "{\n" "\tsorting_completed = true;\n" "\n" "\tfor (unsigned j = 0; j < (n / 2); j++)\n" "\t{\n" "\t\tif (work_array[2 * j] > work_array[2 * j + 1])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\teven[2 * j] = work_array[2 * j + 1];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j + 1);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\teven[2 * j] = work_array[2 * j];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j + 1];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j + 1);\n" "\t\t}\n" "\t}\n" "\n" "\tfor (unsigned j = 0; j < (n / 2 - 1); j++)\n" "\t{\n" "\t\tif (even[2 * j + 1] > even[2 * j + 2])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 2];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 1];\n" "\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 1];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 2];\n" "\t\t}\n" "\t}\n" "\twork_array[0] = even[0];\n" "\twork_array[n-1] = even[n-1];\n" "\n" "\tOutputSignal(0,0) = indexes_even[0];\n" "\tOutputSignal(0,n-1) = indexes_even[n-1];\n" "}\t\t" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Component { Type Constant Name "Constant4" Show off Position [170, 135] Direction right Flipped off Frame [-80, -10; 80, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "zeros(1, 8-pNbrCellsEnabled)" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [290, 110] Direction right Flipped off Parameter { Variable "Width" Value "[pNbrCellsEnabled pNotEnabledCells]" Show off } } Component { Type TargetOutput Name "s" Show on Position [990, 175] Direction right Flipped off Parameter { Variable "Width" Value "nbr_outputs" Show off } } Component { Type ConfigurableSubsystem Name "Activate\nsource" Show on Position [790, 55] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [-25, 0] Direction left } TerminalNames { "out", "A" } Location [0, 36; 441, 234] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Internal" Schematic { Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [240, 80] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "External" Schematic { Component { Type Output Name "out" Show on Position [260, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [145, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pActivateRT" Show off } } Component { Type LogicalOperator Name "Logical\nOperator2" Show off Position [915, 175] Direction up Flipped off Parameter { Variable "Operator" Value "1" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type ConfigurableSubsystem Name "Outmode" Show on Position [840, 180] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "A" } Location [6, 40; 395, 226] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single" Schematic { Component { Type Input Name "in" Show on Position [115, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [275, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [115, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "Dual H+L" Schematic { Component { Type Input Name "in" Show on Position [110, 75] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [180, 105] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Input Name "A" Show on Position [110, 110] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 80] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 1362, 300] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[906 498 1324 444]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [205, 105; 205, 85] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [145, 75] Branch { Points [145, 105] DstComponent "Logical\nOperator" DstTerminal 2 } Branch { DstComponent "Mux and reorder" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+A" Schematic { Component { Type Input Name "in" Show on Position [110, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [110, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 85] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [1151, 369; 1434, 537] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1183 329 792 314]" Show off } Parameter { Variable "NumInputs" Value "[pNbrCellsEnabled*pModuleTopo 1]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < WIDTH; i++)\n" "{\n" "\tOutputSignal(0, i) = InputSignal(0, i);\n" "}\n" "\tOutputSignal(0, WIDTH) = InputSignal(1, 0);" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Mux and reorder" DstTerminal 1 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 Points [175, 115; 175, 90] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+L w/ dead-time" Schematic { Component { Type Input Name "in" Show on Position [65, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [305, 75] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [65, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Delays/Turn-on Delay" Name "Dead-time\ngenerator" Show on Position [235, 75] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "DeadTimeSource" Value "1" Show off } Parameter { Variable "T_d" Value "dead_time_private" Show off } Parameter { Variable "Rounding" Value "1" Show off } Terminal { Type Input Position [-15, 0] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [135, 100] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [185, 75] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 698, 223] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1352 253 1105 683]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "Dead-time\ngenerator" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ngenerator" SrcTerminal 2 DstComponent "out" DstTerminal 1 } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [160, 100; 160, 80] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [100, 70] Branch { DstComponent "Mux and reorder" DstTerminal 1 } Branch { Points [100, 100] DstComponent "Logical\nOperator" DstTerminal 2 } } } } Parameter { Variable "Configuration" Value "out_conf_private" Show off } } Component { Type Subsystem Name "CB_PWM" Show on Position [355, 385] Direction up Flipped off Frame [-35, -45; 35, 45] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -35] Direction left } Terminal { Type Input Position [-35, 35] Direction left } Terminal { Type Output Position [39, -35] Direction right } Terminal { Type Output Position [39, 35] Direction right } Schematic { Location [5, 38; 735, 345] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Integrator Name "Integrator" Show off Position [385, 95] Direction right Flipped off Parameter { Variable "ExternalReset" Value "2" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0" Show off } Parameter { Variable "ShowStatePort" Value "1" Show off } Parameter { Variable "EnableWrapping" Value "1" Show off } Parameter { Variable "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [275, 70] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type RelationalOperator Name "Relational\nOperator" Show off Position [330, 100] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [370, 150] Direction right Flipped on Frame [-25, -10; 25, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0.5" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [335, 205] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 751, 346] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [369, 400; 653, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [1110, 345; 1394, 512] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type ConfigurableSubsystem Name "Carrier" Show on Position [450, 95] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } TerminalNames { "In1", "Out1" } Location [5, 35; 446, 233] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[0 1 0]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "Inv. triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[1 0 1]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "No carrier" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pCarrier" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [160, 70] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "[1 2]" Show off } } Component { Type Subsystem Name "Phase" Show on Position [235, 115] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } Schematic { Location [5, 36; 461, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "P" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "P'" Show on Position [390, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type ConfigurableSubsystem Name "Dead-time\ncompensation" Show on Position [205, 90] Direction up Flipped off Frame [-35, -20; 35, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -10] Direction left } Terminal { Type Output Position [39, 0] Direction right } Terminal { Type Input Position [-35, 10] Direction left } TerminalNames { "phase", "phase'", "freq" } Location [5, 39; 581, 225] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Ignore dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } } Name "Simulate dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 160] Direction right Flipped off Frame [-65, -10; 65, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "dead_time_private/2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Product Name "Product" Show off Position [260, 120] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Saturation Name "Saturation" Show off Position [325, 120] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.25" Show off } Parameter { Variable "LowerLimit" Value "0" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [225, 160; 225, 125] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "freq" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 Points [365, 120] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "phase_compensation" Show off } } Component { Type Input Name "clk" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Math Name "Math" Show off Position [320, 95] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type Constant Name "Constant" Show off Position [265, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [120, 115] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "[1]" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "Dead-time\ncompensation" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ncompensation" SrcTerminal 2 DstComponent "Math" DstTerminal 2 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [285, 110; 285, 100] DstComponent "Math" DstTerminal 3 } Connection { Type Signal SrcComponent "Math" SrcTerminal 1 DstComponent "P'" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [155, 115] DstComponent "Dead-time\ncompensation" DstTerminal 3 } } } Component { Type Subsystem Name "Compare" Show on Position [560, 155] Direction up Flipped off Frame [-30, -20; 30, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-30, -5] Direction left } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [2, 34; 496, 277] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "carrier" Show on Position [100, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [430, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "duty" Show on Position [100, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type RelationalOperator Name "Relational\nOperator1" Show off Position [185, 85] Direction right Flipped off Parameter { Variable "Operator" Value "3" Show off } } Component { Type SignalSwitch Name "Switch" Show off Position [275, 90] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "1" Show off } } Component { Type Constant Name "Constant" Show off Position [215, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant1" Show off Position [325, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch1" Show off Position [375, 95] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Gain Name "Gain" Show off Position [320, 150] Direction right Flipped off Parameter { Variable "K" Value "-1" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "11" Show off } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [140, 65; 140, 80] DstComponent "Relational\nOperator1" DstTerminal 1 } Connection { Type Signal SrcComponent "duty" SrcTerminal 1 Points [140, 105] Branch { Points [140, 90] DstComponent "Relational\nOperator1" DstTerminal 2 } Branch { Points [140, 150; 275, 150] Branch { DstComponent "Switch" DstTerminal 4 } Branch { DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [245, 110] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator1" SrcTerminal 3 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 DstComponent "Switch1" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [345, 115] DstComponent "Switch1" DstTerminal 2 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 Points [375, 150] DstComponent "Switch1" DstTerminal 4 } Connection { Type Signal SrcComponent "Switch1" SrcTerminal 1 DstComponent "PWM" DstTerminal 1 } } } Component { Type Constant Name "Constant" Show on Position [95, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "D" Show on Position [45, 205] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name ">" Show on Position [60, 70] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [650, 155] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Trig" Show on Position [650, 215] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [355, 65] DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [410, 95] Branch { DstComponent "Compare to\nConstant" DstTerminal 1 } Branch { DstComponent "Carrier" DstTerminal 1 } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "Integrator" DstTerminal 3 } Connection { Type Signal SrcComponent "Phase" SrcTerminal 2 Points [285, 115; 285, 105] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent ">" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [235, 70] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Phase" DstTerminal 3 } } Connection { Type Signal SrcComponent "Compare" SrcTerminal 2 DstComponent "PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "Phase" DstTerminal 1 } Connection { Type Signal SrcComponent "D" SrcTerminal 1 DstComponent "Configurable\nSubsystem1" DstTerminal 1 } Connection { Type Signal SrcComponent "Carrier" SrcTerminal 2 Points [500, 95; 500, 150] DstComponent "Compare" DstTerminal 1 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [335, 150; 335, 175] Branch { DstComponent "Configurable\nSubsystem1" DstTerminal 3 } Branch { Points [460, 175; 460, 215] DstComponent "Trig" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [285, 75; 285, 95] DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [500, 205; 500, 160] DstComponent "Compare" DstTerminal 3 } } } Component { Type CScript Name "balancer" Show on Position [735, 180] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1069 546 422 314]" Show off } Parameter { Variable "NumInputs" Value "[8 1 1 1 1]" Show off } Parameter { Variable "NumOutputs" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "-1" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "#define NH 0\n" "#define NL 1\n" "#define PL 2\n" "#define PH 3\n" "\n" "unsigned int next_switch_A[8], cell_state[8];" Show off } Parameter { Variable "StartFcn" Value "for(unsigned int i = 0; i < 8; i++){\n" "\tcell_state[i] = PL;\n" "\tnext_switch_A[i] = 0;\n" "}" Show off } Parameter { Variable "OutputFcn" Value "signed int ReqLevel = InputSignal(1,0);\n" "unsigned int Ncells = InputSignal(2,0);\n" "bool full_bridge = InputSignal(3,0);\n" "bool I_negative\t\t\t = InputSignal(4,0);\n" "\n" "if (Ncells > 8) Ncells = 8;\n" "\n" "for (unsigned int k = 0; k < Ncells; k++) {\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // compute actual level\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " signed int ActualLevel = 0;\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" "\t\tif (cell_state[i] == PH) ActualLevel++;\n" " else if (cell_state[i] == NH) ActualLevel--;\n" "\t}\n" "\n" " if(ActualLevel == ReqLevel) break;\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " bool can_rise[8];\n" " bool can_fall[8];\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" " if(cell_state[i] == PH) can_rise[i] = false;\n" " else can_rise[i] = true;\n" "\n" " if(full_bridge) {\n" "\t\t\t\tif(cell_state[i] == NH) can_fall[i] = false;\n" " else can_fall[i] = true;\n" " } else {\n" " if(cell_state[i] == PH) can_fall[i] = true;\n" " else can_fall[i] = false;\n" " }\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // largest/smallest can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " int largest_can_rise;\n" " int largest_can_fall;\n" " int smallest_can_rise;\n" " int smallest_can_fall;\n" "\n" " for (unsigned int n = 0; n < Ncells; n++) {\n" " // 0 to N-1 -> smallest to largest\n" " unsigned int i = InputSignal(0,n);\n" "\n" " if(can_rise[i]) {\n" " largest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " largest_can_fall = i;\n" " }\n" "\n" " // N-1 to 0 -> smallest to largest\n" " i = InputSignal(0,Ncells-n-1);\n" "\n" " if(can_rise[i]) {\n" " smallest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " smallest_can_fall = i;\n" " }\n" " }\n" "\n" " int cell_rise;\n" " int cell_fall;\n" "\n" " if(I_negative) {\n" " cell_rise = largest_can_rise;\n" " cell_fall = smallest_can_fall;\n" " } else {\n" " cell_rise = smallest_can_rise;\n" " cell_fall = largest_can_fall;\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // transition\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " // FALL --------------------\n" "\n" " if(ReqLevel < ActualLevel) {\n" " if(cell_state[cell_fall] == PH) { // PH\n" " if(full_bridge && next_switch_A[cell_fall]) {\n" " cell_state[cell_fall] = NL; // NL\n" " } else {\n" " cell_state[cell_fall] = PL; // PL\n" " }\n" " } else {\n" " if(full_bridge) {\n" " cell_state[cell_fall] = NH; // NH\n" " }\n" " if(cell_state[cell_fall] == NL) { // NL\n" " next_switch_A[cell_fall] = true;\n" " } else {\n" " next_switch_A[cell_fall] = false;\n" " }\n" " }\n" " }\n" "\n" " // RISE --------------------\n" "\n" " if(ReqLevel > ActualLevel) {\n" " if(cell_state[cell_rise] == NH) { // NH\n" " if(full_bridge && !next_switch_A[cell_rise]) {\n" " cell_state[cell_rise] = NL; // NL\n" " } else {\n" " cell_state[cell_rise] = PL; // PL\n" " }\n" " } else {\n" " if(cell_state[cell_rise] == PL) { // PL\n" " next_switch_A[cell_rise] = true;\n" " } else {\n" " next_switch_A[cell_rise] = false;\n" " }\n" " cell_state[cell_rise] = PH; // PH\n" " }\n" " }\n" "}\n" "\n" "for (unsigned int i = 0; i < Ncells; i++)\n" "{\n" "\tif(full_bridge) {\n" "\t\tif((cell_state[i] == PH) || (cell_state[i] == PL)) {\n" "\t\t\tOutputSignal(0,i*2) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2) = 0;\n" "\t\t}\n" "\t\tif((cell_state[i] == PL) || (cell_state[i] == NH)) {\n" "\t\t\tOutputSignal(0,i*2+1) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2+1) = 0;\n" "\t\t}\n" " } else {\n" " if(cell_state[i] == PH) {\n" " \tOutputSignal(0,i) = 1;\n" " } else {\n" " \tOutputSignal(0,i) = 0;\n" " }\n" " }\n" "}\n" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "Rounding" SrcTerminal 2 Points [215, 370] Branch { Points [215, 355] DstComponent "Sum1" DstTerminal 3 } Branch { Points [215, 470] DstComponent "Configurable\nSubsystem1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Rounding1" SrcTerminal 2 Points [555, 320; 555, 345] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [475, 470; 475, 360] DstComponent "Sum2" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "sim I" SrcTerminal 1 DstComponent "Compare to\nConstant" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [265, 135; 265, 115] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [615, 295] DstComponent "Switch" DstTerminal 4 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [310, 180] Branch { Points [310, 120] DstComponent "sorter" DstTerminal 2 } Branch { DstComponent "balancer" DstTerminal 3 } } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [680, 210; 680, 190] DstComponent "balancer" DstTerminal 4 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "Activate\nsource" DstTerminal 2 } Connection { Type Signal SrcComponent "Activate\nsource" SrcTerminal 1 Points [840, 55; 840, 140] Branch { DstComponent "Outmode" DstTerminal 3 } Branch { Points [880, 140; 880, 170] DstComponent "Logical\nOperator2" DstTerminal 2 } } Connection { Type Signal SrcComponent "m" SrcTerminal 1 Points [125, 345] Branch { Points [125, 320] DstComponent "Rounding1" DstTerminal 1 } Branch { DstComponent "Sum1" DstTerminal 2 } Branch { Points [125, 370] DstComponent "Rounding" DstTerminal 1 } } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 3 DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "Outmode" SrcTerminal 2 DstComponent "Logical\nOperator2" DstTerminal 3 } Connection { Type Signal SrcComponent "sim V" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [690, 235] DstComponent "balancer" DstTerminal 5 } Connection { Type Signal SrcComponent "Logical\nOperator2" SrcTerminal 1 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "sorter" SrcTerminal 3 Points [665, 115; 665, 160] DstComponent "balancer" DstTerminal 1 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 Points [665, 350; 665, 170] DstComponent "balancer" DstTerminal 2 } Connection { Type Signal SrcComponent "balancer" SrcTerminal 6 DstComponent "Outmode" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "sorter" DstTerminal 1 } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 4 Points [425, 420] DstComponent "Configurable\nSubsystem1" DstTerminal 3 } } } Component { Type TargetCode Name "PWM_low_C" Show on Position [1125, 965] Direction up Flipped off Frame [-40, -60; 40, 60] LabelPosition [0, 63] LabelAlign up TargetPortIndices "17" SampleTime "0" EnforceBaseTask "2" CodeFcnLang "2" CodeFcn "if (Target.Family ~= \"Imperix Controllers\") then\n" " return 'This block is not compatible with the selected target family (\"%s" "\")' % {Target.Family}\n" "end\n" "\n" "local OutputCode = StringList:new()\n" "local Require = ResourceList:new()\n" "\n" "--Get mask variables\n" "local pDeviceId = Block.Mask.pDeviceId\n" "local pActivateRT = Block.Mask.pActivateRT\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tlocal temp = 1\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "local out_conf = Block.Mask.pOutConf\n" "local temp = string.reverse(tostring(Block.Mask.pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "local strCells = string.reverse(temp1)\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Block.Mask.pModuleTopo\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Block.Mask.pGlobalActive\n" "local modulator\n" "\n" "local ss_mod_id = Target.Coder.RegisterNewSsModulator(Block.Name, pDeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Too many SS_PWM created.\"\n" "end\n" "\n" "for i = 1, nbr_cells, 1 do\n" "\tif out_conf == 1.0 then \n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\telseif out_conf == 2.0 then\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+1, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*4+3, pDeviceId))\n" "\t\tend\n" "\telse\n" "\t\tif topo == 1.0 then\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i], pDeviceId))\n" "\t\telse \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2, pDeviceId))\n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(outputs[i]*2+1, pDeviceId))\n" "\t\tend\n" "\t\tif i == nbr_cells-1 then \n" "\t\t\tRequire:add(Target.Coder.GetPwmResource(globalActive, pDeviceId))\n" "\t\tend\n" "\tend\n" "end\n" "\n" "--For activate, phase and duty, if the input is the block terminal. Reconfigu" "re them at each step\n" "if pActivateRT == 2.0 then\n" "\tOutputCode:append(\"if ((float)%s > 0) {\" % {Block.InputSignal[4][1]}) --c" "ast in float is added since this condition \"if ((float) true > 0)\" can be e" "ntered by the user\n" "\tOutputCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);}\" % {modulator," " pDeviceId})\n" "\tOutputCode:append(\"else {\")\n" "\tOutputCode:append(\"SsPwm_Deactivate((tSsModulator) %s, %s);}\" % {modulato" "r, pDeviceId})\n" "end\n" "\n" "OutputCode:append(\"SsPwm_SetModulationIndex((tSsModulator) %s, (float) %s, %" "s);\" % {modulator, Block.InputSignal[1][1], pDeviceId})\n" "\n" "\t\n" "-----------------------------------------------------------------------------" "-----\n" "\n" "return {\n" " OutputCode = OutputCode,\n" " Require = Require,\n" "}" NonDftCodeFcn "local InitCode = StringList:new()\n" "\n" "local DeviceId = Block.Mask.pDeviceId\n" "local pEnabledCellsBin =Block.Mask.pEnabledCellsBin\n" "\n" "local pSelCurrent = Block.Mask.pSelCurrent\n" "local pDeadtime = Block.Mask.pDeadtime\n" "local pGlobalActive = Block.Mask.pGlobalActive\n" "local pActivateRT = Block.Mask.pActivateRT\n" "local modulator\n" "\n" "local temp = string.reverse(tostring(pEnabledCellsBin)) \n" "local temp1 = string.gsub(tostring(temp), \"0.\", \"\",1)\n" "\n" "local pEnabledCellsDec = tonumber(string.reverse(temp1),2)\n" "local ss_mod_id = Target.Coder.GetRegisteredSsModulator(Block.Name, DeviceId)" "\n" "if ss_mod_id == 0 then\n" "\tmodulator = \"SS_MODULATOR_0\"\n" "elseif ss_mod_id == 1 then\n" "\tmodulator = \"SS_MODULATOR_1\"\n" "else\n" "\treturn \"Accessing unregistered SS_PWM block\"\n" "end\n" "\n" "\n" "--compute carrier type\n" "local carrier\n" "local stairMod = \"1\";\n" "if Block.Mask.pCarrier == 1.0 then\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "elseif Block.Mask.pCarrier == 2.0 then\n" "\tcarrier = \"INVTRIANGLE\"\t\n" "\tstairMod = \"1\"\n" "else\n" "\tcarrier = \"TRIANGLE\"\t\n" "\tstairMod = \"0\"\n" "end\n" "\n" "--compute output mode\n" "local outmode\n" "if Block.Mask.pOutConf == 2.0 then\n" "\toutmode = \"COMPLEMENTARY\"\t\n" "else\n" "\toutmode = \"INDEPENDENT\"\t\n" "end\n" "\n" "--compute update rate\n" "local update_rate\n" "if Block.Mask.pUpdateRate == 1.0 then\n" "\tupdate_rate = \"SINGLE_RATE\"\t--SINGLE_RATE = 0,\n" "else\n" "\tupdate_rate = \"DOUBLE_RATE\"\t--DOUBLE_RATE = 1\n" "end\n" "\n" "--compute module topology\n" "local topo\n" "if Block.Mask.pModuleTopo == 1.0 then\n" "\ttopo = \"HALF_BRIDGE\"\t\n" "else\n" "\ttopo = \"FULL_BRIDGE\"\t\n" "end\n" "\n" "--compute sorting logic\n" "local invPolarity\n" "if Block.Mask.pSortingLogic == 1.0 then\n" "\tinvPolarity = \"0\"\t\n" "else\n" "\tinvPolarity = \"1\"\t\n" "end\n" "\n" "\t\n" "InitCode:append(\"SsPwm_ConfigureCarrier((tSsModulator) %s, %s, %s, %s);\" % " "{modulator, carrier, stairMod, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureOutputMode((tSsModulator) %s, %s, %s);\" % {" "modulator, outmode, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureUpdateRate((tSsModulator) %s, %s, %s);\" % " "{modulator, update_rate, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodules((tSsModulator) %s, %s, %s);\" % {" "modulator, pEnabledCellsDec, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureCurrentInput((tSsModulator) %s, %s, %s);\" %" " {modulator, pSelCurrent, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureInvertedSorting((tSsModulator) %s, (bool) %s" ", %s);\" % {modulator, invPolarity, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureSubmodulesTopology((tSsModulator) %s, %s, %s" ");\" % {modulator, topo, DeviceId})\n" "InitCode:append(\"SsPwm_ConfigureClock((tSsModulator) %s, (tClock) %s, %s);\"" " % {modulator, Block.InputSignal[5][3], DeviceId})\n" "\n" "if Block.Mask.pOutConf == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureDeadTime((tSsModulator) %s, (float) %s, %s" ");\" % {modulator, pDeadtime, DeviceId})\n" "elseif Block.Mask.pOutConf == 3.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateOutput((tSsModulator) %s, (tPwmOut" "put) %s, %s);\" % {modulator, pGlobalActive, DeviceId})\n" "end\n" "if pActivateRT == 2.0 then\n" "\tInitCode:append(\"SsPwm_ConfigureActivateAsRealTime((tSsModulator) %s, %s);" "\" % {modulator, DeviceId})\n" "else\n" "\tInitCode:append(\"SsPwm_Activate((tSsModulator) %s, %s);\" % {modulator, De" "viceId})\n" "end\n" "\n" "\n" "-----------------------------------------------------------------------------" "------\n" "return {\n" " InitCode = InitCode,\n" "}" MaskType "SS-PWM - Sort and Select PWM" MaskDescription "Generates PWM signals for MMC, using a Sort & Selec" "t algorithm for the balancing of N submodules.

\n" "- The 'm' input is the modulation index. In half-bridge mode, m ranges from 0" " to N. In full-bridge mode m ranges from -N to N.
\n" "- The 'sim V' input is a vector containing the submodules voltages (used only" " in simulation).
\n" "- The 'sim I' input is the arm current (used only in simulation).
\n" "- The '>' input is the clock input.
\n" "- The 'A' input allows the activation (1) or deactivation (0) of the PWM outp" "ut(s)." MaskHelp "https://imperix.ch/help/plecs/pwm/ss" MaskDisplay "local font_size = 9\n" "local function getColor(color)\n" "\tif color == \"red\" then\n" "\t\treturn 255, 26, 0\n" "\telseif color == \"white\" then\n" "\t\treturn 255, 255, 255\n" "\telse --black\n" "\t\treturn 0, 0, 0\n" "\tend\n" "end\n" "local function drawClk(x,y, color)\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x+0.5, x+5.5}, {y-3.5, y})\n" "\tIcon:line({x+0.5, x+5.5}, {y+3.5, y})\n" "end\n" "local function drawRectangle(x,y,w,h, color) --w=width, h=height\n" "\tlocal col = color\n" "\tIcon:color(getColor(col))\n" "\tIcon:line({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function drawRectangleFull(x,y,w,h,color)--w=width, h=height\n" "\tIcon:color(getColor(color))\n" "\tIcon:patch({x,x+w,x+w,x,x},{y,y,y+h,y+h,y})\n" "end\n" "local function getOffsetX_R(a_string)\n" "\tlocal size = #a_string \n" "\tsize = size + (size*0.9) \n" "\tsize = size + 4\n" "\treturn size\n" "end\n" "local function trimeVector(a_s_vector)\n" "\tlocal s = a_s_vector\n" "\tif #a_s_vector > 9 then\n" "\t\ts = \"[...]\"\n" "\tend\n" "\treturn s\n" "end\n" "\n" "local function bitget(s)\n" "\tlocal num = 0\n" "\tfor i = 1, #s, 1\n" "\tdo\n" " \tif s:sub(i, i) == '1' then\n" " \t num = num+1\n" " \tend\n" "\tend\n" "\treturn num\n" "end\n" "\n" "local function find(str_x, num)\n" "\tlocal a = {}\n" "\tfor i=0,num-1 ,1 do\n" "\t\ta[i] = 0\n" "\tend \n" "\tlocal temp = 0\n" "\tfor i = 0, #str_x-1, 1 do\n" "\t\tif str_x:sub(#str_x-i, #str_x-i) == '1' then\n" "\t\t\ta[temp] = i\n" "\t\t\ttemp = temp+1\n" "\t\tend\n" "\tend\n" "\treturn a\n" "end\n" "\n" "drawRectangle(-40,-60, 80, 120)\n" "drawRectangleFull(-39, 40, 78, 19, \"red\")\n" "\n" "local bb_id = 'BB' .. tostring(Dialog:get('pDeviceId'))\n" "Icon:text(0,-52, bb_id, 'FontSize',font_size)\n" "\n" "Icon:text(0,50,'SS PWM', 'FontSize',font_size, 'Color', {getColor(\"white\")}" ")\n" "\n" "drawClk(-40,50, \"black\")\n" "\n" "local out_conf = Dialog:get('pOutConf')\n" "local strCells = Dialog:get('pEnabledCellsBin')\n" "local cellsDec = tonumber(strCells)\n" "local nbr_cells = bitget(strCells)\n" "local topo = Dialog:get('pModuleTopo')\n" "local outputs = find(strCells, nbr_cells)\n" "local globalActive = Dialog:get('pGlobalActive')\n" "local temp = 0\n" "local offset_x \n" "\n" "local mid = (8-nbr_cells)/2\n" "local midH = (8-nbr_cells*2)/2\n" "\n" "for i = 0, nbr_cells-1, 1 do\n" "\tif out_conf == \"1\" then \n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(30,-52 + 12*i+12*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\telse \n" "\t\t\tIcon:text(30,-52 + 12*temp+12*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(30,-52 + 12*(temp+1)+12*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telseif out_conf == \"2\" then\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 12*i+12*mid, outputs[i] .. \"H/L\", 'FontSize',font_" "size)\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 12*temp+12*midH, 2*outputs[i] .. \"H/L\", 'FontSize'" ",font_size)\n" "\t\t\tIcon:text(28,-52 + 12*(temp+1)+12*midH, 2*outputs[i]+1 .. \"H/L\", 'Fon" "tSize',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\tend\n" "\telse\n" "\t\tif topo == \"1\" then\n" "\t\t\tIcon:text(28,-52 + 11*i+11*mid, \"LN\" .. outputs[i], 'FontSize',font_s" "ize)\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(i+1)+11*mid, \"(A)LN\" .. globalActive, 'Fon" "tSize',font_size)\n" "\t\t\tend\n" "\t\telse \n" "\t\t\tIcon:text(28,-52 + 11*temp+11*midH, \"LN\" .. outputs[i]*2, 'FontSize'," "font_size)\n" "\t\t\tIcon:text(28,-52 + 11*(temp+1)+11*midH, \"LN\" .. outputs[i]*2+1, 'Font" "Size',font_size)\n" "\t\t\ttemp = temp+2\n" "\t\t\tif i == nbr_cells-1 then \n" "\t\t\t\tIcon:text(21.5,-52 + 11*(temp+2)+11*midH, \"(A)LN\" .. globalActive, " "'FontSize',font_size)\n" "\t\t\tend\n" "\t\tend\n" "\tend\n" "end\n" MaskDisplayLang "2" MaskIconFrame off MaskIconOpaque off MaskIconRotates on MaskInit "if ~isreal(pDeviceId) || numel(pDeviceId) ~= 1 || any" "(pDeviceId < 0)\n" "\terror('\"Device number\" must be a positive scalar.')\n" "end\n" "\n" "if ~isreal(pDeadtime) || numel(pDeadtime) ~= 1\n" "\t\terror('\"Dead-time duration\" must be a scalar.')\n" "end\n" "\n" "cells = bin2dec(num2str(pEnabledCellsBin));\n" "pNbrCellsEnabled = sum(bitget(cells, 1:8));\n" "pNotEnabledCells = 8-pNbrCellsEnabled;\n" "\n" "if pOutConf == 1 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo;\n" "elseif pOutConf == 2 % Dual output\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = 2*nbr_modulators*pModuleTopo;\n" "else\n" "\tnbr_modulators = pNbrCellsEnabled;\n" "\tnbr_outputs = nbr_modulators*pModuleTopo + 1;\n" "end\n" "\n" "\n" "if pCarrier == 1 || pCarrier == 2 % triangular carrier\n" "\trate_private = pUpdateRate;\n" "\tpRoundModulation = 0;\n" "else\n" "\trate_private = 1;\n" "\tpRoundModulation = 1;\n" "end\n" "\n" "if pModuleTopo == 1\n" "\tpFullBridge = 0;\n" "else\n" "\tpFullBridge = 1;\n" "end\n" "\n" "dead_time_private = 0; % avoids NaN if out_conf is not PWM H+L\n" "out_conf_private = pOutConf;\n" "phase_compensation = 1;\n" "if pOutConf == 2 && pSimDeadtime == 2 % PWM H+L and simulate dead-time\n" "\tdead_time_private = pDeadtime;\n" "\tout_conf_private = 4;\n" "\tphase_compensation = 2; % compensate dead-time\n" "end" MaskDialogCallback "if Dialog:get(\"pActivateRT\") == \"1\" then\n" "\tBlock:showTerminal(\"A\", false)\n" "else\n" "\tBlock:showTerminal(\"A\", true)\n" "\tBlock:moveTerminal(\"A\", -40,25)\n" "end\n" "\n" "\n" "local Outmode = Dialog:get(\"pOutConf\")\n" "if Outmode == \"1\" then --single\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "elseif Outmode == \"2\" then -- dual(H and L)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", false)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", true)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", true)\n" "else -- dual (H and A)\n" "\tDialog:set(\"pGlobalActive\", \"Visible\", true)\n" "\tDialog:set(\"pDeadtime\", \"Visible\", false)\n" "\tDialog:set(\"pSimDeadtime\", \"Visible\", false)\n" "end\n" Parameter { Variable "pDeviceId" Prompt "Device ID [default=0]" Type FreeText Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pOutConf" Prompt "Output mode" Type FixedText PossibleValues {"Single", "Dual (PWM_H + PWM_L)", "Single (PWM + A" "CTIVE)"} Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pGlobalActive" Prompt "Global ACTIVE on PWM lane " Type FreeText Value "4" Show off Tunable off TabName "Addressing" } Parameter { Variable "pEnabledCellsBin" Prompt "Submodules analog input channel mask" Type FreeText Value "11110000" Show off Tunable off TabName "Addressing" } Parameter { Variable "pModuleTopo" Prompt "Submodules topology" Type FixedText PossibleValues {"Half-bridge", "Full-bridge"} Value "1" Show off Tunable off TabName "Addressing" } Parameter { Variable "pSelCurrent" Prompt "Current input channel (8 to 15)" Type FreeText Value "13" Show on Tunable off TabName "Addressing" } Parameter { Variable "pSortingLogic" Prompt "Invert sorting logic" Type Bool Value "2" Show off Tunable off TabName "Addressing" } Parameter { Variable "pCarrier" Prompt "Carrier type" Type FixedText PossibleValues {"Triangle", "Inverted triangle", "No Carrier (Stai" "rcase modulation)"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pActivateRT" Prompt "PWM activation" Type FixedText PossibleValues {"Always activated", "Use block input"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pUpdateRate" Prompt "PWM parameters update rate" Type FixedText PossibleValues {"Once per PWM period", "Twice per PWM period"} Value "1" Show off Tunable off TabName "Modulation parameters" } Parameter { Variable "pDeadtime" Prompt "Dead-time duration [in seconds]" Type FreeText Value "DT" Show off Tunable off TabName "Complementary signal parameters" } Parameter { Variable "pSimDeadtime" Prompt "Dead-time simulation" Type FixedText PossibleValues {"Ignore dead-time during simulation", "Simulate de" "ad-time"} Value "2" Show off Tunable off TabName "Complementary signal parameters" } Terminal { Type Input Position [-40, -50] Direction left } Terminal { Type Input Position [-40, 0] Direction left } Terminal { Type Input Position [-40, -25] Direction left } Terminal { Type Input Position [-40, 25] Direction left } Terminal { Type EventInput Position [-40, 50] Direction left } Schematic { Location [0, 27; 2560, 1334] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Rounding Name "Rounding" Show off Position [175, 370] Direction right Flipped off Parameter { Variable "Operation" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Rounding Name "Rounding1" Show off Position [175, 320] Direction right Flipped off Parameter { Variable "Operation" Value "3" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [255, 350] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "+-" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [425, 470] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 446, 235] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [9, 37; 293, 204] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [415, 55; 699, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type Sum Name "Sum2" Show off Position [520, 355] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch" Show on Position [615, 350] Direction right Flipped off Parameter { Variable "Criteria" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Constant Name "Constant" Show off Position [495, 295] Direction right Flipped off Frame [-55, -10; 55, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pRoundModulation" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "m" Show on Position [80, 345] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim I" Show on Position [75, 235] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "sim V" Show on Position [75, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "pNbrCellsEnabled" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [145, 235] Direction right Flipped off Frame [-20, -10; 20, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Input Name "A" Show on Position [75, 55] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "HasDirectFeedthrough" Value "2" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant1" Show off Position [240, 210] Direction right Flipped off Frame [-30, -10; 30, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pFullBridge" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant2" Show off Position [255, 180] Direction right Flipped off Frame [-45, -10; 45, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "pNbrCellsEnabled" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type EventInput Name "clk" Show off Position [80, 420] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } } Component { Type CScript Name "sorter" Show on Position [390, 115] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1225 349 1195 633]" Show off } Parameter { Variable "NumInputs" Value "[8, 1]" Show off } Parameter { Variable "NumOutputs" Value "8" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "int n;\n" "float work_array[8], even[8];\n" "int indexes_even[8];\n" "bool sorting_completed;" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --" "- EDIT HERE TO _END */\n" "\n" "\n" "\n" "\n" "work_array[0] = InputSignal(0,0);\n" "work_array[1] = InputSignal(0,1);\n" "work_array[2] = InputSignal(0,2);\n" "work_array[3] = InputSignal(0,3);\n" "work_array[4] = InputSignal(0,4);\n" "work_array[5] = InputSignal(0,5);\n" "work_array[6] = InputSignal(0,6);\n" "work_array[7] = InputSignal(0,7);\n" "\n" "n = InputSignal(1,0);\n" "if(n > 8) n = 8;\n" "\n" "OutputSignal(0,0) = 0;\n" "OutputSignal(0,1) = 1;\n" "OutputSignal(0,2) = 2;\n" "OutputSignal(0,3) = 3;\n" "OutputSignal(0,4) = 4;\n" "OutputSignal(0,5) = 5;\n" "OutputSignal(0,6) = 6;\n" "OutputSignal(0,7) = 7;\n" "\n" "sorting_completed = false;\n" "while (!sorting_completed)\n" "{\n" "\tsorting_completed = true;\n" "\n" "\tfor (unsigned j = 0; j < (n / 2); j++)\n" "\t{\n" "\t\tif (work_array[2 * j] > work_array[2 * j + 1])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\teven[2 * j] = work_array[2 * j + 1];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j + 1);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j);\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\teven[2 * j] = work_array[2 * j];\n" "\t\t\teven[2 * j + 1] = work_array[2 * j + 1];\n" "\t\t\tindexes_even[2 * j] = OutputSignal(0,2 * j);\n" "\t\t\tindexes_even[2 * j + 1] = OutputSignal(0,2 * j + 1);\n" "\t\t}\n" "\t}\n" "\n" "\tfor (unsigned j = 0; j < (n / 2 - 1); j++)\n" "\t{\n" "\t\tif (even[2 * j + 1] > even[2 * j + 2])\n" "\t\t{\n" "\t\t\tsorting_completed = false;\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 2];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 1];\n" "\n" "\t\t}\n" "\t\telse\n" "\t\t{\n" "\t\t\twork_array[2 * j + 1] = even[2 * j + 1];\n" "\t\t\twork_array[2 * j + 2] = even[2 * j + 2];\n" "\t\t\tOutputSignal(0,2 * j + 1) = indexes_even[2 * j + 1];\n" "\t\t\tOutputSignal(0,2 * j + 2) = indexes_even[2 * j + 2];\n" "\t\t}\n" "\t}\n" "\twork_array[0] = even[0];\n" "\twork_array[n-1] = even[n-1];\n" "\n" "\tOutputSignal(0,0) = indexes_even[0];\n" "\tOutputSignal(0,n-1) = indexes_even[n-1];\n" "}\t\t" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Component { Type Constant Name "Constant4" Show off Position [170, 135] Direction right Flipped off Frame [-80, -10; 80, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "zeros(1, 8-pNbrCellsEnabled)" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [290, 110] Direction right Flipped off Parameter { Variable "Width" Value "[pNbrCellsEnabled pNotEnabledCells]" Show off } } Component { Type TargetOutput Name "s" Show on Position [990, 175] Direction right Flipped off Parameter { Variable "Width" Value "nbr_outputs" Show off } } Component { Type ConfigurableSubsystem Name "Activate\nsource" Show on Position [790, 55] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [-25, 0] Direction left } TerminalNames { "out", "A" } Location [0, 36; 441, 234] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Internal" Schematic { Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [240, 80] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "External" Schematic { Component { Type Output Name "out" Show on Position [260, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [145, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pActivateRT" Show off } } Component { Type LogicalOperator Name "Logical\nOperator2" Show off Position [915, 175] Direction up Flipped off Parameter { Variable "Operator" Value "1" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type ConfigurableSubsystem Name "Outmode" Show on Position [840, 180] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "A" } Location [6, 40; 395, 226] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single" Schematic { Component { Type Input Name "in" Show on Position [115, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [275, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [115, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "out" DstTerminal 1 } } Name "Dual H+L" Schematic { Component { Type Input Name "in" Show on Position [110, 75] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [180, 105] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Input Name "A" Show on Position [110, 110] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 80] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 1362, 300] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[906 498 1324 444]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [205, 105; 205, 85] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [145, 75] Branch { Points [145, 105] DstComponent "Logical\nOperator" DstTerminal 2 } Branch { DstComponent "Mux and reorder" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+A" Schematic { Component { Type Input Name "in" Show on Position [110, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [270, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [110, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [230, 85] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [1151, 369; 1434, 537] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1183 329 792 314]" Show off } Parameter { Variable "NumInputs" Value "[pNbrCellsEnabled*pModuleTopo 1]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < WIDTH; i++)\n" "{\n" "\tOutputSignal(0, i) = InputSignal(0, i);\n" "}\n" "\tOutputSignal(0, WIDTH) = InputSignal(1, 0);" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Mux and reorder" DstTerminal 1 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 Points [175, 115; 175, 90] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Dual H+L w/ dead-time" Schematic { Component { Type Input Name "in" Show on Position [65, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [305, 75] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "A" Show on Position [65, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Reference SrcComponent "Components/Control/Delays/Turn-on Delay" Name "Dead-time\ngenerator" Show on Position [235, 75] Direction up Flipped off Frame [-15, -15; 15, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "DeadTimeSource" Value "1" Show off } Parameter { Variable "T_d" Value "dead_time_private" Show off } Parameter { Variable "Rounding" Value "1" Show off } Terminal { Type Input Position [-15, 0] Direction left } Terminal { Type Output Position [19, 0] Direction right } Terminal { Type Input Position [-15, 5] Direction left } } Component { Type LogicalOperator Name "Logical\nOperator" Show off Position [135, 100] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Subsystem Name "Mux and reorder" Show on Position [185, 75] Direction up Flipped off Frame [-5, -20; 5, 20] LabelPosition [0, -23] LabelAlign down SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-5, -5] Direction left } Terminal { Type Output Position [9, 0] Direction right } Terminal { Type Input Position [-5, 5] Direction left } Schematic { Location [415, 55; 698, 223] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 85] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "In2" Show on Position [60, 120] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type CScript Name "C-Script" Show on Position [140, 85] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1352 253 1105 683]" Show off } Parameter { Variable "NumInputs" Value "[pModuleTopo*pNbrCellsEnabled pModule" "Topo*pNbrCellsEnabled]" Show off } Parameter { Variable "NumOutputs" Value "nbr_outputs" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "0" Show off } Parameter { Variable "Parameters" Value "pModuleTopo*pNbrCellsEnabled" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#define WIDTH\t\tParamRealData(0, 0)" Show off } Parameter { Variable "StartFcn" Value "" Show off } Parameter { Variable "OutputFcn" Value "for (int i = 0; i < 2; i++)\n" "{\n" "\tfor (int j = 0; j < WIDTH; j++)\n" "\t\tOutputSignal(0, 2*j+i) = InputSignal(i, j);\n" "}" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "In2" SrcTerminal 1 Points [90, 120; 90, 90] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Mux and reorder" SrcTerminal 2 DstComponent "Dead-time\ngenerator" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ngenerator" SrcTerminal 2 DstComponent "out" DstTerminal 1 } Connection { Type Signal SrcComponent "Logical\nOperator" SrcTerminal 1 Points [160, 100; 160, 80] DstComponent "Mux and reorder" DstTerminal 3 } Connection { Type Signal SrcComponent "in" SrcTerminal 1 Points [100, 70] Branch { DstComponent "Mux and reorder" DstTerminal 1 } Branch { Points [100, 100] DstComponent "Logical\nOperator" DstTerminal 2 } } } } Parameter { Variable "Configuration" Value "out_conf_private" Show off } } Component { Type Subsystem Name "CB_PWM" Show on Position [355, 385] Direction up Flipped off Frame [-35, -45; 35, 45] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -35] Direction left } Terminal { Type Input Position [-35, 35] Direction left } Terminal { Type Output Position [39, -35] Direction right } Terminal { Type Output Position [39, 35] Direction right } Schematic { Location [5, 38; 735, 345] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Integrator Name "Integrator" Show off Position [385, 95] Direction right Flipped off Parameter { Variable "ExternalReset" Value "2" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0" Show off } Parameter { Variable "ShowStatePort" Value "1" Show off } Parameter { Variable "EnableWrapping" Value "1" Show off } Parameter { Variable "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [275, 70] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type RelationalOperator Name "Relational\nOperator" Show off Position [330, 100] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type ConstantRelationalOperator Name "Compare to\nConstant" Show off Position [370, 150] Direction right Flipped on Frame [-25, -10; 25, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Operator" Value "3" Show off } Parameter { Variable "Threshold" Value "0.5" Show off } } Component { Type ConfigurableSubsystem Name "Configurable\nSubsystem1" Show off Position [335, 205] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } TerminalNames { "in", "out", "trig" } Location [5, 37; 751, 346] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Single-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [369, 400; 653, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [135, 35] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "1" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } Name "Double-rate" Schematic { Component { Type Input Name "in" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "out" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "trig" Show on Position [180, 25] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Triggered\nSubsystem" Show off Position [220, 80] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left Index "1" } Terminal { Type Output Position [29, 0] Direction right Index "1" } Terminal { Type Input Position [0, -15] Direction up Index "2" } Schematic { Location [1110, 345; 1394, 512] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "In1" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [220, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "InitialOutput" Value "0" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Trigger Name "Trigger" Show on Position [140, 40] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } Parameter { Variable "TriggerType" Value "3" Show off } Parameter { Variable "ShowOutput" Value "1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Connection { Type Signal SrcComponent "in" SrcTerminal 1 DstComponent "Triggered\nSubsystem" DstTerminal 1 } Connection { Type Signal SrcComponent "trig" SrcTerminal 1 Points [220, 25] DstComponent "Triggered\nSubsystem" DstTerminal 3 } Connection { Type Signal SrcComponent "Triggered\nSubsystem" SrcTerminal 2 DstComponent "out" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "rate_private" Show off } } Component { Type ConfigurableSubsystem Name "Carrier" Show on Position [450, 95] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } TerminalNames { "In1", "Out1" } Location [5, 35; 446, 233] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[0 1 0]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "Inv. triangle" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Lookup1D Name "1D-Table" Show off Position [220, 80] Direction right Flipped off Parameter { Variable "x" Value "[0 0.5 1]" Show off } Parameter { Variable "f(x)" Value "[1 0 1]" Show off } Parameter { Variable "ZeroCrossingSignals" Value "2" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "1D-Table" DstTerminal 1 } Connection { Type Signal SrcComponent "1D-Table" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } Name "No carrier" Schematic { Component { Type Input Name "In1" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [300, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Out1" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "pCarrier" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [160, 70] Direction right Flipped off Parameter { Variable "InputWidth" Value "3" Show off } Parameter { Variable "OutputIndices" Value "[1 2]" Show off } } Component { Type Subsystem Name "Phase" Show on Position [235, 115] Direction up Flipped off Frame [-25, -15; 25, 15] LabelPosition [0, 18] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Terminal { Type Input Position [0, -15] Direction up } Schematic { Location [5, 36; 461, 222] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "P" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "P'" Show on Position [390, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type ConfigurableSubsystem Name "Dead-time\ncompensation" Show on Position [205, 90] Direction up Flipped off Frame [-35, -20; 35, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-35, -10] Direction left } Terminal { Type Output Position [39, 0] Direction right } Terminal { Type Input Position [-35, 10] Direction left } TerminalNames { "phase", "phase'", "freq" } Location [5, 39; 581, 225] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Ignore dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } } Name "Simulate dead-time" Schematic { Component { Type Input Name "phase" Show on Position [140, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "phase'" Show on Position [440, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 160] Direction right Flipped off Frame [-65, -10; 65, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "dead_time_private/2" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "freq" Show on Position [140, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Product Name "Product" Show off Position [260, 120] Direction up Flipped off Parameter { Variable "Inputs" Value "2" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } Parameter { Variable "DataType" Value "11" Show off } } Component { Type Saturation Name "Saturation" Show off Position [325, 120] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.25" Show off } Parameter { Variable "LowerLimit" Value "0" Show off } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [225, 160; 225, 125] DstComponent "Product" DstTerminal 3 } Connection { Type Signal SrcComponent "freq" SrcTerminal 1 DstComponent "Product" DstTerminal 2 } Connection { Type Signal SrcComponent "phase" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "phase'" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 Points [365, 120] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Product" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "phase_compensation" Show off } } Component { Type Input Name "clk" Show on Position [60, 115] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Math Name "Math" Show off Position [320, 95] Direction up Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type Constant Name "Constant" Show off Position [265, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSelector Name "Cont\nSelector" Show off Position [120, 115] Direction right Flipped off Parameter { Variable "InputWidth" Value "2" Show off } Parameter { Variable "OutputIndices" Value "[1]" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "Dead-time\ncompensation" DstTerminal 1 } Connection { Type Signal SrcComponent "Dead-time\ncompensation" SrcTerminal 2 DstComponent "Math" DstTerminal 2 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [285, 110; 285, 100] DstComponent "Math" DstTerminal 3 } Connection { Type Signal SrcComponent "Math" SrcTerminal 1 DstComponent "P'" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [155, 115] DstComponent "Dead-time\ncompensation" DstTerminal 3 } } } Component { Type Subsystem Name "Compare" Show on Position [560, 155] Direction up Flipped off Frame [-30, -20; 30, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-30, -5] Direction left } Terminal { Type Output Position [34, 0] Direction right } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [2, 34; 496, 277] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "carrier" Show on Position [100, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [430, 95] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "duty" Show on Position [100, 105] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type RelationalOperator Name "Relational\nOperator1" Show off Position [185, 85] Direction right Flipped off Parameter { Variable "Operator" Value "3" Show off } } Component { Type SignalSwitch Name "Switch" Show off Position [275, 90] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "1" Show off } } Component { Type Constant Name "Constant" Show off Position [215, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Constant Name "Constant1" Show off Position [325, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalSwitch Name "Switch1" Show off Position [375, 95] Direction left Flipped on Parameter { Variable "Criteria" Value "1" Show off } Parameter { Variable "Threshold" Value "0" Show off } } Component { Type Gain Name "Gain" Show off Position [320, 150] Direction right Flipped off Parameter { Variable "K" Value "-1" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "11" Show off } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [140, 65; 140, 80] DstComponent "Relational\nOperator1" DstTerminal 1 } Connection { Type Signal SrcComponent "duty" SrcTerminal 1 Points [140, 105] Branch { Points [140, 90] DstComponent "Relational\nOperator1" DstTerminal 2 } Branch { Points [140, 150; 275, 150] Branch { DstComponent "Switch" DstTerminal 4 } Branch { DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [245, 110] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator1" SrcTerminal 3 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 DstComponent "Switch1" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [345, 115] DstComponent "Switch1" DstTerminal 2 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 Points [375, 150] DstComponent "Switch1" DstTerminal 4 } Connection { Type Signal SrcComponent "Switch1" SrcTerminal 1 DstComponent "PWM" DstTerminal 1 } } } Component { Type Constant Name "Constant" Show on Position [95, 115] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "D" Show on Position [45, 205] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name ">" Show on Position [60, 70] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "PWM" Show on Position [650, 155] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Trig" Show on Position [650, 215] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [355, 65] DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [410, 95] Branch { DstComponent "Compare to\nConstant" DstTerminal 1 } Branch { DstComponent "Carrier" DstTerminal 1 } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "Integrator" DstTerminal 3 } Connection { Type Signal SrcComponent "Phase" SrcTerminal 2 Points [285, 115; 285, 105] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent ">" SrcTerminal 1 DstComponent "Cont\nSelector" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 Points [235, 70] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Phase" DstTerminal 3 } } Connection { Type Signal SrcComponent "Compare" SrcTerminal 2 DstComponent "PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "Phase" DstTerminal 1 } Connection { Type Signal SrcComponent "D" SrcTerminal 1 DstComponent "Configurable\nSubsystem1" DstTerminal 1 } Connection { Type Signal SrcComponent "Carrier" SrcTerminal 2 Points [500, 95; 500, 150] DstComponent "Compare" DstTerminal 1 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [335, 150; 335, 175] Branch { DstComponent "Configurable\nSubsystem1" DstTerminal 3 } Branch { Points [460, 175; 460, 215] DstComponent "Trig" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [285, 75; 285, 95] DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [500, 205; 500, 160] DstComponent "Compare" DstTerminal 3 } } } Component { Type CScript Name "balancer" Show on Position [735, 180] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[1069 546 422 314]" Show off } Parameter { Variable "NumInputs" Value "[8 1 1 1 1]" Show off } Parameter { Variable "NumOutputs" Value "pNbrCellsEnabled*pModuleTopo" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "0" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "-1" Show off } Parameter { Variable "Parameters" Value "" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "GnuExtensions" Value "1" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "\n" "#define NH 0\n" "#define NL 1\n" "#define PL 2\n" "#define PH 3\n" "\n" "unsigned int next_switch_A[8], cell_state[8];" Show off } Parameter { Variable "StartFcn" Value "for(unsigned int i = 0; i < 8; i++){\n" "\tcell_state[i] = PL;\n" "\tnext_switch_A[i] = 0;\n" "}" Show off } Parameter { Variable "OutputFcn" Value "signed int ReqLevel = InputSignal(1,0);\n" "unsigned int Ncells = InputSignal(2,0);\n" "bool full_bridge = InputSignal(3,0);\n" "bool I_negative\t\t\t = InputSignal(4,0);\n" "\n" "if (Ncells > 8) Ncells = 8;\n" "\n" "for (unsigned int k = 0; k < Ncells; k++) {\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // compute actual level\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " signed int ActualLevel = 0;\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" "\t\tif (cell_state[i] == PH) ActualLevel++;\n" " else if (cell_state[i] == NH) ActualLevel--;\n" "\t}\n" "\n" " if(ActualLevel == ReqLevel) break;\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " bool can_rise[8];\n" " bool can_fall[8];\n" "\n" " for (unsigned int i = 0; i < Ncells; i++) {\n" " if(cell_state[i] == PH) can_rise[i] = false;\n" " else can_rise[i] = true;\n" "\n" " if(full_bridge) {\n" "\t\t\t\tif(cell_state[i] == NH) can_fall[i] = false;\n" " else can_fall[i] = true;\n" " } else {\n" " if(cell_state[i] == PH) can_fall[i] = true;\n" " else can_fall[i] = false;\n" " }\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // largest/smallest can rise/fall\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " int largest_can_rise;\n" " int largest_can_fall;\n" " int smallest_can_rise;\n" " int smallest_can_fall;\n" "\n" " for (unsigned int n = 0; n < Ncells; n++) {\n" " // 0 to N-1 -> smallest to largest\n" " unsigned int i = InputSignal(0,n);\n" "\n" " if(can_rise[i]) {\n" " largest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " largest_can_fall = i;\n" " }\n" "\n" " // N-1 to 0 -> smallest to largest\n" " i = InputSignal(0,Ncells-n-1);\n" "\n" " if(can_rise[i]) {\n" " smallest_can_rise = i;\n" " }\n" " if(can_fall[i]) {\n" " smallest_can_fall = i;\n" " }\n" " }\n" "\n" " int cell_rise;\n" " int cell_fall;\n" "\n" " if(I_negative) {\n" " cell_rise = largest_can_rise;\n" " cell_fall = smallest_can_fall;\n" " } else {\n" " cell_rise = smallest_can_rise;\n" " cell_fall = largest_can_fall;\n" " }\n" "\n" " // ----------------------------------------------------------------------" "--------------\n" " // transition\n" " // ----------------------------------------------------------------------" "--------------\n" "\n" " // FALL --------------------\n" "\n" " if(ReqLevel < ActualLevel) {\n" " if(cell_state[cell_fall] == PH) { // PH\n" " if(full_bridge && next_switch_A[cell_fall]) {\n" " cell_state[cell_fall] = NL; // NL\n" " } else {\n" " cell_state[cell_fall] = PL; // PL\n" " }\n" " } else {\n" " if(full_bridge) {\n" " cell_state[cell_fall] = NH; // NH\n" " }\n" " if(cell_state[cell_fall] == NL) { // NL\n" " next_switch_A[cell_fall] = true;\n" " } else {\n" " next_switch_A[cell_fall] = false;\n" " }\n" " }\n" " }\n" "\n" " // RISE --------------------\n" "\n" " if(ReqLevel > ActualLevel) {\n" " if(cell_state[cell_rise] == NH) { // NH\n" " if(full_bridge && !next_switch_A[cell_rise]) {\n" " cell_state[cell_rise] = NL; // NL\n" " } else {\n" " cell_state[cell_rise] = PL; // PL\n" " }\n" " } else {\n" " if(cell_state[cell_rise] == PL) { // PL\n" " next_switch_A[cell_rise] = true;\n" " } else {\n" " next_switch_A[cell_rise] = false;\n" " }\n" " cell_state[cell_rise] = PH; // PH\n" " }\n" " }\n" "}\n" "\n" "for (unsigned int i = 0; i < Ncells; i++)\n" "{\n" "\tif(full_bridge) {\n" "\t\tif((cell_state[i] == PH) || (cell_state[i] == PL)) {\n" "\t\t\tOutputSignal(0,i*2) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2) = 0;\n" "\t\t}\n" "\t\tif((cell_state[i] == PL) || (cell_state[i] == NH)) {\n" "\t\t\tOutputSignal(0,i*2+1) = 1;\n" "\t\t} else {\n" "\t\t\tOutputSignal(0,i*2+1) = 0;\n" "\t\t}\n" " } else {\n" " if(cell_state[i] == PH) {\n" " \tOutputSignal(0,i) = 1;\n" " } else {\n" " \tOutputSignal(0,i) = 0;\n" " }\n" " }\n" "}\n" Show off } Parameter { Variable "UpdateFcn" Value "" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } Parameter { Variable "StoreCustomStateFcn" Value "" Show off } Parameter { Variable "RestoreCustomStateFcn" Value "" Show off } } Connection { Type Signal SrcComponent "Rounding" SrcTerminal 2 Points [215, 370] Branch { Points [215, 355] DstComponent "Sum1" DstTerminal 3 } Branch { Points [215, 470] DstComponent "Configurable\nSubsystem1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Rounding1" SrcTerminal 2 Points [555, 320; 555, 345] DstComponent "Switch" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 1 } Connection { Type Signal SrcComponent "clk" SrcTerminal 1 DstComponent "CB_PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Configurable\nSubsystem1" SrcTerminal 2 Points [475, 470; 475, 360] DstComponent "Sum2" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Switch" DstTerminal 3 } Connection { Type Signal SrcComponent "sim I" SrcTerminal 1 DstComponent "Compare to\nConstant" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [265, 135; 265, 115] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [615, 295] DstComponent "Switch" DstTerminal 4 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [310, 180] Branch { Points [310, 120] DstComponent "sorter" DstTerminal 2 } Branch { DstComponent "balancer" DstTerminal 3 } } Connection { Type Signal SrcComponent "Constant1" SrcTerminal 1 Points [680, 210; 680, 190] DstComponent "balancer" DstTerminal 4 } Connection { Type Signal SrcComponent "A" SrcTerminal 1 DstComponent "Activate\nsource" DstTerminal 2 } Connection { Type Signal SrcComponent "Activate\nsource" SrcTerminal 1 Points [840, 55; 840, 140] Branch { DstComponent "Outmode" DstTerminal 3 } Branch { Points [880, 140; 880, 170] DstComponent "Logical\nOperator2" DstTerminal 2 } } Connection { Type Signal SrcComponent "m" SrcTerminal 1 Points [125, 345] Branch { Points [125, 320] DstComponent "Rounding1" DstTerminal 1 } Branch { DstComponent "Sum1" DstTerminal 2 } Branch { Points [125, 370] DstComponent "Rounding" DstTerminal 1 } } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 3 DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "Outmode" SrcTerminal 2 DstComponent "Logical\nOperator2" DstTerminal 3 } Connection { Type Signal SrcComponent "sim V" SrcTerminal 1 DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Compare to\nConstant" SrcTerminal 2 Points [690, 235] DstComponent "balancer" DstTerminal 5 } Connection { Type Signal SrcComponent "Logical\nOperator2" SrcTerminal 1 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "sorter" SrcTerminal 3 Points [665, 115; 665, 160] DstComponent "balancer" DstTerminal 1 } Connection { Type Signal SrcComponent "Switch" SrcTerminal 1 Points [665, 350; 665, 170] DstComponent "balancer" DstTerminal 2 } Connection { Type Signal SrcComponent "balancer" SrcTerminal 6 DstComponent "Outmode" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "sorter" DstTerminal 1 } Connection { Type Signal SrcComponent "CB_PWM" SrcTerminal 4 Points [425, 420] DstComponent "Configurable\nSubsystem1" DstTerminal 3 } } } Component { Type SignalMux Name "Mux" Show off Position [690, 980] Direction right Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type Subsystem Name "Modulation_B" Show on Position [855, 450] Direction up Flipped off Frame [-25, -20; 25, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, -5] Direction left } Terminal { Type Output Position [29, -5] Direction right } Terminal { Type Input Position [-25, 10] Direction left } Schematic { Location [191, 258; 677, 488] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "Emf" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "m" Show on Position [445, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Vdc" Show on Position [60, 170] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Gain Name "Gain1" Show off Position [145, 135] Direction right Flipped off Parameter { Variable "K" Value "0.5" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum" Show off Position [170, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Product Name "Divide" Show off Position [295, 80] Direction up Flipped off Parameter { Variable "Inputs" Value "*/" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Gain Name "Gain2" Show off Position [365, 80] Direction right Flipped off Parameter { Variable "K" Value "N" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [200, 55] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|-+" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [235, 75] Direction right Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type MinMax Name "Min/Max" Show off Position [205, 175] Direction up Flipped off Parameter { Variable "Operation" Value "2" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 190] Direction right Flipped off Frame [-15, -10; 15, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0.1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Divide" SrcTerminal 1 DstComponent "Gain2" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain2" SrcTerminal 2 DstComponent "m" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "Divide" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 Points [220, 55] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Gain1" SrcTerminal 2 Points [170, 135] Branch { Points [200, 135] DstComponent "Sum1" DstTerminal 3 } Branch { DstComponent "Sum" DstTerminal 3 } } Connection { Type Signal SrcComponent "Emf" SrcTerminal 1 Points [140, 80] Branch { DstComponent "Sum" DstTerminal 2 } Branch { Points [140, 55] DstComponent "Sum1" DstTerminal 2 } } Connection { Type Signal SrcComponent "Vdc" SrcTerminal 1 Points [105, 170] Branch { Points [105, 135] DstComponent "Gain1" DstTerminal 1 } Branch { DstComponent "Min/Max" DstTerminal 2 } } Connection { Type Signal SrcComponent "Min/Max" SrcTerminal 1 Points [245, 175; 245, 85] DstComponent "Divide" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [175, 190] DstComponent "Min/Max" DstTerminal 3 } } } Component { Type Subsystem Name "Modulation_C" Show on Position [855, 770] Direction up Flipped off Frame [-25, -20; 25, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Input Position [-25, -5] Direction left } Terminal { Type Output Position [29, -5] Direction right } Terminal { Type Input Position [-25, 10] Direction left } Schematic { Location [191, 258; 677, 496] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "Emf" Show on Position [60, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "m" Show on Position [445, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Vdc" Show on Position [60, 170] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Gain Name "Gain1" Show off Position [145, 135] Direction right Flipped off Parameter { Variable "K" Value "0.5" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum" Show off Position [170, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|++" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Product Name "Divide" Show off Position [295, 80] Direction up Flipped off Parameter { Variable "Inputs" Value "*/" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Gain Name "Gain2" Show off Position [365, 80] Direction right Flipped off Parameter { Variable "K" Value "N" Show off } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Sum Name "Sum1" Show off Position [200, 55] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|-+" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type SignalMux Name "Mux" Show off Position [235, 75] Direction right Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type MinMax Name "Min/Max" Show off Position [205, 175] Direction up Flipped off Parameter { Variable "Operation" Value "2" Show off } Parameter { Variable "Inputs" Value "2" Show off } } Component { Type Constant Name "Constant" Show off Position [145, 190] Direction right Flipped off Frame [-15, -10; 15, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "0.1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Connection { Type Signal SrcComponent "Divide" SrcTerminal 1 DstComponent "Gain2" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain2" SrcTerminal 2 DstComponent "m" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "Divide" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 Points [220, 55] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Gain1" SrcTerminal 2 Points [170, 135] Branch { Points [200, 135] DstComponent "Sum1" DstTerminal 3 } Branch { DstComponent "Sum" DstTerminal 3 } } Connection { Type Signal SrcComponent "Emf" SrcTerminal 1 Points [140, 80] Branch { DstComponent "Sum" DstTerminal 2 } Branch { Points [140, 55] DstComponent "Sum1" DstTerminal 2 } } Connection { Type Signal SrcComponent "Vdc" SrcTerminal 1 Points [105, 170] Branch { Points [105, 135] DstComponent "Gain1" DstTerminal 1 } Branch { DstComponent "Min/Max" DstTerminal 2 } } Connection { Type Signal SrcComponent "Min/Max" SrcTerminal 1 Points [245, 175; 245, 85] DstComponent "Divide" DstTerminal 3 } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 Points [175, 190] DstComponent "Min/Max" DstTerminal 3 } } } Connection { Type Event SrcComponent "Configuration" SrcTerminal 1 DstComponent "Control Task Trigger" DstTerminal 1 } Connection { Type Signal SrcComponent "Vg_A" SrcTerminal 1 DstComponent "Probe variable9" DstTerminal 1 } Connection { Type Signal SrcComponent "Vg_B" SrcTerminal 1 DstComponent "Probe variable10" DstTerminal 1 } Connection { Type Signal SrcComponent "Vg_C" SrcTerminal 1 DstComponent "Probe variable11" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [260, 295] Branch { Points [260, 270] DstComponent "Probe variable3" DstTerminal 1 } Branch { DstComponent "Goto" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux1" SrcTerminal 2 Points [255, 575] Branch { Points [255, 550] DstComponent "Probe variable5" DstTerminal 1 } Branch { DstComponent "Goto4" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux2" SrcTerminal 2 Points [255, 870] Branch { Points [255, 845] DstComponent "Probe variable7" DstTerminal 1 } Branch { DstComponent "Goto6" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux2" SrcTerminal 3 Points [255, 880] Branch { Points [255, 910] DstComponent "Probe variable8" DstTerminal 1 } Branch { DstComponent "Goto7" DstTerminal 1 } } Connection { Type Event SrcComponent "Configuration" SrcTerminal 2 Points [115, 60; 115, 105] Branch { Points [115, 190] Branch { Points [115, 260] Branch { Points [115, 380] Branch { Points [115, 465] Branch { DstComponent "Vsm_B" DstTerminal 2 } Branch { Points [115, 535] Branch { DstComponent "I_up_low_B" DstTerminal 2 } Branch { Points [115, 660] Branch { Points [115, 760] Branch { DstComponent "Vsm_C" DstTerminal 2 } Branch { Points [115, 830] Branch { DstComponent "I_up_low_C" DstTerminal 2 } Branch { Points [115, 960] DstComponent "Vg_C" DstTerminal 2 } } } Branch { DstComponent "Vg_B" DstTerminal 2 } } } } Branch { DstComponent "Vg_A" DstTerminal 2 } } Branch { DstComponent "I_up_low_A" DstTerminal 2 } } Branch { DstComponent "Vsm_A" DstTerminal 2 } } Branch { DstComponent "Vdc" DstTerminal 2 } } Connection { Type Signal SrcComponent "Mean_Diff" SrcTerminal 2 DstComponent "Demux3" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux3" SrcTerminal 2 Points [480, 240; 480, 230] DstComponent "Probe variable13" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux3" SrcTerminal 3 Points [480, 250; 480, 260] DstComponent "Probe variable14" DstTerminal 1 } Connection { Type Signal SrcComponent "Mean_Diff1" SrcTerminal 2 DstComponent "Demux4" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux4" SrcTerminal 2 Points [485, 515; 485, 505] DstComponent "Probe variable15" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux4" SrcTerminal 3 Points [485, 525; 485, 535] DstComponent "Probe variable16" DstTerminal 1 } Connection { Type Signal SrcComponent "I_up_low_B" SrcTerminal 1 Points [225, 520] Branch { DstComponent "Demux1" DstTerminal 1 } Branch { DstComponent "Mean_Diff1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Mean_Diff2" SrcTerminal 2 DstComponent "Demux5" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux5" SrcTerminal 2 Points [495, 810; 495, 800] DstComponent "Probe variable17" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux5" SrcTerminal 3 Points [495, 820; 495, 830] DstComponent "Probe variable18" DstTerminal 1 } Connection { Type Signal SrcComponent "I_up_low_C" SrcTerminal 1 Points [225, 815] Branch { DstComponent "Demux2" DstTerminal 1 } Branch { DstComponent "Mean_Diff2" DstTerminal 1 } } Connection { Type Signal SrcComponent "Vsm_A" SrcTerminal 1 Points [245, 175] Branch { Points [245, 205] DstComponent "Probe variable" DstTerminal 1 } Branch { DstComponent "Demux6" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux6" SrcTerminal 3 DstComponent "Goto3" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux7" SrcTerminal 2 DstComponent "Goto8" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux7" SrcTerminal 3 DstComponent "Goto9" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm_B" SrcTerminal 1 Points [245, 450] Branch { Points [245, 480] DstComponent "Probe variable1" DstTerminal 1 } Branch { DstComponent "Demux7" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux8" SrcTerminal 2 DstComponent "Goto10" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux8" SrcTerminal 3 DstComponent "Goto11" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm_C" SrcTerminal 1 Points [245, 745] Branch { Points [245, 775] DstComponent "Probe variable2" DstTerminal 1 } Branch { DstComponent "Demux8" DstTerminal 1 } } Connection { Type Signal SrcComponent "Vdc" SrcTerminal 1 Points [245, 90] Branch { Points [245, 115] DstComponent "Probe variable12" DstTerminal 1 } Branch { DstComponent "Goto12" DstTerminal 1 } } Connection { Type Signal SrcComponent "Tunable parameter" SrcTerminal 1 DstComponent "Inverter voltages" DstTerminal 1 } Connection { Type Signal SrcComponent "From12" SrcTerminal 1 DstComponent "Inverter voltages" DstTerminal 3 } Connection { Type Signal SrcComponent "Inverter voltages" SrcTerminal 2 Points [720, 125] Branch { DstComponent "Cont\nSelector" DstTerminal 1 } Branch { Points [720, 445] Branch { DstComponent "Cont\nSelector1" DstTerminal 1 } Branch { Points [720, 765] DstComponent "Cont\nSelector2" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Cont\nSelector" SrcTerminal 2 DstComponent "Modulation_A" DstTerminal 1 } Connection { Type Signal SrcComponent "From13" SrcTerminal 1 DstComponent "Modulation_A" DstTerminal 3 } Connection { Type Signal SrcComponent "Modulation_A" SrcTerminal 2 Points [890, 125] Branch { DstComponent "Cont\nSelector4" DstTerminal 1 } Branch { Points [890, 275] DstComponent "Cont\nSelector3" DstTerminal 1 } } Connection { Type Signal SrcComponent "From14" SrcTerminal 1 DstComponent "Modulation_B" DstTerminal 3 } Connection { Type Signal SrcComponent "Modulation_B" SrcTerminal 2 Points [895, 445] Branch { DstComponent "Cont\nSelector6" DstTerminal 1 } Branch { Points [895, 595] DstComponent "Cont\nSelector5" DstTerminal 1 } } Connection { Type Signal SrcComponent "Cont\nSelector1" SrcTerminal 2 DstComponent "Modulation_B" DstTerminal 1 } Connection { Type Signal SrcComponent "From15" SrcTerminal 1 DstComponent "Modulation_C" DstTerminal 3 } Connection { Type Signal SrcComponent "Modulation_C" SrcTerminal 2 Points [895, 765] Branch { DstComponent "Cont\nSelector8" DstTerminal 1 } Branch { Points [895, 915] DstComponent "Cont\nSelector7" DstTerminal 1 } } Connection { Type Signal SrcComponent "Cont\nSelector2" SrcTerminal 2 DstComponent "Modulation_C" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux6" SrcTerminal 2 DstComponent "Goto2" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [260, 305] Branch { DstComponent "Goto1" DstTerminal 1 } Branch { Points [260, 330] DstComponent "Probe variable4" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux1" SrcTerminal 3 Points [255, 585] Branch { Points [255, 615] DstComponent "Probe variable6" DstTerminal 1 } Branch { DstComponent "Goto5" DstTerminal 1 } } Connection { Type Signal SrcComponent "From1" SrcTerminal 1 DstComponent "PWM_up_A" DstTerminal 3 } Connection { Type Signal SrcComponent "From" SrcTerminal 1 DstComponent "PWM_up_A" DstTerminal 2 } Connection { Type Signal SrcComponent "From3" SrcTerminal 1 DstComponent "PWM_low_A" DstTerminal 3 } Connection { Type Signal SrcComponent "From2" SrcTerminal 1 DstComponent "PWM_low_A" DstTerminal 2 } Connection { Type Signal SrcComponent "From4" SrcTerminal 1 DstComponent "PWM_up_B" DstTerminal 2 } Connection { Type Signal SrcComponent "From5" SrcTerminal 1 DstComponent "PWM_up_B" DstTerminal 3 } Connection { Type Signal SrcComponent "From7" SrcTerminal 1 DstComponent "PWM_low_B" DstTerminal 3 } Connection { Type Signal SrcComponent "From6" SrcTerminal 1 DstComponent "PWM_low_B" DstTerminal 2 } Connection { Type Signal SrcComponent "From9" SrcTerminal 1 DstComponent "PWM_up_C" DstTerminal 3 } Connection { Type Signal SrcComponent "From8" SrcTerminal 1 DstComponent "PWM_up_C" DstTerminal 2 } Connection { Type Signal SrcComponent "From11" SrcTerminal 1 DstComponent "PWM_low_C" DstTerminal 3 } Connection { Type Signal SrcComponent "From10" SrcTerminal 1 DstComponent "PWM_low_C" DstTerminal 2 } Connection { Type Event SrcComponent "Configuration" SrcTerminal 3 Points [985, 50; 985, 225] Branch { DstComponent "PWM_up_A" DstTerminal 5 } Branch { Points [985, 375] Branch { DstComponent "PWM_low_A" DstTerminal 5 } Branch { Points [985, 545] Branch { DstComponent "PWM_up_B" DstTerminal 5 } Branch { Points [985, 695] Branch { DstComponent "PWM_low_B" DstTerminal 5 } Branch { Points [985, 865] Branch { DstComponent "PWM_up_C" DstTerminal 5 } Branch { Points [985, 1015] DstComponent "PWM_low_C" DstTerminal 5 } } } } } } Connection { Type Signal SrcComponent "Cont\nSelector4" SrcTerminal 2 DstComponent "PWM_up_A" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector3" SrcTerminal 2 DstComponent "PWM_low_A" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector6" SrcTerminal 2 DstComponent "PWM_up_B" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector5" SrcTerminal 2 DstComponent "PWM_low_B" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector8" SrcTerminal 2 DstComponent "PWM_up_C" DstTerminal 1 } Connection { Type Signal SrcComponent "Cont\nSelector7" SrcTerminal 2 DstComponent "PWM_low_C" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "precharge_relay" DstTerminal 1 } Connection { Type Signal SrcComponent "Tunable parameter1" SrcTerminal 1 Points [655, 965; 655, 975] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Tunable parameter2" SrcTerminal 1 Points [655, 995; 655, 985] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "I_up_low_A" SrcTerminal 1 Points [230, 245] Branch { DstComponent "Demux" DstTerminal 1 } Branch { DstComponent "Mean_Diff" DstTerminal 1 } } } } Component { Type Subsystem Name "Plant" Show on Position [365, 165] Direction up Flipped off Frame [-70, -90; 70, 90] LabelPosition [0, 93] LabelAlign up TreatAsAtomicUnit on SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [74, -5] Direction right Index "1" } Terminal { Type Output Position [74, 50] Direction right Index "2" } Terminal { Type Output Position [74, -80] Direction right Index "3" } Terminal { Type Output Position [74, 65] Direction right Index "4" } Terminal { Type Output Position [74, 80] Direction right Index "5" } Terminal { Type Output Position [74, -60] Direction right Index "6" } Terminal { Type Output Position [74, 10] Direction right Index "7" } Terminal { Type Output Position [74, -45] Direction right Index "8" } Terminal { Type Output Position [74, -30] Direction right Index "9" } Terminal { Type Output Position [74, 25] Direction right Index "10" } Terminal { Type Input Position [-70, -80] Direction left Index "1" } Terminal { Type Input Position [-70, -60] Direction left Index "2" } Terminal { Type Input Position [-70, -10] Direction left Index "3" } Terminal { Type Input Position [-70, 10] Direction left Index "4" } Terminal { Type Input Position [-70, 75] Direction left Index "5" } Terminal { Type Input Position [-70, 55] Direction left Index "6" } Schematic { Location [40, 109; 1480, 682] ZoomFactor 1 SliderPosition [134, 0] ShowBrowser off BrowserWidth 100 Component { Type DCVoltageSource Name "Vdc_source" Show on Position [80, 210] Direction up Flipped off Parameter { Variable "V" Value "Vdc" Show off } } Component { Type ThreePhaseMeter Name "3ph Meter" Show off Position [1240, 245] Direction up Flipped off Parameter { Variable "voltage" Value "1" Show off } } Component { Type Output Name "I_up_low_A" Show on Position [535, 85] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Vg_A" Show on Position [1390, 110] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Voltmeter Name "V_D" Show off Position [120, 210] Direction up Flipped off } Component { Type Output Name "Vdc" Show on Position [255, 210] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "Phase A" Show on Position [340, 220] Direction up Flipped off Frame [-55, -155; 55, 155] LabelPosition [58, 0] LabelAlign left SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-15, -160] Direction up } Terminal { Type Port Position [-15, 160] Direction down } Terminal { Type Output Position [59, -55] Direction right } Terminal { Type Input Position [-55, 55] Direction left } Terminal { Type Input Position [-55, 85] Direction left } Terminal { Type Output Position [59, -135] Direction right } Terminal { Type Port Position [60, 15] Direction right } Schematic { Location [92, 191; 578, 796] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Port Name "VDD" Show on Position [55, 30] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "VEE" Show on Position [55, 540] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Ammeter Name "I_U" Show on Position [155, 190] Direction up Flipped off } Component { Type SignalMux Name "Mux1" Show off Position [275, 515] Direction down Flipped off Parameter { Variable "Width" Value "[4 4]" Show off } } Component { Type Output Name "Vcaps_U/L" Show on Position [275, 565] Direction down Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "states_U" Show on Position [55, 120] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "states_L" Show on Position [55, 455] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalMux Name "Mux6" Show off Position [385, 515] Direction down Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type Output Name "I_U/L" Show on Position [385, 565] Direction down Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Ammeter Name "I_L" Show on Position [155, 360] Direction up Flipped off } Component { Type Subsystem Name "arm_up" Show on Position [165, 115] Direction up Flipped off Frame [-30, -55; 30, 55] LabelPosition [-33, -58] LabelAlign bottomright SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "arm_idx" Prompt "Arm index (0 to 5)" Type FreeText Value "0" Show off Tunable off TabName "" } Parameter { Variable "Csm" Prompt "Csm" Type FreeText Value "Csm" Show off Tunable off TabName "" } Parameter { Variable "Vsm0" Prompt "Vsm0" Type FreeText Value "Vsm0" Show off Tunable off TabName "" } Parameter { Variable "Rsm" Prompt "Rsm" Type FreeText Value "Rsm" Show off Tunable off TabName "" } Terminal { Type Output Position [34, 25] Direction right } Terminal { Type Port Position [-10, -60] Direction up } Terminal { Type Port Position [-10, 60] Direction down } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [128, 215; 614, 834] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 96 Component { Type Subsystem Name "SM0" Show on Position [175, 125] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [148, 247; 459, 507] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(1+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [280, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Voltmeter Name "Vsm0" Show on Position [255, 125] Direction up Flipped off } Component { Type Voltmeter Name "Vsm1" Show on Position [255, 235] Direction up Flipped off } Component { Type Voltmeter Name "Vsm2" Show on Position [255, 345] Direction up Flipped off } Component { Type Voltmeter Name "Vsm3" Show on Position [255, 455] Direction up Flipped off } Component { Type SignalMux Name "Mux" Show off Position [355, 565] Direction right Flipped off Parameter { Variable "Width" Value "4" Show off } } Component { Type Output Name "voltages" Show on Position [400, 565] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "P" Show on Position [150, 30] Direction down Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "N" Show on Position [150, 565] Direction down Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [70, 290] Direction right Flipped on Parameter { Variable "Width" Value "[2 2 2 2]" Show on } } Component { Type Input Name "states" Show on Position [35, 290] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "SM1" Show on Position [175, 235] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [145, 250; 456, 510] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(2+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM2" Show on Position [175, 345] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [142, 262; 453, 522] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(3+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM3" Show on Position [175, 455] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [144, 249; 455, 509] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(4+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Connection { Type Wire SrcComponent "SM0" SrcTerminal 2 DstComponent "SM1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 2 DstComponent "SM3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 2 DstComponent "SM2" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm3" SrcTerminal 3 Points [295, 455; 295, 580] DstComponent "Mux" DstTerminal 5 } Connection { Type Signal SrcComponent "Vsm2" SrcTerminal 3 Points [305, 345; 305, 570] DstComponent "Mux" DstTerminal 4 } Connection { Type Signal SrcComponent "Vsm1" SrcTerminal 3 Points [315, 235; 315, 560] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Vsm0" SrcTerminal 3 Points [325, 125; 325, 550] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "voltages" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 1 DstComponent "P" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 2 DstComponent "N" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [100, 275; 100, 125] DstComponent "SM0" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 5 Points [100, 305; 100, 455] DstComponent "SM3" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 285; 110, 235] DstComponent "SM1" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [110, 295; 110, 345] DstComponent "SM2" DstTerminal 5 } Connection { Type Signal SrcComponent "states" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 3 Points [160, 75; 255, 75] DstComponent "Vsm0" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 4 Points [160, 285; 255, 285] DstComponent "Vsm1" DstTerminal 2 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 3 Points [160, 295; 255, 295] DstComponent "Vsm2" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 4 Points [160, 175; 255, 175] DstComponent "Vsm0" DstTerminal 2 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 3 Points [160, 185; 255, 185] DstComponent "Vsm1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 4 Points [160, 395; 255, 395] DstComponent "Vsm2" DstTerminal 2 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 3 Points [160, 405; 255, 405] DstComponent "Vsm3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 4 Points [160, 505; 255, 505] DstComponent "Vsm3" DstTerminal 2 } } } Component { Type Port Name "VM" Show on Position [455, 290] Direction left Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Inductor Name "L1" Show on Position [185, 275] Direction left Flipped off Parameter { Variable "L" Value "Lb" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L2" Show on Position [185, 305] Direction left Flipped off Parameter { Variable "L" Value "Lb" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Resistor Name "R1" Show on Position [230, 275] Direction left Flipped off Parameter { Variable "R" Value "Rb" Show off } } Component { Type Resistor Name "R2" Show on Position [230, 305] Direction left Flipped off Parameter { Variable "R" Value "Rb" Show off } } Component { Type Subsystem Name "arm_low" Show on Position [165, 450] Direction up Flipped off Frame [-30, -55; 30, 55] LabelPosition [-33, -58] LabelAlign bottomright SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "arm_idx" Prompt "Arm index (0 to 5)" Type FreeText Value "1" Show off Tunable off TabName "" } Parameter { Variable "Csm" Prompt "Csm" Type FreeText Value "Csm" Show off Tunable off TabName "" } Parameter { Variable "Vsm0" Prompt "Vsm0" Type FreeText Value "Vsm0" Show off Tunable off TabName "" } Parameter { Variable "Rsm" Prompt "Rsm" Type FreeText Value "Rsm" Show off Tunable off TabName "" } Terminal { Type Output Position [34, 25] Direction right } Terminal { Type Port Position [-10, -60] Direction up } Terminal { Type Port Position [-10, 60] Direction down } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [128, 215; 614, 834] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 96 Component { Type Subsystem Name "SM0" Show on Position [175, 125] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [148, 247; 459, 507] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(1+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [280, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Voltmeter Name "Vsm0" Show on Position [255, 125] Direction up Flipped off } Component { Type Voltmeter Name "Vsm1" Show on Position [255, 235] Direction up Flipped off } Component { Type Voltmeter Name "Vsm2" Show on Position [255, 345] Direction up Flipped off } Component { Type Voltmeter Name "Vsm3" Show on Position [255, 455] Direction up Flipped off } Component { Type SignalMux Name "Mux" Show off Position [355, 565] Direction right Flipped off Parameter { Variable "Width" Value "4" Show off } } Component { Type Output Name "voltages" Show on Position [400, 565] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "P" Show on Position [150, 30] Direction down Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "N" Show on Position [150, 565] Direction down Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [70, 290] Direction right Flipped on Parameter { Variable "Width" Value "[2 2 2 2]" Show on } } Component { Type Input Name "states" Show on Position [35, 290] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "SM1" Show on Position [175, 235] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [145, 250; 456, 510] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(2+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM2" Show on Position [175, 345] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [142, 262; 453, 522] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(3+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM3" Show on Position [175, 455] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [144, 249; 455, 509] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(4+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Connection { Type Wire SrcComponent "SM0" SrcTerminal 2 DstComponent "SM1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 2 DstComponent "SM3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 2 DstComponent "SM2" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm3" SrcTerminal 3 Points [295, 455; 295, 580] DstComponent "Mux" DstTerminal 5 } Connection { Type Signal SrcComponent "Vsm2" SrcTerminal 3 Points [305, 345; 305, 570] DstComponent "Mux" DstTerminal 4 } Connection { Type Signal SrcComponent "Vsm1" SrcTerminal 3 Points [315, 235; 315, 560] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Vsm0" SrcTerminal 3 Points [325, 125; 325, 550] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "voltages" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 1 DstComponent "P" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 2 DstComponent "N" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [100, 275; 100, 125] DstComponent "SM0" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 5 Points [100, 305; 100, 455] DstComponent "SM3" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 285; 110, 235] DstComponent "SM1" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [110, 295; 110, 345] DstComponent "SM2" DstTerminal 5 } Connection { Type Signal SrcComponent "states" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 3 Points [160, 75; 255, 75] DstComponent "Vsm0" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 4 Points [160, 285; 255, 285] DstComponent "Vsm1" DstTerminal 2 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 3 Points [160, 295; 255, 295] DstComponent "Vsm2" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 4 Points [160, 175; 255, 175] DstComponent "Vsm0" DstTerminal 2 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 3 Points [160, 185; 255, 185] DstComponent "Vsm1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 4 Points [160, 395; 255, 395] DstComponent "Vsm2" DstTerminal 2 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 3 Points [160, 405; 255, 405] DstComponent "Vsm3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 4 Points [160, 505; 255, 505] DstComponent "Vsm3" DstTerminal 2 } } } Connection { Type Signal SrcComponent "states_U" SrcTerminal 1 DstComponent "arm_up" DstTerminal 4 } Connection { Type Signal SrcComponent "states_L" SrcTerminal 1 DstComponent "arm_low" DstTerminal 4 } Connection { Type Wire SrcComponent "I_U" SrcTerminal 1 DstComponent "arm_up" DstTerminal 3 } Connection { Type Wire SrcComponent "I_L" SrcTerminal 2 DstComponent "arm_low" DstTerminal 2 } Connection { Type Signal SrcComponent "arm_low" SrcTerminal 1 Points [270, 475] DstComponent "Mux1" DstTerminal 3 } Connection { Type Signal SrcComponent "arm_up" SrcTerminal 1 Points [280, 140] DstComponent "Mux1" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux6" SrcTerminal 1 DstComponent "I_U/L" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux1" SrcTerminal 1 DstComponent "Vcaps_U/L" DstTerminal 1 } Connection { Type Signal SrcComponent "I_U" SrcTerminal 3 Points [390, 190] DstComponent "Mux6" DstTerminal 2 } Connection { Type Signal SrcComponent "I_L" SrcTerminal 3 Points [380, 360] DstComponent "Mux6" DstTerminal 3 } Connection { Type Wire SrcComponent "R1" SrcTerminal 2 Points [255, 275; 255, 290] Branch { DstComponent "VM" DstTerminal 1 } Branch { Points [255, 305] DstComponent "R2" DstTerminal 2 } } Connection { Type Wire SrcComponent "R1" SrcTerminal 1 DstComponent "L1" DstTerminal 2 } Connection { Type Wire SrcComponent "R2" SrcTerminal 1 DstComponent "L2" DstTerminal 2 } Connection { Type Wire SrcComponent "I_L" SrcTerminal 1 Points [155, 305] DstComponent "L2" DstTerminal 1 } Connection { Type Wire SrcComponent "arm_low" SrcTerminal 3 Points [155, 540] DstComponent "VEE" DstTerminal 1 } Connection { Type Wire SrcComponent "I_U" SrcTerminal 2 Points [155, 275] DstComponent "L1" DstTerminal 1 } Connection { Type Wire SrcComponent "VDD" SrcTerminal 1 Points [155, 30] DstComponent "arm_up" DstTerminal 2 } } } Component { Type Resistor Name "R1" Show off Position [1285, 235] Direction right Flipped off Parameter { Variable "R" Value "Rg" Show off } } Component { Type Resistor Name "R2" Show off Position [1285, 245] Direction right Flipped off Parameter { Variable "R" Value "Rg" Show off } } Component { Type Resistor Name "R3" Show off Position [1285, 255] Direction right Flipped off Parameter { Variable "R" Value "Rg" Show off } } Component { Type Output Name "Vg_B" Show on Position [1390, 140] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Vg_C" Show on Position [1390, 170] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [1345, 140] Direction right Flipped on Parameter { Variable "Width" Value "3" Show off } } Component { Type Output Name "Vsm_A" Show on Position [535, 165] Direction right Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "I_up_low_B" Show on Position [850, 85] Direction right Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Vsm_B" Show on Position [850, 165] Direction right Flipped off Parameter { Variable "Index" Value "8" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Vsm_C" Show on Position [1170, 165] Direction right Flipped off Parameter { Variable "Index" Value "9" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "I_up_low_C" Show on Position [1170, 85] Direction right Flipped off Parameter { Variable "Index" Value "10" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "PWM_up_A" Show on Position [235, 275] Direction right Flipped off Parameter { Variable "Index" Value "11" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "PWM_low_A" Show on Position [235, 305] Direction right Flipped off Parameter { Variable "Index" Value "12" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "PWM_up_B" Show on Position [550, 275] Direction right Flipped off Parameter { Variable "Index" Value "13" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "PWM_low_B" Show on Position [550, 305] Direction right Flipped off Parameter { Variable "Index" Value "14" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "PWM_low_C" Show on Position [875, 305] Direction right Flipped off Parameter { Variable "Index" Value "15" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "PWM_up_C" Show on Position [875, 275] Direction right Flipped off Parameter { Variable "Index" Value "16" Show on } Parameter { Variable "DataType" Value "10" Show off } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Goto Name "Goto" Show off Position [1265, 205] Direction right Flipped off Parameter { Variable "Tag" Value "Ig_abc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto1" Show off Position [1255, 115] Direction right Flipped off Parameter { Variable "Tag" Value "Vg_abc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto2" Show off Position [425, 140] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto3" Show off Position [745, 140] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto4" Show off Position [1065, 140] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Scope Name "Scope Vsm" Show on Position [455, 495] Direction up Flipped off Location [82, 184; 986, 938] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAIQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAAA4gAAALX" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACQAAAGQAAAAIAAAAZAAAAAcAAABkAAAABgAAAGQAAAAFAAAAZAAAAAQAAABkAAAAAwAAAGQAAA" "ACAAAAZAAAAAEAAABkAAAAmQAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAB" "1AAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAA==" Axes "3" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "Time [s]" ShowLegend "2" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Sub-module capacitor voltages A [V]" Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Sub-module capacitor voltages B [V]" Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Sub-module capacitor voltages C [V]" Untangle 0 KeepBaseline off BaselineValue 0 } Fourier { SingleXAxis on AxisLabel "Frequency" Scaling 0 PhaseDisplay 0 ShowFourierLegend off Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } } } Component { Type From Name "From" Show off Position [385, 475] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From1" Show off Position [385, 495] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From2" Show off Position [385, 515] Direction right Flipped off Parameter { Variable "Tag" Value "Vsm_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Scope Name "Scope load" Show on Position [620, 490] Direction up Flipped off Location [84, 197; 937, 895] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAFwA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAAA1UAAAKf" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACQAAAGQAAAAIAAAAZAAAAAcAAABkAAAABgAAAGQAAAAFAAAAZAAAAAQAAABkAAAAAwAAAGQAAA" "ACAAAAZAAAAAEAAABkAAABAQAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAD" "dAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" Axes "2" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "Time [s]" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Grid voltages [V]" Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Grid currents [A]" Untangle 0 KeepBaseline off BaselineValue 0 } Fourier { SingleXAxis on AxisLabel "Frequency" Scaling 0 PhaseDisplay 0 ShowFourierLegend off Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } } } Component { Type From Name "From3" Show off Position [575, 475] Direction right Flipped off Parameter { Variable "Tag" Value "Vg_abc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From4" Show off Position [575, 505] Direction right Flipped off Parameter { Variable "Tag" Value "Ig_abc" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Sub4" Show off Position [455, 165] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"V_PEH2015\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "-0.0089" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub5" Show off Position [185, 210] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"V_DIN800V\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "0.00246" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub6" Show off Position [1285, 140] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"V_DIN800V\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "0.00246" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub7" Show off Position [775, 165] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"V_PEH2015\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "-0.0089" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub8" Show off Position [1095, 165] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"V_PEH2015\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "-0.0089" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub9" Show off Position [455, 85] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"A_DIN50A\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "0.099" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub10" Show off Position [775, 85] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"A_DIN50A\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "0.099" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Subsystem Name "Sub11" Show off Position [1095, 85] Direction up Flipped off Frame [-35, -10; 35, 10] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplay "Icon:text(0,-0., \"A_DIN50A\", 'FontSize',11)" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque on MaskIconRotates off Terminal { Type Input Position [-35, 0] Direction left } Terminal { Type Output Position [39, 0] Direction right } Schematic { Location [1046, 542; 1183, 679] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Gain Name "Gain" Show on Position [200, 90] Direction right Flipped off Parameter { Variable "K" Value "0.099" Show on } Parameter { Variable "Multiplication" Value "1" Show off } Parameter { Variable "DataType" Value "10" Show off } } Component { Type Input Name "In1" Show on Position [110, 90] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Out1" Show on Position [295, 90] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "In1" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Out1" DstTerminal 1 } } } Component { Type Goto Name "Goto5" Show off Position [425, 55] Direction right Flipped off Parameter { Variable "Tag" Value "I_U/L_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto6" Show off Position [745, 60] Direction right Flipped off Parameter { Variable "Tag" Value "I_U/L_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto7" Show off Position [1065, 60] Direction right Flipped off Parameter { Variable "Tag" Value "I_U/L_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Scope Name "Scope arm currents" Show on Position [785, 495] Direction up Flipped off Location [53, 219; 901, 917] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAIQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAAA1AAAAKf" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACQAAAGQAAAAIAAAAZAAAAAcAAABkAAAABgAAAGQAAAAFAAAAZAAAAAQAAABkAAAAAwAAAGQAAA" "ACAAAAZAAAAAEAAABkAAAA0gAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "uAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAA==" Axes "3" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "Time [s]" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Arm currents A [A]" Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Arm currents B [A]" Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] AxisLabel "Arm currents C [A]" Untangle 0 KeepBaseline off BaselineValue 0 } Fourier { SingleXAxis on AxisLabel "Frequency" Scaling 0 PhaseDisplay 0 ShowFourierLegend off Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} Untangle 0 KeepBaseline off BaselineValue 0 } } } Component { Type From Name "From5" Show off Position [715, 475] Direction right Flipped off Parameter { Variable "Tag" Value "I_U/L_A" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From6" Show off Position [715, 495] Direction right Flipped off Parameter { Variable "Tag" Value "I_U/L_B" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From7" Show off Position [715, 515] Direction right Flipped off Parameter { Variable "Tag" Value "I_U/L_C" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Phase B" Show on Position [660, 220] Direction up Flipped off Frame [-55, -155; 55, 155] LabelPosition [58, 0] LabelAlign left SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-15, -160] Direction up } Terminal { Type Port Position [-15, 160] Direction down } Terminal { Type Output Position [59, -55] Direction right } Terminal { Type Input Position [-55, 55] Direction left } Terminal { Type Input Position [-55, 85] Direction left } Terminal { Type Output Position [59, -135] Direction right } Terminal { Type Port Position [60, 25] Direction right } Schematic { Location [92, 191; 578, 796] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Port Name "VDD" Show on Position [55, 30] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "VEE" Show on Position [55, 540] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Ammeter Name "I_U" Show on Position [155, 190] Direction up Flipped off } Component { Type SignalMux Name "Mux1" Show off Position [275, 515] Direction down Flipped off Parameter { Variable "Width" Value "[4 4]" Show off } } Component { Type Output Name "Vcaps_U/L" Show on Position [275, 565] Direction down Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "states_U" Show on Position [55, 120] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "states_L" Show on Position [55, 455] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalMux Name "Mux6" Show off Position [385, 515] Direction down Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type Output Name "I_U/L" Show on Position [385, 565] Direction down Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Ammeter Name "I_L" Show on Position [155, 360] Direction up Flipped off } Component { Type Subsystem Name "arm_up" Show on Position [165, 115] Direction up Flipped off Frame [-30, -55; 30, 55] LabelPosition [-33, -58] LabelAlign bottomright SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "arm_idx" Prompt "Arm index (0 to 5)" Type FreeText Value "2" Show off Tunable off TabName "" } Parameter { Variable "Csm" Prompt "Csm" Type FreeText Value "Csm" Show off Tunable off TabName "" } Parameter { Variable "Vsm0" Prompt "Vsm0" Type FreeText Value "Vsm0" Show off Tunable off TabName "" } Parameter { Variable "Rsm" Prompt "Rsm" Type FreeText Value "Rsm" Show off Tunable off TabName "" } Terminal { Type Output Position [34, 25] Direction right } Terminal { Type Port Position [-10, -60] Direction up } Terminal { Type Port Position [-10, 60] Direction down } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [128, 215; 614, 834] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 96 Component { Type Subsystem Name "SM0" Show on Position [175, 125] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [148, 247; 459, 507] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(1+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [280, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Voltmeter Name "Vsm0" Show on Position [255, 125] Direction up Flipped off } Component { Type Voltmeter Name "Vsm1" Show on Position [255, 235] Direction up Flipped off } Component { Type Voltmeter Name "Vsm2" Show on Position [255, 345] Direction up Flipped off } Component { Type Voltmeter Name "Vsm3" Show on Position [255, 455] Direction up Flipped off } Component { Type SignalMux Name "Mux" Show off Position [355, 565] Direction right Flipped off Parameter { Variable "Width" Value "4" Show off } } Component { Type Output Name "voltages" Show on Position [400, 565] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "P" Show on Position [150, 30] Direction down Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "N" Show on Position [150, 565] Direction down Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [70, 290] Direction right Flipped on Parameter { Variable "Width" Value "[2 2 2 2]" Show on } } Component { Type Input Name "states" Show on Position [35, 290] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "SM1" Show on Position [175, 235] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [145, 250; 456, 510] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(2+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM2" Show on Position [175, 345] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [142, 262; 453, 522] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(3+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM3" Show on Position [175, 455] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [144, 249; 455, 509] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(4+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Connection { Type Wire SrcComponent "SM0" SrcTerminal 2 DstComponent "SM1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 2 DstComponent "SM3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 2 DstComponent "SM2" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm3" SrcTerminal 3 Points [295, 455; 295, 580] DstComponent "Mux" DstTerminal 5 } Connection { Type Signal SrcComponent "Vsm2" SrcTerminal 3 Points [305, 345; 305, 570] DstComponent "Mux" DstTerminal 4 } Connection { Type Signal SrcComponent "Vsm1" SrcTerminal 3 Points [315, 235; 315, 560] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Vsm0" SrcTerminal 3 Points [325, 125; 325, 550] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "voltages" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 1 DstComponent "P" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 2 DstComponent "N" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [100, 275; 100, 125] DstComponent "SM0" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 5 Points [100, 305; 100, 455] DstComponent "SM3" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 285; 110, 235] DstComponent "SM1" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [110, 295; 110, 345] DstComponent "SM2" DstTerminal 5 } Connection { Type Signal SrcComponent "states" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 3 Points [160, 75; 255, 75] DstComponent "Vsm0" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 4 Points [160, 285; 255, 285] DstComponent "Vsm1" DstTerminal 2 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 3 Points [160, 295; 255, 295] DstComponent "Vsm2" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 4 Points [160, 175; 255, 175] DstComponent "Vsm0" DstTerminal 2 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 3 Points [160, 185; 255, 185] DstComponent "Vsm1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 4 Points [160, 395; 255, 395] DstComponent "Vsm2" DstTerminal 2 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 3 Points [160, 405; 255, 405] DstComponent "Vsm3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 4 Points [160, 505; 255, 505] DstComponent "Vsm3" DstTerminal 2 } } } Component { Type Port Name "VM" Show on Position [455, 290] Direction left Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Inductor Name "L1" Show on Position [185, 275] Direction left Flipped off Parameter { Variable "L" Value "Lb" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L2" Show on Position [185, 305] Direction left Flipped off Parameter { Variable "L" Value "Lb" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Resistor Name "R1" Show on Position [230, 275] Direction left Flipped off Parameter { Variable "R" Value "Rb" Show off } } Component { Type Resistor Name "R2" Show on Position [230, 305] Direction left Flipped off Parameter { Variable "R" Value "Rb" Show off } } Component { Type Subsystem Name "arm_low" Show on Position [165, 450] Direction up Flipped off Frame [-30, -55; 30, 55] LabelPosition [-33, -58] LabelAlign bottomright SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "arm_idx" Prompt "Arm index (0 to 5)" Type FreeText Value "3" Show off Tunable off TabName "" } Parameter { Variable "Csm" Prompt "Csm" Type FreeText Value "Csm" Show off Tunable off TabName "" } Parameter { Variable "Vsm0" Prompt "Vsm0" Type FreeText Value "Vsm0" Show off Tunable off TabName "" } Parameter { Variable "Rsm" Prompt "Rsm" Type FreeText Value "Rsm" Show off Tunable off TabName "" } Terminal { Type Output Position [34, 25] Direction right } Terminal { Type Port Position [-10, -60] Direction up } Terminal { Type Port Position [-10, 60] Direction down } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [128, 215; 614, 834] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 96 Component { Type Subsystem Name "SM0" Show on Position [175, 125] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [148, 247; 459, 507] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(1+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [280, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Voltmeter Name "Vsm0" Show on Position [255, 125] Direction up Flipped off } Component { Type Voltmeter Name "Vsm1" Show on Position [255, 235] Direction up Flipped off } Component { Type Voltmeter Name "Vsm2" Show on Position [255, 345] Direction up Flipped off } Component { Type Voltmeter Name "Vsm3" Show on Position [255, 455] Direction up Flipped off } Component { Type SignalMux Name "Mux" Show off Position [355, 565] Direction right Flipped off Parameter { Variable "Width" Value "4" Show off } } Component { Type Output Name "voltages" Show on Position [400, 565] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "P" Show on Position [150, 30] Direction down Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "N" Show on Position [150, 565] Direction down Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [70, 290] Direction right Flipped on Parameter { Variable "Width" Value "[2 2 2 2]" Show on } } Component { Type Input Name "states" Show on Position [35, 290] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "SM1" Show on Position [175, 235] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [145, 250; 456, 510] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(2+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM2" Show on Position [175, 345] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [142, 262; 453, 522] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(3+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM3" Show on Position [175, 455] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [144, 249; 455, 509] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(4+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Connection { Type Wire SrcComponent "SM0" SrcTerminal 2 DstComponent "SM1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 2 DstComponent "SM3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 2 DstComponent "SM2" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm3" SrcTerminal 3 Points [295, 455; 295, 580] DstComponent "Mux" DstTerminal 5 } Connection { Type Signal SrcComponent "Vsm2" SrcTerminal 3 Points [305, 345; 305, 570] DstComponent "Mux" DstTerminal 4 } Connection { Type Signal SrcComponent "Vsm1" SrcTerminal 3 Points [315, 235; 315, 560] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Vsm0" SrcTerminal 3 Points [325, 125; 325, 550] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "voltages" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 1 DstComponent "P" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 2 DstComponent "N" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [100, 275; 100, 125] DstComponent "SM0" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 5 Points [100, 305; 100, 455] DstComponent "SM3" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 285; 110, 235] DstComponent "SM1" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [110, 295; 110, 345] DstComponent "SM2" DstTerminal 5 } Connection { Type Signal SrcComponent "states" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 3 Points [160, 75; 255, 75] DstComponent "Vsm0" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 4 Points [160, 285; 255, 285] DstComponent "Vsm1" DstTerminal 2 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 3 Points [160, 295; 255, 295] DstComponent "Vsm2" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 4 Points [160, 175; 255, 175] DstComponent "Vsm0" DstTerminal 2 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 3 Points [160, 185; 255, 185] DstComponent "Vsm1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 4 Points [160, 395; 255, 395] DstComponent "Vsm2" DstTerminal 2 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 3 Points [160, 405; 255, 405] DstComponent "Vsm3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 4 Points [160, 505; 255, 505] DstComponent "Vsm3" DstTerminal 2 } } } Connection { Type Signal SrcComponent "states_U" SrcTerminal 1 DstComponent "arm_up" DstTerminal 4 } Connection { Type Signal SrcComponent "states_L" SrcTerminal 1 DstComponent "arm_low" DstTerminal 4 } Connection { Type Wire SrcComponent "I_U" SrcTerminal 1 DstComponent "arm_up" DstTerminal 3 } Connection { Type Wire SrcComponent "I_L" SrcTerminal 2 DstComponent "arm_low" DstTerminal 2 } Connection { Type Signal SrcComponent "arm_low" SrcTerminal 1 Points [270, 475] DstComponent "Mux1" DstTerminal 3 } Connection { Type Signal SrcComponent "arm_up" SrcTerminal 1 Points [280, 140] DstComponent "Mux1" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux6" SrcTerminal 1 DstComponent "I_U/L" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux1" SrcTerminal 1 DstComponent "Vcaps_U/L" DstTerminal 1 } Connection { Type Signal SrcComponent "I_U" SrcTerminal 3 Points [390, 190] DstComponent "Mux6" DstTerminal 2 } Connection { Type Signal SrcComponent "I_L" SrcTerminal 3 Points [380, 360] DstComponent "Mux6" DstTerminal 3 } Connection { Type Wire SrcComponent "R1" SrcTerminal 2 Points [255, 275; 255, 290] Branch { DstComponent "VM" DstTerminal 1 } Branch { Points [255, 305] DstComponent "R2" DstTerminal 2 } } Connection { Type Wire SrcComponent "R1" SrcTerminal 1 DstComponent "L1" DstTerminal 2 } Connection { Type Wire SrcComponent "R2" SrcTerminal 1 DstComponent "L2" DstTerminal 2 } Connection { Type Wire SrcComponent "I_L" SrcTerminal 1 Points [155, 305] DstComponent "L2" DstTerminal 1 } Connection { Type Wire SrcComponent "arm_low" SrcTerminal 3 Points [155, 540] DstComponent "VEE" DstTerminal 1 } Connection { Type Wire SrcComponent "I_U" SrcTerminal 2 Points [155, 275] DstComponent "L1" DstTerminal 1 } Connection { Type Wire SrcComponent "VDD" SrcTerminal 1 Points [155, 30] DstComponent "arm_up" DstTerminal 2 } } } Component { Type Subsystem Name "Phase C" Show on Position [980, 220] Direction up Flipped off Frame [-55, -155; 55, 155] LabelPosition [58, 0] LabelAlign left SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-15, -160] Direction up } Terminal { Type Port Position [-15, 160] Direction down } Terminal { Type Output Position [59, -55] Direction right } Terminal { Type Input Position [-55, 55] Direction left } Terminal { Type Input Position [-55, 85] Direction left } Terminal { Type Output Position [59, -135] Direction right } Terminal { Type Port Position [60, 35] Direction right } Schematic { Location [92, 191; 578, 796] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Port Name "VDD" Show on Position [55, 30] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "VEE" Show on Position [55, 540] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Ammeter Name "I_U" Show on Position [155, 190] Direction up Flipped off } Component { Type SignalMux Name "Mux1" Show off Position [275, 515] Direction down Flipped off Parameter { Variable "Width" Value "[4 4]" Show off } } Component { Type Output Name "Vcaps_U/L" Show on Position [275, 565] Direction down Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "states_U" Show on Position [55, 120] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "states_L" Show on Position [55, 455] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalMux Name "Mux6" Show off Position [385, 515] Direction down Flipped off Parameter { Variable "Width" Value "2" Show off } } Component { Type Output Name "I_U/L" Show on Position [385, 565] Direction down Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Ammeter Name "I_L" Show on Position [155, 360] Direction up Flipped off } Component { Type Subsystem Name "arm_up" Show on Position [165, 115] Direction up Flipped off Frame [-30, -55; 30, 55] LabelPosition [-33, -58] LabelAlign bottomright SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "arm_idx" Prompt "Arm index (0 to 5)" Type FreeText Value "4" Show off Tunable off TabName "" } Parameter { Variable "Csm" Prompt "Csm" Type FreeText Value "Csm" Show off Tunable off TabName "" } Parameter { Variable "Vsm0" Prompt "Vsm0" Type FreeText Value "Vsm0" Show off Tunable off TabName "" } Parameter { Variable "Rsm" Prompt "Rsm" Type FreeText Value "Rsm" Show off Tunable off TabName "" } Terminal { Type Output Position [34, 25] Direction right } Terminal { Type Port Position [-10, -60] Direction up } Terminal { Type Port Position [-10, 60] Direction down } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [128, 215; 614, 834] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 96 Component { Type Subsystem Name "SM0" Show on Position [175, 125] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [148, 247; 459, 507] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(1+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [280, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Voltmeter Name "Vsm0" Show on Position [255, 125] Direction up Flipped off } Component { Type Voltmeter Name "Vsm1" Show on Position [255, 235] Direction up Flipped off } Component { Type Voltmeter Name "Vsm2" Show on Position [255, 345] Direction up Flipped off } Component { Type Voltmeter Name "Vsm3" Show on Position [255, 455] Direction up Flipped off } Component { Type SignalMux Name "Mux" Show off Position [355, 565] Direction right Flipped off Parameter { Variable "Width" Value "4" Show off } } Component { Type Output Name "voltages" Show on Position [400, 565] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "P" Show on Position [150, 30] Direction down Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "N" Show on Position [150, 565] Direction down Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [70, 290] Direction right Flipped on Parameter { Variable "Width" Value "[2 2 2 2]" Show on } } Component { Type Input Name "states" Show on Position [35, 290] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "SM1" Show on Position [175, 235] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [145, 250; 456, 510] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(2+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM2" Show on Position [175, 345] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [142, 262; 453, 522] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(3+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM3" Show on Position [175, 455] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [144, 249; 455, 509] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(4+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Connection { Type Wire SrcComponent "SM0" SrcTerminal 2 DstComponent "SM1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 2 DstComponent "SM3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 2 DstComponent "SM2" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm3" SrcTerminal 3 Points [295, 455; 295, 580] DstComponent "Mux" DstTerminal 5 } Connection { Type Signal SrcComponent "Vsm2" SrcTerminal 3 Points [305, 345; 305, 570] DstComponent "Mux" DstTerminal 4 } Connection { Type Signal SrcComponent "Vsm1" SrcTerminal 3 Points [315, 235; 315, 560] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Vsm0" SrcTerminal 3 Points [325, 125; 325, 550] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "voltages" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 1 DstComponent "P" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 2 DstComponent "N" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [100, 275; 100, 125] DstComponent "SM0" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 5 Points [100, 305; 100, 455] DstComponent "SM3" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 285; 110, 235] DstComponent "SM1" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [110, 295; 110, 345] DstComponent "SM2" DstTerminal 5 } Connection { Type Signal SrcComponent "states" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 3 Points [160, 75; 255, 75] DstComponent "Vsm0" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 4 Points [160, 285; 255, 285] DstComponent "Vsm1" DstTerminal 2 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 3 Points [160, 295; 255, 295] DstComponent "Vsm2" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 4 Points [160, 175; 255, 175] DstComponent "Vsm0" DstTerminal 2 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 3 Points [160, 185; 255, 185] DstComponent "Vsm1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 4 Points [160, 395; 255, 395] DstComponent "Vsm2" DstTerminal 2 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 3 Points [160, 405; 255, 405] DstComponent "Vsm3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 4 Points [160, 505; 255, 505] DstComponent "Vsm3" DstTerminal 2 } } } Component { Type Port Name "VM" Show on Position [455, 290] Direction left Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Inductor Name "L1" Show on Position [185, 275] Direction left Flipped off Parameter { Variable "L" Value "Lb" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L2" Show on Position [185, 305] Direction left Flipped off Parameter { Variable "L" Value "Lb" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Resistor Name "R1" Show on Position [230, 275] Direction left Flipped off Parameter { Variable "R" Value "Rb" Show off } } Component { Type Resistor Name "R2" Show on Position [230, 305] Direction left Flipped off Parameter { Variable "R" Value "Rb" Show off } } Component { Type Subsystem Name "arm_low" Show on Position [165, 450] Direction up Flipped off Frame [-30, -55; 30, 55] LabelPosition [-33, -58] LabelAlign bottomright SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "arm_idx" Prompt "Arm index (0 to 5)" Type FreeText Value "5" Show off Tunable off TabName "" } Parameter { Variable "Csm" Prompt "Csm" Type FreeText Value "Csm" Show off Tunable off TabName "" } Parameter { Variable "Vsm0" Prompt "Vsm0" Type FreeText Value "Vsm0" Show off Tunable off TabName "" } Parameter { Variable "Rsm" Prompt "Rsm" Type FreeText Value "Rsm" Show off Tunable off TabName "" } Terminal { Type Output Position [34, 25] Direction right } Terminal { Type Port Position [-10, -60] Direction up } Terminal { Type Port Position [-10, 60] Direction down } Terminal { Type Input Position [-30, 5] Direction left } Schematic { Location [128, 215; 614, 834] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 96 Component { Type Subsystem Name "SM0" Show on Position [175, 125] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [148, 247; 459, 507] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(1+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [280, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Voltmeter Name "Vsm0" Show on Position [255, 125] Direction up Flipped off } Component { Type Voltmeter Name "Vsm1" Show on Position [255, 235] Direction up Flipped off } Component { Type Voltmeter Name "Vsm2" Show on Position [255, 345] Direction up Flipped off } Component { Type Voltmeter Name "Vsm3" Show on Position [255, 455] Direction up Flipped off } Component { Type SignalMux Name "Mux" Show off Position [355, 565] Direction right Flipped off Parameter { Variable "Width" Value "4" Show off } } Component { Type Output Name "voltages" Show on Position [400, 565] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "P" Show on Position [150, 30] Direction down Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "N" Show on Position [150, 565] Direction down Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [70, 290] Direction right Flipped on Parameter { Variable "Width" Value "[2 2 2 2]" Show on } } Component { Type Input Name "states" Show on Position [35, 290] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Subsystem Name "SM1" Show on Position [175, 235] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [145, 250; 456, 510] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(2+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM2" Show on Position [175, 345] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [142, 262; 453, 522] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(3+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Component { Type Subsystem Name "SM3" Show on Position [175, 455] Direction up Flipped off Frame [-35, -30; 35, 30] LabelPosition [0, 33] LabelAlign up SampleTime "-1" CodeGenSampleTime "NaN" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Port Position [-25, -35] Direction up } Terminal { Type Port Position [-25, 35] Direction down } Terminal { Type Port Position [-15, -35] Direction up } Terminal { Type Port Position [-15, 35] Direction down } Terminal { Type Input Position [-35, 0] Direction left } Schematic { Location [144, 249; 455, 509] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 80 Component { Type Capacitor Name "Csm" Show on Position [220, 75] Direction up Flipped off Parameter { Variable "C" Value "Csm" Show off } Parameter { Variable "v_init" Value "Vsm0(4+arm_idx)" Show off } } Component { Type Port Name "AP" Show on Position [30, 95] Direction left Flipped on Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "AN" Show on Position [30, 185] Direction left Flipped on Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Port Name "BP" Show on Position [275, 20] Direction right Flipped on Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Resistor Name "Rsm" Show on Position [220, 130] Direction up Flipped off Parameter { Variable "R" Value "Rsm" Show off } } Component { Type Port Name "BN" Show on Position [275, 185] Direction left Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type SignalDemux Name "Demux" Show off Position [75, 225] Direction right Flipped on Parameter { Variable "Width" Value "2" Show off } } Component { Type Input Name "state" Show on Position [30, 225] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type IgbtWithDiode Name "IGBTD" Show on Position [150, 55] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type IgbtWithDiode Name "IGBTD1" Show on Position [150, 150] Direction up Flipped off Parameter { Variable "s_init" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Connection { Type Wire SrcComponent "Csm" SrcTerminal 1 Points [220, 20] Branch { Points [150, 20] DstComponent "IGBTD" DstTerminal 1 } Branch { DstComponent "BP" DstTerminal 1 } } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 1 DstComponent "Csm" DstTerminal 2 } Connection { Type Wire SrcComponent "Rsm" SrcTerminal 2 Points [220, 185] Branch { Points [150, 185] Branch { DstComponent "IGBTD1" DstTerminal 2 } Branch { DstComponent "AN" DstTerminal 1 } } Branch { DstComponent "BN" DstTerminal 1 } } Connection { Type Signal SrcComponent "state" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [105, 220; 105, 55] DstComponent "IGBTD" DstTerminal 3 } Connection { Type Wire SrcComponent "IGBTD" SrcTerminal 2 Points [150, 95] Branch { DstComponent "AP" DstTerminal 1 } Branch { DstComponent "IGBTD1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 230; 110, 150] DstComponent "IGBTD1" DstTerminal 3 } } } Connection { Type Wire SrcComponent "SM0" SrcTerminal 2 DstComponent "SM1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 2 DstComponent "SM3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 2 DstComponent "SM2" DstTerminal 1 } Connection { Type Signal SrcComponent "Vsm3" SrcTerminal 3 Points [295, 455; 295, 580] DstComponent "Mux" DstTerminal 5 } Connection { Type Signal SrcComponent "Vsm2" SrcTerminal 3 Points [305, 345; 305, 570] DstComponent "Mux" DstTerminal 4 } Connection { Type Signal SrcComponent "Vsm1" SrcTerminal 3 Points [315, 235; 315, 560] DstComponent "Mux" DstTerminal 3 } Connection { Type Signal SrcComponent "Vsm0" SrcTerminal 3 Points [325, 125; 325, 550] DstComponent "Mux" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux" SrcTerminal 1 DstComponent "voltages" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 1 DstComponent "P" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 2 DstComponent "N" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [100, 275; 100, 125] DstComponent "SM0" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 5 Points [100, 305; 100, 455] DstComponent "SM3" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 Points [110, 285; 110, 235] DstComponent "SM1" DstTerminal 5 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [110, 295; 110, 345] DstComponent "SM2" DstTerminal 5 } Connection { Type Signal SrcComponent "states" SrcTerminal 1 DstComponent "Demux" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 3 Points [160, 75; 255, 75] DstComponent "Vsm0" DstTerminal 1 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 4 Points [160, 285; 255, 285] DstComponent "Vsm1" DstTerminal 2 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 3 Points [160, 295; 255, 295] DstComponent "Vsm2" DstTerminal 1 } Connection { Type Wire SrcComponent "SM0" SrcTerminal 4 Points [160, 175; 255, 175] DstComponent "Vsm0" DstTerminal 2 } Connection { Type Wire SrcComponent "SM1" SrcTerminal 3 Points [160, 185; 255, 185] DstComponent "Vsm1" DstTerminal 1 } Connection { Type Wire SrcComponent "SM2" SrcTerminal 4 Points [160, 395; 255, 395] DstComponent "Vsm2" DstTerminal 2 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 3 Points [160, 405; 255, 405] DstComponent "Vsm3" DstTerminal 1 } Connection { Type Wire SrcComponent "SM3" SrcTerminal 4 Points [160, 505; 255, 505] DstComponent "Vsm3" DstTerminal 2 } } } Connection { Type Signal SrcComponent "states_U" SrcTerminal 1 DstComponent "arm_up" DstTerminal 4 } Connection { Type Signal SrcComponent "states_L" SrcTerminal 1 DstComponent "arm_low" DstTerminal 4 } Connection { Type Wire SrcComponent "I_U" SrcTerminal 1 DstComponent "arm_up" DstTerminal 3 } Connection { Type Wire SrcComponent "I_L" SrcTerminal 2 DstComponent "arm_low" DstTerminal 2 } Connection { Type Signal SrcComponent "arm_low" SrcTerminal 1 Points [270, 475] DstComponent "Mux1" DstTerminal 3 } Connection { Type Signal SrcComponent "arm_up" SrcTerminal 1 Points [280, 140] DstComponent "Mux1" DstTerminal 2 } Connection { Type Signal SrcComponent "Mux6" SrcTerminal 1 DstComponent "I_U/L" DstTerminal 1 } Connection { Type Signal SrcComponent "Mux1" SrcTerminal 1 DstComponent "Vcaps_U/L" DstTerminal 1 } Connection { Type Signal SrcComponent "I_U" SrcTerminal 3 Points [390, 190] DstComponent "Mux6" DstTerminal 2 } Connection { Type Signal SrcComponent "I_L" SrcTerminal 3 Points [380, 360] DstComponent "Mux6" DstTerminal 3 } Connection { Type Wire SrcComponent "R1" SrcTerminal 2 Points [255, 275; 255, 290] Branch { DstComponent "VM" DstTerminal 1 } Branch { Points [255, 305] DstComponent "R2" DstTerminal 2 } } Connection { Type Wire SrcComponent "R1" SrcTerminal 1 DstComponent "L1" DstTerminal 2 } Connection { Type Wire SrcComponent "R2" SrcTerminal 1 DstComponent "L2" DstTerminal 2 } Connection { Type Wire SrcComponent "I_L" SrcTerminal 1 Points [155, 305] DstComponent "L2" DstTerminal 1 } Connection { Type Wire SrcComponent "arm_low" SrcTerminal 3 Points [155, 540] DstComponent "VEE" DstTerminal 1 } Connection { Type Wire SrcComponent "I_U" SrcTerminal 2 Points [155, 275] DstComponent "L1" DstTerminal 1 } Connection { Type Wire SrcComponent "VDD" SrcTerminal 1 Points [155, 30] DstComponent "arm_up" DstTerminal 2 } } } Connection { Type Wire SrcComponent "V_D" SrcTerminal 1 Points [120, 40] Branch { Points [325, 40] Branch { Points [645, 40] Branch { Points [965, 40] DstComponent "Phase C" DstTerminal 1 } Branch { DstComponent "Phase B" DstTerminal 1 } } Branch { DstComponent "Phase A" DstTerminal 1 } } Branch { Points [80, 40] DstComponent "Vdc_source" DstTerminal 1 } } Connection { Type Wire SrcComponent "V_D" SrcTerminal 2 Points [120, 400] Branch { Points [325, 400] Branch { Points [645, 400] Branch { Points [965, 400] DstComponent "Phase C" DstTerminal 2 } Branch { DstComponent "Phase B" DstTerminal 2 } } Branch { DstComponent "Phase A" DstTerminal 2 } } Branch { Points [80, 400] DstComponent "Vdc_source" DstTerminal 2 } } Connection { Type Wire SrcComponent "3ph Meter" SrcTerminal 4 DstComponent "R1" DstTerminal 2 } Connection { Type Wire SrcComponent "3ph Meter" SrcTerminal 5 DstComponent "R2" DstTerminal 2 } Connection { Type Wire SrcComponent "R1" SrcTerminal 1 Points [1315, 235; 1315, 245] Branch { Points [1330, 245; 1330, 290; 1240, 290] DstComponent "3ph Meter" DstTerminal 9 } Branch { DstComponent "R2" DstTerminal 1 } Branch { Points [1315, 255] DstComponent "R3" DstTerminal 1 } } Connection { Type Wire SrcComponent "3ph Meter" SrcTerminal 6 DstComponent "R3" DstTerminal 2 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 3 DstComponent "Vg_B" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 2 Points [1355, 130; 1355, 110] DstComponent "Vg_A" DstTerminal 1 } Connection { Type Signal SrcComponent "Demux" SrcTerminal 4 Points [1355, 150; 1355, 170] DstComponent "Vg_C" DstTerminal 1 } Connection { Type Signal SrcComponent "PWM_low_A" SrcTerminal 1 DstComponent "Phase A" DstTerminal 5 } Connection { Type Signal SrcComponent "PWM_up_B" SrcTerminal 1 DstComponent "Phase B" DstTerminal 4 } Connection { Type Signal SrcComponent "PWM_low_B" SrcTerminal 1 DstComponent "Phase B" DstTerminal 5 } Connection { Type Signal SrcComponent "3ph Meter" SrcTerminal 8 DstComponent "Goto" DstTerminal 1 } Connection { Type Signal SrcComponent "3ph Meter" SrcTerminal 7 Points [1235, 140] Branch { DstComponent "Sub6" DstTerminal 1 } Branch { DstComponent "Goto1" DstTerminal 1 } } Connection { Type Signal SrcComponent "From" SrcTerminal 1 Points [410, 475; 410, 485] DstComponent "Scope Vsm" DstTerminal 1 } Connection { Type Signal SrcComponent "From1" SrcTerminal 1 DstComponent "Scope Vsm" DstTerminal 2 } Connection { Type Signal SrcComponent "From2" SrcTerminal 1 Points [410, 515; 410, 505] DstComponent "Scope Vsm" DstTerminal 3 } Connection { Type Signal SrcComponent "From3" SrcTerminal 1 Points [590, 475] DstComponent "Scope load" DstTerminal 1 } Connection { Type Signal SrcComponent "From4" SrcTerminal 1 Points [590, 505] DstComponent "Scope load" DstTerminal 2 } Connection { Type Signal SrcComponent "PWM_up_A" SrcTerminal 1 DstComponent "Phase A" DstTerminal 4 } Connection { Type Signal SrcComponent "Sub4" SrcTerminal 2 DstComponent "Vsm_A" DstTerminal 1 } Connection { Type Signal SrcComponent "Sub6" SrcTerminal 2 DstComponent "Demux" DstTerminal 1 } Connection { Type Signal SrcComponent "Sub7" SrcTerminal 2 DstComponent "Vsm_B" DstTerminal 1 } Connection { Type Signal SrcComponent "Sub8" SrcTerminal 2 DstComponent "Vsm_C" DstTerminal 1 } Connection { Type Signal SrcComponent "Sub9" SrcTerminal 2 DstComponent "I_up_low_A" DstTerminal 1 } Connection { Type Signal SrcComponent "Sub10" SrcTerminal 2 DstComponent "I_up_low_B" DstTerminal 1 } Connection { Type Signal SrcComponent "Sub11" SrcTerminal 2 DstComponent "I_up_low_C" DstTerminal 1 } Connection { Type Signal SrcComponent "Phase A" SrcTerminal 6 Points [405, 85] Branch { DstComponent "Sub9" DstTerminal 1 } Branch { DstComponent "Goto5" DstTerminal 1 } } Connection { Type Signal SrcComponent "From5" SrcTerminal 1 Points [740, 475; 740, 485] DstComponent "Scope arm currents" DstTerminal 1 } Connection { Type Signal SrcComponent "From6" SrcTerminal 1 DstComponent "Scope arm currents" DstTerminal 2 } Connection { Type Signal SrcComponent "From7" SrcTerminal 1 Points [740, 515; 740, 505] DstComponent "Scope arm currents" DstTerminal 3 } Connection { Type Signal SrcComponent "Sub5" SrcTerminal 2 DstComponent "Vdc" DstTerminal 1 } Connection { Type Signal SrcComponent "V_D" SrcTerminal 3 DstComponent "Sub5" DstTerminal 1 } Connection { Type Wire SrcComponent "3ph Meter" SrcTerminal 2 DstComponent "Phase B" DstTerminal 7 } Connection { Type Wire SrcComponent "3ph Meter" SrcTerminal 3 DstComponent "Phase C" DstTerminal 7 } Connection { Type Signal SrcComponent "PWM_low_C" SrcTerminal 1 DstComponent "Phase C" DstTerminal 5 } Connection { Type Signal SrcComponent "PWM_up_C" SrcTerminal 1 DstComponent "Phase C" DstTerminal 4 } Connection { Type Wire SrcComponent "3ph Meter" SrcTerminal 1 DstComponent "Phase A" DstTerminal 7 } Connection { Type Signal SrcComponent "Phase B" SrcTerminal 6 Points [725, 85] Branch { DstComponent "Sub10" DstTerminal 1 } Branch { DstComponent "Goto6" DstTerminal 1 } } Connection { Type Signal SrcComponent "Phase C" SrcTerminal 6 Points [1045, 85] Branch { DstComponent "Sub11" DstTerminal 1 } Branch { DstComponent "Goto7" DstTerminal 1 } } Connection { Type Signal SrcComponent "Phase A" SrcTerminal 3 Points [405, 165] Branch { DstComponent "Sub4" DstTerminal 1 } Branch { DstComponent "Goto2" DstTerminal 1 } } Connection { Type Signal SrcComponent "Phase B" SrcTerminal 3 Points [725, 165] Branch { DstComponent "Sub7" DstTerminal 1 } Branch { DstComponent "Goto3" DstTerminal 1 } } Connection { Type Signal SrcComponent "Phase C" SrcTerminal 3 Points [1045, 165] Branch { DstComponent "Sub8" DstTerminal 1 } Branch { DstComponent "Goto4" DstTerminal 1 } } Annotation { Name "Modular Multilevel Converter\nimperix Ltd. 2024" Position [1305, 380] } } } Connection { Type Signal SrcComponent "Plant" SrcTerminal 5 Points [440, 280; 75, 280; 75, 245] DstComponent "Imperix controller" DstTerminal 9 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 4 Points [445, 230; 445, 285; 70, 285; 70, 230] DstComponent "Imperix controller" DstTerminal 6 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 2 Points [450, 215; 450, 290; 65, 290; 65, 215] DstComponent "Imperix controller" DstTerminal 3 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 10 Points [460, 190; 460, 295; 55, 295; 55, 195] DstComponent "Imperix controller" DstTerminal 8 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 7 Points [465, 175; 465, 300; 50, 300; 50, 180] DstComponent "Imperix controller" DstTerminal 5 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 1 Points [470, 160; 470, 305; 45, 305; 45, 165] DstComponent "Imperix controller" DstTerminal 2 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 9 Points [480, 135; 480, 310; 35, 310; 35, 140] DstComponent "Imperix controller" DstTerminal 7 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 8 Points [485, 120; 485, 315; 30, 315; 30, 125] DstComponent "Imperix controller" DstTerminal 4 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 6 Points [490, 105; 490, 320; 25, 320; 25, 110] DstComponent "Imperix controller" DstTerminal 1 } Connection { Type Signal SrcComponent "Plant" SrcTerminal 3 Points [500, 85; 500, 325; 15, 325; 15, 85] DstComponent "Imperix controller" DstTerminal 10 } Connection { Type Signal SrcComponent "Imperix controller" SrcTerminal 12 DstComponent "Plant" DstTerminal 11 } Connection { Type Signal SrcComponent "Imperix controller" SrcTerminal 13 DstComponent "Plant" DstTerminal 12 } Connection { Type Signal SrcComponent "Imperix controller" SrcTerminal 14 DstComponent "Plant" DstTerminal 13 } Connection { Type Signal SrcComponent "Imperix controller" SrcTerminal 15 DstComponent "Plant" DstTerminal 14 } Connection { Type Signal SrcComponent "Imperix controller" SrcTerminal 16 DstComponent "Plant" DstTerminal 16 } Connection { Type Signal SrcComponent "Imperix controller" SrcTerminal 17 DstComponent "Plant" DstTerminal 15 } Annotation { Name "Contains the simulation model of\nthe controlled system." Position [360, 35] } Annotation { Name "Contains the control implementation\nthat can be simulate" "d or executed\non an imperix target\n(B-Box RCP or B-Board PRO)" Position [155, 35] } Annotation { Name "Simulation storyboard:\n\nSubmodules capacitors pre-charg" "ed to 50V\nt = 0s: modulation depth M_inv = 0.2\nt = 0.2s:modulation depth M_" "inv = 0.3\nt = 0.4s: end of simulation" Position [520, 205] HorizontalAlignment "left" } } } DemoSignature "/+yzt3HmnQKxQONy9yM+0J/EvH+SysLBpxqH0X4N/o0="