In the mean time, until I get time to fix CC,
I am reworking the ELEC menu because matrix operations are getting to a stable state.
For those not electrically inclined, well, skip by all means ...
I had 2 x symmetrical component programs in this menu. And some programs to manually calculate three phase Ohm's law. Now, since matrix methods are working, I am reworking these to use matrixes.
To make it useful, I needed a way to easily populate a 3x1 matrix for the V-vector. That does not exist, and I do not want to use I & J and STOEL etc. all the time for routine stuff. So a command [zyx>M] was created. I must still do the same for [M>zyx] - not done yet.
So now it is easier for me to create a vector from prior results: if 1, 2, 3 are on the stack, [zyx>M] results in [1;2;3]^T.
*[zyx>M] actually is interesting, as I created the zyx>M using internal XEQM code. That means I did not program that in C but in RPN. Internally I just wrote a text string with the RPN code, and we send that to the XEQM parser which executes it as a sequence of keystrokes. Not really rocket science since HP did that since the 70's, but until now, I would have had to write that in C43 in a C routine. For those interested, the code is below and is pretty recognizable. Not very efficient as it stores and parses text, so when Martin's proper programming comes along, this will be re-evaluated.
Code: Select all
//Create a 3x1 matrix from Z Y X
strcpy(line1,"XEQC43 ERPN 3 ENTER 1 M.NEW STO 99 DROP INDEX 99 3 ENTER 1 STOIJ DROP DROP STOEL DROP I- STOEL DROP I- STOEL DROP RCL 99 ");
fnXEQMexecute(line1);
When we use symmetrical components, the A matrix is fixed, so in addition to the a, and a² constants which I already had, there is now A, which is the standard complex 3x3 A matrix (for the component sequence 0,1,2).
- Clipboard06.jpg (17.84 KiB) Viewed 3605 times
Note, it looks best when you switch on [a b/c].
** [A] was also done this XEQM way to prevent me from running these keystrokes manually for an A matrix every time:
//Create a 3x3 A-matrix
... "XEQC43 ERPN RECT 3 ENTER 3 M.NEW STO 99 DROP INDEX 99 1 ENTER 1 STOIJ DROP DROP 1 STOEL J+ STOEL J+ STOEL J+ STOEL DROP 0.5 ENTER CHS 3 ENTER SQRT 2 / CHS COMPLEX J+ STOEL COMPLEX CHS COMPLEX J+ STOEL 1 J+ STOEL DROP J+ STOEL X^2 J+ STOEL DROP"