The principles are correct but i would use
"Main.HumanModel.BodyModel.SelectedOutput.Right.Leg.JointMomentMeasure.HipFlexion" and the knee equivalent instead of the moment measures you have.

So the joint power should be calculated based on this, right?
KneePower = Main.HumanModel.BodyModel.SelectedOutput.Right.Leg.JointMomentMeasure.KneeFlexion* Main.HumanModel.BodyModel.Interface.Right.KneeFlexion.Vel [0];

Can you tell me what is the difference between the results under these two paths.I found that their values are not the same.
"Main.HumanModel.BodyModel.SelectedOutput.Right.Leg.JointMomentMeasure.HipFlexion"
Main.HumanModel.BodyModel.Right.Leg.MomentMeasure.HipNetMoment.M[0]
Thank you in advance.

it is a good question
Please have a look at the objects "HipNetMomentMuscle" and HipNetMoment in the LegMoments.any file.

in the top of this file there is an explanation saying:

//This file contains a moment measures for the following joints in the Leg:
//Ankle
//Knee
//Hip
//The measures named:
//AnkleNetMoment
//KneeNetMoment
//HipNetMoment
//will measure the moments and forces supplied by the muscles spanning these and on top of these
//moments and force the forces and moments from the constraints in the joints will be added.
//The resulting force and moment are equal to the to total moment and force which
//could replace both the muscles spanning the joint and the joints reactions.
//The measures named:
//AnkleNetMomentMuscle
//KneeNetMomentMuscle
//HipNetMomentMuscle
//will measure ONLY the moments and forces supplied by the muscles spanning these joint and not the moments and forces which from the constraints in the joints.
//The resulting force and moment are equal to the to total moment and force which
//are supplied by the muscles.
//In both cases the resulting force and moment is given in the global coordinate system.
//A vector which shows the resulting moment as an arrow, will automatically be shown in the model view the parameters of it can
//be controlled from the "DrawSettings.any" file typically to be found in the application directory.,

A few comments to this: the HipNetMoment report in global as the comment says the other does too but there is also a transformation to local system.

Thank you for your reply. HipFlexion is the total muscles contribution to the joint moment, HipNetMoment is the sum of all inertial, joint reaction forces,gravitational, and external forces. So I should calculate the power like this，right？
Main.HumanModel.BodyModel.SelectedOutput.Right.Leg.JointMomentMeasure.KneeFlexion* Main.HumanModel.BodyModel.Interface.Right.KneeFlexion.Vel [0];

Can you tell me why the JointNetMomentMuscle and JointNetMoment of the spherical joint are equal, but the rotation joint is not equal?

And MHipAbduction and MHipFlexion in HipNetMomentMuscle are equal to HipAbduction and HipFlexion in SelectedOutput, but why are the values of MKneeFlexion in KneeNetMomentMuscle and KneeFlexion in SelectedOutput opposite? I checked the reference system and still don’t understand, thank you for your help.

I would like to add that it is theorerically incorrect to talk about a sagital power in a 3D model. What you need to compute is the power transfered across the joint defined as the dot product between the moment vector and the relative velocity vector between the two segments.

Talking about a sagital power would equivalent to talking about sagital plane kinetic energy, which clearly would be meaningless. Both of them are computed from 3D vectors with the result being a scalar - not a vector.