From c29534f222ba4ace770935d36cf8ac8d2a367523 Mon Sep 17 00:00:00 2001 From: Rimjhim Mittal Date: Tue, 18 Jun 2024 15:34:55 +0530 Subject: [PATCH] changes --- examples/MDF/switched_rlc.py | 49 ++++++++++++++++++++++-------------- test_all.sh | 2 +- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/examples/MDF/switched_rlc.py b/examples/MDF/switched_rlc.py index 22197a59..aeff0daf 100644 --- a/examples/MDF/switched_rlc.py +++ b/examples/MDF/switched_rlc.py @@ -30,25 +30,36 @@ def run_simulation(mod_graph, duration=2, dt=0.001): V_values.append(V) t += dt - fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 10)) - - ax1.plot(times, i_L_values, label='Inductor Current (i_L)') - ax1.plot(times, i_R_values, label='Resistor Current (i_R)') - ax1.plot(times, i_C_values, label='Capacitor Current (i_C)') - ax1.set_xlabel('Time (s)') - ax1.set_ylabel('Current (A)') - ax1.set_title('Currents in RLC Circuit') - ax1.legend() - - ax2.plot(times, V_values, label='Response Voltage (V)', color='orange') - ax2.plot(times, Vs_values, label='Source Voltage (Vs)', color='green') - ax2.set_xlabel('Time (s)') - ax2.set_ylabel('Voltage (V)') - ax2.set_title('Voltage in RLC Circuit') - ax2.legend() - - plt.tight_layout() - plt.savefig("switched_rlc_plot.png") + # fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 10)) + + # ax1.plot(times, i_L_values, label='Inductor Current (i_L)') + # ax1.plot(times, i_R_values, label='Resistor Current (i_R)') + # ax1.plot(times, i_C_values, label='Capacitor Current (i_C)') + # ax1.set_xlabel('Time (s)') + # ax1.set_ylabel('Current (A)') + # ax1.set_title('Currents in RLC Circuit') + # ax1.legend() + + # ax2.plot(times, V_values, label='Response Voltage (V)', color='orange') + # ax2.plot(times, Vs_values, label='Source Voltage (Vs)', color='green') + # ax2.set_xlabel('Time (s)') + # ax2.set_ylabel('Voltage (V)') + # ax2.set_title('Voltage in RLC Circuit') + # ax2.legend() + + # plt.tight_layout() + # plt.savefig("switched_rlc_plot.png") + # plt.show() + + plt.figure(figsize=(10, 5)) + plt.plot(times, i_L_values, label='Inductor Current (i_L)') + plt.plot(times, i_R_values, label='Resistor Current (i_R)') + plt.plot(times, i_C_values, label='Capacitor Current (i_C)') + plt.plot(times, V_values, label='Voltage (V)') + plt.xlabel('Time (s)') + plt.ylabel('Values') + plt.title('Switched RLC Circuit Simulation Results') + plt.legend() plt.show() return times, i_L_values, i_R_values, i_C_values, V_values diff --git a/test_all.sh b/test_all.sh index 516482e1..3ad5e7ec 100755 --- a/test_all.sh +++ b/test_all.sh @@ -22,7 +22,7 @@ python states.py -run -nogui python abc_conditions.py -run python params_funcs.py -run python newton.py -run -python switched_rlc_circuit.py -run +python switched_rlc.py -run ## Test exporting to NeuroML