How can I set that only one of the subservers can be used at a time?
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
Doug Eastman
2013-1-8
编辑:Doug Eastman
2013-1-8
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.
0 个评论
Ry
2013-1-10
1 个评论
Doug Eastman
2013-1-10
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:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Data Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!