I’m working on a nonlinear equation system with 12 parameters and 12 equations, I have started with FSolve but because results were different between application and computers, I move forward to Gekko… but the problem persists.
I have one routine which the same input data from one excel, running into the same machine (with Jupiter §notebook, or spider or on application compiled with Visual studio, each program produces different outputs! With same Jupiter notebook same input but on different PC, results are also different??? Does anyone have the same experience? How can I solve this?
# Import Libraries
import numpy as np
from gekko import GEKKO
import pandas as pd
# Read Excel File To DataFrame
df = pd.read_excel('INPUT_ML_LIN000_00000.xlsx', header = None)
# Get A
AO = df.iloc[0][1]
# Get Number Of Drives
number_of_drives = df.iloc[1][1]
# First SPL Source
FSS = df.iloc[4][2]
# First Phase Source
FPS = df.iloc[4 + number_of_drives + 2][2]
# First G Source
FGS = df.iloc[4 + (number_of_drives * 2) + 3][3]
# Load G Values
g_matriz = []
for g_cursor in range(number_of_drives):
g_matriz.append(df.iloc[4 + (number_of_drives * 2) + 3 + g_cursor][3])
g_matriz = np.array(g_matriz)
print(AO, number_of_drives, FSS, FPS, FGS, g_matriz)
print(df)
def gekko_sistema():
find_solution = False
counter = 0.0
while not find_solution:
counter += 0.001
m = GEKKO() # create GEKKO model
G12 = m.Var() # define new variable default=0
G11 = m.Var() # define new variable default=0
G10 = m.Var() # define new variable default=0
G9 = m.Var() # define new variable default=0
G8 = m.Var() # define new variable default=0
G7 = m.Var() # define new variable default=0
G6 = m.Var() # define new variable default=0
G5 = m.Var() # define new variable default=0
G4 = m.Var() # define new variable default=0
G3 = m.Var() # define new variable default=0
G2 = m.Var() # define new variable default=0
G1 = m.Var() # define new variable default=0
DU = round(counter, 3) # Deviation
DL = round(counter, 3) # Deviation
A12 = m.CV(AO, AO - DL, AO + DU)
A11 = m.CV(AO, AO - DL, AO + DU)
A10 = m.CV(AO, AO - DL, AO + DU)
A9 = m.CV(AO, AO - DL, AO + DU)
A8 = m.CV(AO, AO - DL, AO + DU)
A7 = m.CV(AO, AO - DL, AO + DU)
A6 = m.CV(AO, AO - DL, AO + DU)
A5 = m.CV(AO, AO - DL, AO + DU)
A4 = m.CV(AO, AO - DL, AO + DU)
A3 = m.CV(AO, AO - DL, AO + DU)
A2 = m.CV(AO, AO - DL, AO + DU)
A1 = m.CV(AO, AO - DL, AO + DU)
#A = AO
m.Equations( \
[(-(10**(A12/20))**2) \
+ \
((10**((df.iloc[4][2 + 0] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[5][2 + 0] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[6][2 + 0] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[7][2 + 0] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[8][2 + 0] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[9][2 + 0] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[10][2 + 0] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[11][2 + 0] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[12][2 + 0] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[13][2 + 0] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[14][2 + 0] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[15][2 + 0] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 0])))**2 \
+ \
((10**((df.iloc[4][2 + 0] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[5][2 + 0] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[6][2 + 0] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[7][2 + 0] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[8][2 + 0] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[9][2 + 0] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[10][2 + 0] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[11][2 + 0] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[12][2 + 0] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[13][2 + 0] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[14][2 + 0] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 0])) + \
(10**((df.iloc[15][2 + 0] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 0])))**2 == 0, \
(-(10**(A11/20))**2) \
+ \
((10**((df.iloc[4][2 + 1] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[5][2 + 1] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[6][2 + 1] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[7][2 + 1] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[8][2 + 1] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[9][2 + 1] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[10][2 + 1] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[11][2 + 1] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[12][2 + 1] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[13][2 + 1] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[14][2 + 1] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[15][2 + 1] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 1])))**2 \
+ \
((10**((df.iloc[4][2 + 1] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[5][2 + 1] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[6][2 + 1] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[7][2 + 1] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[8][2 + 1] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[9][2 + 1] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[10][2 + 1] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[11][2 + 1] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[12][2 + 1] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[13][2 + 1] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[14][2 + 1] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 1])) + \
(10**((df.iloc[15][2 + 1] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 1])))**2 == 0, \
(-(10**(A10/20))**2) \
+ \
((10**((df.iloc[4][2 + 2] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[5][2 + 2] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[6][2 + 2] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[7][2 + 2] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[8][2 + 2] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[9][2 + 2] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[10][2 + 2] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[11][2 + 2] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[12][2 + 2] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[13][2 + 2] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[14][2 + 2] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[15][2 + 2] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 2])))**2 \
+ \
((10**((df.iloc[4][2 + 2] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[5][2 + 2] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[6][2 + 2] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[7][2 + 2] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[8][2 + 2] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[9][2 + 2] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[10][2 + 2] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[11][2 + 2] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[12][2 + 2] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[13][2 + 2] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[14][2 + 2] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 2])) + \
(10**((df.iloc[15][2 + 2] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 2])))**2 == 0, \
(-(10**(A9/20))**2) \
+ \
((10**((df.iloc[4][2 + 3] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[5][2 + 3] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[6][2 + 3] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[7][2 + 3] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[8][2 + 3] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[9][2 + 3] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[10][2 + 3] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[11][2 + 3] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[12][2 + 3] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[13][2 + 3] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[14][2 + 3] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[15][2 + 3] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 3])))**2 \
+ \
((10**((df.iloc[4][2 + 3] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[5][2 + 3] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[6][2 + 3] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[7][2 + 3] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[8][2 + 3] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[9][2 + 3] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[10][2 + 3] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[11][2 + 3] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[12][2 + 3] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[13][2 + 3] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[14][2 + 3] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 3])) + \
(10**((df.iloc[15][2 + 3] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 3])))**2 == 0, \
(-(10**(A8/20))**2) \
+ \
((10**((df.iloc[4][2 + 4] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[5][2 + 4] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[6][2 + 4] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[7][2 + 4] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[8][2 + 4] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[9][2 + 4] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[10][2 + 4] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[11][2 + 4] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[12][2 + 4] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[13][2 + 4] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[14][2 + 4] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[15][2 + 4] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 4])))**2 \
+ \
((10**((df.iloc[4][2 + 4] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[5][2 + 4] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[6][2 + 4] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[7][2 + 4] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[8][2 + 4] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[9][2 + 4] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[10][2 + 4] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[11][2 + 4] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[12][2 + 4] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[13][2 + 4] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[14][2 + 4] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 4])) + \
(10**((df.iloc[15][2 + 4] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 4])))**2 == 0, \
(-(10**(A7/20))**2) \
+ \
((10**((df.iloc[4][2 + 5] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[5][2 + 5] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[6][2 + 5] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[7][2 + 5] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[8][2 + 5] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[9][2 + 5] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[10][2 + 5] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[11][2 + 5] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[12][2 + 5] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[13][2 + 5] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[14][2 + 5] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[15][2 + 5] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 5])))**2 \
+ \
((10**((df.iloc[4][2 + 5] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[5][2 + 5] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[6][2 + 5] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[7][2 + 5] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[8][2 + 5] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[9][2 + 5] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[10][2 + 5] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[11][2 + 5] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[12][2 + 5] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[13][2 + 5] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[14][2 + 5] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 5])) + \
(10**((df.iloc[15][2 + 5] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 5])))**2 == 0, \
(-(10**(A6/20))**2) \
+ \
((10**((df.iloc[4][2 + 6] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[5][2 + 6] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[6][2 + 6] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[7][2 + 6] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[8][2 + 6] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[9][2 + 6] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[10][2 + 6] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[11][2 + 6] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[12][2 + 6] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[13][2 + 6] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[14][2 + 6] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[15][2 + 6] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 6])))**2 \
+ \
((10**((df.iloc[4][2 + 6] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[5][2 + 6] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[6][2 + 6] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[7][2 + 6] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[8][2 + 6] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[9][2 + 6] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[10][2 + 6] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[11][2 + 6] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[12][2 + 6] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[13][2 + 6] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[14][2 + 6] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 6])) + \
(10**((df.iloc[15][2 + 6] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 6])))**2 == 0, \
(-(10**(A5/20))**2) \
+ \
((10**((df.iloc[4][2 + 7] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[5][2 + 7] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[6][2 + 7] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[7][2 + 7] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[8][2 + 7] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[9][2 + 7] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[10][2 + 7] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[11][2 + 7] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[12][2 + 7] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[13][2 + 7] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[14][2 + 7] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[15][2 + 7] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 7])))**2 \
+ \
((10**((df.iloc[4][2 + 7] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[5][2 + 7] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[6][2 + 7] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[7][2 + 7] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[8][2 + 7] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[9][2 + 7] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[10][2 + 7] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[11][2 + 7] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[12][2 + 7] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[13][2 + 7] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[14][2 + 7] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 7])) + \
(10**((df.iloc[15][2 + 7] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 7])))**2 == 0, \
(-(10**(A4/20))**2) \
+ \
((10**((df.iloc[4][2 + 8] + G12) / 20) * np.cos(df.iloc[4 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[5][2 + 8] + G11) / 20) * np.cos(df.iloc[5 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[6][2 + 8] + G10) / 20) * np.cos(df.iloc[6 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[7][2 + 8] + G9) / 20) * np.cos(df.iloc[7 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[8][2 + 8] + G8) / 20) * np.cos(df.iloc[8 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[9][2 + 8] + G7) / 20) * np.cos(df.iloc[9 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[10][2 + 8] + G6) / 20) * np.cos(df.iloc[10 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[11][2 + 8] + G5) / 20) * np.cos(df.iloc[11 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[12][2 + 8] + G4) / 20) * np.cos(df.iloc[12 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[13][2 + 8] + G3) / 20) * np.cos(df.iloc[13 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[14][2 + 8] + G2) / 20) * np.cos(df.iloc[14 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[15][2 + 8] + G1) / 20) * np.cos(df.iloc[15 + number_of_drives + 2][2 + 8])))**2 \
+ \
((10**((df.iloc[4][2 + 8] + G12) / 20) * np.sin(df.iloc[4 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[5][2 + 8] + G11) / 20) * np.sin(df.iloc[5 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[6][2 + 8] + G10) / 20) * np.sin(df.iloc[6 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[7][2 + 8] + G9) / 20) * np.sin(df.iloc[7 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[8][2 + 8] + G8) / 20) * np.sin(df.iloc[8 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[9][2 + 8] + G7) / 20) * np.sin(df.iloc[9 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[10][2 + 8] + G6) / 20) * np.sin(df.iloc[10 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[11][2 + 8] + G5) / 20) * np.sin(df.iloc[11 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[12][2 + 8] + G4) / 20) * np.sin(df.iloc[12 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[13][2 + 8] + G3) / 20) * np.sin(df.iloc[13 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[14][2 + 8] + G2) / 20) * np.sin(df.iloc[14 + number_of_drives + 2][2 + 8])) + \
(10**((df.iloc[15][2 + 8] + G1) / 20) * np.sin(df.iloc[15 + number_of_drives + 2][2 + 8])))**2 == 0, \
(-(10**(A3/20))**2)
... cropped for Stack Overflow character limit
) # equations
m.options.MAX_ITER=250
m.options.IMODE = 3
#m.solve(disp=False) # solve
try:
m.solve(disp=False) # solve
find_solution = True
print(f'Solution Found: U {counter} L -{counter}')
except:
print(f'Solution Not Found: U {counter} L -{counter}')
return [G12.value[0], G11.value[0], G10.value[0], G9.value[0], G8.value[0], G7.value[0], G6.value[0], G5.value[0], G4.value[0], G3.value[0], G2.value[0], G1.value[0]] # print solution
result = gekko_sistema()
print(result)
Data Table