Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

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

README.md

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

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.