Corona Virus Self Isolation Puzzle

Slightly cleaner*, functionally equivalent ST code attached** as btcfb1002.txt.

I'm not saying anything is wrong with the code as is, but I am offering a slightly different approach.


* "Cleaner" is of course a subjective term: the use of the bFound variable causes extra unnecessary evaluations (WHILE/IF and NOT), IMNSHO; then again, the code may be easier for some folks to follow with bFound.


** Along with cvpuzzle.zip of Python-based package that suggests equivalency of the approach: cf. test_cvpuzzle.py; two million pairs of evaluations with random values for [x] produced the same result within each pair.
 
Moved stuff to Github.


cvpuzzle.png
 
Last edited:
* "Cleaner" is of course a subjective term: the use of the bFound variable causes extra unnecessary evaluations (WHILE/IF and NOT), IMNSHO; then again, the code may be easier for some folks to follow with bFound.


My original implementation was spread over many cycles of the plc as the scan time was exceeded when using very large numbers for N so I introduced bFound to indicate when the algorithm had completed.
 
My original implementation was spread over many cycles of the plc as the scan time was exceeded when using very large numbers for N so I introduced bFound to indicate when the algorithm had completed.


Of course, heh try giving it (x,N)=(1e-4,1e4); so bFound was necessary then.

(unless max allowed scan time is increased outrageously;))


It is an interesting algorithm; did tha come up with it th'self or did tha find it?
 
Last edited:
I found something similar and adapted it for Siemens SCL,



Search for
Minkowski's question-mark function
 

Similar Topics

Here's another puzzle to take your mind off the current situation. Attached is some structured text that flashes the variable 'Flash'. A small...
Replies
2
Views
2,265
No, not literally damage to equipment. lol What kind of impact do you think the virus and panic will cause on manufacturing and Automation...
Replies
11
Views
4,775
Anyone doing out of country trips right now? My company just took a job that will be in Mexico. I'm not exactly thrilled about traveling there...
Replies
38
Views
11,617
It's about: The generation that gave us everything we have: our parents and grandparent. When they are in a retirementhome they stay in...
Replies
1
Views
1,974
I am hopeful that some one may be able to help with this application. I have an automated dial table which uses 2 Corona generators to treat...
Replies
9
Views
3,929
Back
Top Bottom