mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
- The thermoelectric generator now works... more or less. Not that I changed anything...
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3773 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -25,13 +25,15 @@
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
//Calculate necessary moles to transfer using PV = nRT
|
//Calculate necessary moles to transfer using PV = nRT
|
||||||
if((air1.total_moles() > 0) && (air1.temperature>0))
|
if(air1.temperature>0)
|
||||||
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
|
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
|
||||||
|
|
||||||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
|
|
||||||
last_pressure_delta = pressure_delta
|
last_pressure_delta = pressure_delta
|
||||||
|
|
||||||
|
//world << "pressure_delta = [pressure_delta]; transfer_moles = [transfer_moles];"
|
||||||
|
|
||||||
//Actually transfer the gas
|
//Actually transfer the gas
|
||||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
spawn(5)
|
spawn(5)
|
||||||
circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,WEST)
|
circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,WEST)
|
||||||
circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,EAST)
|
circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,EAST)
|
||||||
|
|
||||||
|
if(circ1)
|
||||||
|
circ1.side = 1
|
||||||
|
circ1.update_icon()
|
||||||
|
if(circ2)
|
||||||
|
circ2.side = 2
|
||||||
|
circ2.update_icon()
|
||||||
|
|
||||||
if(!circ1 || !circ2)
|
if(!circ1 || !circ2)
|
||||||
stat |= BROKEN
|
stat |= BROKEN
|
||||||
|
|
||||||
@@ -32,42 +40,55 @@
|
|||||||
|
|
||||||
/obj/machinery/power/generator/process()
|
/obj/machinery/power/generator/process()
|
||||||
|
|
||||||
|
//world << "Generator process ran"
|
||||||
|
|
||||||
if(!circ1 || !circ2)
|
if(!circ1 || !circ2)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/datum/gas_mixture/hot_air = circ1.return_transfer_air()
|
//world << "circ1 and circ2 pass"
|
||||||
var/datum/gas_mixture/cold_air = circ2.return_transfer_air()
|
|
||||||
|
var/datum/gas_mixture/cold_air = circ1.return_transfer_air()
|
||||||
|
var/datum/gas_mixture/hot_air = circ2.return_transfer_air()
|
||||||
|
|
||||||
lastgen = 0
|
lastgen = 0
|
||||||
|
|
||||||
|
//world << "hot_air = [hot_air]; cold_air = [cold_air];"
|
||||||
|
|
||||||
if(cold_air && hot_air)
|
if(cold_air && hot_air)
|
||||||
|
|
||||||
|
//world << "hot_air = [hot_air] temperature = [hot_air.temperature]; cold_air = [cold_air] temperature = [hot_air.temperature];"
|
||||||
|
|
||||||
|
//world << "coldair and hotair pass"
|
||||||
var/cold_air_heat_capacity = cold_air.heat_capacity()
|
var/cold_air_heat_capacity = cold_air.heat_capacity()
|
||||||
var/hot_air_heat_capacity = hot_air.heat_capacity()
|
var/hot_air_heat_capacity = hot_air.heat_capacity()
|
||||||
|
|
||||||
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
||||||
|
|
||||||
|
//world << "delta_temperature = [delta_temperature]; cold_air_heat_capacity = [cold_air_heat_capacity]; hot_air_heat_capacity = [hot_air_heat_capacity]"
|
||||||
|
|
||||||
if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0)
|
if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0)
|
||||||
var/efficiency = (1 - cold_air.temperature/hot_air.temperature)*0.65 //65% of Carnot efficiency
|
var/efficiency = 0.65
|
||||||
|
|
||||||
var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity)
|
var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity)
|
||||||
|
|
||||||
var/heat = energy_transfer*(1-efficiency)
|
var/heat = energy_transfer*(1-efficiency)
|
||||||
lastgen = energy_transfer*efficiency
|
lastgen = energy_transfer*efficiency
|
||||||
|
|
||||||
|
//world << "lastgen = [lastgen]; heat = [heat]; delta_temperature = [delta_temperature]; hot_air_heat_capacity = [hot_air_heat_capacity]; cold_air_heat_capacity = [cold_air_heat_capacity];"
|
||||||
|
|
||||||
hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity
|
hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity
|
||||||
cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity
|
cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity
|
||||||
|
|
||||||
|
|
||||||
world << "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]"
|
world << "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]"
|
||||||
|
|
||||||
add_avail(lastgen)
|
add_avail(lastgen)
|
||||||
// update icon overlays only if displayed level has changed
|
// update icon overlays only if displayed level has changed
|
||||||
|
|
||||||
if(hot_air)
|
if(hot_air)
|
||||||
circ1.air2.merge(hot_air)
|
circ2.air2.merge(hot_air)
|
||||||
|
|
||||||
if(cold_air)
|
if(cold_air)
|
||||||
circ2.air2.merge(cold_air)
|
circ1.air2.merge(cold_air)
|
||||||
|
|
||||||
var/genlev = max(0, min( round(11*lastgen / 100000), 11))
|
var/genlev = max(0, min( round(11*lastgen / 100000), 11))
|
||||||
if(genlev != lastgenlev)
|
if(genlev != lastgenlev)
|
||||||
|
|||||||
1715
maps/oldstation.dmm
1715
maps/oldstation.dmm
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user