필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Ry
Ry 2013년 1월 8일
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?

답변 (2개)

Doug Eastman
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.

Ry
Ry 2013년 1월 10일
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
Doug Eastman
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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by