drbitboy
Lifetime Supporting Member
Howdy,
Summary
Rank beginner here. I don't have anything more than [RSLogix Micro Starter Lite], so I am using that for it's editing environment.
I am fiddling with writing a random number generator (RNG).
If you have some spare time, please look over the attached file; as noted below I am primarily interested in critique of style and implementation, but all comments are of course welcome.
Thank you.
Details
I did look at past PLC RNG posts (the clock thing is WAY cool), but chose to re-invent the wheel anyway, with an eye toward developing some actual PLC skills; mine are similar to what my father said at an interview almost seven decades ago when asked what he knew about the Mollier diagram: "I can spell it," to which the interviewer said "Well, that's better than some of my engineers."
The context is that I am helping my brother, who has a lot of experience with PLCs in industry; I'm quick with the math side so sometimes I bug him enough that he asks me to help out. We didn't talk much about why he wanted an RNG, but I think he is doing some demos or training and wants to add noise to a model being controlled by a PID.
I am not tied to the LCG/Box-Muller framework so feel free to make other suggestions along those lines, but what I am far more interested in is critique of my implementation, style, how many instructions are on each rung, etc. I'd like to be able to help out more than putting equations on a page that my brother has to translate into ladder logic, AOIs, etc.
See the caveats in the comments over the second rung:
P.S. At https://github.com/drbitboy/plc_rng/tree/master/zz_miscellany there are some .L5X files where we did some work in something (Studio 5k, maybe?) better than [* Starter Lite] while my brother was visiting for the holidays: the LCG/RNG is in an AOI, but we never really got to the gaussian distribution.
View attachment 52974
Summary
Rank beginner here. I don't have anything more than [RSLogix Micro Starter Lite], so I am using that for it's editing environment.
I am fiddling with writing a random number generator (RNG).
If you have some spare time, please look over the attached file; as noted below I am primarily interested in critique of style and implementation, but all comments are of course welcome.
Thank you.
Details
I did look at past PLC RNG posts (the clock thing is WAY cool), but chose to re-invent the wheel anyway, with an eye toward developing some actual PLC skills; mine are similar to what my father said at an interview almost seven decades ago when asked what he knew about the Mollier diagram: "I can spell it," to which the interviewer said "Well, that's better than some of my engineers."
The context is that I am helping my brother, who has a lot of experience with PLCs in industry; I'm quick with the math side so sometimes I bug him enough that he asks me to help out. We didn't talk much about why he wanted an RNG, but I think he is doing some demos or training and wants to add noise to a model being controlled by a PID.
I am not tied to the LCG/Box-Muller framework so feel free to make other suggestions along those lines, but what I am far more interested in is critique of my implementation, style, how many instructions are on each rung, etc. I'd like to be able to help out more than putting equations on a page that my brother has to translate into ladder logic, AOIs, etc.
See the caveats in the comments over the second rung:
- I have not yet grokked the addressing yet,
- nor how persistent non-device data ("variables?") are stored.
- As you can probably gather, I am far more comfortable in C/C++/Python/Fortran/Node.js/etc., and some of that baggage will certainly be polluting my approach.
P.S. At https://github.com/drbitboy/plc_rng/tree/master/zz_miscellany there are some .L5X files where we did some work in something (Studio 5k, maybe?) better than [* Starter Lite] while my brother was visiting for the holidays: the LCG/RNG is in an AOI, but we never really got to the gaussian distribution.
View attachment 52974