modelDerivative

Test model for the derivative block

Information

Validation test for the block Buildings.Controls.OBC.CDL.Reals.Derivative. The model integrates a time varying signal, and the differentiates this integrated signal. Hence, the output der1.y matches the non-integrated signal intWitRes.u, within a small approximation tolerance.

The instance der1 uses a varying input for T which controls the accuracy of the derivative approximation. At the start of the simulation, T is small and hence the output der1.y matches the signal intWitRes.u well. As expected, the approximation error increases with increasing der1.T.

The instance der2 uses a gain of 2, and it initializes the output to 0. Hence, there is a fast transient at the beginning, and afterwards the output matches der1.y = der2.y / 2.

Components

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Reals.Derivativeder1Derivative block with input gains
Reals.Sources.ConstantconOutputs 1
Reals.Sources.RampramRamp for time constant used in approximating derivative
Buildings.Controls.OBC.CDL.Reals.Sources.CivilTimemodTimCivil time
Buildings.Controls.OBC.CDL.Reals.IntegratorWithResetintWitResIntegration of input
Logical.Sources.ConstantbooSigContant boolean signal
Buildings.Controls.OBC.CDL.Reals.CoscosCosine of model time
Buildings.Controls.OBC.CDL.Reals.Derivativeder2Derivative block with input gains
Reals.Sources.Constantcon2Outputs 2
Reals.Sources.ConstantTTime constant for derivative approximation
Utilities.AssertassMesIssue an error if results differ more than a threshold
Buildings.Controls.OBC.CDL.Reals.SubtractsubDifference between original signal, and differentiated integral of that signal
Buildings.Controls.OBC.CDL.Reals.AbsabsAbsolute difference
Buildings.Controls.OBC.CDL.Reals.LessThresholdlesThrOutput true if difference is within expected accuracy
Buildings.Controls.OBC.CDL.Reals.MultiplyByParametergaiDummy gain to avoid unit difference error

Revisions