Timedata InfluxDB Question


I am pretty new to openEMS, but I think it is a great project.
I have programmed a controller and I am trying out different scenarios to see how it reacts. Currently I am trying to simulate a week. In order to do this, without letting the program run for a whole week, I set the core cycle at 50 ms and the number of cycles after which the Timedata InfluxDB writes the information to a InfluxDB database to 1. However the data is written in the database once every second, not 20 times a second as I wanted.
Does anyone know how to fix this this?
Is it at all possible for the Timedata InfluxDB to write the data so often in a database?
If it isn’t possible, is there another way to simulate a week in a couple of hours?

Best regards,

Hi Vincenzo,

welcome to the Community.

By default the writes to InfluxDB are truncated to one value per second. You should be able to adjust implementation for your use-case here:

Apart from that: I am working on a “Simulator” which might be exactly what you need. It is already functional, but unfortunately still lacks proper documentation and a nice UI.

To try if it suits you, you would have to

  • Activate the “Controller Api REST/JSON Read-Write” in OpenEMS. (I usually use the Talend API Tester chrome extension)
  • Then send a executeSimulation JSONRPC-Request (see the example here), that defines the simulated Components, simulated data and simulation parameters.
    • components keeps the configuration for each Component, just like Apache Felix Configuration Admin would do
    • clock defines the duration of the simulation.
      • To simulate a real-time execution set the timeleapPerCycle to 1000 (i.e. 1 second) and executeCycleTwice to false.
      • (The settings in the example (timeleapPerCycle:900000, executeCycleTwice:true) are for a simulation of 15 minutes values, e.g. for industrial peak-shaving applications)
    • profiles: define the input data. This is the data you currently provide via a datasource.
    • collect: defines the channels that you would want to record.
  • The simulation will then run for a while… watch the logs to see the progress
  • Once it’s finished it returns a JSONRPC-Response, that holds the collected channel data as a JSON
  • The Simulator-App also behaves like a Timedata service in OpenEMS, so you can also see the simulated results in OpenEMS UI.

Looking forward to hearing from you about this. I am curious to know if it works for you.


Hi Stefan!
Thanks for the quick reply!
I have tried to change that row, but it doesn’t really work. The data is still being written once per second. Maybe I’ve done it wrong. Could you be a little more specific about how I should change it?

I have not tried it, but this should work:

	protected synchronized void collectAndWriteChannelValues() {
		if (++this.cycleCount >= this.config.noOfCycles()) {
			this.cycleCount = 0;
			final Builder point = Point.measurement(InfluxConnector.MEASUREMENT).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
			final AtomicBoolean addedAtLeastOneChannelValue = new AtomicBoolean(false);

Thanks a lot, it worked!

That is actually exactly what I have tried, but because the Influx DB log was shown once per second, I falsely assumed that the data is also truncated once per second. After I quarried the data I was able to see that it was logged much more than once per second.

Many thanks and keep up the good work!