MATLAB: Customized N server.

n server preemptionsimeventsimulink

Am not sure how to get started on writing a matlab function for a custom N server. The simevent N server service control does not work for me in that when a preemption signal is received, it disables all servers, what i want is to be able cycle through clients being served and preempt the lower priority users in the system. what i need help with is a function that stores an entity for a period of time depending on its service time. once that time is up, the entity exits the block.

Best Answer

If you are using the new SimEvents in R2016a, the best approach to preempting N-Server differently for entities is probably to use MATLAB Discrete-Event System to write a custom block. To get started quickly, you can drag a “Selection Queue” block from the “Design Patterns” in the SimEvents library. Then you can make changes to the source MATLAB code of the MATLAB Discrete-Event System block in a copy and link it to the block. In that model, the anonymous entities into “call” input port select the “passenger entities” that previously entered “IN” input port with matching index to depart. This actually realizes a preemption tactic. You can change the preemption algorithm to make it fit your use case.
You can also find this “Selection Server” and other examples of custom blocks in http://www.mathworks.com/help/simevents/examples.html