106#include "sfh/filters/FIR.h"
109#include <fhsim/simobject/SimObject.h>
119 void OdeFcn(
const double T,
const double*
const X,
double*
const XDot)
const override;
120 void InitialConditionSetup(
const double T,
const double*
const currentIC,
double*
const updatedIC, ISimObjectCreator*
const creator)
override;
121 void AcceptedStep(
const double T,
const double*
const X)
override;
131 const double* GetValue() {
return m_filter.GetValue(); }
134 sfh::filters::FIR m_filter;
135 double m_updatePeriod;
136 double m_lastUpdate = 0.0;
137 bool m_hasUpdate =
false;
144 std::vector<double>
WarpsTooLong(
const double T,
const double*
const X)
const;
149 const double* OutWarpLength(
const double T,
const double*
const X,
const int index);
150 const double* OutNetWidth(
const double T,
const double*
const X,
const int index);
151 const double* OutMinBottomContact(
const double T,
const double*
const X);
153 std::vector<ISignalPort*> m_inNetPortPos;
154 std::vector<ISignalPort*> m_inNetStbPos;
155 std::vector<ISignalPort*> m_inBottomContact;
156 ISignalPort* m_inWarpLength =
nullptr;
157 ISignalPort* m_inExternalEnable =
nullptr;
158 std::unique_ptr<RateLimitedFIR> m_bottomContactFilter;
162 int m_numBottomContactMeasurements;
163 bool m_controlBottomContact;
164 double m_initialWarpLength = 0.0;
165 double m_minBottomContactGoal;
166 double m_sinkTimeConstant;
167 double m_controllerMaxSpeedDepth;
168 double m_controllerMaxSpeedGeometry;
169 double m_controllerConstant;
170 double m_controllerDamping;
171 int m_indexStateWarpLength;
174 bool m_hasLastStep =
false;
175 double m_lastTime = 0.0;
176 double m_minBottomContact = 0.0;
177 double m_lastBottomContactError = 0.0;
179 double m_lastBottomContactUpdate = 0.0;
180 bool m_hasBottomContactUpdate =
false;
181 std::vector<double> m_lastWarpTooLong;
182 bool m_hasTravelReference =
false;
A FIR filter fed at a fixed period, whatever the step length.
Definition TrawlGeometryController.h:126
bool AddMeasurement(const double measurement[], double time)
Adds measurement once per update period since the last update (once, on the first call); true if it a...
Definition TrawlGeometryController.h:115
std::vector< double > m_outNetWidth
One value per Net<N>Width port: readers on other threads keep the pointer (FISH-0107).
Definition TrawlGeometryController.h:186
std::array< double, 2 > MeanWingPosition(const double T, const double *const X) const
The mean horizontal wing position of all nets.
std::vector< double > WarpsTooLong(const double T, const double *const X) const
How much too long each warp is, from the starboard lead of each net along the direction of travel [m]...
double m_bottomContactErrorRate
Between the last two filter updates [m/s].
Definition TrawlGeometryController.h:178
std::array< double, 2 > m_travelDirection
Unit vector, or zero before the first 1 m of travel.
Definition TrawlGeometryController.h:184
double BottomContactError() const
The bottom contact error of the last accepted step, as an equivalent warp length [m].
std::array< double, 2 > m_travelReference
The mean wing position the travel is measured from.
Definition TrawlGeometryController.h:183