We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
diff --git a/MCEWD998.cfg b/MCEWD998.cfg index d998f17..75f0f3d 100644 --- a/MCEWD998.cfg +++ b/MCEWD998.cfg @@ -1,6 +1,9 @@ CONSTANT N = 3 +CONSTANT Init <- StatsInit SPECIFICATION Spec +CONSTRAINT Stats CONSTRAINT StateConstraint \ No newline at end of file +CONSTRAINT Plot \ No newline at end of file diff --git a/MCEWD998.tla b/MCEWD998.tla index 4ce9ddd..8540b60 100644 --- a/MCEWD998.tla +++ b/MCEWD998.tla @@ -1,5 +1,38 @@ ------------------------------- MODULE MCEWD998 ------------------------------- -EXTENDS EWD998 +EXTENDS EWD998, CSV, TLC, FiniteSets, Sequences, IOUtils + +----------------------------------------------------------------------------- + +StatsInit == + (* Just a single initial state. *) + /\ active \in [Node -> {TRUE}] + /\ pending = [i \in Node |-> 0] + (* Rule 0 *) + /\ color \in [Node -> {"black"}] + /\ counter = [i \in Node |-> 0] + /\ pending = [i \in Node |-> 0] + /\ token = [pos |-> 0, q |-> 0, color |-> "black"] + + +CSVFile == + "MCEWD998.csv" + +ASSUME + (* Write CSV header at startup *) + CSVRecords(CSVFile) = 0 => CSVWrite("n#counter", <<>>, CSVFile) + +Stats == + \* Cfg: CONSTRAINT Stats + \A n \in Node: CSVWrite("%1$s#%2$s", <<n, counter[n]>>, CSVFile) + +Plot == + \* Cfg: CONSTRAINT Plot + \* level 2 and not 1 because all initial states are generated at startup. + TLCGet("level") = 2 => + IOExec(<< + "/usr/bin/env", "Rscript", + "MCEWD998.R", CSVFile>>).exitValue = 0 +----------------------------------------------------------------------------- (***************************************************************************) (* Bound the otherwise infinite state space that TLC has to check. *)
MCEWD998.R
#!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) svg("MCEWD998.svg") d <- read.csv( header = TRUE, sep = '#', file = args[1]) hist(d$counter, main='EWD840!counter', xlab ='Number of Messages', xlim = c(min(d$counter), max(d$counter))) dev.off()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
MCEWD998.R
The text was updated successfully, but these errors were encountered: