Coder Social home page Coder Social logo

maggen-hub / gena-commfsm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pais-lab-public-projects/gena-commfsm

0.0 0.0 0.0 247 KB

A program used for emulating a system of communicating finite state machines and generating a log

License: MIT License

Java 55.80% Scala 43.85% Shell 0.35%

gena-commfsm's Introduction

Gene-CommFSM

Codacy Badge Build Status

Gene-CommFSM is a tool aimed to emulating behavior of communication of finite state machines. The result of emulation can be saved to a file

How to build

The project uses gradle as a build system. In order to build cli jar use:

# build jar
$ ./gradlew build
# run jar 
$ java -jar CFSM-dist/build/libs/cfsm-1.2.0.jar -help
# example usage with test config
$ java -jar CFSM-dist/build/libs/cfsm-1.2.0.jar -f ./CFSM-parser/src/test/resources/cfsm.json 

Note: make sure you have java 8/9 installed.

Usage

usage: cfsm
 -c,--cases <arg>           amount of cases to generate
 -csv                       Format of logs is csv. Work only with '-d'
                            flag
 -d,--destination <arg>     Path where generated logs will be stored
 -elim,--max-events <arg>   maximum amount of events inside one generation
                            session
 -f,--file <arg>            Path to file with description of model
 -h,--help                  Print help message
 -nv,--no-validation        should config file be validated
 -sc,--show-conditions      Print conditions in csv log. Works only with
                            '-d' and '-csv' flag
 -ss,--show-states          Print states in csv log. Works only with '-d'
                            and '-csv' flag

Example

Let's say you have a configuration file like this:

{
  "protocol": "CFSM 0.3",
  "automata": [
    {
      "name": "A",
      "states": [
        {
          "type": "INITIAL",
          "name": "state1"
        },
        {
          "type": "FINAL",
          "name": "state2"
        }
      ],
      "transitions": [
        {
          "name": "transition1",
          "type": "SENDM",
          "condition": "B ! msg1",
          "from": "state1",
          "to": "state2"
        }
      ]
    },
    {
      "name": "B",
      "states": [
        {
          "type": "INITIAL",
          "name": "state1"
        },
        {
          "type": "GENERAL",
          "name": "state2"
        },
        {
          "type": "FINAL",
          "name": "state3"
        }
      ],
      "transitions": [
        {
          "name": "transition2",
          "type": "RECM",
          "condition": "A ? msg1",
          "from": "state1",
          "to": "state2"
        },
        {
          "name": "transition3",
          "type": "SENDM",
          "condition": "C ! msg1",
          "from": "state2",
          "to": "state3"
        }
      ]
    },
    {
      "name": "C",
      "states": [
        {
          "type": "INITIAL",
          "name": "state1"
        },
        {
          "type": "FINAL",
          "name": "state2"
        }
      ],
      "transitions": [
        {
          "name": "transition4",
          "type": "RECM",
          "condition": "B ? msg1",
          "from": "state1",
          "to": "state2"
        }
      ]
    }
  ]
}

The file can be at CFSM-engine/src/test/resources/cfsm2.json. And you want to generate a logs, the system produce.

That is how it can be done:

Specified path to file is: CFSM-engine/src/test/resources/cfsm2.json
Parsing configuration file......
Valid JSON: OK
Valid syntax: OK
Valid config objects: OK
3 machines found
A: state1 ---> state2
B: state1 ---> state2
B: state2 ---> state3
C: state1 ---> state2

gena-commfsm's People

Contributors

maggen-hub avatar mitsyuk avatar sammers21 avatar

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.