-
Notifications
You must be signed in to change notification settings - Fork 0
/
Windlass.h
55 lines (51 loc) · 1.91 KB
/
Windlass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//*********************************************************************
// Windlass.h - class representing a windlass.
//
// Windlass is a windlass state monitor, not a windlass controller: the
// assumption here is that the class will be used to keep track of the
// operating condition of physical device.
//
// All data values in SI units where applicable.
//
// 2020 (c) Paul Reeve <preeve@pdjr.eu>
//*********************************************************************
#ifndef WINDLASS_H
#define WINDLASS_H
class Windlass {
public:
enum OperatingStates { STOPPED, DEPLOYING, RETRIEVING, UNKNOWN };
enum OperatingTimerMode { NORMAL, STORAGE };
enum OperatingTimerFunction { START, STOP };
struct Settings {
double spoolDiameter;
double lineDiameter;
unsigned int turnsPerLayer;
double usableLineLength;
double nominalLineSpeed;
double operatingTime;
double (*operatingTimer)(Windlass::OperatingTimerMode, Windlass::OperatingTimerFunction);
OperatingTimerMode operatingTimerMode;
};
Windlass(Settings settings);
Settings getWindlassSettings();
void setOperatingState(OperatingStates state);
OperatingStates getOperatingState();
void setRotationCount(int rotationCount);
void incrRotationCount();
void decrRotationCount();
void bumpRotationCount();
int getRotationCount();
double getDeployedLineLength();
double getLineSpeed();
bool isLineFullyDeployed();
unsigned long getOperatingTime();
private:
// PROPERTIES...
Settings settings; // Configuration settings
OperatingStates operatingState; // Current state of the windlass
int rotationCount; // Rotation count
double operatingTime; // Total windlass operating time in seconds
// PRIVATE FUNCTIONS...
double lineLengthOnLayer(int layer, int turnsOnLayer);
};
#endif