blockPWM
Compares a sine and a triangular signal. If sine is bigger, the output is vU and vL else.
Extends from ModelicaDEVS.Templates.DSource (DEVS source block).
Information
The PWM BlockParameters:
| as | amplitude of sine signal |
| fs | frequency of sine signal |
| at | amplitude of triangular signal |
| ft | frequency of triangular signal |
| vU | upper output value |
| vL | lower output value |
Description:
The PWM block generates a pulse width modulation signal defined by the comparison between a sine signal and a triangular signal.
This block is an example demonstrating the possibility to reuse models as blocks within other models: instead of programming the PWM signal explicitly, it is actually an assembly of three other blocks: a Sine source, a Triangular source and a Comparator. The functionality of these three blocks is packed into one block (the PWM block) which can be reused as a component in other models. The interior structure of the PWM block can be found when activating the diagram-view of the PWM block.
Generated Events (QSS1/QSS2/QSS3 mode):
| Output is generated each time the two signals (sine/triangular) cross each other. If the sine signal is bigger than the triangular signal, the output takes a value of vU, and vL otherwise. |
![]() |
Parameter setting: |
fs=1 a=1 at=1 ft=16 vU=1 vL=-1 |
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | method (from DSource) | world.qss | Use QSS1, QSS2 or QSS3 |
| Real | as | 1 | Amplitude of sine signal |
| Real | fs | 1 | Frequency of sine |
| Real | at | 1 | Amplitude of triangular signal |
| Real | ft | 1 | Frequency of triangular signal |
| Real | vU | 1 | Upper Value of PWM signal |
| Real | vL | -1 | Lower Value of PWM signal |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| ModelicaDEVS.Templates.DiscreteOutPort | outPort (from DSource) |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| ModelicaDEVS.Miscellaneous.worldModel | world (from DSource) | ||
| Triangular | Triangular1 | ||
| FunctionBlocks.Comparator | Comparator1 | ||
| Sine | Sine1 |
