Open-Mobile-Robotics / open-process-library

Open Process Library
MIT License
19 stars 2 forks source link

Make specifications for the valve object #2

Open aott33 opened 6 months ago

aott33 commented 6 months ago
Flowject commented 6 months ago

I'd start with a 2 state valve and keep analog for a next module/object. And at that stage split up general CM functionality that applies to all.

russwaddell commented 6 months ago

Specifications, parameters, and data item definitions need to reference an existing standard (or alternatively a real valve that was built to a standard). There are lots of standards for valves and none of them are open access as far as I can tell, so the primary concern here is not to invent a new, one-off definition or data model for a valve.

Could also use an off the shelf valve model from a scada vendor or spec sheet from a valve manufacturer. For example Siemens linked at https://github.com/Open-Mobile-Robotics/open-process-library/issues/7#issuecomment-2129695260

zantiu commented 6 months ago

That 'Siemens' library is the DMC one. It's indeed probably the right starting point since it's the only open library available.

zantiu commented 6 months ago

The definition of the inputs, outputs and UDTs will come back a couple of times (specs, code, documentation, ...). Would it make sense to define this part in a machine-readable format? (csv, json, ...) So then we only need to manage one source, and everything else gets updated automatically.

You can also see in the DMC docs that this is a big part of the content.

aott33 commented 6 months ago

I agree that we should define the valve information in a central location in machine-readable format and be accessible for the specs, code, and docs. I am good with using json but let's see what others think?

@zantiu, should we start drafting up the spec using json for now and can change if needed?

russwaddell commented 6 months ago

+1 to start with JSON

zantiu commented 6 months ago

Ok let's use json

zantiu commented 6 months ago

... or yaml?

I took the example from @durinwinter: https://github.com/Open-Mobile-Robotics/open-process-library/blob/ontology/ontology/extend_ontology.md

And applied it to the DMC valve:

namespace: process_automation
entities:
  - name: TwoStateSolenoidValve
    description: "A function block for controlling a two-state solenoid valve."
    fields:
      - name: tInTimeout
        type: time
        description: "The amount of time before an error condition triggers an error."
      - name: iInMode
        type: int
        description: "Device mode input."
      - name: bInOpen
        type: bool
        description: "Open input."
      - name: bInClose
        type: bool
        description: "Close input."
      - name: bInReset
        type: bool
        description: "Reset input."
      - name: hwInAddress
        type: hardware_address
        description: "Hardware address input."
      - name: bInSimulate
        type: bool
        description: "Enables software simulation of device."
      - name: udtHMI_ValveControl
        type: udtHMI_ValveControl
        description: "HMI control parameters."
      - name: bOutOpen
        type: bool
        description: "Output indicating valve is open."
      - name: bOutClose
        type: bool
        description: "Output indicating valve is closed."
      - name: bOutError
        type: bool
        description: "Output indicating an error condition in the valve."
      - name: udtError_Valve
        type: udtError_Valve
        description: "Error UDT with one bit for every type of error."

Error UDT:

namespace: process_automation
entities:
  - name: udtError_Valve
    description: "User Defined Type for valve error states."
    fields:
      - name: ValveStuckOpen
        type: bool
        description: "Valve is stuck open."
      - name: ValveStuckClosed
        type: bool
        description: "Valve is stuck closed."
      - name: NoFeedbackSignal
        type: bool
        description: "No feedback signal from valve."
      - name: GeneralFault
        type: bool
        description: "General fault in valve."
      - name: HardwareFailure
        type: bool
        description: "Hardware failure detected."

HMI UDT:

namespace: process_automation
entities:
  - name: udtHMI_ValveControl
    description: "User Defined Type for HMI control of valve."
    fields:
      - name: iMode
        type: int
        description: "Current mode of the valve."
      - name: iErrorCode
        type: int
        description: "Error code for the valve."
      - name: bOpenCommand
        type: bool
        description: "Command to open the valve from HMI."
      - name: bCloseCommand
        type: bool
        description: "Command to close the valve from HMI."
      - name: bResetCommand
        type: bool
        description: "Command to reset the valve from HMI."
      - name: bFeedbackOpen
        type: bool
        description: "Feedback indicating valve is open."
      - name: bFeedbackClosed
        type: bool
        description: "Feedback indicating valve is closed."
      - name: bError
        type: bool
        description: "Overall error state of the valve."

How about this approach?