-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simulation API - Suggestions and Requirements #1828
Comments
I planed to add a vSPI device after vGPIO. It will provide many CE lines(can be customized) and 2 streams to simulate input and output. |
I think vI2C would provide 2 streams too. |
But I can't imagine how to simulate the behavior of PWM. My first reaction was that PWM didn't seem very necessary. |
REST API may not be suitable for these scenarios with active push data capabilities. I think it's only necessary to set aside the most basic backend that is closest to the hardware itself. And how to use these interfaces is left to the user implements. |
Regarding PWM, before designing simulation, we may think about how to express a device with a PWM input. Is there any chip that can receive PWM signal input? |
vGPIO can respond in real time. But I'm not sure whether vSPI should add a delay in IO operations according to the characteristics of the hardware or ignore this feature to do it directly in real time. |
PWM has two main uses: control the brightness of a LED (for instance when used as a LCD backlight) and for controlling servo motors. It's probably not the most important piece to simulate, but shouldn't be forgotten. I'm basically fine with not having the simulation implementation right now, but I still think the interface should allow the simulation to be as much as possible separate from the actual program under test. You might not want to have the implementation of all simulation hardware in your control application. You're right, REST does not support push messages. Is there a similar protocol that does? |
Hi, whatever interface you add will require a server and a client component. At least for Windows I was thinking to add some kind of config_io.json file describing the signals schema. And then use this file to automatically build for example a UWP/WPF/WinForm client window, or why not a REST API or gRPC service. |
@mcNets Yes, that was my idea as well. Ideally, that schema would be created from a frizzing schema, but I do not know whether there are any useful output formats to get a machine-readable signal schema from that. And it might quickly get very complex, we probably don't want to write a full signal simulator. |
@pgrawehr would you mind to have a look at this: Virtual scenario maganagers and tell me what's your opinion? |
@mcNets That looks promising. I like that it generates the GUI automatically from a configuration. What I don't like so much about your approach is that it requires the simulator with the gui to be built into the target application. I would rather have the GUI in a separate application that communicates with the target application over some network protocol. The GUI wouldn't even need to run on the same computer (note that WPF is not available on linux-based devices). This would make it possible to distribute the simulator pre-built and the configuration would be done at runtime. |
@pgrawehr |
I didn't think much of the Gui part actually. I wouldn't care about the technology so much there. More relevant is probably the RPC tool to use, because that will most likely result in a run-time dependency on some library (e.g. gRPC). Do you have experience with RPC libraries?
For me, that would be Ok, but the Microsoft guys would probably prefer Maui. I don't know how far it's linux support is at the moment, though. I can ask around. |
There is a separated repo for the linux part of MAUI. I've made some tests with gRPC but it requires a web server at least in Windows, like kestrel o IIS, and I don't know the requirements for Linux. But let me think about it, I'm about to finish my current project at work and I think I'll be able to spare some time for this project. |
Sounds good. Of course it would also be possible to use a "bare bone" TCP connection or something, but that's eventually more complex than to use something existing. |
ref: #383 |
From @raffaeler's suggestions on #383: The goals for this proposal:
|
We have several PRs suggesting the addition of a simulation GPIO Driver to simplify development and testing without actual hardware (see #1827 and #1823). The team has agreed that such a simulation is desirable, but it should include, at least as possible further extensions, simulation components for other hardware interfaces, particularly I2C, SPI or PWM.
Suggested class structure:
To simulate the behavior of the actual hardware, the simulation devices should have a "backend" interface that allows connecting a simulation implementation, either by having events to connect to, such as showcased here, or something like a REST api to connect an external simulation Gui to. That simulation GUI could then simulate the wiring between inputs/outputs or simulate devices on the I2C bus.
Suggestions or improvements?
I do not expect that a first implementation would be able to support all cases, but it shouldn't block further development towards such a scenario.
@HumJ0218 @mcNets
The text was updated successfully, but these errors were encountered: