Differences

This shows you the differences between two versions of the page.

Link to this comparison view

model:working_with_time [2025/02/18 04:09] (current)
optrix created
Line 1: Line 1:
 +====Working With Time====
  
 +While most ModelHost models only need to respond to changes in data, some models are time-sensitive (such as forecasting models, running averages/standard deviations or time-series AIs).
 +
 +You can force an output to update once every second by making the output depend on the internal ModelHost clock.
 +
 +<code python>
 +@mdl.part("Time Triggered Model")
 +def TimeTrigger(mod):
 +   TX = mod.AddInput("Time",0,"#Internal.Clock")
 +   Input = mod.AddInput("Value",0,"ARDI Asset.Value")
 +   mod.AddOutput("Result",lambda: float(Input)+20,[Input,TX])
 +</code>
 +
 +The code above will re-calculate the 'result' every second.