-
-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
Labels
Description
To implement generic discrete-time components, we need operators that return the sample time and the clock associated with an equation, without these being explicitly specified in the component. As an example, consider the component below, where the clock is unspecified. MTK already has the capability of inferring the clock for the z = ShiftIndex()
and the equation y(z) ~ k*(u(z) - u(z-1)) / sampletime()
, this feature request is to add support for inferring the value of the sampletime()
to be sampletime(inferred_clock)
.
@mtkmodel DiscreteDerivative begin
@extend u, y = siso = SISO()
@parameters begin
k = 1, [description = "Gain"]
end
begin
z = ShiftIndex()
end
@equations begin
y(z) ~ k*(u(z) - u(z-1)) / sampletime()
end
end