Abdolkarim,
I definitely owe you a beer. This is a massive, help in particular the attached example.
In this example the Server calls the function and returns the result to the attribute (attribute1 in this example).
If I wanted to create a function that operates independent of a single entity how might I do that?
A specific example might be sending a control signal to an output or output switch that depends on the amouint of WIP in the servers ? I'd like to call a function from the switch but that doesn't seem to be an option - requiring instead a control signal. Maybe introduce a [logic] buffer upstream and call from that?
Below I've modified your function to allow for a max number in the painting cycle (seal_cycle_max), checked to see if it's grerater that max and want to create a control signal that switches products upstream. However I'm unclear how to get the control_signal from the Matlab block to the Input Switch. There seem to be to "out" blocks both in the image and am unsure if I use one of these (what's the difference?)or something else.
function seal_control_signal = MyFunction (WIP_Server1, WIP_Server2, seal_cycle_max)
WIP = WIP_Server1 + WIP_Server2;
if mystatistic >= seal_cycle_max
control_signal=2,
else
control_signal=1
end
seal_control_signal=control_signal;
Many thanks. Once I get going I won't be such a nuisance!
Paul