How can I set that only one of the subservers can be used at a time?

2 views (last 30 days)
Per server that I have there are two 'sub'-servers to choose. One 'sub'-server with 0,25 probability, and the other with 0,75 (=> this I implemented with an output switch with four equiprobable output ports and a pathcombiner with 3 input ports for the 0,75 probability). But there is an additional condition: only one of those 'sub'-servers can be used at a time. This means: total content of both servers at every arbitrary time is maximum 1. How can I implement this?

Answers (2)

Doug Eastman
Doug Eastman on 8 Jan 2013
Edited: Doug Eastman on 8 Jan 2013
Here are two possibilities:
1) Do you really need two separate server blocks? The simplest solution might be to set an entity attribute based on what server it was processed by (75% chance Server Attribute is A, 25% chance it is B). Then you can simply use a Set Attribute block and a single Server block (note service time can depend on the attribute so you can set different times based on the server). No need for any routing blocks at all in this case.
2) If you really need two separate blocks, you can use the routing blocks you've set up. In order to only allow one entity in either server you can put an Enabled Gate before the Output Switch. For each server output the number of entities in block (#n), add those two signals together (Add block), then use a Compare To Zero to see when that signal equals (==) 0. Convert that signal to double using a Data Type Conversion block, then send that signal in the enable port on the gate block. So basically you will open the gate only when there are no entities in either server block.

Ry
Ry on 10 Jan 2013
Thank you. I used the second option. Now about the probability that an entity is allocated to a server, for example: the probability for allocation to server 1 = 0,303. The probability for server 2 = 0,234 etc. How can I put this in the system?
  1 Comment
Doug Eastman
Doug Eastman on 10 Jan 2013
You can use the Event-Based Random Number set to Arbitrary Discrete distribution. You can set the value vector to 1:n where n is the number of servers, then the probability vector can be the different probabilities for each of the servers. The trick is that you have to use a Signal Latch block to connect that signal to the port on the Output Switch block. See:

Sign in to comment.

Categories

Find more on Application Deployment in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!