# Screen Constants ==================================
# Screen moment of inertia
J0 = 16297  # 84153.8 #slugs*ft^2
# ===================================================
sc = screen_old.screen(
    weight=22100,
    momentInertia=J0,
    alpha=0.0,
    feedSpringPos=(-8.0, 0.0),
    dischargeSpringPos=(8.0, 0.0),
    feedSpringStiff=(32763, 32763),
    dischargeSpringStiff=(32736, 32736),
)
cw1 = screen_old.counterweight(
    posX=0, posY=0, radius=0.5, weight=257.8, rpm=200, startAngle=270, counterclockwise=False
)
# cw2=screen.counterweight(posX=0,posY=0, radius=0.5, weight=160, rpm=200, startAngle=270-90, counterclockwise=False)
# cw3=screen.counterweight(posX=0,posY=0, radius=0.5, weight=160, rpm=200, startAngle=270, counterclockwise=True)

sc.addCounterWeight(cw1)
# sc.addCounterWeight(cw2)
# sc.addCounterWeight(cw3)

# Update Function ==============================
def screendynamics(state, t, sc):
    return sc.update(state, t)


dt = 0.0001
end_t = 60
__author__ = "jrmccormick"

import screen_old
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec

# cw1=screen.counterweight(posX=0,posY=0, radius=0.5, weight=160, rpm=200, startAngle=270, counterclockwise=True)
cw2 = screen_old.counterweight(
    posX=0, posY=0, radius=0.5, weight=160, rpm=800, startAngle=270 - 90, counterclockwise=False
)
cw3 = screen_old.counterweight(posX=0, posY=0, radius=0.5, weight=320, rpm=800, startAngle=270, counterclockwise=True)

cwArr = [cw2, cw3]
dt = 0.01
end_t = 60
time = np.linspace(0, end_t, num=end_t / dt)
Xarr = []
Yarr = []
for t in time:
    x = 0
    y = 0
    for cw in cwArr:
        cw.calculateForces(t)
        x += cw.fx
        y += cw.fy
    Xarr.append(x)
    Yarr.append(y)

Xarr = np.array(Xarr)
Yarr = np.array(Yarr)
__author__ = 'jrmccormick'

import screen_old
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec

cw1=screen_old.counterweight(posX=1.5,posY=-2, radius=0.5, weight=160, rpm=800, startAngle=270, counterclockwise=True)
cw2=screen_old.counterweight(posX=-2.95,posY=2.21, radius=0.5, weight=160, rpm=800, startAngle=270-90, counterclockwise=False)

cwArr=[cw1,cw2]
dt=.01
end_t=60
time = np.linspace(0, end_t, num=end_t/dt)
Xarr=[]
Yarr=[]
for t in time:
    x=0
    y=0
    for cw in cwArr:
        cw.calculateForces(t)
        x+=cw.fx
        y+=cw.fy
    Xarr.append(x)
    Yarr.append(y)