LinkSmart® Optimization Framework : Defining Inputs through HTTP

Using POST /data_source/file

The first step to define an input is to use the POST request of the endpoint /data_source/mqtt.

Registering a data_source through HTTP

Using a reserved word

If you chose a reserved word in your optimization model because you are working with energy applications, you can register your input data in the following way.

Remember that you can send the input data directly. It is entered as a list oj JSON values.


  • From the API, you find out which is the data model for entering a photovoltaic registry. Inside of it you choose the one that you need. If you are interested in registering an input for the total PV power for example, you choose P_PV. Because we want to enter meta data at the same time, we choose "meta" as well.

{
    "photovoltaic":{
        "P_PV":[
            700,
			600,
			300
		 ],
        "meta":{
            "PV_Inv_Max_Power":1000    
        }
    }
}


  • Then send this data to the /data_source/file endpoint


curl --request POST \
  --url http://ip_address:8080/v1/data_source/file \
  --header 'Cache-Control: no-cache' \
  --header 'Content-Type: application/json' \
  --data '{\r\n    "photovoltaic":{\r\n        "P_PV":[\r\n            700,\r\n            600,\r\n            300\r\n         ],\r\n        "meta":{\r\n            "PV_Inv_Max_Power":1000    \r\n        }\r\n    }\r\n}'


Using a custom word

If you don't want to use any reserved word, you can register your input data in the following way.

Remember that you can send the input data directly. It is entered as a list oj JSON values.


  • From the API, you find out which is the data model for entering a custom registry. Inside of it you choose the one that you need. If you are interested in registering an input for the total PV power with the name "Power_Photovoltaic", you can enter this information. The example shows a list of input values, if you have more than one custom inputs.

{
    "generic":[
    {
        "name":"Power_Photovoltaic",
        "file":[
            700,
			600,
			300
        ]
    },
    {
        "name":"custom_name",
        "file":[
            700,
			600,
			300
        ]
    }

    ]
}


  • Then send this data to the /data_source/file endpoint


curl --request POST \
  --url http://ip_address:8080/v1/data_source/file \
  --header 'Cache-Control: no-cache' \
  --header 'Content-Type: application/json' \
  --data '{\r\n    "generic":[\r\n    {\r\n        "name":"Power_Photovoltaic",\r\n        "file":[\r\n            700,\r\n            600,\r\n            300\r\n        ]\r\n    },\r\n    {\r\n        "name":"custom_name",\r\n        "file":[\r\n            700,\r\n            600,\r\n            300\r\n        ]\r\n    }\r\n\r\n    ]\r\n}'