Connecting Action Parameters to Part Port

Hello!

Is it correct to bind an action parameter to the port of a part?

What I’m trying to model is that the item, that is produced by the function of the system, flows over the system’s interface.

Here’s an example model:

action def Function {
    in input;
    out output;
}

part def System {
    port inPort;
    port outPort;
    action function : Function;

    bind inPort = function.input;
    bind outPort = function.output;
}

Thanks!

1 Like

Hello Tom,

I would not do this because then you say that Function::input and Function::output are ports. Technically, your model is not incorrect (I chose this wording on purpose) only because you didn’t specify the feature kind (e.g., attribute) for Function::input and Function::output, so they could be ports.

I think you would probably want to put in/out items on the port and bind them to the action parameters. This works because you basically say that whatever appears as a parameter value must also be present at the port feature.

However, this will only work as long as only one action communicates via the port this way. If you have more than one, there are two options to consider.

  1. Using send/accept (if the items represent discrete things)
  2. Referencing rather than binding:
action def Function {
    in input;
    out output;
}

part def System {
    port inPort { in input; }
    port outPort { out output; }
    action function : Function {
        // In this context, the action parameters refer to the port features.
        // You could use "subsets" as well (the meaning is the same), but this is 
        // actually a reference kind of subsetting, and we have a keyword for that.
        in redefines input references inPort.input;
        out redefines output references outPort.output;
    }
}

Let me know if you need more help.

Best regards,
Vince