Set up SoftPLS

SoftPLS is used to write and run custom logic in JavaScript directly on an Evolo Gateway. The logic runs cyclically based on the selected execution frequency.

Written By Evolo Support

Last updated 3 days ago

Here's how to do it

  1. Go to Settings and select Apps.

  2. Click Add Application.

  3. Enter a name and, if desired, a description.

  4. Select a gateway.

  5. Specify the execution frequency in milliseconds.

  6. Select the data points the application will read from and/or write to.

  7. Write the logic in JavaScript.

  8. Save the application.

Read and write data points

You read data points from the `datapoints` array. For example, `datapoints[0]` reads the value of the first data point. You write to data points using `write()`.

Reading data points:

const value = datapoints[0];

Writing to data points:

write(0, true);

Example

if (datapoints[0] > 10) {
 write(0, true);
}

This logic writes `true` to data point 0 if the value is greater than 10.

Writing to the system log

You can write to the gateway’s system log using `utils.log_info()` and `utils.log_error()`. SoftPLS also has a `memory` object that can be used to store data between cycles. The data is stored on the gateway’s hard drive up to every ten minutes.

utils.log_info('Dette er en informasjonsmelding'); 
utils.log_error('Dette er en feilmelding');

Storing Temporary Values

SoftPLS provides access to a memory object for storing data between cycles. Data is saved to the gateway’s hard drive up to every 10 minutes.

memory.lastExec = new Date().getTime(); 
memory.counter = memory.counter ? memory.counter + 1 : 1;

Important to know

  • SoftPLS supports a maximum of 100 data points per application.

  • At least one data point must be read or written.

  • Data points without data return `null`.

  • The functions `log_info()`, `log_error()`, and `write()` should be used with caution to avoid unnecessary load on the system log and fieldbus.