StateGraphRoot

model StateGraphRoot "Root of a StateGraph (has to be present on the highest level of a StateGraph)"
    extends StateGraph.Interfaces.CompositeStepState;

    output Integer activeSteps "Number of active steps within the stategraph";
equation
    activeSteps = -integer(subgraphStatePort.activeSteps);

    annotation (
        defaultComponentName = "stateGraphRoot",
        defaultComponentPrefixes = "inner",
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {-200, 110}, 
                        {200, 150}},
                    textString = "%name",
                    lineColor = {0, 0, 255}), 
                Rectangle(extent = {
                    {-100, 100}, 
                    {100, -100}}), 
                Text(
                    extent = {
                        {-92, 78}, 
                        {96, 34}},
                    textString = "root"), 
                Rectangle(extent = {
                    {-82, -6}, 
                    {-44, -40}}), 
                Line(points = {
                    {0, 10}, 
                    {0, -60}}), 
                Rectangle(extent = {
                    {48, -6}, 
                    {86, -40}}), 
                Polygon(
                    points = {
                        {-12, -16}, 
                        {0, -22}, 
                        {-12, -28}, 
                        {-12, -16}},
                    fillPattern = FillPattern.Solid), 
                Line(points = {
                    {-44, -22}, 
                    {-12, -22}}), 
                Polygon(
                    points = {
                        {36, -16}, 
                        {48, -22}, 
                        {36, -28}, 
                        {36, -16}},
                    fillPattern = FillPattern.Solid), 
                Line(points = {
                    {0, -22}, 
                    {36, -22}})}),
        Documentation(info = "<html>\n<p>\nOn the highest level of a StateGraph, an instance of StateGraphRoot\nhas to be present.\n</p>\n<p>\nThe StateGraphRoot object is needed, since all Step objects have\nan \"outer\" reference to communicate with the \"nearest\" CompositeStep\n(which inherits from PartialCompositeStep), especially to abort\na CompositeStep via the \"suspend\" port. Even if no \"CompositeStep\" is present,\non highest level a corresponding \"inner\" definition is needed\nand is provided by the StateGraphRoot object.\n</p>\n</html>"));
end StateGraphRoot;