#!/bin/sh
# Longitudital Feedback

caput FBCK:FB05:TR04:STATE 0


# pockcel_perm, TS4, 1Hz
caput -a FBCK:FB05:TR04:POI1 21 0 0 0 8 0 0 0 128 0 0 55 0 0 0 0 0 0 0 0 0 0

# pockcel_perm, TS1, 1Hz
caput -a FBCK:FB05:TR04:POI2 21 0 0 0 0 0 0 0 128 0 0 62 0 0 0 0 0 0 0 0 0 0

# pockcel_perm, TS4, ~1Hz (9Hz)
caput -a FBCK:FB05:TR04:POI3 21 0 0 0 0 0 0 0 0 0 0 55 0 0 0 0 0 0 128 0 0 0

# pockcel_perm, TS1, ~1Hz (0x20)
caput -a FBCK:FB05:TR04:POI4 21 0 0 0 0 0 0 0 0 0 0 62 0 0 0 0 0 0 128 0 0 0


# F matrix
caput -a FBCK:FB05:TR04:FMATRIX 36 1.046 0 0 0 0 0 -1.2184 2.1986 0.011464 0 0 0 -0.080912 -0.72954 -0.026117 0 0 0 -0.13831 -0.60952 -0.01451 0.87485 0.037702 0 -9.5878 203.654 0.022006 -0.45644 -0.057178 0 -0.0005691 0.0041105 0 -1.5381 0 2.4

# G matrix
caput -a FBCK:FB05:TR04:GMATRIX 36 1 0 0 0 0 0  0 1 0 0 0 0  0 0 1 0 0 0  0 0 0 100 0 0  0 0 0 0 1 0   0 0 0 0 0 10

# Loop configs
caput FBCK:FB05:TR04:NAME PAUSineTest
caput FBCK:FB05:TR04:INSTALLED 1
caput FBCK:FB05:TR04:TOTALPOI 4
caput FBCK:FB05:TR04:ITERATEFUNC SineN

# Measurements
caput FBCK:FB05:TR04:M1DEVNAME FILE:/data/TR04/COUNTER
caput FBCK:FB05:TR04:M1USED 1
caput FBCK:FB05:TR04:M1CAMODE 0

caput FBCK:FB05:TR04:M2DEVNAME FILE:/data/TR04/COUNTER
caput FBCK:FB05:TR04:M2USED 0
caput FBCK:FB05:TR04:M2CAMODE 0

caput FBCK:FB05:TR04:M3DEVNAME FILE:/data/TR04/COUNTER
caput FBCK:FB05:TR04:M3USED 0
caput FBCK:FB05:TR04:M3CAMODE 0

caput FBCK:FB05:TR04:M4DEVNAME FILE:/data/TR04/COUNTER
caput FBCK:FB05:TR04:M4USED 0
caput FBCK:FB05:TR04:M4CAMODE 0
caput FBCK:FB05:TR04:M4.EGU I

caput FBCK:FB05:TR04:M5DEVNAME FILE:/data/TR04/COUNTER
caput FBCK:FB05:TR04:M5USED 0
caput FBCK:FB05:TR04:M5CAMODE 0

caput FBCK:FB05:TR04:M6DEVNAME FILE:/data/TR04/COUNTER
caput FBCK:FB05:TR04:M6USED 0
caput FBCK:FB05:TR04:M6CAMODE 0

