Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within ModelicaByExample.ArrayEquations.HeatTransfer;
model Rod_ArrayComprehensions
"Modeling heat conduction in a rod using array comprehensions"
type Temperature=Real(unit="K", min=0);
type ConvectionCoefficient=Real(unit="W/K", min=0);
type ConvectionCoefficient=Real(unit="W/(m2.K)", min=0);
type ConductionCoefficient=Real(unit="W.m-1.K-1", min=0);
type Mass=Real(unit="kg", min=0);
type SpecificHeat=Real(unit="J/(K.kg)", min=0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within ModelicaByExample.ArrayEquations.HeatTransfer;
model Rod_ArrayComprehensionsOneEquation
"Modeling heat conduction in a rod using single equation with array comprehensions"
type Temperature=Real(unit="K", min=0);
type ConvectionCoefficient=Real(unit="W/K", min=0);
type ConvectionCoefficient=Real(unit="W/(m2.K)", min=0);
type ConductionCoefficient=Real(unit="W.m-1.K-1", min=0);
type Mass=Real(unit="kg", min=0);
type SpecificHeat=Real(unit="J/(K.kg)", min=0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within ModelicaByExample.ArrayEquations.HeatTransfer;
model Rod_ForLoop "Modeling heat conduction in a rod using a for loop"
type Temperature=Real(unit="K", min=0);
type ConvectionCoefficient=Real(unit="W/K", min=0);
type ConvectionCoefficient=Real(unit="W/(m2.K)", min=0);
type ConductionCoefficient=Real(unit="W.m-1.K-1", min=0);
type Mass=Real(unit="kg", min=0);
type SpecificHeat=Real(unit="J/(K.kg)", min=0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within ModelicaByExample.ArrayEquations.HeatTransfer;
model Rod_VectorNotation
"Modeling heat conduction in a rod using vector notation"
type Temperature=Real(unit="K", min=0);
type ConvectionCoefficient=Real(unit="W/K", min=0);
type ConvectionCoefficient=Real(unit="W/(m2.K)", min=0);
type ConductionCoefficient=Real(unit="W.m-1.K-1", min=0);
type Mass=Real(unit="kg", min=0);
type SpecificHeat=Real(unit="J/(K.kg)", min=0);
Expand Down Expand Up @@ -31,6 +31,6 @@ initial equation
T = linspace(200,300,n);
equation
rho*V*C*der(T[1]) = -h*A_s*(T[1]-Tamb)-k*A_c*(T[1]-T[2])/(L/n);
rho*V*C*der(T[2:n-1]) = -h*A_s*(T[i]-Tamb)-k*A_c*(T[2:n-1]-T[1:n-2])/(L/n)-k*A_c*(T[2:n-1]-T[3:n])/(L/n);
rho*V*C*der(T[2:n-1]) = -h*A_s*(T[2:n-1]-fill(Tamb, n-2))-k*A_c*(T[2:n-1]-T[1:n-2])/(L/n)-k*A_c*(T[2:n-1]-T[3:n])/(L/n);
rho*V*C*der(T[end]) = -h*A_s*(T[end]-Tamb)-k*A_c*(T[end]-T[end-1])/(L/n);
end Rod_VectorNotation;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within ModelicaByExample.ArrayEquations.HeatTransfer;
model Rod_VectorNotationNoSubscripts
"Modeling heat conduction in a rod using vector notation"
type Temperature=Real(unit="K", min=0);
type ConvectionCoefficient=Real(unit="W/K", min=0);
type ConvectionCoefficient=Real(unit="W/(m2.K)", min=0);
type ConductionCoefficient=Real(unit="W.m-1.K-1", min=0);
type Mass=Real(unit="kg", min=0);
type SpecificHeat=Real(unit="J/(K.kg)", min=0);
Expand Down