meindert.norg Posted February 25, 2011 Posted February 25, 2011 LS, Threat http://forums.deltatau.com/showthread.php?tid=407&pid=1457 speaks of injecting a sine-signals for identification purposes. In that threat, a PLC0 is used to calculate this sine signal on the fly. Does anyone have a method to calculate and inject a random signal (noise) instead of a sine-signal? Thanks. Meindert
Omron Forums Support Posted February 26, 2011 Posted February 26, 2011 You may use a linear congruential generator algorithm (simple recursive formulas) to calculate uniformly distributed psedurandom numbers in the real time interrupt plc. Injection of this signal is exactly like a sine signal.
meindert.norg Posted March 1, 2011 Author Posted March 1, 2011 Dear Serkan, Thanks for your suggestion. I implemented the random noise generator described on http://en.wikipedia.org/wiki/Linear_congruential_generator as: P907_Random_Value = ((P905_Random_Multiplier*P907_Random_Value) + P906_Random_Increment) % P908_Random_Modulus As mentioned on the Wiki, the generator-outcome strongly depends on the values of Modulus, Multiplier and Increment. For example with Modulus = 2^32, I only found combinations for the other parameters that would make the generator repeat itself every 256 samples or faster. The "Apple CarbonLib" settings do not show any repetition within 30.000 samples (that's how much memory I had left for gathering). P908_Random_Modulus = 2^(32)-1P905_Random_Multiplier = 16807P906_Random_Increment = 0 On my system, the cost of this code is approx. 21 usec (system: 80 MHz UMAC, at 6 kHz Servo interrupt, PLC0 with random generator running every servo-interrupt (I8 = 0). Taking out P906_Random_Increment from the equation reduces this by 6 usec. regards, Meindert Norg
Recommended Posts