BOROSOFTWAREAll work →
scantool/dyno.h 122 lines
1#ifndef _DYNO_H_
2#define _DYNO_H_
3
4/*
5 * freediag - Vehicle Diagnostic Utility
6 *
7 *
8 * Copyright (C) 2001 Richard Almeida & Ibex Ltd ([email protected])
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *************************************************************************
25 *
26 * Dyno functionnalities
27 *
28 */
29
30#if defined(__cplusplus)
31extern "C" {
32#endif
33
34/* Return codes */
35#define DYNO_OK 0 /* OK */
36#define DYNO_USAGE -1 /* Bad usage */
37
38/* structure for loss measure tables */
39typedef struct dyno_loss_measure {
40 int millis; /* number of milliseconds */
41 int speed; /* m/s * 1000 */
42} dyno_loss_measure;
43
44/* structure for measure tables */
45typedef struct dyno_measure {
46 int millis; /* number of milliseconds */
47 int rpm; /* rpm */
48} dyno_measure;
49
50/* structure for dyno results */
51typedef struct dyno_result {
52 int rpm; /* rev per minute */
53 int power; /* power (W) */
54 int power_ch; /* power (ch DYN) */
55 int torque; /* torque (N.m) */
56} dyno_result;
57
58
59/* Mass of the vehicle (kg) */
60int dyno_set_mass(int mass);
61int dyno_get_mass(void);
62
63/* Set ratio between speed (m/s * 1000) and rpm */
64int dyno_set_gear(int speed, int rpm);
65int dyno_get_speed_from_rpm(int rpm);
66
67
68/*
69 * Add loss measure
70 * - millis : time in milliseconds
71 * - speed : speed in m/s * 1000 (mm/s)
72 */
73int dyno_loss_add_measure(int millis, int speed);
74
75/* Get loss measures results */
76double dyno_loss_get_d(void);
77double dyno_loss_get_f(void);
78
79/* Set d and f values */
80void dyno_loss_set_d(double d);
81void dyno_loss_set_f(double f);
82
83/* Reset all dyno loss measures */
84int dyno_loss_reset(void);
85
86
87/*
88 * Add a measure
89 * - millis : time in milliseconds
90 * - rpm : rpm
91 */
92int dyno_add_measure(int millis, int rpm);
93
94/* Reset all dyno data */
95int dyno_reset(void);
96
97
98/* Get number of measures */
99int dyno_get_nb_measures(void);
100
101/* Get all measures */
102int dyno_get_measures(dyno_measure *measures, int size);
103
104
105/* Get number of results */
106int dyno_get_nb_results(void);
107
108/* Get power and torque results */
109int dyno_get_results(dyno_result *results, int size);
110
111/* smooth results */
112int dyno_smooth_results(dyno_result *results, int size);
113
114
115/* save measures and results to a file */
116void dyno_save(char *filename, dyno_result *results, int size);
117
118#if defined(__cplusplus)
119}
120#endif
121#endif /* _DYNO_H_ */
122