Description: "Examples demonstrating the use of models in the SolarCollectors package"

- Home > Modelica

## Buildings.Fluid.SolarCollectors.Examples

Examples demonstrating the use of models in the SolarCollectors package

### Information

This package contains example model demonstrating the use of models in the SolarCollectors package.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

### Package Content

Name | Description
--- | ---
Concentrating | Example showing the use of Concentrating
FlatPlate | Test model for FlatPlate
FlatPlateShaCoeTrue | Test model for FlatPlate with use_shaCoe_in = true
FlatPlateTotalArea | Example showing the use of TotalArea and nSeg
FlatPlateWithTank | Example showing use of the flat plate solar collector in a complete solar thermal system
Tubular | Example showing the use of Tubular

## Buildings.Fluid.SolarCollectors.Examples.Concentrating

Example showing the use of Concentrating

### Information

This model demonstrates the implementation of Buildings.Fluid.SolarCollectors.EN12975. In it water is passed through the solar thermal collector while being heated by the sun in the San Francisco, CA, USA climate.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Buildings.Media.Water | Medium in the system

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Medium in the system

### Modelica definition

model Concentrating "Example showing the use of Concentrating" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Medium in the system"; Buildings.Fluid.SolarCollectors.EN12975 solCol( redeclare package Medium = Medium, shaCoe=0, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, use_shaCoe_in=false, per=Buildings.Fluid.SolarCollectors.Data.Concentrating.C_VerificationModel(), sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Series, rho=0.2, nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, nPanels=5, nSeg=9, lat=0.73097781993588, azi=0.3, til=0.5) "Concentrating solar collector model"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos") "Weather data input file"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, use_p_in=false, p(displayUnit="Pa") = 101325, nPorts=1) "Inlet for fluid flow"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut( redeclare package Medium = Medium, T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn(redeclare package Medium = Medium, m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 10, nPorts=1, use_p_in=true, p(displayUnit="Pa")) "Inlet for water flow"; Modelica.Blocks.Sources.Sine sine( freqHz=3/86400, offset=101325, amplitude=-2*solCol.dp_nominal); equation connect(solCol.port_b,TOut. port_a); connect(TOut.port_b,sin. ports[1]); connect(TIn.port_b,solCol. port_a); connect(weaDat.weaBus, solCol.weaBus); connect(sine.y, sou.p_in); connect(sou.ports[1], TIn.port_a); end Concentrating;

## Buildings.Fluid.SolarCollectors.Examples.FlatPlate

Test model for FlatPlate

### Information

This example demonstrates the implementation of Buildings.Fluid.SolarCollectors.ASHRAE93. In it water is passed through a flat plate solar thermal collector while being heated by the sun in the San Francisco, CA, USA climate.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Modelica.Media.Incompressibl... | Medium in the system

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Medium in the system

### Modelica definition

model FlatPlate "Test model for FlatPlate" extends Modelica.Icons.Example; replaceable package Medium = Modelica.Media.Incompressible.Examples.Glycol47 "Medium in the system"; Buildings.Fluid.SolarCollectors.ASHRAE93 solCol( redeclare package Medium = Medium, shaCoe=0, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, rho=0.2, nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Series, per=Buildings.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_GuangdongFSPTY95(), nPanels=1, nSeg=9, lat=0.73097781993588, azi=0.3, til=0.5) "Flat plate solar collector model"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos") "Weather data input file"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, p(displayUnit="bar") = 100000) "Outlet for water flow"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut( redeclare package Medium = Medium, T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn(redeclare package Medium = Medium, m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 10, nPorts=1, use_p_in=true, p(displayUnit="Pa")) "Inlet for water flow"; Modelica.Blocks.Sources.Sine sine( freqHz=3/86400, offset=100000, amplitude=-solCol.dp_nominal); equation connect(solCol.port_b, TOut.port_a); connect(TOut.port_b, sin.ports[1]); connect(TIn.port_b, solCol.port_a); connect(sou.ports[1], TIn.port_a); connect(weaDat.weaBus, solCol.weaBus); connect(sine.y, sou.p_in); end FlatPlate;

## Buildings.Fluid.SolarCollectors.Examples.FlatPlateShaCoeTrue

Test model for FlatPlate with use_shaCoe_in = true

### Information

This example demonstrates the use of `use_shaCoe_in`. Aside from changed use of `use_shaCoe_in` it is identical to Buildings.Fluid.SolarCollectors.Examples.FlatPlate.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Buildings.Media.Water | Medium in the system

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Medium in the system

### Modelica definition

model FlatPlateShaCoeTrue "Test model for FlatPlate with use_shaCoe_in = true" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Medium in the system"; Buildings.Fluid.SolarCollectors.ASHRAE93 solCol( redeclare package Medium = Medium, shaCoe=0, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, use_shaCoe_in=true, per=Buildings.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_GuangdongFSPTY95(), rho=0.2, azi=0, nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, nPanels=5, sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Series, nSeg=9, lat=0.65938539140346, til=0.5235987755983) "Flat plate solar collector with 3 segments"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos") "Weather data input file"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, use_p_in=false, p(displayUnit="Pa") = 101325, nPorts=1) "Outlet for water flow"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut( redeclare package Medium = Medium, T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn(redeclare package Medium = Medium, m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, use_p_in=false, nPorts=1, T=273.15 + 10, p(displayUnit="Pa") = 101325 + 5*solCol.per.dp_nominal) "Inlet for water flow"; Modelica.Blocks.Sources.Ramp shaCoe( startTime=34040, height=1, duration=24193) "Varying shading coefficient"; equation connect(solCol.port_b, TOut.port_a); connect(TOut.port_b, sin.ports[1]); connect(TIn.port_b, solCol.port_a); connect(sou.ports[1], TIn.port_a); connect(shaCoe.y, solCol.shaCoe_in); connect(weaDat.weaBus, solCol.weaBus); end FlatPlateShaCoeTrue;

## Buildings.Fluid.SolarCollectors.Examples.FlatPlateTotalArea

Example showing the use of TotalArea and nSeg

### Information

This model uses `TotalArea` instead of `nPanels` to define the system size. Aside from that change, this model is identical to Buildings.Fluid.SolarCollectors.Examples.FlatPlate.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Buildings.Media.Water | Medium in the system

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Medium in the system

### Modelica definition

model FlatPlateTotalArea "Example showing the use of TotalArea and nSeg" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Medium in the system"; Buildings.Fluid.SolarCollectors.ASHRAE93 solCol( redeclare package Medium = Medium, shaCoe=0, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, rho=0.2, sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Series, per=Buildings.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_SolahartKf(), nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, nPanels=10, nSeg=9, lat=0.73097781993588, azi=0.3, til=0.5) "Flat plate solar collector model"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos") "Weather data input file"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, use_p_in=false, p(displayUnit="Pa") = 101325, nPorts=2) "Outlet for water flow"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut( redeclare package Medium = Medium, T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn(redeclare package Medium = Medium, m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 10, use_p_in=false, nPorts=2, p(displayUnit="Pa") = 101325 + solCol.dp_nominal) "Inlet for water flow"; Buildings.Fluid.SolarCollectors.ASHRAE93 solCol1( redeclare package Medium = Medium, shaCoe=0, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, rho=0.2, sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Series, per=Buildings.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_SolahartKf(), nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, nPanels=10, nSeg=27, lat=0.73097781993588, azi=0.3, til=0.5) "Flat plate solar collector model"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut1( redeclare package Medium = Medium, T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn1( redeclare package Medium = Medium, m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; equation connect(solCol.port_b, TOut.port_a); connect(TOut.port_b, sin.ports[1]); connect(TIn.port_b, solCol.port_a); connect(sou.ports[1], TIn.port_a); connect(weaDat.weaBus, solCol.weaBus); connect(solCol1.port_b, TOut1.port_a); connect(TIn1.port_b, solCol1.port_a); connect(weaDat.weaBus, solCol1.weaBus); connect(sou.ports[2], TIn1.port_a); connect(TOut1.port_b, sin.ports[2]); end FlatPlateTotalArea;

## Buildings.Fluid.SolarCollectors.Examples.FlatPlateWithTank

Example showing use of the flat plate solar collector in a complete solar thermal system

### Information

This example shows how several different models can be combined to create an entire solar water heating system. The Buildings.Fluid.Storage.StratifiedEnhancedInternalHex (tan) model is used to represent the tank filled with hot water. A loop, powered by a pump ( Buildings.Fluid.Movers.FlowControlled_m_flow, pum), passes the water through an expansion tank ( Buildings.Fluid.Storage.ExpansionVessel, exp), a temperature sensor ( Buildings.Fluid.Sensors.TemperatureTwoPort, TIn), the solar collector ( Buildings.Fluid.SolarCollectors.ASHRAE93, solCol) and a second temperature sensor ( Buildings.Fluid.Sensors.TemperatureTwoPort, TOut) before re-entering the tank.

The solar collector is connected to the weather model ( Buildings.BoundaryConditions.WeatherData.ReaderTMY3, weaDat) which passes information for the San Francisco, CA, USA climate. This information is used to identify both the heat gain in the water from the sun and the heat loss to the ambient conditions.

The flow rate through the pump is controlled by a solar pump controller model ( Buildings.Fluid.SolarCollectors.Controls.SolarPumpController, pumCon) and a gain model. The controller outputs a binary on (1) / off (0) signal. The on/off signal is passed through the gain model, multiplying by 0.04, to represent a flow rate of 0.04 kg/s when the pump is active.

The heat ports for the tank are connected to an ambient temperature of 20 degrees C representing the temperature of the room the tank is stored in.

bou1 ( Buildings.Fluid.Sources.MassFlowSource_T) provides a constant mass flow rate for a hot water draw while bou ( Buildings.Fluid.Sources.Boundary_pT) provides a boundary condition for the outlet of the draw.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Buildings.Media.Water | Fluid in the storage tank
replaceable package Medium_2 | Buildings.Media.Water | Fluid flowing through the collector

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Fluid in the storage tank
replaceable package Medium_2 | Fluid flowing through the collector

### Modelica definition

model FlatPlateWithTank "Example showing use of the flat plate solar collector in a complete solar thermal system" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Fluid in the storage tank"; replaceable package Medium_2 = Buildings.Media.Water "Fluid flowing through the collector"; Buildings.Fluid.SolarCollectors.ASHRAE93 solCol( shaCoe=0, redeclare package Medium = Medium_2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, rho=0.2, nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, nPanels=5, sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Series, per=Buildings.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_SolahartKf(), nSeg=9, lat=0.73097781993588, azi=0.3, til=0.78539816339745) "Flat plate solar collector model"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos", computeWetBulbTemperature=false) "Weather data file reader"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut( T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal, redeclare package Medium = Medium_2) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn(m_flow_nominal=solCol.m_flow_nominal, redeclare package Medium = Medium_2) "Temperature sensor"; Buildings.Fluid.Storage.StratifiedEnhancedInternalHex tan( nSeg=4, redeclare package Medium = Medium, hTan=1.8, m_flow_nominal=0.1, VTan=1.5, dIns=0.07, redeclare package MediumHex = Medium_2, CHex=200, dExtHex=0.01905, hHex_a=0.9, hHex_b=0.65, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, Q_flow_nominal=3000, mHex_flow_nominal=3000/20/4200, T_start=293.15, TTan_nominal=293.15, THex_nominal=323.15, energyDynamicsHex=Modelica.Fluid.Types.Dynamics.FixedInitial) "Storage tank model"; Buildings.Fluid.SolarCollectors.Controls.SolarPumpController pumCon(per=Buildings.Fluid.SolarCollectors.Data.GlazedFlatPlate.FP_ThermaLiteHS20()) "Pump controller"; Buildings.HeatTransfer.Sources.FixedTemperature rooT(T=293.15) "Room temperature"; Modelica.Blocks.Math.Gain gain(k=0.04) "Flow rate of the system in kg/s"; Buildings.Fluid.Sources.Boundary_pT bou(redeclare package Medium = Medium, nPorts=1) "Outlet for hot water draw"; Buildings.Fluid.Sources.MassFlowSource_T bou1( redeclare package Medium = Medium, use_m_flow_in=false, nPorts=1, m_flow=0.001, T=288.15) "Inlet and flow rate for hot water draw"; Buildings.Fluid.Movers.FlowControlled_m_flow pum(redeclare package Medium = Medium_2, m_flow_nominal=0.1, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, dynamicBalance=false) "Pump forcing circulation through the system"; Buildings.Fluid.Storage.ExpansionVessel exp( redeclare package Medium = Medium_2, V_start=0.1) "Expansion tank"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TTan "Temperature in the tank water that surrounds the heat exchanger"; equation connect(solCol.port_b,TOut. port_a); connect(TIn.port_b,solCol. port_a); connect(weaDat.weaBus,solCol. weaBus); connect(weaDat.weaBus, pumCon.weaBus); connect(rooT.port, tan.heaPorTop); connect(rooT.port, tan.heaPorSid); connect(pumCon.y, gain.u); connect(gain.y, pum.m_flow_in); connect(pum.port_b, TIn.port_a); connect(pum.port_a, exp.port_a); connect(exp.port_a, tan.portHex_b); connect(TOut.port_b, tan.portHex_a); connect(bou.ports[1], tan.port_a); connect(bou1.ports[1], tan.port_b); connect(tan.heaPorVol[3], TTan.port); connect(TTan.T, pumCon.TIn); end FlatPlateWithTank;

## Buildings.Fluid.SolarCollectors.Examples.Tubular

Example showing the use of Tubular

### Information

This example models a tubular solar thermal collector. It uses the Buildings.Fluid.SolarCollectors.ASHRAE93 model and references data in the Buildings.Fluid.SolarCollectors.Data.Tubular package.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Buildings.Media.Water | Medium in the system

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Medium in the system

### Modelica definition

model Tubular "Example showing the use of Tubular" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Water "Medium in the system"; Buildings.Fluid.SolarCollectors.ASHRAE93 solCol( redeclare package Medium = Medium, shaCoe=0, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, use_shaCoe_in=false, per=Buildings.Fluid.SolarCollectors.Data.Tubular.T_AMKCollectraAGOWR20(), nPanels=10, sysConfig=Buildings.Fluid.SolarCollectors.Types.SystemConfiguration.Parallel, nColType=Buildings.Fluid.SolarCollectors.Types.NumberSelection.Number, rho=0.2, nSeg=9, lat=0.73097781993588, azi=0.3, til=0.5) "Tubular solar collector model"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= "modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos") "Weather data input file"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, use_p_in=false, p(displayUnit="Pa") = 101325, nPorts=1) "Inlet for fluid flow"; Buildings.Fluid.Sensors.TemperatureTwoPort TOut( redeclare package Medium = Medium, T_start(displayUnit="K"), m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort TIn(redeclare package Medium = Medium, m_flow_nominal=solCol.m_flow_nominal) "Temperature sensor"; Modelica.Blocks.Sources.Sine sine( freqHz=3/86400, offset=101325, amplitude=-1.5*solCol.dp_nominal); Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, T=273.15 + 10, nPorts=1, use_p_in=true, p(displayUnit="Pa")) "Inlet for water flow"; equation connect(solCol.port_b,TOut. port_a); connect(TOut.port_b,sin. ports[1]); connect(TIn.port_b,solCol. port_a); connect(weaDat.weaBus, solCol.weaBus); connect(sine.y, sou.p_in); connect(sou.ports[1], TIn.port_a); end Tubular;