1 /*
2  * sim-settings.h
3  *
4  *
5  * Authors:
6  *  Richard Hult <rhult@hem.passagen.se>
7  *  Ricardo Markiewicz <rmarkie@fi.uba.ar>
8  *  Andres de Barbara <adebarbara@fi.uba.ar>
9  *  Marc Lorber <lorber.marc@wanadoo.fr>
10  *  Guido Trentalancia <guido@trentalancia.com>
11  *
12  * Web page: https://ahoi.io/project/oregano
13  *
14  * Copyright (C) 1999-2001  Richard Hult
15  * Copyright (C) 2003,2004  Ricardo Markiewicz
16  * Copyright (C) 2009-2012  Marc Lorber
17  * Copyright (C) 2017       Guido Trentalancia
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License as
21  * published by the Free Software Foundation; either version 2 of the
22  * License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27  * General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public
30  * License along with this program; if not, write to the
31  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32  * Boston, MA 02110-1301, USA.
33  */
34 
35 #ifndef __SIM_SETTINGS_H
36 #define __SIM_SETTINGS_H
37 
38 typedef struct {
39 	gboolean configured;
40 	gboolean simulation_requested;
41 
42 	// Transient analysis.
43 	gboolean trans_enable;
44 	gboolean trans_init_cond;
45 	gboolean trans_analyze_all;
46 	gchar *trans_start;
47 	gchar *trans_stop;
48 	gchar *trans_step;
49 	gboolean trans_step_enable;
50 
51 	// AC
52 	gboolean ac_enable;
53 	gchar *ac_vout;
54 	gchar *ac_type;
55 	gchar *ac_npoints;
56 	gchar *ac_start;
57 	gchar *ac_stop;
58 
59 	// DC
60 	gboolean dc_enable;
61 	gchar *dc_vin;
62 	gchar *dc_vout;
63 	gchar *dc_start, *dc_stop, *dc_step;
64 
65 	// Fourier analysis. Replace with something sane later.
66 	gboolean fourier_enable;
67 	gchar *fourier_frequency;
68 	gchar *fourier_nb_vout;
69 	GSList *fourier_vout;
70 
71 	// Noise
72 	gboolean noise_enable;
73 	gchar *noise_vin;
74 	gchar *noise_vout;
75 	gchar *noise_type;
76 	gchar *noise_npoints;
77 	gchar *noise_start;
78 	gchar *noise_stop;
79 
80 	// Options
81 	GList *options;
82 } SimSettings;
83 
84 typedef struct _SimOption
85 {
86 	gchar *name;
87 	gchar *value;
88 } SimOption;
89 
90 SimSettings *sim_settings_new ();
91 
92 void sim_settings_finalize(SimSettings *s);
93 
94 gdouble sim_settings_get_trans_start (const SimSettings *sim_settings);
95 
96 gdouble sim_settings_get_trans_stop (const SimSettings *sim_settings);
97 
98 gdouble sim_settings_get_trans_step (const SimSettings *sim_settings);
99 
100 gboolean sim_settings_get_trans (const SimSettings *sim_settings);
101 
102 gdouble sim_settings_get_trans_step_enable (const SimSettings *sim_settings);
103 
104 gboolean sim_settings_get_trans_init_cond (const SimSettings *sim_settings);
105 
106 gboolean sim_settings_get_trans_analyze_all (const SimSettings *sim_settings);
107 
108 void sim_settings_set_trans_start (SimSettings *sim_settings, gchar *str);
109 
110 void sim_settings_set_trans_stop (SimSettings *sim_settings, gchar *str);
111 
112 void sim_settings_set_trans_step (SimSettings *sim_settings, gchar *str);
113 
114 void sim_settings_set_trans (SimSettings *sim_settings, gboolean enable);
115 
116 void sim_settings_set_trans_step_enable (SimSettings *sim_settings, gboolean enable);
117 
118 void sim_settings_set_trans_init_cond (SimSettings *sim_settings, gboolean enable);
119 
120 void sim_settings_set_trans_analyze_all (SimSettings *sim_settings, gboolean enable);
121 
122 gboolean sim_settings_get_dc (const SimSettings *);
123 
124 gchar *sim_settings_get_dc_vsrc (const SimSettings *);
125 
126 gchar *sim_settings_get_dc_vout (const SimSettings *);
127 
128 gdouble sim_settings_get_dc_start (const SimSettings *);
129 
130 gdouble sim_settings_get_dc_start (const SimSettings *);
131 
132 gdouble sim_settings_get_dc_stop (const SimSettings *);
133 
134 gdouble sim_settings_get_dc_step (const SimSettings *);
135 
136 void sim_settings_set_dc (SimSettings *, gboolean);
137 
138 void sim_settings_set_dc_vsrc (SimSettings *, gchar *);
139 
140 void sim_settings_set_dc_vout (SimSettings *, gchar *);
141 
142 void sim_settings_set_dc_start (SimSettings *, gchar *);
143 
144 void sim_settings_set_dc_stop (SimSettings *, gchar *);
145 
146 void sim_settings_set_dc_step (SimSettings *, gchar *);
147 
148 gboolean sim_settings_get_ac (const SimSettings *);
149 
150 gchar *sim_settings_get_ac_vout (const SimSettings *);
151 
152 gchar *sim_settings_get_ac_type (const SimSettings *);
153 
154 gint sim_settings_get_ac_npoints (const SimSettings *);
155 
156 gdouble sim_settings_get_ac_start (const SimSettings *);
157 
158 gdouble sim_settings_get_ac_stop (const SimSettings *);
159 
160 void sim_settings_set_ac (SimSettings *, gboolean);
161 
162 void sim_settings_set_ac_vout (SimSettings *, gchar *);
163 
164 void sim_settings_set_ac_type (SimSettings *, gchar *);
165 
166 void sim_settings_set_ac_npoints (SimSettings *, gchar *);
167 
168 void sim_settings_set_ac_start (SimSettings *, gchar *);
169 
170 void sim_settings_set_ac_stop (SimSettings *, gchar *);
171 
172 void sim_settings_set_fourier (SimSettings *, gboolean);
173 
174 void sim_settings_set_fourier_frequency (SimSettings *, gchar *);
175 
176 void sim_settings_set_fourier_vout (SimSettings *, gchar *);
177 
178 gboolean sim_settings_get_fourier (const SimSettings *);
179 
180 gdouble sim_settings_get_fourier_frequency (const SimSettings *);
181 
182 gchar *sim_settings_get_fourier_vout (const SimSettings *);
183 
184 gchar *sim_settings_get_fourier_nodes (const SimSettings *);
185 
186 gboolean sim_settings_get_noise (const SimSettings *);
187 
188 gchar *sim_settings_get_noise_vsrc (const SimSettings *);
189 
190 gchar *sim_settings_get_noise_vout (const SimSettings *);
191 
192 gchar *sim_settings_get_noise_type (const SimSettings *);
193 
194 gint sim_settings_get_noise_npoints (const SimSettings *);
195 
196 gdouble sim_settings_get_noise_start (const SimSettings *);
197 
198 gdouble sim_settings_get_noise_stop (const SimSettings *);
199 
200 void sim_settings_set_noise (SimSettings *, gboolean);
201 
202 void sim_settings_set_noise_vsrc (SimSettings *, gchar *);
203 
204 void sim_settings_set_noise_vout (SimSettings *, gchar *);
205 
206 void sim_settings_set_noise_type (SimSettings *, gchar *);
207 
208 void sim_settings_set_noise_npoints (SimSettings *, gchar *);
209 
210 void sim_settings_set_noise_start (SimSettings *, gchar *);
211 
212 void sim_settings_set_noise_stop (SimSettings *, gchar *);
213 
214 GList *sim_settings_get_options (const SimSettings *sim_settings);
215 
216 void sim_settings_add_option (SimSettings *, SimOption *);
217 
218 gchar *fourier_add_vout(SimSettings *sim_settings, guint i);
219 
220 #endif
221