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
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Controls.OBC.CDL.Reals.Derivative | der1 | Derivative block with input gains | |
| Reals.Sources.Constant | con | Outputs 1 | |
| Reals.Sources.Ramp | ram | Ramp for time constant used in approximating derivative | |
| Buildings.Controls.OBC.CDL.Reals.Sources.CivilTime | modTim | Civil time | |
| Buildings.Controls.OBC.CDL.Reals.IntegratorWithReset | intWitRes | Integration of input | |
| Logical.Sources.Constant | booSig | Contant boolean signal | |
| Buildings.Controls.OBC.CDL.Reals.Cos | cos | Cosine of model time | |
| Buildings.Controls.OBC.CDL.Reals.Derivative | der2 | Derivative block with input gains | |
| Reals.Sources.Constant | con2 | Outputs 2 | |
| Reals.Sources.Constant | T | Time constant for derivative approximation | |
| Utilities.Assert | assMes | Issue an error if results differ more than a threshold | |
| Buildings.Controls.OBC.CDL.Reals.Subtract | sub | Difference between original signal, and differentiated integral of that signal | |
| Buildings.Controls.OBC.CDL.Reals.Abs | abs | Absolute difference | |
| Buildings.Controls.OBC.CDL.Reals.LessThreshold | lesThr | Output true if difference is within expected accuracy | |
| Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter | gai | Dummy gain to avoid unit difference error |
Revisions
-
May 20, 2022, by Michael Wetter:
First implementation.
This is for Buildings, issue 3022.