From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-19-2019 11:02 AM
Hi all,
I'm working on an AF project where I need the ability to save and load a list of instructions (messages), along with some timing information on what iteration/when to send the message.
Some of thetmessages contain an arbitrary data type, others have no payload.
These messages currently need to be sent to two different nested actors, depending on the instruction.
Has anyone done something similar, or have thoughts on how to implement something like this?
Additionally it would be useful, but not critical, if the file were human readable for edits to the instructions without having to build a separate editor .
Apologies for formatting issues, on mobile.
Solved! Go to Solution.
02-21-2019 01:11 PM
Not AF, but I have done objects saved as human-editable JSON. It requires the objects having "To JSON" and "From JSON" methods. The JSON needs to include the class name so the object can be recreated.
02-28-2019 08:29 AM
This sounds a lot like Desktop Execution Trace Tool. You could use the trace output and parse out a list of commands sent to/received by a specific actor.
I guess you then want to go the other way and issue the messages based on a list of commands. This is a bit more interesting, but I guess you could get the parser to make an array of messages and timings and then recreate this messaging in your other situation. I am not sure how to handle the payloads though!
02-28-2019 08:39 AM
Thanks for the replies!
I was curious if I could get around having saving/loading methods for each message of a different data type (re-assigning all the AF message objects manually isn't fun). Sadly I don't think that's possible, so I'm leaning towards something like a .ToString() method and .FromString() method for each message class.
Nate
02-28-2019 09:41 AM
It won't give you editable data payloads, and it might be not helpful because it will require the application to already have the classes in memory, but you can reproduce instructions from the built-in Flatten to String or similar. Perhaps combined with some manual formatting to a text file for the intervals (allowing the intervals to be editable, and a fixed message with data to be copy-able) would be enough?
If you wanted to also edit the payload, and they had sensible string representations, you could do that too but then I guess you're basically almost all of the way to a toString(), fromString() setup...
02-28-2019 11:05 AM
@CertifiNATEtion wrote:
I was curious if I could get around having saving/loading methods for each message of a different data type (re-assigning all the AF message objects manually isn't fun). Sadly I don't think that's possible, so I'm leaning towards something like a .ToString() method and .FromString() method for each message class.
What in the world are you talking about? Except for a lack of human editability, Flatten/Unflatten does everything you want, effortlessly.
02-28-2019 01:16 PM
02-28-2019 02:51 PM
@CertifiNATEtion wrote:
It's manually changing the inheritance of each message class.
Why would you need to do that?
02-28-2019 03:03 PM
02-28-2019 03:06 PM
Don't make it a method. Just straight up flatten the object.