HeatCapacitor

model HeatCapacitor "Lumped thermal element storing heat"
    parameter Modelica.SIunits.HeatCapacity C "Heat capacity of element (= cp*m)";
    Modelica.SIunits.Temperature T(start = 293.15, displayUnit = "degC") "Temperature of element";
    Modelica.SIunits.TemperatureSlope der_T(start = 0) "Time derivative of temperature (= der(T))";
    Interfaces.HeatPort_a port annotation (Placement(transformation(
        origin = {0, -100},
        extent = {
            {-10, -10}, 
            {10, 10}},
        rotation = 90)));
equation
    C * der(T) = port.Q_flow;
    T = port.T;
    der_T = der(T);

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {-150, 110}, 
                        {150, 70}},
                    textString = "%name",
                    lineColor = {0, 0, 255}), 
                Polygon(
                    points = {
                        {0, 67}, 
                        {-20, 63}, 
                        {-40, 57}, 
                        {-52, 43}, 
                        {-58, 35}, 
                        {-68, 25}, 
                        {-72, 13}, 
                        {-76, -1}, 
                        {-78, -15}, 
                        {-76, -31}, 
                        {-76, -43}, 
                        {-76, -53}, 
                        {-70, -65}, 
                        {-64, -73}, 
                        {-48, -77}, 
                        {-30, -83}, 
                        {-18, -83}, 
                        {-2, -85}, 
                        {8, -89}, 
                        {22, -89}, 
                        {32, -87}, 
                        {42, -81}, 
                        {54, -75}, 
                        {56, -73}, 
                        {66, -61}, 
                        {68, -53}, 
                        {70, -51}, 
                        {72, -35}, 
                        {76, -21}, 
                        {78, -13}, 
                        {78, 3}, 
                        {74, 15}, 
                        {66, 25}, 
                        {54, 33}, 
                        {44, 41}, 
                        {36, 57}, 
                        {26, 65}, 
                        {0, 67}},
                    lineColor = {160, 160, 164},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {-58, 35}, 
                        {-68, 25}, 
                        {-72, 13}, 
                        {-76, -1}, 
                        {-78, -15}, 
                        {-76, -31}, 
                        {-76, -43}, 
                        {-76, -53}, 
                        {-70, -65}, 
                        {-64, -73}, 
                        {-48, -77}, 
                        {-30, -83}, 
                        {-18, -83}, 
                        {-2, -85}, 
                        {8, -89}, 
                        {22, -89}, 
                        {32, -87}, 
                        {42, -81}, 
                        {54, -75}, 
                        {42, -77}, 
                        {40, -77}, 
                        {30, -79}, 
                        {20, -81}, 
                        {18, -81}, 
                        {10, -81}, 
                        {2, -77}, 
                        {-12, -73}, 
                        {-22, -73}, 
                        {-30, -71}, 
                        {-40, -65}, 
                        {-50, -55}, 
                        {-56, -43}, 
                        {-58, -35}, 
                        {-58, -25}, 
                        {-60, -13}, 
                        {-60, -5}, 
                        {-60, 7}, 
                        {-58, 17}, 
                        {-56, 19}, 
                        {-52, 27}, 
                        {-48, 35}, 
                        {-44, 45}, 
                        {-40, 57}, 
                        {-58, 35}},
                    fillColor = {160, 160, 164},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-69, 7}, 
                        {71, -24}},
                    textString = "%C")}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Polygon(
                    points = {
                        {0, 67}, 
                        {-20, 63}, 
                        {-40, 57}, 
                        {-52, 43}, 
                        {-58, 35}, 
                        {-68, 25}, 
                        {-72, 13}, 
                        {-76, -1}, 
                        {-78, -15}, 
                        {-76, -31}, 
                        {-76, -43}, 
                        {-76, -53}, 
                        {-70, -65}, 
                        {-64, -73}, 
                        {-48, -77}, 
                        {-30, -83}, 
                        {-18, -83}, 
                        {-2, -85}, 
                        {8, -89}, 
                        {22, -89}, 
                        {32, -87}, 
                        {42, -81}, 
                        {54, -75}, 
                        {56, -73}, 
                        {66, -61}, 
                        {68, -53}, 
                        {70, -51}, 
                        {72, -35}, 
                        {76, -21}, 
                        {78, -13}, 
                        {78, 3}, 
                        {74, 15}, 
                        {66, 25}, 
                        {54, 33}, 
                        {44, 41}, 
                        {36, 57}, 
                        {26, 65}, 
                        {0, 67}},
                    lineColor = {160, 160, 164},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {-58, 35}, 
                        {-68, 25}, 
                        {-72, 13}, 
                        {-76, -1}, 
                        {-78, -15}, 
                        {-76, -31}, 
                        {-76, -43}, 
                        {-76, -53}, 
                        {-70, -65}, 
                        {-64, -73}, 
                        {-48, -77}, 
                        {-30, -83}, 
                        {-18, -83}, 
                        {-2, -85}, 
                        {8, -89}, 
                        {22, -89}, 
                        {32, -87}, 
                        {42, -81}, 
                        {54, -75}, 
                        {42, -77}, 
                        {40, -77}, 
                        {30, -79}, 
                        {20, -81}, 
                        {18, -81}, 
                        {10, -81}, 
                        {2, -77}, 
                        {-12, -73}, 
                        {-22, -73}, 
                        {-30, -71}, 
                        {-40, -65}, 
                        {-50, -55}, 
                        {-56, -43}, 
                        {-58, -35}, 
                        {-58, -25}, 
                        {-60, -13}, 
                        {-60, -5}, 
                        {-60, 7}, 
                        {-58, 17}, 
                        {-56, 19}, 
                        {-52, 27}, 
                        {-48, 35}, 
                        {-44, 45}, 
                        {-40, 57}, 
                        {-58, 35}},
                    fillColor = {160, 160, 164},
                    fillPattern = FillPattern.Solid), 
                Ellipse(
                    extent = {
                        {-6, -1}, 
                        {6, -12}},
                    lineColor = {255, 0, 0},
                    fillColor = {191, 0, 0},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {11, 13}, 
                        {50, -25}},
                    textString = "T"), 
                Line(
                    points = {
                        {0, -12}, 
                        {0, -96}},
                    color = {255, 0, 0})}),
        Documentation(info = "<html>\n<p>\nThis is a generic model for the heat capacity of a material.\nNo specific geometry is assumed beyond a total volume with\nuniform temperature for the entire volume.\nFurthermore, it is assumed that the heat capacity\nis constant (independent of temperature).\n</p>\n<p>\nThe temperature T [Kelvin] of this component is a <strong>state</strong>.\nA default of T = 25 degree Celsius (= SIunits.Conversions.from_degC(25))\nis used as start value for initialization.\nThis usually means that at start of integration the temperature of this\ncomponent is 25 degrees Celsius. You may, of course, define a different\ntemperature as start value for initialization. Alternatively, it is possible\nto set parameter <strong>steadyStateStart</strong> to <strong>true</strong>. In this case\nthe additional equation '<strong>der</strong>(T) = 0' is used during\ninitialization, i.e., the temperature T is computed in such a way that\nthe component starts in <strong>steady state</strong>. This is useful in cases,\nwhere one would like to start simulation in a suitable operating\npoint without being forced to integrate for a long time to arrive\nat this point.\n</p>\n<p>\nNote, that parameter <strong>steadyStateStart</strong> is not available in\nthe parameter menu of the simulation window, because its value\nis utilized during translation to generate quite different\nequations depending on its setting. Therefore, the value of this\nparameter can only be changed before translating the model.\n</p>\n<p>\nThis component may be used for complicated geometries where\nthe heat capacity C is determined my measurements. If the component\nconsists mainly of one type of material, the <strong>mass m</strong> of the\ncomponent may be measured or calculated and multiplied with the\n<strong>specific heat capacity cp</strong> of the component material to\ncompute C:\n</p>\n<pre>\n   C = cp*m.\n   Typical values for cp at 20 degC in J/(kg.K):\n      aluminium   896\n      concrete    840\n      copper      383\n      iron        452\n      silver      235\n      steel       420 ... 500 (V2A)\n      wood       2500\n</pre>\n</html>"));
end HeatCapacitor;