News:

  • November 23, 2026, 11:58:03 AM

Login with username, password and session length

Author Topic: Strings in UDT  (Read 27812 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Strings in UDT
« on: November 04, 2020, 02:20:19 PM »
Looking for input on how to perform the following:

I would like to store an ASCII string in a UDT. I can't do this directly. What are my options and/or limitations to storing a numeric representation of a string within a UDT?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3858
    • Host Engineering
Re: Strings in UDT
« Reply #1 on: November 04, 2020, 02:38:06 PM »
Better to just have a corresponding string associated with the specific UDT.

If it's a heap-item named Recipe, have a heap-item STRING called RecipeName.

If it's a block of 100 called Recipe (Recipe0-Recipe99), create a corresponding block of 100 STRINGs called RecipeName.
The two are coupled by the index value, i.e. Recipe42 and RecipeName42 correspond with each other.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #2 on: November 04, 2020, 03:52:49 PM »
What's the likelihood of string being added to the UDT in the future?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #3 on: November 04, 2020, 04:38:00 PM »
What's the likelihood of string being added to the UDT in the future?

It would require nesting of structures. That's hard for several technical reasons.

We have ideas, just not sure when we will attack it.
"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: 3858
    • Host Engineering
Re: Strings in UDT
« Reply #4 on: November 04, 2020, 04:40:17 PM »
What's the likelihood of string being added to the UDT in the future?

In the short term, no.  We would like to add it some time in the future (nesting structures, for example), but that is "long term".

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #5 on: November 04, 2020, 09:36:10 PM »
I guess something equivalent to an AB AOI isn't in the works in the short term then either?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #6 on: November 04, 2020, 11:55:08 PM »
I guess something equivalent to an AB AOI isn't in the works in the short term then either?

Actually, it might be. We're taking a hard look at adding a textual language for the next major release, and one of the goals is to add functions callable from in a MATH instruction.
« Last Edit: November 05, 2020, 07:47:05 AM by BobO »
"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

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #7 on: November 05, 2020, 07:05:25 AM »
Please do. I'd really like to use one (or the equivalent thereof) for expansion of a current project.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #8 on: November 05, 2020, 10:35:46 AM »
We've been talking about this a bit today. Maybe there is a way to get strings in UDTs. We may hit a snag we haven't identified yet, but we're gonna explore an idea we have.
"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

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #9 on: November 05, 2020, 11:38:49 AM »
<time passes>

...this can be done.
"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

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #10 on: November 05, 2020, 11:59:25 AM »
How easily and how soon?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #11 on: November 05, 2020, 12:25:48 PM »
How easily and how soon?

Not easily enough to sneak into 2.8 (next month), but barring unforeseen gotchas, I'd guess summer for the next release.

After realizing there is a solution that doesn't require nesting structures, no single thing appears to be hard, but there are many things.
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Strings in UDT
« Reply #12 on: November 05, 2020, 04:16:47 PM »
Strings in UDT's!  Yay!

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #13 on: November 06, 2020, 09:01:04 AM »
Please also look at what it would take to write to a Memory.Real location using the MRX command.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #14 on: November 06, 2020, 09:28:26 AM »
Please also look at what it would take to write to a Memory.Real location using the MRX command.

I don't understand what this means. Is it a different Modbus function code?
"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