-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Description
Serialization mangles the type of a PIDLOOP.
Upon reloading back in it becomes just a vanilla string who's value happens to be the ToString dump of the PIDLOOP, but is not behaving like a PIDLOOP.
It also is not saving the MAXOUTPUT and MINOUTPUT.
Sample:
test.ks
local pidsample is lexicon("mypid",pidloop(1,0.1,0.5, 50, -50)).
set pidsample["mypid"]:SETPOINT TO 100.
print "Before Serialization:".
print "pidsample[0] type: " + pidsample["mypid"]:typename.
print "pidsample[0] value: " + pidsample["mypid"].
writejson(pidsample, "example.json").
local read_lexicon is readjson("example.json").
print "After Serialization:".
print "type of read_lexicon[""mypid""] type: " + read_lexicon["mypid"]:typename.
print "type of read_lexicon[""mypid""] value: " + read_lexicon["mypid"].
Before Serialization:
pidsample[0] type: PIDLoop
pidsample[0] value: PIDLoop(Kp:1, Ki:0.1, Kd:0.5, Setpoint:100, Error:0, Output:0)
After Serialization:
type of read_lexicon[""mypid""] type: String
type of read_lexicon[""mypid""] value: PIDLoop(Kp:1, Ki:0.1, Kd:0.5, Setpoint:100, Error:0, Output:0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels