ICore Blocks / Targets / Software

Java

A single class, no framework, no build tool required.

Deploy writes
  • <name>_deployableCore.java
  • <name>_testbench.java
One call, one sample

executeBlocks()

Verified with

javac and java

Numbers

double

Library blocks

306 of 308

One public class holding params, signals, inputs and state, with executeBlocks() advancing it by a sample. It compiles with javac and runs with java — there is no Maven or Gradle scaffolding to accept, and nothing to exclude if you already have your own.

Useful where the model has to live inside an existing JVM service: a test harness, a simulation server, or an Android-side model that mirrors what the hardware runs.

What the export looks like

Every target page shows the same model, so the ten are directly comparable: an input, an error junction, a gain of 1.8, a discrete plant 0.4z⁻¹ / (1 − 0.6z⁻¹), an output — and the plant's output fed back into the junction. Five blocks, in a diagram the export-verification suite calls DPT_Feedback_Discrete — which is where the names in the file come from. Below is what Deploy writes for this target, with only the file's header banner removed.

DPT_Feedback_Discrete_deployableCore.java

public class DPT_Feedback_Discrete_deployableCore {

    // Tunable parameters (editable from the testbench)
    public static class Params {
        // blk2: ICore Blocks/Home/DPT_Feedback_Discrete/Ctrl_Gain
        public double[][] blk2_gain = new double[][] {{1.8}};
    }
    public Params params = new Params();

    // Signal storage (readable from the testbench)
    public static class Signals {
        // sig0: ICore Blocks/Home/DPT_Feedback_Discrete/In1/ICoreDouble-Out-0
        public double[][] sig0 = new double[1][1];
        // sig1: ICore Blocks/Home/DPT_Feedback_Discrete/Error/ICoreDouble-Out-0
        public double[][] sig1 = new double[1][1];
        // sig2: ICore Blocks/Home/DPT_Feedback_Discrete/Ctrl_Gain/ICoreDouble-Out-0
        public double[][] sig2 = new double[1][1];
        // sig3: ICore Blocks/Home/DPT_Feedback_Discrete/Plant/ICoreDouble-Out-0
        public double[][] sig3 = new double[1][1];
        // sig4 (boundary output): ICore Blocks/Home/DPT_Feedback_Discrete/ICoreDouble-Out-0
        public double[][] sig4 = new double[1][1];
        // External inputs: set before executeBlocks; input gates copy these in.
        public static class Inputs {
            public double[][] sig0 = new double[1][1];
        }
        public Inputs inputs = new Inputs();
    }
    public Signals signals = new Signals();

    // blk0: ICore Blocks/Home/DPT_Feedback_Discrete/In1
    class Blk0 {

        void solve() {
            signals.sig0 = signals.inputs.sig0;
        }
    }

    // blk1: ICore Blocks/Home/DPT_Feedback_Discrete/Error
    class Blk1 {

        void solve() {
            double[][] output = new double[1][1];
            double[][] in0 = signals.sig0;
            for (int i = 0; i < output.length; i++) {
                for (int j = 0; j < output[0].length; j++) {
                    output[i][j] += in0[i][j];
                }
            }
            double[][] in1 = signals.sig3;
            for (int i = 0; i < output.length; i++) {
                for (int j = 0; j < output[0].length; j++) {
                    output[i][j] -= in1[i][j];
                }
            }
            signals.sig1 = output;
        }
    }

    // blk2: ICore Blocks/Home/DPT_Feedback_Discrete/Ctrl_Gain
    class Blk2 {

        void solve() {
            double[][] gain = params.blk2_gain;
            double[][] input = signals.sig1;
            double[][] output = new double[1][1];
            for (int i = 0; i < output.length; i++) {
                for (int j = 0; j < output[0].length; j++) {
                    output[i][j] = input[i][j] * gain[0][0];
                }
            }
            signals.sig2 = output;
        }
    }

    // blk3: ICore Blocks/Home/DPT_Feedback_Discrete/Plant
    class Blk3 {

        double[] num = {0, 0.40000000000000002};
        double[] den = {-0.59999999999999998};
        double[][][] uHist = new double[1][1][2];
        double[][][] yHist = new double[1][1][1];

        void solve() {
            double[][] u = signals.sig2;
            double[][] out = new double[1][1];
            for (int r = 0; r < 1; r++) {
                for (int c = 0; c < 1; c++) {
                    double uk = u[r][c];
                    for (int k = 1; k > 0; k--) uHist[r][c][k] = uHist[r][c][k - 1];
                    uHist[r][c][0] = uk;
                    double yk = 0.0;
                    for (int i = 0; i < 2; i++) yk += num[i] * uHist[r][c][i];
                    for (int i = 0; i < 1; i++) yk -= den[i] * yHist[r][c][i];
                    yHist[r][c][0] = yk;
                    out[r][c] = yk;
                }
            }
            signals.sig3 = out;
        }
    }

    // blk4: ICore Blocks/Home/DPT_Feedback_Discrete/Out1
    class Blk4 {

        void solve() {
            signals.sig4 = signals.sig3;
        }
    }

    Blk0 blk0 = new Blk0();
    Blk1 blk1 = new Blk1();
    Blk2 blk2 = new Blk2();
    Blk3 blk3 = new Blk3();
    Blk4 blk4 = new Blk4();

    // Execution order generated automatically from block diagram
    public void executeBlocks() {
        // blk0: ICore Blocks/Home/DPT_Feedback_Discrete/In1
        blk0.solve();
        // blk1: ICore Blocks/Home/DPT_Feedback_Discrete/Error
        blk1.solve();
        // blk2: ICore Blocks/Home/DPT_Feedback_Discrete/Ctrl_Gain
        blk2.solve();
        // blk3: ICore Blocks/Home/DPT_Feedback_Discrete/Plant
        blk3.solve();
        // blk4: ICore Blocks/Home/DPT_Feedback_Discrete/Out1
        blk4.solve();
    }
}

One public class: nested Params and Signals holding double[][] storage, an inner class per block, and executeBlocks() calling them in order. No annotations, no framework, nothing to put on a classpath — javac and java are the whole toolchain.

How it is checked

Every one of the ten targets is verifiable, and this one is no exception: the export is compiled with the toolchain above, run across the simulation window, and compared against the solver sample by sample. Software targets pass at around 1e-11 % against a 0.1 % tolerance; the HDL targets are bounded by their fixed-point quantum instead. See verification.

See also: Code export  ·  Multi-target, multi-rate deploy

Get started

See it run on your own model.

Download the application from the customer portal, or read the documentation first — the manual, every block with its measured response, and the full command reference are public.