In this tutorial we’d like to show how easy it is to create complex dynamic models with Thermolib. Therefore, we choose a gas fired forced circulation boiler with air preheater and economizer.
In the beginning of the development, when there is only a rather rough idea of the process in the mind of the designer, a steady state model comes in handy. Thermolib offers command line functions of all state changes available in Simulink. This enables the user to efficiently determine dimensions of the components in steady-state.
Consider methane as fuel with environment temperature at 300 K and ambient pressure of 1 bar. The initial state of the fuel can then be calculated with:
fuel_state_in = th_TpState(... 'ndot', 250,... 'T', 300,... 'p', 1e5,... 'psi', 1,... 'species', {'CH4'},... 'gas_eos_method', 1, ... 'MediaData', SMediaData);
The function “th_TpState” calculates all other state properties depending on temperature and pressure. Arguments are pairs of parameter name and value, i.e. parameter name: “T”, value: 300 (K). Additionally, the composition, the molar flow and some other configurations are given. A detailed description of all command line functions can be found in chapter 10 of the user manual. The function yields a struct with fields molar flow, temperature, pressure, enthalpy flow, entropy flow, Gibbs energy flow, heat capacity flow, quality of gas phase and composition.
fuel_state_in = ndot: 250 T: 300 p: 100000 Hdot: -1.8638e+007 Sdot: 4.6638e+004 Gdot: -3.2629e+007 Cpdot: 8.9402e+003 x: 1 psi: 1
We could now query, the enthalpy flow, which would result from an isentropic compression to 1.5 bar.
fuel_state_compressed_s = th_SpState(... 'ndot', fuel_state_in.ndot,... 'Sdot', fuel_state_in.Sdot,... 'p', 1.5e5,... 'psi', fuel_state_in.psi,... 'species', {'CH4'},... 'gas_eos_method', 1, ... 'MediaData', SMediaData);
This time we’re using the “th_SpState” function, which uses entropy flow and pressure to calculate the consistent state fuel_state_compressed_s:
fuel_state_compressed_s = ndot: 250 T: 329.2458 p: 150000 Hdot: -1.8374e+007 Sdot: 4.6638e+004 Gdot: -3.3729e+007 Cpdot: 9.2412e+003 x: 1 psi: 1 iterations: 4
As can be seen, we’re getting a temperature of 329,2458 K. Let’s assume the isentropic efficiency at this point of operation is known to be 80%. The real final state is then
fuel_state_compressed = th_HpState(... 'Hdot', fuel_state_in.Hdot + (fuel_state_compressed_s.Hdot - fuel_state_in.Hdot) / 0.8,... 'p', 1.5e5,... 'T_initial', fuel_state_compressed_s.T,... 'psi', fuel_state_in.psi,... 'ndot', fuel_state_in.ndot,... 'species', {'CH4'},... 'gas_eos_method', 1, ... 'MediaData', SMediaData) fuel_state_compressed = ndot: 250 T: 336.3470 p: 150000 Hdot: -1.8307e+007 Sdot: 4.6836e+004 Gdot: -3.4061e+007 Cpdot: 9.3211e+003 x: 1 psi: 1 iterations: 3
Again we’re using a different function (“th_HpState”), which uses enthalpy flow and pressure. The resulting temperature is 336.3470 K.
You now became acquainted with some important functions and how to use them. Got interested? Have a look at the attached .m-file, which calculates the design points. The calculated dimensions are then used in the dynamic model of the forced ciruclation boiler in the .mdl-file.