コード例 #1
0
ファイル: main.py プロジェクト: sgino209/Traffic_Simulation
def main():
    """
      -----------------------------------------------------------------
    --|-------------------------------------------------------------- |     -----------------------------
    |  Initiator Process                                            | |     | Fabric                    |
    |                                                               | |     |                           |
    |  -------------------                ----------                | |     |---------         ---------|    -----------
    |  | Init. Procedure |---enqueue()--->| Queue  |<---dequeue()------------ Socket |-----    | Socket ---->| Target  |
    |  | (BW Generator)  |                | (FIFO) |    (implicit)  | |     |---------    |    ---------|    | Process |
    |  -------------------                ----------                | |     |             |      |      |    -----------
    |                                                               | |     |            ------------   |
    |  -------------------                ----------                | |     |---------   | ARBITER  |   |
    |  | Init. Procedure |---enqueue()--->| Queue  |<---dequeue()------------ Socket |---|          |   |
    |  | (BW Generator)  |                | (FIFO) |    (implicit)  | |     |---------   |          |   |
    |  -------------------                ----------                | |     |    .       |          |   |
    |          .                              .                     | |     |    .       |          |   |
    |          .                              .                     | |     |    .       ------------   |
    |          .                              .                     | |     |    .        |      |      |
    |  -------------------                ----------                | |     |---------    |    ---------|    -----------
    |  | Init. Procedure |---enqueue()--->| Queue  |<---dequeue()------------ Socket |-----    | Socket ---->| Target  |
    |  | (BW Generator)  |                | (FIFO) |    (implicit)  | |     |---------         ---------|    | Process |
    |  -------------------                ----------                |--     |                           |    -----------
    -----------------------------------------------------------------       -----------------------------
    """

    env = simpy.Environment()

    aux = Auxiliary(env, inc.global_params['DEBUG_LEVEL'])

    tb = {'ENV': env, 'AUX': aux}

    # ========================================================================================
    aux.timestamp(__name__, "Initialization Phase started")

    # Create Initiators:
    tb['INITIATORS'] = {
        'CPU': Initiator('CPU', inc.initiators_params['CPU'], tb),
        'PCIE': Initiator('PCIE', inc.initiators_params['PCIE'], tb)
    }

    # ------------------------------------------------------
    # Create Targets:
    tb['TARGETS'] = {
        'SRAM': Target('SRAM', inc.targets_params['SRAM'], tb),
        'ROM': Target('ROM', inc.targets_params['ROM'], tb)
    }

    # ------------------------------------------------------
    # Create Fabric:
    tb['FABRIC'] = Fabric('DATA', inc.fabric_params, tb)

    aux.timestamp(__name__, "Initialization Phase completed")

    # ========================================================================================
    aux.timestamp(__name__, "Run Phase started")

    tb['ENV'].run(until=inc.global_params['SIMULATION_TIME_IN_CYCLES'])

    aux.timestamp(__name__, "Run Phase completed")
コード例 #2
0
def executeModelTop(showFlows):

  ##Auxiliaries
  MultiplierSchedPressure = Auxiliary("MultiplierSchedPressure")
  MultiplierWorkforce = Auxiliary("MultiplierWorkforce")
  NominalErr = Auxiliary("NominalErr")
  SWDevelopmentRate = Auxiliary("SWDevelopmentRate")
  PotErrDetectRate = Auxiliary("PotErrDetectRate")
  QARate = Auxiliary("QARate")
  AvgErrPerTask = Auxiliary("AvgErrPerTask")
  ActualReworkMP = Auxiliary("ActualReworkMP")
  DailyMPRework = Auxiliary("DailyMPRework")
  ### Flows
  ErrGenRate = Flow("ErrGenRate")
  ErrDetRate = Flow("ErrDetRate")
  ErrEscapeRate = Flow("ErrEscapeRate")
  ReworkRate = Flow("ReworkRate")

  ## we need to fill up auxiliaries ...
  auxDict = utility.createAuxiliaries_Top()
  ##States
  curr = State("CurrentState", True)
  prev = State("PrevState", True)
  dt = 1
  ##output & test purpose
  stockDict ={}
  for key_,val_ in auxDict.items():
   # current state's stocks are dependent on prev. state's flows
   # some have in and out flows
   curr.PotentiallyDetectableError_.setInput(dt * (prev.ErrGenRate_.curr - prev.ErrDetRate_.curr - prev.ErrEscapeRate_.curr ))
   curr.DetectedError_.setInput( dt*( ErrDetRate.curr - ReworkRate.curr  ))
   # some only have in flows
   curr.EscapedError_.setInput( dt*(ErrEscapeRate.curr))
   curr.ReworkedError_.setInput(dt*(ReworkRate.curr))
   print "{} ---> {}".format( key_,  curr)
   #setup output
   stockDict[key_]=[curr.PotentiallyDetectableError_.curr, curr.DetectedError_.curr, curr.EscapedError_.curr, curr.ReworkedError_.curr]
   print "---------------"
   #setting up auxiliaries
   MultiplierSchedPressure.setInput(val_[0])
   MultiplierWorkforce.setInput(val_[1])
   NominalErr.setInput(val_[2])
   SWDevelopmentRate.setInput(val_[3])
   PotErrDetectRate.setInput(val_[4])
   AvgErrPerTask.setInput(val_[5])
   QARate.setInput(val_[6])
   ActualReworkMP.setInput(val_[7])
   DailyMPRework.setInput(val_[8])
   #filling flows
   ErrGenRate.fillFlowsByAuxs(MultiplierSchedPressure, MultiplierWorkforce, NominalErr, SWDevelopmentRate)
   ErrDetRate.fillFlowsByAuxs(PotErrDetectRate)
   ErrEscapeRate.fillFlowsByAuxs(AvgErrPerTask, QARate)
   ReworkRate.fillFlowsByAuxs(ActualReworkMP, DailyMPRework)
   # updating current state's flows
   curr.updateErrGenRate(ErrGenRate)
   curr.updateErrDetRate(ErrDetRate)
   curr.updateErrEscapeRate(ErrEscapeRate)
   curr.updateReworkRate(ReworkRate)
   if(showFlows):
    print "{} ---> {}".format( key_,  curr.getFlows())
    print "---------------"
   prev = curr.copyTop("Prev")
   #print "Prev: ZZZ ",prev_
   print "###################"
  return stockDict
