A remote variable is a data point that is collected by a gateway in one location (“Remote Gateway”) and used by a second gateway in another location (“Local Gateway”) to control outputs. Typically the Local Gateway will be the device that is performing control in that instance and the Remote Gateway will be providing the data point.
Note: Depending on the scenario, a gateway can be both a Local Gateway and a Remote Gateway. The distinction is that the Local Gateway is the gateway performing any control during that specific situation.
- 2+ IG21/IG61 gateway devices activated and connected to the cloud
- Full-Admin privileges to these devices on cloud.samsara.com
Writing a Simple Remote Control Program
pumpOn AT %QX1 : BOOL; //Port 1 of this IG is configured as a PLC Port
SetpointHigh : LREAL; //Declaring Variables that will only exist within program
SetpointLow : LREAL;
SetpointHigh := 65.0; //Setting Value of setpoints that the tanks will be controlled based off
SetpointLow := 50.0;
if(tankLevel >= SetpointHigh) then //Checking tank level vs upper setpoint
pumpOn := False;
elsif(tankLevel <= SetpointLow) then //Checking tank level vs lower setpoint
pumpOn := True;
Checking If A Remote Variable Is Available
When a remote variable is lost due to connection the remote IG will report the value as NaN.
The following block of code can check if a remote variable is NaN:
IF (RemoteVariable <> RemoteVariable) Then
Comms_OK := False;
Alerting If The Control or Remote Gateway Is Offline
To set up disconnected alerts, please follow the Alert Basics guide and set up an alert for your gateway connection status. You can add these for all or some of your gateways to be notified when our system has not detected a connection with the gateway in some time.