Plecs { Name "IControl" Version "4.1" CircuitModel "ContStateSpace" StartTime "0.0" StopTime "10e-3" Timeout "" Solver "dopri" MaxStep "1" InitStep "-1" FixedStep "1e-3" Refine "1" ZCStepSize "1e-9" RelTol "1e-6" AbsTol "-1" TurnOnThreshold "0" SyncFixedStepTasks "2" UseSingleCommonBaseRate "2" LossVariableLimitExceededMsg "3" NegativeSwitchLossMsg "3" DivisionByZeroMsg "2" StiffnessDetectionMsg "2" MaxConsecutiveZCs "1000" AssertionAction "1" InitializationCommands "" InitialState "2" SystemState "AAAACAAAAAADAAAAEgBUAGkAbQBlAFMAdABhAG0AcAAAABAAACWCSQPZjZD/A" "AAAFgBTAHQAYQB0AGUAVgBlAGMAdABvAHIAAAB/AAAAABlQbGVjc0FycmF5OjpEb3VibGVWZWN0b3" "IAAAAACD/2Zk4gYcQCQCf///6Vb/hADzM/TP0rGAAAAAAAAAAAP/AAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAOAEMAbwBtAG0AZQBuAHQAAAAKAAAAAAA=" CodeGenParameterInlining "2" CodeGenInliningExceptions "AAAACwAAAAAA" CodeGenFloatingPointFormat "2" CodeGenIntegerWordSize "32" CodeGenAbsTimeUsageMsg "3" CodeGenBaseName "" CodeGenOutputDir "" CodeGenExtraOpts "" CodeGenTarget "Generic" CodeGenTargetSettings "" ExtendedMatrixPrecision "1" MatrixSignificanceCheck "2" EnableStateSpaceSplitting "2" DisplayStateSpaceSplitting "1" DiscretizationMethod "2" ExternalModeSettings "" AlgebraicLoopMethod "1" AlgebraicLoopTolerance "1e-6" Schematic { Location [989, 484; 1734, 786] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Scope Name "Scope" Show on Position [690, 60] Direction up Flipped off Location [1122, 48; 1544, 439] State "AAAA/wAAAAD9AAAAAgAAAAEAAAB4AAABbfwCAAAABPsAAAAQAFoAbwBvA" "G0AQQByAGUAYQAAAAAA/////wAAAFwA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAAAA//" "///wAAAGYA////+wAAABwAUwBpAG0AdQBsAGEAdABpAG8AbgBSAHUAbgBzAAAAAAAAAAFtAAAAAAA" "AAAD7AAAADABUAHIAYQBjAGUAcwAAAAAA/////wAAAGYA////AAAAAwAAAn7////6/AEAAAAB+wAA" "ABQARABhAHQAYQBXAGkAZABnAGUAdAIAAAHgAAABaAAAAMgAAABDAAABpgAAAWwAAAAEAAAABAAAA" "AgAAAAI/AAAAAEAAAACAAAAAQAAAA4AVABvAG8AbABCAGEAcgEAAAAA/////wAAAAAAAAAA" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJAAAAA" "wAAAGQAAAACAAAAZAAAAAEAAABkAAAABwAAAGQAAAAGAAAAZAAAAAUAAABkAAAABAAAAGQAAAAJAA" "AAZAAAAAgAAABkAAAAngAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAB3AAA" "AAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAA" "AAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAA" "AAnAAAAAQAAAAAAAAPoAA==" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAA" "AEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" Axes "2" TimeRange "0.0" ScrollingMode "1" SingleTimeAxis "1" Open "1" Ts "-1" SampleLimit "0" XAxisLabel "" Axis { Name "Load voltage" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "Inductor current" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] Untangle 0 KeepBaseline off BaselineValue 0 } Fourier { SingleXAxis on AxisLabel "Frequency" Scaling 0 PhaseDisplay 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 DCVoltageSource Name "V_dc" Show off Position [355, 220] Direction down Flipped on Parameter { Variable "V" Value "24" Show on } } Component { Type Diode Name "D1" Show off Position [420, 215] Direction up Flipped on Parameter { Variable "Vf" Value "0" Show off } Parameter { Variable "Ron" Value "0" Show off } Parameter { Variable "thermal" Value "" Show off } Parameter { Variable "T_init" Value "0" Show off } } Component { Type Mosfet Name "T1" Show off Position [390, 175] Direction right Flipped on Parameter { Variable "Ron" Value "0" Show 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 Inductor Name "L1" Show off Position [450, 175] Direction left Flipped off Parameter { Variable "L" Value "1e-6" Show on } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Resistor Name "R" Show off Position [560, 220] Direction down Flipped off Parameter { Variable "R" Value "5" Show on } } Component { Type Capacitor Name "C1" Show off Position [515, 220] Direction down Flipped on Parameter { Variable "C" Value "100e-6" Show on } Parameter { Variable "v_init" Value "0" Show off } } Component { Type Voltmeter Name "Vm1" Show off Position [590, 220] Direction up Flipped off } Component { Type Ammeter Name "Am1" Show off Position [490, 175] Direction left Flipped off } Component { Type Switch Name "S1" Show on Position [635, 175] Direction left Flipped off Parameter { Variable "s_init" Value "0" Show off } } Component { Type Resistor Name "R1" Show off Position [665, 220] Direction down Flipped off Parameter { Variable "R" Value "5" Show on } } Component { Type Constant Name "Vref" Show on Position [25, 110] Direction right Flipped off Frame [-10, -10; 10, 10] LabelPosition [0, 13] LabelAlign up Parameter { Variable "Value" Value "12" Show on } } Component { Type Sum Name "Sum" Show off Position [75, 110] Direction up Flipped on Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } } Component { Type Reference SrcComponent "Components/Control/Modulators/Peak Current\\nController" Name "Peak Current\nController" Show on Position [340, 100] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "fs" Value "3e6" Show off } Parameter { Variable "dmin" Value "0" Show off } Parameter { Variable "dmax" Value "99" Show off } Parameter { Variable "Islope" Value "1" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 10] Direction left } Terminal { Type Output Position [24, 0] Direction right } } Component { Type ConfigurableSubsystem Name "PI Voltage\nController" Show on Position [185, 110] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "kp" Prompt "kp" Type FreeText Value "0.5" Show on Tunable off TabName "" } Parameter { Variable "ki" Prompt "ki" Type FreeText Value "2.0e3" Show on Tunable off TabName "" } Parameter { Variable "fs" Prompt "Sample frequency" Type FreeText Value "250e3" Show on Tunable off TabName "" } Parameter { Variable "td" Prompt "Calculation delay" Type FreeText Value "0.1" Show on Tunable off TabName "" } Terminal { Type Output Position [24, 0] Direction right } Terminal { Type Input Position [-20, 0] Direction left } TerminalNames { "y", "e" } Location [200, 370; 641, 568] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Configurations { Name "Digital C-Script-based PI" Schematic { Component { Type CScript Name "C-Script" Show on Position [215, 65] Direction up Flipped off Parameter { Variable "NumInputs" Value "1" Show off } Parameter { Variable "NumOutputs" Value "1" Show off } Parameter { Variable "NumContStates" Value "0" Show off } Parameter { Variable "NumDiscStates" Value "1" Show off } Parameter { Variable "NumZCSignals" Value "0" Show off } Parameter { Variable "DirectFeedthrough" Value "1" Show off } Parameter { Variable "Ts" Value "[1/fs, 0;-2, 0]" Show off } Parameter { Variable "Parameters" Value "kp, ki, 1/fs, td/fs" Show off } Parameter { Variable "LangStandard" Value "2" Show off } Parameter { Variable "RuntimeCheck" Value "2" Show off } Parameter { Variable "Declarations" Value "/** Digital PI controller buck 10-12-10\n *Note t" "hat multiple sample times are used.\n *The fixed sample time causes a hit at " "the beginning of each switching cycle, i.e. a hit\n *is generated at n*Ts.\n " "*The variable sample time is used to cause a hit at the calculation delay tim" "e\n */\n\n#include \n#include \n\n//Global variables & defi" "nes\ndouble yk, ik;\n\n#define ek Input(0)\n#define kp ParamRealData(0,0)\n#d" "efine ki ParamRealData(1,0)\n#define Ts ParamRealData(2,0)\n#define Td ParamR" "ealData(3,0)\n#define ik_1 DiscState(0)\n#define NEVER DBL_MAX \t//a very lar" "ge number" Show off } Parameter { Variable "StartFcn" Value "//Note the first hit will be cause by the fixed t" "ime setting\nNextSampleHit = NEVER;" Show off } Parameter { Variable "OutputFcn" Value "Output(0) = yk;\n" Show off } Parameter { Variable "UpdateFcn" Value "/**Note Update function is called AFTER Output fu" "nction\n * Since the control action is calculated in this function, it will n" "ot be written to the output\n * until the next sample hit.\n */\nif (NextSamp" "leHit == NEVER) //Beginning of cycle. Hit caused by fixed sample time\n{\n i" "k = ik_1 + Ts*ek; \n ik_1 = ik;\n yk = kp*ek + ki*ik; //Will be output at n" "ext simulation step\n NextSampleHit = CurrentTime + Td; //Time at which con" "trol output is written\n}\nelse \n NextSampleHit = NEVER; //Wait for a hit " "caused by a fixed sample time" Show off } Parameter { Variable "DerivativeFcn" Value "" Show off } Parameter { Variable "TerminateFcn" Value "" Show off } } Component { Type Output Name "y" Show on Position [305, 65] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "e" Show on Position [125, 65] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 2 DstComponent "y" DstTerminal 1 } Connection { Type Signal SrcComponent "e" SrcTerminal 1 DstComponent "C-Script" DstTerminal 1 } Annotation { Name "Has multiple time settings" Position [210, 115] } } Name "Analog PI" Schematic { Component { Type Output Name "y" Show on Position [345, 80] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "e" Show on Position [80, 80] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Gain Name "kp" Show off Position [170, 45] Direction right Flipped off Parameter { Variable "K" Value "kp" Show off } Parameter { Variable "Multiplication" Value "1" Show off } } Component { Type Gain Name "ki" Show off Position [170, 115] Direction right Flipped off Parameter { Variable "K" Value "ki" Show off } Parameter { Variable "Multiplication" Value "1" Show off } } Component { Type Integrator Name "Integrator" Show off Position [225, 115] Direction right Flipped off Parameter { Variable "ExternalReset" Value "1" 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 "UpperLimit" Value "inf" Show off } Parameter { Variable "LowerLimit" Value "-inf" Show off } } Component { Type Sum Name "Sum1" Show off Position [290, 80] Direction up Flipped off Parameter { Variable "IconShape" Value "1" Show off } Parameter { Variable "Inputs" Value "++" Show off } } Connection { Type Signal SrcComponent "ki" SrcTerminal 2 DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "kp" SrcTerminal 2 Points [255, 45; 255, 75] DstComponent "Sum1" DstTerminal 2 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [255, 115; 255, 85] DstComponent "Sum1" DstTerminal 3 } Connection { Type Signal SrcComponent "e" SrcTerminal 1 Points [125, 80] Branch { Points [125, 45] DstComponent "kp" DstTerminal 1 } Branch { Points [125, 115] DstComponent "ki" DstTerminal 1 } } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "y" DstTerminal 1 } } } Parameter { Variable "Configuration" Value "2" Show on } } Component { Type Constant Name "Constant" Show off Position [635, 140] Direction down Flipped off Frame [-10, -10; 10, 10] LabelPosition [-13, 0] LabelAlign right Parameter { Variable "Value" Value "0" Show off } } Component { Type SmallSignalPerturbation Name "Perturbation" Show on Position [120, 110] Direction right Flipped off Parameter { Variable "ShowInput" Value "2" Show off } } Component { Type SmallSignalResponse Name "Response" Show on Position [645, 90] Direction right Flipped off Parameter { Variable "ShowReference" Value "1" Show off } Parameter { Variable "InvertReference" Value "1" Show off } } Component { Type Reference SrcComponent "Components/Control/Small Signal Analysis/Loop Gain Meter" Name "Loop Gain Meter" Show on Position [100, 55] Direction up Flipped on Frame [-10, -10; 10, 10] LabelPosition [0, -13] LabelAlign down Parameter { Variable "invert" Value "2" Show off } Terminal { Type Input Position [10, 0] Direction right } Terminal { Type Output Position [-14, 0] Direction left } } Connection { Type Wire SrcComponent "V_dc" SrcTerminal 2 Points [355, 265; 420, 265] Branch { Points [515, 265] Branch { Points [560, 265] Branch { Points [590, 265] Branch { Points [665, 265] DstComponent "R1" DstTerminal 1 } Branch { DstComponent "Vm1" DstTerminal 2 } } Branch { DstComponent "R" DstTerminal 1 } } Branch { DstComponent "C1" DstTerminal 2 } } Branch { DstComponent "D1" DstTerminal 1 } } Connection { Type Wire SrcComponent "L1" SrcTerminal 1 Points [420, 175] Branch { DstComponent "D1" DstTerminal 2 } Branch { DstComponent "T1" DstTerminal 2 } } Connection { Type Wire SrcComponent "S1" SrcTerminal 2 Points [665, 175] DstComponent "R1" DstTerminal 2 } Connection { Type Signal SrcComponent "Vref" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "Peak Current\nController" SrcTerminal 3 Points [390, 100] DstComponent "T1" DstTerminal 3 } Connection { Type Wire SrcComponent "T1" SrcTerminal 1 Points [355, 175] DstComponent "V_dc" DstTerminal 1 } Connection { Type Wire SrcComponent "Am1" SrcTerminal 1 DstComponent "L1" DstTerminal 2 } Connection { Type Wire SrcComponent "Am1" SrcTerminal 2 Points [515, 175] Branch { Points [560, 175] Branch { Points [590, 175] Branch { DstComponent "S1" DstTerminal 1 } Branch { DstComponent "Vm1" DstTerminal 1 } } Branch { DstComponent "R" DstTerminal 2 } } Branch { DstComponent "C1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Am1" SrcTerminal 3 Points [490, 65] Branch { DstComponent "Scope" DstTerminal 2 } Branch { Points [300, 65; 300, 90] DstComponent "Peak Current\nController" DstTerminal 1 } } Connection { Type Signal SrcComponent "Constant" SrcTerminal 1 DstComponent "S1" DstTerminal 3 } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "Perturbation" DstTerminal 2 } Connection { Type Signal SrcComponent "Perturbation" SrcTerminal 1 DstComponent "PI Voltage\nController" DstTerminal 2 } Connection { Type Signal SrcComponent "Vm1" SrcTerminal 3 Points [610, 220; 610, 90] Branch { Points [610, 55] Branch { DstComponent "Scope" DstTerminal 1 } Branch { DstComponent "Loop Gain Meter" DstTerminal 1 } } Branch { DstComponent "Response" DstTerminal 1 } } Connection { Type Signal SrcComponent "PI Voltage\nController" SrcTerminal 1 DstComponent "Peak Current\nController" DstTerminal 2 } Connection { Type Signal SrcComponent "Loop Gain Meter" SrcTerminal 2 Points [75, 55] DstComponent "Sum" DstTerminal 3 } Annotation { Name "Current-controlled buck converter" Position [235, 25] } Annotation { Name "C-Script-based PI controller\nthat simulates a calculatio" "n delay" Position [480, 30] } } Analysis { Type ImpulseResponseAnalysis Name "Error to Output" TimeSpan "-1" StartTime "0" Tolerance "1e-4" MaxIter "20" FrequencyRange "[100 1e6]" FrequencyScale "2" Amplitude "1e-3" NumPoints "300" Perturbation "Perturbation" Response "Response" JacobianPerturbation "1e-4" JacobianCalculation "2" InitCycles "100000" } Analysis { Type ImpulseResponseAnalysis Name "Loop Gain" TimeSpan "-1" StartTime "0" Tolerance "1e-4" MaxIter "20" FrequencyRange "[100 1e6]" FrequencyScale "2" Amplitude "1e-3" NumPoints "300" Perturbation "Loop Gain Meter/Perturbation" Response "Loop Gain Meter/Response" JacobianPerturbation "1e-4" JacobianCalculation "2" InitCycles "100000" } } DemoSignature "3N52yRtq/H5DXk9IDkjF39vCGZZTMa8aKaDW4kpVoz8="