void CEmTubeSplashViewContainer::Draw(const TRect& /*aRect*/) const
	{

    CWindowGc& gc = SystemGc();

    gc.SetClippingRect( Rect() );

	gc.SetBrushColor( KRgbWhite );
    gc.Clear( Rect() );

	TRect rect = Rect();
	TInt x, y;

	x = (rect.Width() / 2) - (KBitmapSize / 2);
	y = (rect.Height() / 2) - (KBitmapSize / 2);

	TInt s_width = iBitmap->ScanLineLength(iBitmap->SizeInPixels().iWidth, EColor16MU ) / 4;
	TInt s_height = iBitmap->SizeInPixels().iHeight;

	TInt d_width = iTmpBitmap->ScanLineLength(iTmpBitmap->SizeInPixels().iWidth, EColor16MU ) / 4;
//	TInt d_height = iTmpBitmap->SizeInPixels().iHeight;

	iBitmap->LockHeap(ETrue);
	iTmpBitmap->LockHeap(ETrue);

	TUint32* src = (TUint32*) iBitmap->DataAddress();
	TUint32* dst = (TUint32*) iTmpBitmap->DataAddress();

#define GET_R( rgb ) ((rgb >> 16) & 0xff)
#define GET_G( rgb ) ((rgb >> 8) & 0xff)
#define GET_B( rgb ) (rgb & 0xff)

#define SET_R( r ) ((r & 0xff) << 16 )
#define SET_G( g ) ((g & 0xff) << 8 )
#define SET_B( b ) ( b & 0xff)

	TUint32 alpha = iAlpha * 255;
	TUint32 alpha1 = (KAlphaMax - iAlpha);
	for (TInt i = 0; i < s_height; i++)
    	{
    	TUint32* d = dst;
    	TUint32* s = src;
        for (TInt j = 0; j < s_width; j++)
	        {
			TUint32 rgb = *s++;

			TUint32 r = ((GET_R( rgb ) * alpha1) + alpha) >> 8;
			TUint32 g = ((GET_G( rgb ) * alpha1) + alpha) >> 8;
			TUint32 b = ((GET_B( rgb ) * alpha1) + alpha) >> 8;

			rgb = SET_R( r ) + SET_G( g ) + SET_B( b );
			*d++ = rgb;
	        }
        dst += d_width;
        src += s_width;
		}

	iBitmap->UnlockHeap(ETrue);
	iTmpBitmap->UnlockHeap(ETrue);

	gc.BitBlt( TPoint( x, y ), iTmpBitmap);
    gc.CancelClippingRect();
	}
static void evaluate_dynamical_model(AMOContext_Context submodel_ctx)
{
   /* Local common sub-expressions. */
   ZERO_SIZE_ARRAY(cs);
   ZERO_SIZE_ARRAY(is);
   ZERO_SIZE_ARRAY(bs);
   ZERO_SIZE_ARRAY(rs);
   ZERO_SIZE_ARRAY(ss);
   
   /* Evaluating toplevel systems. */
   SET_B(0, FALSE) /* idb__ */;
   SET_B(1, FALSE) /* idb___0 */;
   SET_R(
      16,
      IF(
         GT_TRIGGER(1),
         R(14) /* ifield */ *
         (
            R(14) /* ifield */ *
            (
               5.8160000000000001e-001 * R(14) /* ifield */ +
               - 2.9315000000000002e+000
            ) +
            4.6432000000000002e+000
         ),
         0.0000000000000000e+000
      )
   )
      /* k */;
   SET_R(0, R(16) /* k */ * (1.0471975511999999e-001 * R(17) /* speed */))
      /* BEMF */;
   SET_R(
      4,
      IF(
         BNOT(GE_TRIGGER(0)),
         (- 1.0000000000000000e+000 * R(6) /* Rarm1 */ + R(5) /* Rarm0 */) *
         (
            TIME *
            (
               - 1.0000000000000000e+000 *
               RIPOW(R(18) /* tswitchoff */, - 1)
            ) +
            1.0000000000000000e+000
         ) +
         R(6) /* Rarm1 */,
         R(6) /* Rarm1 */
      )
   )
      /* Rarm */;
   SET_R(
      13,
      RIPOW(R(4) /* Rarm */, - 1) *
      (
         - 1.0000000000000000e+000 * R(0) /* BEMF */ +
         1.4000000000000000e+002
      )
   )
      /* iarm */;
   SET_R(12, R(14) /* ifield */ + R(13) /* iarm */) /* i */;
   SET_R(2, 1.4000000000000000e+002 * R(12) /* i */) /* Pe */;
   SET_R(8, R(13) /* iarm */ * R(16) /* k */) /* Tem */;
   SET_R(
      3, R(8) /* Tem */ * (1.0471975511999999e-001 * R(17) /* speed */)
   )
      /* Pem */;
   SET_R(
      10,
      RIPOW(R(1) /* Lfield */, - 1) *
      (
         R(7) /* Rfield */ *
         (- 1.0000000000000000e+000 * R(14) /* ifield */) +
         1.4000000000000000e+002
      )
   )
      /* der(ifield) */;
   SET_R(
      11,
      9.5492965854826952e+000 *
      (
         R(9) /* cvisc */ * (- 1.0000000000000000e+000 * R(17) /* speed */) +
         R(8) /* Tem */
      )
   )
      /* der(speed) */;
   SET_R(19, 1.4000000000000000e+002) /* u */;
   
   return;
}
/* The dynamic part of the submodel */
void shuntdcmotorwithstartingresistor_(
   int *n,
   double *x0,
   double *xd0,
   double *x1,
   double *xd1,
   double *w0,
   double *w1,
   double *w2,
   double *w3,
   double *w4,
   double *w5,
   double *w6,
   double *w7,
   double *w8,
   double *w9,
   double *w10,
   double *w11,
   double *w12,
   double *w13,
   double *w14,
   double *w15,
   double *w16,
   double *w17,
   double *w18,
   double *w19,
   double rp[7],
   int ip[11],
   char *tp[1],
   void *ps[1],
   int *flag,
   double *t
)
{
/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */
   /* Context declaration. */
   AMOContext_Context submodel_ctx;
/* <<<<<<<<<<<<End of Extra Calculation Declarations. */
/* >>>>>>>>>>>>Calculation Function Executable Statements. */
   /* Retrieving the model context. */
   submodel_ctx = ps[0];
   
   /* Initializing the context for a new submodel call. */
   AMOContext_initialize_submodel_call(submodel_ctx, *t, *flag);
   
   /* Copying input variables. */
   {}
   
   /* Copying integer "pre" values. */
   {}
   
   /* Copying enumeration "pre" values. */
   {}
   
   /* Copying boolean "pre" values. */
   {}
   
   /* Copying real "pre" values. */
   {}
   
   /* Copying dynamical real guess values. */
   {}
   
   /* Copying "when" condition states. */
   {}
   
   /* Copying integer trigger states. */
   {}
   
   /* Copying boolean trigger states. */
   AMOContext_set_boolean_trigger_state(
      submodel_ctx, 1, REAL_TO_BOOLEAN(*w10) /* booleantrigger1 */
   );
   AMOContext_set_boolean_trigger_state(
      submodel_ctx, 0, REAL_TO_BOOLEAN(*w9) /* booleantrigger0 */
   );
   
   /* Copying real trigger states. */
   {}
   
   /* Copying time comparison states. */
   {}
   
   /* Copying sample states. */
   {}
   
   /* Copying continuous variables. */
   SET_R(17, *x1 /* speed */) /* speed */;
   SET_R(14, *x0 /* ifield */) /* ifield */;
   
   /* Executing the appropriate computations. */
   AMOContext_execute_submodel_call(submodel_ctx);
   
   /* Updating integer "pre" values. */
   {}
   
   /* Updating enumeration "pre" values. */
   {}
   
   /* Updating boolean "pre" values. */
   {}
   
   /* Updating real "pre" values. */
   {}
   
   /* Updating real dynamical guess values. */
   {}
   
   /* Updating "when" condition states. */
   {}
   
   /* Updating boolean trigger states. */
   *w10 /* booleantrigger1 */ =
      BOOLEAN_TO_REAL(
         AMOContext_get_boolean_trigger_state(submodel_ctx, 1)
      );
   *w9 /* booleantrigger0 */ =
      BOOLEAN_TO_REAL(
         AMOContext_get_boolean_trigger_state(submodel_ctx, 0)
      );
   
   /* Updating integer trigger states. */
   {}
   
   /* Updating real trigger states. */
   {}
   
   /* Updating time comparison states. */
   {}
   
   /* Updating sample states. */
   {}
   
   /* Updating continuous states. */
   *x1 /* speed */ = R(17) /* speed */;
   *x0 /* ifield */ = R(14) /* ifield */;
   
   /* Updating derivatives. */
   *xd1 /* speed */ = R(11) /* der(speed) */;
   *xd0 /* ifield */ = R(10) /* der(ifield) */;
   
   /* Updating residuals. */
   {}
   
   /* Updating integer simple variables. */
   {}
   
   /* Updating boolean simple variables. */
   {}
   
   /* Updating real simple variables. */
   *w19 /* u */ = R(19) /* u */;
   *w18 /* tswitchoff */ = R(18) /* tswitchoff */;
   *w17 /* k */ = R(16) /* k */;
   *w16 /* inertia */ = R(15) /* inertia */;
   *w15 /* iarm */ = R(13) /* iarm */;
   *w14 /* i */ = R(12) /* i */;
   *w13 /* x1 */ = R(11) /* der(speed) */;
   *w12 /* x0 */ = R(10) /* der(ifield) */;
   *w11 /* cvisc */ = R(9) /* cvisc */;
   *w8 /* Tem */ = R(8) /* Tem */;
   *w7 /* Rfield */ = R(7) /* Rfield */;
   *w6 /* Rarm1 */ = R(6) /* Rarm1 */;
   *w5 /* Rarm0 */ = R(5) /* Rarm0 */;
   *w4 /* Rarm */ = R(4) /* Rarm */;
   *w3 /* Pem */ = R(3) /* Pem */;
   *w2 /* Pe */ = R(2) /* Pe */;
   *w1 /* Lfield */ = R(1) /* Lfield */;
   *w0 /* BEMF */ = R(0) /* BEMF */;
   
   /* Updating output variables. */
   {}
   
   /* Finalizing call. */
   AMOContext_finalize_submodel_call(submodel_ctx);
/* <<<<<<<<<<<<End of Calculation Executable Statements. */
}
static void evaluate_initial_model(AMOContext_Context submodel_ctx)
{
   /* Local common sub-expressions. */
   ZERO_SIZE_ARRAY(cs);
   ZERO_SIZE_ARRAY(is);
   ZERO_SIZE_ARRAY(bs);
   ZERO_SIZE_ARRAY(rs);
   ZERO_SIZE_ARRAY(ss);
   
   /* Evaluating toplevel systems. */
   SET_B(0, TIME >= 2.5000000000000000e+000) /* idb__ */;
   SET_B(1, R(14) /* ifield */ > 0.0000000000000000e+000) /* idb___0 */;
   SET_R(
      16,
      IF(
         B(1) /* idb___0 */,
         R(14) /* ifield */ *
         (
            R(14) /* ifield */ *
            (
               5.8160000000000001e-001 * R(14) /* ifield */ +
               - 2.9315000000000002e+000
            ) +
            4.6432000000000002e+000
         ),
         0.0000000000000000e+000
      )
   )
      /* k */;
   SET_R(0, R(16) /* k */ * (1.0471975511999999e-001 * R(17) /* speed */))
      /* BEMF */;
   SET_R(1, 1.0000000000000001e-001) /* Lfield */;
   SET_R(
      4,
      IF(
         BNOT(B(0) /* idb__ */),
         3.6000000000000001e+000 *
         (
            TIME *
            (
               - 1.0000000000000000e+000 *
               RIPOW(2.5000000000000000e+000, - 1)
            ) +
            1.0000000000000000e+000
         ) +
         4.0000000000000002e-001,
         4.0000000000000002e-001
      )
   )
      /* Rarm */;
   SET_R(
      13,
      RIPOW(R(4) /* Rarm */, - 1) *
      (
         - 1.0000000000000000e+000 * R(0) /* BEMF */ +
         1.4000000000000000e+002
      )
   )
      /* iarm */;
   SET_R(12, R(14) /* ifield */ + R(13) /* iarm */) /* i */;
   SET_R(2, 1.4000000000000000e+002 * R(12) /* i */) /* Pe */;
   SET_R(8, R(13) /* iarm */ * R(16) /* k */) /* Tem */;
   SET_R(
      3, R(8) /* Tem */ * (1.0471975511999999e-001 * R(17) /* speed */)
   )
      /* Pem */;
   SET_R(5, 4.0000000000000000e+000) /* Rarm0 */;
   SET_R(6, 4.0000000000000002e-001) /* Rarm1 */;
   SET_R(7, 2.7500000000000000e+002) /* Rfield */;
   SET_R(9, 1.7000000000000001e-002) /* cvisc */;
   SET_R(
      10,
      RIPOW(1.0000000000000001e-001, - 1) *
      (
         - 2.7500000000000000e+002 * R(14) /* ifield */ +
         1.4000000000000000e+002
      )
   )
      /* der(ifield) */;
   SET_R(
      11,
      9.5492965854826952e+000 *
      (- 1.7000000000000001e-002 * R(17) /* speed */ + R(8) /* Tem */)
   )
      /* der(speed) */;
   SET_R(15, 5.9999999999999998e-001) /* inertia */;
   SET_R(18, 2.5000000000000000e+000) /* tswitchoff */;
   SET_R(19, 1.4000000000000000e+002) /* u */;
   
   return;
}