next up previous contents index
Next: Transducer Up: Throughput and System Time Previous: Throughput and System Time   Contents   Index

Generator

The state transition diagram of Generator is shown in Figure 4.6(a). This model has an output port out and tmValue-type client which will be used for cloning the client every generating time.
class Generator: public Atomic {
public:
    OutputPort* out;
    tmValue client;
public:
    Generator(const string& name=""): Atomic(name),
        client() { out = AddOP("out"); }

Generator::tau() returns a random value from an exponential pdf with mean 5.

    /*virtual*/ Time tau() const
    {
        static rv erv;
        TimeSpan t = erv.exp(5);
        return t;
    }
Generator::detla_y() makes a clone of client and assigns it pClient. pClient is stamped by (``SysIn'',CurrentTime) and it is sent out of Generator through out port.
    /*virtual*/ void delta_y(PortValue& y)
    {
        tmValue* pClient = (tmValue*) client.Clone();
        //-- (event, time) stamping
        pClient->TimeMap.insert(make_pair("SysIn",Devs::TimeCurrent()));
        y.Set(out, pClient);
    }
Generator's init() and delta_x are omitted here because they have no functionality.



MHHwang 2007-05-07