int main(int argc, char **argv) { if (access("train_input.csv" , F_OK ) != -1 ) { //FILE* stream = fopen("train_input.csv", "r"); } else { printf("Input file does not exist. This program expects train_input.csv in the same folder\n"); return 0; } //SCADE reset function call Amsterdam_Utrecht_reset_US_Integration_June(); FILE* stream = fopen("train_input.csv", "r"); char line[1024]; int cycle = 0; while (fgets(line, 1024, stream)) { cycle++; printf("Cycle %d : ", cycle); char* tmp = strdup(line); //strok trashes line, hence repeated tmp use for each call to getfield TrainPos = atof( getfield(tmp, 1) ); printf("Train_pos %f : ", TrainPos); tmp = strdup(line); //strok trashes line, hence repeated tmp use for each call to getfield Trigger_in = atoi( getfield(tmp, 2) ); printf("Trigger_in %d\n", Trigger_in); Amsterdam_Utrecht_US_Integration_June(); free(tmp); } printf("Execution of %d cycles complete\n" , cycle); return 0; }
int SimReset(void) { int nRet=0; _SCSIM_RestoreInterface(); #ifdef EXTENDED_SIM BeforeSimInit(); #endif /* EXTENDED_SIM */ #ifndef KCG_NO_EXTERN_CALL_TO_RESET Amsterdam_Utrecht_reset_US_Integration_June(); nRet=1; #else /* KCG_NO_EXTERN_CALL_TO_RESET */ nRet=0; #endif /* KCG_NO_EXTERN_CALL_TO_RESET */ #ifdef EXTENDED_SIM AfterSimInit(); #endif /* EXTENDED_SIM */ return nRet; }