caput FBCK:FB05:TR04:M7USED 0
caput FBCK:FB05:TR04:M8USED 0
caput FBCK:FB05:TR04:M9USED 0
caput FBCK:FB05:TR04:M10USED 0
caput FBCK:FB05:TR04:M11USED 0
caput FBCK:FB05:TR04:M12USED 0
caput FBCK:FB05:TR04:M13USED 0
caput FBCK:FB05:TR04:M14USED 0
caput FBCK:FB05:TR04:M15USED 0
caput FBCK:FB05:TR04:M16USED 0
caput FBCK:FB05:TR04:M17USED 0
caput FBCK:FB05:TR04:M18USED 0
caput FBCK:FB05:TR04:M19USED 0
caput FBCK:FB05:TR04:M20USED 0
caput FBCK:FB05:TR04:M21USED 0
caput FBCK:FB05:TR04:M22USED 0
caput FBCK:FB05:TR04:M23USED 0
caput FBCK:FB05:TR04:M24USED 0
caput FBCK:FB05:TR04:M25USED 0
caput FBCK:FB05:TR04:M26USED 0
caput FBCK:FB05:TR04:M27USED 0
caput FBCK:FB05:TR04:M28USED 0
caput FBCK:FB05:TR04:M29USED 0
caput FBCK:FB05:TR04:M30USED 0
caput FBCK:FB05:TR04:M31USED 0
caput FBCK:FB05:TR04:M32USED 0
caput FBCK:FB05:TR04:M33USED 0
caput FBCK:FB05:TR04:M34USED 0
caput FBCK:FB05:TR04:M35USED 0
caput FBCK:FB05:TR04:M36USED 0
caput FBCK:FB05:TR04:M37USED 0
caput FBCK:FB05:TR04:M38USED 0
caput FBCK:FB05:TR04:M39USED 0
caput FBCK:FB05:TR04:M40USED 0

# Reference orbit
caput -a FBCK:FB05:TR04:REFORBIT 10 0 0 0 0 0 0 0 0 0 0

# States
caput FBCK:FB05:TR04:S1NAME DL1.Energy
caput FBCK:FB05:TR04:S1USED 1
caput FBCK:FB05:TR04:S1.EGU MeV
caput FBCK:FB05:TR04:S1LOLO -100
caput FBCK:FB05:TR04:S1HIHI 200

caput FBCK:FB05:TR04:S2NAME BC1.Energy
caput FBCK:FB05:TR04:S2USED 0
caput FBCK:FB05:TR04:S2.EGU MeV
caput FBCK:FB05:TR04:S2LOLO -120
caput FBCK:FB05:TR04:S2HIHI 320

caput FBCK:FB05:TR04:S3NAME BC1.Current
caput FBCK:FB05:TR04:S3USED 0
caput FBCK:FB05:TR04:S3.EGU amps
caput FBCK:FB05:TR04:S3LOLO -150
caput FBCK:FB05:TR04:S3HIHI 450

caput FBCK:FB05:TR04:S4NAME BC2.Energy
caput FBCK:FB05:TR04:S4USED 0
caput FBCK:FB05:TR04:S4.EGU MeV
caput FBCK:FB05:TR04:S4LOLO -3700
caput FBCK:FB05:TR04:S4HIHI 6000

caput FBCK:FB05:TR04:S5NAME BC2.Current
caput FBCK:FB05:TR04:S5USED 0
caput FBCK:FB05:TR04:S5.EGU amps
caput FBCK:FB05:TR04:S5LOLO -1000
caput FBCK:FB05:TR04:S5HIHI 6000

caput FBCK:FB05:TR04:S6NAME DL2.Energy
caput FBCK:FB05:TR04:S6USED 0
caput FBCK:FB05:TR04:S6.EGU MeV
caput FBCK:FB05:TR04:S6LOLO -1500
caput FBCK:FB05:TR04:S6HIHI 15000

caput FBCK:FB05:TR04:S7USED 0
caput FBCK:FB05:TR04:S8USED 0
caput FBCK:FB05:TR04:S9USED 0
caput FBCK:FB05:TR04:S10USED 0

# Actuators
caput FBCK:FB05:TR04:A1DEVNAME ACCL:IN20:400:L0B_ADES
#caput FBCK:FB05:TR04:A1DEVNAME FILE:/data/TR04/ACCL:IN20:400:L0B_ADES
caput FBCK:FB05:TR04:A1USED 1
caput FBCK:FB05:TR04:A1.EGU MeV
caput FBCK:FB05:TR04:A1CAMODE 0
caput FBCK:FB05:TR04:A1LOLO -58
caput FBCK:FB05:TR04:A1HIHI 84

caput FBCK:FB05:TR04:A2DEVNAME ACCL:LI21:1:L1S_ADES
#caput FBCK:FB05:TR04:A2DEVNAME FILE:/data/TR04/ACCL:LI21:1:L1S_ADES
caput FBCK:FB05:TR04:A2USED 0
caput FBCK:FB05:TR04:A2.EGU MeV
caput FBCK:FB05:TR04:A2CAMODE 0
caput FBCK:FB05:TR04:A2LOLO -50
caput FBCK:FB05:TR04:A2HIHI 183

caput FBCK:FB05:TR04:A3DEVNAME ACCL:LI21:1:L1S_PDES
#caput FBCK:FB05:TR04:A3DEVNAME FILE:/data/TR04/ACCL:LI21:1:L1S_PDES
caput FBCK:FB05:TR04:A3USED 0
caput FBCK:FB05:TR04:A3.EGU degs
caput FBCK:FB05:TR04:A3CAMODE 0
caput FBCK:FB05:TR04:A3LOLO -180
caput FBCK:FB05:TR04:A3HIHI 180

caput FBCK:FB05:TR04:A4DEVNAME ACCL:LI22:1:ADES
#caput FBCK:FB05:TR04:A4DEVNAME FILE:/data/TR04/ACCL:LI22:1:ADES
caput FBCK:FB05:TR04:A4USED 0
caput FBCK:FB05:TR04:A4.EGU MeV
caput FBCK:FB05:TR04:A4CAMODE 0
caput FBCK:FB05:TR04:A4LOLO -2000
caput FBCK:FB05:TR04:A4HIHI 6000

caput FBCK:FB05:TR04:A5DEVNAME ACCL:LI22:1:PDES 
#caput FBCK:FB05:TR04:A5DEVNAME FILE:/data/TR04/ACCL:LI22:1:PDES 
caput FBCK:FB05:TR04:A5USED 0
caput FBCK:FB05:TR04:A5.EGU degs
caput FBCK:FB05:TR04:A5CAMODE 0
caput FBCK:FB05:TR04:A5LOLO -50
caput FBCK:FB05:TR04:A5HIHI 10

caput FBCK:FB05:TR04:A6DEVNAME ACCL:LI25:1:ADES
#caput FBCK:FB05:TR04:A6DEVNAME FILE:/data/TR04/ACCL:LI25:1:ADES
caput FBCK:FB05:TR04:A6USED 0
caput FBCK:FB05:TR04:A6.EGU MeV
caput FBCK:FB05:TR04:A6CAMODE 0
caput FBCK:FB05:TR04:A6LOLO -1500
caput FBCK:FB05:TR04:A6HIHI 15000

caput FBCK:FB05:TR04:A7CAMODE 0
caput FBCK:FB05:TR04:A8CAMODE 0
caput FBCK:FB05:TR04:A9CAMODE 0
caput FBCK:FB05:TR04:A10CAMODE 0

# Energy
caput -a FBCK:FB05:TR04:ACTENERGY 6 1 1 1 1 1 1

# Must set these up in order to have the config app work
caput FBCK:FB05:TR04:MEASNUM 1
caput FBCK:FB05:TR04:ACTNUM 1
caput FBCK:FB05:TR04:STATENUM 1
caput FBCK:FB05:TR04:PGAIN 0.0
caput FBCK:FB05:TR04:IGAIN 0.1
caput -a FBCK:FB05:TR04:MEASDSPR 10 -262.74 -762.046 -233.372 1 -387.133 1-77.6 97.703 -146.209 -18.7413

# Enable loop
caput FBCK:FB05:TR04:INSTALLED 1
####caput FBCK:FB05:TR04:STATE 1

# Save the configuration
caput FBCK:FB05:TR04:SAVE 0
caput FBCK:FB05:TR04:SAVE 1
