// ************************************************************************** // // eses eses // eses eses // eses eseses esesese eses Embedded Systems Group // ese ese ese ese ese // ese eseseses eseseses ese Department of Computer Science // eses eses ese eses // eses eseses eseseses eses University of Kaiserslautern // eses eses // // ************************************************************************** // Controller1 simply reevaluates the velocity vector in constant time intervals // // The example has been taken from the following reference: // @phdthesis{Baue12, // key ={Baue12}, // author ={K. Bauer}, // title ={A New Modelling Language for Cyber-physical Systems}, // address ={Kaiserslautern, Germany}, // editor ={K. Schneider and R. Majumdar}, // month ={January}, // school ={Department of Computer Science, University of Kaiserslautern, Germany}, // year ={2012}, // note ={PhD}, // remark ={rsg} // } // ****************************************************************************** macro v = 5.0; macro timeOut = 2.0; module Controller1( hybrid real ?boatX, ?boatY, hybrid real !motorX, !motorY, real ?accuracy, ?landingX, ?landingY, len, bool ?landingReached ) { real diffX, diffY; hybrid real t; while (not landingReached){ diffX = landingX − boatX; diffY = landingY − boatY; len = next(motorX) = exp(exp(diffX,2) + exp(diffY,2),0.5); (diffX / len) ∗ v; next(motorY) = (diffY / len) ∗ v; flow{}until(true); // wait for two units of time t = 0.0; flow{ drv(t)<−1.0; } until (cont(t) >= timeOut);// The release condition is fixed according to the time interval } loop{ pause; } }