Create/Join/Resign/Destroy
Federates have to be joined to a federation before they can exchange simulation data. To join to a federation, the federation must first exist. Who creates the federation is a design decision. One option is to have an annointed manager be responsible for creating the federation. Another option is for all federates to try to create the federation and handle the error should the federation already exist. The code below uses this second approach.
Once your code is done, you resign from the federation. The federation is then destroyed. Again, how the federation is destroyed is a design decision. Given the decision above to have all federates attempt to create the federation, we will also have all federates attempt to destroy the federation. The last federate to resign from the federation will successfully destroy the federation. All other federates will receive an exception stating that federates are still joined to the federation.
Pseudocode
Create the federation
Join the federation
Your code
Resign from the federation
Destroy the federation
C++
Last updated
Was this helpful?