Summary

In this article, we will go through the overview of our Controls / Automation system in the Samsara Cloud.

Control not currently supported on the IG41.

Samsara Control Overview

Focus Features

  • Program Management – Create, deploy, and manage programs easily without having to go on-site

  • Program Editing – Utilize intelligent error detection to dynamically correct program mistakes

  • Variable Mapping – Reduce time spent on configuration by reusing logic across programs and devices

  • Remote Variables – Leverage Samsara’s cloud to build smart telemetry for data acquisition and control

Samsara Control Interface

To get to Control, go to Settings (gear icon in bottom left) → Automation

Hit New Program and you will get to this page:

The Samsara Control Interface is broken down into two main sections. The left hand side is where all programming logic will be handled. The right hand side is where all variable mapping will be handled.

On the left hand side:

To name a program, enter a name in the top left corner of the screen where you see Enter New Program Name. 

  • Naming the program is NOT required but will help avoid the confusion of  having multiple unnamed programs.  

Below the name of the program is an empty interface where code will be written. The image above shows the Samsara Structured Text Interface. To program, simply start writing code. No program or config block is required.  

Code will be actively checked for errors as can be seen here. In this image, the IF statement is missing a “then” 

9.png

Hovering over the line will expose the error

10.png

To zoom in or out, hover over the three dots in the bottom right corner and you will see a + and - appear. Select the + to zoom in, and the - to zoom out. 

111.png

On the right hand side:

Under Devices, select a gateway from the drop down to assign the program to a gateway. 

12.jpg

Once a program is selected, click add to confirm your selection. 

Multiple devices can be added and selected.

13.png
14.png

In the top right corner of the above image, notice there is a selector, this is how you will choose which variable mapping you would like to view. You may also click on the name of the gateway to toggle between the two gateways.  

Mapping Variables: 

Each type of program variable has a specific purpose which will be explicitly outlined below.

  • It is important to know that MAPPED VARIABLES DO NOT NEED TO BE DECLARED IN THE PROGRAM. This will cause a variable to be declared twice and will likely cause a compilation error. 

  • A program variable can be thought of as an alias for its corresponding variable. Each program variable is a generic name that is then mapped to a local variable or existing data input or data output (The data inputs/outputs mapped to gateway channels will follow existing configuration).  

Definitions

  • Program Variable - A generic variable or alias assigned to a corresponding data input, data output, or local variable that can be used in the Structured Text code.

    • There are three types of program variables

      • Read/Write - Local variables can be written and read by the IG. They can also be accessed elsewhere in the Samsara platform using corresponding data inputs and data outputs. These are the most dynamic variables given their flexibility. 

      • Read Only - Data input variables can only be read by the IG and must be created outside of the control interface. All scaling specified during the creation of a data input will be applied within the program.

      • Write Only - Data output variables can only be written by the IG and must be created outside of the control interface.

  • Local Variable - A variable that is directly tied to a gateway and can be written to or read from. 

  • Remote Variable - A variable that is acquired by a different gateway and used in the control program. This variable will be highlighted gold in the variable mapping section. 

  • Data Input - Any input that is collected via gateway channel, third party pin, or calculated via data input formulas. 

  • Data output - Any output that is used to write to a gateway channel output or third party pin.  

All variable mapping will be handled by the table seen below. The program variables will remain the same even if the program is applied to a new or different gateway. The only part that will change will be the mapped local, data input, and data output variables.

15.png

A variable map will begin to look like this as it is filled in, select Add row below the program variable to add an additional row. 

16.png

Deploying & Program Management 

Saving a program can be done by selecting save in the bottom left corner. When you click save, the program the control interface will store the old revision in the revision history and make the latest program the first to be accessible. 

Compiling a program is automatically handled by the control interface. As noted above, all errors will be underlined in red and an explanation can be found by hovering over the error. The program is actively checked for errors and compiled while you type. 

Deploying a program can be done by selecting Deploy in the bottom right corner. If there are errors, the deploy button will be greyed out until all errors are resolved. Errors can range from incorrect syntax to missing variable mapping. When you click deploy the program will attempt to compile, if successful it will deploy the program to the IG. 

To find previous revisions of the program (a version that was previously saved or deployed) navigate to the top right corner of the screen and select the down arrow 

24.png

If a program is currently running, it may look more like this 

25.png

After selecting the down arrow, you will see previously deployed or saved versions. 

26.png

 To view more past revisions, select the three dots to the right of the arrow, and select View Summary Page. Additional revisions will be found at the bottom of the page.

27.png

Alternatively, if you’d like to duplicate or delete the program, that can be done here.

Duplicating a Program is useful when two programs are similar but not identical. You can use an existing template, duplicate it and make the required changes while preserving the original template. 

All templates can then be found on the Samsara Automation home page.