| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → SimEvents |
| Contents | Index |
| Learn more about SimEvents |
Servers
This block serves one entity for a period of time, and then attempts to output the entity through the OUT port. If the OUT port is blocked, then the entity stays in this block until the port becomes unblocked. If an entity in this block is scheduled to time out, then it might depart prematurely via the optional TO port; see Forcing Departures Using Timeouts for details about timeouts.
You specify the service time, which is the duration of service, via a parameter, attribute, or signal, depending on the Service time from parameter value. The block determines the service time for an entity upon its arrival. Service times are assumed to be specified in seconds.
Note If you specify the service time via an event-based signal, be sure that its updates occur before the entity arrives. For common problems and troubleshooting tips, see Unexpected Use of Old Value of Signal. |
The block permits preemption if you select Permit preemption based on attribute. In this case, an entity in the server can depart early via the P port. Preemption occurs only if attributes of the current entity and the entity attempting to arrive satisfy specified criteria. For details, see Preempting an Entity in a Server.
When the block does not permit preemption, the IN port is unavailable whenever this block stores an entity. In this case, the IN port becomes available when the entity departs.
Entity Input Ports
| Label | Description |
|---|---|
| IN | Port for arriving entities, which will be served. |
Signal Input Ports
| Label | Description |
|---|---|
| t | Service time, in seconds, for a newly arrived entity. You see this port only if you set Service time from to Signal port t. |
Entity Output Ports
| Label | Description |
|---|---|
| OUT | Port for departing entities that have completed their service time, have not timed out while in this block, and have not been preempted. |
| P | Port for entities that have been preempted by an arriving entity. This port must not be blocked at the time of preemption. |
| TO | Port for entities that time out while in this block. You see this port only if you select Enable TO port for timed-out entities. This port must not be blocked when an entity attempts to depart here. |
Signal Output Ports
| Label | Description | Time of Update When Statistic Is On | Order of Update When Entity Departs |
|---|---|---|---|
| #d | Number of entities that have departed from this block via the OUT port since the start of the simulation. | After entity departure via the OUT port | 4 |
| #n | Number of entities currently in the block, either 0 or 1. | After entity arrival and after entity departure from the OUT port | 3 |
| #p | Number of entities that have been preempted from this block since the start of the simulation. | After entity departure from the P port | 4 |
| pe | A value of 1 indicates when the block tries and fails to output an entity, that is, an entity has completed its service, but cannot depart from the OUT port because the subsequent entity input port is unavailable. | After service completion and when entity departure is imminent | 1 |
| w | Sample mean of the waiting times in this block for all entities that have departed from the OUT or TO port. An entity's waiting time might exceed its service time if the OUT port is blocked when the entity completes service. | After entity departure from the OUT or TO port | 2 |
| util | Utilization of the server, which is the fraction of simulation time spent storing an entity. At T=0, the utilization is 0 or 1 depending on whether the server contains an entity. | Performance considerations cause the block to suppress signal updates until specific occurrences cause updates. In On mode, updates occur after an entity departure from the OUT port and after an entity arrival. In Upon stop or pause mode, stopping or pausing the simulation causes an update. | 2 |
| #to | Number of entities that have timed out from this block since the start of the simulation. | After entity departure via the TO port | 4 |
Output signals having the same number in the Order of Update column in the table above are updated in an arbitrary sequence relative to each other; you should not rely on a specific sequence for your simulation results.
The initial output value, which is in effect from the start of the simulation until the first update by the block, is 0 for all signals.

Determines whether the service time is computed from a parameter in this dialog box, an input signal, or an attribute of the entity being served.
The service time, in seconds, for all entities. You see this field only if you set Service time from to Dialog.
The name of the attribute whose value the block uses as the service time for an entity. You see this field only if you set Service time from to Attribute.
The priority of the service completion event, relative to other simultaneous events in the simulation.

If you select this option, the block can replace an entity by a higher priority entity. Otherwise, the block never permits new arrivals when it is storing an entity. Selecting this option also sets Average wait on the Statistics tab to Off and makes that parameter unavailable.
The block uses this attribute to determine whether a new entity can preempt the one in the server. You see this field only if you select Permit preemption based on attribute.
Preemption occurs when the arriving entity has a strictly smaller (Ascending) or strictly larger (Descending) value of the attribute named above, compared to the attribute value of the entity in the server. You see this field only if you select Permit preemption based on attribute.
If you select this option, a preemption event causes the block to set an attribute in the preempted entity. The attribute value is the remaining service time the entity would have required if it had not been preempted. You see this field only if you select Permit preemption based on attribute.
The name of the attribute the block uses when recording the residual service time of entities. You see this field only if you select Write residual service time to attribute.
Selecting this option enables the block to define a new attribute for the residual service time. Otherwise, the block issues an error if the attribute named above does not already exist. You see this field only if you select Write residual service time to attribute.

This option becomes relevant if an entity times out while in this block. Selecting this option provides a TO entity output port through which the timed-out entity departs. If you clear this option in a model that uses timeouts, see the If entity has no destination when timeout occurs parameter of the Schedule Timeout block.
These parameters determine whether certain ports produce data throughout the simulation, produce data only when you stop or pause the simulation, or are omitted from the block. For descriptions of the affected ports, see the preceding table, "Signal Output Ports".

Controls the presence and behavior of the signal output port labeled #d.
Controls the presence and behavior of the signal output port labeled #n.
Controls the presence and behavior of the signal output port labeled #p. This field is available only if you select the Permit preemption based on attribute option on the Preemption tab.
Controls the presence of the signal output port labeled pe.
Controls the presence and behavior of the signal output port labeled w. This field is available only if you clear the Permit preemption based on attribute option on the Preemption tab.
Controls the presence and behavior of the signal output port labeled util.
Controls the presence and behavior of the signal output port labeled #to.
The following example (open model) illustrates the timing of updates of the util signal, as described in Signal Output Ports.

The server has idle periods that reduce its utilization. However, the server block recomputes the util signal only when the number of entities in the server changes. While the definition of utilization says that the utilization is less than 1 at time 3, the util signal remains at its previous value of 1 until the next entity arrives at time 4.


In a longer simulation, the differences in the value of util compared to its theoretical definition become less pronounced.

![]() | Signal-Based Function-Call Event Generator | Start Timer | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |