In order to calculate producer surplus, we need to define a concept called willingness to sell. A producer's willingness to sell (WTS, or WTA for "willingness to accept") for an item is the minimum amount that it would sell the item for. In general, willingness to sell in a market represents the marginal firm's marginal cost of production. (For example, if a supplier requires a minimum of $10 to sell an item, it must be the case that the marginal firm's marginal cost of producing that unit of the good is $10.)
Interestingly enough, the supply curve represents the willingness to sell (or, equivalently, marginal cost) of the marginal firm. For example, if supply of an item is 3 units at a price of $15, we can infer that the marginal firm faces a marginal cost of $15 for that item. and thus has a willingness to sell of $15.