コード例 #3
0
def executeModelBottom(showFlows):

  ## Eight Unique Auxiliaries
  TimeToSmooth = Auxiliary("TimeToSmooth")
  MultiplierToRegen = Auxiliary("MultiplierToRegen")
  ActiveErrorDensity = Auxiliary("ActiveErrorDensity")
  TestingRate = Auxiliary("TestingRate")
  PassiveErrorDensity = Auxiliary("PassiveErrorDensity")
  FractionEscapingErrors = Auxiliary("FractionEscapingErrors")
  ActiveErrorsRetiringFraction = Auxiliary("ActiveErrorsRetiringFraction")
  BadFixGenRate = Auxiliary("BadFixGenRate")

  ## Six Flows
  ActiveErrorRegenRate = Flow("ActiveErrorRegenRate")
  ActiveErrorDetectAndCorrectRate = Flow("ActiveErrorDetectAndCorrectRate")
  ActiveErrorRetirementRate = Flow("ActiveErrorRetirementRate")
  PassiveErrorDetectAndCorrectRate = Flow("PassiveErrorDetectAndCorrectRate")
  PassiveErrorGenRate = Flow("PassiveErrorGenRate")
  ActiveErrorGenRate = Flow("ActiveErrorGenRate")

  auxDict = utility.createAuxiliaries_Bottom()

  ##States
  curr = State("CurrentState", False)
  prev = State("PrevState", False)
  dt = 1
  ##output & test purpose
  stockDict ={}


  for key_, val_ in auxDict.items():

    # Update stock from inflows and outflows
    curr.UndetectedActiveErrors_.setInput(dt * (prev.ActiveErrorRegenRate_.curr + prev.ActiveErrorGenRate_.curr) - (prev.ActiveErrorRetirementRate_.curr + prev.ActiveErrorDetectAndCorrectRate_.curr) )
    curr.UndetectedPassiveErrors_.setInput(dt * (prev.ActiveErrorRetirementRate_.curr + prev.PassiveErrorGenRate_.curr)- prev.PassiveErrorDetectAndCorrectRate_.curr) 
    print "{} ---> {}".format( key_,  curr)

    stockDict[key_]=[curr.UndetectedActiveErrors_.curr]
    print "---------------"

    #Setting up eight Auxiliaries
    TimeToSmooth.setInput(val_[0])
    MultiplierToRegen.setInput(val_[1])
    ActiveErrorDensity.setInput(val_[2])
    TestingRate.setInput(val_[3])
    ActiveErrorsRetiringFraction.setInput(val_[4])
    FractionEscapingErrors.setInput(val_[5])
    BadFixGenRate.setInput(val_[6])
    PassiveErrorDensity.setInput(val_[7] + curr.UndetectedPassiveErrors_.curr)

    # Filling Flows : six flows
    ActiveErrorRegenRate.fillFlowsByAuxs(TimeToSmooth, MultiplierToRegen, ActiveErrorDensity)
    ActiveErrorDetectAndCorrectRate.fillFlowsByAuxs(ActiveErrorDensity)
    ActiveErrorRetirementRate.fillFlowsByAuxs(TestingRate, ActiveErrorsRetiringFraction)
    ActiveErrorGenRate.fillFlowsByAuxs(FractionEscapingErrors, BadFixGenRate)
    PassiveErrorGenRate.fillFlowsByAuxs(BadFixGenRate, FractionEscapingErrors)
    PassiveErrorDetectAndCorrectRate.fillFlowsByAuxs(PassiveErrorDensity, TestingRate)

    # updating current state's flows: six flows
    curr.updateActiveErrorRegenRate(ActiveErrorRegenRate)
    curr.updateActiveErrorDetectAndCorrectRate(ActiveErrorDetectAndCorrectRate)
    curr.updateActiveErrorRetirementRate(ActiveErrorRetirementRate)
    curr.updateActiveErrorGenRate(ActiveErrorGenRate)
    curr.updatePassiveErrorGenRate(PassiveErrorGenRate)
    curr.updatePassiveErrorDetectAndCorrectRate(PassiveErrorDetectAndCorrectRate)

    if(showFlows):
      print "{} ---> {}".format( key_,  curr.getFlows())
      print "---------------"
    prev = curr.copyBottom("Prev")
    #print "Prev: ZZZ ",prev_
    print "###################"
  return stockDict
