/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const real32_T *motorSpeed = (const real32_T*) ssGetInputPortSignal(S,0); motorControlFCN_Update_wrapper(motorSpeed, xD); }
/* Function: mdlDerivatives ================================================= * Abstract: * In this function, you compute the S-function block's derivatives. * The derivatives are placed in the derivative vector, ssGetdX(S). */ static void mdlDerivatives(SimStruct *S) { real_T t, *xC, *xD, *uWQ, *uES, *sys; int i; SS=S; t = ssGetT(S); xC = ssGetContStates(S); xD = ssGetDiscStates(S); uWQ = ssGetInputPortRealSignal(S,0); sys = ssGetdX(S); for (i=0; i<(int)B(S,"CStates"); i++) { sys[i]=0.0; } // verwijzing naar exra inputs if (B(S,"Setpoints")>0) { uES = &(uWQ[(int) (U(S,"Number")*B(S,"WaterIn"))]); } else { uES=NULL; } wsgetq_Derivatives(sys,t,xC,xD,uWQ,uES, ssGetSFcnParam(S, 0),ssGetSFcnParam(S, 2),ssGetSFcnParam(S, 3)); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T t, *xC, *xD, *uWQ, *uES; SS=S; t = ssGetT(S); xC = ssGetContStates(S); xD = ssGetDiscStates(S); uWQ = ssGetInputPortRealSignal(S,0); // verwijzing naar exra inputs if (B(S,"Setpoints")>0) { uES = &(uWQ[(int) (U(S,"Number")*B(S,"WaterIn"))]); } else { uES=NULL; } wsgetq_Update(t,xC,xD,uWQ,uES, ssGetSFcnParam(S, 0),ssGetSFcnParam(S, 2),ssGetSFcnParam(S, 3)); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const uint16_T *address = (const uint16_T*) ssGetInputPortSignal(S,0); uint16_T *data = (uint16_T *)ssGetOutputPortRealSignal(S,0); logi_readall_Update_wrapper(address, data, xD); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const real_T *input = (const real_T*) ssGetInputPortSignal(S,0); real_T *output = (real_T *)ssGetOutputPortRealSignal(S,0); q_first_sample_latch_Update_wrapper(input, output, xD); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); int16_T *x_vel = (int16_T *)ssGetOutputPortRealSignal(S,0); int16_T *y_acc = (int16_T *)ssGetOutputPortRealSignal(S,1); int16_T *z_acc = (int16_T *)ssGetOutputPortRealSignal(S,2); sf_MPU6050_Driver_GxAyz_Update_wrapper(x_vel, y_acc, z_acc, xD); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const int16_T *uint16_01 = (const int16_T*) ssGetInputPortSignal(S,0); const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S)); const int8_T *Address = (const int8_T *)mxGetData(PARAM_DEF0(S)); MinSegBus01Int_Update_wrapper(uint16_01, xD, Address, p_width0); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); int16_T *x_val = (int16_T *)ssGetOutputPortRealSignal(S,0); int16_T *y_val = (int16_T *)ssGetOutputPortRealSignal(S,1); int16_T *z_val = (int16_T *)ssGetOutputPortRealSignal(S,2); sf_HMC5883L_Update_wrapper(x_val, y_val, z_val, xD); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const boolean_T *in = (const boolean_T*) ssGetInputPortSignal(S,0); const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S)); const uint8_T *pin = (const uint8_T *)mxGetData(PARAM_DEF0(S)); sfcn_A4_out_Update_wrapper(in, xD, pin, p_width0); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const real_T *micros = (const real_T*) ssGetInputPortSignal(S,0); const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S)); const int_T p_width1 = mxGetNumberOfElements(PARAM_DEF1(S)); const real_T *S_T = (const real_T *)mxGetData(PARAM_DEF0(S)); const real_T *PIN = (const real_T *)mxGetData(PARAM_DEF1(S)); hitec_Update_wrapper(micros, xD, S_T, p_width0, PIN, p_width1); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const uint8_T *portNbr = (const uint8_T*) ssGetInputPortSignal(S,0); const uint8_T *data = (const uint8_T*) ssGetInputPortSignal(S,1); const uint8_T *nbrBytes = (const uint8_T*) ssGetInputPortSignal(S,2); real_T *debug = (real_T *)ssGetOutputPortRealSignal(S,0); real_T *data_out = (real_T *)ssGetOutputPortRealSignal(S,1); BBB_UART_ARBOTIX_Update_wrapper(portNbr, data, nbrBytes, debug, data_out, xD); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); real_T *Temp = (real_T *)ssGetOutputPortRealSignal(S,0); const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S)); const int_T p_width1 = mxGetNumberOfElements(PARAM_DEF1(S)); const int8_T *i2cAddress = (const int8_T *)mxGetData(PARAM_DEF0(S)); const real_T *sampleTime = (const real_T *)mxGetData(PARAM_DEF1(S)); Tmp102_Update_wrapper(Temp, xD, i2cAddress, p_width0, sampleTime, p_width1); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); real_T *Humidity = (real_T *)ssGetOutputPortRealSignal(S,0); const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S)); const int_T p_width1 = mxGetNumberOfElements(PARAM_DEF1(S)); const int8_T *interruptNum = (const int8_T *)mxGetData(PARAM_DEF0(S)); const real_T *sampleTime = (const real_T *)mxGetData(PARAM_DEF1(S)); HH10D_Update_wrapper(Humidity, xD, interruptNum, p_width0, sampleTime, p_width1); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); int16_T *gx = (int16_T *)ssGetOutputPortRealSignal(S,0); int16_T *gy = (int16_T *)ssGetOutputPortRealSignal(S,1); int16_T *gz = (int16_T *)ssGetOutputPortRealSignal(S,2); int16_T *ax = (int16_T *)ssGetOutputPortRealSignal(S,3); int16_T *ay = (int16_T *)ssGetOutputPortRealSignal(S,4); int16_T *az = (int16_T *)ssGetOutputPortRealSignal(S,5); sf_MPU6050_Update_wrapper(gx, gy, gz, ax, ay, az, xD); }
/* Function: mdlOutputs ======================================================= * */ static void mdlOutputs(SimStruct *S, int_T tid) { const uint8_T *in = (const uint8_T*) ssGetInputPortSignal(S,0); const real_T *xD = ssGetDiscStates(S); const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S)); const uint8_T *pin = (const uint8_T *)mxGetData(PARAM_DEF0(S)); sfcn_PWM_Out_Outputs_wrapper(in, xD, pin, p_width0); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); real32_T *AccelX = (real32_T *)ssGetOutputPortRealSignal(S,0); real32_T *AccelY = (real32_T *)ssGetOutputPortRealSignal(S,1); real32_T *AccelZ = (real32_T *)ssGetOutputPortRealSignal(S,2); real32_T *GyroX = (real32_T *)ssGetOutputPortRealSignal(S,3); real32_T *GyroY = (real32_T *)ssGetOutputPortRealSignal(S,4); real32_T *GyroZ = (real32_T *)ssGetOutputPortRealSignal(S,5); real32_T *DataSamples = (real32_T *)ssGetOutputPortRealSignal(S,6); readAccelGryo_Update_wrapper(AccelX, AccelY, AccelZ, GyroX, GyroY, GyroZ, DataSamples, xD); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T t, *xC, *xD, *u; int i; t = ssGetT(S); xC = ssGetContStates(S); xD = ssGetDiscStates(S); u = ssGetInputPortRealSignal(S,0); block0_Update(t,xC,xD,u, ssGetSFcnParam(S, 0),ssGetSFcnParam(S, 2),ssGetSFcnParam(S, 3)); }
/* Function: mdlOutputs ======================================================= * Abstract: * In this function, you compute the outputs of your S-function * block. Generally outputs are placed in the output vector, ssGetY(S). */ static void mdlOutputs(SimStruct *S, int_T tid) { real_T t, *xC, *xD, *u, *sys; int i; t = ssGetT(S); xC = ssGetContStates(S); xD = ssGetDiscStates(S); u = ssGetInputPortRealSignal(S,0); sys = ssGetOutputPortRealSignal(S,0); block0_Outputs(sys,t,xC,xD,u, ssGetSFcnParam(S, 0),ssGetSFcnParam(S, 2),ssGetSFcnParam(S, 3)); }
/* Function: mdlOutputs ======================================================= * Abstract: * In this function, you compute the outputs of your S-function * block. Generally outputs are placed in the output vector, ssGetY(S). */ static void mdlOutputs(SimStruct *S, int_T tid) { real_T t, *xC, *xD, *uWQ, *uES, *sysWQ, *sysEM; int i; SS=S; t = ssGetT(S); xC = ssGetContStates(S); xD = ssGetDiscStates(S); uWQ = ssGetInputPortRealSignal(S,0); sysWQ = ssGetOutputPortRealSignal(S,0); for (i=0;i<U(S,"Number")*B(S,"WaterIn")*B(S,"WaterOut");i++) { sysWQ[i] = uWQ[i]; } // verwijzing naar exra inputs if (B(S,"Setpoints")>0) { uES = &(uWQ[ (int) (U(S,"Number")*B(S,"WaterIn"))]); } else { uES=NULL; } // verwijzing naar exra metingen if (B(S,"Measurements")>0) { sysEM = &(sysWQ[(int) (U(S,"Number")*B(S,"WaterOut"))]); for (i=0;i<B(S,"Measurements");i++) { sysEM[i] = 0.0; } } else { sysEM=NULL; } wsgetq_Outputs(sysWQ,sysEM,t,xC,xD,uWQ,uES, ssGetSFcnParam(S, 0),ssGetSFcnParam(S, 2),ssGetSFcnParam(S, 3)); }
/* Function: mdlUpdate ====================================================== * Abstract: * This function is called once for every major integration time step. * Discrete states are typically updated here, but this function is useful * for performing any tasks that should only take place once per * integration step. */ static void mdlUpdate(SimStruct *S, int_T tid) { real_T *xD = ssGetDiscStates(S); const uint16_T *duty1 = (const uint16_T*) ssGetInputPortSignal(S,0); const uint16_T *duty2 = (const uint16_T*) ssGetInputPortSignal(S,1); const uint16_T *period = (const uint16_T*) ssGetInputPortSignal(S,2); const boolean_T *reset_cnt1 = (const boolean_T*) ssGetInputPortSignal(S,3); const boolean_T *reset_cnt2 = (const boolean_T*) ssGetInputPortSignal(S,4); const boolean_T *dir1 = (const boolean_T*) ssGetInputPortSignal(S,5); const boolean_T *dir2 = (const boolean_T*) ssGetInputPortSignal(S,6); uint16_T *cnt1 = (uint16_T *)ssGetOutputPortRealSignal(S,0); uint16_T *cnt2 = (uint16_T *)ssGetOutputPortRealSignal(S,1); uint16_T *spd1 = (uint16_T *)ssGetOutputPortRealSignal(S,2); uint16_T *spd2 = (uint16_T *)ssGetOutputPortRealSignal(S,3); logibone_motor_block_Update_wrapper(duty1, duty2, period, reset_cnt1, reset_cnt2, dir1, dir2, cnt1, cnt2, spd1, spd2, xD); }
/* Function: mdlDerivatives ================================================= * Abstract: * In this function, you compute the S-function block's derivatives. * The derivatives are placed in the derivative vector, ssGetdX(S). */ static void mdlDerivatives(SimStruct *S) { real_T t, *xC, *xD, *u, *sys; int i; t = ssGetT(S); xC = ssGetContStates(S); xD = ssGetDiscStates(S); u = ssGetInputPortRealSignal(S,0); sys = ssGetdX(S); buffer_Derivatives(sys,t,xC,xD,u, ssGetSFcnParam(S, 0),ssGetSFcnParam(S, 2),ssGetSFcnParam(S, 3)); }