/[ascend]/trunk/models/johnpye/datareader/dr.h
ViewVC logotype

Contents of /trunk/models/johnpye/datareader/dr.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 809 - (show annotations) (download) (as text)
Mon Aug 7 14:48:55 2006 UTC (13 years, 11 months ago) by johnpye
File MIME type: text/x-chdr
File size: 2218 byte(s)
A little more tinkering on the Data Reader. I have added routines
to read data from the TMY2 format, but they're a long way from being
fully implemented yet. The added files sun.c and sun.h should
provide some useful routines for sun position and time of day, for
use with the TMY2 reader functions.
1 /* ASCEND modelling environment
2 Copyright (C) 2006 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *//**
19 @file
20 Data Reader implementation
21
22 Although the API allows for functions of more than one variable, the
23 implementation I'll build here will be for functions of just one indep
24 variable, since the application here is time series, eg weather data.
25 *//*
26 by John Pye, 3 Aug 2006
27 */
28
29 #ifndef DATAREADER_H
30 #define DATAREADER_H
31
32 /* DATA READER API DEFINITION */
33
34 struct DataReader;
35
36 typedef enum datareader_file_format_enum{
37 DATAREADER_FORMAT_TMY2
38 ,DATAREADER_FORMAT_UNKNOWN
39 } datareader_file_format_t;
40
41 int datareader_new(const char *fn);
42 int datareader_init(DataReader *d);
43 int datareader_set_file_format(DataReader *d, const datareader_file_format_t &format);
44 int datareader_delete(DataReader *d);
45
46 int datareader_num_inputs(const DataReader *d);
47 int datareader_num_outputs(const DataReader *d);
48
49 int datareader_func(DataReader *d, double *inputs, double *outputs);
50 int datareader_deriv(DataReader *d, double *inputs, double *jacobian);
51
52
53 /**
54 Function that can read a single data point from the open file.
55 Should return 0 on success.
56 */
57 typedef int (DataReaderReadFn)(DataReader *d);
58
59 /**
60 Function that can read the file header and allocate necessary memory
61 */
62 typedef int (DataReaderHeaderFn)(DataReader *d);
63
64
65 /**
66 A function that should be called when a file is first opened, optional.
67 This function can read header lines and determine the number of columns if
68 necessary.
69
70 Return 0 on success.
71 */
72 typedef int (DataHeaderFn)(DataRader *d);
73
74 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22