Skip to content

UDT Handling #14

@isaac-trunorth

Description

@isaac-trunorth

UDT handling is not designed to work in the generic case. The second code snippet below shows attempting to parse based on common members, which look to be too specific to a single use-case or production environment. I would recommend reading through Logix Data Access and reformatting the UDT to be in a new format. I'm trying to make something work locally, and if I get it somewhere that makes sense I'll open a PR. But my approach is going to look something like the first code snippet. Note - in order to write a UDT, you typically need to read it first to get the symbol_id. It's technically possible to calculate that, but much safer to just enforce a read of the UDT before writing to it.

struct PlcValue {
    ....
    Udt(UdtData);
}

struct UdtData {
    pub symbol_id: i32,
    pub data: Vec<u8>,
}
Non-generic UDT parsing:
        // Common UDT member names to try
        let common_members = vec![
            "oFuse_Pass_Status",
            "oMachine_Running",
            "oFuse_Resistance",
            "oProduction_Rate",
            "oFuse_Serial_Number",
            "oCurrent_Shift",
            "iStart_Production",
            "iStop_Production",
            "iTarget_Production",
            "iQuality_Threshold",
            "oFuse_Weight1",
            "oFuse_Weight2",
            "oFuseSandFillTime",
            "oFusePartStatus",
            "oFuseLastStationDone",
        ];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions