Ejemplo n.º 1
0
 def get_text(self):
     """format contents of this item for writing to file"""
     # Use default get_text, but need to skip LID if it is NONE
     lines = []
     for line in Section.get_text(self).splitlines():
         if line.split() != ["LID", "NONE"]:
             lines.append(line)
     return '\n'.join(lines)
 def get_text(self):
     if self.global_efficiency == "75" \
        and self.global_price == "0.0" \
        and self.global_pattern == '' \
        and self.demand_charge == "0.0" \
        and len(self.pumps) == 0:
         return ''  # This section has nothing different from defaults, return blank
     else:
         txt = []
         txt.append(Section.get_text(self))  # Get text for the global variables using metadata
         for pump_energy in self.pumps:      # Add text for each pump energy
             txt.append(pump_energy.get_text())
         return '\n'.join(txt)
Ejemplo n.º 3
0
 def get_text(self):
     if self.global_efficiency == "75" \
        and self.global_price == "0.0" \
        and self.global_pattern == '' \
        and self.demand_charge == "0.0" \
        and len(self.pumps) == 0:
         return ''  # This section has nothing different from defaults, return blank
     else:
         txt = []
         txt.append(Section.get_text(
             self))  # Get text for the global variables using metadata
         for pump_energy in self.pumps:  # Add text for each pump energy
             txt.append(pump_energy.get_text())
         return '\n'.join(txt)
Ejemplo n.º 4
0
 def get_text(self):
     """Contents of this item formatted for writing to file"""
     # First, add the values in this section stored directly in this class
     text_list = [Section.get_text(self)]
     if self.dates is not None:  # Add the values stored in Dates class
         text_list.append(General.section_comments[0])
         text_list.append(self.dates.get_text().replace(self.SECTION_NAME + '\n', ''))
     if self.time_steps is not None:  # Add the values stored in TimeSteps class
         text_list.append(General.section_comments[1])
         text_list.append(self.time_steps.get_text().replace(self.SECTION_NAME + '\n', ''))
     if self.dynamic_wave is not None:  # Add the values stored in DynamicWave class
         text_list.append(General.section_comments[2])
         text_list.append(self.dynamic_wave.get_text().replace(self.SECTION_NAME + '\n', ''))
     return '\n'.join(text_list)
Ejemplo n.º 5
0
 def get_text(self):
     """Contents of this item formatted for writing to file"""
     # First, add the values in this section stored directly in this class
     # Omit COMPATIBILITY option if it is 5, this is assumed now and is no longer listed as an option in 5.1
     text_list = [
         Section.get_text(self).replace(
             self.field_format.format("COMPATIBILITY", "5"), '')
     ]
     if self.dates is not None:  # Add the values stored in Dates class
         text_list.append(General.section_comments[0])
         text_list.append(self.dates.get_text().replace(
             self.SECTION_NAME + '\n', ''))
     if self.time_steps is not None:  # Add the values stored in TimeSteps class
         text_list.append(General.section_comments[1])
         text_list.append(self.time_steps.get_text().replace(
             self.SECTION_NAME + '\n', ''))
     if self.dynamic_wave is not None:  # Add the values stored in DynamicWave class
         text_list.append(General.section_comments[2])
         text_list.append(self.dynamic_wave.get_text().replace(
             self.SECTION_NAME + '\n', ''))
     return '\n'.join(text_list)
Ejemplo n.º 6
0
 def get_text(self):
     txt = Section.get_text(self)
     if self.parameters:
         txt += '\n' + '\n'.join(self.parameters)
     return txt