Skip to content

r-simmer/simmer.json

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

simmer.json

This is an experimental package. The R and JSON syntax can still change significantly.

This package allows to read in a JSON object and translate it into a simmer environment. See below for an example definition:

library(simmer.json)

my_JSON<-'{
  "env": {
    "resources": {
      "nurse": {
        "capacity": 1
      }
    },
    "generators": {
      "patients": {
        "trajectory": "t1",
        "dist": "%at(0,0,0)%"
      }
    }
  },
  "trajectories": {
    "t1": [
      {
        "activity": "seize",
        "resource": "nurse"
      },
      {
        "activity": "timeout",
        "task": "%3%"
      },
      {
        "activity": "release",
        "resource": "nurse"
      }
    ]
  }
}
'

You can translate this into simmer using:

library(simmer.json)
env<-
  deserialise(my_JSON)

env
## simmer environment: anonymous | now: 0 | next: 0
## { Resource: nurse | monitored: 1 | server status: 0(1) | queue status: 0(Inf) }
## { Generator: patients | monitored: 1 | n_generated: 1 }

And run the environment:

env %>%
  run()
## simmer environment: anonymous | now: 9 | next: 
## { Resource: nurse | monitored: 1 | server status: 0(1) | queue status: 0(Inf) }
## { Generator: patients | monitored: 1 | n_generated: 3 }

About

Read / Load 'simmer' Definitions in JSON Format

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages