A melee weapon with an internal battery that must be charged to function has the powered special property, which lists its capacity and usage. Unlike with a ranged weapon, the usage is for 1 minute of operation rather than per attack, though using a powered weapon for less than 1 full minute still expends 1 full usage. The number of charges expended is equal to the usage × the number of minutes the weapon is used, rounded up to the nearest minute. You can activate the power of the weapon as part of the action used to make an attack with it, and it automatically deactivates after 1 minute.
Some weapons that explode or cause critical hit effects allow the target to attempt a saving throw. The DC of such a saving throw is typically equal to 10 + half the weapon’s item level + one of your ability modifiers. Unless stated otherwise, the ability modifier corresponds to the ability score you’d normally use to make an attack with that weapon ( Dexterity for a ranged or thrown weapon, and Strength for a melee weapon). Any penalty you would normally take to your weapon attack roll also applies to this DC, including penalties from the weapon’s range increment.
As with ranged weapons, you can recharge the battery of a powered melee weapon using a generator or a recharging station, or you can purchase new batteries for it. If you try to attack with a powered weapon that’s out of charges, it functions as an improvised weapon.