Quantcast
Channel: Industrial Communications topics
Viewing all 338 articles
Browse latest View live

Melexis - MLX16 LIN Loader

$
0
0

Has anyone already written a LV library for the MLX16 LIN Loader which is a "flash reprogramming procedure through the LIN bus using the LIN protocol" ?

 

Many thanks in advance for any advice

 


Programmatically pushing a Profibus configuration down to a cRIO PB module

$
0
0

I have several different Kunbus configurations saved for my Profibus networks.  Currently the only way I can download a configuration to the cRIO is through the Kunbus Configurator III tool.  Is there a way I can programmatically download a configuration using LabVIEW? 

 

Thank you.

Read from and Write to PLC KGL(LG) M. K120SE

CRIO-PN (Profinet IO) doesn't support ISOCHRONOUS Mode in TIAPortal?

$
0
0

Dear All, 

 

I have just bought a CRIO-PN Module to be used on the NI CompactRIO, The reason why I want buy it is to relize IRT high speed control, the IRT mode is said to be supported on the CRIO-PN documents.

 

The reason why I want have this function is that, I need relize accurate Motor position control in the Isochronous Mode (at least 5ms, evenly), but after I do the test, the result is kind of frustrated, as there is no Isochrnous Mode can be checked for this Module in the TIAPortal as picture below, the normal one should like the picture on right, which Isochronous mode can be checked, but in the CRIO-PN one, there is no this check .

 2.PNG

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

I want know if there is Isochronous Mode can be used for this CRIO-PN Module? After I run the test with no Isochronous mode checked, the result is not good, I send the command by Labview Real-time, 5ms, but the command received is varied from 5ms to 15ms, which as picture showed below left side, which cannot satisfy my demand for the accurate Motor Position Control. I think this CRIO-PN is used for the CompactRIO Real-time function, this result really frustates me, and I want reach the result as right side, which is all evenly 5ms.

 

 

 

3.PNG4.PNG

 

 

 

I want know if there is any method to solve this problem? Or, If there is any latest GSDML file which supports this function? As whether this mode can be checked or not depends on the description in the GSDML in my way of thinking, Or, If I can modify the GSDML file to have this function on?  I am really desperate for this help. as profinet is the basis control of the whole system, if the Profinet control cannot meet the specificaiton, there is no need to buy CompactRIO and CRIO-PN module anymore. I really hope NI and Kunbus can help me to solve this, thank you very much in advance.

Communicating with a .NET Windows desktop app over TCP/IP SOCKET by LabView/VISA

$
0
0

Hello LabView/VISA experts,

 

I'm writing a .NET Windows desktop app that needs to communicate with LabView/VISA over TCP/IP SOCKET. Because I don't own a copy of LabView, I'm using NI MAX's VISA Test Panel to test the app. The app works just fine when NI MAX is running on a different computer - i.e., communicating over a real Ethernet link. However, if both are placed on the same machine, NI MAX sometimes fails to open the socket resource, especially for the first time. Retrying it seems to always work, though. Once the resource is connected, everything works just fine.

 

Does anyone know why this happens? Is there a way to completely avoid the failure opening it?

 

Below shows the socket server code:

namespace Remote
{
    using System;
    using System.Diagnostics;
    using System.Linq;
    using System.Net;
    using System.Net.Sockets;
    using System.Text;

    public class TcpSocketServer
    {
        private readonly IScpiProcessor scpiProcessor;

        private Socket serverSocket;

        public TcpSocketServer(IScpiProcessor scpiProcessor)
        {
            this.scpiProcessor = scpiProcessor;
        }

        public string Ipv4Address { get; set; } = null;

        public ushort Port { get; set; } = 7777;

        public string Terminator { get; set; } = "\n";

        public short BufferSize { get; set; } = 1024;

        public static IPAddress GetIpv4Address()
        {
            var ipHost = Dns.GetHostEntry(Dns.GetHostName());
            foreach (var result in ipHost.AddressList)
            {
                // VISA supports IPv4 only.
                if (result.AddressFamily == AddressFamily.InterNetwork)
                {
                    return result;
                }
            }

            throw new NotSupportedException("No IPv4 address is available on this machine.");
        }