コード例 #4
0
ファイル: ModelExecAll.py プロジェクト: sbiswas4/59115ASE
def executeModelForBaseline(auxListParam, currStateParam, prevStateParam, dt):
    ##Nine Unique Auxiliaries : Top
    MultiplierSchedPressure = Auxiliary("MultiplierSchedPressure")
    MultiplierWorkforce = Auxiliary("MultiplierWorkforce")
    NominalErr = Auxiliary("NominalErr")
    SWDevelopmentRate = Auxiliary("SWDevelopmentRate")
    PotErrDetectRate = Auxiliary("PotErrDetectRate")
    QARate = Auxiliary("QARate")
    AvgErrPerTask = Auxiliary("AvgErrPerTask")
    ActualReworkMP = Auxiliary("ActualReworkMP")
    DailyMPRework = Auxiliary("DailyMPRework")

    ## Eight Unique Auxiliaries :Bottom
    TimeToSmooth = Auxiliary("TimeToSmooth")
    MultiplierToRegen = Auxiliary("MultiplierToRegen")
    ActiveErrorDensity = Auxiliary("ActiveErrorDensity")
    TestingRate = Auxiliary("TestingRate")
    PassiveErrorDensity = Auxiliary("PassiveErrorDensity")
    FractionEscapingErrors = Auxiliary("FractionEscapingErrors")
    ActiveErrorsRetiringFraction = Auxiliary("ActiveErrorsRetiringFraction")
    BadFixGenRate = Auxiliary("BadFixGenRate")

    ### Four Flows from Top
    ErrGenRate = Flow("ErrGenRate")
    ErrDetRate = Flow("ErrDetRate")
    ErrEscapeRate = Flow("ErrEscapeRate")
    ReworkRate = Flow("ReworkRate")

    ## Six Flows from Bottom
    ActiveErrorRegenRate = Flow("ActiveErrorRegenRate")
    ActiveErrorDetectAndCorrectRate = Flow("ActiveErrorDetectAndCorrectRate")
    ActiveErrorRetirementRate = Flow("ActiveErrorRetirementRate")
    PassiveErrorDetectAndCorrectRate = Flow("PassiveErrorDetectAndCorrectRate")
    PassiveErrorGenRate = Flow("PassiveErrorGenRate")
    ActiveErrorGenRate = Flow("ActiveErrorGenRate")

    # current state's stocks are dependent on prev. state's flows
    # some have in and out flows
    currStateParam.PotentiallyDetectableError_.setInput(
        dt *
        (prevStateParam.ErrGenRate_.curr - prevStateParam.ErrDetRate_.curr -
         prevStateParam.ErrEscapeRate_.curr))
    currStateParam.DetectedError_.setInput(
        dt *
        (prevStateParam.ErrDetRate_.curr - prevStateParam.ReworkRate_.curr))

    # some only have in flows from top
    currStateParam.EscapedError_.setInput(dt *
                                          (prevStateParam.ErrEscapeRate_.curr))
    currStateParam.ReworkedError_.setInput(dt *
                                           (prevStateParam.ReworkRate_.curr))

    # Update stock from inflows and outflows from Bottom
    currStateParam.UndetectedActiveErrors_.setInput(
        dt * (prevStateParam.ActiveErrorRegenRate_.curr +
              prevStateParam.ActiveErrorGenRate_.curr) -
        (prevStateParam.ActiveErrorRetirementRate_.curr +
         prevStateParam.ActiveErrorDetectAndCorrectRate_.curr))
    currStateParam.UndetectedPassiveErrors_.setInput(
        dt * (prevStateParam.ActiveErrorRetirementRate_.curr +
              prevStateParam.PassiveErrorGenRate_.curr) -
        prevStateParam.PassiveErrorDetectAndCorrectRate_.curr)

    #setting up auxiliaries
    MultiplierSchedPressure.setInput(auxListParam[0])
    MultiplierWorkforce.setInput(auxListParam[1])
    NominalErr.setInput(auxListParam[2])
    SWDevelopmentRate.setInput(auxListParam[3])
    PotErrDetectRate.setInput(auxListParam[4])
    AvgErrPerTask.setInput(auxListParam[5])
    QARate.setInput(auxListParam[6])
    ActualReworkMP.setInput(auxListParam[7])
    DailyMPRework.setInput(auxListParam[8])

    #Setting up eight Auxiliaries from Bottom
    TimeToSmooth.setInput(auxListParam[9])
    MultiplierToRegen.setInput(auxListParam[10])
    ActiveErrorDensity.setInput(auxListParam[11])
    TestingRate.setInput(auxListParam[12])
    ActiveErrorsRetiringFraction.setInput(auxListParam[13])
    PassiveErrorDensity.setInput(auxListParam[16] +
                                 currStateParam.UndetectedPassiveErrors_.curr)

    #filling flows on the top
    ErrGenRate.fillFlowsByAuxs(MultiplierSchedPressure, MultiplierWorkforce,
                               NominalErr, SWDevelopmentRate)
    ErrDetRate.fillFlowsByAuxs(PotErrDetectRate)
    ErrEscapeRate.fillFlowsByAuxs(AvgErrPerTask, QARate)
    ReworkRate.fillFlowsByAuxs(ActualReworkMP, DailyMPRework)

    # updating current state's flows
    currStateParam.updateErrGenRate(ErrGenRate)
    currStateParam.updateErrDetRate(ErrDetRate)
    currStateParam.updateErrEscapeRate(ErrEscapeRate)
    currStateParam.updateReworkRate(ReworkRate)

    # Connecting top to the bottom
    # Error Escape Rate -> Fraction Escaping Errors
    # Rework Rate -> Bad Fix Generation Rate
    FractionEscapingErrors.setInput(auxListParam[14] + ErrEscapeRate.curr)
    BadFixGenRate.setInput(auxListParam[15] + ReworkRate.curr)

    # Filling Flows : six flows from Bottom
    ActiveErrorRegenRate.fillFlowsByAuxs(TimeToSmooth, MultiplierToRegen,
                                         ActiveErrorDensity)
    ActiveErrorDetectAndCorrectRate.fillFlowsByAuxs(ActiveErrorDensity)
    ActiveErrorRetirementRate.fillFlowsByAuxs(TestingRate,
                                              ActiveErrorsRetiringFraction)
    ActiveErrorGenRate.fillFlowsByAuxs(FractionEscapingErrors, BadFixGenRate)
    PassiveErrorGenRate.fillFlowsByAuxs(BadFixGenRate, FractionEscapingErrors)
    PassiveErrorDetectAndCorrectRate.fillFlowsByAuxs(PassiveErrorDensity,
                                                     TestingRate)

    # updating current state's flows: six flows from bottom
    currStateParam.updateActiveErrorRegenRate(ActiveErrorRegenRate)
    currStateParam.updateActiveErrorDetectAndCorrectRate(
        ActiveErrorDetectAndCorrectRate)
    currStateParam.updateActiveErrorRetirementRate(ActiveErrorRetirementRate)
    currStateParam.updateActiveErrorGenRate(ActiveErrorGenRate)
    currStateParam.updatePassiveErrorGenRate(PassiveErrorGenRate)
    currStateParam.updatePassiveErrorDetectAndCorrectRate(
        PassiveErrorDetectAndCorrectRate)

    ## copying current to prev.
    prevStateParam = currStateParam.copyAll("prev")
    return prevStateParam, currStateParam
コード例 #5
0
ファイル: ModelExecAll.py プロジェクト: sbiswas4/59115ASE
def executeModelAll(showFlows):

    ##Nine Unique Auxiliaries : Top
    MultiplierSchedPressure = Auxiliary("MultiplierSchedPressure")
    MultiplierWorkforce = Auxiliary("MultiplierWorkforce")
    NominalErr = Auxiliary("NominalErr")
    SWDevelopmentRate = Auxiliary("SWDevelopmentRate")
    PotErrDetectRate = Auxiliary("PotErrDetectRate")
    QARate = Auxiliary("QARate")
    AvgErrPerTask = Auxiliary("AvgErrPerTask")
    ActualReworkMP = Auxiliary("ActualReworkMP")
    DailyMPRework = Auxiliary("DailyMPRework")

    ## Eight Unique Auxiliaries :Bottom
    TimeToSmooth = Auxiliary("TimeToSmooth")
    MultiplierToRegen = Auxiliary("MultiplierToRegen")
    ActiveErrorDensity = Auxiliary("ActiveErrorDensity")
    TestingRate = Auxiliary("TestingRate")
    PassiveErrorDensity = Auxiliary("PassiveErrorDensity")
    FractionEscapingErrors = Auxiliary("FractionEscapingErrors")
    ActiveErrorsRetiringFraction = Auxiliary("ActiveErrorsRetiringFraction")
    BadFixGenRate = Auxiliary("BadFixGenRate")

    ### Four Flows from Top
    ErrGenRate = Flow("ErrGenRate")
    ErrDetRate = Flow("ErrDetRate")
    ErrEscapeRate = Flow("ErrEscapeRate")
    ReworkRate = Flow("ReworkRate")

    ## Six Flows from Bottom
    ActiveErrorRegenRate = Flow("ActiveErrorRegenRate")
    ActiveErrorDetectAndCorrectRate = Flow("ActiveErrorDetectAndCorrectRate")
    ActiveErrorRetirementRate = Flow("ActiveErrorRetirementRate")
    PassiveErrorDetectAndCorrectRate = Flow("PassiveErrorDetectAndCorrectRate")
    PassiveErrorGenRate = Flow("PassiveErrorGenRate")
    ActiveErrorGenRate = Flow("ActiveErrorGenRate")

    ## we need to fill up auxiliaries ...
    auxDict = utility.createAuxiliaries_All()
    ##States
    curr = StateAll("CurrentState")
    prev = StateAll("PrevState")
    dt = 1
    ##output & test purpose
    stockDict = {}
    for key_, val_ in auxDict.items():
        # current state's stocks are dependent on prev. state's flows
        # some have in and out flows
        curr.PotentiallyDetectableError_.setInput(
            dt * (prev.ErrGenRate_.curr - prev.ErrDetRate_.curr -
                  prev.ErrEscapeRate_.curr))
        curr.DetectedError_.setInput(
            dt * (prev.ErrDetRate_.curr - prev.ReworkRate_.curr))

        # some only have in flows from top
        curr.EscapedError_.setInput(dt * (prev.ErrEscapeRate_.curr))
        curr.ReworkedError_.setInput(dt * (prev.ReworkRate_.curr))

        # Update stock from inflows and outflows from Bottom
        curr.UndetectedActiveErrors_.setInput(
            dt *
            (prev.ActiveErrorRegenRate_.curr + prev.ActiveErrorGenRate_.curr) -
            (prev.ActiveErrorRetirementRate_.curr +
             prev.ActiveErrorDetectAndCorrectRate_.curr))
        curr.UndetectedPassiveErrors_.setInput(
            dt * (prev.ActiveErrorRetirementRate_.curr +
                  prev.PassiveErrorGenRate_.curr) -
            prev.PassiveErrorDetectAndCorrectRate_.curr)

        print "{} ---> {}".format(key_, curr)
        #setup output
        stockDict[key_] = [
            curr.PotentiallyDetectableError_.curr, curr.DetectedError_.curr,
            curr.EscapedError_.curr, curr.ReworkedError_.curr,
            curr.UndetectedActiveErrors_.curr,
            curr.UndetectedPassiveErrors_.curr
        ]
        print "---------------"
        #setting up auxiliaries
        MultiplierSchedPressure.setInput(val_[0])
        MultiplierWorkforce.setInput(val_[1])
        NominalErr.setInput(val_[2])
        SWDevelopmentRate.setInput(val_[3])
        PotErrDetectRate.setInput(val_[4])
        AvgErrPerTask.setInput(val_[5])
        QARate.setInput(val_[6])
        ActualReworkMP.setInput(val_[7])
        DailyMPRework.setInput(val_[8])

        #Setting up eight Auxiliaries from Bottom
        TimeToSmooth.setInput(val_[9])
        MultiplierToRegen.setInput(val_[10])
        ActiveErrorDensity.setInput(val_[11])
        TestingRate.setInput(val_[12])
        ActiveErrorsRetiringFraction.setInput(val_[13])
        PassiveErrorDensity.setInput(val_[16] +
                                     curr.UndetectedPassiveErrors_.curr)

        #filling flows on the top
        ErrGenRate.fillFlowsByAuxs(MultiplierSchedPressure,
                                   MultiplierWorkforce, NominalErr,
                                   SWDevelopmentRate)
        ErrDetRate.fillFlowsByAuxs(PotErrDetectRate)
        ErrEscapeRate.fillFlowsByAuxs(AvgErrPerTask, QARate)
        ReworkRate.fillFlowsByAuxs(ActualReworkMP, DailyMPRework)

        # updating current state's flows
        curr.updateErrGenRate(ErrGenRate)
        curr.updateErrDetRate(ErrDetRate)
        curr.updateErrEscapeRate(ErrEscapeRate)
        curr.updateReworkRate(ReworkRate)

        # Connecting top to the bottom
        # Error Escape Rate -> Fraction Escaping Errors
        # Rework Rate -> Bad Fix Generation Rate
        FractionEscapingErrors.setInput(val_[14] + ErrEscapeRate.curr)
        BadFixGenRate.setInput(val_[15] + ReworkRate.curr)

        # Filling Flows : six flows from Bottom
        ActiveErrorRegenRate.fillFlowsByAuxs(TimeToSmooth, MultiplierToRegen,
                                             ActiveErrorDensity)
        ActiveErrorDetectAndCorrectRate.fillFlowsByAuxs(ActiveErrorDensity)
        ActiveErrorRetirementRate.fillFlowsByAuxs(
            TestingRate, ActiveErrorsRetiringFraction)
        ActiveErrorGenRate.fillFlowsByAuxs(FractionEscapingErrors,
                                           BadFixGenRate)
        PassiveErrorGenRate.fillFlowsByAuxs(BadFixGenRate,
                                            FractionEscapingErrors)
        PassiveErrorDetectAndCorrectRate.fillFlowsByAuxs(
            PassiveErrorDensity, TestingRate)

        # updating current state's flows: six flows from bottom
        curr.updateActiveErrorRegenRate(ActiveErrorRegenRate)
        curr.updateActiveErrorDetectAndCorrectRate(
            ActiveErrorDetectAndCorrectRate)
        curr.updateActiveErrorRetirementRate(ActiveErrorRetirementRate)
        curr.updateActiveErrorGenRate(ActiveErrorGenRate)
        curr.updatePassiveErrorGenRate(PassiveErrorGenRate)
        curr.updatePassiveErrorDetectAndCorrectRate(
            PassiveErrorDetectAndCorrectRate)

        if (showFlows):
            print "Printing F-L-O-W-S !"
            print "key, flow value ---> {}, {}".format(key_, curr.getFlows())
        ## copying current to prev.
        prev = curr.copyAll("prev")
        print "###################"
    return stockDict
