Plecs { Name "3ph_rtbox" Version "4.6" CircuitModel "DiscStateSpace" StartTime "0.0" TimeSpan "0.5" Timeout "" Solver "radau" MaxStep "1e-3" InitStep "-1" FixedStep "1e-4" 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" AlgebraicLoopWithStateMachineMsg "3" AssertionAction "1" InitializationCommands "fs = 2500/2\nTs = 1/fs\nTc = 2*Ts\nfc = fs/2\n\nVdc " "= 120\nN = 8\nn = 8\n%Vcap = Vdc/N\nVcap = 30\nma = 0.7\nL = 5e-3\nC = 10e-3" "\nbias = 1/4\n\n%%current\nkp2 = 0.2197\nki2 = 0.2197\n\n%kp2 = 2.19722/10\n%" "ki2 = 0.0219722\n\n%%voltage\nkp = kp2/10\nki = ki2/10\n\n%%ic1\nkp3 = kp2/10" "\nki3 = ki2/10\n\nRa = 0\n\ndelay = 1e-4\n\nsumref = 480\ndifref = 0" InitialState "1" SystemState "" TaskingMode "1" TaskConfigurations "" CodeGenParameterInlining "2" CodeGenFloatingPointFormat "2" CodeGenAbsTimeUsageMsg "3" CodeGenBaseName "" CodeGenOutputDir "" CodeGenExtraOpts "" CodeGenTarget "PLECS RT Box 1" CodeGenTargetSettings "AAAAfwAAAAAlUU1hcDxRU3RyaW5nLFFNYXA8UVN0cmluZyxRU3Rya" "W5nPiA+AAAAAAEAAAAcAFAATABFAEMAUwAgAFIAVAAgAEIAbwB4ACAAMQAAACEAAAAgAHgAYwBwAF" "MAbABhAHYAZQBJAGQAZQBuAHQAaQB0AHkAAAACADEAAAAQAHgAYwBwAFMAbABhAHYAZQAAAAAAAAA" "eAHMAeQBuAGMAaAByAG8AbgBpAHoAZQBUAGkAbQBlAAAAAgAwAAAAGABzAHQAYQByAHQAdQBwAFMA" "RgBQAF8ASAAAAAIAMAAAABgAcwB0AGEAcgB0AHUAcABTAEYAUABfAEcAAAACADAAAAAYAHMAdABhA" "HIAdAB1AHAAUwBGAFAAXwBGAAAAAgAwAAAAGABzAHQAYQByAHQAdQBwAFMARgBQAF8ARQAAAAIAMA" "AAABgAcwB0AGEAcgB0AHUAcABTAEYAUABfAEQAAAACADAAAAAYAHMAdABhAHIAdAB1AHAAUwBGAFA" "AXwBDAAAAAgAwAAAAGABzAHQAYQByAHQAdQBwAFMARgBQAF8AQgAAAAIAMAAAABgAcwB0AGEAcgB0" "AHUAcABTAEYAUABfAEEAAAACADAAAAAcAHMAaQBtAHUAbABhAHQAaQBvAG4ATQBvAGQAZQAAAAIAM" "QAAABoAcwBhAG0AcABsAGkAbgBnAEQAZQBsAGEAeQAAAAIAMAAAABgAbQBhAHgAXwBvAHYAZQByAH" "IAdQBuAHMAAAAOADEAMAAwADAAMAAwADAAAAASAG0AYQBzAHQAZQByAFMARgBQAAAAAgAxAAAAEgB" "lAG4AYQBiAGwAZQBYAEMAUAAAAAIAMAAAACQAZABpAGcAaQB0AGEAbABPAHUAdABwAHUAdABMAGUA" "dgBlAGwAAAACADEAAAAQAGMAYQBuADIAVAB4AFIAeAAAAAIAMQAAAB4AYwBhAG4AMgBUAGUAcgBtA" "GkAbgBhAHQAaQBvAG4AAAACADIAAAAiAGMAYQBuADIAUgBlAGMAbwB2AGUAcgB5AEQAZQBsAGEAeQ" "AAAAIAMAAAABQAYwBhAG4AMgBFAG4AYQBiAGwAZQAAAAIAMAAAABAAYwBhAG4AMgBCAGEAdQBkAAA" "ADAA1ADAAMAAwADAAMAAAABAAYwBhAG4AMQBUAHgAUgB4AAAAAgAxAAAAHgBjAGEAbgAxAFQAZQBy" "AG0AaQBuAGEAdABpAG8AbgAAAAIAMgAAACIAYwBhAG4AMQBSAGUAYwBvAHYAZQByAHkARABlAGwAY" "QB5AAAAAgAwAAAAFABjAGEAbgAxAEUAbgBhAGIAbABlAAAAAgAwAAAAEABjAGEAbgAxAEIAYQB1AG" "QAAAAMADUAMAAwADAAMAAwAAAAHABhAG4AYQBsAG8AZwBTAGEAbQBwAGwAaQBuAGcAAAACADEAAAA" "iAGEAbgBhAGwAbwBnAE8AdQB0AHAAdQB0AFIAYQBuAGcAZQAAAAIAMQAAACAAYQBuAGEAbABvAGcA" "SQBuAHAAdQB0AFIAYQBuAGcAZQAAAAIAMQAAAEoAVQBTAEUAXwBEAEEAVABBAF8AVABZAFAARQBTA" "F8ARgBPAFIAXwBUAFUATgBBAEIATABFAF8AUABBAFIAQQBNAEUAVABFAFIAUwAAAAIAMQAAABoAVA" "BBAFIARwBFAFQAXwBEAEUAVgBJAEMARQAAADAAcgB0AGIAbwB4AC0AMgAwAGIAMABmADcAMAA1ADQ" "AMwAxAGMALgBsAG8AYwBhAGwAAAAaAEUAWABUAEUAUgBOAEEATABfAE0ATwBEAEUAAAACADE=" ExtendedMatrixPrecision "1" MatrixSignificanceCheck "2" EnableStateSpaceSplitting "2" DisplayStateSpaceSplitting "1" DiscretizationMethod "2" ExternalModeSettings "AAAAfwAAAAAWUU1hcDxRU3RyaW5nLFFTdHJpbmc+AAAAAAYAAAAYAF" "QAcgBpAGcAZwBlAHIAVgBhAGwAdQBlAAAAAgAwAAAAGABUAHIAaQBnAGcAZQByAEQAZQBsAGEAeQA" "AAAIAMAAAABYAUwBlAG4AcwBpAHQAaQB2AGkAdAB5AAAAAgAwAAAAFgBSAGUAZgByAGUAcwBoAFIA" "YQB0AGUAAAAEADIAMAAAABQATgB1AG0AUwBhAG0AcABsAGUAcwAAAAoAMQAwADAAMAAwAAAAFABEA" "GUAYwBpAG0AYQB0AGkAbwBuAAAAAgA0" AlgebraicLoopMethod "1" AlgebraicLoopTolerance "1e-6" ScriptsDialogGeometry "" ScriptsDialogSplitterPos "0" Schematic { Location [0, 26; 1536, 780] ZoomFactor 1 SliderPosition [-1, 893] ShowBrowser off BrowserWidth 100 Component { Type Reference SrcComponent "Components/Electrical/Power Modules/MFB1" Name "MFB1" Show on Position [685, 125] Direction up Flipped off Frame [-60, -60; 60, 60] LabelPosition [-45, 0] LabelAlign right Parameter { Variable "semiSymbol" Value "1" Show off } Parameter { Variable "N" Value "8" Show off } Parameter { Variable "assert" Value "2" Show off } Parameter { Variable "Configuration" Value "2" Show off } Terminal { Type Input Position [-60, -30] Direction left } Terminal { Type Port Position [65, -5] Direction right } Terminal { Type Port Position [65, 5] Direction right } Terminal { Type Port Position [-65, -55] Direction left } Terminal { Type Input Position [-60, 30] Direction left } Terminal { Type Port Position [-65, 55] Direction left } Terminal { Type Input Position [20, -30] Direction left } Terminal { Type Input Position [20, 30] Direction left } } Component { Type From Name "From3" Show off Position [595, 95] Direction right Flipped off Parameter { Variable "Tag" Value "s1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From4" Show off Position [685, 95] Direction right Flipped off Parameter { Variable "Tag" Value "s3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From8" Show off Position [590, 155] Direction right Flipped off Parameter { Variable "Tag" Value "s2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From9" Show off Position [685, 155] Direction right Flipped off Parameter { Variable "Tag" Value "s4" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Reference SrcComponent "Components/Electrical/Power Modules/MFB1" Name "MFB2" Show on Position [685, 470] Direction up Flipped off Frame [-60, -60; 60, 60] LabelPosition [-45, 0] LabelAlign right Parameter { Variable "semiSymbol" Value "1" Show off } Parameter { Variable "N" Value "8" Show off } Parameter { Variable "assert" Value "2" Show off } Parameter { Variable "Configuration" Value "2" Show off } Terminal { Type Input Position [-60, -30] Direction left } Terminal { Type Port Position [65, -5] Direction right } Terminal { Type Port Position [65, 5] Direction right } Terminal { Type Port Position [-65, -55] Direction left } Terminal { Type Input Position [-60, 30] Direction left } Terminal { Type Port Position [-65, 55] Direction left } Terminal { Type Input Position [20, -30] Direction left } Terminal { Type Input Position [20, 30] Direction left } } Component { Type From Name "From10" Show off Position [595, 440] Direction right Flipped off Parameter { Variable "Tag" Value "s1d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From11" Show off Position [680, 440] Direction right Flipped off Parameter { Variable "Tag" Value "s3d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From12" Show off Position [590, 500] Direction right Flipped off Parameter { Variable "Tag" Value "s2d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From13" Show off Position [680, 500] Direction right Flipped off Parameter { Variable "Tag" Value "s4d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Ground Name "Ground1" Show off Position [1510, 315] Direction up Flipped off } Component { Type Resistor Name "R2" Show on Position [370, 275] Direction up Flipped off Parameter { Variable "R" Value "20" Show off } } Component { Type DCVoltageSource Name "V_dc1" Show on Position [1480, 205] Direction down Flipped on Parameter { Variable "V" Value "50" Show off } } Component { Type DCVoltageSource Name "V_dc3" Show on Position [1475, 425] Direction down Flipped on Parameter { Variable "V" Value "50" Show off } } Component { Type Reference SrcComponent "Components/Electrical/Power Modules/MFB1" Name "MFB3" Show on Position [980, 120] Direction up Flipped off Frame [-60, -60; 60, 60] LabelPosition [-45, 0] LabelAlign right Parameter { Variable "semiSymbol" Value "1" Show off } Parameter { Variable "N" Value "8" Show off } Parameter { Variable "assert" Value "2" Show off } Parameter { Variable "Configuration" Value "2" Show off } Terminal { Type Input Position [-60, -30] Direction left } Terminal { Type Port Position [65, -5] Direction right } Terminal { Type Port Position [65, 5] Direction right } Terminal { Type Port Position [-65, -55] Direction left } Terminal { Type Input Position [-60, 30] Direction left } Terminal { Type Port Position [-65, 55] Direction left } Terminal { Type Input Position [20, -30] Direction left } Terminal { Type Input Position [20, 30] Direction left } } Component { Type From Name "From5" Show off Position [890, 90] Direction right Flipped off Parameter { Variable "Tag" Value "s1_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From6" Show off Position [980, 90] Direction right Flipped off Parameter { Variable "Tag" Value "s3_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From14" Show off Position [885, 150] Direction right Flipped off Parameter { Variable "Tag" Value "s2_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From15" Show off Position [980, 150] Direction right Flipped off Parameter { Variable "Tag" Value "s4_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Reference SrcComponent "Components/Electrical/Power Modules/MFB1" Name "MFB4" Show on Position [980, 465] Direction up Flipped off Frame [-60, -60; 60, 60] LabelPosition [-45, 0] LabelAlign right Parameter { Variable "semiSymbol" Value "1" Show off } Parameter { Variable "N" Value "8" Show off } Parameter { Variable "assert" Value "2" Show off } Parameter { Variable "Configuration" Value "2" Show off } Terminal { Type Input Position [-60, -30] Direction left } Terminal { Type Port Position [65, -5] Direction right } Terminal { Type Port Position [65, 5] Direction right } Terminal { Type Port Position [-65, -55] Direction left } Terminal { Type Input Position [-60, 30] Direction left } Terminal { Type Port Position [-65, 55] Direction left } Terminal { Type Input Position [20, -30] Direction left } Terminal { Type Input Position [20, 30] Direction left } } Component { Type From Name "From16" Show off Position [890, 435] Direction right Flipped off Parameter { Variable "Tag" Value "s1d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From17" Show off Position [980, 435] Direction right Flipped off Parameter { Variable "Tag" Value "s3d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From18" Show off Position [885, 495] Direction right Flipped off Parameter { Variable "Tag" Value "s2d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From19" Show off Position [975, 495] Direction right Flipped off Parameter { Variable "Tag" Value "s4d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Reference SrcComponent "Components/Electrical/Power Modules/MFB1" Name "MFB5" Show on Position [1275, 120] Direction up Flipped off Frame [-60, -60; 60, 60] LabelPosition [-45, 0] LabelAlign right Parameter { Variable "semiSymbol" Value "1" Show off } Parameter { Variable "N" Value "8" Show off } Parameter { Variable "assert" Value "2" Show off } Parameter { Variable "Configuration" Value "2" Show off } Terminal { Type Input Position [-60, -30] Direction left } Terminal { Type Port Position [65, -5] Direction right } Terminal { Type Port Position [65, 5] Direction right } Terminal { Type Port Position [-65, -55] Direction left } Terminal { Type Input Position [-60, 30] Direction left } Terminal { Type Port Position [-65, 55] Direction left } Terminal { Type Input Position [20, -30] Direction left } Terminal { Type Input Position [20, 30] Direction left } } Component { Type From Name "From7" Show off Position [1185, 90] Direction right Flipped off Parameter { Variable "Tag" Value "s1_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From20" Show off Position [1275, 90] Direction right Flipped off Parameter { Variable "Tag" Value "s3_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From21" Show off Position [1180, 150] Direction right Flipped off Parameter { Variable "Tag" Value "s2_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From22" Show off Position [1275, 150] Direction right Flipped off Parameter { Variable "Tag" Value "s4_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Reference SrcComponent "Components/Electrical/Power Modules/MFB1" Name "MFB6" Show on Position [1275, 465] Direction up Flipped off Frame [-60, -60; 60, 60] LabelPosition [-45, 0] LabelAlign right Parameter { Variable "semiSymbol" Value "1" Show off } Parameter { Variable "N" Value "8" Show off } Parameter { Variable "assert" Value "2" Show off } Parameter { Variable "Configuration" Value "2" Show off } Terminal { Type Input Position [-60, -30] Direction left } Terminal { Type Port Position [65, -5] Direction right } Terminal { Type Port Position [65, 5] Direction right } Terminal { Type Port Position [-65, -55] Direction left } Terminal { Type Input Position [-60, 30] Direction left } Terminal { Type Port Position [-65, 55] Direction left } Terminal { Type Input Position [20, -30] Direction left } Terminal { Type Input Position [20, 30] Direction left } } Component { Type From Name "From23" Show off Position [1185, 435] Direction right Flipped off Parameter { Variable "Tag" Value "s1d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From24" Show off Position [1275, 435] Direction right Flipped off Parameter { Variable "Tag" Value "s3d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From25" Show off Position [1180, 495] Direction right Flipped off Parameter { Variable "Tag" Value "s2d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From26" Show off Position [1270, 495] Direction right Flipped off Parameter { Variable "Tag" Value "s4d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Resistor Name "R3" Show on Position [415, 275] Direction up Flipped off Parameter { Variable "R" Value "20" Show off } } Component { Type Resistor Name "R4" Show on Position [455, 290] Direction up Flipped off Parameter { Variable "R" Value "20" Show off } } Component { Type Label Name "Label" Show off Position [385, 215] Direction up Flipped off Parameter { Variable "Tag" Value "a" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Label Name "Label1" Show off Position [440, 215] Direction up Flipped off Parameter { Variable "Tag" Value "b" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Label Name "Label2" Show off Position [495, 210] Direction up Flipped off Parameter { Variable "Tag" Value "c" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Capacitor Name "C1" Show on Position [510, 120] Direction down Flipped on Parameter { Variable "C" Value "C" Show off } Parameter { Variable "v_init" Value "Vcap" Show off } } Component { Type Capacitor Name "C2" Show on Position [510, 470] Direction down Flipped on Parameter { Variable "C" Value "C" Show off } Parameter { Variable "v_init" Value "Vcap" Show off } } Component { Type Capacitor Name "C3" Show on Position [805, 115] Direction down Flipped on Parameter { Variable "C" Value "C" Show off } Parameter { Variable "v_init" Value "Vcap" Show off } } Component { Type Capacitor Name "C4" Show on Position [1100, 120] Direction down Flipped on Parameter { Variable "C" Value "C" Show off } Parameter { Variable "v_init" Value "Vcap" Show off } } Component { Type Capacitor Name "C5" Show on Position [805, 460] Direction down Flipped on Parameter { Variable "C" Value "C" Show off } Parameter { Variable "v_init" Value "Vcap" Show off } } Component { Type Capacitor Name "C6" Show on Position [1100, 460] Direction down Flipped on Parameter { Variable "C" Value "C" Show off } Parameter { Variable "v_init" Value "Vcap" Show off } } Component { Type Voltmeter Name "Vm4" Show on Position [460, 125] Direction up Flipped off } Component { Type Ammeter Name "Am1" Show on Position [695, 230] Direction right Flipped off } Component { Type Ammeter Name "Am2" Show on Position [635, 250] Direction right Flipped off } Component { Type Ammeter Name "Am3" Show on Position [725, 260] Direction right Flipped off } Component { Type Voltmeter Name "Vm5" Show on Position [460, 475] Direction up Flipped off } Component { Type Goto Name "Goto24" Show off Position [530, 490] Direction right Flipped off Parameter { Variable "Tag" Value "vc2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto25" Show off Position [560, 55] Direction right Flipped off Parameter { Variable "Tag" Value "vc1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Voltmeter Name "Vm6" Show on Position [780, 100] Direction up Flipped off } Component { Type Goto Name "Goto" Show off Position [835, 100] Direction right Flipped off Parameter { Variable "Tag" Value "vc3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Voltmeter Name "Vm7" Show on Position [780, 445] Direction up Flipped off } Component { Type Voltmeter Name "Vm8" Show on Position [1075, 100] Direction up Flipped off } Component { Type Voltmeter Name "Vm9" Show on Position [1075, 445] Direction up Flipped off } Component { Type Goto Name "Goto1" Show off Position [830, 445] Direction right Flipped off Parameter { Variable "Tag" Value "vc4" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto2" Show off Position [1120, 100] Direction right Flipped off Parameter { Variable "Tag" Value "vc5" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto3" Show off Position [1125, 445] Direction right Flipped off Parameter { Variable "Tag" Value "vc6" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto4" Show off Position [740, 300] Direction right Flipped off Parameter { Variable "Tag" Value "i1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto5" Show off Position [620, 290] Direction left Flipped off Parameter { Variable "Tag" Value "i2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto6" Show off Position [750, 285] Direction right Flipped off Parameter { Variable "Tag" Value "i3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Inductor Name "L1" Show on Position [770, 205] Direction up Flipped off Parameter { Variable "L" Value "L" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L2" Show on Position [765, 430] Direction up Flipped off Parameter { Variable "L" Value "L" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L9" Show on Position [455, 350] Direction up Flipped off Parameter { Variable "L" Value "5e-3" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L8" Show on Position [415, 350] Direction up Flipped off Parameter { Variable "L" Value "5e-3" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L4" Show on Position [370, 350] Direction up Flipped off Parameter { Variable "L" Value "5e-3" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L3" Show on Position [1065, 200] Direction up Flipped off Parameter { Variable "L" Value "L" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L5" Show on Position [1065, 405] Direction up Flipped off Parameter { Variable "L" Value "L" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L6" Show on Position [1360, 200] Direction up Flipped off Parameter { Variable "L" Value "L" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Inductor Name "L7" Show on Position [1360, 430] Direction up Flipped off Parameter { Variable "L" Value "L" Show off } Parameter { Variable "i_init" Value "0" Show off } } Component { Type Ammeter Name "Am4" Show on Position [770, 165] Direction up Flipped off } Component { Type Ammeter Name "Am5" Show on Position [765, 390] Direction up Flipped off } Component { Type Ammeter Name "Am6" Show on Position [1065, 155] Direction up Flipped off } Component { Type Ammeter Name "Am7" Show on Position [1065, 365] Direction up Flipped off } Component { Type Ammeter Name "Am8" Show on Position [1360, 155] Direction up Flipped off } Component { Type Ammeter Name "Am9" Show on Position [1360, 390] Direction up Flipped off } Component { Type Goto Name "Goto7" Show off Position [825, 195] Direction right Flipped off Parameter { Variable "Tag" Value "iu1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto8" Show off Position [1125, 205] Direction right Flipped off Parameter { Variable "Tag" Value "iu2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto9" Show off Position [1405, 155] Direction right Flipped off Parameter { Variable "Tag" Value "iu3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto10" Show off Position [815, 335] Direction right Flipped off Parameter { Variable "Tag" Value "id1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto11" Show off Position [1105, 365] Direction right Flipped off Parameter { Variable "Tag" Value "id2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto12" Show off Position [1395, 390] Direction right Flipped off Parameter { Variable "Tag" Value "id3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type TriangleGenerator Name "Triangular Wave1" Show on Position [45, 225] Direction right Flipped off Parameter { Variable "Min" Value "0" Show off } Parameter { Variable "Max" Value "1" Show off } Parameter { Variable "f" Value "fc" Show off } Parameter { Variable "DutyCycle" Value "0.5" Show off } Parameter { Variable "Delay" Value "0" Show off } } Component { Type Goto Name "Goto15" Show off Position [105, 225] Direction right Flipped off Parameter { Variable "Tag" Value "vcar" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type TriangleGenerator Name "Triangular Wave2" Show on Position [175, 220] Direction right Flipped off Parameter { Variable "Min" Value "0" Show off } Parameter { Variable "Max" Value "1" Show off } Parameter { Variable "f" Value "fc" Show off } Parameter { Variable "DutyCycle" Value "0.5" Show off } Parameter { Variable "Delay" Value "Tc/2" Show off } } Component { Type Goto Name "Goto17" Show off Position [240, 220] Direction right Flipped off Parameter { Variable "Tag" Value "vcard" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Sub" Show on Position [100, 295] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Schematic { Location [363, 124; 1004, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop" Show on Position [220, 285] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant2" Show on Position [140, 240] 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 Scope Name "Scope2" Show on Position [345, 280] Direction up Flipped off Location [0, 27; 1366, 712] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAFwA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAABVYAAAKS" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAAvAAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "YAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" Axes "2" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 Comparator Name "Comparator" Show on Position [280, 145] Direction right Flipped off } Component { Type RelationalOperator Name "Relational\nOperator" Show on Position [445, 155] Direction right Flipped off Parameter { Variable "Operator" Value "2" Show off } } Component { Type Goto Name "Goto" Show off Position [535, 155] Direction right Flipped off Parameter { Variable "Tag" Value "pulse" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Scope Name "Scope" Show on Position [505, 110] Direction up Flipped off Location [0, 27; 1366, 712] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAADQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAVWAAA" "AY/wBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQBAAAAAAAABVYAAABQAP///wAABVYAAAIr" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAFVgAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "mAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAASwAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" Axes "1" TimeRange "0.0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 } } } Component { Type Scope Name "Scope3" Show on Position [260, 70] Direction up Flipped off Location [0, 27; 1366, 712] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAFwA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAABVYAAAKS" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAAtwAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "TAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" Axes "2" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 "From" Show off Position [90, 285] Direction right Flipped off Parameter { Variable "Tag" Value "pulse" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Scope Name "Scope1" Show on Position [375, 60] Direction up Flipped off Location [363, 124; 713, 351] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAADQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAAAV4AAADI" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAAoQAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAB" "9AAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" Axes "1" TimeRange "0.0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 } } } Component { Type Input Name "carrier" Show on Position [100, 140] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "slope" Show on Position [405, 100] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Q" Show on Position [295, 235] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Delay Name "Delay" Show on Position [185, 175] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Component { Type Delay Name "Delay1" Show on Position [365, 180] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Connection { Type Signal SrcComponent "JK Flip-flop" SrcTerminal 3 Points [260, 275] Branch { DstComponent "Scope2" DstTerminal 1 } Branch { Points [260, 235] DstComponent "Q" DstTerminal 1 } } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [170, 240] Branch { Points [180, 240; 180, 275] DstComponent "JK Flip-flop" DstTerminal 1 } Branch { Points [170, 295] DstComponent "JK Flip-flop" DstTerminal 5 } } Connection { Type Signal SrcComponent "Comparator" SrcTerminal 3 Points [315, 145] Branch { Points [335, 145] Branch { Points [395, 145; 395, 150] DstComponent "Relational\nOperator" DstTerminal 1 } Branch { Points [335, 100; 345, 100] Branch { DstComponent "slope" DstTerminal 1 } Branch { DstComponent "Scope1" DstTerminal 1 } } } Branch { Points [315, 180] DstComponent "Delay1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Delay1" SrcTerminal 2 Points [400, 180; 400, 160] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 Points [475, 155] Branch { DstComponent "Goto" DstTerminal 1 } Branch { DstComponent "Scope" DstTerminal 1 } } Connection { Type Signal SrcComponent "From" SrcTerminal 1 Points [185, 285] Branch { DstComponent "JK Flip-flop" DstTerminal 2 } Branch { DstComponent "Scope2" DstTerminal 2 } } Connection { Type Signal SrcComponent "Delay" SrcTerminal 2 Points [220, 175; 220, 150; 225, 150] Branch { DstComponent "Comparator" DstTerminal 2 } Branch { Points [225, 75] DstComponent "Scope3" DstTerminal 2 } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [150, 140] Branch { Points [180, 140] Branch { DstComponent "Comparator" DstTerminal 1 } Branch { Points [180, 65] DstComponent "Scope3" DstTerminal 1 } } Branch { Points [150, 175] DstComponent "Delay" DstTerminal 1 } } } } Component { Type From Name "From" Show off Position [45, 290] Direction right Flipped off Parameter { Variable "Tag" Value "vcar" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Sub1" Show on Position [95, 370] Direction up Flipped off Frame [-30, -25; 30, 25] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Schematic { Location [363, 124; 1004, 567] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop" Show on Position [220, 285] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant2" Show on Position [140, 240] 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 Scope Name "Scope2" Show on Position [310, 280] Direction up Flipped off Location [0, 27; 1366, 712] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAFwA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAABVYAAAKS" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAABQAAAGQAAAAEAAAAZAAAAAkAAABkAAAACAAAAGQAAAADAAAAZAAAAAIAAABkAAAAAQAAAGQAAA" "AHAAAAZAAAAAYAAABkAAAAvAAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "YAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" Axes "2" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 Comparator Name "Comparator" Show on Position [280, 145] Direction right Flipped off } Component { Type RelationalOperator Name "Relational\nOperator" Show on Position [445, 155] Direction right Flipped off Parameter { Variable "Operator" Value "2" Show off } } Component { Type Goto Name "Goto" Show off Position [535, 155] Direction right Flipped off Parameter { Variable "Tag" Value "pulse" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Scope Name "Scope" Show on Position [505, 110] Direction up Flipped off Location [0, 27; 1366, 712] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAADQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAVWAAA" "AY/wBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQBAAAAAAAABVYAAABQAP///wAABVYAAAIr" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAFVgAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "mAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAASwAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" Axes "1" TimeRange "0.0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 } } } Component { Type Scope Name "Scope3" Show on Position [260, 70] Direction up Flipped off Location [0, 27; 1366, 712] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAAFwA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAABVYAAAKS" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAAtwAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAC" "TAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "QAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" Axes "2" TimeRange "0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] Untangle 0 KeepBaseline off BaselineValue 0 } Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 "From" Show off Position [90, 285] Direction right Flipped off Parameter { Variable "Tag" Value "pulse" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Scope Name "Scope1" Show on Position [375, 60] Direction up Flipped off Location [0, 23; 1366, 708] State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAb" "wBvAG0AQQByAGUAYQAAAAAA/////wAAADQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAA" "AA/////wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAA" "AAPwBAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAABVYAAAKS" "AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AA" "AAAAAAAAA==" SavedViews "AAAAAgAAAAA=" HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJA" "AAACAAAAGQAAAAJAAAAZAAAAAQAAABkAAAABQAAAGQAAAAGAAAAZAAAAAcAAABkAAAAAQAAAGQAAA" "ACAAAAZAAAAAMAAABkAAAAoQAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAAB" "9AAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAA" "AAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAA" "AAAAAAkAAAAAQAAAAAAAAPoAAAAACQ=" PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" Axes "1" TimeRange "0.0" ScrollingMode "1" SingleTimeAxis "1" Open "0" Ts "-1" SampleLimit "0" XAxisLabel "" ShowLegend "1" Axis { Name "" AutoScale 1 MinValue 0 MaxValue 1 Signals {} SignalTypes [ ] 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 } } } Component { Type Input Name "carrier" Show on Position [100, 140] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "slope" Show on Position [405, 100] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Q" Show on Position [295, 235] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Delay Name "Delay" Show on Position [185, 175] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Component { Type Delay Name "Delay1" Show on Position [365, 180] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Connection { Type Signal SrcComponent "JK Flip-flop" SrcTerminal 3 Points [260, 275] Branch { DstComponent "Scope2" DstTerminal 1 } Branch { Points [260, 235] DstComponent "Q" DstTerminal 1 } } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [170, 240] Branch { Points [180, 240; 180, 275] DstComponent "JK Flip-flop" DstTerminal 1 } Branch { Points [170, 295] DstComponent "JK Flip-flop" DstTerminal 5 } } Connection { Type Signal SrcComponent "Comparator" SrcTerminal 3 Points [315, 145] Branch { Points [335, 145] Branch { Points [395, 145; 395, 150] DstComponent "Relational\nOperator" DstTerminal 1 } Branch { Points [335, 100; 345, 100] Branch { DstComponent "slope" DstTerminal 1 } Branch { DstComponent "Scope1" DstTerminal 1 } } } Branch { Points [315, 180] DstComponent "Delay1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Delay1" SrcTerminal 2 Points [400, 180; 400, 160] DstComponent "Relational\nOperator" DstTerminal 2 } Connection { Type Signal SrcComponent "Relational\nOperator" SrcTerminal 3 Points [475, 155] Branch { DstComponent "Goto" DstTerminal 1 } Branch { DstComponent "Scope" DstTerminal 1 } } Connection { Type Signal SrcComponent "From" SrcTerminal 1 Points [185, 285] Branch { DstComponent "JK Flip-flop" DstTerminal 2 } Branch { DstComponent "Scope2" DstTerminal 2 } } Connection { Type Signal SrcComponent "Delay" SrcTerminal 2 Points [220, 175; 220, 150; 225, 150] Branch { DstComponent "Comparator" DstTerminal 2 } Branch { Points [225, 75] DstComponent "Scope3" DstTerminal 2 } } Connection { Type Signal SrcComponent "carrier" SrcTerminal 1 Points [150, 140] Branch { Points [180, 140] Branch { DstComponent "Comparator" DstTerminal 1 } Branch { Points [180, 65] DstComponent "Scope3" DstTerminal 1 } } Branch { Points [150, 175] DstComponent "Delay" DstTerminal 1 } } } } Component { Type From Name "From27" Show off Position [40, 365] Direction right Flipped off Parameter { Variable "Tag" Value "vcard" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto16" Show off Position [165, 290] Direction right Flipped off Parameter { Variable "Tag" Value "slope" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto18" Show off Position [150, 365] Direction right Flipped off Parameter { Variable "Tag" Value "sloped" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto19" Show off Position [170, 315] Direction right Flipped off Parameter { Variable "Tag" Value "Q" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto20" Show off Position [160, 380] Direction right Flipped off Parameter { Variable "Tag" Value "Qd" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "S_1U" Show on Position [80, 460] Direction up Flipped off Frame [-30, -35; 30, 35] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Terminal { Type Output Position [34, 15] Direction right } Terminal { Type Output Position [34, 25] Direction right } Schematic { Location [0, 27; 1366, 681] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script4" Show on Position [395, 170] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 29 1920 991]" Show off } Parameter { Variable "NumInputs" Value "-1" Show off } Parameter { Variable "NumOutputs" Value "[-1 -1 -1 -1]" 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 "n" 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 S1 OutputSignal(0)\n" "//#define S2 OutputSignal(1)\n" "//#define S3 OutputSignal(2)\n" "//#define S4 OutputSignal(3)\n" "static int idx = 0;\n" "static int k;\n" "static int n;\n" "#define Nl 8\n" "static int p[Nl];\n" "static int s1[Nl];\n" "static int s2[Nl];\n" "static int s3[Nl];\n" "static int s4[Nl];\n" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " p[k] = InputSignal(0,k);\n" "\n" "for(k = 0; k < n; k++){\n" "\n" "if (p[k] == 1)\n" "{\n" " s1[k] = s4[k] = 1;\n" " s2[k] = s3[k] = 0;\n" "}\n" "else if(p[k] == -1)\n" "{\n" " s1[k] = s4[k] = 0;\n" " s2[k] = s3[k] = 1;\n" "}\n" "else\n" "{ \n" " if (idx%2 == 0)\n" " {\n" " s1[k] = s3[k] = 1;\n" " s2[k] = s4[k] = 0;\n" " }\n" " else\n" " {\n" " s1[k] = s3[k] = 0;\n" " s2[k] = s4[k] = 1;\n" " }\n" " idx++;\n" " }\n" "}\n" "\n" "for(k = 0; k < n; k++)\n" " OutputSignal(0,k) = s1[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(1,k) = s2[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(2,k) = s3[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(3,k) = s4[k]; " 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 Input Name "P" Show on Position [315, 170] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S1" Show on Position [480, 120] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S2" Show on Position [475, 165] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S3" Show on Position [475, 200] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S4" Show on Position [475, 235] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 2 Points [435, 155; 435, 120] DstComponent "S1" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "S2" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 4 Points [440, 175; 440, 200] DstComponent "S3" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 5 Points [435, 185; 435, 235] DstComponent "S4" DstTerminal 1 } } } Component { Type From Name "From2" Show off Position [20, 455] Direction right Flipped off Parameter { Variable "Tag" Value "P" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto21" Show off Position [150, 415] Direction right Flipped off Parameter { Variable "Tag" Value "s1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto22" Show off Position [150, 435] Direction right Flipped off Parameter { Variable "Tag" Value "s2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto23" Show off Position [150, 455] Direction right Flipped off Parameter { Variable "Tag" Value "s3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto26" Show off Position [145, 485] Direction right Flipped off Parameter { Variable "Tag" Value "s4" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "S_1D" Show on Position [85, 565] Direction up Flipped off Frame [-30, -35; 30, 35] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Terminal { Type Output Position [34, 15] Direction right } Terminal { Type Output Position [34, 25] Direction right } Schematic { Location [0, 27; 1366, 681] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script4" Show on Position [395, 170] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 29 1920 991]" Show off } Parameter { Variable "NumInputs" Value "-1" Show off } Parameter { Variable "NumOutputs" Value "[-1 -1 -1 -1]" 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 "n" 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 S1 OutputSignal(0)\n" "//#define S2 OutputSignal(1)\n" "//#define S3 OutputSignal(2)\n" "//#define S4 OutputSignal(3)\n" "static int idx = 0;\n" "static int k;\n" "static int n;\n" "#define Nl 8\n" "static int p[Nl];\n" "static int s1[Nl];\n" "static int s2[Nl];\n" "static int s3[Nl];\n" "static int s4[Nl];\n" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);" Show off } Parameter { Variable "OutputFcn" Value "//n = 6;\n" "for(k = 0; k < n; k++)\n" " p[k] = InputSignal(0,k);\n" "\n" "for(k = 0; k < n; k++){\n" "\n" "if (p[k] ==1)\n" "{\n" " s1[k] = s4[k] = 1;\n" " s2[k] = s3[k] = 0;\n" "}\n" "else if(p[k] == -1)\n" "{\n" " s1[k] = s4[k] = 0;\n" " s2[k] = s3[k] = 1;\n" "}\n" "else\n" "{ \n" " if (idx%2 == 0)\n" " {\n" " s1[k] = s3[k] = 1;\n" " s2[k] = s4[k] = 0;\n" " }\n" " else\n" " {\n" " s1[k] = s3[k] = 0;\n" " s2[k] = s4[k] = 1;\n" " }\n" " idx++;\n" " }\n" "}\n" "\n" "for(k = 0; k < n; k++)\n" " OutputSignal(0,k) = s1[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(1,k) = s2[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(2,k) = s3[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(3,k) = s4[k]; " 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 Input Name "P" Show on Position [315, 170] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S1" Show on Position [480, 120] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S2" Show on Position [475, 165] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S3" Show on Position [475, 200] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S4" Show on Position [475, 235] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 2 Points [435, 155; 435, 120] DstComponent "S1" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "S2" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 4 Points [440, 175; 440, 200] DstComponent "S3" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 5 Points [435, 185; 435, 235] DstComponent "S4" DstTerminal 1 } } } Component { Type From Name "From28" Show off Position [25, 560] Direction right Flipped off Parameter { Variable "Tag" Value "Pd" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto27" Show off Position [145, 530] Direction right Flipped off Parameter { Variable "Tag" Value "s1d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto28" Show off Position [150, 545] Direction right Flipped off Parameter { Variable "Tag" Value "s2d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto29" Show off Position [155, 560] Direction right Flipped off Parameter { Variable "Tag" Value "s3d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto30" Show off Position [150, 590] Direction right Flipped off Parameter { Variable "Tag" Value "s4d" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Sub2" Show on Position [145, 940] Direction up Flipped off Frame [-45, -55; 45, 55] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [49, -45] Direction right } Terminal { Type Output Position [49, -35] Direction right } Terminal { Type Input Position [-45, -45] Direction left } Terminal { Type Input Position [-45, -35] Direction left } Terminal { Type Input Position [-45, -25] Direction left } Terminal { Type Input Position [-45, -15] Direction left } Terminal { Type Input Position [-45, -5] Direction left } Terminal { Type Input Position [-45, 15] Direction left } Schematic { Location [0, 26; 1536, 780] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script" Show on Position [195, 190] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[710 343 500 334]" Show off } Parameter { Variable "NumInputs" Value "[1 1]" Show off } Parameter { Variable "NumOutputs" Value "1" 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" "#define ref InputSignal(0,0)\n" "#define Q InputSignal(1,0)\n" "#define D OutputSignal(0,0)\n" "\n" "double ref_abs;\n" "int I;\n" "int Qold;" Show off } Parameter { Variable "StartFcn" Value "Qold = -1;\n" Show off } Parameter { Variable "OutputFcn" Value "ref_abs = fabs(ref);\n" "if(Q != Qold){\n" "I = (int)ref_abs;\n" "D = ref_abs - I;\n" "Qold = Q;\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 } } Component { Type Goto Name "Goto35" Show off Position [270, 190] Direction right Flipped off Parameter { Variable "Tag" Value "Decimal" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type CScript Name "C-Script4" Show on Position [215, 120] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[710 343 500 334]" Show off } Parameter { Variable "NumInputs" Value "[1 1]" Show off } Parameter { Variable "NumOutputs" Value "1" 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" "#define ref InputSignal(0,0)\n" "#define Q InputSignal(1,0)\n" "#define D OutputSignal(0,0)\n" "\n" "double ref_abs;\n" "int I;\n" "int Qold;" Show off } Parameter { Variable "StartFcn" Value "Qold = -1;\n" Show off } Parameter { Variable "OutputFcn" Value "ref_abs = fabs(ref);\n" "if(Q != Qold){\n" "I = (int)ref_abs;\n" "D = ref_abs - I;\n" "Qold = Q;\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 } } Component { Type Goto Name "Goto36" Show off Position [280, 120] Direction right Flipped off Parameter { Variable "Tag" Value "Decimald" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Sum Name "Sum1" Show off Position [180, 245] 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 Goto Name "Goto37" Show off Position [235, 245] Direction right Flipped off Parameter { Variable "Tag" Value "subd" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Sum Name "Sum2" Show off Position [170, 295] 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 Goto Name "Goto38" Show off Position [220, 295] Direction right Flipped off Parameter { Variable "Tag" Value "sub" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Product Name "Divide" Show on Position [475, 120] 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 From Name "From31" Show off Position [355, 115] Direction right Flipped off Parameter { Variable "Tag" Value "sub" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop" Show on Position [695, 160] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant2" Show on Position [615, 115] 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 Comparator Name "Comparator" Show on Position [560, 130] Direction right Flipped off } Component { Type Constant Name "Constant4" Show on Position [510, 85] 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 Product Name "Divide1" Show on Position [460, 240] 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 From Name "From42" Show off Position [355, 235] Direction right Flipped off Parameter { Variable "Tag" Value "subd" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop1" Show on Position [680, 280] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant3" Show on Position [600, 235] 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 Comparator Name "Comparator1" Show on Position [545, 250] Direction right Flipped off } Component { Type Constant Name "Constant5" Show on Position [490, 190] 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 Output Name "E" Show on Position [770, 150] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Ed" Show on Position [755, 270] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "refd" Show on Position [125, 100] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Qd" Show on Position [125, 140] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "refu" Show on Position [115, 175] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Q" Show on Position [115, 215] Direction right Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "card" Show on Position [120, 245] Direction right Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "car" Show on Position [120, 320] Direction right Flipped off Parameter { Variable "Index" Value "8" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type From Name "From43" Show off Position [120, 280] Direction right Flipped off Parameter { Variable "Tag" Value "Decimald" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type From Name "From44" Show off Position [120, 355] Direction right Flipped off Parameter { Variable "Tag" Value "Decimal" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Delay Name "Delay" Show on Position [420, 145] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Component { Type Delay Name "Delay1" Show on Position [405, 265] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Goto35" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "Goto36" DstTerminal 1 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "Goto37" DstTerminal 1 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Goto38" DstTerminal 1 } Connection { Type Signal SrcComponent "Divide" SrcTerminal 1 Points [515, 120; 515, 135] DstComponent "Comparator" DstTerminal 2 } Connection { Type Signal SrcComponent "Delay" SrcTerminal 2 Points [445, 145] DstComponent "Divide" DstTerminal 3 } Connection { Type Signal SrcComponent "From31" SrcTerminal 1 Points [385, 115] Branch { DstComponent "Divide" DstTerminal 2 } Branch { Points [385, 145] DstComponent "Delay" DstTerminal 1 } } Connection { Type Signal SrcComponent "Comparator" SrcTerminal 3 Points [650, 130; 650, 160] DstComponent "JK Flip-flop" DstTerminal 2 } Connection { Type Signal SrcComponent "JK Flip-flop" SrcTerminal 3 DstComponent "E" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [645, 115] Branch { Points [655, 115; 655, 150] DstComponent "JK Flip-flop" DstTerminal 1 } Branch { Points [645, 170] DstComponent "JK Flip-flop" DstTerminal 5 } } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [525, 125] DstComponent "Comparator" DstTerminal 1 } Connection { Type Signal SrcComponent "Divide1" SrcTerminal 1 Points [500, 240; 500, 255] DstComponent "Comparator1" DstTerminal 2 } Connection { Type Signal SrcComponent "Delay1" SrcTerminal 2 Points [430, 265] DstComponent "Divide1" DstTerminal 3 } Connection { Type Signal SrcComponent "From42" SrcTerminal 1 Points [370, 235] Branch { DstComponent "Divide1" DstTerminal 2 } Branch { Points [370, 265] DstComponent "Delay1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Comparator1" SrcTerminal 3 Points [635, 250; 635, 280] DstComponent "JK Flip-flop1" DstTerminal 2 } Connection { Type Signal SrcComponent "JK Flip-flop1" SrcTerminal 3 DstComponent "Ed" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant3" SrcTerminal 1 Points [630, 235] Branch { Points [640, 235; 640, 270] DstComponent "JK Flip-flop1" DstTerminal 1 } Branch { Points [630, 290] DstComponent "JK Flip-flop1" DstTerminal 5 } } Connection { Type Signal SrcComponent "Constant5" SrcTerminal 1 Points [510, 190; 510, 245] DstComponent "Comparator1" DstTerminal 1 } Connection { Type Signal SrcComponent "refd" SrcTerminal 1 Points [160, 100; 160, 115] DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "Qd" SrcTerminal 1 Points [150, 140; 150, 125] DstComponent "C-Script4" DstTerminal 2 } Connection { Type Signal SrcComponent "refu" SrcTerminal 1 Points [145, 175; 145, 185] DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "Q" SrcTerminal 1 Points [140, 215; 140, 195] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "card" SrcTerminal 1 DstComponent "Sum1" DstTerminal 2 } Connection { Type Signal SrcComponent "car" SrcTerminal 1 Points [145, 320] DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "From43" SrcTerminal 1 Points [180, 280] DstComponent "Sum1" DstTerminal 3 } Connection { Type Signal SrcComponent "From44" SrcTerminal 1 Points [170, 355] DstComponent "Sum2" DstTerminal 3 } } } Component { Type From Name "From29" Show off Position [45, 925] Direction right Flipped off Parameter { Variable "Tag" Value "vrefu_1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From33" Show off Position [45, 945] Direction right Flipped off Parameter { Variable "Tag" Value "Q" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From36" Show off Position [60, 880] Direction right Flipped off Parameter { Variable "Tag" Value "vrefd_1" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From37" Show off Position [45, 900] Direction right Flipped off Parameter { Variable "Tag" Value "Qd" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From38" Show off Position [45, 970] Direction right Flipped off Parameter { Variable "Tag" Value "vcard" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From40" Show off Position [50, 1000] Direction right Flipped off Parameter { Variable "Tag" Value "vcar" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto35" Show off Position [215, 895] Direction right Flipped off Parameter { Variable "Tag" Value "E" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto36" Show off Position [215, 915] Direction right Flipped off Parameter { Variable "Tag" Value "Ed" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "S_1U1" Show on Position [275, 445] Direction up Flipped off Frame [-30, -35; 30, 35] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Terminal { Type Output Position [34, 15] Direction right } Terminal { Type Output Position [34, 25] Direction right } Schematic { Location [0, 27; 1366, 681] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script4" Show on Position [395, 170] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 29 1920 991]" Show off } Parameter { Variable "NumInputs" Value "-1" Show off } Parameter { Variable "NumOutputs" Value "[-1 -1 -1 -1]" 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 "n" 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 S1 OutputSignal(0)\n" "//#define S2 OutputSignal(1)\n" "//#define S3 OutputSignal(2)\n" "//#define S4 OutputSignal(3)\n" "static int idx = 0;\n" "static int k;\n" "static int n;\n" "#define Nl 8\n" "static int p[Nl];\n" "static int s1[Nl];\n" "static int s2[Nl];\n" "static int s3[Nl];\n" "static int s4[Nl];\n" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " p[k] = InputSignal(0,k);\n" "\n" "for(k = 0; k < n; k++){\n" "\n" "if (p[k] == 1)\n" "{\n" " s1[k] = s4[k] = 1;\n" " s2[k] = s3[k] = 0;\n" "}\n" "else if(p[k] == -1)\n" "{\n" " s1[k] = s4[k] = 0;\n" " s2[k] = s3[k] = 1;\n" "}\n" "else\n" "{ \n" " if (idx%2 == 0)\n" " {\n" " s1[k] = s3[k] = 1;\n" " s2[k] = s4[k] = 0;\n" " }\n" " else\n" " {\n" " s1[k] = s3[k] = 0;\n" " s2[k] = s4[k] = 1;\n" " }\n" " idx++;\n" " }\n" "}\n" "\n" "for(k = 0; k < n; k++)\n" " OutputSignal(0,k) = s1[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(1,k) = s2[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(2,k) = s3[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(3,k) = s4[k]; " 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 Input Name "P" Show on Position [315, 170] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S1" Show on Position [480, 120] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S2" Show on Position [475, 165] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S3" Show on Position [475, 200] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S4" Show on Position [475, 235] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 2 Points [435, 155; 435, 120] DstComponent "S1" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "S2" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 4 Points [440, 175; 440, 200] DstComponent "S3" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 5 Points [435, 185; 435, 235] DstComponent "S4" DstTerminal 1 } } } Component { Type From Name "From30" Show off Position [215, 440] Direction right Flipped off Parameter { Variable "Tag" Value "P2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto37" Show off Position [345, 400] Direction right Flipped off Parameter { Variable "Tag" Value "s1_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto38" Show off Position [345, 420] Direction right Flipped off Parameter { Variable "Tag" Value "s2_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto39" Show off Position [345, 440] Direction right Flipped off Parameter { Variable "Tag" Value "s3_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto40" Show off Position [340, 470] Direction right Flipped off Parameter { Variable "Tag" Value "s4_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "S_1D1" Show on Position [280, 550] Direction up Flipped off Frame [-30, -35; 30, 35] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Terminal { Type Output Position [34, 15] Direction right } Terminal { Type Output Position [34, 25] Direction right } Schematic { Location [0, 27; 1366, 681] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script4" Show on Position [395, 170] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 29 1920 991]" Show off } Parameter { Variable "NumInputs" Value "-1" Show off } Parameter { Variable "NumOutputs" Value "[-1 -1 -1 -1]" 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 "n" 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 S1 OutputSignal(0)\n" "//#define S2 OutputSignal(1)\n" "//#define S3 OutputSignal(2)\n" "//#define S4 OutputSignal(3)\n" "static int idx = 0;\n" "static int k;\n" "static int n;\n" "#define Nl 8\n" "static int p[Nl];\n" "static int s1[Nl];\n" "static int s2[Nl];\n" "static int s3[Nl];\n" "static int s4[Nl];\n" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);" Show off } Parameter { Variable "OutputFcn" Value "//n = 6;\n" "for(k = 0; k < n; k++)\n" " p[k] = InputSignal(0,k);\n" "\n" "for(k = 0; k < n; k++){\n" "\n" "if (p[k] ==1)\n" "{\n" " s1[k] = s4[k] = 1;\n" " s2[k] = s3[k] = 0;\n" "}\n" "else if(p[k] == -1)\n" "{\n" " s1[k] = s4[k] = 0;\n" " s2[k] = s3[k] = 1;\n" "}\n" "else\n" "{ \n" " if (idx%2 == 0)\n" " {\n" " s1[k] = s3[k] = 1;\n" " s2[k] = s4[k] = 0;\n" " }\n" " else\n" " {\n" " s1[k] = s3[k] = 0;\n" " s2[k] = s4[k] = 1;\n" " }\n" " idx++;\n" " }\n" "}\n" "\n" "for(k = 0; k < n; k++)\n" " OutputSignal(0,k) = s1[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(1,k) = s2[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(2,k) = s3[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(3,k) = s4[k]; " 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 Input Name "P" Show on Position [315, 170] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S1" Show on Position [480, 120] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S2" Show on Position [475, 165] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S3" Show on Position [475, 200] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S4" Show on Position [475, 235] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 2 Points [435, 155; 435, 120] DstComponent "S1" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "S2" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 4 Points [440, 175; 440, 200] DstComponent "S3" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 5 Points [435, 185; 435, 235] DstComponent "S4" DstTerminal 1 } } } Component { Type From Name "From31" Show off Position [220, 545] Direction right Flipped off Parameter { Variable "Tag" Value "Pd2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto41" Show off Position [345, 510] Direction right Flipped off Parameter { Variable "Tag" Value "s1d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto42" Show off Position [345, 530] Direction right Flipped off Parameter { Variable "Tag" Value "s2d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto43" Show off Position [350, 545] Direction right Flipped off Parameter { Variable "Tag" Value "s3d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto44" Show off Position [345, 575] Direction right Flipped off Parameter { Variable "Tag" Value "s4d_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "S_1U2" Show on Position [100, 680] Direction up Flipped off Frame [-30, -35; 30, 35] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Terminal { Type Output Position [34, 15] Direction right } Terminal { Type Output Position [34, 25] Direction right } Schematic { Location [0, 27; 1366, 681] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script4" Show on Position [395, 170] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 29 1920 991]" Show off } Parameter { Variable "NumInputs" Value "-1" Show off } Parameter { Variable "NumOutputs" Value "[-1 -1 -1 -1]" 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 "n" 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 S1 OutputSignal(0)\n" "//#define S2 OutputSignal(1)\n" "//#define S3 OutputSignal(2)\n" "//#define S4 OutputSignal(3)\n" "static int idx = 0;\n" "static int k;\n" "static int n;\n" "#define Nl 8\n" "static int p[Nl];\n" "static int s1[Nl];\n" "static int s2[Nl];\n" "static int s3[Nl];\n" "static int s4[Nl];\n" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " p[k] = InputSignal(0,k);\n" "\n" "for(k = 0; k < n; k++){\n" "\n" "if (p[k] == 1)\n" "{\n" " s1[k] = s4[k] = 1;\n" " s2[k] = s3[k] = 0;\n" "}\n" "else if(p[k] == -1)\n" "{\n" " s1[k] = s4[k] = 0;\n" " s2[k] = s3[k] = 1;\n" "}\n" "else\n" "{ \n" " if (idx%2 == 0)\n" " {\n" " s1[k] = s3[k] = 1;\n" " s2[k] = s4[k] = 0;\n" " }\n" " else\n" " {\n" " s1[k] = s3[k] = 0;\n" " s2[k] = s4[k] = 1;\n" " }\n" " idx++;\n" " }\n" "}\n" "\n" "for(k = 0; k < n; k++)\n" " OutputSignal(0,k) = s1[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(1,k) = s2[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(2,k) = s3[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(3,k) = s4[k]; " 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 Input Name "P" Show on Position [315, 170] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S1" Show on Position [480, 120] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S2" Show on Position [475, 165] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S3" Show on Position [475, 200] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S4" Show on Position [475, 235] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 2 Points [435, 155; 435, 120] DstComponent "S1" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "S2" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 4 Points [440, 175; 440, 200] DstComponent "S3" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 5 Points [435, 185; 435, 235] DstComponent "S4" DstTerminal 1 } } } Component { Type From Name "From32" Show off Position [40, 675] Direction right Flipped off Parameter { Variable "Tag" Value "P3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto45" Show off Position [170, 635] Direction right Flipped off Parameter { Variable "Tag" Value "s1_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto46" Show off Position [170, 655] Direction right Flipped off Parameter { Variable "Tag" Value "s2_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto47" Show off Position [170, 675] Direction right Flipped off Parameter { Variable "Tag" Value "s3_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto48" Show off Position [165, 705] Direction right Flipped off Parameter { Variable "Tag" Value "s4_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "S_1D2" Show on Position [105, 785] Direction up Flipped off Frame [-30, -35; 30, 35] LabelPosition [0, 0] 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, -5] Direction right } Terminal { Type Output Position [34, 5] Direction right } Terminal { Type Output Position [34, 15] Direction right } Terminal { Type Output Position [34, 25] Direction right } Schematic { Location [0, 27; 1366, 681] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script4" Show on Position [395, 170] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 29 1920 991]" Show off } Parameter { Variable "NumInputs" Value "-1" Show off } Parameter { Variable "NumOutputs" Value "[-1 -1 -1 -1]" 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 "n" 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 S1 OutputSignal(0)\n" "//#define S2 OutputSignal(1)\n" "//#define S3 OutputSignal(2)\n" "//#define S4 OutputSignal(3)\n" "static int idx = 0;\n" "static int k;\n" "static int n;\n" "#define Nl 8\n" "static int p[Nl];\n" "static int s1[Nl];\n" "static int s2[Nl];\n" "static int s3[Nl];\n" "static int s4[Nl];\n" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);" Show off } Parameter { Variable "OutputFcn" Value "//n = 6;\n" "for(k = 0; k < n; k++)\n" " p[k] = InputSignal(0,k);\n" "\n" "for(k = 0; k < n; k++){\n" "\n" "if (p[k] ==1)\n" "{\n" " s1[k] = s4[k] = 1;\n" " s2[k] = s3[k] = 0;\n" "}\n" "else if(p[k] == -1)\n" "{\n" " s1[k] = s4[k] = 0;\n" " s2[k] = s3[k] = 1;\n" "}\n" "else\n" "{ \n" " if (idx%2 == 0)\n" " {\n" " s1[k] = s3[k] = 1;\n" " s2[k] = s4[k] = 0;\n" " }\n" " else\n" " {\n" " s1[k] = s3[k] = 0;\n" " s2[k] = s4[k] = 1;\n" " }\n" " idx++;\n" " }\n" "}\n" "\n" "for(k = 0; k < n; k++)\n" " OutputSignal(0,k) = s1[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(1,k) = s2[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(2,k) = s3[k];\n" "for(k = 0; k < n; k++)\n" " OutputSignal(3,k) = s4[k]; " 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 Input Name "P" Show on Position [315, 170] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S1" Show on Position [480, 120] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S2" Show on Position [475, 165] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S3" Show on Position [475, 200] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "S4" Show on Position [475, 235] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Connection { Type Signal SrcComponent "P" SrcTerminal 1 DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 2 Points [435, 155; 435, 120] DstComponent "S1" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "S2" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 4 Points [440, 175; 440, 200] DstComponent "S3" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 5 Points [435, 185; 435, 235] DstComponent "S4" DstTerminal 1 } } } Component { Type From Name "From34" Show off Position [45, 780] Direction right Flipped off Parameter { Variable "Tag" Value "Pd3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto49" Show off Position [170, 745] Direction right Flipped off Parameter { Variable "Tag" Value "s1d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto50" Show off Position [170, 765] Direction right Flipped off Parameter { Variable "Tag" Value "s2d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto51" Show off Position [175, 780] Direction right Flipped off Parameter { Variable "Tag" Value "s3d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto52" Show off Position [170, 810] Direction right Flipped off Parameter { Variable "Tag" Value "s4d_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Sub3" Show on Position [380, 705] Direction up Flipped off Frame [-45, -55; 45, 55] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [49, -45] Direction right } Terminal { Type Output Position [49, -35] Direction right } Terminal { Type Input Position [-45, -45] Direction left } Terminal { Type Input Position [-45, -35] Direction left } Terminal { Type Input Position [-45, -25] Direction left } Terminal { Type Input Position [-45, -15] Direction left } Terminal { Type Input Position [-45, -5] Direction left } Terminal { Type Input Position [-45, 15] Direction left } Schematic { Location [0, 26; 1536, 780] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script" Show on Position [195, 190] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[710 343 500 334]" Show off } Parameter { Variable "NumInputs" Value "[1 1]" Show off } Parameter { Variable "NumOutputs" Value "1" 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" "#define ref InputSignal(0,0)\n" "#define Q InputSignal(1,0)\n" "#define D OutputSignal(0,0)\n" "\n" "double ref_abs;\n" "int I;\n" "int Qold;" Show off } Parameter { Variable "StartFcn" Value "Qold = -1;\n" Show off } Parameter { Variable "OutputFcn" Value "ref_abs = fabs(ref);\n" "if(Q != Qold){\n" "I = (int)ref_abs;\n" "D = ref_abs - I;\n" "Qold = Q;\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 } } Component { Type Goto Name "Goto35" Show off Position [270, 190] Direction right Flipped off Parameter { Variable "Tag" Value "Decimal" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type CScript Name "C-Script4" Show on Position [215, 120] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[710 343 500 334]" Show off } Parameter { Variable "NumInputs" Value "[1 1]" Show off } Parameter { Variable "NumOutputs" Value "1" 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" "#define ref InputSignal(0,0)\n" "#define Q InputSignal(1,0)\n" "#define D OutputSignal(0,0)\n" "\n" "double ref_abs;\n" "int I;\n" "int Qold;" Show off } Parameter { Variable "StartFcn" Value "Qold = -1;\n" Show off } Parameter { Variable "OutputFcn" Value "ref_abs = fabs(ref);\n" "if(Q != Qold){\n" "I = (int)ref_abs;\n" "D = ref_abs - I;\n" "Qold = Q;\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 } } Component { Type Goto Name "Goto36" Show off Position [280, 120] Direction right Flipped off Parameter { Variable "Tag" Value "Decimald" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Sum Name "Sum1" Show off Position [180, 245] 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 Goto Name "Goto37" Show off Position [235, 245] Direction right Flipped off Parameter { Variable "Tag" Value "subd" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Sum Name "Sum2" Show off Position [170, 295] 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 Goto Name "Goto38" Show off Position [220, 295] Direction right Flipped off Parameter { Variable "Tag" Value "sub" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Product Name "Divide" Show on Position [475, 120] 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 From Name "From31" Show off Position [355, 115] Direction right Flipped off Parameter { Variable "Tag" Value "sub" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop" Show on Position [695, 160] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant2" Show on Position [615, 115] 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 Comparator Name "Comparator" Show on Position [560, 130] Direction right Flipped off } Component { Type Constant Name "Constant4" Show on Position [510, 85] 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 Product Name "Divide1" Show on Position [460, 240] 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 From Name "From42" Show off Position [355, 235] Direction right Flipped off Parameter { Variable "Tag" Value "subd" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop1" Show on Position [680, 280] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant3" Show on Position [600, 235] 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 Comparator Name "Comparator1" Show on Position [545, 250] Direction right Flipped off } Component { Type Constant Name "Constant5" Show on Position [490, 190] 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 Output Name "E" Show on Position [770, 150] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Ed" Show on Position [755, 270] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "refd" Show on Position [125, 100] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Qd" Show on Position [125, 140] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "refu" Show on Position [115, 175] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Q" Show on Position [115, 215] Direction right Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "card" Show on Position [120, 245] Direction right Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "car" Show on Position [120, 320] Direction right Flipped off Parameter { Variable "Index" Value "8" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type From Name "From43" Show off Position [120, 280] Direction right Flipped off Parameter { Variable "Tag" Value "Decimald" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type From Name "From44" Show off Position [120, 355] Direction right Flipped off Parameter { Variable "Tag" Value "Decimal" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Delay Name "Delay" Show on Position [420, 145] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Component { Type Delay Name "Delay1" Show on Position [405, 265] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 DstComponent "Goto35" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "Goto36" DstTerminal 1 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "Goto37" DstTerminal 1 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Goto38" DstTerminal 1 } Connection { Type Signal SrcComponent "Divide" SrcTerminal 1 Points [515, 120; 515, 135] DstComponent "Comparator" DstTerminal 2 } Connection { Type Signal SrcComponent "Delay" SrcTerminal 2 Points [445, 145] DstComponent "Divide" DstTerminal 3 } Connection { Type Signal SrcComponent "From31" SrcTerminal 1 Points [385, 115] Branch { DstComponent "Divide" DstTerminal 2 } Branch { Points [385, 145] DstComponent "Delay" DstTerminal 1 } } Connection { Type Signal SrcComponent "Comparator" SrcTerminal 3 Points [650, 130; 650, 160] DstComponent "JK Flip-flop" DstTerminal 2 } Connection { Type Signal SrcComponent "JK Flip-flop" SrcTerminal 3 DstComponent "E" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [645, 115] Branch { Points [655, 115; 655, 150] DstComponent "JK Flip-flop" DstTerminal 1 } Branch { Points [645, 170] DstComponent "JK Flip-flop" DstTerminal 5 } } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [525, 125] DstComponent "Comparator" DstTerminal 1 } Connection { Type Signal SrcComponent "Divide1" SrcTerminal 1 Points [500, 240; 500, 255] DstComponent "Comparator1" DstTerminal 2 } Connection { Type Signal SrcComponent "Delay1" SrcTerminal 2 Points [430, 265] DstComponent "Divide1" DstTerminal 3 } Connection { Type Signal SrcComponent "From42" SrcTerminal 1 Points [370, 235] Branch { DstComponent "Divide1" DstTerminal 2 } Branch { Points [370, 265] DstComponent "Delay1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Comparator1" SrcTerminal 3 Points [635, 250; 635, 280] DstComponent "JK Flip-flop1" DstTerminal 2 } Connection { Type Signal SrcComponent "JK Flip-flop1" SrcTerminal 3 DstComponent "Ed" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant3" SrcTerminal 1 Points [630, 235] Branch { Points [640, 235; 640, 270] DstComponent "JK Flip-flop1" DstTerminal 1 } Branch { Points [630, 290] DstComponent "JK Flip-flop1" DstTerminal 5 } } Connection { Type Signal SrcComponent "Constant5" SrcTerminal 1 Points [510, 190; 510, 245] DstComponent "Comparator1" DstTerminal 1 } Connection { Type Signal SrcComponent "refd" SrcTerminal 1 Points [160, 100; 160, 115] DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "Qd" SrcTerminal 1 Points [150, 140; 150, 125] DstComponent "C-Script4" DstTerminal 2 } Connection { Type Signal SrcComponent "refu" SrcTerminal 1 Points [145, 175; 145, 185] DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "Q" SrcTerminal 1 Points [140, 215; 140, 195] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "card" SrcTerminal 1 DstComponent "Sum1" DstTerminal 2 } Connection { Type Signal SrcComponent "car" SrcTerminal 1 Points [145, 320] DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "From43" SrcTerminal 1 Points [180, 280] DstComponent "Sum1" DstTerminal 3 } Connection { Type Signal SrcComponent "From44" SrcTerminal 1 Points [170, 355] DstComponent "Sum2" DstTerminal 3 } } } Component { Type From Name "From35" Show off Position [280, 690] Direction right Flipped off Parameter { Variable "Tag" Value "vrefu_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From39" Show off Position [280, 710] Direction right Flipped off Parameter { Variable "Tag" Value "Q" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From41" Show off Position [295, 645] Direction right Flipped off Parameter { Variable "Tag" Value "vrefd_2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From42" Show off Position [280, 665] Direction right Flipped off Parameter { Variable "Tag" Value "Qd" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From43" Show off Position [280, 735] Direction right Flipped off Parameter { Variable "Tag" Value "vcard" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From44" Show off Position [285, 765] Direction right Flipped off Parameter { Variable "Tag" Value "vcar" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto53" Show off Position [450, 660] Direction right Flipped off Parameter { Variable "Tag" Value "E2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto54" Show off Position [450, 680] Direction right Flipped off Parameter { Variable "Tag" Value "Ed2" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Subsystem Name "Sub4" Show on Position [435, 905] Direction up Flipped off Frame [-45, -55; 45, 55] LabelPosition [0, 0] SampleTime "-1" CodeGenDiscretizationMethod "2" CodeGenTarget "Generic" MaskDisplayLang "2" MaskIconFrame on MaskIconOpaque off MaskIconRotates on Terminal { Type Output Position [49, -45] Direction right } Terminal { Type Output Position [49, -35] Direction right } Terminal { Type Input Position [-45, -45] Direction left } Terminal { Type Input Position [-45, -35] Direction left } Terminal { Type Input Position [-45, -25] Direction left } Terminal { Type Input Position [-45, -15] Direction left } Terminal { Type Input Position [-45, -5] Direction left } Terminal { Type Input Position [-45, 15] Direction left } Schematic { Location [0, 26; 1536, 780] ZoomFactor 1 SliderPosition [0, 0] ShowBrowser off BrowserWidth 100 Component { Type CScript Name "C-Script" Show on Position [195, 190] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[710 343 500 334]" Show off } Parameter { Variable "NumInputs" Value "[1 1]" Show off } Parameter { Variable "NumOutputs" Value "1" 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" "#define ref InputSignal(0,0)\n" "#define Q InputSignal(1,0)\n" "#define D OutputSignal(0,0)\n" "\n" "double ref_abs;\n" "int I;\n" "int Qold;" Show off } Parameter { Variable "StartFcn" Value "Qold = -1;\n" Show off } Parameter { Variable "OutputFcn" Value "ref_abs = fabs(ref);\n" "if(Q != Qold){\n" "I = (int)ref_abs;\n" "D = ref_abs - I;\n" "Qold = Q;\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 } } Component { Type Goto Name "Goto35" Show off Position [275, 195] Direction right Flipped off Parameter { Variable "Tag" Value "Decimal" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type CScript Name "C-Script4" Show on Position [215, 120] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[710 343 500 334]" Show off } Parameter { Variable "NumInputs" Value "[1 1]" Show off } Parameter { Variable "NumOutputs" Value "1" 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" "#define ref InputSignal(0,0)\n" "#define Q InputSignal(1,0)\n" "#define D OutputSignal(0,0)\n" "\n" "double ref_abs;\n" "int I;\n" "int Qold;" Show off } Parameter { Variable "StartFcn" Value "Qold = -1;\n" Show off } Parameter { Variable "OutputFcn" Value "ref_abs = fabs(ref);\n" "if(Q != Qold){\n" "I = (int)ref_abs;\n" "D = ref_abs - I;\n" "Qold = Q;\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 } } Component { Type Goto Name "Goto36" Show off Position [280, 120] Direction right Flipped off Parameter { Variable "Tag" Value "Decimald" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Sum Name "Sum1" Show off Position [180, 245] 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 Goto Name "Goto37" Show off Position [235, 245] Direction right Flipped off Parameter { Variable "Tag" Value "subd" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Sum Name "Sum2" Show off Position [170, 295] 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 Goto Name "Goto38" Show off Position [220, 295] Direction right Flipped off Parameter { Variable "Tag" Value "sub" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Product Name "Divide" Show on Position [475, 120] 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 From Name "From31" Show off Position [355, 115] Direction right Flipped off Parameter { Variable "Tag" Value "sub" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop" Show on Position [695, 160] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant2" Show on Position [615, 115] 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 Comparator Name "Comparator" Show on Position [560, 130] Direction right Flipped off } Component { Type Constant Name "Constant4" Show on Position [510, 85] 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 Product Name "Divide1" Show on Position [460, 240] 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 From Name "From42" Show off Position [355, 235] Direction right Flipped off Parameter { Variable "Tag" Value "subd" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Reference SrcComponent "Components/Control/Logical/JK Flip-flop" Name "JK Flip-flop1" Show on Position [680, 280] Direction up Flipped off Frame [-20, -20; 20, 20] LabelPosition [0, 23] LabelAlign up Parameter { Variable "trigger" Value "1" Show off } Parameter { Variable "x_init" Value "0" Show off } Terminal { Type Input Position [-20, -10] Direction left } Terminal { Type Input Position [-20, 0] Direction left } Terminal { Type Output Position [24, -10] Direction right } Terminal { Type Output Position [24, 10] Direction right } Terminal { Type Input Position [-20, 10] Direction left } } Component { Type Constant Name "Constant3" Show on Position [600, 235] 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 Comparator Name "Comparator1" Show on Position [545, 250] Direction right Flipped off } Component { Type Constant Name "Constant5" Show on Position [490, 190] 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 Output Name "E" Show on Position [770, 150] Direction right Flipped off Parameter { Variable "Index" Value "1" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Output Name "Ed" Show on Position [755, 270] Direction right Flipped off Parameter { Variable "Index" Value "2" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "refd" Show on Position [125, 100] Direction right Flipped off Parameter { Variable "Index" Value "3" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Qd" Show on Position [125, 140] Direction right Flipped off Parameter { Variable "Index" Value "4" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "refu" Show on Position [115, 175] Direction right Flipped off Parameter { Variable "Index" Value "5" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "Q" Show on Position [115, 215] Direction right Flipped off Parameter { Variable "Index" Value "6" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "card" Show on Position [120, 245] Direction right Flipped off Parameter { Variable "Index" Value "7" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type Input Name "car" Show on Position [120, 320] Direction right Flipped off Parameter { Variable "Index" Value "8" Show on } Parameter { Variable "Width" Value "-1" Show off } } Component { Type From Name "From43" Show off Position [120, 280] Direction right Flipped off Parameter { Variable "Tag" Value "Decimald" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type From Name "From44" Show off Position [120, 355] Direction right Flipped off Parameter { Variable "Tag" Value "Decimal" Show off } Parameter { Variable "Visibility" Value "2" Show off } } Component { Type Delay Name "Delay" Show on Position [420, 145] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Component { Type Delay Name "Delay1" Show on Position [405, 265] Direction right Flipped off Parameter { Variable "N" Value "1" Show off } Parameter { Variable "X0" Value "0" Show off } Parameter { Variable "Ts" Value "delay" Show off } } Connection { Type Signal SrcComponent "C-Script" SrcTerminal 3 Points [245, 190; 245, 195] DstComponent "Goto35" DstTerminal 1 } Connection { Type Signal SrcComponent "C-Script4" SrcTerminal 3 DstComponent "Goto36" DstTerminal 1 } Connection { Type Signal SrcComponent "Sum1" SrcTerminal 1 DstComponent "Goto37" DstTerminal 1 } Connection { Type Signal SrcComponent "Sum2" SrcTerminal 1 DstComponent "Goto38" DstTerminal 1 } Connection { Type Signal SrcComponent "Divide" SrcTerminal 1 Points [515, 120; 515, 135] DstComponent "Comparator" DstTerminal 2 } Connection { Type Signal SrcComponent "Delay" SrcTerminal 2 Points [445, 145] DstComponent "Divide" DstTerminal 3 } Connection { Type Signal SrcComponent "From31" SrcTerminal 1 Points [385, 115] Branch { DstComponent "Divide" DstTerminal 2 } Branch { Points [385, 145] DstComponent "Delay" DstTerminal 1 } } Connection { Type Signal SrcComponent "Comparator" SrcTerminal 3 Points [650, 130; 650, 160] DstComponent "JK Flip-flop" DstTerminal 2 } Connection { Type Signal SrcComponent "JK Flip-flop" SrcTerminal 3 DstComponent "E" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant2" SrcTerminal 1 Points [645, 115] Branch { Points [655, 115; 655, 150] DstComponent "JK Flip-flop" DstTerminal 1 } Branch { Points [645, 170] DstComponent "JK Flip-flop" DstTerminal 5 } } Connection { Type Signal SrcComponent "Constant4" SrcTerminal 1 Points [525, 125] DstComponent "Comparator" DstTerminal 1 } Connection { Type Signal SrcComponent "Divide1" SrcTerminal 1 Points [500, 240; 500, 255] DstComponent "Comparator1" DstTerminal 2 } Connection { Type Signal SrcComponent "Delay1" SrcTerminal 2 Points [430, 265] DstComponent "Divide1" DstTerminal 3 } Connection { Type Signal SrcComponent "From42" SrcTerminal 1 Points [370, 235] Branch { DstComponent "Divide1" DstTerminal 2 } Branch { Points [370, 265] DstComponent "Delay1" DstTerminal 1 } } Connection { Type Signal SrcComponent "Comparator1" SrcTerminal 3 Points [635, 250; 635, 280] DstComponent "JK Flip-flop1" DstTerminal 2 } Connection { Type Signal SrcComponent "JK Flip-flop1" SrcTerminal 3 DstComponent "Ed" DstTerminal 1 } Connection { Type Signal SrcComponent "Constant3" SrcTerminal 1 Points [630, 235] Branch { Points [640, 235; 640, 270] DstComponent "JK Flip-flop1" DstTerminal 1 } Branch { Points [630, 290] DstComponent "JK Flip-flop1" DstTerminal 5 } } Connection { Type Signal SrcComponent "Constant5" SrcTerminal 1 Points [510, 190; 510, 245] DstComponent "Comparator1" DstTerminal 1 } Connection { Type Signal SrcComponent "refd" SrcTerminal 1 Points [160, 100; 160, 115] DstComponent "C-Script4" DstTerminal 1 } Connection { Type Signal SrcComponent "Qd" SrcTerminal 1 Points [150, 140; 150, 125] DstComponent "C-Script4" DstTerminal 2 } Connection { Type Signal SrcComponent "refu" SrcTerminal 1 Points [145, 175; 145, 185] DstComponent "C-Script" DstTerminal 1 } Connection { Type Signal SrcComponent "Q" SrcTerminal 1 Points [140, 215; 140, 195] DstComponent "C-Script" DstTerminal 2 } Connection { Type Signal SrcComponent "card" SrcTerminal 1 DstComponent "Sum1" DstTerminal 2 } Connection { Type Signal SrcComponent "car" SrcTerminal 1 Points [145, 320] DstComponent "Sum2" DstTerminal 2 } Connection { Type Signal SrcComponent "From43" SrcTerminal 1 Points [180, 280] DstComponent "Sum1" DstTerminal 3 } Connection { Type Signal SrcComponent "From44" SrcTerminal 1 Points [170, 355] DstComponent "Sum2" DstTerminal 3 } } } Component { Type From Name "From45" Show off Position [335, 890] Direction right Flipped off Parameter { Variable "Tag" Value "vrefu_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From46" Show off Position [335, 910] Direction right Flipped off Parameter { Variable "Tag" Value "Q" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From47" Show off Position [340, 845] Direction right Flipped off Parameter { Variable "Tag" Value "vrefd_3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From48" Show off Position [335, 865] Direction right Flipped off Parameter { Variable "Tag" Value "Qd" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From49" Show off Position [335, 935] Direction right Flipped off Parameter { Variable "Tag" Value "vcard" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type From Name "From50" Show off Position [340, 965] Direction right Flipped off Parameter { Variable "Tag" Value "vcar" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto55" Show off Position [505, 860] Direction right Flipped off Parameter { Variable "Tag" Value "E3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type Goto Name "Goto56" Show off Position [505, 880] Direction right Flipped off Parameter { Variable "Tag" Value "Ed3" Show off } Parameter { Variable "Visibility" Value "1" Show off } } Component { Type CScript Name "C-Script1" Show on Position [740, 625] Direction up Flipped off Parameter { Variable "DialogGeometry" Value "[0 28 1920 991]" Show off } Parameter { Variable "NumInputs" Value "[1 1 1 -1 1 1 1 ]" Show off } Parameter { Variable "NumOutputs" Value "-1" 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 "n" 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" "#define Q InputSignal(0,0)\n" "#define vcar InputSignal(1,0)\n" "#define ic InputSignal(2,0)\n" "#define slope InputSignal(4,0)\n" "#define ref InputSignal(5,0)\n" "#define E InputSignal(6,0)\n" "\n" "\n" "static int n;\n" "static int Eold;\n" "static int k;\n" "static int Qold;\n" "static int I;\n" "static double D;\n" "static int fl;\n" "static int ce;\n" "static int Nm;\n" "static double ref_abs;\n" "static int pos;\n" "static double vc[]= {0,0,0,0,0,0,0,0};\n" "static int vs[] = {0,1,2,3,4,5,6,7};\n" "static int p[] = {0,0,0,0,0,0,0,0};\n" "static double temp;\n" "static int tempi;\n" "static int id1;\n" "static int id2;\n" "static int change = 0;\n" "static int slopeold;\n" "\n" "\n" "\n" "void sort(double vc[],int vs[],int n){\n" "do\n" "{\n" " change = 0;\n" " for(id1 = 1; id1 < n; id1++)\n" " {\n" " if(vc[vs[id1 - 1]] < vc[vs[id1]])\n" " {\n" " tempi = vs[id1];\n" " vs[id1] = vs[id1 - 1];\n" " vs[id1 - 1] = tempi;\n" " change = 1;\n" " }\n" " }\n" "}\n" "while(change == 1);\n" "};\n" "\n" "void gate_signals(double i, int n, int Nm,int p[],int vs[],int pos){\n" "if(i > 0){\n" "\n" " if(pos == 1){\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = 1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = -1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" " \n" "if(i < 0){\n" " if(pos == 1){\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = 1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = -1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" "};\n" "\n" "#define P1 OutputSignal(0,0)\n" "#define P2 OutputSignal(0,1)\n" "#define P3 OutputSignal(0,2)\n" "#define P4 OutputSignal(0,3)" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);\n" "Qold = -1;\n" "Eold = 0;\n" "\n" "\n" "\n" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " vc[k] = InputSignal(3,k);\n" " \n" " \n" "\n" " \n" "if(Q != Qold){\n" " ref_abs = fabs(ref);\n" " \n" " if(ref >= 0)\n" " pos = 1;\n" " else\n" " pos = 0;\n" " \n" " I = (int)ref;\n" " D = ref_abs - I; //Decimal\n" " fl = floor(ref_abs);\n" " ce = ceil(ref_abs);\n" " \n" " sort(vc,vs,n);\n" " \n" " Qold = Q;\n" "\n" " if(pos == 1){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" " \n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" "gate_signals(ic,n,Nm,p,vs,pos);\n" "}\n" "\n" "\n" "if(Eold != E){\n" " Eold = E;\n" " sort(vc,vs,n);\n" " \n" " if(pos ==1){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " \n" "gate_signals(ic,n,Nm,p,vs,pos);\n" " }\n" " \n" "\n" "for(k = 0; k\n" "#define Q InputSignal(0,0)\n" "#define vcar InputSignal(1,0)\n" "#define ic InputSignal(2,0)\n" "#define slope InputSignal(4,0)\n" "#define ref InputSignal(5,0)\n" "#define E InputSignal(6,0)\n" "\n" "\n" "static int n;\n" "static int Eold;\n" "static int k;\n" "static int Qold;\n" "static int I;\n" "static double D;\n" "static int fl;\n" "static int ce;\n" "static int Nm;\n" "static double ref_abs;\n" "static int pos;\n" "static double vc[]= {0,0,0,0,0,0,0,0};\n" "static int vs[] = {0,1,2,3,4,5,6,7};\n" "static int p[] = {0,0,0,0,0,0,0,0};\n" "static double temp;\n" "static int tempi;\n" "static int id1;\n" "static int id2;\n" "static int change = 0;\n" "static int slopeold;\n" "\n" "\n" "\n" "void sort(double vc[],int vs[],int n){\n" "do\n" "{\n" " change = 0;\n" " for(id1 = 1; id1 < n; id1++)\n" " {\n" " if(vc[vs[id1 - 1]] < vc[vs[id1]])\n" " {\n" " tempi = vs[id1];\n" " vs[id1] = vs[id1 - 1];\n" " vs[id1 - 1] = tempi;\n" " change = 1;\n" " }\n" " }\n" "}\n" "while(change == 1);\n" "};\n" "\n" "void gate_signals(double i, int n, int Nm,int p[],int vs[],int pos){\n" "if(i > 0){\n" "\n" " if(pos == 1){\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = 1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = -1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" " \n" "if(i < 0){\n" " if(pos == 1){\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = 1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = -1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" "};\n" "\n" "#define P1 OutputSignal(0,0)\n" "#define P2 OutputSignal(0,1)\n" "#define P3 OutputSignal(0,2)\n" "#define P4 OutputSignal(0,3)" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);\n" "Qold = -1;\n" "Eold = 0;\n" "\n" "\n" "\n" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " vc[k] = InputSignal(3,k);\n" " \n" " \n" "\n" " \n" "if(Q != Qold){\n" " ref_abs = fabs(ref);\n" " \n" " if(ref >= 0)\n" " pos = 1;\n" " else\n" " pos = 0;\n" " \n" " I = (int)ref;\n" " D = ref_abs - I; //Decimal\n" " fl = floor(ref_abs);\n" " ce = ceil(ref_abs);\n" " \n" " sort(vc,vs,n);\n" " \n" " Qold = Q;\n" "\n" " if(pos == 1){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" " \n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" "gate_signals(ic,n,Nm,p,vs,pos);\n" "}\n" "\n" "\n" "if(Eold != E){\n" " Eold = E;\n" " sort(vc,vs,n);\n" " \n" " if(pos ==1){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " \n" "gate_signals(ic,n,Nm,p,vs,pos);\n" " }\n" " \n" "\n" "for(k = 0; k\n" "#define Q InputSignal(0,0)\n" "#define vcar InputSignal(1,0)\n" "#define ic InputSignal(2,0)\n" "#define slope InputSignal(4,0)\n" "#define ref InputSignal(5,0)\n" "#define E InputSignal(6,0)\n" "\n" "\n" "static int n;\n" "static int Eold;\n" "static int k;\n" "static int Qold;\n" "static int I;\n" "static double D;\n" "static int fl;\n" "static int ce;\n" "static int Nm;\n" "static double ref_abs;\n" "static int pos;\n" "static double vc[]= {0,0,0,0,0,0,0,0};\n" "static int vs[] = {0,1,2,3,4,5,6,7};\n" "static int p[] = {0,0,0,0,0,0,0,0};\n" "static double temp;\n" "static int tempi;\n" "static int id1;\n" "static int id2;\n" "static int change = 0;\n" "static int slopeold;\n" "\n" "\n" "\n" "void sort(double vc[],int vs[],int n){\n" "do\n" "{\n" " change = 0;\n" " for(id1 = 1; id1 < n; id1++)\n" " {\n" " if(vc[vs[id1 - 1]] < vc[vs[id1]])\n" " {\n" " tempi = vs[id1];\n" " vs[id1] = vs[id1 - 1];\n" " vs[id1 - 1] = tempi;\n" " change = 1;\n" " }\n" " }\n" "}\n" "while(change == 1);\n" "};\n" "\n" "void gate_signals(double i, int n, int Nm,int p[],int vs[],int pos){\n" "if(i > 0){\n" "\n" " if(pos == 1){\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = 1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = -1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" " \n" "if(i < 0){\n" " if(pos == 1){\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = 1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = -1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" "};\n" "\n" "#define P1 OutputSignal(0,0)\n" "#define P2 OutputSignal(0,1)\n" "#define P3 OutputSignal(0,2)\n" "#define P4 OutputSignal(0,3)" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);\n" "Qold = -1;\n" "Eold = 0;\n" "\n" "\n" "\n" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " vc[k] = InputSignal(3,k);\n" " \n" " \n" "\n" " \n" "if(Q != Qold){\n" " ref_abs = fabs(ref);\n" " \n" " if(ref >= 0)\n" " pos = 1;\n" " else\n" " pos = 0;\n" " \n" " I = (int)ref;\n" " D = ref_abs - I; //Decimal\n" " fl = floor(ref_abs);\n" " ce = ceil(ref_abs);\n" " \n" " sort(vc,vs,n);\n" " \n" " Qold = Q;\n" "\n" " if(pos == 1){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" " \n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" "gate_signals(ic,n,Nm,p,vs,pos);\n" "}\n" "\n" "\n" "if(Eold != E){\n" " Eold = E;\n" " sort(vc,vs,n);\n" " \n" " if(pos ==1){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " \n" "gate_signals(ic,n,Nm,p,vs,pos);\n" " }\n" " \n" "\n" "for(k = 0; k\n" "#define Q InputSignal(0,0)\n" "#define vcar InputSignal(1,0)\n" "#define ic InputSignal(2,0)\n" "#define slope InputSignal(4,0)\n" "#define ref InputSignal(5,0)\n" "#define E InputSignal(6,0)\n" "\n" "static int n;\n" "static int Eold;\n" "static int k;\n" "static int Qold;\n" "static int I;\n" "static double D;\n" "static int fl;\n" "static int ce;\n" "static int Nm;\n" "static double ref_abs;\n" "static int pos;\n" "static double vc[]= {0,0,0,0,0,0,0,0};\n" "static int vs[] = {0,1,2,3,4,5,6,7};\n" "static int p[] = {0,0,0,0,0,0,0,0};\n" "static double temp;\n" "static int tempi;\n" "static int id1;\n" "static int id2;\n" "static int change = 0;\n" "static int slopeold;\n" "\n" "\n" "\n" "void sort(double vc[],int vs[],int n){\n" "do\n" "{\n" " change = 0;\n" " for(id1 = 1; id1 < n; id1++)\n" " {\n" " if(vc[vs[id1 - 1]] < vc[vs[id1]])\n" " {\n" " tempi = vs[id1];\n" " vs[id1] = vs[id1 - 1];\n" " vs[id1 - 1] = tempi;\n" " change = 1;\n" " }\n" " }\n" "}\n" "while(change == 1);\n" "};\n" "\n" "void gate_signals(double i, int n, int Nm,int p[],int vs[],int pos){\n" "if(i > 0){\n" "\n" " if(pos == 1){\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = 1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = -1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" " \n" "if(i < 0){\n" " if(pos == 1){\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = 1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = -1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" "};\n" "\n" "#define P1 OutputSignal(0,0)\n" "#define P2 OutputSignal(0,1)\n" "#define P3 OutputSignal(0,2)\n" "#define P4 OutputSignal(0,3)" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);\n" "Qold = -1;\n" "Eold = 0;\n" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " vc[k] = InputSignal(3,k);\n" " \n" " \n" "\n" " \n" "if(Q != Qold){\n" " ref_abs = fabs(ref);\n" " \n" " if(ref >= 0)\n" " pos = 1;\n" " else\n" " pos = 0;\n" " \n" " I = (int)ref;\n" " D = ref_abs - I; //Decimal\n" " fl = floor(ref_abs);\n" " ce = ceil(ref_abs);\n" " sort(vc,vs,n);\n" " \n" " Qold = Q;\n" "\n" " if(pos == 1){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" " \n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" "gate_signals(ic,n,Nm,p,vs,pos);\n" "}\n" "\n" "\n" "if(E != Eold){\n" " Eold = E;\n" " sort(vc,vs,n);\n" " \n" " if(pos ==1){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " \n" "gate_signals(ic,n,Nm,p,vs,pos);\n" " }\n" " \n" "\n" "for(k = 0; k\n" "#define Q InputSignal(0,0)\n" "#define vcar InputSignal(1,0)\n" "#define ic InputSignal(2,0)\n" "#define slope InputSignal(4,0)\n" "#define ref InputSignal(5,0)\n" "#define E InputSignal(6,0)\n" "\n" "static int n;\n" "static int Eold;\n" "static int k;\n" "static int Qold;\n" "static int I;\n" "static double D;\n" "static int fl;\n" "static int ce;\n" "static int Nm;\n" "static double ref_abs;\n" "static int pos;\n" "static double vc[]= {0,0,0,0,0,0,0,0};\n" "static int vs[] = {0,1,2,3,4,5,6,7};\n" "static int p[] = {0,0,0,0,0,0,0,0};\n" "static double temp;\n" "static int tempi;\n" "static int id1;\n" "static int id2;\n" "static int change = 0;\n" "static int slopeold;\n" "\n" "\n" "\n" "void sort(double vc[],int vs[],int n){\n" "do\n" "{\n" " change = 0;\n" " for(id1 = 1; id1 < n; id1++)\n" " {\n" " if(vc[vs[id1 - 1]] < vc[vs[id1]])\n" " {\n" " tempi = vs[id1];\n" " vs[id1] = vs[id1 - 1];\n" " vs[id1 - 1] = tempi;\n" " change = 1;\n" " }\n" " }\n" "}\n" "while(change == 1);\n" "};\n" "\n" "void gate_signals(double i, int n, int Nm,int p[],int vs[],int pos){\n" "if(i > 0){\n" "\n" " if(pos == 1){\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = 1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = -1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" " \n" "if(i < 0){\n" " if(pos == 1){\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = 1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = -1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" "};\n" "\n" "#define P1 OutputSignal(0,0)\n" "#define P2 OutputSignal(0,1)\n" "#define P3 OutputSignal(0,2)\n" "#define P4 OutputSignal(0,3)" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);\n" "Qold = -1;\n" "Eold = 0;\n" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " vc[k] = InputSignal(3,k);\n" " \n" " \n" "\n" " \n" "if(Q != Qold){\n" " ref_abs = fabs(ref);\n" " \n" " if(ref >= 0)\n" " pos = 1;\n" " else\n" " pos = 0;\n" " \n" " I = (int)ref;\n" " D = ref_abs - I; //Decimal\n" " fl = floor(ref_abs);\n" " ce = ceil(ref_abs);\n" " sort(vc,vs,n);\n" " \n" " Qold = Q;\n" "\n" " if(pos == 1){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" " \n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" "gate_signals(ic,n,Nm,p,vs,pos);\n" "}\n" "\n" "\n" "if(E != Eold){\n" " Eold = E;\n" " sort(vc,vs,n);\n" " \n" " if(pos ==1){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " \n" "gate_signals(ic,n,Nm,p,vs,pos);\n" " }\n" " \n" "\n" "for(k = 0; k\n" "#define Q InputSignal(0,0)\n" "#define vcar InputSignal(1,0)\n" "#define ic InputSignal(2,0)\n" "#define slope InputSignal(4,0)\n" "#define ref InputSignal(5,0)\n" "#define E InputSignal(6,0)\n" "\n" "static int n;\n" "static int Eold;\n" "static int k;\n" "static int Qold;\n" "static int I;\n" "static double D;\n" "static int fl;\n" "static int ce;\n" "static int Nm;\n" "static double ref_abs;\n" "static int pos;\n" "static double vc[]= {0,0,0,0,0,0,0,0};\n" "static int vs[] = {0,1,2,3,4,5,6,7};\n" "static int p[] = {0,0,0,0,0,0,0,0};\n" "static double temp;\n" "static int tempi;\n" "static int id1;\n" "static int id2;\n" "static int change = 0;\n" "static int slopeold;\n" "\n" "\n" "\n" "void sort(double vc[],int vs[],int n){\n" "do\n" "{\n" " change = 0;\n" " for(id1 = 1; id1 < n; id1++)\n" " {\n" " if(vc[vs[id1 - 1]] < vc[vs[id1]])\n" " {\n" " tempi = vs[id1];\n" " vs[id1] = vs[id1 - 1];\n" " vs[id1 - 1] = tempi;\n" " change = 1;\n" " }\n" " }\n" "}\n" "while(change == 1);\n" "};\n" "\n" "void gate_signals(double i, int n, int Nm,int p[],int vs[],int pos){\n" "if(i > 0){\n" "\n" " if(pos == 1){\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = 1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = -1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" " \n" "if(i < 0){\n" " if(pos == 1){\n" " for(k = 0; k < Nm; k++)\n" " p[vs[k]] = 1;\n" " for(k = Nm; k < n; k++)\n" " p[vs[k]] = 0;\n" " }\n" " else{\n" " for(k = n-1; k > n-1-Nm; k--)\n" " p[vs[k]] = -1;\n" " for(k = 0; k <= n-1-Nm; k++)\n" " p[vs[k]] = 0;\n" " }\n" " }\n" "};\n" "\n" "#define P1 OutputSignal(0,0)\n" "#define P2 OutputSignal(0,1)\n" "#define P3 OutputSignal(0,2)\n" "#define P4 OutputSignal(0,3)" Show off } Parameter { Variable "StartFcn" Value "n = ParamRealData(0,0);\n" "Qold = -1;\n" "Eold = 0;\n" Show off } Parameter { Variable "OutputFcn" Value "for(k = 0; k < n; k++)\n" " vc[k] = InputSignal(3,k);\n" " \n" " \n" "\n" " \n" "if(Q != Qold){\n" " ref_abs = fabs(ref);\n" " \n" " if(ref >= 0)\n" " pos = 1;\n" " else\n" " pos = 0;\n" " \n" " I = (int)ref;\n" " D = ref_abs - I; //Decimal\n" " fl = floor(ref_abs);\n" " ce = ceil(ref_abs);\n" " sort(vc,vs,n);\n" " \n" " Qold = Q;\n" "\n" " if(pos == 1){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" " \n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm = fl;\n" " else\n" " Nm = ce; \n" " }\n" "gate_signals(ic,n,Nm,p,vs,pos);\n" "}\n" "\n" "\n" "if(E != Eold){\n" " Eold = E;\n" " sort(vc,vs,n);\n" " \n" " if(pos ==1){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " if(pos == 0){\n" " if(slope == 0)\n" " Nm++;\n" " else\n" " Nm--; \n" " }\n" " \n" "gate_signals(ic,n,Nm,p,vs,pos);\n" " }\n" " \n" "\n" "for(k = 0; k