Skip to content

Conversation

@kmruehl
Copy link
Collaborator

@kmruehl kmruehl commented Feb 18, 2022

Refactoring WEC-Sim Classes and Properties based on https://github.com/WEC-Sim/WEC-Sim/projects/58#card-64210391 and discussions with the WEC-Sim team.

Objectives:

  • clear and intuitive variable naming using camelCase
  • consistent properties across classes, e.g. pto.loc versus mooring.ref
  • convert properties for a single feature to property structures, e.g. struct(body.morison)
  • move properties to the appropriate class, e.g. simu.yaw to body.yaw
  • updating WEC-Sim library accordingly

Wave Class

  • waves.etaImport to waves.waveImport to waves.elevationImport
  • waves.spectrumDataFile to waves.waveSpectrumFile to waves.spectrumFile
  • waves.etaDataFile to waves.waveElevationFileto waves.elevationFile
  • waves.plotEta to waves.plotElevation
  • waves.waveDir to waves.waveDirection to waves.direction
  • waves.waveSpread to waves.spread
  • beta to theta to match online documentation
  • waves.deepWaterWave to waves.deepWater
  • convert waves.current properties to structure, similar to morison element,
    • waves.currentOption to waves.current.option
    • waves.currentDepth to waves.current.depth
    • waves.currentDirection to waves.current.direction
    • waves.currentSpeed to waves.current.speed
  • convert properties related to BEM data to waves.bem structure
    • waves.numFreq to waves.freqNum to waves.bem.count
    • waves.freqDisc to waves.bem.option
    • waves.freqRange to wave.bem.range
  • add checks for waveClass structures
  • convert waves.marker properties to structure
    • waves.markerLoc to waves.marker.loc to waves.marker.location
    • waves.markerSize to waves.marker.size
    • waves.markerStyle to waves.marker.style
    • convert waves.marker properties to structure in Frames Library

Simulation Class

  • simu.writetxt to simu.writeText
  • waves.waveStatisticsDataLoad to simu.mcrExcelFile (formerly Wave Class)
  • simu.mcrCaseFile to simu.mcrMatFile
  • simu.dtME to simu.morisonDt
  • simu.CTTime to simu.cicTime
  • simu.dtCI to simu.cicDt
  • simu.CITime to simu.cicEndTime
  • simu.CIkt to simu.cicLength
  • simu.ssCalc to simu.stateSpace
  • simu.setupSimu to simu.simuSetup to simu.setup
  • convert simu.paraview properties to structure, similar to morison element, note: test that sub-properties are tested
    • simu.dtParaview to simu.paraviewDt to simu.paraview.dt
    • simu.StartTimeParaview to simu.paraviewStartTime to simu.paraview.startTime
    • simu.EndTimeParaview to simu.paraviewEndTime to simu.paraview.endTime
    • simu.pathParaviewVideo to simu.paraviewDirectory to simu.paraview.path
  • simu.numWecBodies to simu.body.numHydroBodies
  • simu.pressureDis to simu.pressure
  • simu.simulationDate to simu.date
  • add checks for simulationClass structures
  • simu.adjMassWeightFun to simu.adjMassFactor
  • simu.autoRateTranBlk to simu.rateTransition
  • simu.zeroCrossCont to simu.zeroCross
  • simu.numIntMidTimeSteps removed

Body Class

  • body.dof_start to body.dofStart
  • body.dof_end to body.dofEnd
  • body.dof_gbm to body.dofGBM
  • body.nlHydro to body.nonlinearHydro
  • body.lenJ to body.dofCoupled
  • body.meanDriftForce to body.meanDrift
  • body.bodyparaview to body.paraviewBody to body.paraview
  • body.flexHydroBody to body.flexBody to body.flex
  • body.nhBody to body.nonHydroBody to body.nonHydro
  • body.hydroDataBodyNum to body.hydroBodyTotal to body.hydroTotal NOTE Do we even use this?
  • body.viscDrag to body.viscousDrag to body.quadDrag
  • body.userDefinedExcIRF to body.excitationIRF
  • add checks for bodyClass structures
  • move simu.yaw and simu.yawThresh to bodyClass
    • simu.yaw to body.yaw.option
    • simu.yawThres to body.yaw.threshold
  • body.bodyNumber to body.number
  • body.bodyTotal to body.total
  • body.bodyGeometry to body.geometry

