def __init__(self,facility):
     self.measured_inventory = 0
     self.edge = edge_transition_class(facility,0)
     self.initial_inventory = facility.initial_inventory
     self.storage_buffer = storage_buffer_class(facility, self.initial_inventory)
     self.kmp = kmp_class(facility,0)
     facility_component_class.__init__(self, 0, 0, 0, "first_storage_unit", "manager", None)
    def __init__(self,facility):
        """
        The fabricator initializes all of the objects that are its own constituents.  That includes the melter,
        trimmer, recycle storage, four kmp's, and the edge transitions between such.

        The expected batch and heel weights are changed everytime a component that changes those state variables
        processes a batch.  
        """
        self.edge = edge_transition_class(facility,0)
        self.kmp = []
        for n in range(4):
            self.kmp.append(kmp_class(facility,n))
        self.melter= melter_class(facility)
        self.trimmer = trimmer_class(facility)
        self.recycle_storage = recycle_storage_class(facility)
        self.expected_campaign_muf = 0
        self.measured_campaign_muf = 0
        self.true_campaign_muf = 0
        facility_component_class.__init__(self, 0, 0, 0, "fuel_fabricator", "manager", None)
Esempio n. 3
0
    def __init__(self, root_dir, subsystem):
        """
        Although large, all this part does is to read in the number of input files required to start up the
        facility. 
        
        """
        # variable initiation
        self.operation_time = 0
        self.total_campaign = 1

        self.measured_muf = 0
        self.false_alarm_count = 0
        self.melter_did_fail = False
        self.did_conduct_inspection = False

        self.log_file = open(root_dir + '/log.txt', 'w')
        self.root_dir = root_dir
        self.subsystem = subsystem

        self.sequential_muf = 0.0
        self.failure_check = False
        self.total_muf_cal = 0
        self.muf_cal_1 = 0
        self.muf_cal_2 = 0
        self.muf_cal_3 = 0

        self.false_alarm_count_1 = 0
        self.false_alarm_count_2 = 0
        self.false_alarm_count_3 = 0
        self.melter_failure_count = 0
        # Begin Preprocessing
        self.log_file.write('Fuel fabrication \n\nPREPROCESSING\n')

        # Get a home directory path.
        home_dir = open(self.root_dir +
                        '/simulation/meta.data/home.dir.inp').read()

        # Get directory paths.
        directory_path_file = open(
            self.root_dir +
            '/simulation/meta.data/fuel.fabrication_simulation.dir.inp'
        ).readlines()

        directory_paths = directory_path_file[0].split(
            ',')  #split path data and set directories.

        # Get directory paths for input & output files.
        self.input_dir = directory_paths[0]
        self.output_dir = directory_paths[1]

        # Get paths for subdirectories in 'input' directory.
        self.edge_transition_dir = directory_paths[2]
        self.failure_distribution_dir = directory_paths[3]
        self.failure_equipment_dir = directory_paths[4]
        self.kmps_dir = directory_paths[5]
        self.process_states_dir = directory_paths[6]
        self.system_false_alarm_dir = directory_paths[7]

        # Get paths for directories in 'output' directory.
        self.data_dir = directory_paths[8]
        self.figures_dir = directory_paths[9]

        # Get paths for directories in 'data' directory.
        self.system_odir = directory_paths[10]
        self.material_flow_odir = directory_paths[11]
        self.inventory_odir = directory_paths[12]
        self.false_alarm_odir = directory_paths[13]
        self.kmps_odir = directory_paths[14]
        self.muf_odir = directory_paths[15]
        self.equipment_failure_odir = directory_paths[16]

        # Get paths for directories in 'figures' directory.
        self.system_gdir = directory_paths[17]
        self.material_flow_gdir = directory_paths[18]
        self.inventory_gdir = directory_paths[19]
        self.false_alarm_gdir = directory_paths[20]
        self.kmps_gdir = directory_paths[21]
        self.muf_gdir = directory_paths[22]
        self.equipment_failure_gdir = directory_paths[23]

        # Read input data
        self.total_operation_time = np.loadtxt(
            self.process_states_dir + '/facility.operation.inp'
        )  #250 days, np.loadtxt loads data from a text file.
        self.end_of_campaign_time_delay = np.loadtxt(
            self.system_false_alarm_dir + '/system.inspection.time.inp',
            usecols=[1]
        )  # End of campaign inspection time: 4 hours = 0.1667 days. 'usecols' defines which columns to read.
        self.end_of_campaign_alarm_threshold = np.loadtxt(
            self.system_false_alarm_dir +
            '/eoc.alarm.threshold.inp')  # Threshold = 2.4kg.
        self.facility_inspection_time = np.loadtxt(
            self.system_false_alarm_dir +
            '/facility.inspection.time.inp')  # 4 hours = 0.1667 days
        self.initial_inventory = np.loadtxt(
            self.process_states_dir +
            '/unprocessed.storage.inventory.inp')  # 10,000 KG

        # Open output files
        self.system_time_output = open(
            self.system_odir + '/facility.operation.time.out',
            'w+')  # facility operation time output file
        self.system_info_output = open(
            self.system_odir + '/system_info.out',
            'w+')  # facility operation time, # of campaign, # of false alarms
        self.muf_check_output = open(self.kmps_odir + '/muf_check.out',
                                     'w+')  # muf info

        # Write data to output files
        self.system_time_output.write('%.4f\n' % (self.operation_time))
        self.system_info_output.write(
            '%.4f\t%i\t%i\n' %
            (self.operation_time, self.total_campaign, self.false_alarm_count))

        # Initialize facility components
        self.storage_buffer = storage_buffer_class(self,
                                                   self.initial_inventory)
        self.melter = melter_class(self)
        self.trimmer = trimmer_class(self)
        self.product_storage = product_storage_class(self)
        self.recycle_storage = recycle_storage_class(self)

        # Initialize the edge transition.
        self.edge = edge_transition_class(self, 0)

        # Initialize key measurement points.
        self.kmp = []
        for n in range(4):  # 0,1,2,3
            self.kmp.append(kmp_class(self, n))

        # total amount of heel + batch initilization

        self.total = batch_class(0, "total")

        # Log end of Preprocess
        self.log_file.write('\n\nEND PREPROCESSING \n\n\n')
 def __init__(self,facility):
     self.measured_inventory = 0
     self.edge = edge_transition_class(facility,0)
     self.product_storage = product_storage_class(facility)
     self.kmp = kmp_class(facility,2)
     facility_component_class.__init__(self, 0, 0, 0, "final_storage_unit", "manager", None)