Persimia API

Persimia API is a REST-based API service that runs risk simulations for the wind energy industry. For more information about Persimia, see persimia.com.

Typical Workflow

Here are the typical steps that you will use to send API requests:

  1. Request a client API account from Persimia. You only need to do this once.
  2. Obtain an access token by sending an HTTP POST request to https://api.persimia.com/authentication. If successful, this will return an accessToken in the result.
  3. Use the accessToken from step 2 make an API request. You do this by creating a key/value pair in the header of the API request.
    The key must be named 'Authorization' and the value should be the concatenation of 'Bearer ' and the accessToken. Note: there must be space between 'Bearer' and the token.

Hint: It's helpful to use a REST-based API tool that you can test with. A good tool for this is Postman.

Authentication

Persimia API uses the OAuth 2.0 protocol for authentication. All simulation API requests must contain an OAuth 2.0 access token using the Bearer authentication scheme. You must first request an access token by sending a POST authentication request with your email and password. Note: Please contact Persimia to request a client API account. If the authentication is successful, then the response will include an access token.
Here are the details:

POST: https://persimia.com/authentication

Body:


 {
     "strategy" : "local",
     "email" : "youremail",
     "password" : "yourpassword"
 }
 

Typical successful response:

{
     "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6ImFjY2VzcyJ9.eyQiOjE1OTMTA2MzY0MjcsImV4cCI6MTU5MzcyMjgyNywiYXVkIjoiaHR0ccGkucGVyc2ltaWEuY29tIiwiaXNzIjoiJpYXZmVhdGhlcnMiLCJzdWIiOiIxIiwianRpIjoiYHM6Ly9h2UwY2EzMTItM2U2MC00NTMzLTk3ZtMTZhYTdlOWU2NzA4In0.-YIpPM2GpuSkN_F8N53I5x8dZ-OKOEDU1-86DmEaR2c",
     "authentication": {
         "strategy": "local"
     },
     "user": {
         "id": 999,
         "email": "youremail",
         "created_at": "2019-11-10T20:58:30.000Z",
         "updated_at": "2019-11-10T20:58:30.000Z"
     }
 }
 

The accessToken is valid for 1 day. After that you will need to reauthenticate.

Create a Flicker Simulation

This will submit a simulation request. The simulation type should be of type 'flicker'. When you submit the request, it will be queued with other requests. Depending on the type of simulation and the input data (number of turbines and receptors), it may take anywhere from a few minutes or a few hours to run.

Request

POST: https://persimia.com/api/1/simulations

Headers attributes:

Body: JSON-formatted simulation input with the following attributes:

Example Flicker Input

{
    "simulationType": "flicker",
    "clientId": "xyz-client-1",
    "clientSimulationId": "xyz-proj-45-sim-13",
    "projectId": "xyz-proj-45",
    "projectName": "XYZ Project 45 - Bremen",
    "numberOfContours": 10,
    "contourLevels": [0, 5, 30, 100],
    "turbines": [
       {
          "name": "T1",
          "latitude": 37.750404,
          "longitude": -95.0088,
          "turbineModelName": "Vestas V136",
          "turbineHubHeight": 100,
          "turbineRotorRadius": 66,
          "turbineNumberOfBlades": 3,
          "turbineAvgBladeChord": 2.2
       },
       {
          "name": "T2",
          "latitude": 37.749924,
          "longitude": -95.01294,
          "turbineModelName": "Vestas V150",
          "turbineHubHeight": 80,
          "turbineRotorRadius": 75,
          "turbineNumberOfBlades": 3,
          "turbineAvgBladeChord": 2.5
       },
       {
          "name": "T3",
          "latitude": 37.74936,
          "longitude": -95.01674,
          "turbineModelName": "Vestas V150",
          "turbineHubHeight": 80,
          "turbineRotorRadius": 75,
          "turbineNumberOfBlades": 3,
          "turbineAvgBladeChord": 2.5
       }
    ],
    "receptors": [
       {
          "name": "R1",
          "latitude": 37.730972,
          "longitude": -95.03899
       },
       {
          "name": "R1",
          "latitude": 37.73597,
          "longitude": -95.00899
       }
    ],
    "receptorSize": 400
    }
    

Response

If successful, the result will be a JSON object that includes the simulation id and other simulation status data. You can use this id to get the current status and output of the simulation.


        {
          "id": "485b3822-fd52-4349-8522-8d2c2d2115a3",
          "clientId": "xyz-client-1,
          "clientSimulationId": "xyz-proj-45-sim-13",
          "projectId": "xyz-proj-45",
          "projectName": "XYZ Project 45 - Bremen",
          "simulationType": "flicker",
          "status": "Not Started",
          "statusMessage": "Simulation has been queued and is waiting to run.",
          "statusDate": null,
          "startedAt": null,
          "endedAt": null,
          "result": null,
          "queuePosition": 1,
          "queueLength": 1,
          "runtime": 0,
          "runtimeHuman": ""
      }
      

Create a Noise Simulation

This will submit a simulation request. The simulation type should be of type 'noise'. When you submit the request, it will be queued with other requests. Depending on the type of simulation and the input data (number of turbines and receptors), it may take anywhere from a few minutes or a few hours to run.

Request

POST: https://persimia.com/api/1/simulations

Headers attributes:

Body: JSON-formatted simulation input with the following attributes:

Example Noise Input


      {
        "simulationType": "noise",
        "clientId": "xyz-client-1",
        "clientSimulationId": "xyz-proj-45-sim-13",
        "projectId": "xyz-proj-45",
        "projectName": "XYZ Project 45 - Bremen",
        "modelType": "Dutch",
        "groundFactorSource": 1,
        "groundFactorReceiver": 1,
        "groundFactorMiddle": 1,
        "receiverHeight": 1.5,
        "numberOfContours": 64,
        "turbines": [
           {
              "name": "T1",
              "latitude": 37.750404,
              "longitude": -95.0088,
              "turbineModelName": "Vestas V136",
              "turbineHubHeight": 100,
              "soundSpectrumDay": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ],
              "soundSpectrumEvening": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ],
              "soundSpectrumNight": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ]
           },
           {
              "name": "T2",
              "latitude": 37.749924,
              "longitude": -95.01294,
              "turbineModelName": "Vestas V136",
              "turbineHubHeight": 100,
              "soundSpectrumDay": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ],
              "soundSpectrumEvening": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ],
              "soundSpectrumNight": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ]
           },
           {
              "name": "T3",
              "latitude": 37.74936,
              "longitude": -95.02474,
              "turbineModelName": "Vestas V136",
              "turbineHubHeight": 100,
              "soundSpectrumDay": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ],
              "soundSpectrumEvening": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ],
              "soundSpectrumNight": [
                 112.7,
                 111.7,
                 110.1,
                 105.8,
                 101.8,
                 97.9,
                 93.3,
                 86.6,
                 79.2
              ]
           }
        ],
        "receptors": [
           {
              "name": "R1",
              "latitude": 37.730972,
              "longitude": -95.03899
           },
           {
              "name": "R2",
              "latitude": 37.73597,
              "longitude": -95.00899
           }
        ]
     }
    

Response

If successful, the result will be a JSON object that includes the simulation id and other simulation status data. You can use this id to get the current status and output of the simulation.


        {
          "id": "485b3822-fd52-4349-8522-8d2c2d2115a3",
          "clientId": "xyz-client-1,
          "clientSimulationId": "xyz-proj-45-sim-13",
          "projectId": "xyz-proj-45",
          "projectName": "XYZ Project 45 - Bremen",
          "simulationType": "noise",
          "status": "Not Started",
          "statusMessage": "Simulation has been queued and is waiting to run.",
          "statusDate": null,
          "startedAt": null,
          "endedAt": null,
          "result": null,
          "queuePosition": 1,
          "queueLength": 1,
          "runtime": 0,
          "runtimeHuman": ""
      }
      

Create an Ice Throw Simulation

This will submit a simulation request. The simulation type should be of type 'ice throw'. When you submit the request, it will be queued with other requests. Depending on the type of simulation and the input data (number of turbines and receptors), it may take anywhere from a few minutes or a few hours to run.

Request

POST: https://persimia.com/api/1/simulations

Headers attributes:

Body: JSON-formatted simulation input with the following attributes:

Example Ice Throw Input

{
      "simulationType": "ice throw",
      "clientSimulationId": "xyz-proj-45-sim-12",
      "projectName": "",
      "airDensity": 1.5,
      "windMagDistributionType": 0,
      "windMagParameter1": 2.4125,
      "windMagParameter2": 7.8929,
      "windDirDistributionType": 0,
      "windDirPoints": [
         0,
         22.5,
         45,
         67.5,
         90,
         112.5,
         135,
         157.5,
         180,
         202.5,
         225,
         247.5,
         270,
         292.5,
         315,
         337.5
      ],
      "windDirFrequency": [
         7.6,
         6.5,
         5.3,
         4.5,
         4.3,
         3.9,
         4.8,
         9.6,
         19.4,
         11.8,
         3.9,
         2.2,
         2.2,
         2.7,
         4.1,
         7.1
      ],
      "ieaIcingClass": 1,
      "turbines": [
         {
            "name": "T1",
            "latitude": 37.750404,
            "longitude": -95.0088,
            "turbineModelName": "Vestas V136",
            "turbineHubHeight": 100,
            "turbineRotorRadius": 66,
            "turbineRotorSpeedPoints": [
               0,
               2.99,
               3,
               18,
               20,
               20.01,
               1000
            ],
            "turbineRotorSpeed": [
               0,
               0,
               5.1566,
               12.987,
               12.987,
               0,
               0
            ]
         },
         {
            "name": "T2",
            "latitude": 37.749924,
            "longitude": -95.01294,
            "turbineModelName": "Vestas V150",
            "turbineHubHeight": 80,
            "turbineRotorRadius": 75,
            "turbineRotorSpeedPoints": [
               0,
               2.99,
               3,
               18,
               20,
               20.01,
               1000
            ],
            "turbineRotorSpeed": [
               0,
               0,
               5.1566,
               12.987,
               12.987,
               0,
               0
            ]
         },
         {
            "name": "T3",
            "latitude": 37.74936,
            "longitude": -95.01674,
            "turbineModelName": "Vestas V150",
            "turbineHubHeight": 80,
            "turbineRotorRadius": 75,
            "turbineRotorSpeedPoints": [
               0,
               2.99,
               3,
               18,
               20,
               20.01,
               1000
            ],
            "turbineRotorSpeed": [
               0,
               0,
               5.1566,
               12.987,
               12.987,
               0,
               0
            ]
         },
         {
            "name": "T4",
            "latitude": 37.749207,
            "longitude": -95.023674,
            "turbineModelName": "Vestas V162",
            "turbineHubHeight": 100,
            "turbineRotorRadius": 81,
            "turbineRotorSpeedPoints": [
               0,
               2.99,
               3,
               18,
               20,
               20.01,
               1000
            ],
            "turbineRotorSpeed": [
               0,
               0,
               5,
               12,
               12,
               0,
               0
            ]
         }
      ],
      "receptors": [
         {
            "name": "R1",
            "latitude": 37.730972,
            "longitude": -95.03899
         },
         {
            "name": "R2",
            "latitude": 37.72556,
            "longitude": -95.06829
         },
         {
            "name": "R3",
            "latitude": 37.747753,
            "longitude": -94.9991
         },
         {
            "name": "R4",
            "latitude": 37.746395,
            "longitude": -95.00019
         },
         {
            "name": "R5",
            "latitude": 37.71843,
            "longitude": -94.980354
         }
      ],
      "receptorSize": 400
   }
   

Get Simulation Status and Results

Use this API call to get the status of a simulation and the result (if completed). The result will vary depending on the type of simulation requested.

Request

GET: https://persimia.com/api/1/simulations/[id | clientSimulationId]

Headers attributes:

You can get the simulation status using either the simulation id (which was returned when you submitted the request) or the clientSimulationId that you provided in the simulation input data. The clientSimulationId has to be unique per user account. Otherwise, the API service will return a 404 error.

Response

The response will be a JSON object that includes the id, status, messages, status date, start date, end date, and the result (if completed). The status will be one of:

If the API server is busy with multiple requests, your simulation job may be queued. The results will contain the queue position of the simulation request and the length of the queue. The running time of the simulation will also be returned. The runtime is in milliseconds. The runtimeHuman is an English-language description of the the runtime. See examples of reponses below.

For a running simulation, the response will be similar to the following:


      {
        "id": "485b3822-fd52-4349-8522-8d2c2d2115a3",
        "clientId": "xyz-client-1,
        "clientSimulationId": "xyz-proj-45-sim-13",
        "projectId": "xyz-proj-45",
        "projectName": "XYZ Project 45 - Bremen",
        "simulationType": "flicker",
        "status": "Running",
        "statusMessage": "Running Flick mode 1.",
        "statusDate": "2020-08-08T15:54:32.000Z",
        "startedAt": "2020-08-08T15:54:26.000Z",
        "endedAt": null,
        "result": null,
        "queuePosition": 0,
        "queueLength": 0,
        "runtime": 371891,
        "runtimeHuman": "6 minutes 11 seconds 891 milliseconds"
      }
    

For a successfully completed simulation, the response will be similar to this:


      {
        "id": "485b3822-fd52-4349-8522-8d2c2d2115a3",
        "clientId": "xyz-client-1,
        "clientSimulationId": "xyz-proj-45-sim-13",
        "projectId": "xyz-proj-45",
        "projectName": "XYZ Project 45 - Bremen",
        "simulationType": "flicker",
        "status": "Completed",
        "statusMessage": "Simulation has completed.",
        "statusDate": "2020-08-08T16:03:31.000Z",
        "startedAt": "2020-08-08T15:54:26.000Z",
        "endedAt": "2020-08-08T16:03:31.000Z",
        "result": {
            "contoursKMLFile": "https://sims.persimia.com/simulations/485b3822-fd52-4349-8522-8d2c2d2115a3/flicker_contours.kml",
            "receptorFlickerHoursFile": "https://sims.persimia.com/simulations/485b3822-fd52-4349-8522-8d2c2d2115a3/obs_max_flicker_hours.txt"
        },
        "queuePosition": 0,
        "queueLength": 0,
        "runtime": 545000,
        "runtimeHuman": "9 minutes 5 seconds"
      }
    

Get the Input Data of a Simulation

This will get the input data that was submitted by the user when simulation was created.

Request

GET: https://persimia.com/api/1/simulations/[id | clientSimulationId]/input

Headers attributes:

Make sure to replace [id] with the actual simulation id that was returned when you submitted the request.

Response

The response will be a JSON object that returns the input data of the simulation.

Get a List of Simulations (with filtering)

Use this API call to get a list of simulations. This call can also accept query parameters to help filter the list.

Request

GET: https://persimia.com/api/1/simulations[? query parameters]

Headers attributes:

By default (without query parameters) all user simulations will be retured up to the maximum of 200 simulations. Pass query parameters such as clientId, projectId and status to filter the results to a more manageble list. See examples further below.

Response

