Giter Site home page Giter Site logo

cepsdev / machines4ceps Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 60.84 MB

Workflow/State Machine Engine written in modern C++. Offers a comprehensive DSL (Domain Specific Language) for UML state machines. Comes with a runtime to run, trace and visualize your state machines.

License: Apache License 2.0

Makefile 0.70% Shell 0.93% HTML 15.89% C++ 44.59% QMake 0.27% Lex 0.22% CSS 0.09% JavaScript 37.18% C 0.04% CMake 0.10%
engine harel harel-statechart low-code mermaidjs nietzsche portable state-chart state-machine state-machines uml uml-diagram uml-diagrams uml-state-diagram uml-state-machine websocket workflow-engine workflow-tool

machines4ceps's People

Contributors

bizlbizl avatar cepsdev avatar finfalter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cni-kbj

machines4ceps's Issues

The binary op(...) operator

Introduce a left associative operator op(...) with precedence higher than the comment operator #, where ... stands for a non empty character sequence.

Examples: op(in), op(+++), op(select all *)

An expression of the form A op(xyz) B would be parsed as (S-expression)

 (xyz A B)

Use case: with the --pr option set, the right hand side of the comment operator '#' gets evaluated which allows for a more user friendly print version of an expression. In this context user defined operators for documentation purposes would be nice.

Example:

ComplexGuard = in_state(A.B.C.abc) || in_state(X.C.D.F.j) && Predicate1(...) # (States op(are in) A op(and) P)

would evaluate to (in --pr mode):

States are in A and P

with additional formatting.

Markdown Output

In addition to the format option ansi (in combination with the options --pr [print raw] / --pe [print evaluated] / --ppe [print post evaluation] ) diverse markdown styles (Jira/Github/Asciidoc etc.) should be supported.

Console Output (Options --pe,--ppe): Wrong transitions

kind Event;
kind Guard;
kind Systemstate;

Guard CP_StateA;
Guard CP_StateB;
Guard CP_StateC;
Guard CP_StateD;

Guard CP_OutOfBounds_StateB;
Guard CP_OutOfBounds_StateC;
Guard CP_OutOfBounds_StateD;
Guard CPVoltageInBoundsForCurrentState;
Guard TooManyPeaksInARow;
Guard PeakdelayIntervalElapsed;
Guard NoPeakDetected;
Guard PeakDetected;

Event ReadValuesFromChargingBus; 
Event PeakDetectionCompleted;

Systemstate current_cp_voltage;
Systemstate peak_counter;
Systemstate max_peaks_in_a_row;
Systemstate peakdelay_interval;


current_cp_voltage = 0.0;
peak_counter = 0;


max_peaks_in_a_row = 8;
peakdelay_interval = 10;

sm{
    evse;
    sm{
        secc;
        sm{
            secc_serial;
            sm{
                peak_detect;
                states{Initial;CheckPeakCondition;NoPeak;Peak;Plateau;};
                t{Initial;CheckPeakCondition;};

                t{CheckPeakCondition;Peak;CP_OutOfBounds_StateB;};
                t{CheckPeakCondition;Peak;CP_OutOfBounds_StateC;};
                t{CheckPeakCondition;Peak;CP_OutOfBounds_StateD;};
                t{CheckPeakCondition;NoPeak;CPVoltageInBoundsForCurrentState;};

                t{Peak;CheckPeakCondition;ReadValuesFromChargingBus;};
                t{NoPeak;CheckPeakCondition;ReadValuesFromChargingBus;};

                t{Peak;Plateau;TooManyPeaksInARow;};
                t{Plateau;CheckPeakCondition;ReadValuesFromChargingBus;PeakdelayIntervalElapsed;};
            };
            sm{
                analyzePhysicalValues;
                states{Initial;
                 WaitForNewValuesFromChargingBus;
                 WaitForPeakDetection;
                 DoComputationsBasedOnCPVoltage;
                 AnalyzeBCPToggle;};
                
                t{Initial;WaitForNewValuesFromChargingBus;};
                t{WaitForNewValuesFromChargingBus;WaitForPeakDetection;ReadValuesFromChargingBus;};
                t{WaitForPeakDetection;DoComputationsBasedOnCPVoltage;PeakDetectionCompleted;NoPeakDetected;};
                t{WaitForPeakDetection;AnalyzeBCPToggle;PeakDetectionCompleted;PeakDetected;};
                t{DoComputationsBasedOnCPVoltage;AnalyzeBCPToggle;};
                t{AnalyzeBCPToggle;WaitForNewValuesFromChargingBus;};
            };
            states{Initial;};
            t{Initial;peak_detect;};
            t{Initial;analyzePhysicalValues;};

        };
        states{Initial;};
        t{Initial;secc_serial;};        
    };
    sm{
        low_level_charging_bus;
        states{Initial;};
        sm{
            ControlPilot;
            states{Initial;A;B;C;D;};
            t{Initial;A;};

        };
        sm{
            ProximityPilot;
            states{Initial;Connected;Disconnected;};
        };

        t{Initial;ControlPilot;};
        t{Initial;ProximityPilot;};
    };
    states{Initial;};
    t{Initial;low_level_charging_bus;};
    t{Initial;secc;};
};

