FSM/父子状态机测试.plecs

785 lines
20 KiB
Plaintext
Raw Permalink Normal View History

Plecs {
Name base64 "54q25oCB5py65rWL6K+V"
Version "4.7"
CircuitModel "ContStateSpace"
StartTime "0.0"
TimeSpan "2"
Timeout ""
Solver "auto"
MaxStep "1e-3"
InitStep "-1"
FixedStep "1e-3"
Refine "1"
ZCStepSize "1e-9"
RelTol "1e-3"
AbsTol "-1"
TurnOnThreshold "0"
SyncFixedStepTasks "2"
UseSingleCommonBaseRate "2"
LossVariableLimitExceededMsg "3"
NegativeSwitchLossMsg "3"
DivisionByZeroMsg "3"
StiffnessDetectionMsg "2"
MaxConsecutiveZCs "1000"
AlgebraicLoopWithStateMachineMsg "3"
AssertionAction "1"
InitializationCommands ""
InitialState "1"
SystemState ""
TaskingMode "1"
TaskConfigurations ""
CodeGenParameterInlining "2"
CodeGenFloatingPointFormat "2"
CodeGenAbsTimeUsageMsg "3"
CodeGenBaseName ""
CodeGenOutputDir ""
CodeGenExtraOpts ""
CodeGenTarget "Generic"
CodeGenTargetSettings ""
ExtendedMatrixPrecision "1"
MatrixSignificanceCheck "2"
EnableStateSpaceSplitting "2"
DisplayStateSpaceSplitting "1"
DiscretizationMethod "2"
ExternalModeSettings ""
AlgebraicLoopMethod "1"
AlgebraicLoopTolerance "1e-6"
ScriptsDialogGeometry ""
ScriptsDialogSplitterPos "0"
Schematic {
Location [1734, 301; 2376, 730]
ZoomFactor 1.71498
SliderPosition [0, 0]
ShowBrowser off
BrowserWidth 100
Component {
Type FsmBlock
Name "State Machine"
Show on
Position [260, 100]
Direction up
Flipped off
LabelPosition south
Frame [-40, -15; 40, 15]
Parameter {
Variable "InputVariables"
Value "i,j"
Show off
}
Parameter {
Variable "InputTypes"
Value "1,1"
Show off
}
Parameter {
Variable "InternalConstants"
Value ""
Show off
}
Parameter {
Variable "InternalConstantValues"
Value ""
Show off
}
Parameter {
Variable "InternalVariables"
Value ""
Show off
}
Parameter {
Variable "InternalVariableValues"
Value ""
Show off
}
Parameter {
Variable "OutputVariables"
Value ""
Show off
}
Parameter {
Variable "Declarations"
Value "#include <stdio.h>\n"
"\n"
"typedef enum _ParentEvent{\n"
" Parent_Idle_Event,\n"
" Start,\n"
" A2B,\n"
" B2A,\n"
" B2C,\n"
" C2A,\n"
"\n"
" Parent_Count_Event,\n"
"}ParentEvent;\n"
"\n"
"\n"
"typedef enum _ChildEvent{\n"
" Child_Idle_Event,\n"
" Idle2D,\n"
" Idle2E,\n"
" D2E,\n"
" E2D,\n"
"\n"
" Child_Count_Event,\n"
"}ChildEvent;"
Show off
}
Parameter {
Variable "TransitionOrder"
Value "2"
Show off
}
Parameter {
Variable "SampleTime"
Value "0.1"
Show off
}
Parameter {
Variable "Animate"
Value "1"
Show off
}
FSM {
Location [-1, -8; 2559, 1309]
ZoomFactor 1.14437
SliderPosition [0, 0]
FsmState {
Name "A"
Position [360, 480]
Frame [-100, -90; 100, 90]
Parameter {
Name "EnterAction"
Value "printf(\" enterA \");"
}
Parameter {
Name "DuringAction"
Value "printf(\" duringA \");"
}
Parameter {
Name "ExitAction"
Value "printf(\" exitA \");"
}
}
FsmState {
Name "B"
Position [1110, 430]
Frame [-420, -270; 420, 270]
Parameter {
Name "EnterAction"
Value "printf(\" enterB \");"
}
Parameter {
Name "DuringAction"
Value ""
}
Parameter {
Name "ExitAction"
Value "printf(\" exitB \");"
}
FsmState {
Name "D"
Position [-240, -10]
Frame [-100, -90; 100, 90]
Parameter {
Name "EnterAction"
Value "printf(\" enterD \");"
}
Parameter {
Name "DuringAction"
Value "printf(\" duringD \");"
}
Parameter {
Name "ExitAction"
Value "printf(\" exitD \");"
}
}
FsmState {
Name "E"
Position [210, -10]
Frame [-100, -90; 100, 90]
Parameter {
Name "EnterAction"
Value "printf(\" enterE \");"
}
Parameter {
Name "DuringAction"
Value "printf(\" duringE \");"
}
Parameter {
Name "ExitAction"
Value "printf(\" exitE \");"
}
}
FsmState {
Name ".Junction"
Position [-90, -160]
}
FsmState {
Name ".PointState"
Position [-90, -200]
}
}
FsmState {
Name "C"
Position [650, 1050]
Frame [-100, -90; 100, 90]
Parameter {
Name "EnterAction"
Value "printf(\" enterC \");"
}
Parameter {
Name "DuringAction"
Value "printf(\" duringC \");"
}
Parameter {
Name "ExitAction"
Value "printf(\" exitC \");"
}
}
FsmState {
Name ".PointState"
Position [330, 250]
}
FsmTransition {
FsmSrcInfo {
StatePath "A"
TerminalLoc right
TerminalCoord 0.390136
External on
}
FsmDstInfo {
StatePath "B"
TerminalLoc left
TerminalCoord 0.511449
External on
}
SegmentLengths [107.3600447694556]
LabelPosition 0.685
Parameter {
Name "Trigger"
Value "i==A2B"
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" A2B \");"
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B"
TerminalLoc left
TerminalCoord 0.654101
External on
}
FsmDstInfo {
StatePath "A"
TerminalLoc right
TerminalCoord 0.641567
External on
}
SegmentLengths [-110]
LabelPosition 0.5
Parameter {
Name "Trigger"
Value "i==B2A"
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" B2A \");"
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B"
TerminalLoc bottom
TerminalCoord 0.491978
External on
}
FsmDstInfo {
StatePath "C"
TerminalLoc top
TerminalCoord 0.435411
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value "i==B2C"
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" B2C \");"
}
Parameter {
Name "Priority"
Value "2"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "C"
TerminalLoc left
TerminalCoord 0.480089
External on
}
FsmDstInfo {
StatePath "A"
TerminalLoc bottom
TerminalCoord 0.531347
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value "i == C2A"
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" C2A \");"
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B/D"
TerminalLoc right
TerminalCoord 0.336937
External on
}
FsmDstInfo {
StatePath "B/E"
TerminalLoc left
TerminalCoord 0.350905
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value "j==D2E"
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" D2E \");"
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B/E"
TerminalLoc left
TerminalCoord 0.593025
External on
}
FsmDstInfo {
StatePath "B/D"
TerminalLoc right
TerminalCoord 0.560432
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value "j==E2D"
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" E2D \");"
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B/.PointState"
TerminalLoc bottom
TerminalCoord 0.5
External on
}
FsmDstInfo {
StatePath "B/.Junction"
TerminalLoc top
TerminalCoord 0.5
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value ""
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value ""
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B/.Junction"
TerminalLoc left
TerminalCoord 0.5
External on
}
FsmDstInfo {
StatePath "B/D"
TerminalLoc top
TerminalCoord 0.606534
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value ""
}
Parameter {
Name "Condition"
Value "j == Idle2D"
}
Parameter {
Name "Action"
Value "printf(\" Idle2D \");"
}
Parameter {
Name "Priority"
Value "1"
}
}
FsmTransition {
FsmSrcInfo {
StatePath "B/.Junction"
TerminalLoc right
TerminalCoord 0.5
External on
}
FsmDstInfo {
StatePath "B/E"
TerminalLoc top
TerminalCoord 0.519516
External on
}
SegmentLengths []
LabelPosition 0.5
Parameter {
Name "Trigger"
Value ""
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value "printf(\" Idle2E \");"
}
Parameter {
Name "Priority"
Value "2"
}
}
FsmTransition {
FsmSrcInfo {
StatePath ".PointState"
TerminalLoc bottom
TerminalCoord 0.5
External on
}
FsmDstInfo {
StatePath "A"
TerminalLoc top
TerminalCoord 0.509626
External on
}
SegmentLengths [63.5]
LabelPosition 0.5
Parameter {
Name "Trigger"
Value ""
}
Parameter {
Name "Condition"
Value ""
}
Parameter {
Name "Action"
Value ""
}
Parameter {
Name "Priority"
Value "1"
}
}
}
}
Component {
Type CScript
Name "C-Script"
Show on
Position [75, 70]
Direction up
Flipped off
LabelPosition south
Parameter {
Variable "DialogGeometry"
Value "[1296 663 655 313]"
Show off
}
Parameter {
Variable "NumInputs"
Value "1"
Show off
}
Parameter {
Variable "NumOutputs"
Value "2"
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 "0"
Show off
}
Parameter {
Variable "Ts"
Value "0.1"
Show off
}
Parameter {
Variable "Parameters"
Value ""
Show off
}
Parameter {
Variable "LangStandard"
Value "2"
Show off
}
Parameter {
Variable "GnuExtensions"
Value "1"
Show off
}
Parameter {
Variable "RuntimeCheck"
Value "2"
Show off
}
Parameter {
Variable "Declarations"
Value "#include <stdio.h>\n"
"\n"
"static int index = 0;\n"
"static int pu[20] = {0,1,2,0,0,0,0,0, 4,5,2,3};\n"
"static int cu[20] = {0,0,1,0,0,3,4,3,0,0,0,0};"
Show off
}
Parameter {
Variable "StartFcn"
Value ""
Show off
}
Parameter {
Variable "OutputFcn"
Value base64 "cHJpbnRmKCJcbuesrCVk5qyhIiwgaW5kZXgpOwpPdXRwdXQo"
"MCkgPSBwdVtpbmRleF07Ck91dHB1dCgxKSA9IGN1W2luZGV4XTsKaW5kZXgrKzsKCgo="
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 Scope
Name "Scope"
Show on
Position [165, 35]
Direction up
Flipped off
LabelPosition south
Location [811, 582; 1161, 825]
State "AAAA/wAAAAD9AAAAAgAAAAEAAAAAAAAAAPwCAAAAA/sAAAAQAFoAbwBvA"
"G0AQQByAGUAYQAAAAAA/////wAAADQA////+wAAABQAUwBhAHYAZQBkAFYAaQBlAHcAcwAAAAAA//"
"///wAAAGYA////+wAAAAwAVAByAGEAYwBlAHMAAAAAAP////8AAABmAP///wAAAAMAAAAAAAAAAPw"
"BAAAAAfsAAAAUAEQAYQB0AGEAVwBpAGQAZwBlAHQAAAAAAP////8AAABQAP///wAAAV4AAADYAAAA"
"BAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAA"
"AAAAA=="
SavedViews "AAAAAgAAAAA="
HeaderState "AAAA/wAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAL/gMAAAAJAAAAA"
"wAAAGQAAAACAAAAZAAAAAkAAABkAAAACAAAAGQAAAAFAAAAZAAAAAQAAABkAAAABwAAAGQAAAAGAA"
"AAZAAAAAEAAABkAAAAiwAAAAsBAAABAAAAAAAAAAAAAAAAZP////8AAACBAAAAAAAAAAsAAABzAAA"
"AAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAA"
"AAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAA"
"AAYAAAAAQAAAAAAAAPoAAAAABg="
PlotPalettes "AAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
Axes "1"
TimeRange "0.0"
ScrollingMode "1"
SingleTimeAxis "1"
Open "1"
Ts "-1"
SampleLimit "0"
XAxisLabel "Time / s"
ShowLegend "1"
Axis {
Name ""
AutoScale 1
MinValue 0
MaxValue 1
Signals {}
SignalTypes [ ]
Untangle 0
KeepBaseline off
BaselineValue 0
}
Fourier {
SingleXAxis on
AxisLabel "Frequency / Hz"
Scaling 0
PhaseDisplay 0
ShowFourierLegend off
Axis {
Name ""
AutoScale 1
MinValue 0
MaxValue 1
Signals {}
Untangle 0
KeepBaseline off
BaselineValue 0
}
}
}
Component {
Type SignalDemux
Name "Demux"
Show off
Position [165, 100]
Direction right
Flipped on
LabelPosition south
Parameter {
Variable "Width"
Value "2"
Show off
}
}
Connection {
Type Signal
SrcComponent "C-Script"
SrcTerminal 2
Points [135, 70]
Branch {
DstComponent "Scope"
DstTerminal 1
}
Branch {
Points [135, 100]
DstComponent "Demux"
DstTerminal 1
}
}
Connection {
Type Signal
SrcComponent "Demux"
SrcTerminal 2
DstComponent "State Machine"
DstTerminal 1
}
Connection {
Type Signal
SrcComponent "Demux"
SrcTerminal 3
DstComponent "State Machine"
DstTerminal 2
}
}
}
DemoSignature "C/ZrxOQHJ0OXW30du/vTiFYFVRZZzc0r6Uyc2MRNbyo="