Sign in to follow this  
Followers 0
nicepal

CJ1M Date and Time Calculation

6 posts in this topic

To all experts out there, I am using CJ1M-CPU23. I have a project that need to calculate when a Error start and when a Error End. Form the Time, I need to calculate how long the error takes to reset by operator. With this info, I need to write into the CF card a file capturing all errors with, how many time it occurs in a day, how long was the duration the error last added up together. And I also need to check that if the files was 4 months old, I need to delete them from CF card. Can anyone help to advise me how can I do this as now I am stuck on the time calculation portion. I need to know; 1) how i can calculate the time difference. 2) how can I check the CF card that the file is more that 3 months ago (I intend to save the file with the YYMMDD kind of format) Thanks in advance. I appreciate if someone out there can let me know by thursday as I need to reply Cstomer by 30/08/2007 Singapore time. Thanks a zillion.

Share this post


Link to post
Share on other sites
You can use a mask for the time clock and trigger the masked move with a diff up contact when the fault occurs. Similarly for the reset. Then subract the fault time from the reset time to give you a length of time to reset value. If I get time today I will see if I can do something for you but don't count on it - I may or may not get time. Cannot help with the CF card though.

Share this post


Link to post
Share on other sites
Hello! they are happened two forms to calculate the time that the alarm has lasted. 1ª) To the beginning of the alarm, to Keep the hour, it dates current in a channel. When concluding the alarm, to subtract the kept value of the hour, it dates current. 2ª), maybe but easy. To the beginning of the alarm, to Put to zero an accountant, and to go increasing it, each 1s. at the end of the alarm, we will have the duration in seconds. For the second part, lalectura of the file in CF, I don't understand very well that it is loq eu you want to make.. * To look for files whose creation date is previous to 4 months? * To look for annotations inside the file of more antiquity?? greetings.

Share this post


Link to post
Share on other sites
Hi, I had a system where I needed to log data to the cF, where we created a new file each day. The filename simply incorporated an unsigned integer value of 0 to 65535. This filename index was incremented each day. We then wrote some ladder code to delete any file(names) older than 60 days. This prevented the cF card ever getting too full. I note also the FINs command 'FILE NAME READ' code 2201 (see manual W342) retrieves the file creation date - you could issue this command to the CPU using the CMND ladder function - however I suspect quite a bit of development time could be used if you headed down this track ... (it looks perhaps complicated to use) It may be simpler to install a huge cF card and periodically manually delete the files using a PC ? Note that you can connect a PC (windows explorer etc) to the cF card using FTP if you have an Ethernet unit on the PLC .. Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
Ever looked at the CSUB function..... ????? Secondly I uploaded a long time ago in the download section how to write to a compact flash card... Via ethernet you can use a FTP client to download the file or delete it... Or some one did a thread on creating a connection to the card to appear as a drive etc.

Share this post


Link to post
Share on other sites
I would like to thank all in providing your valuable advises. I have made some tests last weekend. 1) how i can calculate the time difference. - I captured the Start & End time and uses the CSUB (Calendar subtract) to calculate the duration. 2) how can I check the CF card that the file is more that 3 months ago (I intend to save the file with the YYMMDD kind of format) - I use the same CSUB function and calculate what is the date that is 90 days ago (90*24hr=2160hr). As the file is created under the formate of YYMMDD.txt, so I just issue a file delete command to CF Card to delete the file that is YYMMDD.txt. I had even saved those files under individual folder, named monthly ("09" for September). When 90 days is up, the program can go into individual folder to delete the required dated file.

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
Sign in to follow this  
Followers 0