modelZoneLinearise

Test for linearisation

Extends from LIDEAS.Components.LinearisationInterface, Modelica.Icons.Example.

Information

This model represents a very simple two-zone building. The model can be linearised by executing the command Linearise in the Commands menu of Dymola. This executes the script at LIDEAS/LIDEAS/Resources/Scripts/linearize.mos, which contains the following code:


OutputCPUtime:=false;

// linearise model and save results in "re"
re=Modelica_LinearSystems2.ModelAnalysis.Linearize("IDEAS.LIDEAS.Examples.ZoneLinearise");

// extract state space matrices from 're' and save them to a mat file in the current working directory
writeMatrix(fileName="ssm_ZoneLinearise.mat",matrixName="A",matrix=re.A);
writeMatrix(fileName="ssm_ZoneLinearise.mat",matrixName="B",matrix=re.B, append=true);
writeMatrix(fileName="ssm_ZoneLinearise.mat",matrixName="C",matrix=re.C, append=true);
writeMatrix(fileName="ssm_ZoneLinearise.mat",matrixName="D",matrix=re.D, append=true);

// save the variable names of the inputs, outputs and states in the current working directory
Modelica.Utilities.Files.remove("uNames_ZoneLinearise.txt");
for i in 1:size(re.uNames,1) loop Modelica.Utilities.Streams.print(re.uNames[i], "uNames_ZoneLinearise.txt"); end for;
Modelica.Utilities.Files.remove("yNames_ZoneLinearise.txt");
for i in 1:size(re.yNames,1) loop Modelica.Utilities.Streams.print(re.yNames[i], "yNames_ZoneLinearise.txt"); end for;
Modelica.Utilities.Files.remove("xNames_ZoneLinearise.txt");
for i in 1:size(re.xNames,1) loop Modelica.Utilities.Streams.print(re.xNames[i], "xNames_ZoneLinearise.txt"); end for;

OutputCPUtime:=true;

The first and last line of the code avoid that the CPU time is also linearised. The second line performs the actual linearisation and stores the resulting state space model in variable re. The next four lines are used to save the four state space matrices contained by re to a file ssm.mat. The remaining four lines of code also export the variable names of the state space inputs (u), states (x) and outputs (y) to three .txt files, which can then be used externally.

Parameters

TypeNameDefaultDescription
IntegernZones2Number of zone
IntegernEmb1Number of embbed systems

Components

TypeNameDefaultDescription
LIDEAS.Components.LinZonegroFloGround floor
IDEAS.Buildings.Components.BoundaryWallcommonWallCommon wall model
IDEAS.Buildings.Components.InternalWallfloorTABS Floor between the two zones.
LIDEAS.Components.LinWindowwindowWindow model
IDEAS.Buildings.Components.SlabOnGroundslabOnGroundFloor model
IDEAS.Buildings.Components.OuterWallouterWallOuter wall model
LIDEAS.Components.LinZonefirFloFirst floor
IDEAS.Buildings.Components.Shading.ShadingControlshadingControlShading control model
IDEAS.Buildings.Components.BoundaryWallcommonWall1Common wall model
Modelica.Blocks.Sources.ConstantTComTemperature at one side of the common wall
Modelica.Blocks.Sources.ConstantQComConstant heat flow at one side of the common wall 1
IDEAS.Buildings.Components.OuterWallouterWall1Outer wall model
IDEAS.Buildings.Components.OuterWallRoofOuter wall model

Contents

NameDescription
Medium

Revisions

  • August 21, 2018 by Damien Picard:
    Change medium to IDEAS.Media.Specialized.DryAir.
  • April 10, 2018 by Damien Picard:
    Add documentation.
  • July 18, 2016 by Filip Jorissen:
    Cleaned up code and implementation.
  • By Filip Jorissen:
    First implementation.