Open-SCPI-Protocol-Emulator icon indicating copy to clipboard operation
Open-SCPI-Protocol-Emulator copied to clipboard

Can we use this to emulate another keysight device?

Open njentit opened this issue 1 year ago • 2 comments

can i emulate keysight N77* families using this emulator, what step do i need to write the device emulation ?

sorry it not an issue but a question.

njentit avatar Feb 22 '24 06:02 njentit

Hi, yes you can use this to write your own emulator for Keysight N77xx series devices. In order to do so you need this Programming Guide and then you can write an ANTLR grammar similar to the existing ones. Then you need a visitor that transforms the parse tree of a command to a command type (a generated union type) that contains all the values of the command. In the existing implementations the command type is fed to an event stream and the emulation state machine listens to that input stream. When you want to send data back you just push it to the output queue.

Tyrrx avatar Feb 28 '24 07:02 Tyrrx

Btw, there is a better solution for generating union types in C#. You can use the FunicularSwitch.Generators package like:

[FunicularSwitch.Generators.UnionType]
public abstract class Command{...}

public sealed class ConfigureChannel: Command{...}
public sealed class InitiateChannel: Command{...}
public sealed class InputChannel: Command{...}

Or you can use F# with native union type support to implement the visitor (best solution).

Tyrrx avatar Feb 28 '24 08:02 Tyrrx