# Can comeone help me decode this please? (RSlogix 5000 PLC code, like C or basic)

#### strantor

Joined Oct 3, 2010
6,112
Here's some baground: I have a stranding machine which is essentially a giant rotating tube, with 9 bottom-heavy gimbles inside. The gimble are "stationary" - unless you physically rock them, and the the tube spins around them. I am trying to find out how the PLC would detect a rocking gimble (or spinning gimble), which would indicate a bad bearing or other problem. I think the code below might be the key, but I don't understand how. all of the functions called here (except for ST_MW_act_speed, ST_I_rotor_pulse, and ST_F_coil_pos) are only local, used only within the code block have posted. if ST_F_coil_pos goes true, the machine will shut down. I have not been able to find any kind of sensor on the machine to detect gimble rocking and this code seems to be just functioning within itself, not looking at any data other than tube speed. how could this code detect if the gimble was rocking?
Rich (BB code):
// PENDULUM WATCHDOG
ST_MW_sentinel_speed := ABS(ST_MW_act_speed * 400.0 / 16384.0); //Absolute value of rotor speed
ST_MW_speed_to_frequ := ST_MW_sentinel_speed / 60;    //f = n/60
ST_MW_frequ_to_time := 100/ST_MW_speed_to_frequ;             //T[10ms] = 100/f
If ST_MW_sentinel_speed > 50 and Visu_ROTOR.set_sentinel_on then
ST_MW_sentinel_counter := ST_MW_sentinel_counter + 1;
OSRI_sentinel.InputBit := ST_I_rotor_pulse;    // CRS - ST_I_rotor_pulse comes from shaft encoder (I assume)
OSRI(OSRI_sentinel);
OSFI_sentinel.InputBit := ST_I_rotor_pulse;
OSFI(OSFI_sentinel);
If OSRI_sentinel.OutputBit or OSFI_sentinel.OutputBit then
ST_MW_sentinel_last := ST_MW_sentinel_counter;

If ST_MW_sentinel_last > ST_MW_sentinel_big then
ST_MW_sentinel_big := ST_MW_sentinel_last;
end_if;
ST_MW_sentinel_counter := 0;
end_if;
If ST_MW_sentinel_counter > (ST_MW_frequ_to_time * 2) then
ST_F_coil_pos := 1;
else
ST_F_coil_pos := 0;
end_if;
else
ST_MW_sentinel_counter := 0;
ST_MW_sentinel_big := 0;
ST_F_coil_pos := 0;
end_if;

#### GetDeviceInfo

Joined Jun 7, 2009
2,118
glancing through, it looks like a component of ST_MW_act_speed is being compare to ST_I_rotor_pulse. more specifically, it appears that your looking for a ST_MW_sentinel_big allowance of ST_I_rotor_pulse(s) within a calculated time frame. If you flush out your tags, it could be a difference in actual speed compared to set speed?

you've indicated the tags to be 'local'. In RS5000, tags are controller or program scoped, with either able to 'alias' to a controller tag. If you check these two tag's properties, you'll see if the're alias'd to another tag, or to a local hardware slot. If your on a network, remote devices that share tag names, and are controller scoped, will communicate the tag's values.

I'm working on a conveyor system today with Controllogix/PV1000/Powerflex so can help if your online.

Last edited:

#### strantor

Joined Oct 3, 2010
6,112
glancing through, it looks like a component of ST_MW_act_speed is being compare to ST_I_rotor_pulse.
Yes that's pretty much what I gathered also, but the 2 (ST_MW_act_speed & ST_I_rotor_pulse) are both in reference to the rotor (or giant rotating tube) so I don't see how that could be used to determine if the gimbles are rocking. I'm pretty sure I'm barking up the wrong tree here.

more specifically, it appears that your looking for a ST_MW_sentinel_big allowance of ST_I_rotor_pulse(s) within a calculated time frame. If you flush out your tags, it could be a difference in actual speed compared to set speed?
Makes sense to me; I guess it would determine belt slippage or other failure if the tube were not rotating at the commanded speed.

you've indicated the tags to be 'local'. In RS5000, tags are controller or program scoped, with either able to 'alias' to a controller tag. If you check these two tag's properties, you'll see if the're alias'd to another tag, or to a local hardware slot. If your on a network, remote devices that share tag names, and are controller scoped, will communicate the tag's values.
By local, I meant only used in that small block of code I posted. If I search through the entire program, they aren't referenced anywhere else.

I'm working on a conveyor system today with Controllogix/PV1000/Powerflex so can help if your online.
That's sure nice of you, but I'm on night shift. thanks for the help, but I think I'm done here. I was trying to figure out if that was for detecting gimbles rocking and I'm pretty confident that it's not.

#### GetDeviceInfo

Joined Jun 7, 2009
2,118
By local, I meant only used in that small block of code I posted. If I search through the entire program, they aren't referenced anywhere else.
opening up the tags property box will expose the alias's.