If B31.1 is your Code, you should use that Code to satisfy your design Code requirement.
The design thus has to meet the requirements of B31.1.

There are different approaches to designing a trunnion. Get some piping handbooks and should get a first rough idea where to start.