Commit 1d970129 authored by Sebastien Timmermans's avatar Sebastien Timmermans 🎹

Merge branch 'MBsysPy_UserModel' into 'dev'

Unifying (and fix) user model for C, Python and Python using c

Closes #205

See merge request robotran/mbsysc!324
parents 924bee03 bb71da80
## Changes for next release
* To be defined
* **For user: Requires to generate again user files (and user file generation application)**
* [Python]
* **For user: update your MBsysPy project as previous indexing was starting at 0.**
* **function `MbsData.mbs_load_from_file` renamed to `MbsData.load_state`
* **function `MbsSensor.gensensor` renamed to `MbsSensor.gen_sensor`
* [Fix] some attributes of `MbsPart` were mislinked to C-memory.
* [Fix] `qv` attributes of `MbsData` was missing.
* [Fix] User model 'array-like' starts with index 1 (Similar to MBsysC)
* [Fix] Unsupported User Model (LUT, structures) does not prevent model loading.
* [Fix] User model vector and state correctly binded in pure Python and mixed-C.
* [New] attributes of `MbsSensor` are set to 0 before any computation
* [New] the c-memory allocated by `MbsSensor` are freed
* [New] function `MbsSensor.force_sensor` to compute force sensor
* [New] functions to set outputs (value, vector...) are available from `MbsData` class
* [New] functions to set outputs accept numpy derivated types (`numpy.float64`, `numpy.int32`)
* [New] Setting user models accept derivated types and do conversion:
* Scalar/Vector: accept `int, float, numpy.float64, numpy.int64`, warn then try to cast to `float` otherwise.
* State: accept list/numpy.array of `int, numpy.int64`, warn then try to cast to `int` otherwise.
* Integer:
* With Python user functions: integers user model are float (accept `int, float`...) as they are loaded as float in loadxml MBsysC function.
* [New] Changing user state ids is now forbidden.
* [Template] user_ExtForces documentation improved.
* [DEV] files updated to respect pep8 (except for E116, E126, E127, E402, E501, E722, E743, W503, W504)
* [DOC] files updated to respect numpydoc style (with spyder 4 linting)
* [DOC] files updated to respect numpydoc style (with spyder 4 lining)
* [useful functions] two added :
pick_and_place_dvec_1 : dest[index[i]] = src[i]; (also exist for vec_0)
slct_dvec_1 : dest[i] = src[index[i]]; (previously only exist for vec_0)
* `pick_and_place_dvec_1 : dest[index[i]] = src[i];` (also exist for vec_0)
* `slct_dvec_1 : dest[i] = src[index[i]];` (previously only exist for vec_0)
## Robotran v1.13.0
* [Python] A Python interface is available (MBsysPy)
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -46,18 +46,20 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->lin_struct.New_Parameter = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->lin_struct.New_Parameter = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
for(ind=0; ind<mbs_infos->user_models->user_model_list[1]->parameter_list[0]->n_value; ind++)
for(ind=1; ind<=mbs_infos->user_models->user_model_list[1]->parameter_list[0]->n_value; ind++)
{
um->lqr.K[ind+1] = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[ind];
um->lqr.K[ind] = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[ind];
}
um->lqr.process = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->lqr.process = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
}
void mbs_bind_user_model(MbsInfos* mbs_infos, UserModel* um)
{
mbs_infos->user_models->user_model_list[0]->parameter_list[0]->val_ptr = um->lin_struct.ss;
mbs_infos->user_models->user_model_list[0]->parameter_list[1]->val_ptr = um->lin_struct.lpk;
mbs_infos->user_models->user_model_list[0]->parameter_list[2]->val_ptr = &um->lin_struct.New_Parameter;
mbs_infos->user_models->user_model_list[1]->parameter_list[0]->val_ptr = um->lqr.K;
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Tue Jul 30 08:59:36 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -16,6 +16,8 @@
#define USERMODEL_h
#include "mbs_statespace_struct.h"
#include "mbs_linearipk_struct.h"
#include "mbs_user_interface.h"
// ============================================================ //
......@@ -24,6 +26,8 @@
struct UserModel
{
struct lin_struct{
MbsSS* ss; // pointer must be initialized and freed by the user
MbsLpk* lpk; // pointer must be initialized and freed by the user
double New_Parameter;
} lin_struct;
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -41,8 +41,8 @@ void mbs_delete_user_model(UserModel* um)
{
int ind_state_value = 1;
um->Bushing.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->Bushing.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->Bushing.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->Bushing.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -58,26 +58,26 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->Suspension.Z0 = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->Suspension.Z0 = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
for(ind=0; ind<mbs_infos->user_models->user_model_list[1]->parameter_list[0]->n_value; ind++)
for(ind=1; ind<=mbs_infos->user_models->user_model_list[1]->parameter_list[0]->n_value; ind++)
{
um->Pneumatic.states[ind+1] = ind_state_value;
um->Pneumatic.states[ind] = ind_state_value;
ind_state_value++;
}
um->Pneumatic.Vc0 = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->Pneumatic.Ae0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[0];
um->Pneumatic.Vr = mbs_infos->user_models->user_model_list[1]->parameter_list[3]->value_list[0];
um->Pneumatic.Lt = mbs_infos->user_models->user_model_list[1]->parameter_list[4]->value_list[0];
um->Pneumatic.dt = mbs_infos->user_models->user_model_list[1]->parameter_list[5]->value_list[0];
um->Pneumatic.gamma = mbs_infos->user_models->user_model_list[1]->parameter_list[6]->value_list[0];
um->Pneumatic.R = mbs_infos->user_models->user_model_list[1]->parameter_list[7]->value_list[0];
um->Pneumatic.p0 = mbs_infos->user_models->user_model_list[1]->parameter_list[8]->value_list[0];
um->Pneumatic.pa = mbs_infos->user_models->user_model_list[1]->parameter_list[9]->value_list[0];
um->Pneumatic.Ta = mbs_infos->user_models->user_model_list[1]->parameter_list[10]->value_list[0];
um->Pneumatic.lambda = mbs_infos->user_models->user_model_list[1]->parameter_list[11]->value_list[0];
um->Pneumatic.xsi = mbs_infos->user_models->user_model_list[1]->parameter_list[12]->value_list[0];
um->Pneumatic.dAedz = mbs_infos->user_models->user_model_list[1]->parameter_list[13]->value_list[0];
um->Pneumatic.Vc0 = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
um->Pneumatic.Ae0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[1];
um->Pneumatic.Vr = mbs_infos->user_models->user_model_list[1]->parameter_list[3]->value_list[1];
um->Pneumatic.Lt = mbs_infos->user_models->user_model_list[1]->parameter_list[4]->value_list[1];
um->Pneumatic.dt = mbs_infos->user_models->user_model_list[1]->parameter_list[5]->value_list[1];
um->Pneumatic.gamma = mbs_infos->user_models->user_model_list[1]->parameter_list[6]->value_list[1];
um->Pneumatic.R = mbs_infos->user_models->user_model_list[1]->parameter_list[7]->value_list[1];
um->Pneumatic.p0 = mbs_infos->user_models->user_model_list[1]->parameter_list[8]->value_list[1];
um->Pneumatic.pa = mbs_infos->user_models->user_model_list[1]->parameter_list[9]->value_list[1];
um->Pneumatic.Ta = mbs_infos->user_models->user_model_list[1]->parameter_list[10]->value_list[1];
um->Pneumatic.lambda = mbs_infos->user_models->user_model_list[1]->parameter_list[11]->value_list[1];
um->Pneumatic.xsi = mbs_infos->user_models->user_model_list[1]->parameter_list[12]->value_list[1];
um->Pneumatic.dAedz = mbs_infos->user_models->user_model_list[1]->parameter_list[13]->value_list[1];
}
......
......@@ -56,22 +56,22 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[0];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[0];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[0];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[0];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[0];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[0];
for(ind=0; ind<mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[1];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[1];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[1];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[1];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[1];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[1];
for(ind=1; ind<=mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
{
um->Motor.i[ind+1] = ind_state_value;
um->Motor.i[ind] = ind_state_value;
ind_state_value++;
}
......
......@@ -56,22 +56,22 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[0];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[0];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[0];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[0];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[0];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[0];
for(ind=0; ind<mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[1];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[1];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[1];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[1];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[1];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[1];
for(ind=1; ind<=mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
{
um->Motor.i[ind+1] = ind_state_value;
um->Motor.i[ind] = ind_state_value;
ind_state_value++;
}
......
......@@ -56,22 +56,22 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[0];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[0];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[0];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[0];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[0];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[0];
for(ind=0; ind<mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[1];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[1];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[1];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[1];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[1];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[1];
for(ind=1; ind<=mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
{
um->Motor.i[ind+1] = ind_state_value;
um->Motor.i[ind] = ind_state_value;
ind_state_value++;
}
......
......@@ -45,7 +45,7 @@ int main(int argc, char const *argv[])
char *respath;
char *animpath;
MbsLoadOptions *opts;
MbsLoader *loader = mbs_new_loader();
opts = loader->opts;
......@@ -101,16 +101,16 @@ int main(int argc, char const *argv[])
mbs_equil->options->respath = strdup(respath);
mbs_equil->options->animpath = strdup(animpath);
mbs_run_equil(mbs_equil, mbs_data);
free(mbs_equil->options->respath);
free(mbs_equil->options->animpath);
free((void*)mbs_equil->options->respath);
free((void*)mbs_equil->options->animpath);
mbs_delete_equil(mbs_equil, mbs_data);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* MODAL ANALYSIS *
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
mbs_data->process = 3;
mbs_modal = mbs_new_modal(mbs_data);
// modal options (see documentations for additional options)
......@@ -121,9 +121,9 @@ int main(int argc, char const *argv[])
mbs_modal->options->respath = strdup(respath);
mbs_modal->options->animpath = strdup(animpath);
mbs_run_modal(mbs_modal, mbs_data);
free(mbs_modal->options->respath);
free(mbs_modal->options->animpath);
mbs_delete_modal(mbs_modal, mbs_data);
free((void*)mbs_modal->options->respath);
free((void*)mbs_modal->options->animpath);
mbs_delete_modal(mbs_modal, mbs_data);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
......@@ -144,8 +144,8 @@ int main(int argc, char const *argv[])
mbs_dirdyn->options->respath = strdup(respath);
mbs_dirdyn->options->animpath = strdup(animpath);
mbs_run_dirdyn(mbs_dirdyn, mbs_data);
free(mbs_dirdyn->options->respath);
free(mbs_dirdyn->options->animpath);
free((void*)mbs_dirdyn->options->respath);
free((void*)mbs_dirdyn->options->animpath);
mbs_delete_dirdyn(mbs_dirdyn, mbs_data);
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -56,22 +56,22 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[0];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[0];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[0];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[0];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[0];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[0];
for(ind=0; ind<mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
um->Spring.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->Spring.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->Spring.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
um->mylink.K = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[1];
um->Motor.Un = mbs_infos->user_models->user_model_list[2]->parameter_list[0]->value_list[1];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[2]->parameter_list[1]->value_list[1];
um->Motor.kphi = mbs_infos->user_models->user_model_list[2]->parameter_list[2]->value_list[1];
um->Motor.L = mbs_infos->user_models->user_model_list[2]->parameter_list[3]->value_list[1];
um->Motor.rho = mbs_infos->user_models->user_model_list[2]->parameter_list[4]->value_list[1];
for(ind=1; ind<=mbs_infos->user_models->user_model_list[2]->parameter_list[5]->n_value; ind++)
{
um->Motor.i[ind+1] = ind_state_value;
um->Motor.i[ind] = ind_state_value;
ind_state_value++;
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:47 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -42,9 +42,9 @@ void mbs_delete_user_model(UserModel* um)
{
int ind_state_value = 1;
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -52,18 +52,18 @@ void mbs_delete_user_model(UserModel* um)
int ind;
int ind_state_value = 1;
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
um->Motor.rho = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[0];
um->Motor.U = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[0];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[0];
um->Motor.Kphi = mbs_infos->user_models->user_model_list[1]->parameter_list[3]->value_list[0];
um->Motor.L = mbs_infos->user_models->user_model_list[1]->parameter_list[4]->value_list[0];
for(ind=0; ind<mbs_infos->user_models->user_model_list[1]->parameter_list[5]->n_value; ind++)
um->Motor.rho = mbs_infos->user_models->user_model_list[1]->parameter_list[0]->value_list[1];
um->Motor.U = mbs_infos->user_models->user_model_list[1]->parameter_list[1]->value_list[1];
um->Motor.Rmot = mbs_infos->user_models->user_model_list[1]->parameter_list[2]->value_list[1];
um->Motor.Kphi = mbs_infos->user_models->user_model_list[1]->parameter_list[3]->value_list[1];
um->Motor.L = mbs_infos->user_models->user_model_list[1]->parameter_list[4]->value_list[1];
for(ind=1; ind<=mbs_infos->user_models->user_model_list[1]->parameter_list[5]->n_value; ind++)
{
um->Motor.i[ind+1] = ind_state_value;
um->Motor.i[ind] = ind_state_value;
ind_state_value++;
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -42,9 +42,9 @@ void mbs_delete_user_model(UserModel* um)
{
int ind_state_value = 1;
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->mylink.Z0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:46 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -44,6 +44,8 @@ void mbs_delete_user_model(UserModel* um)
void mbs_bind_user_model(MbsInfos* mbs_infos, UserModel* um)
{
mbs_infos->user_models->user_model_list[0]->parameter_list[0]->val_ptr = um->lin_struct.ss;
mbs_infos->user_models->user_model_list[0]->parameter_list[1]->val_ptr = um->lin_struct.lpk;
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Tue Jul 30 08:59:36 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -16,6 +16,8 @@
#define USERMODEL_h
#include "mbs_statespace_struct.h"
#include "mbs_linearipk_struct.h"
#include "mbs_user_interface.h"
// ============================================================ //
......@@ -24,6 +26,8 @@
struct UserModel
{
struct lin_struct{
MbsSS* ss; // pointer must be initialized and freed by the user
MbsLpk* lpk; // pointer must be initialized and freed by the user
} lin_struct;
};
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:47 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -42,9 +42,9 @@ void mbs_delete_user_model(UserModel* um)
{
int ind_state_value = 1;
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:47 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -42,9 +42,9 @@ void mbs_delete_user_model(UserModel* um)
{
int ind_state_value = 1;
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];
}
......
......@@ -8,7 +8,7 @@
*
* Universite catholique de Louvain, Belgium
*
* Last update : Wed Aug 28 17:50:47 2019
* Last update : Fri Apr 10 16:29:39 2020
* --------------------------------------------------------
*
*/
......@@ -42,9 +42,9 @@ void mbs_delete_user_model(UserModel* um)
{
int ind_state_value = 1;
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[0];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[0];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[0];
um->mylink.K = mbs_infos->user_models->user_model_list[0]->parameter_list[0]->value_list[1];
um->mylink.C = mbs_infos->user_models->user_model_list[0]->parameter_list[1]->value_list[1];
um->mylink.L0 = mbs_infos->user_models->user_model_list[0]->parameter_list[2]->value_list[1];