|
|
|
|
within AIDAModelica;
|
|
|
|
|
model SelectControlMode "[SF4.3] Select control mode"
|
|
|
|
|
Modelica.Blocks.Interfaces.BooleanOutput SelectedControlMode "0 == AP, 1 == SAC" annotation(Placement(
|
|
|
|
|
visible = true,transformation(origin = {53, -15}, extent = {{-21, -21}, {21, 21}}, rotation = 0),
|
|
|
|
|
iconTransformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
|
|
|
|
|
Modelica.Blocks.Interfaces.BooleanInput APEngagement "0 ==AP, 1 == SAC" annotation(Placement(
|
|
|
|
|
visible = true,transformation(extent = {{-96, -38}, {-56, 2}}, rotation = 0),
|
|
|
|
|
iconTransformation(extent = {{-120, -20}, {-80, 20}}, rotation = 0)));
|
|
|
|
|
type Main_StateT = enumeration(
|
|
|
|
|
InActive "InActive(1)",
|
|
|
|
|
InitialState2 "InitialState2(2)",
|
|
|
|
|
WaitingForDeploy "WaitingForDeploy(3)",
|
|
|
|
|
APControlMode "APControlMode(4)",
|
|
|
|
|
SACControlMode "SACControlMode(5)");
|
|
|
|
|
Main_StateT Main_State(start=Main_StateT.InitialState2) "Main_State";
|
|
|
|
|
protected
|
|
|
|
|
type TransT = enumeration(
|
|
|
|
|
InActive "InActive(1)",
|
|
|
|
|
Main_Transition3 "Main_Transition3(2)",
|
|
|
|
|
Main_Transition4 "Main_Transition4(3)",
|
|
|
|
|
Main_Transition6 "Main_Transition6(4)",
|
|
|
|
|
Main_Transition5 "Main_Transition5(5)",
|
|
|
|
|
Main_Transition2 "Main_Transition2(6)");
|
|
|
|
|
type StateT = enumeration(
|
|
|
|
|
InActive "InActive(1)",
|
|
|
|
|
Main_InitialState2 "Main_InitialState2(2)",
|
|
|
|
|
Main_WaitingForDeploy "Main_WaitingForDeploy(3)",
|
|
|
|
|
Main_APControlMode "Main_APControlMode(4)",
|
|
|
|
|
Main_SACControlMode "Main_SACControlMode(5)");
|
|
|
|
|
//Main_StateT Onto_Main_State(start=Main_StateT.WaitingForDeploy) "Onto_Main_State";
|
|
|
|
|
TransT Last_Trans(start=TransT.InActive) "Last_Trans" annotation(HideResult=false);
|
|
|
|
|
StateT Last_State(start=StateT.InActive) "Last_State" annotation(HideResult=false);
|
|
|
|
|
algorithm
|
|
|
|
|
// State Chart Algorithm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Copyright (C) 2008-2010 by Fraunhofer-Gesellschaft. All rights reserved.
|
|
|
|
|
// Fraunhofer Institute for Integrated Circuits, Design Automation Division
|
|
|
|
|
// Fraunhofer Statechartcompiler 20100219
|
|
|
|
|
// CompilerFlags: SimulationX, -
|
|
|
|
|
// Generation time: 14/08/2018 14:46:30
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Event Generation Block
|
|
|
|
|
// Entry Activity Blocks
|
|
|
|
|
// Entry Activity Block of Main_
|
|
|
|
|
when (Main_State == Main_StateT.APControlMode) then
|
|
|
|
|
SelectedControlMode:=true;
|
|
|
|
|
elsewhen (Main_State == Main_StateT.SACControlMode) then
|
|
|
|
|
SelectedControlMode:=false;
|
|
|
|
|
end when;
|
|
|
|
|
// Transition Blocks
|
|
|
|
|
// Transition Block of Main_
|
|
|
|
|
when ( pre(Main_State) == Main_StateT.WaitingForDeploy ) and ( APEngagement==true ) then
|
|
|
|
|
Main_State := Main_StateT.APControlMode;
|
|
|
|
|
Last_Trans := TransT.Main_Transition3;
|
|
|
|
|
Last_State := StateT.Main_WaitingForDeploy;
|
|
|
|
|
elsewhen ( pre(Main_State) == Main_StateT.WaitingForDeploy ) and ( APEngagement == false ) then
|
|
|
|
|
Main_State := Main_StateT.SACControlMode;
|
|
|
|
|
Last_Trans := TransT.Main_Transition4;
|
|
|
|
|
Last_State := StateT.Main_WaitingForDeploy;
|
|
|
|
|
elsewhen ( pre(Main_State) == Main_StateT.APControlMode ) and ( APEngagement==false ) then
|
|
|
|
|
Main_State := Main_StateT.SACControlMode;
|
|
|
|
|
Last_Trans := TransT.Main_Transition6;
|
|
|
|
|
Last_State := StateT.Main_APControlMode;
|
|
|
|
|
elsewhen ( pre(Main_State) == Main_StateT.SACControlMode ) and ( APEngagement==true ) then
|
|
|
|
|
Main_State := Main_StateT.APControlMode;
|
|
|
|
|
Last_Trans := TransT.Main_Transition5;
|
|
|
|
|
Last_State := StateT.Main_SACControlMode;
|
|
|
|
|
elsewhen initial() then
|
|
|
|
|
Main_State := Main_StateT.WaitingForDeploy;
|
|
|
|
|
SelectedControlMode:=false;
|
|
|
|
|
Last_Trans := TransT.Main_Transition2;
|
|
|
|
|
Last_State := StateT.Main_InitialState2;
|
|
|
|
|
end when;
|
|
|
|
|
// End of Statechart
|
|
|
|
|
annotation(
|
|
|
|
|
viewinfo(
|
|
|
|
|
statechart="AAEAAAD/////AQAAAAAAAAAMAgAAAEVTdGF0ZUNoYXJ0VmlldywgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwMAwAAAEhTdGF0ZUNoYXJ0TGlicmFyeSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwFAQAAACBTdGF0ZUNoYXJ0Vmlldy5TdGF0ZUNoYXJ0V3JhcHBlcgEAAAAKc3RhdGVDaGFydAQcU3RhdGVDaGFydExpYnJhcnkuU3RhdGVDaGFydAMAAAACAAAACQQAAAAFBAAAABxTdGF0ZUNoYXJ0TGlicmFyeS5TdGF0ZUNoYXJ0BwAAAAh2ZXJ0aWNlcwl0YWJsZVNFRFQQZGVmaW5lZFZhcmlhYmxlcwthY3RpdmVTdGF0ZQduYW1lSURzCXZhcmlhYmxlcxBlbnVtZXJhdGlvblR5cGVzAwMDBAMDA4cBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tTdGF0ZUNoYXJ0TGlicmFyeS5WZXJ0ZXgsIFN0YXRlQ2hhcnRMaW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ZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3RhdGVDaGFydExpYnJhcnkuVmFyaWFibGUsIFN0YXRlQ2hhcnRMaWJyYXJ5LCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAcU3RhdGVDaGFydExpYnJhcnkuVmFyaWFibGVbXQMAAAAICAkQAAAAAAAAADwAAAAECgAAAIwBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tT
|
|
|
|
|
statechartsymbols={"Main_StateT","Main_State","TransT","StateT","Onto_Main_State","Last_Trans","Last_State"},
|
|
|
|
|
typename="TypeInfo"),
|
|
|
|
|
Icon(graphics={
|
|
|
|
|
Rectangle(
|
|
|
|
|
fillColor={255,255,255},
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{-100,100},{100,-100}})}),
|
|
|
|
|
Diagram(graphics={
|
|
|
|
|
Ellipse(
|
|
|
|
|
lineColor=DynamicSelect({0,0,0},if Last_State==StateT.Main_InitialState2 then{255,0,0}else{0,0,0}),
|
|
|
|
|
fillColor=DynamicSelect({0,0,0},if Main_State==Main_StateT.InitialState2 then{255,128,128}else{0,0,0}),
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{-30,90},{-26,86}}),
|
|
|
|
|
Rectangle(
|
|
|
|
|
radius=4,
|
|
|
|
|
lineColor=DynamicSelect({0,0,0},if Last_State==StateT.Main_WaitingForDeploy then{255,0,0}else{0,0,0}),
|
|
|
|
|
fillColor=DynamicSelect({255,255,255},if Main_State==Main_StateT.WaitingForDeploy then{255,128,128}else{255,255,255}),
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{-45,76},{-10,55}}),
|
|
|
|
|
Text(
|
|
|
|
|
textString="WaitingForDeploy",
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{-45,74},{-10,68}}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{-45,66},{-10,66}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_State==StateT.Main_WaitingForDeploy then{255,0,0}else{0,0,0})),
|
|
|
|
|
Rectangle(
|
|
|
|
|
radius=4,
|
|
|
|
|
lineColor=DynamicSelect({0,0,0},if Last_State==StateT.Main_APControlMode then{255,0,0}else{0,0,0}),
|
|
|
|
|
fillColor=DynamicSelect({255,255,255},if Main_State==Main_StateT.APControlMode then{255,128,128}else{255,255,255}),
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{6,41},{41,14}}),
|
|
|
|
|
Text(
|
|
|
|
|
textString="APControlMode",
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{6,39},{41,33}}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{6,31},{41,31}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_State==StateT.Main_APControlMode then{255,0,0}else{0,0,0})),
|
|
|
|
|
Rectangle(
|
|
|
|
|
radius=4,
|
|
|
|
|
lineColor=DynamicSelect({0,0,0},if Last_State==StateT.Main_SACControlMode then{255,0,0}else{0,0,0}),
|
|
|
|
|
fillColor=DynamicSelect({255,255,255},if Main_State==Main_StateT.SACControlMode then{255,128,128}else{255,255,255}),
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{-85,42},{-50,13}}),
|
|
|
|
|
Text(
|
|
|
|
|
textString="SACControlMode",
|
|
|
|
|
fillPattern=FillPattern.Solid,
|
|
|
|
|
extent={{-85,40},{-50,34}}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{-85,32},{-50,32}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_State==StateT.Main_SACControlMode then{255,0,0}else{0,0,0})),
|
|
|
|
|
Line(
|
|
|
|
|
points={{-28,86},{-28,82},{-28,80},{-28,76}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_Trans==TransT.Main_Transition2 then{255,0,0}else{0,0,0}),
|
|
|
|
|
arrow={Arrow.None,Arrow.Filled}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{-10,64},{14,64},{14,41}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_Trans==TransT.Main_Transition3 then{255,0,0}else{0,0,0}),
|
|
|
|
|
arrow={Arrow.None,Arrow.Filled}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{-45,63},{-70,63},{-70,42}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_Trans==TransT.Main_Transition4 then{255,0,0}else{0,0,0}),
|
|
|
|
|
arrow={Arrow.None,Arrow.Filled}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{6,20},{-50,20}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_Trans==TransT.Main_Transition6 then{255,0,0}else{0,0,0}),
|
|
|
|
|
arrow={Arrow.None,Arrow.Filled}),
|
|
|
|
|
Line(
|
|
|
|
|
points={{-50,32},{-13,32},{6,32}},
|
|
|
|
|
color=DynamicSelect({0,0,0},if Last_Trans==TransT.Main_Transition5 then{255,0,0}else{0,0,0}),
|
|
|
|
|
arrow={Arrow.None,Arrow.Filled})}));
|
|
|
|
|
end SelectControlMode;
|