        public void Start()
        {
            if (this.serverSocket != null)
            {
                return;
            }

            if (!TryParseIpv4Address(this.Ipv4Address, out var ipAddress))
            {
                // Use this machine's Ipv4 address when no valid Ipv4 address is set.
                ipAddress = GetIpv4Address();
            }

            var ipEndPoint = new IPEndPoint(ipAddress, this.Port);
            this.serverSocket = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            this.serverSocket.Bind(ipEndPoint);
            this.serverSocket.Listen(100);
            this.serverSocket.BeginAccept(this.AcceptCallback, this.serverSocket);
        }

        public void Stop()
        {
            this.serverSocket?.Dispose();
            this.serverSocket = null;
        }

        private static bool TryParseIpv4Address(string input, out IPAddress ipAddress)
        {
            // Make sure it contains three dots that represent Ipv4, rather than Ipv6.
            if (input == null || input.Count(c => c == '.') != 3)
            {
                ipAddress = null;
                return false;
            }

            var result = IPAddress.TryParse(input, out ipAddress);
            return result;
        }

        private void AcceptCallback(IAsyncResult ar)
        {
            Debug.WriteLine("Entering AcceptCallback().");
            StateObject state = null;
            try
            {
                var listener = (Socket)ar.AsyncState;
                var socket = listener.EndAccept(ar);
                state = new StateObject(socket, this.BufferSize);
                state.Socket.BeginReceive(
                    state.Buffer,
                    0,
                    state.Buffer.Length,
                    SocketFlags.None,
                    this.ReceiveCallback,
                    state);
                this.serverSocket?.BeginAccept(this.AcceptCallback, this.serverSocket);
            }
            catch (ObjectDisposedException)
            {
                Debug.WriteLine("TCPIP server socket is disposed properly.");
            }
            catch (SocketException ex)
            {
                Debug.WriteLine($"{ex.GetType()} in {nameof(this.AcceptCallback)}");
                state?.Socket?.Close();
                this.serverSocket?.BeginAccept(this.AcceptCallback, this.serverSocket);
            }
        }

        private void ReceiveCallback(IAsyncResult ar)
        {
            Debug.WriteLine("Entering ReceiveCallback().");
            var state = (StateObject)ar.AsyncState;

            try
            {
                this.DoReceiveCallback(ar, state);
            }
            catch (SocketException ex)
            {
                Debug.WriteLine($"{ex.GetType()} in {nameof(this.ReceiveCallback)}");
                state.Socket?.Close();
            }
        }

        private void DoReceiveCallback(IAsyncResult ar, StateObject state)
        {
            var bytesRead = state.Socket.EndReceive(ar);
            Debug.WriteLine($"bytesRead = {bytesRead}");
            if (bytesRead > 0)
            {
                this.ProcessReceivedMessage(state, bytesRead);

                state.Socket.BeginReceive(
                    state.Buffer,
                    0,
                    state.Buffer.Length,
                    SocketFlags.None,
                    this.ReceiveCallback,
                    state);
            }
            else
            {
                state.Socket.Close();
            }
        }

        private void ProcessReceivedMessage(StateObject state, int bytesRead)
        {
            var s = Encoding.ASCII.GetString(state.Buffer, 0, bytesRead);
            Debug.WriteLine($"Received: {s}");
            state.StringBuilder.Append(s);
            var accumulatedString = state.StringBuilder.ToString();
            if (accumulatedString.Contains(this.Terminator))
            {
                this.ProcessMessage(state);
            }
        }

        private void ProcessMessage(StateObject state)
        {
            // Note that accumulated string may contain multiple terminators depending on the timing.
            var response = this.scpiProcessor.Process(state.StringBuilder.ToString());
            state.StringBuilder.Clear();
            if (!string.IsNullOrEmpty(response))
            {
                this.Send(response, state.Socket);
            }
        }

