PWM generation using RT-Events and Digital IO example

Here is a complete loopback example of PWM generation / detection using RT-Events and Opal-RT Digital IO. Here are the things to know for this type of application "

  • The model must be executed in "Hardware Synchronized" mode
  • A digital 16 Din / 16 Dout loopback must be connected to the digital IO slot
  • "RTE Conversion OP5110-5120 Event Generator/Detector" block and "OP5110-5120 Event Generator" block must have the same "Time Unit" setting
  • "OP5110-5120 Event Detector" block and "RTE Conversion OP5110-5120 Event Generator/Detector1" block must have the same "Time Unit" setting
  • Parameter "Signal Edge" from "OP5110-5120 Event Detector" block should be set to "both"
  • The duty cycle of SPWM block must be scaled between 0 and 1
  • RTE can support multiple events (transitions) within a single time-step
  • The maximum frequency you can reach for PWM is automatically computed : Fmax = NumEvents / (2*Ts) and is displayed in the console

PWM_generation.mdl - detailed example model