Project 1
The cylinder and piston, use the Revolved Solid (Simscape Multibody) and Cylindrical Solid .Then use a Prismatic Joint, To easily calculate the lengths of the chambers A and B, and follower frame (F) of the joint to the centers of the left inner surface of the chamber A and the left surface of the piston, B and F frames are aligned and both point toward chamber B.