1# MBDyn (C) is a multibody analysis code.
2# http://www.mbdyn.org
3#
4# Copyright (C) 1996-2017
5#
6# Pierangelo Masarati	<masarati@aero.polimi.it>
7# Paolo Mantegazza	<mantegazza@aero.polimi.it>
8#
9# Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
10# via La Masa, 34 - 20156 Milano, Italy
11# http://www.aero.polimi.it
12#
13# Changing this copyright notice is forbidden.
14#
15# This program is free software; you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation (version 2 of the License).
18#
19#
20# $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/modules/module-asynchronous_machine/asynchronous_machine.mbdyn,v 1.8 2017/01/12 14:47:25 masarati Exp $
21#
22# This program is distributed in the hope that it will be useful,
23# but WITHOUT ANY WARRANTY; without even the implied warranty of
24# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25# GNU General Public License for more details.
26#
27# You should have received a copy of the GNU General Public License
28# along with this program; if not, write to the Free Software
29# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30#
31# Author: Reinhard Resch <r.resch@secop.com>
32set: integer node_id_rotor 				= 1001;
33set: integer node_id_stator				= 1002;
34set: integer node_id_motor_torque			= 1003;
35set: integer node_id_motor_omega_derivative	= 1005;
36
37set: integer body_id_rotor 		  		= 2001;
38set: integer body_id_stator 				= 2002;
39
40set: integer joint_id_revolute_rotation 		= 3001;
41set: integer joint_id_clamp 				= 3002;
42set: integer joint_id_bearing_friction			= 3003;
43set: integer elem_id_motor				= 4001;
44
45set: integer ref_id_stator 					= 5001;
46
47set: real rotor_momentum_of_inertia = 0.0001533;
48
49##########################################
50# Asynchronmotor
51##########################################
52
53# p ... Polpaarzahl
54set: real motor_p = 1.;
55
56# f ... Netzfrequenz
57set: real motor_f = 50.;
58
59# MA ... Anzugsmoment
60set: real motor_MA = 0.148214577;
61
62# MK ... Kippmoment
63set: real motor_MK = 0.457;
64
65# sense ... Drehrichtung
66set: real motor_sense = -1.;
67
68set: real motor_MK_MN = 2.5;
69
70# omegaS ... Synchrondrehzahl
71set: real motor_OmegaS = motor_sense * 2. * pi * motor_f / motor_p;
72
73# sK ... Kippschlupf
74set: real motor_sK = motor_MK / motor_MA - sqrt( ( motor_MK / motor_MA )^2 - 1. );
75
76set: real motor_MN = motor_MK / motor_MK_MN;
77
78set: real motor_sN = - ( sqrt(motor_MK^2 - motor_MN^2) - motor_MK ) / motor_MN * motor_sK;
79
80set: real motor_omegaN = motor_OmegaS * ( 1 - motor_sN );
81
82set: real motor_PN = motor_omegaN * motor_MN;
83
84set: real motor_MA_MN = motor_MA / motor_MN;
85
86set: real motor_viscos_friction_coeff = 0.0015;
87
88set: real omega0 = 0;
89
90set: real initial_time = 0;
91set: real final_time = 4;
92set: real motor_t0 = 0;
93set: real motor_t1 = 2;
94set: real time_step = 1e-3;
95
96set: real motor_torque_derivative0 = 0;
97set: real motor_torque0 = 0;
98
99begin: data;
100	problem: initial value; # the default
101end: data;
102
103begin: initial value;
104	initial time: initial_time;
105	final time: final_time;
106	time step: time_step;
107	min time step: time_step/1e3;
108	max time step: time_step;
109
110	strategy: factor, 0.5, 3, 2, 3, 15, 20;
111	max iterations: 1000;
112	derivatives max iterations: 300;
113	derivatives tolerance: 1e-6;
114	tolerance: 1e-6;
115	linear solver: naive,colamd,mt,1;
116	threads: assembly, 1;
117	nonlinear solver: newton raphson;
118	output: messages;
119        derivatives tolerance: 1e-6;
120        derivatives max iterations: 1000;
121        derivatives coefficient: 1e-6;
122	#~ output: residual;
123	#~ output: jacobian;
124
125
126end: initial value;
127
128begin: control data;
129
130	structural nodes: 2;
131	parameter nodes: 2;
132	rigid bodies: 2;
133	joints: 3;
134	forces: 0;
135	loadable elements: 1;
136	#~ skip initial joint assembly;
137	#~ print: dof stats;
138	#~ print: equation description;
139	#~ print: dof description;
140	#~ print: element connection;
141	print: node connection;
142	#~ make restart file;
143end: control data;
144
145#FIXME: cannot load user defined modules at runtime on cygwin!
146#module load: "libmodule-asynchronous_machine"; # uncomment when using run-time module
147
148reference: ref_id_stator,
149	reference, global, null,
150	#~ reference, global, euler123, 0.*pi/180.,0.*pi/180.,0*pi/180.,
151	reference, global, eye,
152	reference, global, null,
153	reference, global, null;
154
155begin: nodes;
156	structural: node_id_rotor, dynamic,
157		# position
158		reference, ref_id_stator, null,
159		# orientation
160		reference, ref_id_stator, eye,
161		# velocity
162		reference, ref_id_stator, null,
163		# angular velocity
164		reference, ref_id_stator, 0.,0.,omega0,
165		accelerations, yes;
166
167	structural: node_id_stator, dynamic,
168		# position
169		reference, ref_id_stator, null,
170		# orientation
171		reference, ref_id_stator, eye,
172		# velocity
173		reference, ref_id_stator, null,
174		# angular velocity
175		reference, ref_id_stator, null,
176		accelerations, yes;
177
178	parameter: node_id_motor_torque, element;
179
180	parameter: node_id_motor_omega_derivative, element;
181end: nodes;
182
183begin: elements;
184	body: body_id_rotor, node_id_rotor,
185		# mass
186		1.,
187		# center of mass
188		null,
189		# inertia matrix
190		diag,0.,0.,rotor_momentum_of_inertia;
191
192	body: body_id_stator, node_id_stator,
193		1,
194		null,
195		eye;
196
197	joint: joint_id_revolute_rotation, revolute hinge,
198		node_id_stator,
199			position, reference, node, null,
200			orientation, reference, node, eye,
201		node_id_rotor,
202			position, reference, node, null,
203			orientation, reference, node, eye;
204
205	joint: joint_id_clamp, clamp, node_id_stator,
206		position,node,
207		orientation,node;
208
209	driven: elem_id_motor, string, "( Time >= motor_t0 ) * ( Time < motor_t1 )",
210	user defined: elem_id_motor, asynchronous_machine,
211		rotor, node_id_rotor,
212		stator, node_id_stator,
213		MK, motor_MK,
214		sK, motor_sK,
215		OmegaS, const, motor_OmegaS,
216		M0, motor_torque0,
217		MP0, motor_torque_derivative0;
218
219	joint: joint_id_bearing_friction, deformable joint,
220		node_id_rotor, null,
221		node_id_stator, null,
222		linear viscous generic,
223			diag,0,0,0,0,0,motor_viscos_friction_coeff;
224
225	#~ drive caller: drive_id_torque, element, elem_id_motor, user defined, index, 1, direct;
226	#~ bind: elem_id_motor,user defined,node_id_motor_torque,index, 1;
227	bind: elem_id_motor, user defined, node_id_motor_torque, string,"M";
228
229	bind: elem_id_motor, user defined, node_id_motor_omega_derivative, string, "omegaP";
230	#~ bind: elem_id_motor, user defined, node_id_motor_omega_derivative, index, 5;
231end: elements;
232