REQUIRE "system.a4l"; REQUIRE "basemodel.a4l"; IMPORT "test/blackbox/bboxtest"; (* yi = coef*xi test *) MODEL bbox3; coef IS_A real_constant; n IS_A integer_constant; coef :== 2.0; n :== 3; x[1..n], y[1..n] IS_A generic_real; bbox: bboxtest( x[1..n] : INPUT ; y[1..n] : OUTPUT ; coef : DATA); METHODS METHOD default_all; RUN default_self; END default_all; METHOD default_self; FOR i IN [1..n] DO x[i] := 1+i; y[i] := -x[i]; END FOR; END default_self; METHOD on_load; RUN reset; RUN default_all; END on_load; METHOD self_test; FOR i IN [1..n] DO ASSERT y[1] == coef * x[1]; END FOR; END self_test; METHOD specify; y[1..n].fixed := FALSE; x[1..n].fixed := TRUE; END specify; METHOD specify_reverse; x[1..n].fixed := FALSE; y[1..n].fixed := TRUE; END specify_reverse; END bbox3;