You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
442 lines
9.8 KiB
Plaintext
442 lines
9.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 54,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"The autoreload extension is already loaded. To reload it, use:\n",
|
|
" %reload_ext autoreload\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from notepad import WaterStorage\n",
|
|
"\n",
|
|
"%load_ext autoreload\n",
|
|
"%autoreload 2"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Developments steps to take: \n",
|
|
"* Test the WaterStorage\n",
|
|
"* Create some example for WaterStorage\n",
|
|
"* Define interactions WaterStorage <> Heatpump\n",
|
|
"* Create some example for WaterStorage + Heatpump\n",
|
|
"* Develop the interactions --> Create working examples"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## WaterStorage"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Functional requirements for the WaterStorage:\n",
|
|
"* Given: \n",
|
|
" * Size / capacity\n",
|
|
" * Temperature in/out\n",
|
|
" * Max power\n",
|
|
" * Roundtripp efficiency\n",
|
|
"* It should be able to execute commands, like: \n",
|
|
" * Charge\n",
|
|
" * Discharge\n",
|
|
" * Whats the storage level? \n",
|
|
" * Assign financials \n",
|
|
" * Take into account storage losses (time dependent)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 55,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"waterstorage = WaterStorage(\n",
|
|
" name='MyStorage',\n",
|
|
" max_power=10,\n",
|
|
" min_power=-10,\n",
|
|
" roundtrip_eff=0.90,\n",
|
|
" specific_heat_capacity =1.16*1e-3,\n",
|
|
" volume = 500,\n",
|
|
" lifetime = 25,\n",
|
|
" min_temperature = 328, #K\n",
|
|
" max_temperature = 368 #K\n",
|
|
" \n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 56,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"Tsink = 413 #K\n",
|
|
"Tsource = 333 #K\n",
|
|
"Tref = 273 #K\n",
|
|
"hp_capacity = 31 #MW\n",
|
|
"demand = 25 #MW\n",
|
|
"Cp = 4190\n",
|
|
"MW_to_J_per_s = 1000_000\n",
|
|
"hp_capacity *= MW_to_J_per_s\n",
|
|
"demand *= MW_to_J_per_s"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 57,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"52.84691442209342"
|
|
]
|
|
},
|
|
"execution_count": 57,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"def hp_mass_flow (hp_capacity, Tsink, Tref, Cp):\n",
|
|
" return hp_capacity /(Cp*(Tsink - Tref)) \n",
|
|
"hp_mass_flow (31_000_000, 413, 273, 4190)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 58,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"42.61847937265598"
|
|
]
|
|
},
|
|
"execution_count": 58,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"def process_mass_flow (demand, Tsink, Tref, Cp):\n",
|
|
" return demand /(Cp*(Tsink - Tref)) \n",
|
|
"process_mass_flow (25_000_000, 413, 273, 4190)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 59,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"5.866"
|
|
]
|
|
},
|
|
"execution_count": 59,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"charge_mass_flow = 52 - 42 #can be written as a functiality\n",
|
|
"charge_heat = (charge_mass_flow * Cp * (Tsink - Tref)) / MW_to_J_per_s\n",
|
|
"charge_heat"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 60,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# charge_mass_flow = 52 - 42 #should be written as function\n",
|
|
"# def charge_heat (charge_mass_flow, Cp, Tsink, Tref, MW_to_J_per_s):\n",
|
|
"# return (charge_mass_flow * Cp * (Tsink - Tref)) / MW_to_J_per_s\n",
|
|
"# charge_heat (10, 4190, 413, 273, 1000_000)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 61,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"99.44311853619729"
|
|
]
|
|
},
|
|
"execution_count": 61,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"def source_mass_flow (demand, Tsource, Tref, Cp):\n",
|
|
" return demand /(Cp*(Tsource - Tref)) \n",
|
|
"source_mass_flow (25_000_000, 333, 273, 4190) "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 62,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"10.199723652807435"
|
|
]
|
|
},
|
|
"execution_count": 62,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"efficiency = 0.7\n",
|
|
"Tdischarge = 95 + 273\n",
|
|
"heat_output = 5.8 * efficiency\n",
|
|
"heat_output *= MW_to_J_per_s\n",
|
|
"discharge_mass_flow = heat_output /(Cp*(Tdischarge - Tref)) \n",
|
|
"discharge_mass_flow"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 63,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"4059999.9999999995"
|
|
]
|
|
},
|
|
"execution_count": 63,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"heat_output"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 64,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"63.18181818181818"
|
|
]
|
|
},
|
|
"execution_count": 64,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Tsource_new = (discharge_mass_flow * T_discharge + Tsource * source_mass_flow) / (discharge_mass_flow + source_mass_flow)\n",
|
|
"Tsource_new = (10 * 95 + 60*100) / (10+100)\n",
|
|
"Tsource_new"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 65,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"dict_keys(['name', 'id', 'max_power', 'min_power', 'modes', 'roundtrip_eff', 'specific_heat_capacity', 'volume', 'lifetime', 'min_temperature', 'max_temperature', 'delta_T', 'energy_density', 'max_storage_capacity'])"
|
|
]
|
|
},
|
|
"execution_count": 65,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"waterstorage.__dict__.keys()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 66,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"23.2"
|
|
]
|
|
},
|
|
"execution_count": 66,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# max_storage_capacity is in MWh and it should inherit MWh to MW conversion from Assets\n",
|
|
"# MW = MWh / self.time_factor\n",
|
|
"waterstorage.max_storage_capacity"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 67,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# chargelevel = self.chargelevel\n",
|
|
"# max_charging = chargelevel - self.max_chargelevel\n",
|
|
"# max_discharging = chargelevel - self.min_chargelevel"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 71,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Funtionality: Set the storage level\n",
|
|
"# waterstorage.storagelevel = 15\n",
|
|
"# waterstorage.max_storagelevel = 23.2\n",
|
|
"# waterstorage.min_storagelevel = 5\n",
|
|
"# # waterstorage.max_charging = waterstorage.max_storagelevel - waterstorage.storagelevel\n",
|
|
"# # waterstorage.max_discharging = waterstorage.max_storagelevel - waterstorage.min_storagelevel\n",
|
|
"# waterstorage.max_discharging"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 72,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"20"
|
|
]
|
|
},
|
|
"execution_count": 72,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Functionality: Charge the storage\n",
|
|
"waterstorage.storage_level = 15\n",
|
|
"waterstorage.charge = 5\n",
|
|
"waterstorage.storage_level += waterstorage.charge\n",
|
|
"waterstorage.storage_level"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 73,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"11"
|
|
]
|
|
},
|
|
"execution_count": 73,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Functionality: Discharge the storage\n",
|
|
"waterstorage.storage_level = 15\n",
|
|
"waterstorage.discharge = 4\n",
|
|
"waterstorage.storage_level -= waterstorage.discharge\n",
|
|
"waterstorage.storage_level"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## WaterStorage + Heatpump system"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Functional requirements for the WaterStorage + Heatpump system:\n",
|
|
"1. Goal (Funtional requirements): \n",
|
|
" * Given (context)\n",
|
|
" * price (forecast), \n",
|
|
" * source and sink temperature (provided by process), \n",
|
|
" * process heat demand, \n",
|
|
" * storage level of the water storage (temperature level)\n",
|
|
"* I want to know:\n",
|
|
" * Heat output from the heatpump (in MW)\n",
|
|
" * New storage level / temperature level\n",
|
|
" * Electricity consumption of the heatpump"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.5"
|
|
},
|
|
"widgets": {
|
|
"application/vnd.jupyter.widget-state+json": {
|
|
"state": {},
|
|
"version_major": 2,
|
|
"version_minor": 0
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|