FraunhoferIOSB / FROST-Server

A Complete Server implementation of the OGC SensorThings API
https://fraunhoferiosb.github.io/FROST-Server/
GNU Lesser General Public License v3.0
194 stars 70 forks source link

About add Actuator model #3

Closed zebrainncu closed 6 years ago

zebrainncu commented 7 years ago

How to do if I want to add a model actuator like things?

Thanks

hylkevds commented 7 years ago

The current version of the SensorThings API (OGC SensorThings API Part 1: Sensing) does not deal with actuators yet. That will be in the second Part. As a result, our SensorThingsServer also does not have specific actuator functionality yet.

One option is to define a "setpoint sensor" and datastream, have the actuator keep track of the last value in that datastream, and act accordingly.

zebrainncu commented 7 years ago

I appreciate for your instant reply. Can I do something in pathParser.jjt and queryParser.jjt to generate function for actuator ?

mjacoby commented 7 years ago

The SensorThingsAPI has a static data model. Therefore, custom extensions (e.g. classes) like you want to add are not foreseen in this implementation. Nevertheless, it is possible to add support for additional classes like an Actuator class but this will require multiple changes through different modules of the code. Extending the parser files (like you suggested) is just one of multiple steps you have to take.

As these changes are to complex to give you a simple tutorial, I would suggest you to have a look at the model classes (e.g. Sensor) and check where they are used to find out all the things you need to extend to make this work.

zebrainncu commented 7 years ago

Thanks a lot. I got it.

hylkevds commented 7 years ago

If you want to add actuator support, and you have a data model, you would need to look at the following places:

I probably forgot some things, but like mjacoby wrote, have a look at where for instance Sensor.java and QSensors.java are used and it should give you an idea.

zebrainncu commented 7 years ago

It is a big help for me. Thanks!

zebrainncu commented 7 years ago

I treated the Actuator as a Sensor. I try to add the Actuator module which will connect to Thing module. Now I see QThings something in PostgresPersistenceManager.java How to do to get the QActuators.java?

hylkevds commented 7 years ago

The Q* classes are generated by QueryDSL from the build-database. The build-database is generated by Liquibase. The Liquibase change definitions are in tables.xml

It's a bit of a round-abound way, but on one hand it allows for clean database updating, and on the other it gives us database-abstractions that should allow for the easy implementation of other database backends.

By the way, what actuator model are you implementing?

zebrainncu commented 7 years ago

Thanks a lot. It's Smart air conditioner.

hylkevds commented 7 years ago

Ok, but I mean, how does your data model look? Are you using one of the proposed data models for the second part of the SensorThings API?

hylkevds commented 7 years ago

That's really cool! I'll mention it at the OGC Meeting in Delft next week.

zebrainncu commented 7 years ago

I already add createTable for QActuators in tables.xml and add Actuators as well as actuator in pom.xml of SensorThingsServer.SQL and then build the project,but I can't see Q*classes. What else need to do?

Thanks!

hylkevds commented 7 years ago

You might need to do a clean & build, to ensure the build system re-creates the database: mvn clean install That should cause it to remove the build database, re-create the build database and generate the Q* classes from that.

zebrainncu commented 7 years ago

Yes. I saw it. Thanks a lot.