Integer swapping

MaxGauss

Member
Join Date
Mar 2013
Location
Spring Hill, Florida
Posts
10
Gentlemen: Good Afternoon.
Because of you gentlemen, I have my PID's running very nicely. Now I need switch the cv of PD9-1 with the cv of PD9-2. Right now my cv is my analog output addresses. O:0.0 and O:0.1. I am using RSLOGIX Micro Developer, and my analog out is a 1762-Of4. Is there some clean way to switch them.. I have a lot of hours trying to use the SWP, but I just can not seem to work it out.
I want to thank you again for your PID support. I was seven hours in a steel building freezing to death, trying to work that out. I threw two emails to you, and in those two, you got me out of the box. there are no words that I know that could Properly convey to you the magnitude of the APPRECIATION I have for you and you gracious help.
Sincerely,
john little
 
Write your CV to an N address instead. Then use a MOV instruction to move the value in the N address where ever you want it.
 
If you only have a few occurances of O:0.0 and O:0.1, then do a Search and Replace within the programming software:

(1) First do a "Search, Replace" for "O:0.0". Each time an instruction is found that uses O:0.0, replace it temporarily with some unused spare address. Also have the program move any symbols and descriptions to the new address.

(2) Next do the same "Search, Replace" for "O:0.1", but this time replace it with the now-unused-and-free O:0.0.

(3) Finally, do one more "Search, Replace" for the temporary spare address (used in Step 1), this time replacing it with O:0.1.
 
Last edited:
Is this something you want to do on the fly, depending on process conditions? Then be able to go back and forth?

If not then what ever you are doing to move PD9-1's output to O:0.0 move it to O:0.1,
what am I missing here?

Post you .rss file ( zip it first) someone can give you better help that way, after you answer the above questions.
 
Is this something you want to do on the fly, depending on process conditions? Then be able to go back and forth?
I AssUMe that it is a one-time address move or swap, a straight one for the other.
Now I need to switch the Control Variable (O:0.0) of PD9-1 with the Control Variable (O:0.1) of PD9-2.
Make sure that the addresses O:0.0 and O:0.1 are the addresses actually used in your PD9 files.
 
I am sorry that I was not clear.
I have two pumps a lead and a lag. approximately every 12 hours I will lead to lag, and 12 hours later, I will change lead to lag again. This is to keep the physical wear of the two pumps the same.
I not sure I know how to get an ??.RSS into this environment. The actual .RSS is at the job site, but i will try and insert a test .RSS, just to see how it is accomplished. Thank You Sirs:
 
Then do an Advanced Search here on this site for alternator, toggle, or lead-lag. It has been done many times and beaten back and forth until the subject is worn out! You need to set up the alternator logic so that a timer switches a bit every 12 hours. For example, Pump 1 runs, Alternator bit is OFF, 12 hours later, timer causes Alternator to go ON, and Pump 2 runs.

Once you get the alternator set up, you can use the alternator bit to swap addresses for all needed adddresses that need to shift with the Lead Pump and the Lag Pump. You can use the indirect addressing method to swap effective addresses every time your alternator logic switches from lead to lag.

This is to keep the physical wear of the two pumps the same.
Sometimes that is desirable, but it also means that both pumps will have about the same probable life span and both will wear out and quit on the same day. Is that okay with everybody?
 
Last edited:
The original variables will not be swapped, because their values are copied into the function's arguments. The function then proceeds to swap the values of those arguments, and then returns.The trouble only comes when x and y use the same storage location, in which case their values must already be equal.
 
My comments have been directed toward how to control the lead-lag function. I do not think swapping the input and control variables of a PID instruction would be a good way to go. Why do it anyway? All that needs swapping when changing the lead pump is the Outputs. If there is a "lead" PID with an Output, then simply swap the address of that output with that of the lag pump, and keep on trucking. The "lead" control switches and pressure inputs that control the "lead" pump will still be controlling the "lead" pump after the swap, just like they were before. All that needs swappping are the FUNCTIONs of lead and lag, not any physical devices or inputs.

Wait a minute, swapping the PID Outputs is exactly what Max said he is trying to do. What is the problem with that? The only thing being swapped is WHERE each PID output is going.
Now I need to switch the Control Variable (O:0.0) of PD9-1 with the Control Variable (O:0.1) of PD9-2.
 
Last edited:
You could just change the set-points of the two PID's. Raise one lower the other, by ramping them up or down. This would provide a smooth transition.
 
Lancie1.. thank you so very much. Just wanted to confirm that I would not fault my PID block.
Don't fault it by not doing anything to it. There is no need. You should only switch where the CV from each PID is sent to.

Rewire your brain not to think of Pump 1 and 2, but instead "LEAD PUMP" and "LAG PUMP". For the PIDs, PID #1 needs to feed its Output to LEAD PUMP, and PID #2 should feed its Output to LAG PUMP (regardless of which Pump Number either Lead or Lag is right now. Then your Alternator Logix does everything necessary to switch old Lag to new Lead, and old Lead to new Lag.
 
Last edited:

Similar Topics

Hi. I'm using a Modbus ProSoft where I basically map data to a big INT array. Example, where GX_I_63HPU is a REAL, MNETC.DATA.WriteData[200] an...
Replies
21
Views
428
Good morning all, I'm integerating a device with a Rockwell PLC with V34 Studio 5000. The device reports error codes using a single integer to...
Replies
19
Views
1,286
Ex If I Read from Integer file N7:0 N7:0 is an 8 point input card , input 0 and 2 are on , rest off When I look at : N7:0 -7 6 5 4 3 2 1 0 I...
Replies
5
Views
743
The analog array has 16 individual bits and each bit is an alarm. SCADA is having issues getting the BIT bool value. However they can get the...
Replies
9
Views
1,021
I set up a Mitisubishi test system on the bench. Q03UDSPU Q173DCPU MR-J3-40B HF-KP43 HMI is a LS XP50 TTA/KP43 I am trying to use a signed...
Replies
1
Views
394
Back
Top Bottom