How can I set that only one of the subservers can be used at a time?
조회 수: 1 (최근 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!