 OMRON Forums

# Random signal generator

## Recommended Posts

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

• Replies 2
• Created

#### Popular Days

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.
##### Share on other sites

Dear Serkan,

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)-1
• P905_Random_Multiplier = 16807
• P906_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

##### Share on other sites This topic is now closed to further replies.

×
• Forums

• Events
• #### Browse

×
• Create New...