`Ai4EComponentLib.HVAC.CoolingTower`

— Method```
CoolingTower(; name, Tw, ΔTct)
```

**Component: CoolingTower**

**States:**

`qc(t)`

: [`kg/s`

] Cooling water mass flow`Tci(t)`

: [`K`

] Water supply temperature of cooling water`Tco(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 flow`Tci ~ outlet.T`

: [`K`

] Water supply temperature of cooling water`Tco ~ inlet.T`

: [`K`

] Return water temperature`Tci ~ Tw + ΔTct`

: [`K`

] Water temperature`ΔT ~ Tco - Tci`

: [`K`

] Temperature difference between supply and return water`inlet.qm + outlet.qm ~ 0`

: [`kg/s`

] Mass balance`inlet.p ~ outlet.p`

: [`Pa`

] Pressure balance

**Arguments:**

**Connectors:**

`inlet`

: Inlet of cooling tower`outlet`

: Outlet of cooling tower

`Ai4EComponentLib.HVAC.FanCoil`

— Method```
FanCoil(; name, D, Qf0, Tai0, Twi0, Tai, cp)
```

**Component: FanCoil**

**States:**

`Qf(t)`

: [`W`

] Actual heat transfer`Twi(t)`

: [`K`

] Actual inlet water temperature`Two(t)`

: [`K`

] Actual outlet water temperature

**Arguments:**

`D`

: [`Vector{Float64}`

] Coefficient of fan coil`Qf0`

: [`W`

] Rated heat transfer`Tai0`

: [`K`

] Rated inlet air temperature`Twi0`

: [`K`

] Rated inlet water temperature`Tai`

: [`K`

] Inlet air temperature`cp`

: [`J/(kg·K)`

] Specific heat of water

**Connectors:**

`inlet`

: Inlet of fan coil`outlet`

: Outlet of fan coil

`Ai4EComponentLib.HVAC.FlowPort`

— Method```
FlowPort(; name, T0)
```

A pipe port(inlet or outlet) in an pipe network.

**States:**

`p(t)`

: [`Pa`

] The pressure at this port`q(t)`

: [`m³/s`

] The volume flow passing through this port`T(t)`

: [`K`

] The temperature at this port

`Ai4EComponentLib.HVAC.Pump`

— Method```
Pump(; name, D, n0, ρ, g)
```

**Component: CentrifugalPump**

**States:**

`n(t)`

: [`rpm`

] Actual speed of pump`qv(t)`

: [`m³/s`

] Actual volume flow rate`H(t)`

: [`m`

] Actual head`η(t)`

: [`-`

] Actual efficiency`P(t)`

: [`W`

] Actual power

**Parameters:**

`D`

: [`m`

] Diameter of pump`n0`

: [`rpm`

] Rated speed of pump`ρ`

: [`kg/m³`

] Density of liquid`g`

: [`m/s²`

] Gravitational acceleration

**Arguments:**

`name`

: Name of the component`D`

: [`m`

] Diameter of pump`n0`

: [`rpm`

] Rated speed of pump`ρ`

: [`kg/m³`

] Density of liquid`g`

: [`m/s²`

] Gravitational acceleration

**Connectors:**

`inlet`

: Inlet of pump`outlet`

: Outlet of pump

`Ai4EComponentLib.HVAC.SimplePipe`

— Method```
SimplePipe(; name, R, T)
```

**Component: SimplePipe(pipe with fixed friction factor f)**

**States:**

**Parameters:**

`R`

: [`Pa·s/m³`

] Friction factor

**Arguments:**

**Connectors:**

`inlet`

: Inlet of pipe`outlet`

: Outlet of pipe

`Ai4EComponentLib.HVAC.source`

— Method```
source(; name, qm, p, t0)
```

**Component: Source**

**States:**

`Ai4EComponentLib.CompressedAirSystem.AirStroageTank`

— Method```
AirStroageTank(; name, V, T, p0)
```

Air tank.

Valve with constant resistance.

**Arguments:**

`V`

: [`m³`

] Volume, defaults: 20`T`

: [`K`

] Temperature, defaults: 300`p0`

: [`Pa`

] Initial pressure, defaults: 1e5

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.ConstantValve`

— Method```
ConstantValve(; name, R)
```

