RUN
Jump to navigation
Jump to search
The RUN statement can be used within a METHOD to invoke (run) another method, in the same way as a subroutine is called in other languages. In ASCEND, at present, there is no way to pass parameters to METHODS, so the syntax is as simple as
MODEL modela; x IS_A solver_var; METHODS METHOD on_load; FIX x; x := 5; END on_load; END modela; MODEL submodel1; w,y,z IS_A solver_var; w = y^2 + z; METHODS METHOD setup; FIX w; w := 3; END setup; END submodel1; MODEL modelb REFINES modela a IS_A submodel; METHODS METHOD specify; a.z := 5; END specify; METHOD on_load; RUN specify; (* run a method on the same model *) RUN a.setup; (* run a method on a sub-model *) RUN modela::on_load; (* run a 'hidden' method by explicitly stating the MODEL name *) END on_load; END modelb;