In frame analysis with finite element every node can be assumed with 6 Degree of Freedom (3 translation DoF and 3 rotational DoF). There are formulations over the web for creating stiffness matrix etc. of frame elements like this one. These formulation does model rigid joints which means element is totally connected to nodes, but i need a document to describe how to model pinned joints like this image:
A pin restricts all relative translation and 2 dof of relative rotation. Therefore, you should impose that the nodes being "pinned" have this property. Implementation of this is straightforward after assembly of the full FE system. You must use 2 nodes at the joint--one for each part. If you only use a single node that gets shared between parts, you will be effectively saying that those two pieces are rigidly connected.
Truss elements, as opposed to beam elements, don't usually include rotational freedoms so there's no need to release them to model a pin-joint. The structure illustrated could be modelled with a 2-D beam element for the left-hand part (encastre at the wall) and a 2-D truss element for the right hand element (roller supported at the end). The beam element will include rotational freedoms but, because the truss element won't, the joint will act as a pin.
nodes node(1)... coordinates of left-hand end node(2)... coordinates of joint node(3)... coordinates of right-hand end elements elem,type=2Dbeam.... joins node(1) to node(2) elem,type=2Dtruss... joins node(2) to node(3) constraints node(1) disp(x)=0,disp(y)=0,rotation=0 node(3) disp(y)=0
This is for the simplest case, with a point load at the joint.