I send bellow the code to do that.
But in my case I want to develop this with the limits imposed by EN15251.
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:SENSOR ===========
EnergyManagementSystem:Sensor,
T1, !- Name
Thermal Zone 6, !- Output:Variable or Output:Meter Index Key Name
Zone Mean Air Temperature; !- Output:Variable or Output:Meter Name
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAMCALLINGMANAGER ===========
EnergyManagementSystem:ProgramCallingManager,
Annual Discomfort Time, !- Name
EndOfZoneTimestepBeforeZoneReporting, !- EnergyPlus Model Calling Point
OverheatingCheck; !- Program Name 1
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAM ===========
EnergyManagementSystem:Program,
OverheatingCheck, !- Name
SET UpperLimit = 25, !- Program Line 1
SET Temperature = T1 > UpperLimit, !- Program Line 2
SET OverheatingRate = Temperature; !- A4
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:GLOBALVARIABLE ===========
EnergyManagementSystem:GlobalVariable,
OverheatingRate; !- Erl Variable 1 Name
!- =========== ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:OUTPUTVARIABLE ===========
EnergyManagementSystem:OutputVariable,
Discomfort Time, !- Name
OverheatingRate, !- EMS Variable Name
Summed, !- Type of Data in Variable
ZoneTimeStep; !- Update Frequency
!- =========== ALL OBJECTS IN CLASS: OUTPUT:VARIABLEDICTIONARY ===========
Output:VariableDictionary,
IDF, !- Key Field
Unsorted; !- Sort Option
!- =========== ALL OBJECTS IN CLASS: OUTPUT:ENERGYMANAGEMENTSYSTEM ===========
Output:EnergyManagementSystem,
Verbose, !- Actuator Availability Dictionary Reporting
Verbose, !- Internal Variable Availability Dictionary Reporting
Verbose; !- EMS Runtime Language Debug Output Level