Timer array-extract or compare done bits?

dginbuffalo

Member
Join Date
Dec 2010
Location
Buffalo,NY
Posts
630
Hello again- after the nice thread on filling the .pre's on timer arrays, I'm in another bind.

I need to look at 60 timer_array.dn bits and see if any of them are on so i can flag a main alarm. I tried unsuccessfully with AB chat and they dumped me because it's a programming question-lol.

The only thing I can think of is to either create an indexer to step through the array and see if array_timer[0].dn is greater than zero?

Or copy and index all the array_timer.dn bits and move into 2 DINT's and then see if they are greater than 0?

Maybe I'm missing the obvious- any ideas??:unsure::unsure:
 
Move the dn bit of your indexed array into the first bit of a dint array. Then do your search/compare on the indexed array of dints
 
Move the dn bit of your indexed array into the first bit of a dint array. Then do your search/compare on the indexed array of dints

This may be a good idea as I also need to alarm these bits in FTV ME. I believe i can break out the array bits in FTV alarm setup. I'll give this a try!
 
I would just build a simple AOI using structured text to do the bit detection.

For example:

(* NOTE THIS WAS DONE USING CODESYS, SHOULD BE COPY PASTE TO AB, DOUBLE CHECK THE FOR LOOP *)

Code:
INPUT PARAMTER - [B]Timers[/B] (TON[60])
OUTPUT PARAMETER - [B]currentAlarm[/B] (DINT)
LOCAL PARAMETER - [B]arrayIndex[/B] (DINT)

// ---------------------------------------------------------------------
// Loop Through Timer Done Bits to see if any are active
// As soon as an alarm timer done bit is detected, output the timer number
// ---------------------------------------------------------------------

// Reset the output
currentAlarm := 0;
FOR arrayIndex := 0 TO 60 BY 1 DO
    IF Timers[arrayIndex].DN = TRUE THEN
        currentAlarm := arrayIndex;
	RETURN;		
    END_IF
END_FOR

Note the RETURN statement ensures that the first alarm detected by the loop is what is set as the current alarm. Otherwise the last evaluation in the loop will win, depends on priority. The downside to this is you can only detect 1 alarm at any given time.

Generally speaking if you need to trigger alarms in FTView ME, I would create another bit array that will serve as triggers for the alarms on FTView ME.


Timer[1].DN AlarmArray[0].1
---| |-------------------------( )---




Let FTView ME scan the entire AlarmArray[x], use bit detection and each bit in the array can be an individual alarm with the appropriate message.
 
Generally speaking if you need to trigger alarms in FTView ME said:
Timer[1].DN AlarmArray[0].1
---| |-------------------------( )---
[/LADDER]


Let FTView ME scan the entire AlarmArray[x], use bit detection and each bit in the array can be an individual alarm with the appropriate message.

Paully- Yes I will need bit detection for each alarm. I kind of like Tharons idea where I will index all the timer done bits into an alarm array. This way I do not need an a alarm array coil for each alarm and I can use the array right in FTV alarm setup. I "think" this will be the least work.
 
Have a look at this document, might be helpful.

That's good stuff and exactly what I think I'm going to do. Instead of using an alarm_array[0].X coil for every timer (since that logic is already complete), I think I am going to continually index through the timer array .dn bits and move them into Alarm_array. I'll then use that alarm array in FTV alarms. This will just save me from adding code to 60 timer rungs.
 
Orrrrr-maybe not! It appears i can't MOV or COP a timer.dn (bool) to dint array (bool). It has to be sint, int, dint, etc...

O well- I may just put the 60 coils in and forget it!!!!
 
You cannot move or copy a bit tag. An XIC to an OTE is move you move a single bit. MVM or BTD could work but ar emore than you need.

Use a COP to copy the entire structure to a DINT[3]. Then DINT[0].29 is the done bit.

From the useless information file.

OG
 
Orrrrr-maybe not! It appears i can't MOV or COP a timer.dn (bool) to dint array (bool). It has to be sint, int, dint, etc...

O well- I may just put the 60 coils in and forget it!!!!


You can set up a single XIC OTE rung with the indexed addresses. It will accomplish the same thing. But one bit rather than a word.
 
You can set up a single XIC OTE rung with the indexed addresses. It will accomplish the same thing. But one bit rather than a word.

If I index to a single OTE, it will be overwritten on every index? Also I have to FTV alarm on the proper timer[x].dn bit. Maybe I'm missing something?
 

Similar Topics

I have some logic that I have written within a 5380 series controller that tracks the time an event is started, while the event is running an RTO...
Replies
2
Views
93
Hi all, I have a simple question that I have overcomplicated and gotten stuck on. I have a variable, we can call it "light" that I need to stay...
Replies
4
Views
316
Question to anyone with ideas about my thoughts on upgrading a very vintage timer, which is being used to switch between 2 5hp domestic water...
Replies
14
Views
437
why my timer only executes once here? After first time i use it, ET stays at 0ms all the time. It is in FB
Replies
5
Views
315
Good morning guys, I'm searching for a Timer relay which accomplishes the "flasher" condition in the photo attached, however, I need the ability...
Replies
2
Views
556
Back
Top Bottom