public object Clone()
 {
     PEQMessageApplication msg = new PEQMessageApplication(
         (PEQSubscriptionCriteria)_Criteria.Clone(),
         (PEQData)_Data.Clone());
     return msg;
 }
        public void GenerateEvent(double time, ILocation location)
        {
            // Overloads GenerateEvent to allow the simulation to provide the time the event occurs.
            XYDoubleLocation initalCorner = (XYDoubleLocation)field[0];  // Casting to xyLocation objects. Other
            XYDoubleLocation finalCorner = (XYDoubleLocation)field[1];     // coordinate systems are not supported.

            List<PEQNode> nodesInRange = new List<PEQNode>();

            // Generate the random center location of the event.
            eventCenter = (XYDoubleLocation)location;

            eventCenter.SetField(field);

            Notify(generateStaticReport(time, eventCenter));

            foreach (PEQNode node in nodes.NodeQueue)
            { // Find which nodes are within the effective detection area.
                if (eventCenter.Distance(node.Location) <= eventSize) // if in the event area
                    nodesInRange.Add(node);
            }

            double eventTime = 0;
            for (int i = 0; i < this.numOccurances; i++)
            {
                eventTime = time + i / this.eventFreq;

                foreach (PEQNode node in nodesInRange)
                {
                    PEQMessageApplication appMsg = new PEQMessageApplication(); // Create a new app message
                    appMsg._Data._DataID = _dataID++;
                    MessageEvent msgEvent = new MessageEvent(appMsg); // create a new message event
                    msgEvent.Referrer = node; // set the referrer to the current node

                    PEQDataInfoReport rep = new PEQDataInfoReport(node.ID, eventTime);
                    rep._Sent = 1;
                    rep._DataID = appMsg._Data._DataID;
                    Notify(rep);

                    PEQTimerInternal messageTimer = new PEQTimerInternal(appMsg, eventTime, node);
                    eventMgr.AddEvent(messageTimer);   // add the event to the Event Queue.
                }
            }

            SimulationCompleteEvent simCompleteEvent = new SimulationCompleteEvent(nodes);
            simCompleteEvent.Time = eventTime + 60; // one minute after last event occurs
            eventMgr.AddEvent(simCompleteEvent);
        }
Пример #3
0
 private void processApplicationMessage(PEQMessageApplication msg)
 {
     msg._Data._StartTime = _eventManager.CurrentClock;
     foreach (PEQTableEntryRouting routeEntry in _tableRouting)
     //foreach (PEQTableEntrySubscription subEntry in _tableSubscription)
     {
         //if ((subEntry._CriteriaType == msg._Criteria.CriteriaType)
           //  && subEntry._Valid)
         if (routeEntry._Valid)
         {
             PEQMessageNotify notifyMsg = new PEQMessageNotify(_id, _id,
                 0x00, routeEntry._SinkID, msg._Data);
             notifyMsg._nextHopCheat = _location;
             processNotify(notifyMsg);
         }
     }
 }