modelDetailedHouse8

JSON writer

Extends from DetailedHouse7 (Adding a controller).

Information

Extracting results from Dymola can be tedious. Therefore, several custom tools have been developed to facilitate exporting simulation results. For time-series data, a generic CSV writer can be found in IDEAS.Utilities.IO.Files.JSONWriter. This model generates a CSV file at a user-defined location that contains data for each of the inputs of the block. The delimiter can be modified in the advanced parameter tab. The model IDEAS.Utilities.IO.Files.CombiTimeTableWriter, does the same, albeit using a slightly different file format which can be read directly back into Modelica using the file reader Modelica.Blocks.Sources.CombiTimeTable.

In this example we will not output time series data, only a single value: the total electricity consumption at the end of the simulation, using the JSON file format. Note that the external library ExternData can be used to read JSON files.

Required models

Connection instructions

Add the model, choose a file path and indicate the appropriate time when the result should be saved. Connect the appropriate signal to the input of the block.

Reference result

Check the contents of the generated file. Depending on the chosen value for the parameter varKeys, the result should be similar to: {"Electrical energy [kWh]"}: 1.7425569229e+01

Parameters

TypeNameDefaultDescription
Modelica.Units.SI.Lengthl (from DetailedHouse5)8Zone length
Modelica.Units.SI.Lengthw (from DetailedHouse5)4Zone width
Modelica.Units.SI.Lengthh (from DetailedHouse5)2.8Zone height

Components

TypeNameDefaultDescription
IDEAS.BoundaryConditions.SimInfoManagersim (from DetailedHouse5)
IDEAS.Buildings.Components.RectangularZoneTemplaterecZon (from DetailedHouse5)Northern part of the zone
IDEAS.Buildings.Components.RectangularZoneTemplaterecZon1 (from DetailedHouse5)Southern part of the zone
IDEAS.Fluid.HeatPumps.ScrollWaterToWaterheaPum (from DetailedHouse6)Heat pump model, rescaled for low thermal powers
IDEAS.Fluid.HeatExchangers.Radiators.RadiatorEN442_2rad (from DetailedHouse6)Radiator for zone 1
IDEAS.Fluid.HeatExchangers.Radiators.RadiatorEN442_2rad1 (from DetailedHouse6)Radiator for zone 2
IDEAS.Fluid.Actuators.Valves.TwoWayTRVval (from DetailedHouse6)Thermostatic valve for first zone
IDEAS.Fluid.Movers.FlowControlled_dppumEmi (from DetailedHouse6)Circulation pump of the heat emission (radiator) side of the circuit
IDEAS.Fluid.Sources.Boundary_pTbou (from DetailedHouse6)Cold water source for heat pump
IDEAS.Fluid.Actuators.Valves.TwoWayTRVval1 (from DetailedHouse6)Thermostatic valve for second zone
IDEAS.Fluid.Movers.FlowControlled_dppumPri (from DetailedHouse6)Circulation pump at the primary (evaporator) side of the heat pump
Modelica.Blocks.Sources.IntegerConstantheaPumOn (from DetailedHouse6)Heat pump is on
Modelica.Blocks.Continuous.IntegratorEEl (from DetailedHouse6)Electrical energy meter with conversion to kWh
IDEAS.Fluid.Sensors.TemperatureTwoPortsenTemSup (from DetailedHouse6)Supply water temperature sensor
IDEAS.Fluid.Sources.Boundary_pTbou1 (from DetailedHouse6)Cold water source for heat pump
IDEAS.Fluid.Storage.Stratifiedtan (from DetailedHouse6)Buffer tank for avoiding excessive heat pump on/off switches
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensorsenTan (from DetailedHouse6)Temperature sensor of tank volume
IDEAS.Fluid.Movers.FlowControlled_dppumSec (from DetailedHouse6)Circulation pump at the secondary (condenser) side of the heat pump
Modelica.Blocks.Logical.Hysteresishys (from DetailedHouse7)Hysteresis controller
Modelica.Blocks.Math.BooleanToRealbooToRea (from DetailedHouse7)Conversion to real control signal
IDEAS.Utilities.IO.Files.JSONWriterjsonWri

Revisions

  • April 14, 2025, by Anna Dell'Isola and Lone Meertens:
    Update and restructure IDEAS tutorial models. See #1374 and #1389.
  • September 18, 2019 by Filip Jorissen:
    First implementation for the IDEAS crash course.