Skip to content

Simulation parameters

kyrcha edited this page Jul 23, 2012 · 6 revisions

RESTful protocol for SimulationParams

The following Foreign Key apply:

simulationsparams.scn_id : Foreign Key to Scenarios

READ SimulationParams

GET /api/smp?scn_id={scn_id} | index

Fetches the Simulation Paramameters of a Scenario using the query parameter scn_id.

Consumes: Route, Parameter

Produces: JSON

READ SimulationParam

GET /api/smp/{smp_id} | show

Fetches the properties (simulation parameters) of a Simulation.

Consumes: Route

Produces: JSON

{
  "success": true,
  "message": "Simulation Parameters retrieved successfully",
  "size": 1,
  "data": [
    {
      "_id": { "$oid": "4ff5bca7e4b0082c63d08df3" },
      "sim_param": {
        "name": "BBBB simulation",
        "numberOfDay": 33,
        "scn_id": "4ff5bca7e4b0082c63d08df3",
        "cid": { "$oid": "4ff5bca7e4b0082c63d08df5" }
      }
    }
  ]
}

CREATE SimulationParam

POST /api/smp | create

Creates a new _Simulation for the given Scenario, based on the properties filled up by the user when creating a new Simulation.

Consumes: Route, JSON

{
    name: "A simulation",
    numberOfDay: 44,
    scn_id : "4ff1a8e2e4b0ed82920aa45b",
    locationInfo : "Athens",
    calendar : {
        dayOfMonth : 20,
        dayOfWeek : "Monday",
        month : 3,
        year : 2012
    }
}

Produces: Create status

UPDATE SimulationParam

PUT /api/smp/{smp_id} | update

Updates the properties of the Simulation after editing.

Consumes: Route, JSON

Produces: Update status

DELETE SimulationParam

DELETE /api/smp/{smp_id} | delete

Deletes the existing Simulation.

Consumes: Route

Produces: Delete status

Simulation Parameters Schema

{
    "name": "SimulationParameters",
    "type": "object",
    "description": "The simulation parameters of a scenario",
    "properties": {
        "scn_id": {
            "type": "string",
            "description": "The ObjectId of the Scenario these Simulation Parameters belong ",
            "optional": false
        },
        "name": {
            "type": "string",
            "description": "Name of the Simulation Parameters",
            "optional": true
        },        
        "description": {
            "type": "string",
            "description": "Description of the Simulation Parameters",
            "optional": true
        },
        "numberOfDay": {
            "type": "integer",
            "description": "The number of days that the simulation will run",
            "optional": true
        },
        "locationInfo": {
            "type": "string",
            "description": "Information about the location",
            "optional": true
        }, 
        "calendar": {
            "type": "object",
            "description": "Calendar",
            "optional": true,
            "properties" : {
                "dayOfMonth" : {
                    "type": "integer",
                    "optional": true
                },
                "dayOfWeek" : {
                    "type": "string",
                    "optional": true                
                },
                "month" : {
                    "type": "integer",
                    "optional": true               
                },
                "year" : {
                    "type": "integer",
                    "optional": true                
                }                
            },
            "optional": true
        }               
    },
    "additionalProperties" : false
}