Cable Class

  • cable.c to cable.damping
  • cable.k to cable.stiffness
  • cable.viscDrag to cable.viscousDrag to cable.quadDrag
  • cable.cableNum to cable.number
  • cable.loc to cable.location

Constraint Class

  • constraint.loc to constraint.location
  • constraint.constraintNum to constraint.number

PTO Class

  • pto.loc to pto.location
  • pto.c to pto.damping
  • pto.k to pto.stiffness
  • pto.ptoNum to pto.number

Mooring Class

  • mooring.ref to mooring.loc to mooring.location
  • mooring.loc to mooring.orientation (internal)
  • mooring.mooringNum to mooring.number

Doc

  • add dev documentation for style guide, look into naming convention, e.g. pep 8

Notes

  • Are the property structure fields checked? No, properties are automatically checked, but not the structure fields. For example there's an error if waves.bems is specified in the input file, but not for waves.bem.options. This can be addressed by adding some additional checks to the checkinputs method of each class with a structure.
  • how does b2b impact migration of passive yaw to bodyClass?
  • resolve TestPassiveYawRegression test failure
  • resolve runFromSimTest test issues, fails on first run but not second

@kmruehl
Copy link
Collaborator Author

kmruehl commented Feb 22, 2022

@akeeste The tests right now are passing because I did not update the run-from-simulink parameters. I'll be out for the working meeting, but if you'd like to work on this PR to update the new variables in the run-from-simulink cases that would be a huge help. On that note... is here a best workflow to find/replace variable names for run-from-simulink?

@kmruehl kmruehl changed the title Variable cleanup DRAFT: Variable cleanup Feb 23, 2022
@kmruehl kmruehl added SCM source code mangagement and warnings Wave Class Wave Classs (waveClass.m) labels Feb 24, 2022
@kmruehl kmruehl changed the title DRAFT: Refactoring classes and properties Refactoring classes and properties Mar 9, 2022
@kmruehl
Copy link
Collaborator Author

kmruehl commented Mar 9, 2022

@akeeste and @nathanmtom I'm sure I'll find bugs with this and need to make a few more commits but this PR is ready for a review. You may want to refer to WEC-Sim/WEC-Sim_Applications#17 to test the revisions. Please refer to my Notes with unresolved issues.

@kmruehl kmruehl added Cable Class Cable Class (cableClass.m) Constraint Class Constraint Class (constraintClass.m) Library updates to the WEC-Sim Library PTO Class Power Take-off Class (ptoClass.m) Response Class Response Class (responseClass.m) labels Mar 10, 2022
@kmruehl kmruehl requested a review from H0R5E March 10, 2022 19:08
@kmruehl
Copy link
Collaborator Author

kmruehl commented Mar 10, 2022

@akeeste @H0R5E @nathanmtom I'm going to go ahead and merge this PR and then re-open a new one for review.

Copy link
Contributor

@akeeste akeeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was changed in the three example .slx files?
Did we ever decide on renaming for momOfInertia?

Also noting that some of these may be updated in #822 already, but I only viewed the changes merged already

@kmruehl
Copy link
Collaborator Author

kmruehl commented Mar 14, 2022

All of these comments should be addressed in #822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Body Class Body Class (bodyClass.m) Cable Class Cable Class (cableClass.m) Constraint Class Constraint Class (constraintClass.m) Library updates to the WEC-Sim Library PTO Class Power Take-off Class (ptoClass.m) Response Class Response Class (responseClass.m) SCM source code mangagement and warnings Simulation Class Simulation Class (simulationClass.m) Wave Class Wave Classs (waveClass.m)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants