News:

  • June 30, 2026, 04:15:50 AM

Login with username, password and session length

Author Topic: Miscellaneous Do-More Questions  (Read 55332 times)

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Miscellaneous Do-More Questions
« on: February 05, 2015, 12:42:48 PM »
1) I assume MEMCLEAR/COPY is significantly more efficient than MOVE when applicable?

2) Is there a way to reorder user data blocks in the list if they'll be accessed with REFx functions?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Miscellaneous Do-More Questions
« Reply #1 on: February 05, 2015, 12:44:44 PM »
1) I assume MEMCLEAR/COPY is significantly more efficient than MOVE when applicable?

Yes.

2) Is there a way to reorder user data blocks in the list if they'll be accessed with REFx functions?

No.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Miscellaneous Do-More Questions
« Reply #2 on: February 05, 2015, 12:52:46 PM »
Need them 2D arrays then.  Can't store the memory block numbers in an array and nest the array refs I don't think.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Miscellaneous Do-More Questions
« Reply #3 on: February 05, 2015, 12:57:45 PM »
The array reference can be a full expression in MATH. Is that not enough?
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3833
    • Host Engineering
Re: Miscellaneous Do-More Questions
« Reply #4 on: February 05, 2015, 02:00:33 PM »
Need them 2D arrays then.  Can't store the memory block numbers in an array and nest the array refs I don't think.
Not really 2D arrays, you just need a slightly smarter calculation for the extra level of indirection utilized by your REF/REFWRITE instructions.

Say you were using D100 as your "Reference Type" value (aka Block #) in your REFWRITE/REF instructions.

You were probably doing something like a FOR loop for your D100 value, hoping you had a "contiguous" range of block #'s.

Say you had 5 blocks 40..44 nice and neat for your D100 values
FOR D100 40 to 44
// use D100 in REF/REFWRITE instructions
NEXT

But now you need 10 ADDITIONAL blocks, but those are now 50..59.

All you need to do now is store these block #'s in a range of V, or even better, a new block called MyRefType.

Define MyRefType to be 15 words long (for the 15 now non-contiguous block #'s 40..44, and 50..59).
Initialize that to
MyRefType0 = 40
MyRefType1 = 41
...
MyRefType4 = 44  // last of 1st contiguous block
MyRefType5 = 50  // first of next contiguous block
MyRefType6 = 51
...
MyRefType14 = 59

So each MyRefType ID now stores the unique block # value.

Now your FOR loop iterates through the simple 0..14 indexes of MyRefType:

FOR V0 0 TO 14
  MOVE MyRefType[V0] D100  // D100 now contains the V0th block # in your "non-contiguous" set of blocks!
  // use D100 just like you did before in your REFWRITE/REF instructions!
NEXT

Sure, it's a little extra overhead compared to what you were probably doing, but it's just as powerful!

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Miscellaneous Do-More Questions
« Reply #5 on: February 05, 2015, 02:56:54 PM »
I know -- I was just hoping to do MyBigArray[BlockList[V101]]

I'm lazy plus I like it clean.  Whatever, it works.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Miscellaneous Do-More Questions
« Reply #6 on: February 05, 2015, 04:07:55 PM »
I know -- I was just hoping to do MyBigArray[BlockList[V101]]

I'm lazy plus I like it clean.  Whatever, it works.

I'm confused. That's legal.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Miscellaneous Do-More Questions
« Reply #7 on: February 05, 2015, 04:28:32 PM »
I guess I should have tried it.   I thought nesting array refs was taboo.

Part of the issue is that I haven't used REFx very much so I don't know when I'm pushing the envelope.

Now is that nomenclature valid for assignment as well as use in an expression?  That would be part of the task.
« Last Edit: February 05, 2015, 04:42:27 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Miscellaneous Do-More Questions
« Reply #8 on: February 05, 2015, 05:38:29 PM »
Now is that nomenclature valid for assignment as well as use in an expression?  That would be part of the task.

No, sorry. Only as part of the expression itself, so it would require a two-part computation.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Miscellaneous Do-More Questions
« Reply #9 on: February 06, 2015, 04:11:10 PM »
I guess if you were really intent on reordering the user data blocks, and if you had a reasonable number, say 20 or so, you could start a new empty program, recreate all the blocks in the order you want them, then cut and paste the logic from the program with the blocks in the undesirable order into the new one.  A lot of effort, but it's something you'd hardly ever do.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Miscellaneous Do-More Questions
« Reply #10 on: February 09, 2015, 07:26:52 AM »
I really despise that extra MATH instruction to get the deeper nesting for indexes. I know we had an older thread about it in the past... What was the issue that makes the deeper nesting 'non-doable'?

I guess one thing I don't like about the extra step, is the readability/documentation. I have not figured out how to use meaningful names for the large number of indexes that I use in my programs using only 15 characters. Especially when many of my indexes require two v-mem's per index because of nesting. One thing that would help, is instruction level comments. Or maybe even a new instruction that would allow deeper nesting for inputs and outputs (a supercharged MATH box!).
What would the chances be of adding a new instruction that would allow expressions in the Destination field of 'MATHREF'?
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Miscellaneous Do-More Questions
« Reply #11 on: February 09, 2015, 09:54:33 AM »
I really despise that extra MATH instruction to get the deeper nesting for indexes. I know we had an older thread about it in the past... What was the issue that makes the deeper nesting 'non-doable'?

Everything is do-able, the question is ROI. I have spent a bit of time thinking about this though, and I know how to do it pretty easily in the PLC. Whether I can talk Franj into the the Designer side work remains to be seen.

I have not figured out how to use meaningful names for the large number of indexes that I use in my programs using only 15 characters.

An unfortunate decision on our part to stick with 16 character nicknames. That decision was made early in the development, when we thought it was going to be a quick-n-dirty effort. We are planning to increase that in a future rev, maybe 2.0.

Or maybe even a new instruction that would allow deeper nesting for inputs and outputs (a supercharged MATH box!). What would the chances be of adding a new instruction that would allow expressions in the Destination field of 'MATHREF'?

Right side of the equal should be effectively unlimited now, at least in MATH. I'm pretty sure we could do an expression in a simple output reference. Meaning "D[V0 + V1*10 + V2*100] = Expression" would be legal.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Miscellaneous Do-More Questions
« Reply #12 on: February 09, 2015, 10:14:44 AM »
So would the enhanced ability on assignment include array references in the expressions?  Even array-less expressions would be very powerful and address many of the cases.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Miscellaneous Do-More Questions
« Reply #13 on: February 09, 2015, 10:20:10 AM »
Everything is do-able, the question is ROI. I have spent a bit of time thinking about this though, and I know how to do it pretty easily in the PLC. Whether I can talk Franj into the the Designer side work remains to be seen.

If you can, Do-More would be industry-leading in this respect.  This (lack of nested array refs) has been a thorn in my side with Control Logix since the inception.  Such a cool vision, and then they leave out critical parts.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Miscellaneous Do-More Questions
« Reply #14 on: February 09, 2015, 11:28:19 AM »
So would the enhanced ability on assignment include array references in the expressions?  Even array-less expressions would be very powerful and address many of the cases.

Like this: "D[D[V0] + D[V1]] = Expression"? Yes.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO