PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. petermannon
  2. PLCnext Engineer
  3. Sunday, 23 February 2020

Hello:

 

I need to be able to create, Monitor and Control upto 400 Timers (TON).

The easiest way would be to create an ARRAY of TON (Data Types), but this is not available.

Do you know of another way to accomplish this ?

 

Thank you !

Peter.

Josh Accepted Answer Pending Moderation
0
Votes
Undo

Hey Peter,

I have run into this in the past. From what I found it is not possible to create a datatype that is tied to the TON FB.

Alternatively, you can create your own user-defined datatype that is made up of a structure and an array. The structure can contain the elements of the timer (i.e. IN, PT, ET, Q). Then an array of that structure can be created which will give you an array of TON elements.

Please see attachments for the user-defined datatype and how to use it in a program. 

 

Attachments (3)
  1. more than a month ago
  2. PLCnext Engineer
  3. # 1
petermannon Accepted Answer Pending Moderation
0
Votes
Undo

Josh:

Since the TON Block is the Same Instance and just uses Arrays to acces it, this does not work as I need it to.

Each Array needs to have different PT Values, Start Times, etc....

The Array Data as you described for each is not independant, since they are based upon a Single TON Instance..

The TON will only have the Values from the Last Array sent to it.

 

Thanks !

 

  1. more than a month ago
  2. PLCnext Engineer
  3. # 2
Josh Accepted Answer Pending Moderation
0
Votes
Undo

Hey Peter,

The array in the example would have the ability to store info about/for multiple timers. 

The array can also be referenced implicitly instead explicitly like the example shown

For example, change arrTimers[1] to arrTimer[iIndex] and now you can change that index however it needs to fit that instance of the TON.

 

  1. more than a month ago
  2. PLCnext Engineer
  3. # 3
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi guys, sorry to butt in to this conversation ... I like Josh's solution but I think I can see what Peter is saying.

If I understand Josh's solution correctly, the array can hold information for the 400 timers that Peter needs, and this makes it easy to process this information using for-next loops (for example).

However, I believe that for this to work, there must be 400 instances of the TON function block created, with each FB instance "tied" to one single set of array elements. This is because there are internal variables in the FB instance that keep track of (for example) the elapsed time. And I understand that Peter does not want to create those 400 FB instances, but is looking for a way to create an array of FB instances.

I have passed this question on to the PLCnext Engineer support team, and I hope that they have a solution that will suit Peter's requirements (if I understand them correctly).

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

  1. more than a month ago
  2. PLCnext Engineer
  3. # 4
petermannon Accepted Answer Pending Moderation
0
Votes
Undo

Matin:

Yes, I need 400 instances.

Thank you for looking into this for me and I look forward to a response.

Regards,

Peter

  1. more than a month ago
  2. PLCnext Engineer
  3. # 5
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Peter,

Unfortunately what you want to do is not possible with the current version of PLCnext Engineer.

So at this point - if you want to use PLCnext Engineer - you will need to create 400 function block instances and connect each instance to its own inputs and outputs.

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

  1. more than a month ago
  2. PLCnext Engineer
  3. # 6
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.