import ch.hevs.isi.MinecraftController;
import ch.hevs.isi.core.FloatDataPoint;
import ch.hevs.isi.db.DatabaseConnector;

/**
 * Class to test the database connector
 *
 */
public class Database {
    public static void main(String[] args) {
        // set the erase parameter to true
        MinecraftController.ERASE_PREVIOUS_DATA_INB_DB = true;

        // Create 2 data points
        FloatDataPoint clock = new FloatDataPoint("CLOCK_FLOAT", false);
        FloatDataPoint gridVoltage = new FloatDataPoint("GRID_U_FLOAT", true);

        // Initialize the database connector
        DatabaseConnector.getMySelf().initialize(null);

        // Set the time to 0
        clock.setValue(0f);

        // Set the grid voltage to 750
        // and make a sawtooth from 750 to 850 and back to 750 in 30 steps
        for (float i = 0; i < 3; i += 0.1f) {
            System.out.println();
            clock.setValue(i);
            gridVoltage.setValue(750 + (100*i)%100);
        }

    }
}
