Relay Output Overview

Written on: September 13, 2022 9:11 am

Series 4 JNIORs have a varying amount of inputs and outputs depending on what model you have. The 410 has 8 inputs and 8 outputs, the 412 and 412DMX have 4 inputs and 12 outputs, and the 414 has 12 inputs and 4 outputs. Each relay contact rating is 1A @ 24VDC and the voltage source must be in the range of 5 – 30V AC or DC. The JNIOR uses a 2-piece terminal connector system for all power and I/O wiring connections allowing for easy installation and/or removal of the JNIOR.

Controlling Relay Outputs

When controlling the JNIOR’s I/O, the JANOS class can be used to get/manipulate their statuses. In the following example the JANOS class is used to pulse outputs, get the output states mask, check the status of an output, and check an outputs usage meter.

package outputcontrolexample;

import com.integpg.system.JANOS;
import java.io.IOException;
import static java.lang.Thread.sleep;

public class OutputControlExample {
    
    public static void main(String[] args) throws IOException, InterruptedException {
        
        //Pulse output 1 for 3 seconds
        JANOS.setOutputPulsed(1, 1, 3000);
        sleep(4000);
        //Pulse output 2 and 3 for 3 seconds
        JANOS.setOutputPulsed(6, 6, 3000);
        //print out the current mask of outputs that are on.
        System.out.println(String.format("current output states are %d\n", JANOS.getOutputStates()));
        sleep(4000);
        //Check if output 1 is on
        System.out.println(String.format("Is output 1 on: %s\n", String.valueOf(JANOS.isOutputSet(0))));
        //print out usage meter value for output 1, values may change for different model JNIOR:
        System.out.println(String.format("Current usage meter value for output 1: %d\n", JANOS.getUsageMeter(8)));
        
    }

}

I put the built jar file of this example application into the JNIOR’s flash folder and ran it from the Web UI’s console tab. As you can see it displays different data about the outputs at the time of the application running.

Getting Outputs from the IO Log

Another way to interact with the I/O on the JNIOR is via the Iolog Monitor. The Iolog Monitor is an object that can be checked for I/O events that have occurred on the JNIOR. There is the IoEvent class and Iolog class. An IoEvent is when an input or output state changed on the JNIOR, and the Iolog is an object that contains all the IoEvents from a certain timestamp. The example below pulses an output, and then shows how the Iolog has recorded that output pulse as an IoEvent.

package outputcontrolexample2;

import com.integpg.system.IoEvent;
import com.integpg.system.Iolog;
import com.integpg.system.JANOS;
import java.io.IOException;
import static java.lang.Thread.sleep;
import java.text.SimpleDateFormat;

public class OutputControlExample2 {

    public static void main(String[] args) throws IOException, InterruptedException {
        
        //gets the current time as a long.
        long now = System.currentTimeMillis();
        
        JANOS.setOutputPulsed(8, 8, 3000);
        sleep(4000);
        
        //iolog object for getting I/O events
        //refresh Iolog so getting output events from it are only output evetns
        //from when this application start AKA the outputs we just pulsed. 
        Iolog iolog = new Iolog();
        iolog.refresh(now);
        IoEvent[] events = iolog.getOutputEvents();

        //for each output event in the iolog, print the output states at that
        //time and the timestamp it occured.
        if (events.length > 0) {
            //SimpleDateFormat object that formats the timestamps of the IO events
            //into a caladender date and time.
            SimpleDateFormat date = new SimpleDateFormat("MM/dd/yy HH:mm:ss.SSS");
            for (int i = iolog.getOutputEvents().length - 1; i >= 0; i--) {
                System.out.println(String.format("States: %d @ %s\n",
                        events[i].states, date.format(events[i].timestamp)));
            }
        } else {
            System.out.println("no output events...\n");
        }
        
    }
    
}

I put the built jar file of this example application into the JNIOR’s flash folder and ran it from the Web UI’s console tab. As you can see it recorded the output change where output 8 turned on and again when it turned back off.

By | Updated On October 24, 2022 2:58 pm | No Comments | Categories: , | Tags:


 

INTEG Process Group, inc. © 2022

Real-Time
Mon - Fri, 8am - 4pm EST
P: 724-933-9350
PureChat
Always Available
Contact Form
sales@integpg.com
support@integpg.com

@integpg
@jniordev