Jump to content
OMRON Forums

Random signal generator


meindert.norg

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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)-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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...