Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a unit and update a term to be vectorized in ArrayEquations.HeatTransfer #470

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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