Skip to content

Commit

Permalink
The following patch adds the following features and fixes:
Browse files Browse the repository at this point in the history
- add noise analysis (initial version: integrated noise
  only);
- add user documentation for the simulation settings (DC,
  AC and Noise);
- increase the minimum width of the simulation settings
  window in order to fit all the descriptions (labels);
- fix units of measurements for several simulation
  settings (DC and AC, from incorrect units of
  "seconds");
- properly set Pango Text Attribute Markup Language in
  oregano_error(), oregano_warning() and oregano_question();
- add auxiliary functions to schedule calls to oregano_error(),
  oregano_warning() and oregano_question() using the GLib
  function g_idle_add_full() (thanks Bernhard for the tip,
  this is a local ngspice_analysis resolution for drahnr#194);
- some style improvements here and there;
- insert the proper GNU copyright notice in new files (proper
  copyright information and full name is still missing for
  user "Michi" !);
- update authors, copyright information and contact
  details in the GUI;
- version bump.

Signed-off-by: Guido Trentalancia <[email protected]>
---
 AUTHORS
|    1
 data/xml/sim-settings.ui
|  566 +++-
 docs/user-docs/Simulation-Settings-HOWTO.md
|   30
 src/dialogs.c
|   66
 src/dialogs.h
|    5
 src/engines/netlist-helper.c
|   10
 src/engines/netlist-helper.h
|    2
 src/engines/ngspice-analysis.c
|   98
 src/engines/ngspice-watcher.c
|   23
 src/engines/ngspice-watcher.h
|   23
 src/engines/ngspice.c
|   23
 src/load-schematic.c
|   81
 src/log-interface.h
|   25
 src/plot.c
|   32
 src/save-schematic.c
|   31
 src/sim-settings-gui.c
|  401 ++-
 src/sim-settings-gui.h
|   46
 src/sim-settings.c
|   95
 src/sim-settings.h
|   37
 src/simulation.h
|    3
 src/tools/cancel-info.c
|   23
 src/tools/cancel-info.h
|   23
 src/tools/thread-pipe.c
|   29
 src/tools/thread-pipe.h
|   23
 test/test-files/test_engine_ngspice_watcher/basic/result/actual.txt
| 1176 ----------
 test/test-files/test_engine_ngspice_watcher/error/step_zero/result/actual.txt
|    5
 test/test_engine_ngspice.c
|   23
 test/test_thread_pipe.c
|   23
 test/test_update_connection_designators.c
|   24
 wscript
|    2
 30 files changed, 1394 insertions(+), 1555 deletions(-)
  • Loading branch information
gtrentalancia committed Jun 20, 2017
1 parent 2fecae3 commit 276f903
Show file tree
Hide file tree
Showing 30 changed files with 1,395 additions and 1,556 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Ricardo Markiewicz <[email protected]>
Andrés de Barbará <[email protected]>
Marc Lorber <[email protected]>
Bernhard Schuster <[email protected]>
Guido Trentalancia <[email protected]>
568 changes: 391 additions & 177 deletions data/xml/sim-settings.ui

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions docs/user-docs/Simulation-Settings-HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Why simulation settings?
Before you can start a simulation, you have to tell the simulation engine
(ngspice or gnucap) things like

- type of simulation (time domain, frequency domain, DC sweep, ...)
- type of simulation (time domain, frequency domain, DC sweep, AC, Noise, ...)
- simulation dependant parameters (for time domain: start, stop, step, ...)
- ...

Expand Down Expand Up @@ -43,11 +43,35 @@ Analysis Parameters
engine and the simulation will run fluently and without errors.


**DC Sweep**

- Source: the indipendent voltage source.
- Output: the voltage output variable.
- Start: the starting voltage (sweep from).
- Stop: the ending voltage (sweep to).
- Step: voltage increment.


**AC**

- Output: the voltage output variable.
- Type: the scale type (decade, linear or octave variation).
- Points: the number of points in the simulation (from start to stop).
- Start: the starting frequency.
- Stop: the final frequency.


**Fourier**

//TODO


**DC Sweep**
**Noise**

- Source: the indipendent voltage source.
- Output: the voltage output variable.
- Type: the scale type (decade, linear or octave variation).
- Points: the number of points in the simulation (from start to stop).
- Start: the starting frequency.
- Stop: the final frequency.

//TODO
66 changes: 52 additions & 14 deletions src/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* Andres de Barbara <[email protected]>
* Marc Lorber <[email protected]>
* Bernhard Schuster <[email protected]>
* Guido Trentalancia <[email protected]>
*
* Web page: https://ahoi.io/project/oregano
*
* Copyright (C) 1999-2001 Richard Hult
* Copyright (C) 2003,2006 Ricardo Markiewicz
* Copyright (C) 2009-2012 Marc Lorber
* Copyright (C) 2013 Bernhard Schuster
* Copyright (C) 2017 Guido Trentalancia
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
Expand All @@ -37,6 +39,15 @@

#include "pixmaps/logo.xpm"

/*
* Schedule a call to the oregano_error() function so that it is
* called whenever there are no higher priority events pending.
*
* The caller should schedule this function call using the GLib
* function g_idle_add_full().
*/
gboolean oregano_schedule_error (gchar *msg) { oregano_error_with_title (msg, NULL); return FALSE; }

void oregano_error (gchar *msg) { oregano_error_with_title (msg, NULL); }

void oregano_error_with_title (gchar *title, gchar *desc)
Expand All @@ -53,17 +64,28 @@ void oregano_error_with_title (gchar *title, gchar *desc)
span_msg = g_string_append (span_msg, desc);
}

dialog = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, "%s", span_msg->str);
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, NULL);

gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), span_msg->str);

gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);

gtk_dialog_run (GTK_DIALOG (dialog));

g_string_free (span_msg, TRUE);
gtk_widget_destroy (dialog);
}

/*
* Schedule a call to the oregano_warning() function so that it is
* called whenever there are no higher priority events pending.
*
* The caller should schedule this function call using the GLib
* function g_idle_add_full().
*/
gboolean oregano_schedule_warning (gchar *msg) { oregano_warning_with_title (msg, NULL); return FALSE; }

void oregano_warning (gchar *msg) { oregano_warning_with_title (msg, NULL); }

void oregano_warning_with_title (gchar *title, gchar *desc)
Expand All @@ -80,28 +102,42 @@ void oregano_warning_with_title (gchar *title, gchar *desc)
span_msg = g_string_append (span_msg, desc);
}

dialog = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK, "%s", span_msg->str);
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING,
GTK_BUTTONS_CLOSE, NULL);

gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), span_msg->str);

gtk_dialog_run (GTK_DIALOG (dialog));
gtk_dialog_set_default_response (GTK_MESSAGE_DIALOG (dialog), GTK_RESPONSE_CLOSE);

gtk_dialog_run (GTK_MESSAGE_DIALOG (dialog));

g_string_free (span_msg, TRUE);

gtk_widget_destroy (dialog);
}

/*
* Schedule a call to the oregano_question() function so that it is
* called whenever there are no higher priority events pending.
*
* The caller should schedule this function call using the GLib
* function g_idle_add_full().
*/
gboolean oregano_schedule_question (gchar *msg) { oregano_question (msg); return FALSE; }

gint oregano_question (gchar *msg)
{
GtkWidget *dialog;
gint ans;

dialog = gtk_message_dialog_new_with_markup (NULL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK,
GTK_BUTTONS_CANCEL, "%s", msg);
dialog = gtk_message_dialog_new (NULL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK,
GTK_BUTTONS_CANCEL, NULL);

gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);

gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
gtk_dialog_set_default_response (GTK_MESSAGE_DIALOG (dialog), GTK_RESPONSE_CANCEL);

ans = gtk_dialog_run (GTK_DIALOG (dialog));
ans = gtk_dialog_run (GTK_MESSAGE_DIALOG (dialog));
gtk_widget_destroy (dialog);
return (ans == GTK_RESPONSE_ACCEPT);
}
Expand All @@ -113,15 +149,17 @@ void dialog_about (void)

const gchar *authors[] = {"Richard Hult", "Margarita Manterola", "Andres de Barbara",
"Gustavo M. Pereyra", "Maximiliano Curia", "Ricardo Markiewicz",
"Marc Lorber", "Bernhard Schuster", NULL};
"Marc Lorber", "Bernhard Schuster", "Guido Trentalancia",
NULL};

const char *docs[] = {"Ricardo Markiewicz <[email protected]> (es)",
"Jordi Mallach <[email protected]> (ca)",
"Marc Lorber <[email protected]> (en)",
"Bernhard Schuster <[email protected]> (de)",
"Bernhard Schuster <[email protected]> (de)",
NULL};

const gchar *copy = _ ("(c) 2012-2017 Bernhard Schuster\n"
const gchar *copy = _ ("(c) 2017 Guido Trentalancia\n"
"(c) 2012-2017 Bernhard Schuster\n"
"(c) 2009-2012 Marc Lorber\n"
"(c) 2003-2006 LUGFi\n"
"(c) 1999-2001 Richard Hult");
Expand Down
5 changes: 5 additions & 0 deletions src/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
* Ricardo Markiewicz <[email protected]>
* Andres de Barbara <[email protected]>
* Marc Lorber <[email protected]>
* Guido Trentalancia <[email protected]>
*
* Web page: https://ahoi.io/project/oregano
*
* Copyright (C) 1999-2001 Richard Hult
* Copyright (C) 2003,2004 Ricardo Markiewicz
* Copyright (C) 2009-2012 Marc Lorber
* Copyright (C) 2017 Guido Trentalancia
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
Expand All @@ -35,10 +37,13 @@

#include "schematic.h"

gboolean oregano_schedule_error (gchar *msg);
void oregano_error (gchar *msg);
void oregano_error_with_title (gchar *title, gchar *desc);
gboolean oregano_schedule_warning (gchar *msg);
void oregano_warning (gchar *msg);
void oregano_warning_with_title (gchar *title, gchar *desc);
gboolean oregano_schedule_question (gchar *msg);
gint oregano_question (gchar *msg);
void dialog_about (void);

Expand Down
10 changes: 8 additions & 2 deletions src/engines/netlist-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ GSList *netlist_helper_get_voltmeters_list (Schematic *sm, GError **error, gbool
return clamp_list;
}

GSList *netlist_helper_get_voltage_sources_list (Schematic *sm, GError **error)
GSList *netlist_helper_get_voltage_sources_list (Schematic *sm, GError **error, gboolean ac_only)
{
Netlist netlist_data;
GError *e = NULL;
Expand All @@ -732,7 +732,13 @@ GSList *netlist_helper_get_voltage_sources_list (Schematic *sm, GError **error)
if (prop[0] == 'V' && (prop[1] >= '0' && prop[1] <= '9')) {
gchar *tmp;
tmp = g_strdup (&prop[1]);
sources_list = g_slist_append (sources_list, tmp);
if (ac_only) {
g_free(prop);
prop = part_get_property (part, "Frequency");
if (prop)
sources_list = g_slist_append (sources_list, tmp);
} else
sources_list = g_slist_append (sources_list, tmp);
if (0)
printf ("sources_list = %s\n", tmp);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engines/netlist-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ void netlist_helper_init_data (NetlistData *data);
void netlist_helper_create (Schematic *sm, Netlist *out, GError **error);
char *netlist_helper_create_analysis_string (NodeStore *store, gboolean do_ac);
GSList *netlist_helper_get_voltmeters_list (Schematic *sm, GError **error, gboolean with_type);
GSList *netlist_helper_get_voltage_sources_list (Schematic *sm, GError **error);
GSList *netlist_helper_get_voltage_sources_list (Schematic *sm, GError **error, gboolean ac_only);

#endif
Loading

0 comments on commit 276f903

Please sign in to comment.