SSModelGit / LinearMotorModeling

1 stars 1 forks source link

Create a car model that uses a translational connector #7

Closed xogeny closed 10 years ago

xogeny commented 10 years ago

Don't worry (yet) about converting all your models to use translational connectors. You can find definitions of translational connectors here. But you should probably use the definitions from the Modelica standard library (nearly the same).

For now, I would start simply with making a car model using the such a connector. Don't consider external forces (friction, drag, magnetism) in the model. Just the behavior of the car itself (i.e., inertia).

xogeny commented 10 years ago

Ah, I see you've already done this with the CarWC component models. But I have several comments on this. First, don't call it CarWC because that isn't very descriptive. Call it CarWithConnector or something like that. Also, you should include descriptive text (like you did with CarWf).

However, the CarWf model is exactly what we want to avoid. What you'll learn as we go here is that each component should focus on doing just one thing. Then, we can build subsystems and systems where we connect these components together. Not only is this much easier, the essential point is that we don't want to make component models of all the different combinations. So instead of "car with friction", just make "car" and "friction" as separate models.

Now, you'll notice that friction due to vehicle mass is complicated by the fact that the friction model needs to know the "normal force" of the vehicle on the track (and ideally the angle of the vehicle as well). But you can still separate these into two different models. For now, don't worry about the angle of the vehicle on the track (let's put that complexity off to the future). But you should include an "output" signal from the vehicle that reports the vehicle mass and an input connector on the friction model to receive that mass information. But the forces and position information should be exchanged strictly through the acausal connector.

Also, I see you added a translational connector called CarF. This is essentially the Modelica Standard Library (MSL) translational connector. So let's just use the MSL version.