Signals are by default floating point in the generated code. PLECS will generate an error during code generation whenever a non-boolean signal is fed into a switching element. This is to urge users to use the appropriate components from the “Power Modules” section of the PLECS library which are significantly better suited for code generation and high fidelity real-time simulation.
In some cases there may not be an appropriate power module or the switch is a simple disconnect. In those cases you can eliminate the error by explicitly converting the signal’s data type to a boolean, as you have done.
In addition to using the Data Type block, in some cases you can also change the “Output data type” parameter of the component supplying to the gate input (the Pulse Generator in your model). This has the same net effect.