Using BASIC to email tags on cycle change


#1

@anonzsrbyldm
Hi Mark,

The way I understand it, and correct me if I’m wrong, is that you want to be able to send a group of tag values by email (or ftp, API, etc.) each time a cycle completes in the PLC, and you will have a cycle counter increment, which will be a tag as well. Will the tags be the same each time?

Can you send me the backup of device so I have an idea of the tags, and whatever code or notes you have so far. That way we’ll be on the same page and be able to help you get this done.

Thanks,

Kyle


#3

Kyle,

Sort of. I want make a historical log of each group as the Vessel Cycle No increases from 1 to ……. Or resets to from some number to 0. Upon that event trigger I want to make a historical log of each Group of Data. As you will see in the backup I have 3 Cycle_No variables that I want to monitor and upon a change I want to record each group of data. I want to end up with 3 logs of data and need to have a user retrieve that data say daily or weekly, this can be done using the Web interface or perhaps an email triggered by a change in the Vessel Batch No. Is it possible to make the data into tabular form (csv type file)?

Mark


#5

Hi Mark,

I think I understand what you’re looking for. Are you saying that you want to make it so that it starts logging when one of your vessel cycle numbers starts counting and sends out an email for a certain group of historical data when the vessel cycle changes to 0?


#6

Tim,

Thanks for your reply. Almost, I want to perform a “one-shot” log of the Group values when the vessel cycle changes values from 1 to 2 to 3 to 4. Then create a csv something like this

. When the Vessel batch number changes from 12345 to say 12346, then send the data and start creating a new log or perhaps just keep logging and send on a weekly basis.


#7

Tim,

Another option if it would be easier they could set a bit on an HMI and trigger a bit to change to in the PLC to the send the email?

Regards,

Mark


#8

I think I have an idea on what we could do for this, I’ll write up some code and get back to you soon


#9

Hi Mark,

Here’s some code I wrote, it will create a new csv file each time that the batch number increments as well as sending out all of the previous data

Here’s how the output looks for the email and in the text file.

If you open it up as a csv, you can set it up so it’s semicolon delimited and it should look something like this

image

The code is attached below, as well as a picture of the tags I created for this

CSV Incrementer and Email.txt (2.3 KB)


#10

Tim,

Thanks, so I can just replicate this for the other two Batch / cycle combos…. How do I handle and ongoing cycle count cycle count number n+1 until the batch number is changed?

Regards,

Mark


#11

Hi Mark,

Glad we could get it working, Let me know if you have any other questions on this one


#13

https://ewonsupport.biz/ebd/


#14

A post was split to a new topic: Historical logging on an SD card