Hi Andy,
Once upon a time in a previous lifetime (a clue -- the processor was an
Intel 8080) I developed a general purpose process control system that had
such a block. It had N ports which could be used as inputs or outputs or
both. It had a set of formula lines that each looked something like this:
Y = 3.0 * X^2 + 2 * X + 1
B = (2 + 3.5)/(6.6)
C = sin(a/2.0)
I forget now which math functions we handled (if we handled them at all). I
did handle + - / * (I'm not sure about ^). And we used appropriate
precedence and accepted parentheses.
There was a second type of block that was strictly logic functions. And,
Or, Xor, invert. ( & | ^ ~).
The system as a whole did pretty much what HAL does, but in a somewhat
different way.
- There were four different processes running at different rates with
the fastest one the highest priority
- All variables were in a symbol table. I believe that they could have
names, but I think the formulas referred to them by A-Z or by number (I
forget which).
- Any block could read or write any entry. The last written value
remained until it was overwritten.
- In addition to the logic and arithmetic blocks, there were digital
input, digital output, analog input, and analog output blocks. There were
also PID, Lead/Lag, and a few other special purpose blocks.
It would be reasonably straight forward to implement such a thing for HAL.
- I would probably build it so that it could have mixed logic and
arithmetic formulas (use C operator symbols and precedence).
- Should C ternary operator be included?
- Offhand, I don't know the best way to supply the formulas.
- It's not clear to me how to best represent the pins in the formulas.
- Short names make for cleaner formulas, but are not self commenting.
- Perhaps in addition to the formulas have a table providing the
mapping of formula names to pin names
- Would this have to run in the kernel? If so, would we have access to
math functions (sin, cos, log, ...)? Do we need or want them?
Just some thoughts.
Ken
Kenneth Lerman
55 Main Street
Newtown, CT 06470
On Sun, May 13, 2018 at 5:33 PM, andy pugh <[email protected]> wrote:
> On 13 May 2018 at 19:43, Gene Heskett <[email protected]> wrote:
>
> > But I've forgotten how to get the reciprocal out of a mult2!
>
> You need to use the "invert" function to get a reciprocal.
>
> I keep considering making an arbitrary-maths function.
>
> --
> atp
> "A motorcycle is a bicycle with a pandemonium attachment and is
> designed for the especial use of mechanical geniuses, daredevils and
> lunatics."
> — George Fitch, Atlanta Constitution Newspaper, 1916
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers