Skip to content

Commit

Permalink
adding all files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Clinton committed Jan 21, 2021
0 parents commit 984f981
Show file tree
Hide file tree
Showing 88 changed files with 441 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CFMvsRPM.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.0, 0.0
2500.0, 100.0
2 changes: 2 additions & 0 deletions Chip_temperature_control.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/>
Binary file added Demo_description.pdf
Binary file not shown.
Binary file added HeatInput.mat
Binary file not shown.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Modeling Systems Governed by PDEs in Simulink

The system being modeled in this Simulink example is a variable-speed fan cooling a CPU which,
depending on the model and the operating point, can generate variable amount of heat. Each component
of the system is modeled using techniques that easily incorporate empirical data and technical
specifications, and all assumptions are stated in the following discussion regarding levels of
modeling fidelity.

The plant in this system is the thermal dynamics of the heat-generating CPU and the heat-dissipating heat
sink. These dynamics are modeled by a finite element formulation of the heat equation on the 3D
geometry. The geometry, meshing, and discretization in this example are done using MATLAB’s PDE
Toolbox. The finite element matrices generated can then be solved using Simulink’s Descriptor State Space
block. For more information on time-dependent finite-element formulations, please see the MathWorks
documentation.
The dominant mode of heat transfer in this scenario is due to convection. A convective boundary condition
is constructed in Simulink for the ducted airflow where forced convection coefficients
would be applied on the internal fin surfaces, and free convection coefficients are applied on the
external facing surfaces of the system.
The heat generation of the CPU can be controlled by the user in this formulation as an input Wattage. This
demonstration provides examples of different loadings of the processor that lead to different heat
generation, thus lending itself useful for design decisions in determining if a certain heat sink is suitable
for a specific CPU.

# Running the Model

This example is organized inside a Simulink Project. Once the project is opened, running “top_script” will
load all the variables needed for the simulation and then execute a parameter sweep. Six scenarios are
included in this example. The six simulations run varied levels of heat generation from the CPU as input
to the plant subsystem.
Upon completion of the parameter sweep, the Simulation Manager will launch. The socket temperature
signal is logged using Simulink Data Inspector and can be visualized by selecting the simulations of
interest and clicking the “Show Results” option. The Signal Editor block, data logging, and adding
additional systems to the model can all provide opportunities to expand on physical system modeling
and the engineering design decision process that goes along with it.
Note, there is an included “debug” plant model that uses the same parameters, but a simpler geometry
with fewer mesh nodes to reduce the number of degrees of freedom. This is useful for debugging the
model and iterating on other parameters in the system outside of the plant. This feature can be utilized
by commenting out “heat_sink_defs” in the “top_script” and replacing it with “heat_sink_defs_DEBUG”.


Contents:

Chip_temperature_control.prj: the Simulink project file

CFMvsRPM.csv, RPMvsV.csv: data tables used to construct 1D lookup tables in Simulink model, can be digitized data from plots

fan.slx, heat_sink.slx, sensor.slx: subsystem files referenced by the top level model

fan_defs.m, heat_sink_defs.m, heat_sink_defs_DEBUG.m, sensor_defs.m: MATLAB scripts to initialize subsystem parameters

top_system.slx: top level model of complete control systems

HeatInput.mat: MAT file that defines Signal Editor scenarios

top_script.m: MATLAB script that calls subsytem scripts, runs simulations with different input scenarios, and opens Simulation Manager

Demo_description.pdf: Detailed write-up of model development and design decisions made
2 changes: 2 additions & 0 deletions RPMvsV.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.0, 0.0
12.0, 2500.0
6 changes: 6 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Reporting Security Vulnerabilities

If you believe you have discovered a security vulnerability, please report it to
[[email protected]](mailto:[email protected]). Please see
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
for additional information.
Binary file added fan.slx
Binary file not shown.
7 changes: 7 additions & 0 deletions fan_defs.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%% cooling fan
tauFan = 0.2192;
%% load digitized data
V2RPM = readmatrix('RPMvsV.csv');
RPM2CFM = readmatrix('CFMvsRPM.csv');
%% conversion constants
CFM2CMS = 0.00047194745; % CFM to cubic meters per second
Binary file added figures/fan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/heat_sink.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/sensor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added heat_sink.slx
Binary file not shown.
86 changes: 86 additions & 0 deletions heat_sink_defs.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
%% heat sink
heatsink = createpde('thermal','transient');
%% heat sink+chip geometry
W = 27*10^-3; % heat sink width
H = 17.5*10^-3; % heat sink fin height
t = 2*10^-3; % approximated fin thickness
nFin = 8; % number of fins on heat sink
dFin = (W - (nFin*t))/(nFin-1); % space between fins, calculated from approximations
R1 = [3 4 0.0 W W 0.0 0.0 0.0 t t]'; % base plate
R2 = [3 4 (0*(t+dFin)) (0*(t+dFin))+t (0*(t+dFin))+t (0*(t+dFin)) t t H-t H-t]'; % fin1
R3 = [3 4 (1*(t+dFin)) (1*(t+dFin))+t (1*(t+dFin))+t (1*(t+dFin)) t t H-t H-t]'; % fin2
R4 = [3 4 (2*(t+dFin)) (2*(t+dFin))+t (2*(t+dFin))+t (2*(t+dFin)) t t H-t H-t]'; % fin3
R5 = [3 4 (3*(t+dFin)) (3*(t+dFin))+t (3*(t+dFin))+t (3*(t+dFin)) t t H-t H-t]'; % fin4
R6 = [3 4 (4*(t+dFin)) (4*(t+dFin))+t (4*(t+dFin))+t (4*(t+dFin)) t t H-t H-t]'; % fin5
R7 = [3 4 (5*(t+dFin)) (5*(t+dFin))+t (5*(t+dFin))+t (5*(t+dFin)) t t H-t H-t]'; % fin6
R8 = [3 4 (6*(t+dFin)) (6*(t+dFin))+t (6*(t+dFin))+t (6*(t+dFin)) t t H-t H-t]'; % fin7
R9 = [3 4 (7*(t+dFin)) (7*(t+dFin))+t (7*(t+dFin))+t (7*(t+dFin)) t t H-t H-t]'; % fin8
R0 = [3 4 0.001 0.026 0.026 0.001 0.0 0.0 -t -t]'; % chip
gd = [R1 R2 R3 R4 R5 R6 R7 R8 R9 R0]; % Geometry description matrix
sf = 'R1+R2+R3+R4+R5+R6+R7+R8+R9+R0'; % Set formula for adding 2D shapes
ns = (char('R1','R2','R3','R4','R5','R6','R7','R8','R9','R0'))'; % Name-space matrix
g = decsg(gd,sf,ns); % Decompose constructive solid 2-D geometry into minimal regions
pg = geometryFromEdges(heatsink,g); % apply geometry to model
gm = extrude(pg,W); % generate 3D geometry from 2D cross section
heatsink.Geometry = gm; % replace model geometry with 3D
m = generateMesh(heatsink,'Hmin',t,'Hgrad',1.9); % try to min(nDoF)
%% visualize geometry to get i/o #s
% figure; pdegplot(heatsink,'FaceLabels','on') % visualize geometry
% figure; pdegplot(heatsink,'CellLabels','on')
% figure; pdemesh(m); axis equal
% figure; pdemesh(m,'NodeLabels','on') % visualize mesh
CPUcell = 1;
freeBCfaces = 1:20; % faces that do not see flow, using free convection
forcedBCfaces = 21:heatsink.Geometry.NumFaces; % faces aligned with flow
outID = findNodes(m,'nearest',[0.026 -t/2 W/2]'); % middle of yz side of casing
%% internal properties
k = 210; % W*m^-1*K^-1
rho = 2710; % kg/m^3
Cp = 900; % J*kg^-1*K^-1
mtl = thermalProperties(heatsink,'ThermalConductivity',k, ...
'MassDensity',rho, ...
'SpecificHeat',Cp); % aluminum alloy 6060 T6
chipHeat = 1; % Watts
chipW = 25e-3; % m
chipL = W; % m
chipH = t; % m
heatPerVol = chipHeat/(chipL*chipW*chipH); % W/m^3
heatSource = internalHeatSource(heatsink,heatPerVol,'Cell',CPUcell);
IC = 294; % Kelvin
thermIC = thermalIC(heatsink,IC); % T = IC everywhere @T=0
%% boundary conditions
Tinf = IC; % ambient temperature, Kelvin
xSectionA = (2*W)*(2*H); % duct cross-sectional area, m^2
rho = 1.225; % kg/m^3
h_free = 9.0;
h_forced = [ ...
0.0, h_free; ...
3.0, 50.0; ...
]; % [V_linear, convective heat transfer coeff]
h_forced(:,1) = h_forced(:,1) * xSectionA * rho; % convert to h = f(mdot)
freeBC = thermalBC(heatsink,'Face',freeBCfaces,'HeatFlux',1); % used as convective BC
forcedBC = thermalBC(heatsink,'Face',forcedBCfaces,'HeatFlux',1); % used as convective BC
%% FE formulation
femat = assembleFEMatrices(heatsink);
K = femat.K; % is the stiffness matrix, the integral of the c coefficient against the basis functions
M = femat.M; % is the mass matrix, the integral of the m or d coefficient against the basis functions.
A = femat.A; % is the integral of the a coefficient against the basis functions.
F = femat.F; % is the integral of the f coefficient against the basis functions.
Q = femat.Q; % is the integral of the q boundary condition against the basis functions.
G = femat.G; % is the integral of the g boundary condition against the basis functions.
H = femat.H; % The H and R matrices come directly from the Dirichlet conditions and the mesh.
R = femat.R; % %
%% construct SL vectors
nDoF = size(K,1);
freeBCnodes = findNodes(m,'Region','Face',freeBCfaces);
unitFreeBC = zeros(nDoF,1);
unitFreeBC(freeBCnodes) = 1;
normalizedFreeBC = zeros(nDoF,1);
normalizedFreeBC(freeBCnodes) = G(freeBCnodes);
forcedBCnodes = findNodes(m,'Region','Face',forcedBCfaces);
unitForcedBC = zeros(nDoF,1);
unitForcedBC(forcedBCnodes) = 1;
normalizedForcedBC = zeros(nDoF,1);
normalizedForcedBC(forcedBCnodes) = G(forcedBCnodes);
x0 = ones(nDoF,1)*IC;
unitCPUHeat = full(F);
75 changes: 75 additions & 0 deletions heat_sink_defs_DEBUG.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
%% heat sink
heatsink = createpde('thermal','transient');
%% heat sink+chip geometry
L = 15e-3; % m
R1 = [3 4 0.0 L L 0.0 0.0 0.0 L L]'; % top cube
R2 = [3 4 0.0 L L 0.0 0.0 0.0 -L -L]'; % bot cube
gd = [R1 R2];
sf = 'R1+R2';
ns = (char('R1','R2'))';

g = decsg(gd,sf,ns); % Decompose constructive solid 2-D geometry into minimal regions
pg = geometryFromEdges(heatsink,g); % apply geometry to model
gm = extrude(pg,L); % generate 3D geometry from 2D cross section
heatsink.Geometry = gm; % replace model geometry with 3D
m = generateMesh(heatsink,'Hmin',5e-3); % try to min(nDoF)
%% visualize geometry to get i/o #s
% figure; pdegplot(heatsink,'FaceLabels','on') % visualize geometry
% figure; pdegplot(heatsink,'CellLabels','on')
% figure; pdemesh(m); axis equal
% figure; pdemesh(m,'NodeLabels','on') % visualize mesh
CPUcell = 1;
freeBCfaces = [1 3 6 8 10]; % faces that do not see flow, using free convection
forcedBCfaces = [2 4 5 9 11]; % faces aligned with flow
outID = 7; % top right corner
%% internal properties
k = 210; % W*m^-1*K^-1
rho = 2710; % kg/m^3
Cp = 900; % J*kg^-1*K^-1
mtl = thermalProperties(heatsink,'ThermalConductivity',k, ...
'MassDensity',rho, ...
'SpecificHeat',Cp); % aluminum alloy 6060 T6
chipHeat = 1; % Watts
chipW = L; % m
chipL = L; % m
chipH = L; % m
heatPerVol = chipHeat/(chipL*chipW*chipH); % W/m^3
heatSource = internalHeatSource(heatsink,heatPerVol,'Cell',CPUcell);
IC = 294; % Kelvin
thermIC = thermalIC(heatsink,IC); % T = IC everywhere @T=0
%% boundary conditions
Tinf = IC; % ambient temperature, Kelvin
xSectionA = (2*L)^2; % duct cross-sectional area, m^2
rho = 1.225; % kg/m^3
h_free = 9.0;
h_forced = [ ...
0.0, h_free; ...
3.0, 50.0; ...
]; % [V_induced, convective heat transfer coeff]
h_forced(:,1) = h_forced(:,1) * xSectionA * rho; % convert to h = f(mdot)
freeBC = thermalBC(heatsink,'Face',freeBCfaces,'HeatFlux',1); % used as convective BC
forcedBC = thermalBC(heatsink,'Face',forcedBCfaces,'HeatFlux',1); % used as convective BC
%% FE formulation
femat = assembleFEMatrices(heatsink);
K = femat.K; % is the stiffness matrix, the integral of the c coefficient against the basis functions
M = femat.M; % is the mass matrix, the integral of the m or d coefficient against the basis functions.
A = femat.A; % is the integral of the a coefficient against the basis functions.
F = femat.F; % is the integral of the f coefficient against the basis functions.
Q = femat.Q; % is the integral of the q boundary condition against the basis functions.
G = femat.G; % is the integral of the g boundary condition against the basis functions.
H = femat.H; % The H and R matrices come directly from the Dirichlet conditions and the mesh.
R = femat.R; % %
%% construct SL vectors
nDoF = size(K,1);
freeBCnodes = findNodes(m,'Region','Face',freeBCfaces);
unitFreeBC = zeros(nDoF,1);
unitFreeBC(freeBCnodes) = 1;
normalizedFreeBC = zeros(nDoF,1);
normalizedFreeBC(freeBCnodes) = G(freeBCnodes);
forcedBCnodes = findNodes(m,'Region','Face',forcedBCfaces);
unitForcedBC = zeros(nDoF,1);
unitForcedBC(forcedBCnodes) = 1;
normalizedForcedBC = zeros(nDoF,1);
normalizedForcedBC(forcedBCnodes) = G(forcedBCnodes);
x0 = ones(nDoF,1)*IC;
unitCPUHeat = full(F);
7 changes: 7 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2020, The MathWorks, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Type="Basic" Visible="1" Icon="" File="top_script.m" Name="Run simulations" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="22b86a1b-1c5b-44fb-8413-a23879258c5b" type="EntryPoint" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Test" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="test" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Other" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="other" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Convenience" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="convenience" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="None" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="none" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Derived" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="derived" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Design" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="design" type="Label" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="READ_ONLY" Name="Artifact" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="artifact" type="Label" />
2 changes: 2 additions & 0 deletions resources/project/Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info MetadataType="fixedPathV2" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info ReadOnly="1" SingleValued="1" DataType="None" Name="Classification" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="FileClassCategory" type="Category" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design" />
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="sensor.slx" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design" />
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="heat_sink.slx" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design" />
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="top_system.slx" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="RPMvsV.csv" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="license.txt" type="File" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design" />
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="fan_defs.m" type="File" />
Loading

0 comments on commit 984f981

Please sign in to comment.