Plecs { Name "Buck_Cntl" Version "4.0" CircuitModel "ContStateSpace" StartTime "0.0" StopTime "1.0" Solver "radau" MaxStep "1e-5" InitStep "-1" FixedStep "1e-3" Refine "1" ZCStepSize "1e-9" RelTol "1e-3" AbsTol "-1" TurnOnThreshold "0" SyncFixedStepTasks "2" UseSingleCommonBaseRate "2" LossVariableLimitExceededMsg "3" NegativeSwitchLossMsg "3" DivisionByZeroMsg "3" StiffnessDetectionMsg "2" MaxConsecutiveZCs "1000" AssertionAction "1" InitializationCommands "" InitialState "1" SystemState "" CodeGenParameterInlining "2" CodeGenInliningExceptions "AAAACwAAAAAA" CodeGenFloatingPointFormat "2" CodeGenIntegerWordSize "32" CodeGenAbsTimeUsageMsg "3" CodeGenBaseName "" CodeGenOutputDir "" CodeGenExtraOpts "" CodeGenTarget "Generic" CodeGenTargetSettings "" ExtendedMatrixPrecision "1" MatrixSignificanceCheck "2" ExternalModeSettings "" Schematic { Location [97, 615; 663, 971] ZoomFactor 1 SliderPosition [0, 8] ShowBrowser off BrowserWidth 100 Component { Type Step Name "Ref\nvolt" Show on Position [40, 275] Direction right Flipped off Parameter { Variable "Time" Value "0" Show off } Parameter { Variable "Before" Value "0" Show off } Parameter { Variable "After" Value "4" Show off } } Component { Type Sum Name "Sum" Show off Position [115, 275] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "|+-" Show off } } Component { Type VoltageSource Name "V" Show on Position [105, 115] Direction down Flipped on Parameter { Variable "DiscretizationBehavior" Value "2" Show off } Parameter { Variable "StateSpaceInlining" Value "1" Show off } } Component { Type Step Name "Vd" Show on Position [40, 115] Direction right Flipped off Parameter { Variable "Time" Value "0" Show off } Parameter { Variable "Before" Value "8" Show off } Parameter { Variable "After" Value "8" Show off } } Component { Type Diode Name "D1" Show on Position [205, 165] Direction down Flipped off 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 Inductor Name "L1" Show off Position [300, 120] Direction left Flipped off Parameter { Variable "L" Value "5e-6" Show on } Parameter { Variable "i_init" Value "20" Show off } } Component { Type Capacitor Name "C1" Show off Position [330, 170] Direction down Flipped on Parameter { Variable "C" Value "2000e-6" Show on } Parameter { Variable "v_init" Value "0" Show off } } Component { Type Resistor Name "R_Load" Show on Position [420, 165] Direction up Flipped off Parameter { Variable "R" Value "3" Show off } } Component { Type Voltmeter Name "Vo" Show on Position [375, 170] Direction up Flipped off } Component { Type Subsystem Name "PWM" Show on Position [265, 275] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [24, 0] Direction right } Terminal { Type Input Position [-20, 0] Direction left } Schematic { Location [860, 512; 1070, 683] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type RelationalOperator Name "Relational\nOperator" Show on Position [130, 70] Direction right Flipped off Parameter { Variable "Operator" Value "6" Show off } } Component { Type TriangleGenerator Name "Triangular Wave" Show on Position [70, 105] Direction right Flipped off Parameter { Variable "Min" Value "0" Show off } Parameter { Variable "Max" Value "1" Show off } Parameter { Variable "f" Value "100e3" Show off } Parameter { Variable "DutyCycle" Value "0.5" Show off } Parameter { Variable "Delay" Value "0" Show off } } Component { Type Output Name "s" Show on Position [180, 70] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "m" Show on Position [45, 65] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 DstComponent "s" DstTerminal 1 } Connection { Type Signal SrcComponent "m" SrcTerminal 1 DstComponent "Relational\nOperator" DstTerminal 1 } Connection { Type Signal SrcComponent "Triangular Wave" SrcTerminal 1 Points [95, 105; 95, 75] DstComponent "Relational\nOperator" DstTerminal 2 } } } Component { Type MosfetWithDiode Name "FET" Show on Position [205, 90] Direction down 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 Subsystem Name "PID\nController1" Show on Position [185, 275] Direction up Flipped off Frame [-25, -20; 25, 20] LabelPosition [0, 23] LabelAlign up SampleTime "-1" CodeGenTarget "Generic" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Parameter { Variable "fz" Prompt "PD zero" Type FreeText Value "1.85e2" Show off Tunable off TabName "" } Parameter { Variable "fp" Prompt "PD pole" Type FreeText Value "5.4e1" Show off Tunable off TabName "" } Parameter { Variable "Ki" Prompt "PI zero" Type FreeText Value "3.16e3" Show off Tunable off TabName "" } Terminal { Type Input Position [-25, 0] Direction left } Terminal { Type Output Position [29, 0] Direction right } Schematic { Location [531, 413; 1053, 642] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Input Name "Verr" Show on Position [35, 110] 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 [485, 110] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Gain Name "Gain" Show on Position [95, 110] Direction right Flipped off Parameter { Variable "K" Value "0.3" Show off } Parameter { Variable "Multiplication" Value "1" Show off } } Component { Type TransferFunction Name "Transfer Fcn" Show on Position [170, 110] Direction right Flipped off Frame [-30, -15; 30, 15] LabelPosition [0, 18] LabelAlign up Parameter { Variable "Numerator" Value "[1/(fz) 1]" Show off } Parameter { Variable "Denominator" Value "[1/(fp) 1]" Show off } Parameter { Variable "X0" Value "0" Show off } } Component { Type Integrator Name "Integrator" Show on Position [325, 140] Direction right Flipped off Parameter { Variable "ExternalReset" Value "1" Show off } Parameter { Variable "InitialConditionSource" Value "1" Show off } Parameter { Variable "x0" Value "0.1" 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 Gain Name "Ki" Show on Position [265, 140] Direction right Flipped off Parameter { Variable "K" Value "Ki" Show off } Parameter { Variable "Multiplication" Value "1" Show off } } Component { Type Sum Name "Sum" Show off Position [365, 110] Direction up Flipped off Parameter { Variable "IconShape" Value "2" Show off } Parameter { Variable "Inputs" Value "+|+" Show off } } Component { Type Saturation Name "Saturation" Show on Position [425, 110] Direction right Flipped off Parameter { Variable "UpperLimit" Value "0.9" Show off } Parameter { Variable "LowerLimit" Value "0.1" Show off } } Connection { Type Signal SrcComponent "Gain" SrcTerminal 2 DstComponent "Transfer Fcn" DstTerminal 1 } Connection { Type Signal SrcComponent "Ki" SrcTerminal 2 DstComponent "Integrator" DstTerminal 1 } Connection { Type Signal SrcComponent "Integrator" SrcTerminal 2 Points [365, 140] DstComponent "Sum" DstTerminal 3 } Connection { Type Signal SrcComponent "Transfer Fcn" SrcTerminal 2 Points [225, 110] Branch { Points [225, 140] DstComponent "Ki" DstTerminal 1 } Branch { Points [225, 80; 365, 80] DstComponent "Sum" DstTerminal 2 } } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "Saturation" DstTerminal 1 } Connection { Type Signal SrcComponent "Saturation" SrcTerminal 2 DstComponent "m" DstTerminal 1 } Connection { Type Signal SrcComponent "Verr" SrcTerminal 1 DstComponent "Gain" DstTerminal 1 } } } Connection { Type Signal SrcComponent "Vd" SrcTerminal 1 DstComponent "V" DstTerminal 3 } Connection { Type Wire SrcComponent "V" SrcTerminal 2 Points [105, 215; 205, 215] Branch { Points [330, 215] Branch { Points [375, 215] Branch { Points [420, 215] DstComponent "R_Load" DstTerminal 2 } Branch { DstComponent "Vo" DstTerminal 2 } } Branch { DstComponent "C1" DstTerminal 2 } } Branch { DstComponent "D1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Sum" SrcTerminal 1 DstComponent "PID\nController1" DstTerminal 1 } Connection { Type Wire SrcComponent "D1" SrcTerminal 2 Points [205, 120] Branch { DstComponent "L1" DstTerminal 1 } Branch { DstComponent "FET" DstTerminal 2 } } Connection { Type Wire SrcComponent "FET" SrcTerminal 1 Points [205, 35; 105, 35] DstComponent "V" DstTerminal 1 } Connection { Type Wire SrcComponent "C1" SrcTerminal 1 Points [330, 120] Branch { DstComponent "L1" DstTerminal 2 } Branch { Points [375, 120] Branch { DstComponent "Vo" DstTerminal 1 } Branch { Points [420, 120] DstComponent "R_Load" DstTerminal 1 } } } Connection { Type Signal SrcComponent "PID\nController1" SrcTerminal 2 DstComponent "PWM" DstTerminal 2 } Connection { Type Signal SrcComponent "Ref\nvolt" SrcTerminal 1 DstComponent "Sum" DstTerminal 2 } Connection { Type Signal SrcComponent "PWM" SrcTerminal 1 Points [470, 275; 470, 90] DstComponent "FET" DstTerminal 3 } Connection { Type Signal SrcComponent "Vo" SrcTerminal 3 Points [390, 335; 115, 335] DstComponent "Sum" DstTerminal 3 } } }