# Appendices

# Plexus nomenclature criteria

The text fields to be filled in respecting the nomenclature criteria these criteria are only alphanumeric characters [0-9, a-z, A-Z] and a few symbols [-, _]. Punctuation marks, spaces, single quotes and double quotes, slashes and backslashes, parentheses and mathematical symbols are prohibited.

# Functions API: General

WARNING

  • Follow php syntax. Remember to end statement with semicolon ;

# debug_message

# Syntax

/**
 *
 * Prints a message to the debug message box inside the page
 *
 * @param string $message The message to be shown
 * 
 * @return void
 */
debug_message($message);

# Example

$x = read_val('FOO');
debug_message('FOO is : ' . $x);

# Outcome

12:24:56(0): FOO is 50000

/images/appendices/debug_message.gif')' thumbnail='Debug Message able to view'>

# info_message

# Syntax

/**
 *
 * Prints a message to the info message box inside the HMI Panel.
 *
 * @param string $message The message to be shown
 * 
 * @return void
 */
info_message('Test info Message Here');

# Example

$x = read_val('FOO');
info_message('FOO is : ' . $x);

# Outcome

12:24:56(0): FOO is 50000

/images/appendices/debug_message.gif')' thumbnail='Info Message able to view'>

# device_status

# Syntax

/**
 *
 * Return 0 or 1 to get the device status.
 * 0 = off
 * 1 = on
 * @param string $device The choose device to return status
 * 
 * @return 0 or 1
 */
device_status($device);

# Example

$x = device_status('DEVICE_ONE');
if ($x == 1) {
  debug_message('DEVICE IS ON');
} else if ($x == 0) {
  debug_message('DEVICE IS OFF');
}

# Outcome

12:24:56(0): DEVICE IS ON

# Functions API: Variable

# read_val

# Syntax

/**
 *
 * Read a device or variable and return value.
 *
 * @param string $var_name
 * 
 * @return number
 */
read_val($device);

# Example

if (read_val('temperature_sensor_1') > 54) {
  // do something if the condition is true
  debug_message('Temperature Sensor 1 is above 54');
}

# Outcome

12:24:56(0): Temperature Sensor 1 is above 54

# read_future_val

TIP

Variable have to be recorded in blackbox in order for this functions api to work.

# Syntax

/**
 *
 * Read a device or variable X seconds to the future and return value.
 *
 * @param string $var_name
 * @param number $seconds_future
 * @return value
 */
read_future_val($var_name, $seconds_future);

# Example

if (read_future_val('temperature_sensor_1', 10) > 54) {
  // do something if the condition is true
  debug_message('Temperature Sensor 1 is above 54, in 10 seconds ahead');
}

# Outcome

12:24:56(0): Temperature Sensor 1 is above 54, in 10 seconds ahead

# read_average_val

# Syntax

/**
 *
 * Read a average value within a certain timeframe.
 *
 * @param string $var_name
 * @param number $seconds_past
 * @return value
 */
read_average_val($var_name, $seconds_past);

# Example

if (read_average_val('temperature_sensor_1', 10) > 54) {
  // do something if the condition is true
  debug_message('Temperature Sensor 1 average in 10 seconds is above 54!');
}

# Outcome

12:24:56(0): Temperature Sensor 1 average in 10 seconds is above 54!

# write_val

# Syntax

/**
 *
 * write a device or variable.
 *
 * @param string $var_name
 * @param number $value
 * 
 * @return void
 */
write_val($var_name, $value);

# Example

write_val('temperature_sensor_1', 20);
$x = read_val('temperature_sensor_1');
debug_message('temperature_sensor_1 is ' . $x);
write_val('temperature_sensor_1', 10);
$x = read_val('temperature_sensor_1');
debug_message('temperature_sensor_1 is ' . $x);

# Outcome

12:24:40(0): temperature_sensor_1 is 20
12:24:56(0): temperature_sensor_1 is 10

# write_val_period

# Syntax

/**
 * Write 2 value at two different time. In Milliseconds
 * It will write value 10 at first second and then write value 50 at the * fifth second.
 * 
 * @param string $var_name
 * @param number $value1
 * @param number $value2
 * @param number $ms1
 * @param number $ms2
 */
write_val_period($var_name, $value1, $value2, $ms1, $ms2);

# Example

write_val_period('temperature_sensor_1', 10, 50, 1000, 5000);

# Outcome

temperature_sensor_1 value will be 10 at first second.

temperature_sensor_1 value will be 50 at fifth second.

# reset_val_period

# Syntax

/**
 *
 * Reset device value period that have being set
 * 
 * @param string $var_name
 * 
 * @return void
 */
reset_val_period($var_name);

# Example

reset_val_period('temperature_sensor_1');

# Outcome

Temperature_sensor_1 period will be reset

# write_val_ramp

# Syntax

/**
 *
 * Write value in incremental by time in milliseconds
 * 
 * @param string $var_name
 * @param number $rampValueStart
 * @param number $rampValueEnd
 * @param number $msRampDuration
 * @return void
 */
write_val_ramp($var_name, $rampValueStart, $rampValueEnd, $msRampDuration)

WARNING

RAMP have to be reset everytime after execute once.

# Example

write_val_ramp('temperature_sensor_1', 1, 100, 1000);

# Outcome

Temperature sensor 1 will increase from 1 to 100 in 1000 second

# reset_val_ramp

# Syntax

/**
 *
 * Reset ramp of variable to 0
 * 
 * @param string $var_name
 * @return void
 */
reset_val_ramp($var_name);

# Example

reset_val_ramp('temperature_sensor_1');

# Outcome

Temperature sensor will stop incrementing.

# write_val_at_time

# Syntax

/**
 *
 * Write value at time using 24 hour format (00:00)
 * 
 * @param string $var_name
 * @param number $value
 * @param time $time 
 * @return void
 */
write_val_at_time($var_name, $value, $time);

# Example

write_val_at_time('temperature_sensor_1', 100, '16:20')

# Outcome

Temperature sensor 1 will be written 100 at 4:20pm local time to user.

# disable

# Syntax

/**
 *
 * Disable Device to write from HMI Panel / Section / Device List
 * 
 * @param string $var_name
 * @return void
 */
disable($var_name);

# Example

disable('temperature_sensor_1');

# Outcome

Temperature sensor 1 can't be written anywhere else.

# enable

# Syntax

/**
 *
 * Enable Device to write from HMI Panel / Section / Device List
 * 
 * @param string $var_name
 * @return void
 */
enable($var_name);

# Example

enable('temperature_sensor_1');

# Outcome

Temperature sensor 1 will be able to written everywhere.

# Functions API: Timer

# start_timer

# Syntax

/**
 *
 * Start Timer 
 * Timer have to be created from Alarms page foremost.
 * @param string $timer_name
 * @return void
 */
start_timer($timer_name);

# Example

start_timer('my_timer');

# Outcome

my_timer will start.

# reset_timer

# Syntax

/**
 *
 * Reset Timer 
 * Timer have to be started from Section page foremost.
 *
 * @param string $timer_name
 * @return void
 */
reset_timer($timer_name);

# Example

start_timer('my_timer');

# Outcome

my_timer timer will stop.

# reset_timer

# Syntax

/**
 *
 * Reset Timer 
 * Timer have to be started from Alarms page foremost.
 *
 * @param string $timer_name 
 * @return void
 */
reset_timer($timer_name);

# Example

start_timer('my_timer');

# Outcome

my_timer timer will stop.

# pause_timer

# Syntax

/**
 *
 * Pause Timer 
 * Timer have to be started foremost
 *
 * @param string $timer_name 
 * @param number $value ( 1/0 ) only
 * @return void
 */
pause_timer($timer_name, $value);

# Example

pause_timer('my_timer', 1);

# Outcome

my_timer timer will pause.

# timer_running

# Syntax

/**
 *
 * Check if Timer is running
 * 
 * @param string $timer_name
 * @return bool ( 0 or 1 or true or false)
 */
timer_running($timer_name);

# Example

if (!timer_running('my_timer')) {
  debug_message('TIMER IS NOT RUNNING');
}

# Outcome

TIMER IS NOT RUNNING

# read_timer

# Syntax

/**
 * Check if Timer is running
 * 
 * @param string $timer_name
 * @return number
 */
read_timer($timer_name);

# Example

$x = read_timer('my_timer');
debug_message('TIMER IS : ' . $x);

# Outcome

TIMER IS 22000

# set_timer_duration

# Syntax

/**
 *
 * Set Timer duration
 * 
 * @param string $timer_name
 * @param number $duration
 * @return void
 */
set_timer_duration($timer_name, $duration);

# Example

set_timer_duration('my_timer', 1000);

# Outcome

my_timer duration is set to 1 second or 1000ms

# Functions API: Alarms

# set_alarm

# Syntax

/**
 *
 * Set Alarm With Message
 * 
 * @param string $alarm_name
 * @param string $message
 * @return void
 */
set_alarm($alarm_name, $message);

# Example

set_alarm('my_alarm', 'Alarm triggered');

# Outcome

my_timer duration is set to 1 second or 1000ms

# set_alarm_delay

# Syntax

/**
 *
 * Set Alarm With Message
 * 
 * @param string $alarm_name
 * @param string $message ( alarm message )
 * @param number $msDelay 
 * @return void
 */
set_alarm_delay($alarm_name, $message, $msDelay);

# Example

set_alarm_delay('my_alarm', 'Alarm triggered', 1000);

# Outcome

my_timer alarm will be triggered with 1 second delay.

# reset_alarm

# Syntax

/**
 *
 * Reset Alarm That Triggered
 * 
 * @param string $alarm_name
 * @return void
 */
reset_alarm($alarm_name);

# Example

reset_alarm('my_alarm');

# Outcome

my_alarm alarm will be reset.

# alarm_active

# Syntax

/**
 *
 * Reset Alarm That Triggered
 * 
 * @param Alarm $alarm( alarm name)
 * @return bool 1 for true , 0 for false
 */
alarm_active($alarm);

# Example

$x = alarm_active('my_alarm'); //not active
debug_message('my_alarm is :' . $x);

# Outcome

my_alarm is 0

# any_alarm_active

# Syntax

/**
 *
 * Reset Alarm That Triggered
 * 
 * @return bool 1 for true , 0 for false
 */
any_alarm_active();

# Example

$x = any_alarm_active(); //not active
debug_message('Active Alarm Currently :' . $x);

# Outcome

Active Alarm Currently : 0

# Functions API: Steppers API

# start_step

# Syntax

/**
 *
 * Stepper like a switch statement
 * @param string $step_name 
 * @return void
 */
start_step($stepper);

# Example

start_step('my_stepper');

# Outcome

Stepper started

# read_step

# Syntax

/**
 *
 * Stepper like a switch statement
 * @param string $step_name  
 * @return number $value
 */
read_step($step_name);

# Example

$x = read_step('my_stepper');
if ($x == 1) {
  debug_message('Step currently at one');
}

# Outcome

1

# set_step

# Syntax

/**
 *
 * Stepper like a switch statement
 * @param string $step_name 
 * @param number $value
 * @return void $value
 */
set_step($step_name, $value);

# Example

set_step('my_step', 10);
if (read_step('my_step') == 10) {
  debug_message('Step currently at 10');
}

# Outcome

my_step step set to 10.
Step currently at 10
Last Updated: 3/3/2021, 1:30:27 PM