AngryRobot

Data from an NX102 to Excel

26 posts in this topic

What is the best way to get data from an NX102 (or any NJ/NX PLC) into Excel?  I've been experimenting with some OPC UA options, but so far the only clients I've been able to connect with don't allow exporting of data.  Does Omron have any sort of ODBA connection?

Share this post


Link to post
Share on other sites

Write a .csv file onto the SD card and then use FTP to get it off the card.  That is one pretty easy way.  

1 person likes this

Share this post


Link to post
Share on other sites

I've used the NJ models with SQL capabilities before, but this machine doesn't normally require data logging.  We are wanting to do an in-house run off on the machine and log some of the test results to prove its reputability when our customer shows up; and I figure logging it right from the PLC will be easier than sitting at the machine and manually recording every number by hand then transcribing it into Excel.

So FTP it is.

Share this post


Link to post
Share on other sites

Any tips on how to write data to the CSV file?  I have an array of REAL numbers.  I can create and close the file just fine, but the data that gets written is just junk characters.  Do I need to convert the data to string?

 

EDIT: Converting to string and concatenating a ',' worked.

Edited by AngryRobot
2 people like this

Share this post


Link to post
Share on other sites

This may be slightly more complex than what you are looking for but here is what I have. This will write a CSV file populated from a 2 dimensional array of REALs (16x16). In this particular example, the "Unit_Str" is specific to our application. I also run it twice with the "Light_Check_SeqStep_xx_Active" sequence step bits but only once is necessary. I copied this code over from a working program but I haven't tested this one.

SD_Card_Write_Example.smc2

1 person likes this

Share this post


Link to post
Share on other sites
On 9/6/2019 at 10:51 AM, PMCR said:

Hi PMCR,

Can I have multiple instances of these function blocks to write to the same SD card so it creates different files?

I would like to log equipment downtime in seperate files. Also, does your LogDataX variables within the structure support Time data type?

Thanks

Share this post


Link to post
Share on other sites

Multiple instances should be OK.

I use the status flags for SD card access in the FB.

Share this post


Link to post
Share on other sites
On 28/08/2019 at 10:30 PM, Michael Walsh said:

Write a .csv file onto the SD card and then use FTP to get it off the card.  That is one pretty easy way.  

Hi Michael, 

Can you provide more info on how to do this? i have 14 arrays of 18 Dint, every hour data is recorded in these arrays i want to be able to send the data in these arrays at the end of shift before there get blanked

thanks

Share this post


Link to post
Share on other sites

Here is sample code on how to write to a csv.  You will need to create a login on the site to get to the file if you have not already done so.

https://automation.omron.com/en/us/support/resources/sample-code/sd-card-write-sample-code-in-njnx-controller

Here is a video that explains how to FTP the file from the SD card:

https://www.youtube.com/watch?v=a1d81yiaHu0

Share this post


Link to post
Share on other sites
On 8/28/2019 at 5:30 PM, Michael Walsh said:

Write a .csv file onto the SD card and then use FTP to get it off the card.  That is one pretty easy way.  

Hello Michael,

I am new in this field. But I want to take data in .csv file into SD card. How can i create .csv file that can directly trace data of my program?

Please help me out.

Thanks

Share this post


Link to post
Share on other sites

He already provided a link explaining how to save controller data to CSV file.

1 person likes this

Share this post


Link to post
Share on other sites

Hello everybody!

For all the above links you have provided, I get the following error from Sysmac Studio.

Is there any way skip that error?

Is any pdf file available for the above links, for writing data to SD card?

Thanks

 

Capture.PNG

Share this post


Link to post
Share on other sites

I'm not familiar with the limited SS version. What is your PLC model that it allows you to open?

Edited by IO_Rack

Share this post


Link to post
Share on other sites
1 hour ago, IO_Rack said:

I'm not familiar with the limited SS version. What is your PLC model that it allows you to open?

I'm using the NX1P2-9B24DT controller.

Is this an issue with the controller or with the license? I tried also OMRON site to download some samples but none of it opend..

 

Thanks for the pdf file!

Share this post


Link to post
Share on other sites

I'm assuming you have a limited license for Sysmac Studio. The project file I posted used an NJ501 controller. 

Share this post


Link to post
Share on other sites

You must have the light version. If you can't write your own from the PDF let me know and I can convert an example to an NX1P

Share this post


Link to post
Share on other sites
1 hour ago, photovoltaic said:

You must have the light version. If you can't write your own from the PDF let me know and I can convert an example to an NX1P

Yes I have the light version, unfortunately.. So I suppose this version is only for NX controllers..?

I'm going to give it a try of writing my own and I will let you know.

Thanks a lot!

Share this post


Link to post
Share on other sites

Sysmac Studio Lite is only for NJ101 and NX1P2.

Share this post


Link to post
Share on other sites

Lite also supports NX102 CPUs.

The 'Full' version adds support for NJ301, NJ501, and NX701.

I have attached a version compiled for NX102, firmware version 1.32, which is an old version of firmware that older versions of Sysmac Studio can open.

 

NJ Data Log Function NX102.smc2

Share this post


Link to post
Share on other sites
11 hours ago, PMCR said:

Lite also supports NX102 CPUs.

The 'Full' version adds support for NJ301, NJ501, and NX701.

I have attached a version compiled for NX102, firmware version 1.32, which is an old version of firmware that older versions of Sysmac Studio can open.

 

NJ Data Log Function NX102.smc2

I managed to open the project.

thanks a lot!! 

Share this post


Link to post
Share on other sites
17 hours ago, PMCR said:

Lite also supports NX102 CPUs.

The 'Full' version adds support for NJ301, NJ501, and NX701.

I have attached a version compiled for NX102, firmware version 1.32, which is an old version of firmware that older versions of Sysmac Studio can open.

 

NJ Data Log Function NX102.smc2

The only document I could find on Lite indicated only NX1P2 and NJ101.  Would be nice if it was better documented.  

Share this post


Link to post
Share on other sites

Hello again!

As per IO_Rack and PMCR latest attachments, I understand that the writing of headers is for first cell only in each line of csv file, i.e A1,A2,A3 and so on.

What I'm trying to do is to add headers in each column for the first line (this is going to be fixed) and then, rest of lines will be filled with the respective data, coming from an array of structures, for a number of 50 lines in csv file.

So, lets say that the array of structure (array#1) consist of data of a structure (myStructure1) with 6 members in total.

Final csv should be as follows:

Line 1: Headers (6 columns)

Line 2: Data of array#1 (column1=member1, column2=member2, column3=member3 etc.)

Line 3: Data of array#1 (column1=member1, column2=member2, column3=member3 etc.)

Line 50: Data of array#1 (column1=member1, column2=member2, column3=member3 etc.)

My problem is:

1) I cannot find a way (or I don't understand the way) of adding headers in different columns

2) I cannot insert each value of member in separate cell (column). I assume that I could use concat instruction for 6 members separately but I believe there is a more optimal and effective way instead of it. Even if I use the FileWrite instruction (usage also for array of structures), the values from the array of structures are going to the first cell only. In addition, I cannot find a way of inserting the values to a specific cell.

I tried also to move the array of structures in to a new array and then move the new array to csv file but, the problem with this option is that movement can be done only with the same data types..

 

Any suggestion please?

Hope my points were clear..

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now