diff --git a/src/WinchModels.jl b/src/WinchModels.jl index 9000f3b..e137296 100644 --- a/src/WinchModels.jl +++ b/src/WinchModels.jl @@ -39,7 +39,7 @@ abstract type AbstractWinchModel end const AWM = AbstractWinchModel include("async_generator.jl") -include("torque_controlled_generator.jl") include("winch_controller.jl") +include("torque_controlled_generator.jl") end \ No newline at end of file diff --git a/src/torque_controlled_generator.jl b/src/torque_controlled_generator.jl index 9d2776c..eb66b2a 100644 --- a/src/torque_controlled_generator.jl +++ b/src/torque_controlled_generator.jl @@ -32,6 +32,8 @@ Model of a winch with an torque controlled generator and a gearbox. """ @with_kw mutable struct TorqueControlledMachine <: AbstractWinchModel @deftype Float64 set::Settings + "winch speed controller" + wcs::WinchSpeedController "minimal speed of the winch in m/s. If v_set is lower the brake is activated." v_min = 0.2 "linear acceleration of the brake [m/s²]" @@ -43,7 +45,8 @@ Model of a winch with an torque controlled generator and a gearbox. end function TorqueControlledMachine(set::Settings) - TorqueControlledMachine(set=set) + wcs = WinchSpeedController(;kp=set.p_speed, ki=set.i_speed, dt=1/set.sample_freq) + TorqueControlledMachine(set=set, wcs=wcs) end # calculated the motor reactance X [Ohm] diff --git a/src/winch_controller.jl b/src/winch_controller.jl index 888581b..d46f060 100644 --- a/src/winch_controller.jl +++ b/src/winch_controller.jl @@ -1,5 +1,5 @@ using DiscretePIDs -# low level winch controller; this code will be moved to WinchControllers.jl in the future +# low level winch speed controller mutable struct WinchSpeedController kp::Float64