Hi Safi Ahmed!
You need to have an event that changes a time variable that keeps track of when the values of u1 and u2 last where 0 at the same time, and then check if it has been within 5 seconds since last this occurred. Does the following code work as you intended your NOR block? Once you input two 0:s, it will give a 1 for 5 seconds (even if one of the inputs changes during that time).
model ModifiedNOR
extends Modelica.Blocks.Interfaces.partialBooleanSI2SO;
protected
discrete Modelica.SIunits.Time entryTime "Time instant when NOR became true";
initial equation
pre(entryTime) = 0;
equation
when not (u1 or u2) then
entryTime = time;
end when;
y = if time - entryTime < 5 then true else false;
annotation(Diagram(coordinateSystem(extent = {{-148.5, -105}, {148.5, 105}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})));
end ModifiedNOR;
Here are some resources if you want to learn more about events and when-statements.
Hope that helps!