<commit_before># frozen_string_literal: true

module Qernel
  module NodeApi
    # Supplies the Node API with methods to calculate the yearly costs of one plant.
    #
    # These methods are used in conversion.rb to offer a possibility to convert to a number of
    # different units.
    module Cost
      # Public: Calculates the input capacity of a typical plant, based on the  output capacity in
      # MW.
      #
      # If the node has an electrical efficiency and capacity this is used to calculate the input
      # capacity. Otherwise it checks for a heat capacity and heat efficiency. If this can also not
      # be found it will try cooling.
      #
      # Finally it will try the attribute typical_input_capacity (currently only used for electric
      # transport). If all return nil 0.0 will be used. This should only happen for statistical
      # nodes.
      #
      # Return a float of the input capacity of a typical plant in MWinput
      def input_capacity
        fetch(:input_capacity) do
          typical_input_capacity ||
            electric_based_input_capacity ||
            heat_based_input_capacity ||
            cooling_based_input_capacity ||
            0.0
        end
      end

      # Public: Calculates the inital investment costs of a plant.
      #
      # Based on the initial investment (purchase costs), installation costs and the additional cost
      # for CCS (if applicable)
      #
      # Returns a numeric value representing cost per plant.
      def total_initial_investment
        fetch(:total_initial_investment) do
          if initial_investment.nil? && ccs_investment.nil? &&
              cost_of_installing.nil? && storage_costs&.zero?
            nil
          else
            (initial_investment || 0.0) +
              (ccs_investment || 0.0) +
              (cost_of_installing || 0.0) +
              (storage_costs || 0.0)
          end
        end
      end<commit_msg>Update documentation for `input_capacity`<commit_after># frozen_string_literal: true

module Qernel
  module NodeApi
    # Supplies the Node API with methods to calculate the yearly costs of one plant.
    #
    # These methods are used in conversion.rb to offer a possibility to convert to a number of
    # different units.
    module Cost
      # Public: Calculates the input capacity of a typical plant, based on the  output capacity in
      # MW.
      #
      # If the node has a "typical_input_capacity" defined, this value is always used. When no
      # typical input capacity is defined (in the node document), the input capacity will be
      # calculated based on the electricity, heat, or cooling inputs.
      #
      # Return a float of the input capacity of a typical plant in MWinput
      def input_capacity
        fetch(:input_capacity) do
          typical_input_capacity ||
            electric_based_input_capacity ||
            heat_based_input_capacity ||
            cooling_based_input_capacity ||
            0.0
        end
      end

      # Public: Calculates the inital investment costs of a plant.
      #
      # Based on the initial investment (purchase costs), installation costs and the additional cost
      # for CCS (if applicable)
      #
      # Returns a numeric value representing cost per plant.
      def total_initial_investment
        fetch(:total_initial_investment) do
          if initial_investment.nil? && ccs_investment.nil? &&
              cost_of_installing.nil? && storage_costs&.zero?
            nil
          else
            (initial_investment || 0.0) +
              (ccs_investment || 0.0) +
              (cost_of_installing || 0.0) +
              (storage_costs || 0.0)
          end
        end
      end
{'fraction_non_alphanumeric': 0.05510752688172043, 'fraction_numerical': 0.005913978494623656, 'mean_word_length': 2.1641156462585034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2117268', 'n_tokens_mistral': 976, 'n_tokens_neox': 947, 'n_words': 379}