next up previous contents index
Next: Utilization in DEVS# Up: Throughput and System Time Previous: Generator   Contents   Index

Transducer

Figure 4.7: State Transition Diagrams of Transducer
\begin{figure}\centering\mbox {\epsfig{file=Transd,width=0.35\columnwidth}}
\end{figure}

Transducer's behavior is pretty much opposite to that of Generator. Figure 4.7 shows its state transition diagram. It has an input port iin and a buffer Collector as Dictionary<int, List<Job>> to collect jobs coming in with respect to their types.

public class Transducer: Atomic
    {
        public InputPort iin;
        Dictionary<int, List<Job>> Collector;

        public Transducer(string name, TimeUnit tu): base(name, tu)
        {
            CollectStatistics(true); // default collecting statistics
            iin = AddIP("in");
            Collector = new Dictionary<int, List<Job>>();
        }

Transducer::init() clears all clients in Collector. Transducer::tau() returns $ \infty$ all the time so it is passive.

    public override void init() { Collector.Clear(); }
    public override double tau() { return double.MaxValue; }

Transducer::delta_x() castes the input value x.value to pv of Job type. It stamps pv with (``SysOut'',CurrentTime), and pushes pv into Collector. Since Transducer is always passive, it has no output, and so delta_y() is not needed here;

    public override bool delta_x(PortValue x)
    {
        Job pv = (Job) x.value;
        if(pv != null)
        {
            //-- (event, time) stamping
            pv.TimeMap.Add("SysOut", Devs.TimeCurrent);
            if (Collector.ContainsKey(pv.type) == false)
                Collector.Add(pv.type, new List<Job>());
            Collector[pv.type].Add(pv);
        }
        //else
        //    throw new Exception("Type casting Failed!");
        return false;
    }

Recall that Transducer collects incoming Jobs stamped with (``SysIn'',arrival-time) by Generator, (``SysOut'',departure-time) by Transducer. Using these data, GetPerformance() of Transducers returns {(``Throughput'', value) and (``Average System Time'', value) } as follows.

The function Transducer::GetPerformance() returns these three indices. The source code of GetPerformance() is available in Transducer.cs.


next up previous contents index
Next: Utilization in DEVS# Up: Throughput and System Time Previous: Generator   Contents   Index
MHHwang 2007-05-08