コード例 #6
0
ファイル: Converter.py プロジェクト: ProfNimnul/converter
from Auxiliary import Auxiliary
import Statement
import datetime

aux = Auxiliary()


try:
    fullpath, filename, file_extention = aux.getSourceStatementName()
    print (filename)
except AttributeError:
    exit(0)

acceptext = [".DBF", ".CSV"]


if file_extention not in acceptext:
    exit(0)


elif file_extention == ".CSV":

    statement = Statement.MarfinStatement()
elif file_extention == ".DBF":


    statement = Statement.PivdennyStatement()

suffix = statement.createOutDbfName()

outputDbfName = fullpath +"\\"+suffix.upper() + ".DBF"
コード例 #7
0
ファイル: ModelExecAll.py プロジェクト: manish211/59115ASE
def executeModelForBaseline(auxListParam, currStateParam, prevStateParam, dt):
   ##Nine Unique Auxiliaries : Top 
   MultiplierSchedPressure = Auxiliary("MultiplierSchedPressure")
   MultiplierWorkforce = Auxiliary("MultiplierWorkforce")
   NominalErr = Auxiliary("NominalErr")
   SWDevelopmentRate = Auxiliary("SWDevelopmentRate")
   PotErrDetectRate = Auxiliary("PotErrDetectRate")
   QARate = Auxiliary("QARate")
   AvgErrPerTask = Auxiliary("AvgErrPerTask")
   ActualReworkMP = Auxiliary("ActualReworkMP")
   DailyMPRework = Auxiliary("DailyMPRework")


   ## Eight Unique Auxiliaries :Bottom
   TimeToSmooth = Auxiliary("TimeToSmooth")
   MultiplierToRegen = Auxiliary("MultiplierToRegen")
   ActiveErrorDensity = Auxiliary("ActiveErrorDensity")
   TestingRate = Auxiliary("TestingRate")
   PassiveErrorDensity = Auxiliary("PassiveErrorDensity")
   FractionEscapingErrors = Auxiliary("FractionEscapingErrors")
   ActiveErrorsRetiringFraction = Auxiliary("ActiveErrorsRetiringFraction")
   BadFixGenRate = Auxiliary("BadFixGenRate")

   ### Four Flows from Top
   ErrGenRate = Flow("ErrGenRate")
   ErrDetRate = Flow("ErrDetRate")
   ErrEscapeRate = Flow("ErrEscapeRate")
   ReworkRate = Flow("ReworkRate")


   ## Six Flows from Bottom
   ActiveErrorRegenRate = Flow("ActiveErrorRegenRate")
   ActiveErrorDetectAndCorrectRate = Flow("ActiveErrorDetectAndCorrectRate")
   ActiveErrorRetirementRate = Flow("ActiveErrorRetirementRate")
   PassiveErrorDetectAndCorrectRate = Flow("PassiveErrorDetectAndCorrectRate")
   PassiveErrorGenRate = Flow("PassiveErrorGenRate")
   ActiveErrorGenRate = Flow("ActiveErrorGenRate")    
    
   # current state's stocks are dependent on prev. state's flows
   # some have in and out flows
   currStateParam.PotentiallyDetectableError_.setInput(dt * (prevStateParam.ErrGenRate_.curr - prevStateParam.ErrDetRate_.curr - prevStateParam.ErrEscapeRate_.curr ))
   currStateParam.DetectedError_.setInput( dt*( prevStateParam.ErrDetRate_.curr - prevStateParam.ReworkRate_.curr  ))

   # some only have in flows from top
   currStateParam.EscapedError_.setInput( dt*(prevStateParam.ErrEscapeRate_.curr))
   currStateParam.ReworkedError_.setInput(dt*(prevStateParam.ReworkRate_.curr))

   # Update stock from inflows and outflows from Bottom
   currStateParam.UndetectedActiveErrors_.setInput(dt * (prevStateParam.ActiveErrorRegenRate_.curr + prevStateParam.ActiveErrorGenRate_.curr) - (prevStateParam.ActiveErrorRetirementRate_.curr + prevStateParam.ActiveErrorDetectAndCorrectRate_.curr) )
   currStateParam.UndetectedPassiveErrors_.setInput(dt * (prevStateParam.ActiveErrorRetirementRate_.curr + prevStateParam.PassiveErrorGenRate_.curr)- prevStateParam.PassiveErrorDetectAndCorrectRate_.curr) 
   

   #setting up auxiliaries
   MultiplierSchedPressure.setInput(auxListParam[0])
   MultiplierWorkforce.setInput(auxListParam[1])
   NominalErr.setInput(auxListParam[2])
   SWDevelopmentRate.setInput(auxListParam[3])
   PotErrDetectRate.setInput(auxListParam[4])
   AvgErrPerTask.setInput(auxListParam[5])
   QARate.setInput(auxListParam[6])
   ActualReworkMP.setInput(auxListParam[7])
   DailyMPRework.setInput(auxListParam[8])

   #Setting up eight Auxiliaries from Bottom
   TimeToSmooth.setInput(auxListParam[9])
   MultiplierToRegen.setInput(auxListParam[10])
   ActiveErrorDensity.setInput(auxListParam[11])
   TestingRate.setInput(auxListParam[12])
   ActiveErrorsRetiringFraction.setInput(auxListParam[13])
   PassiveErrorDensity.setInput(auxListParam[16] + currStateParam.UndetectedPassiveErrors_.curr)

   #filling flows on the top
   ErrGenRate.fillFlowsByAuxs(MultiplierSchedPressure, MultiplierWorkforce, NominalErr, SWDevelopmentRate)
   ErrDetRate.fillFlowsByAuxs(PotErrDetectRate)
   ErrEscapeRate.fillFlowsByAuxs(AvgErrPerTask, QARate)
   ReworkRate.fillFlowsByAuxs(ActualReworkMP, DailyMPRework)
   
   # updating current state's flows
   currStateParam.updateErrGenRate(ErrGenRate)
   currStateParam.updateErrDetRate(ErrDetRate)
   currStateParam.updateErrEscapeRate(ErrEscapeRate)
   currStateParam.updateReworkRate(ReworkRate)   

   # Connecting top to the bottom 
   # Error Escape Rate -> Fraction Escaping Errors
   # Rework Rate -> Bad Fix Generation Rate   
   FractionEscapingErrors.setInput(auxListParam[14] + ErrEscapeRate.curr) 
   BadFixGenRate.setInput(auxListParam[15] + ReworkRate.curr)
   
   # Filling Flows : six flows from Bottom
   ActiveErrorRegenRate.fillFlowsByAuxs(TimeToSmooth, MultiplierToRegen, ActiveErrorDensity)
   ActiveErrorDetectAndCorrectRate.fillFlowsByAuxs(ActiveErrorDensity)
   ActiveErrorRetirementRate.fillFlowsByAuxs(TestingRate, ActiveErrorsRetiringFraction)
   ActiveErrorGenRate.fillFlowsByAuxs(FractionEscapingErrors, BadFixGenRate)
   PassiveErrorGenRate.fillFlowsByAuxs(BadFixGenRate, FractionEscapingErrors)
   PassiveErrorDetectAndCorrectRate.fillFlowsByAuxs(PassiveErrorDensity, TestingRate)


   # updating current state's flows: six flows from bottom
   currStateParam.updateActiveErrorRegenRate(ActiveErrorRegenRate)
   currStateParam.updateActiveErrorDetectAndCorrectRate(ActiveErrorDetectAndCorrectRate)
   currStateParam.updateActiveErrorRetirementRate(ActiveErrorRetirementRate)
   currStateParam.updateActiveErrorGenRate(ActiveErrorGenRate)
   currStateParam.updatePassiveErrorGenRate(PassiveErrorGenRate)
   currStateParam.updatePassiveErrorDetectAndCorrectRate(PassiveErrorDetectAndCorrectRate)


   ## copying current to prev. 
   prevStateParam = currStateParam.copyAll("prev") 
   return prevStateParam, currStateParam     
コード例 #8
0
ファイル: ModelExecAll.py プロジェクト: manish211/59115ASE
def executeModelAll(showFlows):

  ##Nine Unique Auxiliaries : Top 
  MultiplierSchedPressure = Auxiliary("MultiplierSchedPressure")
  MultiplierWorkforce = Auxiliary("MultiplierWorkforce")
  NominalErr = Auxiliary("NominalErr")
  SWDevelopmentRate = Auxiliary("SWDevelopmentRate")
  PotErrDetectRate = Auxiliary("PotErrDetectRate")
  QARate = Auxiliary("QARate")
  AvgErrPerTask = Auxiliary("AvgErrPerTask")
  ActualReworkMP = Auxiliary("ActualReworkMP")
  DailyMPRework = Auxiliary("DailyMPRework")


  ## Eight Unique Auxiliaries :Bottom
  TimeToSmooth = Auxiliary("TimeToSmooth")
  MultiplierToRegen = Auxiliary("MultiplierToRegen")
  ActiveErrorDensity = Auxiliary("ActiveErrorDensity")
  TestingRate = Auxiliary("TestingRate")
  PassiveErrorDensity = Auxiliary("PassiveErrorDensity")
  FractionEscapingErrors = Auxiliary("FractionEscapingErrors")
  ActiveErrorsRetiringFraction = Auxiliary("ActiveErrorsRetiringFraction")
  BadFixGenRate = Auxiliary("BadFixGenRate")

  ### Four Flows from Top
  ErrGenRate = Flow("ErrGenRate")
  ErrDetRate = Flow("ErrDetRate")
  ErrEscapeRate = Flow("ErrEscapeRate")
  ReworkRate = Flow("ReworkRate")


  ## Six Flows from Bottom
  ActiveErrorRegenRate = Flow("ActiveErrorRegenRate")
  ActiveErrorDetectAndCorrectRate = Flow("ActiveErrorDetectAndCorrectRate")
  ActiveErrorRetirementRate = Flow("ActiveErrorRetirementRate")
  PassiveErrorDetectAndCorrectRate = Flow("PassiveErrorDetectAndCorrectRate")
  PassiveErrorGenRate = Flow("PassiveErrorGenRate")
  ActiveErrorGenRate = Flow("ActiveErrorGenRate")

  ## we need to fill up auxiliaries ...
  auxDict = utility.createAuxiliaries_All()
  ##States
  curr = StateAll("CurrentState")
  prev = StateAll("PrevState")
  dt = 1
  ##output & test purpose
  stockDict ={}
  for key_,val_ in auxDict.items():
   # current state's stocks are dependent on prev. state's flows
   # some have in and out flows
   curr.PotentiallyDetectableError_.setInput(dt * (prev.ErrGenRate_.curr - prev.ErrDetRate_.curr - prev.ErrEscapeRate_.curr ))
   curr.DetectedError_.setInput( dt*( prev.ErrDetRate_.curr - prev.ReworkRate_.curr  ))

   # some only have in flows from top
   curr.EscapedError_.setInput( dt*(prev.ErrEscapeRate_.curr))
   curr.ReworkedError_.setInput(dt*(prev.ReworkRate_.curr))

   # Update stock from inflows and outflows from Bottom
   curr.UndetectedActiveErrors_.setInput(dt * (prev.ActiveErrorRegenRate_.curr + prev.ActiveErrorGenRate_.curr) - (prev.ActiveErrorRetirementRate_.curr + prev.ActiveErrorDetectAndCorrectRate_.curr) )
   curr.UndetectedPassiveErrors_.setInput(dt * (prev.ActiveErrorRetirementRate_.curr + prev.PassiveErrorGenRate_.curr)- prev.PassiveErrorDetectAndCorrectRate_.curr) 
   
   print "{} ---> {}".format( key_,  curr)
   #setup output
   stockDict[key_]=[curr.PotentiallyDetectableError_.curr, curr.DetectedError_.curr, curr.EscapedError_.curr, curr.ReworkedError_.curr, curr.UndetectedActiveErrors_.curr,curr.UndetectedPassiveErrors_.curr]
   print "---------------"
   #setting up auxiliaries
   MultiplierSchedPressure.setInput(val_[0])
   MultiplierWorkforce.setInput(val_[1])
   NominalErr.setInput(val_[2])
   SWDevelopmentRate.setInput(val_[3])
   PotErrDetectRate.setInput(val_[4])
   AvgErrPerTask.setInput(val_[5])
   QARate.setInput(val_[6])
   ActualReworkMP.setInput(val_[7])
   DailyMPRework.setInput(val_[8])

   #Setting up eight Auxiliaries from Bottom
   TimeToSmooth.setInput(val_[9])
   MultiplierToRegen.setInput(val_[10])
   ActiveErrorDensity.setInput(val_[11])
   TestingRate.setInput(val_[12])
   ActiveErrorsRetiringFraction.setInput(val_[13])
   PassiveErrorDensity.setInput(val_[16] + curr.UndetectedPassiveErrors_.curr)

   #filling flows on the top
   ErrGenRate.fillFlowsByAuxs(MultiplierSchedPressure, MultiplierWorkforce, NominalErr, SWDevelopmentRate)
   ErrDetRate.fillFlowsByAuxs(PotErrDetectRate)
   ErrEscapeRate.fillFlowsByAuxs(AvgErrPerTask, QARate)
   ReworkRate.fillFlowsByAuxs(ActualReworkMP, DailyMPRework)
   
   # updating current state's flows
   curr.updateErrGenRate(ErrGenRate)
   curr.updateErrDetRate(ErrDetRate)
   curr.updateErrEscapeRate(ErrEscapeRate)
   curr.updateReworkRate(ReworkRate)   

   # Connecting top to the bottom 
   # Error Escape Rate -> Fraction Escaping Errors
   # Rework Rate -> Bad Fix Generation Rate   
   FractionEscapingErrors.setInput(val_[14] + ErrEscapeRate.curr) 
   BadFixGenRate.setInput(val_[15] + ReworkRate.curr)
   
   # Filling Flows : six flows from Bottom
   ActiveErrorRegenRate.fillFlowsByAuxs(TimeToSmooth, MultiplierToRegen, ActiveErrorDensity)
   ActiveErrorDetectAndCorrectRate.fillFlowsByAuxs(ActiveErrorDensity)
   ActiveErrorRetirementRate.fillFlowsByAuxs(TestingRate, ActiveErrorsRetiringFraction)
   ActiveErrorGenRate.fillFlowsByAuxs(FractionEscapingErrors, BadFixGenRate)
   PassiveErrorGenRate.fillFlowsByAuxs(BadFixGenRate, FractionEscapingErrors)
   PassiveErrorDetectAndCorrectRate.fillFlowsByAuxs(PassiveErrorDensity, TestingRate)


   # updating current state's flows: six flows from bottom
   curr.updateActiveErrorRegenRate(ActiveErrorRegenRate)
   curr.updateActiveErrorDetectAndCorrectRate(ActiveErrorDetectAndCorrectRate)
   curr.updateActiveErrorRetirementRate(ActiveErrorRetirementRate)
   curr.updateActiveErrorGenRate(ActiveErrorGenRate)
   curr.updatePassiveErrorGenRate(PassiveErrorGenRate)
   curr.updatePassiveErrorDetectAndCorrectRate(PassiveErrorDetectAndCorrectRate)

   if(showFlows):
     print "Printing F-L-O-W-S !"  
     print "key, flow value ---> {}, {}".format(key_, curr.getFlows())      
   ## copying current to prev. 
   prev = curr.copyAll("prev") 
   print "###################"
  return stockDict