Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing UTD #22

Open
Akhil4703 opened this issue Jan 19, 2021 · 3 comments
Open

Accessing UTD #22

Akhil4703 opened this issue Jan 19, 2021 · 3 comments

Comments

@Akhil4703
Copy link

image

I have the following UDT. Is there way I can access the week[0].day[0] and so on... to read and write to it.
I have tried using the following tag but gives me out of bounds error.
("IPAddress", "1, 0", CpuType.LGX, "Week[0].Day", DataType.Float32, 100);
var TstTag1 = client.GetFloat32Value(tag, (elementnumber * tag.ElementSize));

Akhil.

@GitHubDragonFly
Copy link

You seem to be requesting 100 elements from an array which has 78 elements.
If you lower the number of elements to 78 or below then test it with either "Week[0].Day" or "Week[0].Day[0]".

You should definitely check the AdvancedHMI forum website which has lots of highly functional software, including a tag browser program (free registration is required to access it). See this message:

https://www.advancedhmi.com/forum/index.php?topic=2670.msg16843#msg16843

It is currently in the form of a standalone Windows package which should provide a little bit more UDT related info.

@bfurlani
Copy link

bfurlani commented May 3, 2021

You should use something like the following
` private Tag<RealPlcMapper, float> generateRealTag(string tagName, string tagData)
{

        var tag = new Tag<RealPlcMapper, float>()
        {
            Name = $"{tagName}.{tagData}",
            Gateway = IPAddress,
            Path = $"1,{Path}",
            PlcType = PlcType.ControlLogix,
            Protocol = Protocol.ab_eip,
            Timeout = TimeSpan.FromSeconds(3)
        };
        return tag;
    }`

@bfurlani
Copy link

bfurlani commented May 3, 2021

You should pass in generateRealTag("Week[0]","Day[0]"); Mind you this is a method I made, but It is how I create specific data typed tags. I have one for each of the data types and I use a dynamic to use them. to do data that has more than one such as you Week[0].Day example I would just do a while and if it fails do a Thread.Sleep(1) and do another try (sometimes there may be a timeout ) then try again. it it fails you will know its at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants