Skip to content
Traducción automática sin revisar. Prevalece la versión en inglés.

API ​

Ofrecemos varios endpoints REST públicos con los que puede, entre otras cosas,

  • ejecutar cálculos
  • enviar solicitudes de conexión
  • exportar datos de Adaptricity

Documentación de los endpoints ​

Todos los endpoints públicos están documentados en Adaptricity en User > API Documentation.

Las redes y series temporales se importan mediante la Data Integration API (v3), aparte.

Página API Documentation en Adaptricity

Autenticación ​

Para acceder a los endpoints necesita un token de API, que puede crear en su perfil de usuario.

Crear token

Este token es su llave de acceso a Adaptricity. ¡Trátelo como una contraseña!

Ejemplo ​

Como ejemplo veremos el endpoint de flujo de cargas, que calcula el flujo de cargas de una red y devuelve los resultados en formato JSON.

http
POST https://{instance-id}.adaptricity.com/api/grid/{grid-id}/calculatepowerflow/v2

Preparación ​

Como preparación, primero cargamos una red en Adaptricity:

Grids > Grid Editor > Load grid from file > cargar example-grid.xml

Cargar red

Cada red tiene un ID único de 24 caracteres que aparece en la URL (marcado en amarillo en la captura). Extraiga el ID de la red de la URL. Al copiarlo, no incluya la «g» inicial, que no forma parte del ID.

Las URL web de Adaptricity suelen tener este formato:

http
https://{instance-id}.adaptricity.com/#/{project-id}/s/g{grid-id}/

URL ​

Tome la URL del endpoint y sustituya {grid-id} e {instance-id} por sus IDs.

http
POST https://{instance-id}.adaptricity.com/api/grid/{grid-id}/calculatepowerflow/v2

Cabeceras de la petición ​

Defina estas cabeceras y sustituya {your-api-token} por su token.

http
X-Auth-Token: {your-api-token}
Content-Type: application/json

Cuerpo de la petición ​

Los ajustes del algoritmo se pasan en el cuerpo.

json
{
	"DPGProtocolVersion": "2.0",
	"operationalVoltages": [],
	"algorithm": {
		"type": "FULL_NEWTON",
		"tolerance": 0.000001,
		"maxIter": 1000
	}
}

Enviar la petición ​

Ahora puede enviar la petición con una herramienta como Postman o directamente en la consola, p. ej., con curl. Este es un ejemplo del comando curl completo:

bash
curl -X POST "https://adt-123456.adaptricity.com/api/grid/688109db1dadf237a782a8ef/calculatepowerflow/v2" \
  -H "X-Auth-Token: {your-api-token}" \
  -H "Content-Type: application/json" \
  -d '{
    "DPGProtocolVersion": "2.0",
    "operationalVoltages": [],
    "algorithm": {
      "type": "FULL_NEWTON",
      "tolerance": 0.000001,
      "maxIter": 1000
    }
  }'

Respuesta ​

La respuesta contiene los resultados del flujo de cargas, incluidas tensiones de nudo, corrientes de línea y pérdidas, en formato JSON.

json
{
  "convergenceInfo": {
    "algorithm": "Full Newton-Raphson",
    "hasConverged": true,
    "numIterations": 1,
    "disabledWarmStart": false
  },
  "powerFlowSummary": {
    "load": {
      "total": { "activePowerInMegawatt": 0.01, "reactivePowerInMegavar": 0.0 },
      "byVoltageLevel": {
        "20.0 kV": {
          "activePowerInMegawatt": 0.0,
          "reactivePowerInMegavar": 0.0
        },
        "0.4 kV": {
          "activePowerInMegawatt": 0.01,
          "reactivePowerInMegavar": 0.0
        }
      }
    },
    "generation": {
      "total": { "activePowerInMegawatt": 0.0, "reactivePowerInMegavar": 0.0 },
      "byVoltageLevel": {
        "20.0 kV": {
          "activePowerInMegawatt": 0.0,
          "reactivePowerInMegavar": 0.0
        },
        "0.4 kV": {
          "activePowerInMegawatt": 0.0,
          "reactivePowerInMegavar": 0.0
        }
      }
    },
    "flow": {
      "total": {
        "activePowerInMegawatt": 0.01998689567564519,
        "reactivePowerInMegavar": -5.192047912955003e-6
      },
      "byVoltageLevel": {
        "0.4 kV": {
          "activePowerInMegawatt": 0.009988478786482116,
          "reactivePowerInMegavar": 1.9374434934664843e-8
        },
        "20.0 / 0.4 kV": {
          "activePowerInMegawatt": 0.009998416889163076,
          "reactivePowerInMegavar": -5.211422347889668e-6
        }
      }
    },
    "losses": {
      "total": {
        "activePowerInMegawatt": 1.0498950978737875e-5,
        "reactivePowerInMegavar": 9.72651577058059e-6
      },
      "byVoltageLevel": {
        "0.4 kV": {
          "activePowerInMegawatt": 9.435569420235268e-6,
          "reactivePowerInMegavar": 2.6319084106551927e-6
        },
        "20.0 / 0.4 kV": {
          "activePowerInMegawatt": 1.0633815585026074e-6,
          "reactivePowerInMegavar": 7.094607359925398e-6
        }
      }
    }
  },
  "powerFlowResult": [
    {
      "elementType": "bus",
      "id": "bus_1",
      "powerFlowData": {
        "voltageInPerUnit": 1.0,
        "angleInRadians": 0.0,
        "activeBusLoadInMegawatt": 0.0,
        "reactiveBusLoadInMegavar": 0.0,
        "activeBusGenerationInMegawatt": 0.0,
        "reactiveBusGenerationInMegavar": 0.0,
        "voltageInKilovolt": 20.0,
        "activeResidualBusLoadInMegawatt": 0.0,
        "reactiveResidualBusLoadInMegavar": 0.0,
        "angleInDegrees": 0.0
      }
    },
    {
      "elementType": "bus",
      "id": "bus_2",
      "powerFlowData": {
        "voltageInPerUnit": 0.999893774408436,
        "angleInRadians": -7.095529905871144e-4,
        "activeBusLoadInMegawatt": 0.0,
        "reactiveBusLoadInMegavar": 0.0,
        "activeBusGenerationInMegawatt": 0.0,
        "reactiveBusGenerationInMegavar": 0.0,
        "voltageInKilovolt": 0.3999575097633744,
        "activeResidualBusLoadInMegawatt": 0.0,
        "reactiveResidualBusLoadInMegavar": 0.0,
        "angleInDegrees": -0.04065439170152748
      }
    },
    {
      "elementType": "bus",
      "id": "bus_3",
      "powerFlowData": {
        "voltageInPerUnit": 0.9989500624829588,
        "angleInRadians": -0.0011471351227720045,
        "activeBusLoadInMegawatt": 0.01,
        "reactiveBusLoadInMegavar": 0.0,
        "activeBusGenerationInMegawatt": 0.0,
        "reactiveBusGenerationInMegavar": 0.0,
        "voltageInKilovolt": 0.39958002499318357,
        "activeResidualBusLoadInMegawatt": 0.01,
        "reactiveResidualBusLoadInMegavar": 0.0,
        "angleInDegrees": -0.06572600106605739
      }
    },
    {
      "elementType": "powerline",
      "id": "powerline_1",
      "powerFlowData": {
        "activePowerInMegawatt": 0.009988478786482116,
        "reactivePowerInMegavar": 1.9374434934664843e-8,
        "activeLossInMegawatt": 9.435569420235268e-6,
        "reactiveLossInMegavar": 2.6319084106551927e-6,
        "apparentPowerInMegavoltampere": 0.009988478786500906,
        "activePowerInPerUnit": 9.988478786482116e-5,
        "reactivePowerInPerUnit": 1.9374434934664843e-10,
        "activeLossInPerUnit": 9.435569420235268e-8,
        "reactiveLossInPerUnit": 2.6319084106551927e-8,
        "apparentPowerInPerUnit": 9.988478786500907e-5,
        "loadingInPerUnit": 0.04008966745271987,
        "currentInAmpere": 14.432280282979153,
        "currentInPerUnit": 9.998977087677769e-5,
        "currentAngleInRadians": -0.0011490748010613216,
        "voltageDropInVolt": 0.37748477019086124,
        "loadingInPercent": 4.008966745271987,
        "activePowerFlowingToBus2": true,
        "reactivePowerFlowingToBus2": true
      }
    },
    {
      "elementType": "transformer",
      "id": "transformer_1",
      "powerFlowData": {
        "activePowerInMegawatt": 0.009998416889163076,
        "reactivePowerInMegavar": -5.211422347889668e-6,
        "activeLossInMegawatt": 1.0633815585026074e-6,
        "reactiveLossInMegavar": 7.094607359925398e-6,
        "apparentPowerInMegavoltampere": 0.009998418247324139,
        "activePowerInPerUnit": 9.998416889163075e-5,
        "reactivePowerInPerUnit": -5.211422347889668e-8,
        "activeLossInPerUnit": 1.0633815585026074e-8,
        "reactiveLossInPerUnit": 7.094607359925398e-8,
        "apparentPowerInPerUnit": 9.998418247324139e-5,
        "loadingInPerUnit": 0.01587050515448276,
        "currentInAmpere": 14.433006821095084,
        "currentInPerUnit": 9.99948044804994e-5,
        "currentAngleInRadians": -1.8832828710316994e-4,
        "voltageDropInVolt": 0.04249023662561413,
        "loadingInPercent": 1.587050515448276,
        "activePowerFlowingToBus2": true,
        "reactivePowerFlowingToBus2": false
      }
    }
  ]
}