Example #1
0
 void out2(const vle::devs::Time& /* time */, vle::devs::ExternalEventList& output) const
 {
     vle::devs::ExternalEvent* e = new vle::devs::ExternalEvent("g");
     e->attributes().addString("name","g");
     e->attributes().addDouble("value",0);
     output.push_back(e);
     e = new vle::devs::ExternalEvent("b");
     e->attributes().addString("name","b");
     e->attributes().addDouble("value",0);
     output.push_back(e);
 }
Example #2
0
    void out1(const vle::devs::Time&  /*time*/, vle::devs::ExternalEventList& output) const
    {
        vle::devs::ExternalEvent* e = new vle::devs::ExternalEvent("g");
        e->attributes().addString("name","g");
        e->attributes().addDouble("value",10);
        output.push_back(e);
        e = new vle::devs::ExternalEvent("b");
        e->attributes().addString("name","b");
        e->attributes().addDouble("value",10);
        output.push_back(e);
//        std::cout << " FSA send out1 " << time << std::endl;
    }
    virtual void output(const vle::devs::Time &time,
                        vle::devs::ExternalEventList &output) const
    {
        (void)time;

        DTraceModel(vle::fmt("CompareDateAI: output at %1%") % time);

        if (date.empty() || index >= date.size())
            return;

        auto low = std::lower_bound(date.begin() + index, date.end(),
                                    (*(date.begin() + index)).dmin,
                                    [] (const data& d, vle::devs::Time value)
                                    {
                                        return d.dmin <= value;
                                    });

        DTraceModel(vle::fmt("CompareDateAI: need to send %1% start message"
                             " (%2%)") % (std::distance(date.begin() + index,
                                                       low)) % index);

        std::for_each(date.begin() + index, low,
                      [&output] (const data& d)
                      {
                          vle::devs::ExternalEvent *ret =
                              new vle::devs::ExternalEvent("start");
                          ret->putAttribute("specie_name",
                                            new vle::value::String(
                                                d.name));
                          ret->putAttribute("landunit_id",
                                            new vle::value::Integer(
                                                d.id));
                          output.push_back(ret);
                      });
    }
 void aout(const std::string& /*name*/, const vmd::Activity& activity,
           vd::ExternalEventList& out)
 {
     if (activity.isInStartedState()) {
         vd::ExternalEvent* evt = new vd::ExternalEvent("out");
         out.push_back(evt);
     }
 }
Example #5
0
        void output(const vle::devs::Time& time,
                    vle::devs::ExternalEventList& output) const
        {
            if (mPhase == SEND_ASSIGN) {
                for (ResourceConstraints::const_iterator it =
                         mResourceConstraints->begin();
                     it != mResourceConstraints->end(); ++it) {
                    vle::devs::ExternalEvent* ee =
                        new vle::devs::ExternalEvent("assign");

                    ee << vle::devs::attribute("type", it->type());
                    ee << vle::devs::attribute("quantity", (int)it->quantity());
                    output.push_back(ee);
                }
            } else if (mPhase == SEND_DEMAND) {
                for (ResourceConstraints::const_iterator it =
                         mResourceConstraints->begin();
                     it != mResourceConstraints->end(); ++it) {
                    vle::devs::ExternalEvent* ee =
                        new vle::devs::ExternalEvent("demand");

                    TraceModel(
                        vle::fmt(" [%1%:%2%] at %3% -> demand: %4% = %5%") %
                        getModel().getParentName() % getModelName() %
                        time % it->type() % it->quantity());

                    ee << vle::devs::attribute("type", it->type());
                    ee << vle::devs::attribute("quantity", (int)it->quantity());
                    output.push_back(ee);
                }
            } else if (mPhase == SEND_RELEASE) {
                vle::devs::ExternalEvent* ee =
                    new vle::devs::ExternalEvent("release");

                ee << vle::devs::attribute("resources",
                                           mReleasedResources->toValue());
                output.push_back(ee);
            } else if (mPhase == SEND_UNAVAILABLE) {
                vle::devs::ExternalEvent* ee =
                    new vle::devs::ExternalEvent("unavailable");

                ee << vle::devs::attribute("resources",
                                           mUnavailableResources.toValue());
                output.push_back(ee);
            }
        }
Example #6
0
    void out(const vd::Time& /* time */, vd::ExternalEventList& output) const
    {
        vd::ExternalEvent* ee = new vd::ExternalEvent("out");

        ee << vd::attribute("name", std::string("a"));
        ee << vd::attribute("value", 2.);
        ee << vd::attribute("type", ve::DifferenceEquation::ADD);
        output.push_back(ee);
    }
Example #7
0
    virtual void output(const vle::devs::Time& /* time */,
                        vle::devs::ExternalEventList& output) const
    {
		std::vector < std::string >::const_iterator it;
		
		for (it = mPortList.begin(); it != mPortList.end(); ++it) {		
			output.push_back(buildEventWithAString("add", "name", *it));
		}	
	}
Example #8
0
 void out(const vd::Time& time, vd::ExternalEventList& output) const
 {
     if(signal == "stop") {
         std::cout << std::setprecision(8) << time << " OS::out model:" << getModelName() << std::endl;
         vd::ExternalEvent* evt = new vd::ExternalEvent("act");
         evt->putAttribute("name", new vv::String("Stade"));
         evt->putAttribute("value", new vv::Double(RECOLTE));
         output.push_back(evt);
     }
 }
Example #9
0
        void output(const vle::devs::Time& /* time */,
                    vle::devs::ExternalEventList& output) const
        {
            if (mPhase == SEND) {
                const Activities::result_t& activities =
                    mActivities.startingActivities();

                for(Activities::result_t::const_iterator it =
                        activities.begin();
                    it != activities.end(); ++it) {
                    vle::devs::ExternalEvent* ee =
                        new vle::devs::ExternalEvent((*it)->location().name());

                    ee << vle::devs::attribute("location",
                                               (*it)->location().name());
                    ee << vle::devs::attribute("activity", (*it)->toValue());
                    output.push_back(ee);
                }
            }
        }