Generate an excel file containing the parameter sets in a format you can import into SimaPro Developer.

        The file will be called "ParameterSet_<ModelName>_input_file.xlsx"

def generate_parameter_set_excel_file(self):
        """
        Generate an excel file containing the parameter sets in a format you can import into SimaPro Developer.

        The file will be called "ParameterSet_<ModelName>_input_file.xlsx"
        """
        
        parameter_sets = self.parameter_sets

        p_set = []
        filename = "ParameterSet_{}_input_file.xlsx".format(self.name)

        if self.save_option == 'curdir':
            base_dir = os.getcwd()
        else:
            base_dir = os.path.join(storage.simapro_dir, self.name.replace(" ", "_"))

        if not os.path.isdir(base_dir):
            os.mkdir(base_dir)

        p_set_name = os.path.join(base_dir, filename)

        p = self.params
        for k in p.keys():
            if p[k]['function'] is None:
                base_dict = {'id': k, 'name': p[k]['description'], 'unit': p[k]['unit']}

                for s in parameter_sets.keys():
                    base_dict[s] = parameter_sets[s][k]

                p_set.append(base_dict)
            else:
                pass
                #print("{} is determined by a function".format(p[k]['description']))

        for e in self.ext_params:
            base_dict = {'id': '{}'.format(e['name']), 'type': 'external', 'name': e['description'], 'unit': ''}

            for s in parameter_sets.keys():
                    base_dict[s] = parameter_sets[s][e['name']]

            p_set.append(base_dict)

        df = pd.DataFrame(p_set)

        with pd.ExcelWriter(p_set_name, engine='xlsxwriter') as writer:

            ps_columns = [k for k in parameter_sets.keys()]
            #print (ps_columns)
            my_columns = ['name', 'unit', 'id']
            
            my_columns.extend(ps_columns)
            #print (my_columns)

            #print(df)

            df.to_excel(writer, sheet_name=self.name, columns=my_columns, index=False, merge_cells=False)
       
        return p_set_name