Redes Petri:
Código:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from snakes.nets import * | |
from snakes.data import * | |
import snakes.plugins | |
snakes.plugins.load('gv','snakes.nets','nets') | |
from nets import * | |
n1 = PetriNet('Elevador') | |
#Places(Estados) | |
n1.add_place(Place("Inicio",[1])) | |
n1.add_place(Place("Subir",[2])) | |
n1.add_place(Place("Bajar",[2])) | |
n1.add_place(Place("Detener",[3])) | |
#Transitions of the Game | |
n1.add_transition(Transition("t1",Expression('Piso>Actual'))) | |
n1.add_transition(Transition("t2", Expression('Piso<Actual'))) | |
n1.add_transition(Transition("t3", Expression('Piso==Actual'))) | |
#Gambits of Van | |
n1.add_input("Inicio", "t1", Variable("Piso")) | |
#n1.add_input("Detener", "t3", Variable("Piso")) | |
n1.add_output("Subir", "t1", Expression("Piso>Actual")) | |
n1.add_input("Subir", "t1", Variable("Piso")) | |
n1.add_input("Subir", "t3", Variable("Piso")) | |
#n1.add_input("Detener", "t3", Variable("Piso")) | |
n1.add_input("Inicio", "t2", Variable("Piso")) | |
n1.add_output("Bajar", "t2", Expression("Piso<Actual")) | |
n1.add_input("Bajar", "t2", Variable("Piso")) | |
n1.add_input("Bajar", "t3", Variable("Piso")) | |
n1.add_input("Inicio", "t3", Variable("Piso")) | |
n1.add_output("Inicio", "t3", Variable("Piso")) | |
n1.add_output("Detener", "t3", Variable("Piso")) | |
n1.draw("saul_net.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from snakes.nets import * | |
from snakes.data import * | |
import snakes.plugins | |
snakes.plugins.load('gv','snakes.nets','nets') | |
from nets import * | |
n1 = PetriNet('Puerta') | |
#Places(Estados) | |
n1.add_place(Place("Abierto",[1])) | |
n1.add_place(Place("Cerrado",[2])) | |
n1.add_transition(Transition("t1",Expression('Asciende == true or Desciende == true'))) | |
n1.add_transition(Transition("t2", Expression('Asciende == false or Desciende == false'))) | |
#Gambits of Van | |
n1.add_input("Abierto", "t1", Variable("Asciende__y__Desciende")) | |
n1.add_input("Cerrado", "t2", Variable("Asciende__y__Desciende")) | |
n1.add_output("Cerrado", "t1", Expression('Asciende == true or Desciende == true')) | |
n1.add_input("Abierto", "t2", Variable("Asciende__y__Desciende")) | |
n1.draw("saul_puerta.png") |
Ya no regresa nunca de detenido... Pero está bien la parte modelada. Te pongo 9 pts.
ResponderEliminarandate a la verga pinche no me sirvió de nada
ResponderEliminarandate a la verga pinche no me sirvió de nada
ResponderEliminar