7 #ifndef __tire_RigParticleMountSystem_h__ 8 #define __tire_RigParticleMountSystem_h__ 41 virtual void compile(
const t_note_id &a_note_id)
43 sp<Scope> spScope = m_rg_dataset->scope();
45 if(!spScope.isValid()) {
return; }
47 enforce<AsTire,AsTireLive>(m_rg_dataset);
49 m_asRig.bind(spScope);
50 m_asPoint.bind(spScope);
51 m_asTireLive.bind(spScope);
52 m_asMount.bind(spScope);
53 m_asSurface.bind(spScope);
57 RecordDictionary<AsRig> rd_rigs(m_rg_dataset);
58 RecordDictionary<AsTire> rd_tires(m_rg_dataset);
60 std::vector<Record> mounts;
61 m_asMount.filter(mounts, m_rg_dataset);
63 for(
unsigned int i_mount = 0; i_mount < mounts.size(); i_mount++)
65 Record &r_mount = mounts[i_mount];
67 mount.m_r_parent = r_mount;
68 mount.m_r_p0 = m_asMount.p0(r_mount);
69 mount.m_r_p1 = m_asMount.p1(r_mount);
70 mount.m_r_p2 = m_asMount.p2(r_mount);
71 mount.m_r_tire = rd_tires[m_asMount.tire(r_mount)];
72 mount.m_r_rig = rd_rigs[m_asMount.rig(r_mount)];
73 if( mount.m_r_p0.isValid() &&
74 mount.m_r_p1.isValid() &&
75 mount.m_r_p2.isValid() &&
76 mount.m_r_tire.isValid() &&
77 mount.m_r_rig.isValid() &&
78 m_asPoint.check(mount.m_r_p0) &&
79 m_asPoint.check(mount.m_r_p1) &&
80 m_asPoint.check(mount.m_r_p2) &&
81 m_asRig.check(mount.m_r_rig) &&
82 m_asTireLive.check(mount.m_r_tire))
85 if(m_asRig.floor(mount.m_r_rig).isValid())
87 if(m_asSurface.check(m_asRig.floor(mount.m_r_rig)))
89 mount.m_r_floor = m_asRig.floor(mount.m_r_rig);
95 setIdentity(relative);
97 bool frame_made = makeFrame(frame,
98 m_asPoint.location(mount.m_r_p0),
99 m_asPoint.location(mount.m_r_p1),
100 m_asPoint.location(mount.m_r_p2),
103 invert(mount.m_inv_R, frame);
105 translate(relative, m_asMount.location(r_mount));
106 rotate(relative, m_asMount.inclination(r_mount),
110 rotate(relative, m_asRig.pitch(mount.m_r_rig), e_yAxis);
112 mount.m_inv_R = relative * mount.m_inv_R;
114 m_mounts.push_back(mount);
121 for(
unsigned int i_mount = 0; i_mount < m_mounts.size(); i_mount++)
126 WeakRecord &r_tire = m_mounts[i_mount].m_r_tire;
127 WeakRecord &r_mount = m_mounts[i_mount].m_r_parent;
128 WeakRecord &r_rig = m_mounts[i_mount].m_r_rig;
132 setIdentity(relative);
133 bool frame_made = makeFrame(frame,
134 m_asPoint.location(r_p0),
135 m_asPoint.location(r_p1),
136 m_asPoint.location(r_p2),
137 m_mounts[i_mount].m_inv_R);
139 if(m_mounts[i_mount].m_r_floor.isValid())
141 t_moa_real alpha = m_asRig.alpha(r_rig)*pi/180.0;
143 m_asSurface.velocity(m_mounts[i_mount].m_r_floor)[0] =
144 m_asRig.velocity(r_rig);
145 m_asSurface.velocity(m_mounts[i_mount].m_r_floor)[1] = 0.0;
147 m_asTireLive.transform(r_tire) = frame;
149 if(determinant(m_asTireLive.transform(r_tire)) == 0.0)
153 setIdentity(incl_xform);
155 if(m_asRig.incline_floor(r_rig))
157 rotate(incl_xform, m_asRig.inclination(r_rig),
162 rotate(m_asTireLive.transform(r_tire),
163 m_asRig.inclination(r_rig), e_xAxis);
166 rotate(incl_xform, alpha, e_zAxis);
168 m_asSurface.transform(m_mounts[i_mount].m_r_floor)
171 invert(m_asMount.transform_inv(r_mount),
172 m_asTireLive.transform(r_tire));
174 m_asTireLive.velocity(r_tire) =
175 rotateVector<3, t_moa_real> (
176 m_asMount.transform_inv(r_mount),
177 m_asPoint.velocity(r_p0));
180 m_asRig.kappa(r_rig),0);
181 if(m_asRig.free_wheel(r_rig))
184 += (m_asRig.velocity(r_rig)*cos(alpha))
185 / m_asTireLive.radius(r_tire);
187 m_asTireLive.angular_velocity(r_tire) = angular_velocity;
193 t_moa_real alpha = m_asRig.alpha(r_rig)*pi/180.0;
195 rig_vel[0] = m_asRig.velocity(r_rig) * cos(alpha);
196 rig_vel[1] = m_asRig.velocity(r_rig) * sin(alpha);
199 m_asTireLive.transform(r_tire) = frame;
201 if(determinant(m_asTireLive.transform(r_tire)) == 0.0)
206 rotate(m_asTireLive.transform(r_tire),
207 m_asRig.inclination(r_rig), e_xAxis);
208 invert(m_asMount.transform_inv(r_mount),
209 m_asTireLive.transform(r_tire));
211 rig_vel = rotateVector<3, t_moa_real>(
212 m_asMount.transform_inv(r_mount),rig_vel);
215 rotateVector<3, t_moa_real> (
216 m_asMount.transform_inv(r_mount),
217 m_asPoint.velocity(r_p0));
219 t_moa_v3 vel = tire_space_p0_v + rig_vel;
221 m_asTireLive.velocity(r_tire) = vel;
224 m_asRig.kappa(r_rig),0);
225 if(m_asRig.free_wheel(r_rig))
228 += (m_asRig.velocity(r_rig)*cos(alpha))
229 / m_asTireLive.radius(r_tire);
231 m_asTireLive.angular_velocity(r_tire) = angular_velocity;
236 void accumulate(
void)
238 for(
unsigned int i_mount = 0; i_mount < m_mounts.size(); i_mount++)
243 WeakRecord &r_tire = m_mounts[i_mount].m_r_tire;
245 t_moa_xform tire_xform = m_asTireLive.transform(r_tire);
247 t_moa_v3 rig_space_F = rotateVector<3, t_moa_real>
248 (tire_xform, m_asTireLive.force(r_tire));
249 t_moa_v3 rig_space_M = rotateVector<3, t_moa_real>
250 (tire_xform, m_asTireLive.moment(r_tire));
252 t_moa_v3 rig_space_P = tire_xform.translation();
254 applyFMToPoints(rig_space_F, rig_space_M, rig_space_P,
255 m_asPoint, r_p0, r_p1, r_p2);
259 std::vector<Mount> m_mounts;
262 AsRigParticlesMount m_asMount;
264 AsSurface m_asSurface;
virtual void compile(const t_note_id &a_note_id)
Compile internal structure for dataset.
Definition: RigParticleMountSystem.h:41
Tire Test Rig Live.
Definition: tireAS.h:206
Tire.
Definition: tireAS.h:36
Tire to Rig Connection.
Definition: RigParticleMountSystem.h:18
void step(t_moa_real a_dt)
Move system forward in time by a timestep.
Definition: RigParticleMountSystem.h:119
kernel
Definition: namespace.dox:3
force application point
Definition: shapeAS.h:42
Matrix< 4, 4, T > & invert(Matrix< 4, 4, T > &a_inverted, const Matrix< 4, 4, T > &a_matrix)
4x4 full matrix inversion
Definition: Matrix.h:1033
Time Stepping System.
Definition: Stepper.h:15
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Run Time Single Contact Tire Model.
Definition: tireAS.h:49
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17