-
Notifications
You must be signed in to change notification settings - Fork 0
/
MotionProf.fun
113 lines (105 loc) · 4.29 KB
/
MotionProf.fun
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
FUNCTION MotionProfAcc : DINT (*Minimum acceleration to move in time over a distance*)
VAR_INPUT
Duration : LREAL; (*[s] Time duration*)
Distance : LREAL; (*[units] Distance*)
InitialVelocity : LREAL; (*[units/s] Initial velocity*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
END_VAR
VAR_IN_OUT
Profile : MotionProfProfileType; (*Profile output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfTime : DINT (*Minimum time duration to move with acceleration over a distance*)
VAR_INPUT
Distance : LREAL; (*[units] Distance*)
InitialVelocity : LREAL; (*[units/s] Initial velocity*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
Acceleration : LREAL; (*[units/s/s] Acceleration magnitude*)
END_VAR
VAR_IN_OUT
Profile : MotionProfProfileType; (*Profile output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfDist : DINT (*Maximum distance from move with acceleration in time*)
VAR_INPUT
Duration : LREAL; (*[s] Time duration*)
InitialVelocity : LREAL; (*[units/s] Initial velocity*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
Acceleration : LREAL; (*[units/s/s] Acceleration magnitude*)
END_VAR
VAR_IN_OUT
Profile : MotionProfProfileType; (*Profile output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfVel : DINT (*Minimum velocity to move with acceleration in time over a distance*)
VAR_INPUT
Duration : LREAL; (*[s] Time duration*)
Distance : LREAL; (*[units] Distance*)
InitialVelocity : LREAL; (*[units/s] Initial velocity*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
Acceleration : LREAL; (*[units/s/s] Acceleration magnitude*)
END_VAR
VAR_IN_OUT
Profile : MotionProfProfileType; (*Profile output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfTimeDiff : DINT (*Maximum difference in time duration between fastest and slowest profiles*)
VAR_INPUT
Distance : LREAL; (*[units] Distance*)
InitialVelocity : LREAL; (*[units/s] Initial velocity*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
Acceleration : LREAL; (*[units/s/s] Acceleration magnitude*)
END_VAR
VAR_IN_OUT
Output : MotionProfTimeDiffType; (*Output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfAccTimeDiff : DINT (*Minimum acceleration to achieve moves throughout a time difference*)
VAR_INPUT
TimeDifference : LREAL; (*[s] Difference in time durations*)
Distance : LREAL; (*[units] Distance*)
InitialVelocity : LREAL; (*[units/s] Initial velocity*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
END_VAR
VAR_IN_OUT
Output : MotionProfTimeDiffType; (*Output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfAccTimeDiffZero : DINT (*Minimum acceleration to achieve moves throughout a time difference starting at standstill*)
VAR_INPUT
TimeDifference : LREAL; (*[s] Difference in time durations*)
Distance : LREAL; (*[units] Distance*)
FirstVelocity : LREAL; (*[units/s] First velocity point from standstill*)
FinalVelocity : LREAL; (*[units/s] Final velocity*)
MinimumVelocity : LREAL; (*[units/s] Minimum velocity*)
MaximumVelocity : LREAL; (*[units/s] Maximum velocity*)
END_VAR
VAR_IN_OUT
Output : MotionProfTimeDiffType; (*Output*)
END_VAR
END_FUNCTION
FUNCTION MotionProfPoint : DINT (*Velocity profile point interpolation*)
VAR_INPUT
InitialPosition : LREAL; (*[units] Initial position*)
TimePoints : ARRAY[0..MOTIONPROF_POINT_MAX] OF LREAL; (*[s] Time points*)
VelocityPoints : ARRAY[0..MOTIONPROF_POINT_MAX] OF LREAL; (*[units/s] Velocity points*)
NumberOfPoints : USINT; (*Number of points*)
Time : LREAL; (*[s] Time interpolation*)
JerkFactor : LREAL; (*Jerk factor 1.0 infinite jerk 2.0 minimum jerk*)
END_VAR
VAR_IN_OUT
Point : MotionProfPointType; (*Point output*)
END_VAR
END_FUNCTION