Commit 7925b263 authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

user_hard_param instead of user_hardcoded

parent 3018ff22
......@@ -8,45 +8,45 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Thu Aug 13 11:02:43 2015
* Last update : Wed Sep 9 13:31:19 2015
* --------------------------------------------------------
*
*/
#ifndef USER_HARDCODED_h
#define USER_HARDCODED_h
#ifndef USER_HARD_PARAM_h
#define USER_HARD_PARAM_h
// ============================================================ //
// gravity
#define G_3 9.810000
#define G_3 9.81
// mass
#define M_1 5.000000
#define M_3 2.000000
#define M_4 2.000000
#define M_5 2.000000
#define M_1 5
#define M_3 2
#define M_4 2
#define M_5 2
// center of mass
#define L_3_1 0.400000
#define L_3_4 0.075000
#define L_1_5 0.290000
#define L_3_1 0.4
#define L_3_4 0.075
#define L_1_5 0.29
// inertia
#define IN_5_1 0.100000
#define IN_9_3 1.000000
#define IN_5_4 0.100000
#define IN_5_5 0.100000
#define IN_5_1 0.1
#define IN_9_3 1
#define IN_5_4 0.1
#define IN_5_5 0.1
// body point
#define DPT_1_1 0.250000
#define DPT_1_2 -0.500000
#define DPT_3_3 0.500000
#define DPT_3_4 0.250000
#define DPT_3_5 1.500000
#define DPT_3_6 0.150000
#define DPT_1_7 0.580000
#define DPT_1_8 0.290000
#define DPT_1_1 0.25
#define DPT_1_2 -0.5
#define DPT_3_3 0.5
#define DPT_3_4 0.25
#define DPT_3_5 1.5
#define DPT_3_6 0.15
#define DPT_1_7 0.58
#define DPT_1_8 0.29
// ============================================================ //
......
......@@ -90,7 +90,7 @@ def gen_out_file(in_file, out_file):
new_line = new_line.replace('s->frc','frc')
new_line = new_line.replace('s->trq','trq')
new_line = new_line.replace('#include "mbs_project_interface.h"', '#include "mbs_project_interface.h"\n#include "user_hardcoded.h"')
new_line = new_line.replace('#include "mbs_project_interface.h"', '#include "mbs_project_interface.h"\n#include "user_hard_param.h"')
new_line = new_line.replace('#define q s->q', '\ndouble *q = s->q;')
new_line = new_line.replace('#define qd s->qd', 'double *qd = s->qd;')
new_line = new_line.replace('#define qdd s->qdd','double *qdd = s->qdd;\n\ndouble **frc = s->frc;\ndouble **trq = s->trq;')
......
......@@ -38,6 +38,6 @@ make
specifying which file must be generated:
* "user_models": user model files
* "user_all_id": id header file
* "user_hardcoded": hardcoded mbs values header file
* "user_hard_param": hardcoded mbs values header file
* "all": all previous options (this is the default option
if the options is omitted)
......@@ -163,11 +163,11 @@ void generate_user_all_id(char* mbsfile)
}
/*! \brief Generates 'user_hardcoded.h'
/*! \brief Generates 'user_hard_param.h'
*
* \param[in] mbsfile f.mbs file (with path) to use
*/
void generate_user_hardcoded(char* mbsfile)
void generate_user_hard_param(char* mbsfile)
{
// variables declaration
char *fileoutH, *userpath;
......@@ -180,10 +180,10 @@ void generate_user_hardcoded(char* mbsfile)
// files initialization
fileoutH = (char*) malloc(sizeof(char)*(strlen(userpath)+50));
sprintf(fileoutH, "%suser_hardcoded.h", userpath);
sprintf(fileoutH, "%suser_hard_param.h", userpath);
gen = MDS_mbs_reader(mbsfile);
mbs_print_user_hardcoded(gen, fileoutH);
mbs_print_user_hard_param(gen, fileoutH);
free_MDS_gen_strct(gen);
free(fileoutH);
......@@ -229,7 +229,7 @@ int main(int argc, char *argv[])
{
generate_user_models(mbsFile);
generate_user_all_id(mbsFile);
generate_user_hardcoded(mbsFile);
generate_user_hard_param(mbsFile);
}
else if ( !strcmp(argv[2], "user_models") )
{
......@@ -239,14 +239,14 @@ int main(int argc, char *argv[])
{
generate_user_all_id(mbsFile);
}
else if ( !strcmp(argv[2], "user_hardcoded") )
else if ( !strcmp(argv[2], "user_hard_param") )
{
generate_user_hardcoded(mbsFile);
generate_user_hard_param(mbsFile);
}
else
{
printf("Error: %s is not a good argument !\n", argv[2]);
printf("Arguments accepted: 'all', 'user_models', 'user_all_id' and 'user_hardcoded' (without '')\n");
printf("Arguments accepted: 'all', 'user_models', 'user_all_id' and 'user_hard_param' (without '')\n");
}
}
return 0;
......
/*
* Functions used to generate 'user_models.c', 'user_models.h', 'user_all_id.h' and 'user_hardcoded.h'
* Functions used to generate 'user_models.c', 'user_models.h', 'user_all_id.h' and 'user_hard_param.h'
*
* author: Aubain VERLE, Nicolas Docquier, Nicolas Van der Noot
*
......@@ -408,12 +408,12 @@ int get_index_parent_joint(MDS_body_strct *body, MDS_bodytree_strct *bodytree)
return 0;
}
/*! \brief print the 'user_hardcoded.h' file
/*! \brief print the 'user_hard_param.h' file
*
* \param[in] gen MDS generated structure (from the .mbs file)
* \param[in] fileoutH file to create
*/
void mbs_print_user_hardcoded(MDS_gen_strct* gen, char *fileoutH)
void mbs_print_user_hard_param(MDS_gen_strct* gen, char *fileoutH)
{
int i, j, k;
int ind;
......@@ -441,13 +441,13 @@ void mbs_print_user_hardcoded(MDS_gen_strct* gen, char *fileoutH)
bodytree = gen->bodytree;
// -- user_hardcoded.h -- //
// -- user_hard_param.h -- //
// print the generic header
mbs_print_header(fidH);
fprintf(fidH,"#ifndef USER_HARDCODED_h\n");
fprintf(fidH,"#define USER_HARDCODED_h\n");
fprintf(fidH,"#ifndef USER_HARD_PARAM_h\n");
fprintf(fidH,"#define USER_HARD_PARAM_h\n");
fprintf(fidH,"\n");
fprintf(fidH,"// ============================================================ //\n\n");
fprintf(fidH,"\n");
......@@ -532,5 +532,5 @@ void mbs_print_user_hardcoded(MDS_gen_strct* gen, char *fileoutH)
fprintf(fidH,"// ============================================================ //\n\n");
fprintf(fidH,"# endif""\n");
fclose(fidH);
printf(">> 'user_hardcoded.h' created\n");
printf(">> 'user_hard_param.h' created\n");
}
......@@ -17,4 +17,4 @@ void mbs_print_user_models(MDS_gen_strct* gen, char *fileoutC, char *fileoutH);
void mbs_print_user_all_id(MDS_gen_strct* gen, char *fileoutH);
void mbs_print_user_hardcoded(MDS_gen_strct* gen, char *fileoutH);
void mbs_print_user_hard_param(MDS_gen_strct* gen, char *fileoutH);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment