Sud: server always starts empty; sude/*.json is purely a client concern
Several sude/*.json schedules can exist on disk; only one runs at a time, chosen by a client Load. Sud no longer takes a path at all - it starts empty (EMPTY_SUD) and the server config no longer names a specific schedule file, removing the implicit link to sud_0010.json in particular. Reading/writing sude/*.json is now entirely the client's job (e.g. the GUI's Load/Save file dialogs); the server's Sud only ever holds whatever was last Load()ed, in memory, until replaced or the server restarts. Updates demo_sud.py/demo_sud_save_load.py to construct an empty Sud() and load() a schedule explicitly, matching the new constructor.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import numpy as np
|
||||
from matplotlib.pyplot import plot, step, figure, subplot, grid, show, legend, yticks
|
||||
from components.sud import Sud, SudState
|
||||
@@ -33,7 +34,9 @@ if __name__ == '__main__':
|
||||
}
|
||||
}
|
||||
|
||||
sud = Sud("sude/sud_0010.json")
|
||||
sud = Sud()
|
||||
with open("sude/sud_0010.json") as f:
|
||||
sud.load(json.load(f))
|
||||
|
||||
first_step = sud.schedule[0]
|
||||
plant_params = {
|
||||
|
||||
Reference in New Issue
Block a user