Ai4EComponentLib.HVAC.CoolingTower
— MethodCoolingTower(; name, Tw, ΔTct)
Component: CoolingTower
States:
qc(t)
: [kg/s
] Cooling water mass flowTci(t)
: [K
] Water supply temperature of cooling waterTco(t)
: [K
] Return water temperatureΔT(t)
: [K
] Temperature difference between supply and return water
Parameters:
Tw
: [K
] Water temperatureΔTct
: [K
] Temperature difference between water and air
Equations:
qc ~ inlet.qm
: [kg/s
] Cooling water mass flowTci ~ outlet.T
: [K
] Water supply temperature of cooling waterTco ~ inlet.T
: [K
] Return water temperatureTci ~ Tw + ΔTct
: [K
] Water temperatureΔT ~ Tco - Tci
: [K
] Temperature difference between supply and return waterinlet.qm + outlet.qm ~ 0
: [kg/s
] Mass balanceinlet.p ~ outlet.p
: [Pa
] Pressure balance
Arguments:
Connectors:
inlet
: Inlet of cooling toweroutlet
: Outlet of cooling tower
Ai4EComponentLib.HVAC.FanCoil
— MethodFanCoil(; name, D, Qf0, Tai0, Twi0, Tai, cp)
Component: FanCoil
States:
Qf(t)
: [W
] Actual heat transferTwi(t)
: [K
] Actual inlet water temperatureTwo(t)
: [K
] Actual outlet water temperature
Arguments:
D
: [Vector{Float64}
] Coefficient of fan coilQf0
: [W
] Rated heat transferTai0
: [K
] Rated inlet air temperatureTwi0
: [K
] Rated inlet water temperatureTai
: [K
] Inlet air temperaturecp
: [J/(kg·K)
] Specific heat of water
Connectors:
inlet
: Inlet of fan coiloutlet
: Outlet of fan coil
Ai4EComponentLib.HVAC.FlowPort
— MethodFlowPort(; name, T0)
A pipe port(inlet or outlet) in an pipe network.
States:
p(t)
: [Pa
] The pressure at this portq(t)
: [m³/s
] The volume flow passing through this portT(t)
: [K
] The temperature at this port
Ai4EComponentLib.HVAC.Pump
— MethodPump(; name, D, n0, ρ, g)
Component: CentrifugalPump
States:
n(t)
: [rpm
] Actual speed of pumpqv(t)
: [m³/s
] Actual volume flow rateH(t)
: [m
] Actual headη(t)
: [-
] Actual efficiencyP(t)
: [W
] Actual power
Parameters:
D
: [m
] Diameter of pumpn0
: [rpm
] Rated speed of pumpρ
: [kg/m³
] Density of liquidg
: [m/s²
] Gravitational acceleration
Arguments:
name
: Name of the componentD
: [m
] Diameter of pumpn0
: [rpm
] Rated speed of pumpρ
: [kg/m³
] Density of liquidg
: [m/s²
] Gravitational acceleration
Connectors:
inlet
: Inlet of pumpoutlet
: Outlet of pump
Ai4EComponentLib.HVAC.SimplePipe
— MethodSimplePipe(; name, R, T)
Component: SimplePipe(pipe with fixed friction factor f
)
States:
Parameters:
R
: [Pa·s/m³
] Friction factor
Arguments:
Connectors:
inlet
: Inlet of pipeoutlet
: Outlet of pipe
Ai4EComponentLib.HVAC.source
— Methodsource(; name, qm, p, t0)
Component: Source
States:
Ai4EComponentLib.CompressedAirSystem.AirStroageTank
— MethodAirStroageTank(; name, V, T, p0)
Air tank.
Valve with constant resistance.
Arguments:
V
: [m³
] Volume, defaults: 20T
: [K
] Temperature, defaults: 300p0
: [Pa
] Initial pressure, defaults: 1e5
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.ConstantValve
— MethodConstantValve(; name, R)
Valve with constant resistance.
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.FlowPort
— MethodFlowPort(; name)
Port(inlet or outlet) in CompressedAirSystem.
States:
p(t)
: [Pa
] The pressure at this portqm(t)
: [kg/s
] The mass flow rate passing through this portT(t)
: [K
] The mass flow rate passing through this portρ(t)
: [kg/m³
] The density passing at this portμ(t)
: [Pa⋅s
] The absolute viscosity at this portqv(t)
: [m³/s
] The volume flow rate passing through this port
Ai4EComponentLib.CompressedAirSystem.Purifier
— MethodPurifier(; name, c, Δp, T)
General purifier.
Arguments:
c
: Purification coefficient, percentage of residual mass flow after purification to inlet mass flow, defaults: 1.0Δp
: [Pa
] Absolute pressure drop across the componentT
: [K
] Outlet temperature after cooling
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.SISOComponent
— MethodSISOComponent(; name)
The Component with two ports inlet
and outlet
and mass flow qm
flows from inlet
to outlet
. It plays the same role as Oneport
in the circuit system.
States:
qm(t)
: [kg/s
] The mass flow rate passing through this componentΔp(t)
: [Pa
] The pressure difference at a componentρ_mean(t)
: [kg/m³
] The density at a componentμ_mean(t)
: [Pa⋅s
] The absolute viscosity at a componentqv_mean(t)
: [m³/s
] The volume flow rate passing through this component
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.SimplifiedPipe
— MethodSimplifiedPipe(; name, R0)
Simplified pipe model
Arguments:
R0
: [kg/m^7
] Resistance coefficient of pipeline
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.Source
— MethodSource(; name, boundary)
Source
is a general source, which can generate pressure boundary("p"), temperature boundary("T") or mass flow boundary("qm") with different input parameters.
Valve with constant resistance.
Arguments:
boundary
:Dict
with boundaries
Connectors:
source
: port of source
inletBoundary = Dict(
"p" => 1.0e5(1 + 0.001sin(t)),
"T" => 300,
)
Ai4EComponentLib.CompressedAirSystem.StraightPipe
— MethodStraightPipe(; name, D, L, ϵ)
Straight round pipe and height difference is not considered. Friction coefficient is obtained from Modi diagram.
Arguments:
D
: [m
] Pipe diameter, defaults: 1.0L
: [m
] Pipe length, defaults: 1.0ϵ
: [m
] Absolute roughness of pipeline, defaults: 0.05
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.TransitionPipe
— MethodTransitionPipe(; name, n, f, D, L, T, p0, qm0)
Simplified pipe model
Arguments:
f
: [kg/m⁷
] Resistance coefficient of pipelinen
: Number of pipe discrete nodeD
: [m
] Pipe diameter, defaults: 1.0L
: [m
] Pipe length, defaults: 1.0T
: [K
] Ambient temperature, defaults: 300p0
: [Pa
] Initial pressure of each nodeqm0
: [kg/(m²⋅s)
] Initial specific momentum of each node
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.VarySpeedCompressor
— MethodVarySpeedCompressor(
;
name,
n0,
h_polCoff,
etaCoff,
surgeCoff,
chokeCoff
)
Variable speed compressor.
\[h_polCoff = a1 * inlet.qv^2 + a2 * inlet.qv * n / n0 + a3 * (n / n0)^3) * g\]
\[etaCoff = b1 * inlet.qv^2 * (n0 / n)^2 + b2 * inlet.qv * n0 / n + b3\]
\[surgeCoff = (c1 * n * n + c2 * n + c3) / 3600\]
\[chokeCoff = (d1 * n * n + d2 * n + d3) / 3600\]
States:
qm(t)
: [kg/s
] The mass flow raten(t)
: [rpm
] speedϵ(t)
: pressure ratioh_pol(t)
: [J
] Energy headh_tot(t)
: [J
] Total Worketa_pol(t)
: Surge limit coefficientqv_surge(t)
: [kg/s
] Surge flow rateqv_choke(t)
: [kg/s
] choke flow rateσ(t)
Arguments:
n0
: [rpm
] Rated speedh_polCoff
: Work coefficientetaCoff
: Efficiency coefficientsurgeCoff
: Surge limit coefficientchokeCoff
: Choke limit coefficient
Connectors:
inlet
inlet of componentsoutlet
outlet of components
Ai4EComponentLib.CompressedAirSystem.pipeFriction_turbulent
— MethodpipeFriction_turbulent(f, Re, ϵ, D) -> Any
Fitting Formula for Friction Coefficient of Turbulent Pipe
Ai4EComponentLib.CompressedAirSystem.pipeRe
— MethodpipeRe(ρ, u, D, μ) -> Any
Reynolds number
Ai4EComponentLib.CompressedAirSystem.pipeVelocity
— MethodpipeVelocity(Δp, ρ, L, D, f) -> Any
Flow rate in pipe
Ai4EComponentLib.CompressedAirSystem.stateEquation
— MethodstateEquation(p, ρ, T) -> Any
State Equation of Dry Air
Ai4EComponentLib.Electrochemistry.Capacitor
— MethodCapacitor(; name, C, v_start)
Creates an ideal capacitor.
States:
v(t)
: [V
] The voltage across the capacitor, given byD(v) ~ p.i / C
Connectors:
p
Positive pinn
Negative pin
Parameters:
C
: [F
] Capacitancev_start
: [V
] Initial voltage of capacitor
Ai4EComponentLib.Electrochemistry.Conductor
— MethodConductor(; name, G)
Creates an ideal conductor.
States:
See OnePort
Connectors:
p
Positive pinn
Negative pin
Parameters:
G
: [S
] Conductance
Ai4EComponentLib.Electrochemistry.Constant
— MethodConstant(; name, U)
Generate constant signal.
Parameters:
U
: Constant output value
Connectors:
u
Ai4EComponentLib.Electrochemistry.Current_source
— MethodAi4EComponentLib.Electrochemistry.DC2DC
— MethodDC2DC(; name, n, output_type, value)
Component: DC2DC
DC2DC is a device that converts electrical energy of one voltage value into electrical energy of another voltage value in a direct current circuit.
Parameters:
n
: efficiency of conversionoutput_type
: type of "boost" includesvoltage
orcurrent
ornone
value
: the value of outport
Connectors:
in.p
Positive pin of the solar panelin.n
Negative pin of the solar panelout.p
Positive pin of the batteryout.n
Negative pin of the battery
Ai4EComponentLib.Electrochemistry.Ground
— MethodGround(; name)
Ground node with the potential of zero and connector g
. Every circuit must have one ground node.
From ModelingToolkitStandardLibrary.jl
Connectors:
g
Ai4EComponentLib.Electrochemistry.Inductor
— MethodInductor(; name, L, i_start)
Creates an ideal Inductor.
States:
See OnePort
Connectors:
p
Positive pinn
Negative pin
Parameters:
L
: [H
] Inductancei_start
: [A
] Initial current through inductor
Ai4EComponentLib.Electrochemistry.Lithium_ion_batteries
— MethodLithium_ion_batteries(
;
name,
R_0,
R_s,
R_f,
R_sd,
C_s,
C_f,
C_b,
SOC2OC
)
Component: lithiumionbatteries with 8 Paramenters
States:
v_b
: [V
] Load voltagei_b
: [A
] Load currentv_s
: [V
] Voltage through the short transient RCv_f
: [V
] Voltage through the long transient RCv_soc
: [V
] Voltage representing SOC(0~1)v_oc
: [V
] Open circuit voltage
Paramenters:
- R_0: Series resistor
- R_s: Short transient resistor
- R_f: Long transient resistor
- R_sd: Self-discharge resistor
- C_s: Short transient capacity
- C_f: Long transient capacity
- C_b: Usable capacity
- SOC2OC: The fitting function of vsoc and voc
Connectors:
p
Positive pinn
Negative pin
Reference: M. Chen, G.A. Rincon-Mora, Accurate electrical battery model capable of predicting runtime and i-v performance, IEEE Trans. Energy Convers. 21 (2) (2006) 504–511, https://doi.org/10.1109/TEC.2006.874229.
Ai4EComponentLib.Electrochemistry.MPPT_Controller
— MethodMPPT_Controller(; name, Sampling_time)
Component: MPPT_controller
The MPPT controller can detect the generating voltage of the solar panel in real time, and track the maximum voltage current value (VI), so that the system can charge the battery at the maximum power output.
Parameters:
Sampling_time
: Voltage sampling time
Connectors:
in.p
Positive pin of the solar panelin.n
Negative pin of the solar panelout.p
Positive pin of the batteryout.n
Negative pin of the battery
Ai4EComponentLib.Electrochemistry.OnePort
— MethodOnePort(; name, v_start, i_start)
Component with two electrical pins p
and n
and current i
flows from p
to n
.
From ModelingToolkitStandardLibrary.jl
States:
v(t)
: [V
] The voltage across componentp.v - n.v
i(t)
: [A
] The current passing through positive pin
Parameters:
v_start
: [V
] Initial voltage across the componenti_start
: [A
] Initial current through the component
Connectors:
p
Positive pinn
Negative pin
Ai4EComponentLib.Electrochemistry.OnePort_key
— MethodOnePort_key(; name, v_start, i_start)
Component with two electrical pins p
and n
and current i
flows from p
to n
.
The component does exactly the same thing as the "OnePort" but its variables can not be simplified in the function "structural_simplify"
Ai4EComponentLib.Electrochemistry.PEMElectrolyzer
— MethodPEMElectrolyzer(; name, τ, I_0, n, u_0, R_sol)
Component: PEMElectrolyzer(Proton Exchange Membranes Electrolyzer)
I-U in Electrolyzer:
\[U_{cell}=U_{0}-\tau \times \sinh \left(\frac{I}{I_{0}(T)}\right)+I \times R_{\text{sol}}(T)\]
Molar Yield of Hydrogen and Oxygen, Molar consumption of water:
\[\begin{aligned} \dot{n}_{H_{2} O} &=\frac{n_{c} I_{e l}}{2 \cdot F} \\ \dot{n}_{H_{2}} &=\frac{n_{c} I_{e l}}{2 \cdot F} \cdot \eta_{f} \\ \dot{n}_{O_{2}} &=\frac{n_{c} I_{e l}}{2 \cdot F} \cdot \eta_{f} \end{aligned}\]
Mass yield of hydrogen[1]:
\[\frac{\mathrm{d}^{2} \dot{m}}{\mathrm{~d} t^{2}}=-2 \zeta \cdot \omega_{n} \frac{\mathrm{d} \dot{m}}{\mathrm{~d} t}-\omega_{n}{ }^{2} \dot{m}+\omega_{n}{ }^{2} M_{H_{2}} n_{H_{2}}\]
States:
v(t)
: [V
] Voltage across the Electrolyzeri(t)
: [A
] Current through the Electrolyzern_H_2(t)
: [mol/s
] Molar Yield of Hydrogenη_f(t)
: Faraday efficiency, here $η_f = 1$m_H_2(t)
: [g/s
] Mass yield of hydrogen∂_m_H_2
: Derivative of hydrogen mass yield
Parameters:
τ
: Tafel slopeI_0
: Exchange Current Densityn
: Number of electrolyzers in seriesu_0
: Equilibrium potentialR_sol
: Solution resistance
Inside Variables:
- ωₙ: Natural frequency of Hydrogen production [1]
- ζ: Damping ratio of Hydrogen production [1]
- molarMassH2: [
g/mol
] Molar mass of hydrogen
Connectors:
p
Positive pinn
Negative pin
Reference:
- [1]Espinosa-López M, Darras C, Poggi P, et al. Modelling and experimental validation of a 46 kw pem high pressure water electrolyzer[J]. Renewable energy, 2018, 119:160-173.
Ai4EComponentLib.Electrochemistry.PhotovoltaicCell
— MethodPhotovoltaicCell(; name, I_ph, I_0, a, R_s, R_sh)
Component: PhotovoltaicCell with 5 Paramenters
States:
v(t)
: [V
] Voltage across the Celli(t)
: [A
] Current through the Cell
Paramenters:
- I_ph: Photocurrent
- I_0: Reverse saturation current
- a: Correction factor
- R_s: Series resistance
- R_sh: Ohmic resistance
Connectors:
p
Positive pinn
Negative pin
Reference: De Soto W, Klein S A, Beckman W A. Improvement and validation of a model for photovoltaic array performance[J]. Solar energy, 2006, 80(1):78-88.
Ai4EComponentLib.Electrochemistry.Pin
— MethodPin(; name)
A pin in an analog circuit.
From ModelingToolkitStandardLibrary.jl
States:
v(t)
: [V
] The voltage at this pini(t)
: [A
] The current passing through this pin
Ai4EComponentLib.Electrochemistry.RealInput
— MethodRealInput(; name, nin, u_start)
Connector with one input signal of type Real.
Parameters:
nin=1
: Number of inputsu_start=0
: Initial value foru
States:
u
: Value of of the connector; if nin=1 this is a scalar
Ai4EComponentLib.Electrochemistry.RealOutput
— MethodRealOutput(; name, nout, u_start)
Connector with one output signal of type Real.
Parameters:
nout=1
: Number of inputsu_start=0
: Initial value foru
States:
u
: Value of of the connector; if nout=1 this is a scalar
Ai4EComponentLib.Electrochemistry.Resistor
— MethodResistor(; name, R)
Creates an ideal Resistor following Ohm's Law.
States:
See OnePort
Connectors:
p
Positive pinn
Negative pin
Parameters:
R
: [Ω
] Resistance
Ai4EComponentLib.Electrochemistry.Secrete
— MethodSecrete(data; name, output_type)
Generate secrete signal.
Parameters:
data_name
: the name of datafileoutput_type
: the type of sample time includess
ormin
orhour
orday
Connectors:
u
Ai4EComponentLib.Electrochemistry.Super_capacity
— MethodSuper_capacity(; name, R_0, C_0, K_v, R_2, C_2, R_EPR)
Component: Super_capacity with 6 Paramenters
States:
v_b
: [V
] Load voltagei_b
: [A
] Load currentv_0
: [V
] Voltage through the capacity of the first branchv_2
: [V
] Voltage through the capacity of the second branch
Paramenters:
- R_0: Series resistor of the first branch
- C_0: Constant capacity of the first branch
- K_v: Proportionality coefficient term
- R_2: Series resistor of the second branch
- C_2: Constant capacity of the second branch
- REPR: selfdischarge resistor
Connectors:
p
Positive pinn
Negative pin
Reference: R. Faranda, M. Gallina, D.T. Son, A new simplified model of double-layer capacitors, in: Proceedings of the IEEE International Conference on Clean Electrical Power (ICEEP), May 21–23, 2007.https://ieeexplore.ieee.org/abstract/document/4272459/
Ai4EComponentLib.Electrochemistry.TwoPort
— MethodTwoPort(; name, v1_start, v2_start, i1_start, i2_start)
Component with four electrical pins p1
, n1
, p2
and n2
Current i1
flows from p1
to n1
and i2
from p2
to n2
.
States:
v1(t)
: [V
] The voltage across first portsp1.v - n1.v
v2(t)
: [V
] The voltage across second portsp2.v - n2.v
i1(t)
: [A
] The current passing through positive pinp1
i2(t)
: [A
] The current passing through positive pinp2
Parameters:
v1_start
: [V
] Initial voltage across p1 and n1v2_start
: [V
] Initial voltage across p2 and n2i2_start
: [A
] Initial current through p1i2_start
: [A
] Initial current through p2
Connectors:
p1
First positive pinp2
Second positive pinn1
First negative pinn2
Second Negative pin
Ai4EComponentLib.Electrochemistry.Voltage_source
— MethodAi4EComponentLib.Electrochemistry.charge_controller
— Methodcharge_controller(; name, time, value)
Component: charge_controller
The charge controller can maintain a constant current and change the current at a specific time.
Parameters:
time
: The time the current is changedvalue
: The value of current aftertime
Connectors:
p
Positive pinn
Negative pin
Ai4EComponentLib.Electrochemistry.electronic_load
— Methodelectronic_load(; name)
Simulated load.
Connectors:
u
Ai4EComponentLib.Electrochemistry.vari_Resistor
— Methodvari_Resistor(; name, R)
Creates an Resistor whose value increases with time.
States:
See OnePort
Connectors:
p
Positive pinn
Negative pin
Parameters:
R
: [Ω
] Resistance
Ai4EComponentLib.ThermodynamicCycle.ArbitraryProcess
— MethodArbitraryProcess(; name, inter_state, process, fluid)
Component: ArbitraryProcess
Once the two states in a node are determined, the remaining 3 states can be obtained from these two known states. In ArbitraryProcess
, 2 states need to be determined.
Connectors:
in
: Inlet of processout
: Outlet of process
Arguments:
inter_state
: One state to be determined. There are 7 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy"Q_0"
: Giving saturated liquid(0 is value of the state, automatically passed into ODESystem)"Q_1"
: Giving saturated vapor(1 is value of the state, automatically passed into ODESystem)
process
: Another state to be determined. There are 5 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy
fluid
: The fluid passing throught the component, default: "Water"
Ai4EComponentLib.ThermodynamicCycle.DThermalStates
— MethodDThermalStates(; name, state, value, u0)
Component: DThermalStates
The DThermalStates
make the value of state changes over time.
\[\frac{\partial State}{\partial t} = ConstantValue\]
Connectors:
node
: A node passing value
Arguments:
state
: State that determined in process. There are 5 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy
value
: The value ofConstantValue
in above formula:u0
: The initial value of the state
Ai4EComponentLib.ThermodynamicCycle.IsentropicProcess
— MethodIsentropicProcess(; name, inter_state, fluid)
Component: IsentropicProcess
The Entropy
is constant during the process.
Once the two states in a node are determined, the remaining 3 states can be obtained from these two known states. In IsentropicProcess, entropy
are the same from inlet to outlet. So another state still needed.
Connectors:
in
: Inlet of processout
: Outlet of process
Arguments:
inter_state
: Another state need to be determined. There are 7 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy"Q_0"
: Giving saturated liquid(0 is value of the state, automatically passed into ODESystem)"Q_1"
: Giving saturated vapor(1 is value of the state, automatically passed into ODESystem)
fluid
: The fluid passing throught the component, default: "Water"
Ai4EComponentLib.ThermodynamicCycle.IsobaricProcess
— MethodIsobaricProcess(; name, inter_state, fluid)
Component: IsobaricProcess
The Pressure
is constant during the process.
Once the two states in a node are determined, the remaining 3 states can be obtained from these two known states. In IsobaricProcess, pressure
are the same from inlet to outlet. So another state still needed.
Connectors:
in
: Inlet of processout
: Outlet of process
Arguments:
inter_state
: Another state need to be determined. There are 7 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy"Q_0"
: Giving saturated liquid(0 is value of the state, automatically passed into ODESystem)"Q_1"
: Giving saturated vapor(1 is value of the state, automatically passed into ODESystem)
fluid
: The fluid passing throught the component, default: "Water"
Ai4EComponentLib.ThermodynamicCycle.IsochoricProcess
— MethodIsochoricProcess(; name, inter_state, fluid)
Component: IsochoricProcess
The Density
is constant during the process.
Once the two states in a node are determined, the remaining 3 states can be obtained from these two known states. In IsochoricProcess, density
are the same from inlet to outlet. So another state still needed.
Connectors:
in
: Inlet of processout
: Outlet of process
Arguments:
inter_state
: Another state need to be determined. There are 7 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy"Q_0"
: Giving saturated liquid(0 is value of the state, automatically passed into ODESystem)"Q_1"
: Giving saturated vapor(1 is value of the state, automatically passed into ODESystem)
fluid
: The fluid passing throught the component, default: "Water"
Ai4EComponentLib.ThermodynamicCycle.IsoenthalpyProcess
— MethodIsoenthalpyProcess(; name, inter_state, fluid)
Component: IsoenthalpyProcess
The Enthalpy
is constant during the process.
Once the two states in a node are determined, the remaining 3 states can be obtained from these two known states. In IsoenthalpyProcess, enthalpy
are the same from inlet to outlet. So another state still needed.
Connectors:
in
: Inlet of processout
: Outlet of process
Arguments:
inter_state
: Another state need to be determined. There are 7 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy"Q_0"
: Giving saturated liquid(0 is value of the state, automatically passed into ODESystem)"Q_1"
: Giving saturated vapor(1 is value of the state, automatically passed into ODESystem)
fluid
: The fluid passing throught the component, default: "Water"
Ai4EComponentLib.ThermodynamicCycle.IsothermalProcess
— MethodIsothermalProcess(; name, inter_state, fluid)
Component: IsothermalProcess
The Temperature
is constant during the process.
Once the two states in a node are determined, the remaining 3 states can be obtained from these two known states. In IsothermalProcess, temperature
are the same from inlet to outlet. So another state still needed.
Connectors:
in
: Inlet of processout
: Outlet of process
Arguments:
inter_state
: Another state need to be determined. There are 7 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy"Q_0"
: Giving saturated liquid(0 is value of the state, automatically passed into ODESystem)"Q_1"
: Giving saturated vapor(1 is value of the state, automatically passed into ODESystem)
fluid
: The fluid passing throught the component, default: "Water"
Ai4EComponentLib.ThermodynamicCycle.StreamNode
— MethodStreamNode(; name)
A stream node(inlet or outlet) in a thermodynamic cycle system. There are five states in a node: pressure, enthalpy, temperature, density, entropy.
States:
p(t)
: [Pa
] The pressure at this nodeh(t)
: [J/kg
] The enthalpy at this nodeT(t)
: [K
] The temperature at this nodeρ(t)
: [kg/m³
] The density at this nodes(t)
: [J/(kg·K)
] The entropy at this node
Ai4EComponentLib.ThermodynamicCycle.StreamPort
— MethodStreamPort(; name)
Component with two stream nodes in
and out
and some variables between in
and out
.
States:
Δp(t)
: [Pa
] The pressure at this nodeΔh(t)
: [J/kg
] The enthalpy at this nodeΔT(t)
: [K
] The temperature at this nodeΔρ(t)
: [kg/m³
] The density at this nodeΔs(t)
: [J/(kg·K)
] The entropy at this node
Connectors:
in
inlet of componentsout
outlet of components
Ai4EComponentLib.ThermodynamicCycle.ThermalStates
— MethodThermalStates(; name, state, value)
Component: ThermalStates
The ThermalStates
passed a fixed value of the state that determined in process.
Connectors:
node
: A node passing value
Arguments:
state
: State that determined in process. There are 5 options:"P"
: Giving state pressure"H"
: Giving state enthalpy"T"
: Giving state temperature"D"
: Giving state density"S"
: Giving state entropy
value
: The value of the state
Ai4EComponentLib.IncompressiblePipe.CentrifugalPump
— MethodCentrifugalPump(; name, D, ω, c_0, c_1, ρ)
Component: CentrifugalPump
Ideal H-Q Characteristic curves of Centrifugal Pumps:
\[H_t=\frac{(r\omega)^2}{g}-\frac{\omega \cot\beta }{2\pi bg}Q=c_0\omega^2-c_1\omega Q=a_0-a_1Q\]
Parameters:
D
: [m
] Diameter of pipeω
: [r/min
] rotary speedc_0
: parameter in H-Q Characteristic curvesc_1
: parameter in H-Q Characteristic curves
Connectors:
in
: Inlet of pumpout
: Outlet of pump
Ai4EComponentLib.IncompressiblePipe.ElbowPipe
— MethodElbowPipe(; name, D, K, ρ, zin, zout)
Component: ElbowPipe(pipe with fixed local resistance loss coefficient f
)
Energy conservation equation in the form of Bernoulli Equation between two ports:
\[\frac{p_{in}}{\rho g} +\frac{8q_{in}^{2}}{\pi^2D^4g} + z_{in}= \frac{p_{out}}{\rho g} +\frac{8q_{out}^{2}}{\pi^2D^4g} + z_{out}+h_f+h_m\]
Parameters:
D
: [m
] Diameter of pipeK
: Local resistance loss coefficient
Connectors:
in
: Inlet of pipeout
: Outlet of pipe
Arguments:
zin
: [m
] The height of inlet portzout
: [m
] The height of outlet portρ
: [`m³/kg] The density of fluid passing the port
Ai4EComponentLib.IncompressiblePipe.PipeNode
— MethodPipeNode(; name, z)
A pipe port(inlet or outlet) in an pipe network.
States:
p(t)
: [Pa
] The pressure at this portq(t)
: [m³/s
] The volume flow passing through this port
Parameters:
z
: [m
] The hight of port, expressing potential energy
Ai4EComponentLib.IncompressiblePipe.SimplePipe
— MethodSimplePipe(; name, L, D, f, ρ, zin, zout, K_inside)
Component: SimplePipe(pipe with fixed friction factor f
)
Energy conservation equation in the form of Bernoulli Equation between two ports:
\[\frac{p_{in}}{\rho g} +\frac{8q_{in}^{2}}{\pi^2D^4g} + z_{in}= \frac{p_{out}}{\rho g} +\frac{8q_{out}^{2}}{\pi^2D^4g} + z_{out}+h_f+h_m\]
Parameters:
D
: [m
] Diameter of pipeL
: [m
] Length of pipef
: Friction factorK_inside
: Coefficient of local resistance loss inside the pipe
Connectors:
in
: Inlet of pipeout
: Outlet of pipe
Arguments:
zin
: [m
] The height of inlet portzout
: [m
] The height of outlet portρ
: [`m³/kg] The density of fluid passing the port
Ai4EComponentLib.IncompressiblePipe.Sink_P
— MethodSink_P(; name, p)
Component: Sink_P
Sink_P can be defined as a source(where fluids are from) or sink(where fluid are going to).
Connectors:
port
: port of sink
Arguments:
p
: [Pa
] The pressure of sink,default
: 101325 (standard atmospheric pressure)
Ai4EComponentLib.IncompressiblePipe.Source_P
— MethodSource_P(; name, D, z, ρ, p, K_inlet)
Component: Source_P(source with inlet pressure losses)
Parameters:
D
: [m
] Diameter of pipeK_inlet
: Local resistance loss coefficient of Inlet port,default
: 0.5
Connectors:
port
: port of source
Arguments:
z
: [m
] The height of sourceρ
: [m³/kg
] The density of fluidp
: [Pa
] The pressure of source,default
: 101325 (standard atmospheric pressure)
Ai4EComponentLib.IncompressiblePipe._NodeEnergy
— Method_NodeEnergy(node, D, ρ) -> Any
To get the energy at the port.
The governing equation of incompressible pipe network is Bernoulli Equation:
\[\frac{p}{\rho g} +\frac{v^{2}}{2g} + z=\mathrm{constant}\]
In volume flow form:
\[\frac{p}{\rho g} +\frac{8q^{2}}{\pi^2D^4g} + z=\mathrm{constant}\]
D
: [m
] Diameter of pipeρ
: [`m³/kg] The density of fluid passing the port
Ai4EComponentLib.IncompressiblePipe._h_f
— Method_h_f(node, f, L, D) -> Any
To get the loss of resistance along the pipe(between two ports).
In volume flow form:
\[h_f = f\frac{L}{D} \frac{8q^{2}}{\pi^2D^4g}\]
Ai4EComponentLib.IncompressiblePipe._h_m
— Method_h_m(node, K, D) -> Any
To get the local resistance loss the components.
In volume flow form:
\[h_m = K \frac{8q^{2}}{\pi^2D^4g}\]
Ai4EComponentLib.EconomyGCDModel_A1.Capitalflow
— MethodThe port through which money flows.
States:
p(t)
: Price of goodw(t)
: Wage(per hour)l(t)
: Laborc(t)
: Consumption𝛌₁(t),𝛌₂(t),𝛌₃(t)
:Parameters that result from the constraint force for the change in consumption and varies over time.
Parameters:
α,β
: Parameters in a simple Cobb-Douglas production function.K₀
: Initial value of Capital.
Ai4EComponentLib.EconomyGCDModel_A1.Firm
— MethodComponent: an agent–-firm.
Function of this component:
\[DP=\hat{dp}(K)\\ firm.m.p\times firm.m.C-firm.m.w\times firm.m.L-firm.m.M=0\\ \beta(firm.m.L)^\alpha(K)^{1-\alpha}-firm.m.C-(K)'-(S)'-DP=0\\ (K)'=\mu^H_Kp\beta(1-\alpha)(firm.m.L)^\alpha(K)^{-\alpha}-\lambda_3\\ (firm.m.M)'=-\lambda_2\ (S)'=\mu^F_S(\hat{S}-S)-\lambda_3\ \ (firm.m.p)'=\mu^F_p\beta(K)^{1-\alpha}(firm.m.L)^\alpha-\lambda_1(firm.m.C)+\lambda_2(firm.m.C)\\ (firm.m.w)'=\mu^F_w(firm.m.L)+\lambda_1(firm.m.L)-\lambda_2(firm.m.L)\\ (firm.m.L)'=\mu^H_L(\hat{L}-firm.m.L)+\mu^F_L(\alpha\beta(K)^{1-\alpha}(firm.m.L)^{\alpha-1}-firm.m.w)\\ +\lambda_1(firm.m.w)-\lambda_2(firm.m.w)+\lambda_3\alpha\beta(firm.m.L)^{\alpha-1}(K)^{1-\alpha}\]
Parameters:
α,β
: Parameters in a simple Cobb-Douglas production function.dp̂
: depreciation.μ₂
: The parameter of Capital.μ₃
: The parameter of Labor and Household.μ₄
: The parameter of Labor and Firm.μ₇
: The parameter of Price.μ₈
: The parameter of storage.μ₉
: The parameter of Wage.Ŝ
: The planned inventory of storage.l̂
: The wish of working time.
Connectors:
m
: money.
Ai4EComponentLib.EconomyGCDModel_A1.Household
— MethodComponent: an agent–-Household.
Function of this component:
\[household.m.w\times household.m.L-household.m.p\times household.m.C-household.m.M\\ (household.m.M)'=2\mu^H_{M^H}(\hat{M}^H-household.m.M)-\lambda_2\\ (household.m.C)'=\mu^H_C\gamma (household.m.C)^{\gamma-1}-\lambda_1(household.m.p)+\lambda_2(household.m.p)-\lambda_3\]
States:
Mʰ(t)
: Money stock household.mʰ(t)
: Derivative of Mʰ(t).
Parameters:
α,β
: Parameters in a simple Cobb-Douglas production function.dp̂
: depreciation.μ₁
: The parameter of Consumption.μ₆
: The parameter of money stock household.K₀
: Initial value of Capital.M̂ʰ
: The amount of cash that Households aim to keep.γ
: The parameter of Consumption and Household.
Connectors:
m
: money.
Ai4EComponentLib.AirPipeSim.AirSimplePipe
— MethodAirSimplePipe(; name, R, T)
Component: a single pipe or a pipe network with only one inlet and one outlet in steady state.
Assumptions
- The density or pressure of the air doesn't change too fast.
- Temperature of the pipe (pipe network) doesn't change. Default to 300K.
- Ideal gas law is avliable.
Function of this component:
\[p_{in}-p_{out}=Rq_m|q_m|\]
Parameters:
R
: [kg^{-1}⋅m^{-1}
] Resistance coefficient of a pipe (or pipe network)T
: [K
] Approximate temperature of the gas inside pipe.
Connectors:
in
: Inlet of tankout
: Outlet of tank
Ai4EComponentLib.AirPipeSim.AirStorageTank
— MethodAirStorageTank(; name, V, T, p0)
Component: an air storage tank
Assumptions
- Ignore the pressure drop between inlet and outlet. The pressure everywhere inside tank equal to the inlet and outlet.
- Temperature of the tank doesn't change. Default to 300K.
- Ideal gas law is avliable.
Function of this component:
\[\frac{\mathrm{d}p}{\mathrm{d}t}=\frac{R_gT}{V}\left (q_{m,in}+q_{m,in}\right)\]
Parameters:
R_g
: [J⋅kg^{-1}⋅K^{-1}
] Ideal gas constant. For air is 287.11, which is unchangeable in this component.V
: [m^3
] Volume of the tank.T
: [K
] Temperature of the gas inside the tank.
Connectors:
in
: Inlet of tankout
: Outlet of tank
Arguments:
p_0
: [Pa
] Initial value of tank pressure.
Ai4EComponentLib.AirPipeSim.FlowPort
— MethodFlowPort(; name, T)
A pipe port(inlet or outlet) in an pipe network.
States:
p(t)
: [Pa
] The pressure at this portqm(t)
: [kg/s
] The mass flow rate passing through this port
Parameters:
T
: [K
] The temperature of port. It'll be used in future develop.
Ai4EComponentLib.AirPipeSim.FlowSource
— MethodFlowSource(; name, qm, T)
Component: a source (or sink) with constant mass flow rate
Parameters:
qm
: [kg⋅s^{-1}
] The mass flow rate this source supply or this sink absorb.T
: [K
] Temperature of the gas flow out (or into) this source (or sink). Default to 300K.
Connectors:
port
: a FlowPort type subcomponent.
Ai4EComponentLib.AirPipeSim.PressureSource
— MethodPressureSource(; name, p, T)
Component: a source (or sink) with constant pressure
Parameters:
p
: [Pa
] The pressure this source (or sink) supply.T
: [K
] Temperature of the gas flow out (or into) this source (or sink). Default to 300K.
Connectors:
port
: a FlowPort type subcomponent.
Ai4EComponentLib.AirPipeSim.TransitionPipe
— MethodTransitionPipe(
;
name,
λ1,
λ2,
λ3,
n,
f,
D,
L,
T,
pins,
pouts
)
Component: a single straight pipe in transition state.
Assumptions
- Ignore the difference in parameters on the same cross section. The flow inside pipe can be treated an 1-D flow.
- Temperature of the pipe (pipe network) doesn't change. Default to 300K.
- Ideal gas law is avliable.
Function of this component:
\[\frac{\partial p}{\partial t}=-\frac{R_{g} T}{A} \frac{\partial q_{m}}{\partial x} \\ \frac{\partial q_{m}}{\partial t}=\left(\frac{R_{g} T}{A} \frac{q_{m}^{2}}{p^{2}}-A\right) \frac{\partial p}{\partial x}-2 \frac{R_{g} T}{A} \frac{q_{m}}{p} \frac{\partial q_{m}}{\partial x}-\frac{f}{2 D} \frac{R_{g} T}{A} \frac{q_{m}\left|q_{m}\right|}{p}\]
Parameters:
Parameters:
R_g
: [J⋅kg^{-1}⋅K^{-1}
] Ideal gas constant. For air is 287.11, which is unchangeable in this component.T
: [K
] Temperature of the air.f
: Friction factorD
: [m
] Diameter of the pipeL
: [m
] Length of the pipe
Connectors:
in
: Inlet of tankout
: Outlet of tank
Arguments:
λ1, λ2 and λ3
: Three coefficient for other use like parameter estimation. They have no influence on simulation, and they are default to 1.n
: The number of control volumes that the pipe be divided into equally.pins and pouts
: [Pa
] The initial pressure at the inlet and outlet of pipe. Simulation will start from the steady state of pipe at the boundary pins and pouts.