public Optional<PlcValue> get(SimulatedTag tag) {
        LOGGER.debug("getting tag {}", tag);
        Objects.requireNonNull(tag);
        switch (tag.getType()) {
            case STATE:
                return Optional.ofNullable(state.get(tag));
            case RANDOM:
                return Optional.ofNullable(randomValue(tag));
            case STDOUT:
                return Optional.empty();
        }
        throw new IllegalArgumentException("Unsupported tag type: " + tag.getType().name());
    }
Test device storing its state in memory.
Values are stored in a HashMap.
plc4j/drivers/simulated/src/main/java/org/apache/plc4x/java/simulated/connection/SimulatedDevice.java