        private void Send(string message, Socket socket)
        {
            var byteData = Encoding.ASCII.GetBytes(message + Environment.NewLine);
            if (socket.Connected)
            {
                Debug.WriteLine($"Sending {message}");
                lock (socket)
                {
                    socket.Send(byteData, byteData.Length, SocketFlags.None);
                    Debug.WriteLine($"Sent {message}");
                }
            }
            else
            {
                Debug.WriteLine($"Cannot send {message}");
            }
        }

        private class StateObject
        {
            public StateObject(Socket socket, short bufferSize)
            {
                this.Socket = socket;
                this.Buffer = new byte[bufferSize];
                this.StringBuilder = new StringBuilder();
            }

            public Socket Socket { get; }

            public byte[] Buffer { get; }

            public StringBuilder StringBuilder { get; }
        }
    }
}

It requires a dependency called IScpiProcessor that processes SCPI commands and queries. Below shows the interface and its fake implementation:

namespace Remote
{
    public interface IScpiProcessor
    {
        string Process(string content);
    }

public class FakeScpiProcessor : IScpiProcessor
{
public string Process(string content)
{
return content.ToUpperInvariant().Contains("*IDN?") ? "Hello world!" : string.Empty;
}
} }

Below shows my unit test code that starts the server and access it via IMessageBasedSession:

namespace Remote.Test
{
    using System;
    using Ivi.Visa;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Remote;

    [TestClass]
    public class SocketServerTest
    {
        private const string StarIdnQuery = "*IDN?";
        private const string ExpectedIdnResponse = "Hello world!";
        private static TcpSocketServer server;

        [ClassInitialize]
        public static void StartServer(TestContext testContext)
        {
            var scpiProcessor = new FakeScpiProcessor();
            server = new TcpSocketServer(scpiProcessor);
            server.Start();
        }

        [ClassCleanup]
        public static void StopServer()
        {
            server.Stop();
        }

        [TestMethod]
        public void ShouldOpenSession()
        {
            Exception exception = null;
            try
            {
                var session = this.OpenSession();
                session.Dispose();
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsNull(exception);
        }

        [TestMethod]
        public void ShouldIdentify()
        {
            var session = this.OpenSession();
            session.FormattedIO.WriteLine("*Idn?");
            var response = session.FormattedIO.ReadLine();
            response = response.TrimEnd('\r', '\n');
            session.Dispose();

            // Assert
            Assert.AreEqual(ExpectedIdnResponse, response);
        }

        [TestMethod]
        public void ShouldIdentify2()
        {
            var session = this.OpenSession();

            session.FormattedIO.WriteLine("*Idn?");
            var response = session.FormattedIO.ReadLine();
            response = response.TrimEnd('\r', '\n');
            Assert.AreEqual(ExpectedIdnResponse, response);

            session.FormattedIO.WriteLine("*IDN?");
            response = session.FormattedIO.ReadLine();
            response = response.TrimEnd('\r', '\n');
            Assert.AreEqual(ExpectedIdnResponse, response);

            session.Dispose();
        }

        private IMessageBasedSession OpenSession()
        {
            var ipAddress = TcpSocketServer.GetIpv4Address().ToString();
            var resourceName = $"TCPIP0::{ipAddress}::7777::SOCKET";
            var session = (ITcpipSocketSession)GlobalResourceManager.Open(resourceName, AccessModes.None, 0);
            session.TimeoutMilliseconds = 2000;
            session.TerminationCharacter = 0x0a;
            session.TerminationCharacterEnabled = true;

            return session;
        }
    }
}

Interestingly, the unit tests never fail to open the session and always pass, even though the client and server are running on the same machine.

 

When testing the code with NI MAX, make sure you check the "Enable Termination Character" setting in the VISA Test Panel.

 

I'm using .NET V4.7.1, NI VISA V17.0, and IVI.Visa V5.8.0.

 

I'd appreciate any suggestions.

 

Thanks,

 

Tetsu Shimizu

IF possible can make the CRIO-PN communication time shorter?

$
0
0

Dear All,

 

I have just bought a CRIO-PN module with CompactRIO to realize the Profinet communicaiton function.

 

And I use the Official Example File (CS_cRIO-PN_IO-DeviceExample(FPGA).vi) to realize the funciton Receive/Send Profinet signals Loop. I want know how quicke can be realized for a profinet Signal Send/Receive Loop.

 

According to the Official document, To send command and receive signal from Profinet Communication network must go through following Process:

Set Input Data  - Read/Write IO data - Get Output Data

 

After I do the test, the time consuming for each process is as following:

Set Input Data(1ms) - Read/Write IO data (2-4ms) - Get Output Data(1ms)

 

Which means that for this one communicaion loop, it needs take 4ms-6ms to finish whole process. 

 

As I want get the communication loop finished as quick as possible, I want know if there is any method to reach this target? My target is kind of reach communication loop finished within 1ms if possible (RT) or even better reach within 250us (IRT), to get maximum usage of Profinet network.  

 

You can find following pictures of my test VI, 

Read_Write_Diagram.PNGIO_Read_Write_4ms.PNG

After my test, you can see for one I/O read/Write process finished, it takes about 4ms.

 

Do you have any precious idea regarding how to optimize this read/write loop? If there is any optimizaion on the FPGA level that that can reach this target? 

Share COM device between two instances of application running on two computers

$
0
0

Some years ago, I wrote a LV application which controls a given number of DUTs (not represented on the pictures) and queries the status of the climate chamber by a serial communication. The test cycle is started by the operator and the application doesn't send any command (only query of the status) to the climate chamber.

One.jpg

 

Now, in order to double the number of DUTs but without the need to buy another expensive and bulky climate chamber, we want to go to this configuration.

 

Two.jpg

The same application runs on both computers. It must be possible to use each of the two computers separately but also both at a time. 

 

Which interface or technique would you use to share the COM port of the climate chamber ? A solution requiring no (or only a minor) adaptation of the application will be preferred.

 

Many thanks in advance.

Communication with MFC P4B via RS485

$
0
0

Hello,

I have a MKS Type P4B Digital MFC and I want to communicate with him via RS485. I don't know how to understand a 'Command Specification RS-485 Interface MKS Types P4B Digital Mass Flow Controllers' because there is something like this:

manual.PNG

In this specification is information 'This message structure resembles with the one used by DeviceNet protocol' so I installed DeviceNet 15.0 and I found examples, but I still don't how to write this command.

 

Can anyone help me and tell me how to fill these controls?

 

1) Basic Examples -> PXI & PCI -> Explicit Messaging Write Read

example1.PNG

 

or

 

2) Legacy Examples -> Windows -> DeviceNET PCI Legacy

example2.PNG

 

 

or any other idea how can I communicate with my MFC P4B via RS485?


LabVIEW NXG Ethernet/IP Support

$
0
0

Hello all:

 

I am using the Ethernet/IP communication module along with NI vision software. This is a really powerful combination of tools! I have about 30 machines running this software (with many more to come). Will there be Ethernet/IP support for LabVIEW NXG in the near future? I am fairly concerned about migration. I have been told that there is no ETA for Ethernet/IP support in NXG as of yet. I was asked to post here by an NI applications engineer, so I am hoping maybe someone else has the same concerns or perhaps some advise.

 

Thanks!

Interfacing with Proportional valve with HART

$
0
0

We have a valve with HART control that we are currently controlling with an NI 9265, current output module. This has worked fine but we're wanting to get positional feedback from the valve. Previously we had used a USB HART Protocol Modem (https://microflx.com/products/din_hart?variant=792035747) This worked fine on an older system where we were using an SCXI Chassis. But the cRIO module has a max load of 600 ohms and when we put the required resistor for the modem to work, the combined load of the valve and the resistor were too much and we weren't getting full scale output. 

 

Now I am looking into using the AM-9898 module. However this module only reads in the current loop, it doesn't have a current output. Could I use this in conjunction with the NI 9265 or do you think I would run into the same problem? Thank you for any help or input. 

 

Also the valve controller is a metso nd9000 I believe. I'll have to look and see if I can find the information on the load resistance.

EtherCAT Distributed clocks with Beckhoff IO

$
0
0

We are using Beckhoff EtherCAT IO with Labview 2016 running on Labview RT Pharlap.  

We cannot get the EtherCAT distributed clocks to work correctly using the device properties dialog.  Enabling DC causes an error stating the device does not support DC.  The device does support DC.  

 

Digging deeper, I found when setting up DC the SDO 1C33:1 is only ever set to mode 0 or 1.  The correct mode to synchronize inputs to the clock is 3.  I wrote a program to setup distributed clocks using a property node.  This also did not work correctly.  I accidentally created a configuration of the property node that will enable DC on only 1 module. If I try to enable the clock on a second identical module, it does not work.  Where the node does work, it is not sending the correct values to the slave. 

 

When Input.Mode is set to "Synchronize to EtherCAT frame" and Sync0 is enabled SDO 1C33:1 should be 1, but becomes 3.  When Input.Mode is set to "Synchronize to distributed clock" and Sync0 is enabled the DC doesn't work and gives an error.  

 

When Input.Mode is set to "Synchronize to EtherCAT frame" and Sync0 is disabled SDO 1C33:1 should be 1, but becomes 0. 

 

I have been able to get distributed clock work on all modules by a very complicated work around: 

First enable to DC on the one module where it will work, this ensures the master creates the sync packets correctly.  

Set Input.Mode is set to "Synchronize to EtherCAT frame" and Sync0.  This causes the module to not enable DC but the SDO 1C33:2-1C33Smiley Very Happy become populated with the correct values.  

The scan engine can then be placed into Active Mode.  

After placing the scan engine into Active Mode, I use WriteSDO to write the value 3 to SDO 1C33:1.  The DC on the slave then becomes correctly enabled.  

 

While this solution works, it is not easily scale-able as each module has specific needs for correct configuration.  These needs are described in the ESI xml files which are read when opening the device properties window.  Without using the device properties window it is necessary to manually open each ESI file to read the correct DC settings.  

 

Attached is a picture of the program used to configure the modules and the device tree.  The Ethernet adapter driver is i8254x. 

IEC 60870-5-101: Read Values

$
0
0

Hi everyone,

 

i am working on IEC 60870-5-101 Client protocol; the server is configured and transmitting Analogue and Digital values.

I also test those values with IEC Test Harness Software; All values are valid. 

I tried to access those values in Labview 2013 (from example NI Industrial Communication) but its not working.

Any suggestion/help is highly appreciated.

 

Thanks

Profibus Questions

$
0
0

Hi,

    I have to communicate to Parker Compax3 drive containing profibus dp protocol from my PC .If i have selected PCI Profibus card is it possible to communicate to drive.

Communicate PCI NI PROFIBUS with PC(master) and PLC S7-200(slave)

$
0
0

It consists in communicating through the RS-485 cable, a PC (master) and PLC (slave), I have the NI POFIBUS PCI card, but in which step I indicate that I want to use my PC as a master?

Omron PLC - Ethernet/IP Communication

$
0
0

I need a data communication between Omron PLC and Labview. According to my researches, we must specify the eds file of Labview to Omron PLC. Someone mentioned to use Generic EDS file for communicating with Labview. We tried this method but it couldn't work. Then i tried these instructions.Finally, i try to generate EDS file via EZ-EDS program. Unfortunately, i haven't accomplished any solution. Can you help me?


Ethernet/IP bit collision in PLC?

$
0
0

TL;DR - If two cRIO chassis write to the same Ethernet/IP tag using implicit messaging, why would the values be OR'd instead of overwritten?

 

I ran into an odd situation this week. We have two end-of-line testers on an assembly cell that use a NI cRIO-9063. They communicate with an AB Logix PLC over Ethernet/IP using explicit messaging. We were seeing some weird behavior where the typedef'd state machine variable (as seen on the PLC) was showing "impossible" values. We checked the PLC to verify that there wasn't some wayward instruction toggling the mystery bit. We also tried masking the output from the first tester with a value that would prevent the wayward bit from being sent and it still showed up.

 

After some head scratching and a good night's sleep, something occurred to me: the second nest wasn't being used yet since the product it was supposed to run hasn't launched, but during some troubleshooting the cRIOs were physically swapped. The end result was that the PLC tag names on both cRIOs were writing to the tags assigned to nest one. I.e. "Nest1_State" on both instead of Nest1_State and Nest2_State. The first machine was responding to the PLC as expected (start cycle, change state, etc.) and the other machine was constantly throwing an error during setup, causing it to cycle between the Error (index 8) and Init (index 0) states. The end result was that the state from nest 2 was sometimes being OR'd with the state from nest 1. Specifically, the Error state on nest 2 and the Idle state (index 1) on nest 1 would show up as index 9 on the PLC, which is a valid state during some portions of the test. Sometimes the overlap was where we expected to see state 9, sometimes it wasn't, but it was there on almost every machine cycle. The weird part is that the only unexpected state we ever saw was 9, which would only be possible if nest 1 was in Idle and nest 2 was in Error, even thought the overlap should have been happening during states 5, 6 and 7.

 

So yeah, what would cause that to happen? Is it something in the LabVIEW library and how it writes to the data structure? Would it be in the way the PLC receives the network packets? Ideally you should never do this, but we stumbled on to it and it's baffling me.

 

Thanks!

Cranky

 

LabVIEW library for Molex SST-DN4-USB DeviceNet master, is it possible?

$
0
0

Hi,

 

What's the latest on the SST-DN4-USB? It looks like I would wrap functions the dnscan32.dll, as described in

5136-DN/5136-DNP, DeviceNet Scanner Module / 32-Bit DLL API, Reference Guide, Version 2.21, to create a LabVIEW library for this device.

 

Has anyone done this, does this work? Are there LabVIEW VIs available for this? How many man hours did it take to get it working?

Thanks,

Chris C.

Danfoss fc-102 Modbus TCP communication

$
0
0

I am trying to establish communication with a Danfoss FC-102 inverter through the NI modbus libary.  I constantly get a 'the Modbus slave does not accept the data address contained in the query. Function 3' error. But device identification works.  I try to read for instance the speed which is parameter 1617 which should be address 16170.

Does anyone have experience with Danfoss drives?

The led on the card is blinking indicating that it needs commisioning. But I don't know what parameter still needs to be set.

Getting started with 3rd party EtherCAT slaves - questions

$
0
0

Hi,

I'm reasonably experienced with Labview RT, but this is the first time I've used EtherCAT.

I have a PXI chassis acting as EtherCAT master, and I will be using 2 different 3rd party EtherCAT slaves. One is to talk to a Control Techniques motor drive, and the other is to talk to an HBM torque flange.

For now I only have the Control Techniques Drive part, so that's what I've started with.

I have managed to import the xml file and add the slave device and 4 variable have appeared in the project linked to that device (2 read and 2 write). I set up a 1kHz loop to read the 2 variables, and this works most of the time, but I get an error every now and then, see attached. I have tried increasing the EtherCAT Cyclic Bandwidth percentage from 40% to 60% but still get the error. Any ideas what might be causing this?

How would I go about reading other data items? the xml file only seems to include the 4 that I'm getting access to but if I look at the EtherCAT Parameters in the Online Slave Device State there are lots more.

Also, is there likely to be an issue if one or both of the slaves get turned off and back on again? will my code need to somehow re-initialise? I don't really understand the whole configure/active mode thing. Is the simple way of just dragging the variables in to a vi from the project going to be fine or is it better to use the programmatic way of discovering devices/variables etc.?

The application is an engine testcell, so I need to measure speed and torque, and output a speed setpoint at 1kHz.

Thanks in advance for any help - sorry it's been a bit of a rambling post!

 

Adding NI-9881 to project (cRIO 9038)

$
0
0

Hello,

Hopefully this is an easy one. Pretty much a rookie here.

 

I have a cRIO-9038 and a NI-9881 CANopen card. When I go to add the 9881 to my project for either FPGA target or Scan mode, it sees the module but that the "This C Series module in not supported by the current versions of LabVIEW and NI-RIO"

 

I am obviously missing something here. Any pointers/solutions would be greatly appreciated!

 

Thanks!

Tyler

Viewing all 338 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>