# N-Server

Serve up to N entities for period of time

Servers

## Description

This block stores up to N entities, serving each one independently for a period of time and then attempting 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. For an example that uses the TO port of a queue block in the same way, see Use Timeouts to Limit Entity Queueing Time.

An N-server is like a set of N single servers connected in parallel, followed by a path combiner; the path combiner notifies entities of an unblocked path in the sequence in which the entities completed their service time, until one entity departs.

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.

All entities that arrive do so via the IN port. The IN port is unavailable whenever this block contains N entities. In that case, the IN port becomes available when at least one of the N entities departs.

## Ports

Entity Input Ports

Port LabelDescription
INPort for arriving entities, which will be served.

Signal Input Ports

Port LabelDescription
tService time, in seconds, for a newly arrived entity. This signal must be an event-based signal. You see this port only if you set Service time from to ```Signal port t```.
pausePort for input signal that disables all servers when the signal is positive. While the servers are disabled, any occupied servers retain their entities and the software pauses the remaining service time for each server. When the signal at the input port becomes nonpositive, each server resumes service. You see this port only if you select Allow service control and set Service change upon disabling to `Pause`.
completePort for input signal that disables all servers when the signal is positive.

When a positive signal enters the complete port, the software:

• Disables all servers.

• Immediately completes service in all occupied servers.

• Resets the remaining service time in all servers.

If no blockage exists at the entity output port of the N-Server block, entities immediately advance from occupied servers to downstream blocks. When the signal at the input port becomes nonpositive, normal behavior of the N-Server block resumes.

You see this port only if you select Allow service control and set Service change upon disabling to ```Force complete```.

Entity Output Ports

Port LabelDescription
OUTPort for departing entities that have completed their service time and have not timed out while in this block.
TOPort 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

Port LabelDescriptionTime of Update When Statistic Is OnOrder of Update When Entity Departs
#dNumber of entities that have departed from this block via the OUT port since the start of the simulation.After entity departure via the OUT port5
#nNumber of entities currently in the block, between 0 and N.After entity arrival and after entity departure4
pe

A value of 1 indicates that the block stores at least one entity that has tried and failed to depart. Such entities are pending entities.

A value of 0 indicates that the block does not store any pending entities.

After the block stores an entity that has tried and failed to depart. In this case, the signal value is 1.

After the departure of a pending entity. In this case, the signal value depends on whether any other pending entities remain in the block.

1
#peNumber of pending entities in the block.

After the block stores an entity that has tried and failed to depart.

After the departure of a pending entity.

3
wSample mean of the waiting times in this block for all entities that have departed via any port. An entity's waiting time might exceed its service time if the OUT port is blocked when the entity completes service.After entity departure2
utilUtilization of the N-server. If Number of servers is finite, util is the time average of the fraction of servers that are storing an entity. At time values when an entity arrives or departs, util equals 1/N times the time average of the #n signal. If Number of servers is infinite, then util is always zero.Performance considerations cause the block to update the signal only after each arrival or departure of an entity.2
#toNumber of entities that have timed out from this block since the start of the simulation.After entity departure via the TO port5
soOccupancy status of each server in the N-Server block. The so port outputs a vector of values. If a server is unoccupied, the value of the correpsonding vector element is `0`. If a server is occupied, the vector element has a value of `1`.After entity arrival and after entity departure6

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.

A more precise definition of the utilization signal util at an update time T>0 is

$\frac{1}{T}\sum _{k}\left(\frac{{\left(#n\right)}_{k}}{N}\right)\cdot \text{length(}{I}_{k}\right)$

where Ik is the kth time interval between successive pairs of times that util is updated and ${\left(#n\right)}_{k}$ is the number of entities the N-Server block is storing during the open interval Ik. If an update of util occurs at T=0, the value is #n/N.

## Dialog Box

### N-Server Tab

Number of servers

The number of servers the block represents, N.

Service time from

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.

Service time

The service time, in seconds, for all entities. You see this field only if you set Service time from to `Dialog`.

Attribute name

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`.

Service completion event priority

The priority of the service completion event, relative to other simultaneous events in the simulation.

### Service control Tab

Allow service control

Adds an input signal port to the block. When you input a positive signal to this added signal port, the software disables servers in the block and applies a service change. You specify the service change action using an option that becomes visible when you select Allow service control.

Service change upon disabling

Specifies the service change action that the software applies to disabled servers. You see this option only if you select Allow service control.

By default, Service change upon disabling is set to `Pause`. When `Pause` is selected, the signal input port added by Allow service control is labeled pause. When you input a positive signal to the pause port, the software disables all servers in the block. While this input signal remains positive, any occupied servers retain their entities and the software pauses the remaining service time for each server. When the signal at the input port becomes nonpositive, each server resumes service.
For an example of using the pause port, see Pause Service in a Conveyor Belt System.

You can also set Service change upon disabling to ```Force complete```. In this case, when you click OK, the label of the signal input port added by Allow service control changes to complete.

When a positive signal enters the complete port, the software:

• Disables all servers.

• Immediately completes service in all occupied servers.

• Resets the remaining service time in all servers.

If no blockage exists at the entity output port of the N-Server block, entities immediately advance from occupied servers to downstream blocks. When the signal at the input port becomes nonpositive, normal behavior of the N-Server block resumes.
For an example of using the complete port, see Task Preemption in a Multitasking Processor.

Block entity entry to disabled servers

Determines whether unoccupied servers can accept entities while the signal at the pause or complete port is positive.

Control event priority

The priority of the service control event, relative to other simultaneous events in the simulation.

### Timeout Tab

Enable TO port for timed-out entities

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.

### Statistics Tab

These parameters determine whether the block produces data at signal output ports or omits those ports. For descriptions of the data and ports, see the preceding table, "Signal Output Ports".

Number of entities departed

Allows you to use the signal output port labeled #d.

Number of entities in block

Allows you to use the signal output port labeled #n.

Pending entity present in block

Allows you to use the signal output port labeled pe.

Number of pending entities

Allows you to use the signal output port labeled #pe.

Average wait

Allows you to use the signal output port labeled w.

Utilization

Allows you to use the signal output port labeled util.

Number of entities timed out

Allows you to use the signal output port labeled #to.

Server occupancy, so

Allows you to use the signal output port labeled so.