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;