예제 #1
0
 def xmlConfluent(self, aDEVS):
     """
     The trace functionality for XML output at a confluent transition
     Args:
         aDEVS - the model that transitioned
     """
     portInfo = ""
     for I in range(len(aDEVS.IPorts)):
         portInfo += "<port name=\"" + aDEVS.IPorts[I].getPortName(
         ) + "\" category=\"I\">\n"
         for j in aDEVS.peek(aDEVS.IPorts[I]):
             portInfo += "<message>" + str(j) + "</message>\n</port>\n"
     execute(
         aDEVS,
         easyCommand("self.tracers.saveXML", [
             toStr(aDEVS.getModelFullName()), aDEVS.timeLast, "'EX'",
             toStr(portInfo),
             toStr(aDEVS.state.toXML()),
             toStr(aDEVS.state)
         ]), self.immediate)
     portInfo = ""
     for I in range(len(aDEVS.OPorts)):
         if aDEVS.OPorts[I] in aDEVS.myOutput:
             portInfo += "<port name=\"" + aDEVS.OPorts[I].getPortName(
             ) + "\" category=\"O\">\n"
             for j in aDEVS.myOutput[aDEVS.OPorts[I]]:
                 portInfo += "<message>" + str(j) + "</message>\n</port>\n"
     execute(
         aDEVS,
         easyCommand("self.tracers.saveXML", [
             toStr(aDEVS.getModelFullName()), aDEVS.timeLast, "'IN'",
             toStr(portInfo),
             toStr(aDEVS.state.toXML()),
             toStr(aDEVS.state)
         ]), self.immediate)
예제 #2
0
 def vcdConfluent(self, aDEVS):
     """
     The trace functionality for VCD output at a confluent transition
     Args:
         aDEVS - the model that transitioned
     """
     name = aDEVS.getModelFullName()
     for I in range(len(aDEVS.IPorts)):
         portName = aDEVS.IPorts[I].getPortName()
         signalBag = aDEVS.peek(aDEVS.IPorts[I])
         if signalBag is not None:
             for portSignal in signalBag:
                 execute(
                     aDEVS,
                     easyCommand("self.tracers.saveVCD", [
                         toStr(aDEVS.getModelFullName()), aDEVS.timeLast,
                         toStr(portName),
                         toStr(portSignal)
                     ]), self.immediate)
     for I in range(len(aDEVS.OPorts)):
         if aDEVS.OPorts[I] in aDEVS.myOutput:
             portName = aDEVS.OPorts[I].getPortName()
             signalBag = aDEVS.myOutput[aDEVS.OPorts[I]]
             if signalBag is not None:
                 for portSignal in signalBag:
                     execute(
                         aDEVS,
                         easyCommand("self.tracers.saveVCD", [
                             toStr(aDEVS.getModelFullName()),
                             aDEVS.timeLast,
                             toStr(portName),
                             toStr(portSignal)
                         ]), self.immediate)
예제 #3
0
 def verboseConfluent(self, aDEVS):
     """
     The trace functionality for verbose output at a confluent transition
     Args:
         aDEVS - the model that transitioned
     """
     text = ""
     text += "\n\tCONFLUENT TRANSITION in model <%s>\n" % aDEVS.getModelFullName(
     )
     text += "\t  Input Port Configuration:\n"
     for I in range(len(aDEVS.IPorts)):
         text += "\t    port <" + str(
             aDEVS.IPorts[I].getPortName()) + ">: \n"
         for msg in aDEVS.myInput.get(aDEVS.IPorts[I], []):
             text += "\t       " + str(msg) + "\n"
     text += "\t  New State: %s\n" % str(aDEVS.state)
     text += "\t  Output Port Configuration:\n"
     for I in range(len(aDEVS.OPorts)):
         text += "\t    port <" + str(
             aDEVS.OPorts[I].getPortName()) + ">:\n"
         for msg in aDEVS.myOutput.get(aDEVS.OPorts[I], []):
             text += "\t       " + str(msg) + "\n"
     # Don't show the age
     text += "\t  Next scheduled internal transition at time %5f\n" % (
         aDEVS.timeNext[0])
     execute(
         aDEVS,
         easyCommand("self.tracers.traceVerbose",
                     [aDEVS.timeLast, '"' + text + '"']), self.immediate)
예제 #4
0
 def xmlInit(self, aDEVS):
     """
     The trace functionality for XML output at initialization
     Args:
         aDEVS - the model that was initialised
     """
     execute(aDEVS, easyCommand("self.tracers.saveXML", [toStr(aDEVS.getModelFullName()), aDEVS.timeLast, "'EX'", "''", toStr(aDEVS.state.toXML()), toStr(aDEVS.state)]), self.immediate)
예제 #5
0
 def verboseInternal(self, aDEVS):
     """
     The trace functionality for verbose output at an internal transition
     Args:
         aDEVS - the model that transitioned
     """
     text = ""
     text += "\n\tINTERNAL TRANSITION in model <%s>\n" % aDEVS.getModelFullName(
     )
     text += "\t  New State: %s\n" % str(aDEVS.state)
     text += "\t  Output Port Configuration:\n"
     for I in range(len(aDEVS.OPorts)):
         if aDEVS.OPorts[I] in aDEVS.myOutput:
             text += "\t    port <" + str(
                 aDEVS.OPorts[I].getPortName()) + ">: \n"
             for msg in aDEVS.myOutput[aDEVS.OPorts[I]]:
                 text += "\t       " + str(msg) + "\n"
         else:
             text += "\t    port%d: NoEvent\n" % (I)
     # Don't show the age
     text += "\t  Next scheduled internal transition at time %5f\n" % (
         aDEVS.timeNext[0])
     execute(
         aDEVS,
         easyCommand("self.tracers.traceVerbose",
                     [aDEVS.timeLast, '"' + text + '"']), self.immediate)
예제 #6
0
 def xmlConfluent(self, aDEVS):
     """
     The trace functionality for XML output at a confluent transition
     Args:
         aDEVS - the model that transitioned
     """
     portInfo = ""
     for I in range(len(aDEVS.IPorts)):
         portInfo += "<port name=\""+ aDEVS.IPorts[I].getPortName()+"\" category=\"I\">\n"
         for j in aDEVS.peek(aDEVS.IPorts[I]):
             portInfo += "<message>" + str(j) + "</message>\n</port>\n"
     execute(aDEVS, easyCommand("self.tracers.saveXML", [toStr(aDEVS.getModelFullName()), aDEVS.timeLast, "'EX'", toStr(portInfo), toStr(aDEVS.state.toXML()), toStr(aDEVS.state)]), self.immediate)
     portInfo = ""
     for I in range(len(aDEVS.OPorts)):
         if aDEVS.OPorts[I] in aDEVS.myOutput:
             portInfo += "<port name=\""+ aDEVS.OPorts[I].getPortName()+"\" category=\"O\">\n"
             for j in aDEVS.myOutput[aDEVS.OPorts[I]]:
                 portInfo += "<message>" + str(j) + "</message>\n</port>\n"
     execute(aDEVS, easyCommand("self.tracers.saveXML", [toStr(aDEVS.getModelFullName()), aDEVS.timeLast, "'IN'", toStr(portInfo), toStr(aDEVS.state.toXML()), toStr(aDEVS.state)]), self.immediate)
예제 #7
0
 def vcdConfluent(self, aDEVS):
     """
     The trace functionality for VCD output at a confluent transition
     Args:
         aDEVS - the model that transitioned
     """
     name = aDEVS.getModelFullName()
     for I in range(len(aDEVS.IPorts)):
         portName = aDEVS.IPorts[I].getPortName()
         signalBag = aDEVS.peek(aDEVS.IPorts[I])
         if signalBag is not None:
             for portSignal in signalBag:
                 execute(aDEVS, easyCommand("self.tracers.saveVCD", [toStr(aDEVS.getModelFullName()), aDEVS.timeLast, toStr(portName), toStr(portSignal)]), self.immediate)
     for I in range(len(aDEVS.OPorts) ):
         if aDEVS.OPorts[I] in aDEVS.myOutput:
             portName = aDEVS.OPorts[I].getPortName()
             signalBag = aDEVS.myOutput[aDEVS.OPorts[I]]
             if signalBag is not None:
                 for portSignal in signalBag:
                     execute(aDEVS, easyCommand("self.tracers.saveVCD", [toStr(aDEVS.getModelFullName()), aDEVS.timeLast, toStr(portName), toStr(portSignal)]), self.immediate)
예제 #8
0
 def verboseInit(self, aDEVS):
     """
     The trace functionality for verbose output at the initialisation step
     Args:
         aDEVS - the model that transitioned
     """
     text = ""
     text += "\n\tINITIAL CONDITIONS in model <%s>\n" % aDEVS.getModelFullName()
     text += "\t  Initial State: %s\n" % str(aDEVS.state)
     # Don't show the age
     text += "\t  Next scheduled internal transition at time %5f\n" % (aDEVS.timeNext[0])
     execute(aDEVS, easyCommand("self.tracers.traceVerbose", [aDEVS.timeLast, '"' + text + '"']), self.immediate)
예제 #9
0
 def xmlInit(self, aDEVS):
     """
     The trace functionality for XML output at initialization
     Args:
         aDEVS - the model that was initialised
     """
     execute(
         aDEVS,
         easyCommand("self.tracers.saveXML", [
             toStr(aDEVS.getModelFullName()), aDEVS.timeLast, "'EX'", "''",
             toStr(aDEVS.state.toXML()),
             toStr(aDEVS.state)
         ]), self.immediate)
예제 #10
0
 def verboseInit(self, aDEVS):
     """
     The trace functionality for verbose output at the initialisation step
     Args:
         aDEVS - the model that transitioned
     """
     text = ""
     text += "\n\tINITIAL CONDITIONS in model <%s>\n" % aDEVS.getModelFullName(
     )
     text += "\t  Initial State: %s\n" % str(aDEVS.state)
     # Don't show the age
     text += "\t  Next scheduled internal transition at time %5f\n" % (
         aDEVS.timeNext[0])
     execute(
         aDEVS,
         easyCommand("self.tracers.traceVerbose",
                     [aDEVS.timeLast, '"' + text + '"']), self.immediate)
예제 #11
0
 def verboseExternal(self, aDEVS):
     """
     The trace functionality for verbose output at an external transition
     Args:
         aDEVS - the model that transitioned
     """
     text = ""
     text += "\n\tEXTERNAL TRANSITION in model <%s>\n" % aDEVS.getModelFullName()
     text += "\t  Input Port Configuration:\n"
     for I in range(len(aDEVS.IPorts)):
         text += "\t    port <" + str(aDEVS.IPorts[I].getPortName()) + ">:\n"
         for msg in aDEVS.myInput.get(aDEVS.IPorts[I], []):
             text += "\t       " + str(msg) + "\n"
     text += "\t  New State: %s\n" % str(aDEVS.state)
     # Don't show the age
     text += "\t  Next scheduled internal transition at time %5f\n" % (aDEVS.timeNext[0])
     execute(aDEVS, easyCommand("self.tracers.traceVerbose", [aDEVS.timeLast, '"' + text + '"']), self.immediate)