Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Jul 25, 2024
1 parent ae261af commit 1fa5402
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/torque_controlled_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ function calc_viscous_friction(wm::TorqueControlledMachine, omega)
end

function calc_acceleration(wm::TorqueControlledMachine, speed, force; set_torque=nothing, set_speed=nothing, use_brake = false)
if use_brake
# if abs(set_speed) < 0.9 * wm.v_min
# wm.brake = true
# elseif abs(set_speed) > 1.1 * wm.v_min
# wm.brake = false
# end
# if wm.brake
# # if the brake is active the acceleration proportional to the speed
# # TODO: check if this is physically correct
# return wm.brake_acc * speed
# end
if use_brake && ! isnothing(set_speed)
if abs(set_speed) < 0.9 * wm.v_min
wm.brake = true
elseif abs(set_speed) > 1.1 * wm.v_min
wm.brake = false
end
if wm.brake
# if the brake is active the acceleration proportional to the speed
# TODO: check if this is physically correct
return wm.brake_acc * speed
end
end
# limit the acceleration
if ! isnothing(set_speed)
Expand Down

0 comments on commit 1fa5402

Please sign in to comment.