Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.3 kB
7
Indexable
Never
def estimate_cycle_costs(price_signals, nominal_power=2, usable_capacity=4, efficiency=0.9, target_average_cycles=1.5, max_cycles_per_day=2.5):
    total_cycle_costs = 0
    total_cycles = 0

    for price in price_signals:
        max_energy = nominal_power * efficiency
        energy_price = price * max_energy
        cycles_for_hour = max(0, min(max_energy / usable_capacity, max_cycles_per_day - total_cycles))
        total_cycles += cycles_for_hour
        total_cycle_costs += cycles_for_hour * energy_price

    average_cycles = total_cycles / len(price_signals)
    required_cycle_costs = (target_average_cycles * len(price_signals) * usable_capacity) / efficiency

    return total_cycle_costs, average_cycles, required_cycle_costs

# Example usage:
price_signals = [
    6, 4, 4, 6, 4, 4, 5, 6, 4, 4, 5, 7, 3, 2, 3, 1, 2, 4, 5, 2,
    4, 6, 9, 2, 4, 3, 6, 2, 4, 4, 6, 5, 5, 6, 7, 6, 5, 6, 8, 5,
    6, 6, 6, 7, 6, 6, 6, 4, 4, 6, 7, 4, 6, 8, 1, 6, 7, 8, 9, 7,
    8, 9, 0, 7, 0, 1, 0, 1, 9, 1, 8, 1, 9, 9, 7, 1, 9, 8, 5, 1,
    7, 7, 6, 1, 7, 9, 4, 8, 6, 6, 3, 8, 2, 6, 6, 4
]

total_costs, avg_cycles, required_costs = estimate_cycle_costs(price_signals)
print(f"Total Cycle Costs: {total_costs}")
print(f"Average Cycles: {avg_cycles}")
print(f"Required Cycle Costs for Target Average Cycles: {required_costs}")