The response will be similar to the following:


      [
        {
          "id": "840ed986-dc5b-40bf-a6cd-ed906117bf1b",
          "clientId": "xyz-client-1",
          "clientSimulationId": "xyz-proj-45-sim-14",
          "projectId": "xyz-proj-45",
          "projectName": "XYZ Project 45 - Bremen",
          "simulationType": "flicker",
          "status": "Completed",
          "statusMessage": "Simulation has completed.",
          "statusDate": "2020-08-19T21:19:05.000Z",
          "startedAt": "2020-08-19T21:04:29.000Z",
          "endedAt": "2020-08-19T21:19:05.000Z",
          "result": {
              "contoursKMLFile": "https://sims.persimia.com/simulations/840ed986-dc5b-40bf-a6cd-ed906117bf1b/flicker_contours.kml",
              "receptorFlickerHoursFile": "https://sims.persimia.com/simulations/840ed986-dc5b-40bf-a6cd-ed906117bf1b/obs_max_flicker_hours.txt"
          },
          "queuePosition": 0,
          "queueLength": 0,
          "runtime": 876000,
          "runtimeHuman": "14 minutes 36 seconds"
        },
        {
          "id": "cd5b4a11-90c3-4f48-8388-608bf16747f7",
          "clientId": "xyz-client-1",
          "clientSimulationId": "xyz-proj-45-sim-15",
          "projectId": "xyz-proj-45",
          "projectName": "XYZ Project 45 - Bremen",
          "simulationType": "flicker",
          "status": "Completed",
          "statusMessage": "Simulation has completed.",
          "statusDate": "2020-08-19T21:19:05.000Z",
          "startedAt": "2020-08-19T21:04:40.000Z",
          "endedAt": "2020-08-19T21:19:05.000Z",
          "result": {
              "contoursKMLFile": "https://sims.persimia.com/simulations/cd5b4a11-90c3-4f48-8388-608bf16747f7/flicker_contours.kml",
              "receptorFlickerHoursFile": "https://sims.persimia.com/simulations/cd5b4a11-90c3-4f48-8388-608bf16747f7/obs_max_flicker_hours.txt"
          },
          "queuePosition": 0,
          "queueLength": 0,
          "runtime": 865000,
          "runtimeHuman": "14 minutes 25 seconds"
        },
        {
          "id": "2cf9960b-dbc7-4e48-a30f-c31e29987ad1",
          "clientId": "xyz-client-1",
          "clientSimulationId": "xyz-proj-45-sim-16",
          "projectId": "xyz-proj-45",
          "projectName": "XYZ Project 45 - Bremen",
          "simulationType": "flicker",
          "status": "Completed",
          "statusMessage": "Simulation has completed.",
          "statusDate": "2020-08-19T21:19:14.000Z",
          "startedAt": "2020-08-19T21:04:51.000Z",
          "endedAt": "2020-08-19T21:19:14.000Z",
          "result": {
              "contoursKMLFile": "https://sims.persimia.com/simulations/2cf9960b-dbc7-4e48-a30f-c31e29987ad1/flicker_contours.kml",
              "receptorFlickerHoursFile": "https://sims.persimia.com/simulations/2cf9960b-dbc7-4e48-a30f-c31e29987ad1/obs_max_flicker_hours.txt"
          },
          "queuePosition": 0,
          "queueLength": 0,
          "runtime": 863000,
          "runtimeHuman": "14 minutes 23 seconds"
        }
      ]
    

Examples

To query all running simulations for a client project:


      https://api.persimia.com/api/1/simulations?clientId=xyz-client-1&projectId=xyz-proj-45&status=Running
    

To query all queued simulations for a client project:


      https://api.persimia.com/api/1/simulations?clientId=xyz-client-1&projectId=xyz-proj-45&status=Not%20Started
    

To query all completed simulations for a client project:


      https://api.persimia.com/api/1/simulations?clientId=xyz-client-1&projectId=xyz-proj-45&status=Completed
    

Delete a Simulation

Use this API call to delete a simulation. This API call uses a soft-delete process. That is, the simulation is not initially deleted, but is instead marked for deletion. A separate server process runs that will actually delete the simulation. This is because, deleting a simulation requires that the database entry and associated files and folders also need to be deleted. It may take about 10 to 20 seconds for this to happen.

Request

DELETE: https://persimia.com/api/1/simulations/[id | clientSimulationId]

Headers attributes:

Response

A successful response will return an HTTP 202 code. You should also receive the following message:

"Simulation has been marked for deletion. Note: Deletion may not happen immediately since another process is responsible for deleting the simulation record and related files."