Valve with constant resistance.

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.FlowPort`

— Method```
FlowPort(; name)
```

Port(inlet or outlet) in CompressedAirSystem.

**States:**

`p(t)`

: [`Pa`

] The pressure at this port`qm(t)`

: [`kg/s`

] The mass flow rate passing through this port`T(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 port`qv(t)`

: [`m³/s`

] The volume flow rate passing through this port

`Ai4EComponentLib.CompressedAirSystem.Purifier`

— Method```
Purifier(; 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 component`T`

: [`K`

] Outlet temperature after cooling

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.SISOComponent`

— Method```
SISOComponent(; 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 component`qv_mean(t)`

: [`m³/s`

] The volume flow rate passing through this component

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.SimplifiedPipe`

— Method```
SimplifiedPipe(; name, R0)
```

Simplified pipe model

**Arguments:**

`R0`

: [`kg/m^7`

] Resistance coefficient of pipeline

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.Source`

— Method```
Source(; 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`

— Method```
StraightPipe(; 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.0`L`

: [`m`

] Pipe length, defaults: 1.0`ϵ`

: [`m`

] Absolute roughness of pipeline, defaults: 0.05

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.TransitionPipe`

— Method```
TransitionPipe(; name, n, f, D, L, T, p0, qm0)
```

Simplified pipe model

**Arguments:**

`f`

: [`kg/m⁷`

] Resistance coefficient of pipeline`n`

: Number of pipe discrete node`D`

: [`m`

] Pipe diameter, defaults: 1.0`L`

: [`m`

] Pipe length, defaults: 1.0`T`

: [`K`

] Ambient temperature, defaults: 300`p0`

: [`Pa`

] Initial pressure of each node`qm0`

: [`kg/(m²⋅s)`

] Initial specific momentum of each node

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.VarySpeedCompressor`

— Method```
VarySpeedCompressor(
;
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 rate`n(t)`

: [`rpm`

] speed`ϵ(t)`

: pressure ratio`h_pol(t)`

: [`J`

] Energy head`h_tot(t)`

: [`J`

] Total Work`eta_pol(t)`

: Surge limit coefficient`qv_surge(t)`

: [`kg/s`

] Surge flow rate`qv_choke(t)`

: [`kg/s`

] choke flow rate`σ(t)`

**Arguments:**

`n0`

: [`rpm`

] Rated speed`h_polCoff`

: Work coefficient`etaCoff`

: Efficiency coefficient`surgeCoff`

: Surge limit coefficient`chokeCoff`

: Choke limit coefficient

**Connectors:**

`inlet`

inlet of components`outlet`

outlet of components

`Ai4EComponentLib.CompressedAirSystem.pipeFriction_turbulent`

— Method```
pipeFriction_turbulent(f, Re, ϵ, D) -> Any
```

Fitting Formula for Friction Coefficient of Turbulent Pipe

`Ai4EComponentLib.CompressedAirSystem.pipeRe`

— Method```
pipeRe(ρ, u, D, μ) -> Any
```

Reynolds number

`Ai4EComponentLib.CompressedAirSystem.pipeVelocity`

— Method```
pipeVelocity(Δp, ρ, L, D, f) -> Any
```

Flow rate in pipe

`Ai4EComponentLib.CompressedAirSystem.stateEquation`

— Method```
stateEquation(p, ρ, T) -> Any
```

State Equation of Dry Air

`Ai4EComponentLib.Electrochemistry.Capacitor`

— Method```
Capacitor(; name, C, v_start)
```

Creates an ideal capacitor.

**States:**

`v(t)`

: [`V`

] The voltage across the capacitor, given by`D(v) ~ p.i / C`

**Connectors:**

`p`

Positive pin`n`

Negative pin

**Parameters:**

`C`

: [`F`

] Capacitance`v_start`

: [`V`

] Initial voltage of capacitor

`Ai4EComponentLib.Electrochemistry.Conductor`

— Method```
Conductor(; name, G)
```

Creates an ideal conductor.

**States:**

See OnePort

**Connectors:**

`p`

Positive pin`n`

Negative pin

**Parameters:**

`G`

: [`S`

] Conductance

`Ai4EComponentLib.Electrochemistry.Constant`

— Method```
Constant(; name, U)
```

Generate constant signal.

**Parameters:**

`U`

: Constant output value

**Connectors:**

`u`

`Ai4EComponentLib.Electrochemistry.Current_source`

— Method`Ai4EComponentLib.Electrochemistry.DC2DC`

— Method```
DC2DC(; 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 conversion`output_type`

: type of "boost" includes`voltage`

or`current`

or`none`

`value`

: the value of outport

**Connectors:**

`in.p`

Positive pin of the solar panel`in.n`

Negative pin of the solar panel`out.p`

Positive pin of the battery`out.n`

Negative pin of the battery

`Ai4EComponentLib.Electrochemistry.Ground`

— Method```
Ground(; 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`

— Method```
Inductor(; name, L, i_start)
```

Creates an ideal Inductor.

**States:**

See OnePort

**Connectors:**

`p`

Positive pin`n`

Negative pin

**Parameters:**

`L`

: [`H`

] Inductance`i_start`

: [`A`

] Initial current through inductor

`Ai4EComponentLib.Electrochemistry.Lithium_ion_batteries`

— Method```
Lithium_ion_batteries(
;
name,
R_0,
R_s,
R_f,
R_sd,
C_s,
C_f,
C_b,
SOC2OC
)
```

**Component: lithium ionbatteries with 8 Paramenters**

**States:**

`v_b`

: [`V`

] Load voltage`i_b`

: [`A`

] Load current`v_s`

: [`V`

] Voltage through the short transient RC`v_f`

: [`V`

] Voltage through the long transient RC`v_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 v
*soc and v*oc

**Connectors:**

`p`

Positive pin`n`

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`

— Method```
MPPT_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 panel`in.n`

Negative pin of the solar panel`out.p`

Positive pin of the battery`out.n`

Negative pin of the battery

`Ai4EComponentLib.Electrochemistry.OnePort`

— Method```
OnePort(; 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 component`p.v - n.v`

`i(t)`

: [`A`

] The current passing through positive pin

**Parameters:**

`v_start`

: [`V`

] Initial voltage across the component`i_start`

: [`A`

] Initial current through the component

**Connectors:**

`p`

Positive pin`n`

Negative pin

`Ai4EComponentLib.Electrochemistry.OnePort_key`

— Method```
OnePort_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`

— Method```
PEMElectrolyzer(; 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 Electrolyzer`i(t)`

: [`A`

] Current through the Electrolyzer`n_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 slope`I_0`

: Exchange Current Density`n`

: Number of electrolyzers in series`u_0`

: Equilibrium potential`R_sol`

: Solution resistance

**Inside Variables:**

- ωₙ: Natural frequency of Hydrogen production [1]
- ζ: Damping ratio of Hydrogen production [1]
- molarMass
*H*2: [`g/mol`

] Molar mass of hydrogen

**Connectors:**

`p`

Positive pin`n`

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`

— Method```
PhotovoltaicCell(; name, I_ph, I_0, a, R_s, R_sh)
```

**Component: PhotovoltaicCell with 5 Paramenters**

**States:**

`v(t)`

: [`V`

] Voltage across the Cell`i(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 pin`n`

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`

— Method```
Pin(; name)
```

A pin in an analog circuit.

From ModelingToolkitStandardLibrary.jl

**States:**

`v(t)`

: [`V`

] The voltage at this pin`i(t)`

: [`A`

] The current passing through this pin

`Ai4EComponentLib.Electrochemistry.RealInput`

— Method```
RealInput(; name, nin, u_start)
```

Connector with one input signal of type Real.

**Parameters:**

`nin=1`

: Number of inputs`u_start=0`

: Initial value for`u`

**States:**

`u`

: Value of of the connector; if nin=1 this is a scalar

`Ai4EComponentLib.Electrochemistry.RealOutput`

— Method```
RealOutput(; name, nout, u_start)
```

Connector with one output signal of type Real.

**Parameters:**

`nout=1`

: Number of inputs`u_start=0`

: Initial value for`u`

**States:**

`u`

: Value of of the connector; if nout=1 this is a scalar

`Ai4EComponentLib.Electrochemistry.Resistor`

— Method```
Resistor(; name, R)
```

Creates an ideal Resistor following Ohm's Law.

**States:**

See OnePort

**Connectors:**

`p`

Positive pin`n`

Negative pin

**Parameters:**

`R`

: [`Ω`

] Resistance

`Ai4EComponentLib.Electrochemistry.Secrete`

— Method```
Secrete(data; name, output_type)
```

Generate secrete signal.

**Parameters:**

`data_name`

: the name of datafile`output_type`

: the type of sample time includes`s`

or`min`

or`hour`

or`day`

**Connectors:**

`u`

`Ai4EComponentLib.Electrochemistry.Super_capacity`

— Method```
Super_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 voltage`i_b`

: [`A`

] Load current`v_0`

: [`V`

] Voltage through the capacity of the first branch`v_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
- R
*EPR: self*discharge resistor

**Connectors:**

`p`

Positive pin`n`

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`

— Method```
TwoPort(; 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 ports`p1.v - n1.v`

`v2(t)`

: [`V`

] The voltage across second ports`p2.v - n2.v`

`i1(t)`

: [`A`

] The current passing through positive pin`p1`

`i2(t)`

: [`A`

] The current passing through positive pin`p2`

**Parameters:**

`v1_start`

: [`V`

] Initial voltage across p1 and n1`v2_start`

: [`V`

] Initial voltage across p2 and n2`i2_start`

: [`A`

] Initial current through p1`i2_start`

: [`A`

] Initial current through p2

**Connectors:**

`p1`

First positive pin`p2`

Second positive pin`n1`

First negative pin`n2`

Second Negative pin

`Ai4EComponentLib.Electrochemistry.Voltage_source`

— Method`Ai4EComponentLib.Electrochemistry.charge_controller`

— Method```
charge_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 changed`value`

: The value of current after`time`

**Connectors:**

`p`

Positive pin`n`

Negative pin

`Ai4EComponentLib.Electrochemistry.electronic_load`

— Method```
electronic_load(; name)
```

Simulated load.

**Connectors:**

`u`

`Ai4EComponentLib.Electrochemistry.vari_Resistor`

— Method```
vari_Resistor(; name, R)
```

Creates an Resistor whose value increases with time.

**States:**

See OnePort

**Connectors:**

`p`

Positive pin`n`

Negative pin

**Parameters:**

`R`

: [`Ω`

] Resistance

`Ai4EComponentLib.ThermodynamicCycle.ArbitraryProcess`

— Method```
ArbitraryProcess(; 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 process`out`

: 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`

— Method```
DThermalStates(; 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 of`ConstantValue`

in above formula:`u0`

: The initial value of the state

`Ai4EComponentLib.ThermodynamicCycle.IsentropicProcess`

— Method```
IsentropicProcess(; 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 process`out`

: 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`

— Method```
IsobaricProcess(; 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 process`out`

: 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`

— Method```
IsochoricProcess(; 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 process`out`

: 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`

— Method```
IsoenthalpyProcess(; 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 process`out`

: 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`

— Method```
IsothermalProcess(; 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 process`out`

: 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`

— Method```
StreamNode(; 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 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

`Ai4EComponentLib.ThermodynamicCycle.StreamPort`

— Method```
StreamPort(; 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 components`out`

outlet of components

`Ai4EComponentLib.ThermodynamicCycle.ThermalStates`

— Method```
ThermalStates(; 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`

— Method```
CentrifugalPump(; 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 speed`c_0`

: parameter in H-Q Characteristic curves`c_1`

: parameter in H-Q Characteristic curves

**Connectors:**

`in`

: Inlet of pump`out`

: Outlet of pump

`Ai4EComponentLib.IncompressiblePipe.ElbowPipe`

— Method```
ElbowPipe(; 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 pipe`K`

: Local resistance loss coefficient

**Connectors:**

`in`

: Inlet of pipe`out`

: Outlet of pipe

**Arguments:**

`zin`

: [`m`

] The height of inlet port`zout`

: [`m`

] The height of outlet port`ρ`

: [`m³/kg] The density of fluid passing the port

`Ai4EComponentLib.IncompressiblePipe.PipeNode`

— Method```
PipeNode(; name, z)
```

A pipe port(inlet or outlet) in an pipe network.

**States:**

`p(t)`

: [`Pa`

] The pressure at this port`q(t)`

: [`m³/s`

] The volume flow passing through this port

**Parameters:**

`z`

: [`m`

] The hight of port, expressing potential energy

`Ai4EComponentLib.IncompressiblePipe.SimplePipe`

— Method```
SimplePipe(; 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 pipe`L`

: [`m`

] Length of pipe`f`

: Friction factor`K_inside`

: Coefficient of local resistance loss inside the pipe

**Connectors:**

`in`

: Inlet of pipe`out`

: Outlet of pipe

**Arguments:**

`zin`

: [`m`

] The height of inlet port`zout`

: [`m`

] The height of outlet port`ρ`

: [`m³/kg] The density of fluid passing the port

`Ai4EComponentLib.IncompressiblePipe.Sink_P`

— Method```
Sink_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`

— Method```
Source_P(; name, D, z, ρ, p, K_inlet)
```

**Component: Source_P(source with inlet pressure losses)**

**Parameters:**

`D`

: [`m`

] Diameter of pipe`K_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 fluid`p`

: [`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 good`w(t)`

: Wage(per hour)`l(t)`

: Labor`c(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`

— Method**Component: 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`

— Method**Component: 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`

— Method```
AirSimplePipe(; 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 tank`out`

: Outlet of tank

`Ai4EComponentLib.AirPipeSim.AirStorageTank`

— Method```
AirStorageTank(; 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 tank`out`

: Outlet of tank

**Arguments:**

`p_0`

: [`Pa`

] Initial value of tank pressure.

`Ai4EComponentLib.AirPipeSim.FlowPort`

— Method```
FlowPort(; name, T)
```

A pipe port(inlet or outlet) in an pipe network.

**States:**

`p(t)`

: [`Pa`

] The pressure at this port`qm(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`

— Method```
FlowSource(; 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`

— Method```
PressureSource(; 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`

— Method```
TransitionPipe(
;
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 factor`D`

: [`m`

] Diameter of the pipe`L`

: [`m`

] Length of the pipe

**Connectors:**

`in`

: Inlet of tank`out`

: 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.