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

Returning an array from generic_message #309

Open
MULLERGuilherme opened this issue Dec 22, 2023 · 1 comment
Open

Returning an array from generic_message #309

MULLERGuilherme opened this issue Dec 22, 2023 · 1 comment
Labels
question Further information is requested

Comments

@MULLERGuilherme
Copy link

Hi, I am using this Library in order to read an write data to a ConveyLinx device, I can successfully read and write data while using the class b'\x64' (program_name) using the "physical" parameters from the device, however, i would like to access the "virtual" parameters from it by using assemblies. However, due to my inexperience with the protocol, I am struggling to do it.

Following the device documentation (https://www.manula.com/manuals/pulseroller/conveylinx-ersc/2/en/topic/reading-ersc-input-assembly-with-msg-instruction), i changed the class to b'\x64' (assembly), and used the instance 105 (Assem105 in the EDS file) and used the attributes 3 and 4 (according to documentation), though i didn't figure why these attributes are the only ones supported. The device documentation shows the Assem105 being stored in an array, however, i am not sure how can i get this array here. Am i doing something wrong? Did i misunderstood something?

Assembly example from EDS file:

[Assembly]
        Object_Name = "Assembly Object";
        Object_Class_Code = 0x04;
        Assem105 =
                "ZPA to PLC",
                "20 04 24 69 30 03",
                ,
                0x0000,
                ,,
                16,Param116,
                16,Param196,
                16,Param106,
                16,Param107,
                16,Param186,
                16,Param187,
                32,Param88,
                32,Param119,
                32,Param199,
                16,Param105,
                16,Param185,
                32,Param201,
                32,Param121,
                16,Param35,
                16,Param514,
                16,Param19;

How i called my read_parameter function:

def read_parameter(device_ip, service, class_code, instance, attribute):

    with CIPDriver(device_ip) as drive:
        param = drive.generic_message(
            service=service,
            class_code=class_code,
            instance=instance,
            attribute=attribute,
            data_type=INT,
            connected=True,
            name='read_param'
        )
        print(param)
        return param.value
        
read_parameter("192.168.202.39", b'\x0e', b'\x04', 105, 3)

Output from the print function inside read_parameter:

read_param, 0, INT, None

Thanks in advance

@MULLERGuilherme MULLERGuilherme added the question Further information is requested label Dec 22, 2023
@Colt-H
Copy link
Contributor

Colt-H commented May 1, 2024

I believe your data type needs to be set to an array. See below:

        param = drive.generic_message(
            service=service,
            class_code=class_code,
            instance=instance,
            attribute=attribute,
            data_type=INT[10], #change 10 to the size of the array you're reading
            connected=True,
            name='read_param'```

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

No branches or pull requests

2 participants