10.05.2013 Views

Texto base de la asignatura - UNED

Texto base de la asignatura - UNED

Texto base de la asignatura - UNED

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MODELADO DE SISTEMAS MEDIANTE DEVS<br />

}<br />

}<br />

if (!sw && input.equals("in")) con = makeContent("out", job);<br />

else if (!sw && input.equals("in1")) con = makeContent("out1",job);<br />

else if (sw && input.equals("in")) con = makeContent("out1",job);<br />

else con = makeContent("out", job);<br />

m.add(con);<br />

}<br />

return m;<br />

6.5.4. Mo<strong>de</strong>lo <strong>de</strong> un generador<br />

A continuación se muestra el mo<strong>de</strong>lo DEVSJAVA <strong>de</strong> un generador <strong>de</strong> eventos<br />

con dos puertos <strong>de</strong> entrada, start y stop, que contro<strong>la</strong>n el comienzo y <strong>la</strong> finalización<br />

<strong>de</strong> <strong>la</strong> generación <strong>de</strong> eventos. Mientras el generador se encuentra en <strong>la</strong> fase “active”,<br />

genera eventos <strong>de</strong> salida cada interArrivalTime unida<strong>de</strong>s <strong>de</strong> tiempo. La c<strong>la</strong>se genr<br />

se encuentra en el paquete SimpArc.<br />

package SimpArc;<br />

import simView.*;<br />

import genDevs.mo<strong>de</strong>ling.*;<br />

import GenCol.*;<br />

public c<strong>la</strong>ss genr extends ViewableAtomic {<br />

294<br />

protected double interArrivalTime;<br />

protected int count;<br />

public genr(String name, double interArrivalTime) {<br />

super(name);<br />

addInport("in");<br />

addOutport("out");<br />

addInport("stop");<br />

addInport("start");<br />

this.interArrivalTime = interArrivalTime ;<br />

}<br />

public void initialize() {<br />

holdIn("active", interArrivalTime);<br />

count = 0;<br />

super.initialize();<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!