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

Discussion in 'Programmer's Corner' started by strantor, May 11, 2011.

  1. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    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?
    Code ( (Unknown Language)):
    2. ST_MW_sentinel_speed := ABS(ST_MW_act_speed * 400.0 / 16384.0); //Absolute value of rotor speed
    3. ST_MW_speed_to_frequ := ST_MW_sentinel_speed / 60;    //f = n/60
    4. ST_MW_frequ_to_time := 100/ST_MW_speed_to_frequ;             //T[10ms] = 100/f
    5. If ST_MW_sentinel_speed > 50 and Visu_ROTOR.set_sentinel_on then
    6.   ST_MW_sentinel_counter := ST_MW_sentinel_counter + 1;
    7.   OSRI_sentinel.InputBit := ST_I_rotor_pulse;    // CRS - ST_I_rotor_pulse comes from shaft encoder (I assume)
    8.   OSRI(OSRI_sentinel);
    9.   OSFI_sentinel.InputBit := ST_I_rotor_pulse;
    10.   OSFI(OSFI_sentinel);
    11.   If OSRI_sentinel.OutputBit or OSFI_sentinel.OutputBit then
    12.     ST_MW_sentinel_last := ST_MW_sentinel_counter;
    14.     If ST_MW_sentinel_last > ST_MW_sentinel_big then
    15.       ST_MW_sentinel_big := ST_MW_sentinel_last;
    16.     end_if;
    17.     ST_MW_sentinel_counter := 0;
    18.   end_if;
    19.   If ST_MW_sentinel_counter > (ST_MW_frequ_to_time * 2) then
    20.     ST_F_coil_pos := 1;
    21.   else
    22.     ST_F_coil_pos := 0;
    23.   end_if;
    24. else
    25.   ST_MW_sentinel_counter := 0;
    26.   ST_MW_sentinel_big := 0;
    27.   ST_F_coil_pos := 0;
    28. end_if;
  2. GetDeviceInfo

    AAC Fanatic!

    Jun 7, 2009
    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: May 12, 2011
  3. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    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.

    Makes sense to me; I guess it would determine belt slippage or other failure if the tube were not rotating at the commanded speed.

    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.

    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.
  4. GetDeviceInfo

    AAC Fanatic!

    Jun 7, 2009
    opening up the tags property box will expose the alias's.
  5. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    Got it figured out. This IS to detect the gimbles rocking. There is a laser which shines all the way through the tube, through a hole in each gimble. that is the "pulse". If any gimble get off kilter & blocks the laser beam for a period of time > than X amount of time ( period of time dependent on the rotor speed) then the fault will be triggered.