-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
properly use the new instance model constructors. This seems to point…
… out all sorts of oddities. Regularized some (SSP and SWHS) and left some in (GlassBR and GamePhysics). Unclear what is really going on, need to get @smiths to take a good look.
- Loading branch information
1 parent
560d776
commit f23bf7b
Showing
19 changed files
with
203 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Drasil.GamePhysics.IMods (iModels, iModels_new, im1_new, im2_new, im3_new) where | ||
module Drasil.GamePhysics.IMods (iModels_new, im1_new, im2_new, im3_new) where | ||
|
||
import Language.Drasil | ||
import Language.Drasil.Development (MayHaveUnit) | ||
|
@@ -16,30 +16,30 @@ import qualified Data.Drasil.Quantities.Physics as QP (acceleration, | |
import Data.Drasil.SentenceStructures (foldlSent, foldlSent_) | ||
import Data.Drasil.Utils (fmtU, foldle1) | ||
|
||
iModels :: [RelationConcept] | ||
iModels = [transMot, rotMot, col2D] | ||
|
||
iModels_new :: [InstanceModel] | ||
iModels_new = [im1_new, im2_new, im3_new] | ||
|
||
{-- Force on the translational motion --} | ||
im1_new :: InstanceModel | ||
im1_new = im' transMot [qw vel_i, qw QP.time, qw QP.gravitationalAccel, qw force_i, qw mass_i] | ||
im1_new = eqModel transMot | ||
[qw vel_i, qw QP.time, qw QP.gravitationalAccel, qw force_i, qw mass_i] | ||
[sy vel_i $> 0, sy QP.time $> 0, sy QP.gravitationalAccel $> 0, | ||
sy force_i $> 0, sy mass_i $> 0 ] (qw acc_i) [] [] "transMot" [transMotDesc] | ||
sy force_i $> 0, sy mass_i $> 0 ] (qw acc_i) [] [] [] "transMot" [transMotDesc] | ||
|
||
transMot :: RelationConcept | ||
transMot = makeRC "transMot" transMotNP (transMotDesc +:+ transMotLeg) transMotRel | ||
transMot :: QDefinition | ||
transMot = fromEqn' "transMot" transMotNP (transMotDesc +:+ transMotLeg) | ||
(eqSymb acc_i) transMotEqn | ||
|
||
transMotNP :: NP | ||
transMotNP = nounPhraseSP "Force on the translational motion of a set of 2d rigid bodies" | ||
|
||
transMotRel :: Relation -- FIXME: add proper equation | ||
transMotRel = (sy acc_i) $= (deriv (apply1 vel_i QP.time) QP.time) | ||
$= (sy QP.gravitationalAccel) + ((apply1 force_i QP.time) / (sy mass_i)) | ||
-- FIXME: the 'equation' used to be a sequence of equations | ||
transMotEqn :: Expr | ||
transMotEqn = (deriv (apply1 vel_i QP.time) QP.time) | ||
-- $= (sy QP.gravitationalAccel) + ((apply1 force_i QP.time) / (sy mass_i)) | ||
|
||
|
||
--fixme: need referencing | ||
-- FIXME: need referencing | ||
transMotDesc, transMotLeg :: Sentence | ||
transMotDesc = foldlSent [S "The above equation expresses the total", | ||
(phrase QP.acceleration), S "of the", (phrase CP.rigidBody), | ||
|
@@ -57,21 +57,23 @@ transMotLeg = foldle1 (+:+) (+:+) $ map defList transMotLegTerms | |
{-- Rotational Motion --} | ||
|
||
im2_new :: InstanceModel | ||
im2_new = im' rotMot [qw QP.angularVelocity, qw QP.time, qw torque_i, qw QP.momentOfInertia] | ||
[sy QP.angularVelocity $> 0, sy QP.time $> 0, sy torque_i $> 0, sy QP.momentOfInertia $> 0] | ||
(qw QP.angularAccel) [sy QP.angularAccel $> 0] [] "rotMot" | ||
im2_new = eqModel rotMot | ||
[qw QP.angularVelocity, qw QP.time, qw torque_i, qw QP.momentOfInertia] | ||
[sy QP.angularVelocity $> 0, sy QP.time $> 0, sy torque_i $> 0, sy QP.momentOfInertia $> 0] | ||
(qw QP.angularAccel) [sy QP.angularAccel $> 0] [] [] "rotMot" | ||
[rotMotDesc] | ||
|
||
rotMot :: RelationConcept | ||
rotMot = makeRC "rotMot" (rotMotNP) (rotMotDesc +:+ rotMotLeg) rotMotRel | ||
rotMot :: QDefinition | ||
rotMot = fromEqn' "rotMot" (rotMotNP) (rotMotDesc +:+ rotMotLeg) | ||
(eqSymb QP.angularAccel) rotMotEqn | ||
|
||
rotMotNP :: NP | ||
rotMotNP = nounPhraseSP "Force on the rotational motion of a set of 2D rigid body" | ||
|
||
rotMotRel :: Relation | ||
rotMotRel = (sy QP.angularAccel) $= deriv | ||
(apply1 QP.angularVelocity QP.time) QP.time $= | ||
((apply1 torque_i QP.time) / (sy QP.momentOfInertia)) | ||
-- FIXME: the 'equation' used to be a sequence of equations | ||
rotMotEqn :: Expr | ||
rotMotEqn = deriv (apply1 QP.angularVelocity QP.time) QP.time | ||
-- $= ((apply1 torque_i QP.time) / (sy QP.momentOfInertia)) | ||
|
||
--fixme: need referencing | ||
rotMotDesc, rotMotLeg :: Sentence | ||
|
@@ -87,10 +89,11 @@ rotMotLeg = foldle1 (+:+) (+:+) $ map defList rotMotLegTerms | |
|
||
{-- 2D Collision --} | ||
|
||
-- FIXME: othModel because it should be a Functional Model | ||
im3_new :: InstanceModel | ||
im3_new = im' col2D [qw QP.time, qw QP.impulseS, qw mass_A, qw normalVect] | ||
im3_new = othModel col2D [qw QP.time, qw QP.impulseS, qw mass_A, qw normalVect] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
JacquesCarette
Author
Owner
|
||
[sy QP.time $> 0, sy QP.impulseS $> 0, sy mass_A $> 0, sy normalVect $> 0] | ||
(qw time_c) [sy vel_A $> 0, sy time_c $> 0] [] "col2D" | ||
(qw time_c) [sy vel_A $> 0, sy time_c $> 0] [] [] "col2D" | ||
[col2DDesc] | ||
|
||
col2D :: RelationConcept | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1 comment
on commit f23bf7b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JacquesCarette, I'd be happy to look at the oddities that you mentioned. When you get a chance, maybe you could list some specific examples for us to focus on?
What was the reasoning behind making this an
OthModel
? Is it not anEquationalModel
? @JacquesCarette