Produces the output:

State Machine evse:
 States:
  Initial
 Transitions:
  Initial --low_level_charging_bus
  Initial --secc

 State Machine secc:
  States:
   Initial
  Transitions:
   A --State Machine secc_serial:
   States:
    Initial
   Transitions:
    Plateau --CheckPeakCondition --State Machine peak_detect:
    States:
     Initial, CheckPeakCondition, NoPeak, Peak, Plateau
    Transitions:
      --Initial
     Peak -[PeakDetectionCompleted]-analyzePhysicalValues
     Initial -[ReadValuesFromChargingBus]-WaitForNewValuesFromChargingBus
     DoComputationsBasedOnCPVoltage -[CP_OutOfBounds_StateB]-CheckPeakCondition
      -[CP_OutOfBounds_StateC]-Plateau
     Initial -CP_OutOfBounds_StateD-CheckPeakCondition
      -CPVoltageInBoundsForCurrentState-CheckPeakCondition -[ReadValuesFromChargingBus]-Peak
     CheckPeakCondition -PeakDetectionCompleted[NoPeakDetected]-Peak
   

   State Machine analyzePhysicalValues:
    States:
     Initial, WaitForNewValuesFromChargingBus, WaitForPeakDetection, DoComputationsBasedOnCPVoltage, AnalyzeBCPToggle
    Transitions:
      --NoPeak
     Peak -ReadValuesFromChargingBus-Peak -CPVoltageInBoundsForCurrentState[CP_OutOfBounds_StateD]--CP_OutOfBounds_StateC[CP_OutOfBounds_StateB]-Plateau
     Initial --CheckPeakCondition
     CheckPeakCondition --Peak
   
  
 

 State Machine low_level_charging_bus:
  States:
   Initial
  Transitions:
   Initial --ControlPilot
   Initial --ProximityPilot

  State Machine ControlPilot:
   States:
    Initial, A, B, C, D
   Transitions:
     --Initial
  

  State Machine ProximityPilot:
   States:
    Initial, Connected, Disconnected

Almost all transitions are wrong

Events are ignored in actions.

The following doesn't work - E is never fired.

Event E;
sm{
 S;
 on_enter{
   E;
 };
 states{Initial;};
};
Simulation{
 Start{S;};
};

But putting E into a scope works:

...
 on_enter{
   {E;}
 };
...

Docgen: Introduce mechanism to define verbosity of output

We need a general mechanism to control the verbosity of the output written by document modules. e.g. console output triggered by the --pr option.

An interesting approach would be to introduce doc-templates.

Example:

Consider the following state machine definition.

sm{
S;
states{A;B;C;};
t{A;B;};
};

A user might be interested only in the name of the states and not the specific transitions. i.e. he would like a summary in the form:

State Machine S
States:
A, B, C

To achieve this, the user could define a docgen-template:

kind docgen_template; docgen_template DT;
template{
DT;
sm{
states;
};
};

Meaning: Of all top level elements print only sm - elements, and of sm -elements print only states.

Console Output of State Machine Definition doesn't merge definitions

Consider following definition:

sm{
EVCC_Application_Layer;
states{Initial;A;B;Final;};
t{Initial;A;};
};

sm{
EVCC_Application_Layer;
t{A;B;};
};

this is correctly interpreted as

sm{
EVCC_Application_Layer;
states{Initial;A;B;Final;};
t{Initial;A;};
t{A;B;};
};

but printed as two different state machines (e.g. using --pe --format ansi)

State Machine EVCC_Application_Layer:
States:
Initial, A, B, Final
Transitions:
Initial --▶ A

State Machine EVCC_Application_Layer:
Transitions:
A --▶ B

Should be:

State Machine EVCC_Application_Layer:
States:
Initial, A, B, Final
Transitions:
Initial --▶ A
A --▶ B

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.