Skip to content

Commit

Permalink
Fix transform_condition (was using Brnez for default instead of Breqz)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsso committed Jul 30, 2021
1 parent 1f65306 commit 0c02589
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions myps/test-scripts/factory/gas.myps
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,22 @@ loop:
if db.Setting != 0:
# (a) batch read temperature and pressure from furnace (tF/pF)
db.Setting = 2
yield()
fix nF = AdvFurnace.all.TotalMoles.avg
tF = AdvFurnace.all.Temperature.avg
pF = AdvFurnace.all.Pressure.avg

# (b) read tank temperatures
db.Setting = 3
yield()
tC = tankC.Temperature
tH = tankH.Temperature

# (c) read targets (tT/pT),
db.Setting = 4
yield()
tT = tTSrc.Setting
pT = pTSrc.Setting

# (d) calculate moles to remove and add from C and H (nR/nC/nH)
db.Setting = 5
yield()
tag partD:
nT = pT*vF/(R*tT)
tTnT = tT*nT
Expand All @@ -52,7 +48,6 @@ loop:

# (e) remove nR, mix nC and nH
db.Setting = 6
yield()
tag parthE:
def kP = 0.06
def kD = 0.02
Expand All @@ -74,25 +69,15 @@ loop:
fix eFPrev = 0 # fix F error (prev)
fix eCPrev = 0 # fix C error (prev)
fix eHPrev = 0 # fix H error (prev)
db.Setting = eF
yield()
db.Setting = eC
yield()
db.Setting = eH
yield()
db.Setting = 999
yield()
while eF > 0.1 or eC > 0.1 or eH > 0.1:
db.Setting = 1234
yield()
uF = (kP * eF) + (kD * (eF - eFPrev) / dt)
AdvFurnace.all.SettingOutput = uF # set furnace out
AdvFurnace.all.SettingOutput = max(0, min(uF, 100)) # set furnace out

uC = (kP * eC) + (kD * (eC - eCPrev) / dt)
nCPump.Setting = uC # set C pump
nCPump.Setting = max(0, min(uC, 100)) # set C pump

uH = (kP * eH) + (kD * (eH - eHPrev) / dt)
nHPump.Setting = uH # set H pump
nHPump.Setting = max(0, min(uH, 100)) # set H pump

eFPrev = eF # save F error
eCPrev = eC # save C error
Expand All @@ -110,7 +95,6 @@ loop:

# (f) input the nC and nH gas (can the necessary run time be calculated?)
db.Setting = 7
yield()
AdvFurnace.all.SettingInput = 100
while PipeAnalyzer.all.TotalMoles.avg > 0:
yield()
Expand Down

0 comments on commit 0c02589

Please sign in to comment.