MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Control_valve2 Class Reference

#include <valve.h>

Inheritance diagram for Control_valve2:
Collaboration diagram for Control_valve2:

Public Member Functions

 Control_valve2 (unsigned int uL, const DofOwner *pD, HydraulicFluid *hf, const PressureNode *p1, const PressureNode *p2, const PressureNode *p3, const PressureNode *p4, doublereal A_max, doublereal Loss_a, const DriveCaller *pDC, flag fOut)
 
 ~Control_valve2 (void)
 
virtual HydraulicElem::Type GetHydraulicType (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual unsigned int iGetNumDof (void) const
 
virtual DofOrder::Order GetDofType (unsigned int i) const
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Output (OutputHandler &OH) const
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from HydraulicElem
 HydraulicElem (unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
 
virtual ~HydraulicElem (void)
 
virtual Elem::Type GetElemType (void) const
 
- Public Member Functions inherited from ElemWithDofs
 ElemWithDofs (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~ElemWithDofs (void)
 
- Public Member Functions inherited from DofOwnerOwner
 DofOwnerOwner (const DofOwner *pDO)
 
virtual ~DofOwnerOwner ()
 
virtual const DofOwnerpGetDofOwner (void) const
 
virtual integer iGetFirstIndex (void) const
 
virtual void SetInitialValue (VectorHandler &X)
 
- Public Member Functions inherited from DriveOwner
 DriveOwner (const DriveCaller *pDC=0)
 
 DriveOwner (const DriveOwner &drive)
 
virtual ~DriveOwner (void)
 
void Set (const DriveCaller *pDC)
 
DriveCallerpGetDriveCaller (void) const
 
doublereal dGet (const doublereal &dVar) const
 
doublereal dGet (void) const
 
bool bIsDifferentiable (void) const
 
doublereal dGetP (const doublereal &dVar) const
 
doublereal dGetP (void) const
 

Private Types

enum  {
  N1 = 0, N2 = 1, N3 = 2, N4 = 3,
  LAST_N = 4
}
 
enum  {
  Q12 = 0, Q34 = 1, Q13 = 2, Q24 = 3,
  Q14 = 4, Q23 = 5, LAST_Q = 6
}
 

Private Member Functions

void Prepare (void)
 

Private Attributes

const PressureNodepNode [LAST_N]
 
doublereal q [LAST_Q]
 
doublereal dp [LAST_Q]
 
doublereal density
 
doublereal Stato
 
doublereal Cd
 
doublereal area_max
 
doublereal loss_area
 
doublereal area_min
 
doublereal s_max
 
doublereal f [LAST_N]
 
doublereal A [LAST_Q]
 

Additional Inherited Members

- Public Types inherited from Elem
enum  Type {
  UNKNOWN = -1, AIRPROPERTIES = 0, INDUCEDVELOCITY, AUTOMATICSTRUCTURAL,
  GRAVITY, BODY, JOINT, JOINT_REGULARIZATION,
  BEAM, PLATE, FORCE, INERTIA,
  ELECTRICBULK, ELECTRIC, THERMAL, HYDRAULIC,
  BULK, LOADABLE, DRIVEN, EXTERNAL,
  AEROMODAL, AERODYNAMIC, GENEL, SOCKETSTREAM_OUTPUT,
  RTAI_OUTPUT = SOCKETSTREAM_OUTPUT, LASTELEMTYPE
}
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from HydraulicElem
enum  Type {
  UNKNOWN = -1, MINOR_LOSS = 0, THREEWAYMINORLOSS, CONTROL_VALVE,
  DYNAMIC_CONTROL_VALVE, PRESSURE_FLOW_CONTROL_VALVE, PRESSURE_VALVE, FLOW_VALVE,
  ORIFICE, ACCUMULATOR, TANK, PIPE,
  DYNAMIC_PIPE, HYDRAULIC_ACTUATOR, ACTUATOR, LASTHYDRAULICTYPE
}
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from HydraulicElem
HydraulicFluidHF
 
- Protected Attributes inherited from DriveOwner
DriveCallerpDriveCaller
 

Detailed Description

Definition at line 120 of file valve.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
N1 
N2 
N3 
N4 
LAST_N 

Definition at line 136 of file valve.h.

136  {
137  N1 = 0,
138  N2 = 1,
139  N3 = 2,
140  N4 = 3,
141  LAST_N = 4
142  };
anonymous enum
private
Enumerator
Q12 
Q34 
Q13 
Q24 
Q14 
Q23 
LAST_Q 

Definition at line 143 of file valve.h.

143  {
144  Q12 = 0,
145  Q34 = 1,
146  Q13 = 2,
147  Q24 = 3,
148 #ifdef VALVE_6
149  Q14 = 4,
150  Q23 = 5,
151  LAST_Q = 6
152 #else /* !VALVE_6 */
153  LAST_Q = 4
154 #endif /* !VALVE_6 */
155  };

Constructor & Destructor Documentation

Control_valve2::Control_valve2 ( unsigned int  uL,
const DofOwner pD,
HydraulicFluid hf,
const PressureNode p1,
const PressureNode p2,
const PressureNode p3,
const PressureNode p4,
doublereal  A_max,
doublereal  Loss_a,
const DriveCaller pDC,
flag  fOut 
)

Definition at line 330 of file valve.cc.

References area_max, ASSERT, Cd, Node::HYDRAULIC, loss_area, N1, N2, N3, N4, and pNode.

337 : Elem(uL, fOut),
338 HydraulicElem(uL, pDO, hf, fOut),
339 DriveOwner(pDC),
340 area_max(A_max), loss_area(Loss_A), area_min(area_max*loss_area)
341 {
342  pNode[N1] = p1;
343  pNode[N2] = p2;
344  pNode[N3] = p3;
345  pNode[N4] = p4;
346 
347  ASSERT(pNode[N1] != NULL);
348  ASSERT(pNode[N1]->GetNodeType() == Node::HYDRAULIC);
349  ASSERT(pNode[N2] != NULL);
350  ASSERT(pNode[N2]->GetNodeType() == Node::HYDRAULIC);
351  ASSERT(pNode[N3] != NULL);
352  ASSERT(pNode[N3]->GetNodeType() == Node::HYDRAULIC);
353  ASSERT(pNode[N4] != NULL);
354  ASSERT(pNode[N4]->GetNodeType() == Node::HYDRAULIC);
355 
356  ASSERT(area_max > std::numeric_limits<doublereal>::epsilon());
357  ASSERT(loss_area > 1.e-9); /*
358  * se = 0. occorre fare un elemento
359  * apposta con solo 2 dof
360  */
361 
362  Cd = .611; /* coefficiente di perdita */
363 }
doublereal area_max
Definition: valve.h:164
doublereal Cd
Definition: valve.h:163
const PressureNode * pNode[LAST_N]
Definition: valve.h:157
doublereal area_min
Definition: valve.h:166
HydraulicElem(unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
Definition: preselem.cc:54
doublereal loss_area
Definition: valve.h:165
#define ASSERT(expression)
Definition: colamd.c:977
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
DriveOwner(const DriveCaller *pDC=0)
Definition: drive.cc:627
Control_valve2::~Control_valve2 ( void  )

Definition at line 365 of file valve.cc.

References NO_OP.

366 {
367  NO_OP;
368 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

VariableSubMatrixHandler & Control_valve2::AssJac ( VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 404 of file valve.cc.

References A, a, Cd, DEBUGCOUT, density, grad::fabs(), DofOwnerOwner::iGetFirstIndex(), LAST_N, LAST_Q, pNode, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), q, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and WorkSpaceDim().

408 {
409  DEBUGCOUT("Entering Control_valve2::AssJac()" << std::endl);
410 
411  FullSubMatrixHandler& WM = WorkMat.SetFull();
412  integer iNumRows, iNumCols;
413  WorkSpaceDim(&iNumRows, &iNumCols);
414  WM.ResizeReset(iNumRows, iNumCols);
415 
416  integer iFirstIndex = iGetFirstIndex();
417 
418  for (int i = 0; i < LAST_N; i++) {
419  WM.PutRowIndex(1+i, pNode[i]->iGetFirstRowIndex()+1);
420  WM.PutColIndex(1+i, pNode[i]->iGetFirstColIndex()+1);
421  }
422 
423  for (int i = 1; i <= LAST_Q; i++) {
424  WM.PutRowIndex(4+i, iFirstIndex+i);
425  WM.PutColIndex(4+i, iFirstIndex+i);
426  }
427 
428  doublereal dKappa = 2.*Cd*Cd*density;
429 
430  /* Q12 */
431  WM.PutCoef(1, 5, -1.);
432  WM.PutCoef(2, 5, 1.);
433 
434  doublereal a = A[0]*A[0];
435  WM.PutCoef(5, 1, -a);
436  WM.PutCoef(5, 2, a);
437 
438  /* Q34 */
439  WM.PutCoef(3, 6, -1.);
440  WM.PutCoef(4, 6, 1.);
441 
442  a = A[1]*A[1];
443  WM.PutCoef(6, 3, -a);
444  WM.PutCoef(6, 4, a);
445 
446  /* Q13 */
447  WM.PutCoef(1, 7, -1.);
448  WM.PutCoef(3, 7, 1.);
449 
450  a = A[2]*A[2];
451  WM.PutCoef(7, 1, -a);
452  WM.PutCoef(7, 3, a);
453 
454  /* Q24 */
455  WM.PutCoef(2, 8, -1.);
456  WM.PutCoef(4, 8, 1.);
457 
458  a = A[3]*A[3];
459  WM.PutCoef(8, 2, -a);
460  WM.PutCoef(8, 4, a);
461 
462 #ifdef VALVE_6
463  /* Q14 */
464  WM.PutCoef(1, 9, -1.);
465  WM.PutCoef(4, 9, 1.);
466 
467  a = A[4]*A[4];
468  WM.PutCoef(9, 1, -a);
469  WM.PutCoef(9, 4, a);
470 
471  /* Q23 */
472  WM.PutCoef(2, 10, -1.);
473  WM.PutCoef(3, 10, 1.);
474 
475  a = A[5]*A[5];
476  WM.PutCoef(10, 2, -a);
477  WM.PutCoef(10, 3, a);
478 #endif /* VALVE_6 */
479 
480  for (int i = 0; i < LAST_Q; i++) {
481  WM.PutCoef(5+i, 5+i, 2.*fabs(q[i])/dKappa);
482  }
483 
484  return WorkMat;
485 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
doublereal density
Definition: valve.h:160
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
doublereal Cd
Definition: valve.h:163
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
const PressureNode * pNode[LAST_N]
Definition: valve.h:157
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
doublereal A[LAST_Q]
Definition: valve.h:169
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: valve.cc:397
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
doublereal q[LAST_Q]
Definition: valve.h:158
static const doublereal a
Definition: hfluid_.h:289
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

SubVectorHandler & Control_valve2::AssRes ( SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 542 of file valve.cc.

References A, Cd, DEBUGCOUT, density, dp, f, grad::fabs(), DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), LAST_N, LAST_Q, N1, N2, N3, N4, pNode, Prepare(), SubVectorHandler::PutItem(), q, Q12, Q13, Q14, Q23, Q24, Q34, VectorHandler::Resize(), and WorkSpaceDim().

546 {
547  DEBUGCOUT("Entering Control_valve2::AssRes()" << std::endl);
548 
549  integer iNumRows, iNumCols;
550  WorkSpaceDim(&iNumRows, &iNumCols);
551  WorkVec.Resize(iNumRows);
552 
553  integer iFirstIndex = iGetFirstIndex()+1;
554 
555  integer iNodeRowIndex[LAST_N];
556  for (int i = 0; i < LAST_N; i++) {
557  iNodeRowIndex[i] = pNode[i]->iGetFirstRowIndex()+1;
558  }
559 
560  Prepare();
561  doublereal dKappa = 2.*Cd*Cd*density;
562 
563  for (int i = 0; i < LAST_Q; i++) {
564  q[i] = XCurr(iFirstIndex+i);
565  }
566 
567 #ifdef VALVE_6
568  f[N1] = q[Q12]+q[Q13]+q[Q14];
569  f[N2] = -q[Q12]+q[Q23]+q[Q24];
570  f[N3] = -q[Q13]-q[Q23]+q[Q34];
571  f[N4] = -q[Q14]-q[Q24]-q[Q34];
572 #else /* !VALVE_6 */
573  f[N1] = q[Q12]+q[Q13];
574  f[N2] = -q[Q12]+q[Q24];
575  f[N3] = -q[Q13]+q[Q34];
576  f[N4] = -q[Q24]-q[Q34];
577 #endif /* !VALVE_6 */
578 
579  for (int i = 0; i < LAST_N; i++) {
580  WorkVec.PutItem(1+i, iNodeRowIndex[i], f[i]);
581  }
582 
583  for (int i = 0; i < LAST_Q; i++) {
584  WorkVec.PutItem(5+i, iFirstIndex+i,
585  A[i]*A[i]*dp[i]-q[i]*fabs(q[i])/dKappa);
586  }
587 
588  return WorkVec;
589 }
doublereal density
Definition: valve.h:160
doublereal Cd
Definition: valve.h:163
doublereal f[LAST_N]
Definition: valve.h:168
const PressureNode * pNode[LAST_N]
Definition: valve.h:157
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
virtual void PutItem(integer iSubRow, integer iRow, const doublereal &dCoef)
Definition: submat.h:1445
void Prepare(void)
Definition: valve.cc:488
doublereal A[LAST_Q]
Definition: valve.h:169
doublereal dp[LAST_Q]
Definition: valve.h:159
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: valve.cc:397
virtual integer iGetFirstRowIndex(void) const
Definition: node.cc:82
doublereal q[LAST_Q]
Definition: valve.h:158
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual void Resize(integer iNewSize)=0

Here is the call graph for this function:

virtual void Control_valve2::GetConnectedNodes ( std::vector< const Node * > &  connectedNodes) const
inlinevirtual

Reimplemented from Elem.

Definition at line 211 of file valve.h.

References N1, N2, N3, N4, and pNode.

211  {
212  connectedNodes.resize(4);
213  connectedNodes[0] = pNode[N1];
214  connectedNodes[1] = pNode[N2];
215  connectedNodes[2] = pNode[N3];
216  connectedNodes[3] = pNode[N4];
217  };
const PressureNode * pNode[LAST_N]
Definition: valve.h:157
DofOrder::Order Control_valve2::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 390 of file valve.cc.

References DofOrder::ALGEBRAIC, ASSERT, and iGetNumDof().

391 {
392  ASSERT(i >= 0 && i < iGetNumDof());
393  return DofOrder::ALGEBRAIC;
394 }
virtual unsigned int iGetNumDof(void) const
Definition: valve.cc:385
#define ASSERT(expression)
Definition: colamd.c:977

Here is the call graph for this function:

HydraulicElem::Type Control_valve2::GetHydraulicType ( void  ) const
virtual

Implements HydraulicElem.

Definition at line 372 of file valve.cc.

References HydraulicElem::CONTROL_VALVE.

unsigned int Control_valve2::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 385 of file valve.cc.

References LAST_Q.

Referenced by GetDofType().

386 {
387  return LAST_Q;
388 }
void Control_valve2::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 592 of file valve.cc.

References ToBeOutput::bToBeOutput(), f, WithLabel::GetLabel(), OutputHandler::Hydraulic(), N1, N2, N3, N4, and Stato.

593 {
594  if (bToBeOutput()) {
595  std::ostream& out = OH.Hydraulic();
596  out << std::setw(8) << GetLabel()
597  << " " << Stato
598  << " " << -f[N1] << " " << -f[N2]
599  << " " << -f[N3] << " " << -f[N4] << std::endl;
600  }
601 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
doublereal f[LAST_N]
Definition: valve.h:168
doublereal Stato
Definition: valve.h:162
std::ostream & Hydraulic(void) const
Definition: output.h:492
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

void Control_valve2::Prepare ( void  )
private

Definition at line 488 of file valve.cc.

References A, area_max, area_min, density, DriveCaller::dGet(), HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), dp, HydraulicElem::HF, LAST_N, N1, N2, N3, N4, DriveOwner::pGetDriveCaller(), pNode, Q12, Q13, Q14, Q23, Q24, Q34, and Stato.

Referenced by AssRes(), and SetValue().

489 {
490  doublereal p[LAST_N];
491  doublereal pm = 0.;
492 
493  for (int i = 0; i < LAST_N; i++) {
494  p[i] = pNode[i]->dGetX();
495  pm += p[i];
496  }
497  pm /= 4.;
498 
499  density = HF->dGetDensity(pm);
500 
501  dp[Q12] = p[N1]-p[N2];
502  dp[Q34] = p[N3]-p[N4];
503  dp[Q13] = p[N1]-p[N3];
504  dp[Q24] = p[N2]-p[N4];
505 #ifdef VALVE_6
506  dp[Q14] = p[N1]-p[N4];
507  dp[Q23] = p[N2]-p[N3];
508 #endif /* VALVE_6 */
509 
510  Stato = pGetDriveCaller()->dGet();
511  if (Stato > 0.) {
512  if (Stato > 1.) {
513  Stato = 1.;
514  }
515 
516  A[Q12] = Stato*area_max+2.*area_min;
517  A[Q34] = Stato*area_max+2.*area_min;
518  A[Q13] = area_min;
519  A[Q24] = area_min;
520  } else {
521  if (Stato < -1.) {
522  Stato = -1.;
523  }
524 
525  A[Q12] = 2.*area_min;
526  A[Q34] = 2.*area_min;
529  }
530 
531  /*
532  * vale sempre area_min (lo genero ogni volta perche' magari
533  * la si puo' far dipendere da qualche parametro
534  */
535 #ifdef VALVE_6
536  A[Q14] = area_min;
537  A[Q23] = area_min;
538 #endif /* VALVE_6 */
539 }
doublereal area_max
Definition: valve.h:164
doublereal density
Definition: valve.h:160
const PressureNode * pNode[LAST_N]
Definition: valve.h:157
doublereal area_min
Definition: valve.h:166
doublereal Stato
Definition: valve.h:162
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
doublereal A[LAST_Q]
Definition: valve.h:169
HydraulicFluid * HF
Definition: preselem.h:79
doublereal dp[LAST_Q]
Definition: valve.h:159
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual doublereal dGet(const doublereal &dVar) const =0
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

std::ostream & Control_valve2::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 379 of file valve.cc.

380 {
381  return out << "Control_valve2 not implemented yet!" << std::endl;
382 }
void Control_valve2::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 604 of file valve.cc.

References A, Cd, copysign(), density, dp, grad::fabs(), DofOwnerOwner::iGetFirstIndex(), LAST_Q, Prepare(), VectorHandler::PutCoef(), and grad::sqrt().

607 {
608  integer iFirstIndex = iGetFirstIndex()+1;
609 
610  const_cast<Control_valve2 *>(this)->Prepare();
611 
612  for (int i = 0; i < LAST_Q; i++) {
613 
614  /*
615  * q = sign(Dp)*Cd*A*sqrt(2.*rho*abs(Dp))
616  */
617 
618  X.PutCoef(iFirstIndex+i,
619  Cd*A[i]*copysign(sqrt(2.*density*fabs(dp[i])), dp[i]));
620  }
621 }
doublereal density
Definition: valve.h:160
doublereal Cd
Definition: valve.h:163
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
void Prepare(void)
Definition: valve.cc:488
doublereal A[LAST_Q]
Definition: valve.h:169
doublereal dp[LAST_Q]
Definition: valve.h:159
doublereal copysign(doublereal x, doublereal y)
Definition: gradient.h:97
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void Control_valve2::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 397 of file valve.cc.

References LAST_Q.

Referenced by AssJac(), and AssRes().

398 {
399  *piNumRows = 4+LAST_Q;
400  *piNumCols = 4+LAST_Q;
401 }

Member Data Documentation

doublereal Control_valve2::A[LAST_Q]
private

Definition at line 169 of file valve.h.

Referenced by AssJac(), AssRes(), Prepare(), and SetValue().

doublereal Control_valve2::area_max
private

Definition at line 164 of file valve.h.

Referenced by Control_valve2(), and Prepare().

doublereal Control_valve2::area_min
private

Definition at line 166 of file valve.h.

Referenced by Prepare().

doublereal Control_valve2::Cd
private

Definition at line 163 of file valve.h.

Referenced by AssJac(), AssRes(), Control_valve2(), and SetValue().

doublereal Control_valve2::density
private

Definition at line 160 of file valve.h.

Referenced by AssJac(), AssRes(), Prepare(), and SetValue().

doublereal Control_valve2::dp[LAST_Q]
private

Definition at line 159 of file valve.h.

Referenced by AssRes(), Prepare(), and SetValue().

doublereal Control_valve2::f[LAST_N]
private

Definition at line 168 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Control_valve2::loss_area
private

Definition at line 165 of file valve.h.

Referenced by Control_valve2().

const PressureNode* Control_valve2::pNode[LAST_N]
private

Definition at line 157 of file valve.h.

Referenced by AssJac(), AssRes(), Control_valve2(), GetConnectedNodes(), and Prepare().

doublereal Control_valve2::q[LAST_Q]
private

Definition at line 158 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Control_valve2::s_max
private

Definition at line 167 of file valve.h.

doublereal Control_valve2::Stato
private

Definition at line 162 of file valve.h.

Referenced by Output(), and Prepare().


The documentation for this class was generated from the following files: