Bit Shift or Sequence?

Iandayen

Member
Join Date
Oct 2020
Location
Colorado Springs
Posts
5
I have a program I need to work out for a client and I'm having trouble figuring out the correct logic to do it. Let me see if I can explain it properly.

Programming done in Studio 5000 - compactlogix processor.

There are some Supply and Exhaust fans I need to control (4 of each) to keep a room temperature around 90 degrees. They have 4 combinations of fans they want to run depending on temperature. I'm calling these F1 through F4. Fans are all on or off, no speed control, just a digital output to a motor starter in MCC.

F1 Active below 85 Degrees
F2 Active above 90 Degrees
F3 Active above 95 Degrees
F4 Active above 98 Degrees

I'm using a 15 minute timer for each of these setpoints, temperature has to be over that point for 15 minutes for fan operation to kick in.

That's the easy part. The part I'm having issues working out is the drop in temperature operation.

Say F4 is active currently. They don't want it to drop to F3 until the temp has been below 85 degrees for 15 minutes. So if the temperature suddenly drops below 85 and stays for 15 minutes it goes to F3 operation, if it stays for 15 minutes again it goes to F2 operation.

I was thinking about using a BSL/BSR operation but not sure if I'm thinking about this the right way.

Timer for under 85 degrees set to 15 minutes. Use the done bit to trigger a BSL. F1-F4 operations are active depending on where the bit is in the bit shift operation.

I can't seem to work out how to get the Temperature up bit shift right to work with the different temperature ranges though.

Is this something that should be done with a sequence operation maybe? Am I missing a super simple way to do this and overcomplicating it?
 
you could add a branch to fans 2 and 3 to lock them in with the next higher fan. For example if fan 3 has turned on, a branch with fan 3 running on fan 2 would keep it on until fan 3 is no longer running. then you would start your 15 minute temperature based shutdown timer for fan 2. Thats just a start would have to think about the transitions.
 
You would need 4 different reset timers, otherwise it can easily reset all stages at same time.


if F4 and under 85c 15mins then reset F4
if F3 and not F4 and under 85c 15mins then reset F3


..
F1 and not F2, F3, F4 and under 85c then reset F1





Or you can use sequence / integer and step down one step (steps/ integer number 1..4)


Edit. I would go set/reset or integer value, as it is probably easier to handle than shifting if you need to add or shutdown fans fast on some situations.
 
Last edited:
What about F1 operation? - does the temperature have to be under 85 for a further 15 minutes after dropping to F2 operation before F1 become active?

Yes, F1 operation happens if under 85 degrees and F2, F3, F4 are all inactive.

That's why I was thinking bit shift. 4 bits, 1000 =F1, 0100 =F2, 0010 =F3, 0001 =F4

And that works out great for shifting left.

Shifting right is where I am getting confused. If F1 is active and Temperature spikes to 100 degrees for 15 minutes, I need to shift that bit right 3 times.

Can I just write to that array instead of shifting the bit right?

Leave the BSL in place for under 85 degrees then depending on temperature could write to that array? Then use those bits to activate F1-F4 operations?
 
I would use what is used for shop air compressors.

Monitor the runtime hours of each fan, start the lowest hours fan first, then the next lowest as demand increases, up to all 4 on.

Program in the ability to turn off each fan for maintenance and take it out of rotation.
 
I like using compare instruction example:
create rung with compare if greater than say (F4)98 degrees put output coil on.
Or another compare with cutoff temp say 85 degress then and coil contact.

so if temp above 98(F4)coil on and latched until below 85.

You can then use that add timers and additional fans.

Just a thought
 
update: whoops, I just realized F1-F4 are the combinations, not the individual fans.

There are five combinations, not four:

  • Add F1.5 which is all fans off.
three INTs: fnum; losp, hisp (high setpoint).

Use SQO on array sqo

  • sqo[0] = F1
  • sqo[1] = F1.5 = 0
  • sqo[2] = F2
  • sqo[3] = F3
  • sql[4] = F4
two TONs: next_timer_up; next_timer_down

  • next_timer_up is fed by rung output of [GEQ temperature hisp] AND [GRT temperature hisp]
  • next_timer_up.PRE = 900k ms (or equivalent)
  • next_timer_down is fed by rung output of [LES temperatue losp] AND [LEQ temperature losp]
  • next_timer_down.PRE = 900k ms
when next_timer_up.DN is 1, it triggers a few events:

  • reset of next_timer_up
  • SQO (add 1 to .position; I forget how SQO works)
  • MOV hisp losp
  • ADD hisp 5 hisp
  • EQU hisp 100 MOV 98 hisp
when next_timer_down.DN is 1, it triggers:

  • reset of next_timer_down
  • SQO (subtract 1 to position)
  • MOV losp hisp
  • SUB losp 5 losp
  • EQU losp 93 MOV 95 losp
update II: initialize SQO to sqo[0], losp to 85; hisp to 90; we may need to tweak the setpoints by 1 so LEQ and GRT will work i.e.


F1 Active below 85 Degrees
F2 Active above 90 Degrees
F3 Active above 95 Degrees
F4 Active above 98 Degrees
is the same as
F1 Active above 79 Degrees <= not literal; next_timer_down will not be running when losp is 79
F1.5 Active above 84 Degrees <= requires special handling
F2 Active above 90 Degrees
F3 Active above 95 Degrees
F4 Active above 98 Degrees <= requires special handling
 
Last edited:
@Iandayen do you mean the sequence can go from F1 - F4 within 15 minutes if temperature is above 100 Deg, but when temp drops to below 85 Deg it will take 45 minutes to return to F1 ?
 
never mind, I think SQO only goes in one direction.
SQO has one flaw when paired with SQI, there must be a false to true transition of the input pattern before it will advance. It also needs to be very well thought out and designed and documented to be most effective. I have come across SQO applications that have had logic strapped onto them inappropriately turning them into a troubleshooting nightmare.

If a sequence has a lot of steps and typically they go in order, then it can be a good programming technique however I prefer to use MEQ MVM pair so I can advance without the required transition and have external control over the step number which is integrated into the SQI/SQO instruction. In sequences with complex input patterns required for each step, the bit sequencer style can create diagnostics which can make visualization and alarms very nice.

For this application, I would probably use state logic where you can step forward and backward with logic that is easier to follow on screen. There are not very many conditions and not very many states.

I would name the patterns P1 through P4 so they don't get confused with the actual fan numbers, and then map the patterns to the actual fans separately from the state engine.
 


The false-to-true transition to trigger the next pattern is not a showstopper here, the lack of bi-directional capability is, though. maybe we can write directly to .position?


I prefer to use MEQ MVM...


Yeah, MVM can be made into a bi-directional SQO, it's four main rungs and maybe some initialization beyond that.


I am not sure if OP wants to spend 15minutes at each Fn, or if they need to ever jump more than combination at at a time.
 
The false-to-true transition to trigger the next pattern is not a showstopper here, the lack of bi-directional capability is, though. maybe we can write directly to .position?





Yeah, MVM can be made into a bi-directional SQO, it's four main rungs and maybe some initialization beyond that.


I am not sure if OP wants to spend 15minutes at each Fn, or if they need to ever jump more than combination at at a time.

A full blown bit sequencer with input mapping and diagnostics is severe overkill for this job.

I have designed some sequencers with a column for "skip this step" so that I can have, for example, 50 total steps and only use a some of them depending on product assembly selections by toggling the correct bits in that column.

I have done a sequencer where I had a parallel array of integers for a "minimum time in step" and another array for a "max time in step", the latter would generate a fault and halt the process if the preset was greater than zero and the sequence failed to advance. So you can get pretty fancy with bit sequencers.

Here's a fairly plain example where I think I included the step skipping JMP piece. I haven't looked at this in many years. I probably should so I could assess whether I am getting better at this or on the downhill slide.

https://forums.mrplc.com/index.php?/files/file/854-generic-sequencer/
 
Last edited:

Similar Topics

Hi All. I have a very specific question about tracking using an encoder and bitshift register. We would like to use a Compact or Control Logix PLC...
Replies
40
Views
1,601
Hello. I've been using the answers in this forum for a while now, so thank you. Usually I can find the answer I'm looking for with a basic...
Replies
8
Views
733
Hi, I need some help write a PLC instruction. I am using Proficy Machine Edition 6.5. Our indexing rotating table has 3 nests that are equally...
Replies
15
Views
3,893
Good morning (EST), I am trying to implement the code below in on an S7-1200. It's barely half a dozen instructions, but I am stuck; I have not...
Replies
26
Views
5,535
I am having trouble figuring out how to track a product using a BSL instruction. The way that I have it set up is: I have an infeed eye that...
Replies
10
Views
2,707
Back
Top Bottom