Skip to content

Matlab code to simulate the state space model obtained from the LIDEAS linearization

Notifications You must be signed in to change notification settings

open-ideas/hybridGeotabsMatlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Simulation in matlab
^^^^^^^^^^^^^
This section describes the provided matlab code which allows the simulation of the SSM originating from the linearisation of the modelica model. The code includes functions to load the disturbances and prescribed variables generated by the createOutputs models (see previous section), to generate a discrete SSM and reduce it to a reduced order model (ROM) of desired order, and to simulate and compare the SSM and ROMs in matlab. 

Load disturbances
===========
The file hybridGeotabsMatlab/utilities/disturbances.m contains a function to read the outputs generated by the dymola script  'Create outputs' described in the previous section and to convert them into a time vector (t) and a disturbance matrix (v). If precomputed variables are contained in the output file, they will be added to the matrix v. The function also returns a list of the input index of each disturbance and of each prescribed variable (i.e. the index in the SSM input vector coinciding with the variable) and dictionaries which contain the control input and output names and indexes. The indexes are used to automatically connect the disturbance matrix v to the SSM and to tell the user which inputs of the SSM can be used for control purposes.

Generation of discrete SSM and ROM
=======================
The file hybridGeotabsMatlab/utilities/fGenerateSysAndRom.m contains a function that generates a discrete SSM from the continuous SSM obtained from Dymola and reduces it to reduced order models (ROMs) of user-defined orders. The ROMs are also augmented in order to include to the non-zero initial conditions (see paper: Picard D., Drgona J., Kvasnica M., Helsen L. (2017). Impact of the controller model complexity on model predictive control performance for buildings. Energy and Buildings, 152, 739-751).

SSM simulation
==========
The file hybridGeotabsMatlab/utilities/run_simulation.m contains a function to simulate the SSM (SSM) and reduced SSM (ROM). The disturbances and prescribed variables are loaded using disturbances.m and the SSM and ROMs are created using fGenerateSysAndRom.m. The SSM and ROMs outputs can also be plotted and compared. Run the file run_simulation.m to see an example. By default, the function will use the linearized SSM contained in hybridGeotabsMatlab\examples\zoneWithInputs.

About

Matlab code to simulate the state space model obtained from the LIDEAS linearization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages