Oasys.PRIMER.SensorSwitch class¶
Constants¶
Properties¶
- property SensorSwitch.abid: integer¶
Airbag ID
- property SensorSwitch.amax: float¶
Maximum allowable area for failed vent surface area (VA)
- property SensorSwitch.c23: integer/float¶
Vent coefficient if positive or user defined load curve ID if negative
- property SensorSwitch.exists(read only): boolean¶
true if *SENSOR_SWITCH exists, false if referred to but not defined
- property SensorSwitch.filtrid: integer¶
Filter ID
- property SensorSwitch.id: integer¶
Part set ID or Part ID
- property SensorSwitch.id_flag: boolean¶
Turns _TITLE/_ID ON or OFF. Used only for
SensorSwitch.SWITCH_SHELL_TO_VENT.
- property SensorSwitch.itype: integer¶
0 for Part, 1 for Part Set
- property SensorSwitch.label: integer¶
SensorSwitch
number. Theswitid
property is an alternative name for this
- property SensorSwitch.logic: string¶
Logic operator
- property SensorSwitch.nrow: integer¶
Number of Shell Fail Time Cards
- property SensorSwitch.nswit(read only): integer¶
Number of sensor switch IDs defined. IDs can be positive for “AND”, negative ID for “OR”. Applicable to
SensorSwitch.SWITCH_CALC_LOGIC
- property SensorSwitch.option: constant¶
SENSOR_SWITCH suffix. Can be
SensorSwitch.SWITCH
,SensorSwitch.SWITCH_CALC_LOGIC
orSensorSwitch.SWITCH_SHELL_TO_VENT
- property SensorSwitch.sensid: integer¶
ID of the sensor whose value will be compared
- property SensorSwitch.switid: integer¶
SensorSwitch
number. Thelabel
property is an alternative name for this
- property SensorSwitch.timwin: float¶
Trigger status change when the value given by the sensor is less/greater (depending on logic) than value for duration defined by timwin
- property SensorSwitch.title: string¶
SensorSwitch
title. Used only forSensorSwitch.SWITCH_SHELL_TO_VENT.
- property SensorSwitch.value: float¶
Critical value
Constructor¶
- classmethod SensorSwitch(option, model, switch_id)¶
Create a new
SensorSwitch
object
- Parameters:
option (constant) – SENSOR_SWITCH suffix. Can be
SensorSwitch.SWITCH
,SensorSwitch.SWITCH_CALC_LOGIC
orSensorSwitch.SWITCH_SHELL_TO_VENT
model (Model) –
Model
that *SENSOR_SWITCH will be created inswitch_id (integer) –
SensorSwitch
id. This is required for theSensorSwitch.SWITCH
andSensorSwitch.SWITCH_CALC_LOGIC
options and ignored forSensorSwitch.SWITCH_SHELL_TO_VENT
- Returns:
SensorSwitch object
- Return type:
dict
Example
To create a new *SENSOR_SWITCH in model m with label 100:
sc = Oasys.PRIMER.SensorSwitch(Oasys.PRIMER.SensorSwitch.SWITCH, m, 100)
Static methods¶
- classmethod SensorSwitch.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a *SENSOR_SWITCH
- Parameters:
model (Model) –
Model
that the *SENSOR_SWITCH will be created inmodal (boolean) – Optional. If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal
- Returns:
SensorSwitch object (or None if not made)
- Return type:
dict
Example
To start creating a *SENSOR_SWITCH in model m:
ss = Oasys.PRIMER.SensorSwitch.Create(m)
- classmethod SensorSwitch.First(model)¶
Returns the first *SENSOR_SWITCH in the model
- Parameters:
model (Model) –
Model
to get first *SENSOR_SWITCH in- Returns:
SensorSwitch object (or None if there are no *SENSOR_SWITCHs in the model)
- Return type:
SensorSwitch
Example
To get the first *SENSOR_SWITCH in model m:
ss = Oasys.PRIMER.SensorSwitch.First(m)
- classmethod SensorSwitch.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free *SENSOR_SWITCH label in the model. Also see
SensorSwitch.LastFreeLabel()
,SensorSwitch.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
SensorSwitch label
- Return type:
int
Example
To get the first free *SENSOR_SWITCH label in model m:
label = Oasys.PRIMER.SensorSwitch.FirstFreeLabel(m)
- classmethod SensorSwitch.FlagAll(model, flag)¶
Flags all of the *SENSOR_SWITCHs in the model with a defined flag
- Parameters:
model (Model) –
Model
that all *SENSOR_SWITCHs will be flagged inflag (Flag) – Flag to set on the *SENSOR_SWITCHs
- Returns:
No return value
- Return type:
None
Example
To flag all of the *SENSOR_SWITCHs with flag f in model m:
Oasys.PRIMER.SensorSwitch.FlagAll(m, f)
- classmethod SensorSwitch.GetAll(model)¶
Returns a list of SensorSwitch objects for all of the *SENSOR_SWITCHs in a model in PRIMER
- Parameters:
model (Model) –
Model
to get *SENSOR_SWITCHs from- Returns:
List of SensorSwitch objects
- Return type:
list
Example
To make a list of SensorSwitch objects for all of the *SENSOR_SWITCHs in model m
ss = Oasys.PRIMER.SensorSwitch.GetAll(m)
- classmethod SensorSwitch.GetFlagged(model, flag)¶
Returns a list of SensorSwitch objects for all of the flagged *SENSOR_SWITCHs in a model in PRIMER
- Parameters:
model (Model) –
Model
to get *SENSOR_SWITCHs fromflag (Flag) – Flag set on the *SENSOR_SWITCHs that you want to retrieve
- Returns:
List of SensorSwitch objects
- Return type:
list
Example
To make a list of SensorSwitch objects for all of the *SENSOR_SWITCHs in model m flagged with f
ss = Oasys.PRIMER.SensorSwitch.GetFlagged(m, f)
- classmethod SensorSwitch.GetFromID(model, number)¶
Returns the SensorSwitch object for a *SENSOR_SWITCH ID
- Parameters:
model (Model) –
Model
to find the *SENSOR_SWITCH innumber (integer) – number of the *SENSOR_SWITCH you want the SensorSwitch object for
- Returns:
SensorSwitch object (or None if *SENSOR_SWITCH does not exist)
- Return type:
SensorSwitch
Example
To get the SensorSwitch object for *SENSOR_SWITCH 100 in model m
ss = Oasys.PRIMER.SensorSwitch.GetFromID(m, 100)
- classmethod SensorSwitch.Last(model)¶
Returns the last *SENSOR_SWITCH in the model
- Parameters:
model (Model) –
Model
to get last *SENSOR_SWITCH in- Returns:
SensorSwitch object (or None if there are no *SENSOR_SWITCHs in the model)
- Return type:
SensorSwitch
Example
To get the last *SENSOR_SWITCH in model m:
ss = Oasys.PRIMER.SensorSwitch.Last(m)
- classmethod SensorSwitch.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free *SENSOR_SWITCH label in the model. Also see
SensorSwitch.FirstFreeLabel()
,SensorSwitch.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
SensorSwitch label
- Return type:
int
Example
To get the last free *SENSOR_SWITCH label in model m:
label = Oasys.PRIMER.SensorSwitch.LastFreeLabel(m)
- classmethod SensorSwitch.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) *SENSOR_SWITCH label in the model. Also see
SensorSwitch.FirstFreeLabel()
,SensorSwitch.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
SensorSwitch label
- Return type:
int
Example
To get the next free *SENSOR_SWITCH label in model m:
label = Oasys.PRIMER.SensorSwitch.NextFreeLabel(m)
- classmethod SensorSwitch.RenumberAll(model, start)¶
Renumbers all of the *SENSOR_SWITCHs in the model
- Parameters:
model (Model) –
Model
that all *SENSOR_SWITCHs will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the *SENSOR_SWITCHs in model m, from 1000000:
Oasys.PRIMER.SensorSwitch.RenumberAll(m, 1000000)
- classmethod SensorSwitch.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged *SENSOR_SWITCHs in the model
- Parameters:
model (Model) –
Model
that all the flagged *SENSOR_SWITCHs will be renumbered inflag (Flag) – Flag set on the *SENSOR_SWITCHs that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the *SENSOR_SWITCHs in model m flagged with f, from 1000000:
Oasys.PRIMER.SensorSwitch.RenumberFlagged(m, f, 1000000)
- classmethod SensorSwitch.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select *SENSOR_SWITCHs using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting *SENSOR_SWITCHs
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only *SENSOR_SWITCHs from that model can be selected. If the argument is aFlag
then only *SENSOR_SWITCHs that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any *SENSOR_SWITCHs can be selected. from any modelmodal (boolean) – Optional. If selection is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the selection will be modal
- Returns:
Number of *SENSOR_SWITCHs selected or None if menu cancelled
- Return type:
int
Example
To select *SENSOR_SWITCHs from model m, flagging those selected with flag f, giving the prompt ‘Select *SENSOR_SWITCHs’:
Oasys.PRIMER.SensorSwitch.Select(f, 'Select \*SENSOR_SWITCHs', m)To select *SENSOR_SWITCHs, flagging those selected with flag f but limiting selection to *SENSOR_SWITCHs flagged with flag l, giving the prompt ‘Select *SENSOR_SWITCHs’:
Oasys.PRIMER.SensorSwitch.Select(f, 'Select \*SENSOR_SWITCHs', l)
- classmethod SensorSwitch.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of *SENSOR_SWITCHs in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing *SENSOR_SWITCHs should be counted. If false or omitted referenced but undefined *SENSOR_SWITCHs will also be included in the total
- Returns:
number of *SENSOR_SWITCHs
- Return type:
int
Example
To get the total number of *SENSOR_SWITCHs in model m:
total = Oasys.PRIMER.SensorSwitch.Total(m)
- classmethod SensorSwitch.UnflagAll(model, flag)¶
Unsets a defined flag on all of the *SENSOR_SWITCHs in the model
- Parameters:
model (Model) –
Model
that the defined flag for all *SENSOR_SWITCHs will be unset inflag (Flag) – Flag to unset on the *SENSOR_SWITCHs
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the *SENSOR_SWITCHs in model m:
Oasys.PRIMER.SensorSwitch.UnflagAll(m, f)
Instance methods¶
- SensorSwitch.AssociateComment(comment)¶
Associates a comment with a *SENSOR_SWITCH
- Parameters:
comment (Comment) –
Comment
that will be attached to the *SENSOR_SWITCH- Returns:
No return value
- Return type:
None
Example
To associate comment c to the *SENSOR_SWITCH ss:
ss.AssociateComment(c)
- SensorSwitch.Browse(modal=Oasys.gRPC.defaultArg)¶
Starts an edit panel in Browse mode
- Parameters:
modal (boolean) – Optional. If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal
- Returns:
no return value
- Return type:
None
Example
To Browse *SENSOR_SWITCH ss:
ss.Browse()
- SensorSwitch.ClearFlag(flag)¶
Clears a flag on the *SENSOR_SWITCH
- Parameters:
flag (Flag) – Flag to clear on the *SENSOR_SWITCH
- Returns:
No return value
- Return type:
None
Example
To clear flag f for *SENSOR_SWITCH ss:
ss.ClearFlag(f)
- SensorSwitch.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the *SENSOR_SWITCH. The target include of the copied *SENSOR_SWITCH can be set using
Options.copy_target_include
- Parameters:
range (boolean) – Optional. If you want to keep the copied item in the range specified for the current include. Default value is false. To set current include, use
Include.MakeCurrentLayer()
- Returns:
SensorSwitch object
- Return type:
SensorSwitch
Example
To copy *SENSOR_SWITCH ss into *SENSOR_SWITCH z:
z = ss.Copy()
- SensorSwitch.DetachComment(comment)¶
Detaches a comment from a *SENSOR_SWITCH
- Parameters:
comment (Comment) –
Comment
that will be detached from the *SENSOR_SWITCH- Returns:
No return value
- Return type:
None
Example
To detach comment c from the *SENSOR_SWITCH ss:
ss.DetachComment(c)
- SensorSwitch.Edit(modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel
- Parameters:
modal (boolean) – Optional. If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal
- Returns:
no return value
- Return type:
None
Example
To Edit *SENSOR_SWITCH ss:
ss.Edit()
- SensorSwitch.Flagged(flag)¶
Checks if the *SENSOR_SWITCH is flagged or not
- Parameters:
flag (Flag) – Flag to test on the *SENSOR_SWITCH
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if *SENSOR_SWITCH ss has flag f set on it:
if ss.Flagged(f): do_something..
- SensorSwitch.GetComments()¶
Extracts the comments associated to a *SENSOR_SWITCH
- Returns:
List of Comment objects (or None if there are no comments associated to the node)
- Return type:
list
Example
To get the list of comments associated to the *SENSOR_SWITCH ss:
comm_list = ss.GetComments()
- SensorSwitch.GetParameter(prop)¶
Checks if a SensorSwitch property is a parameter or not. Note that object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. For this function to work the JavaScript interpreter must use the parameter name instead of the value. This can be done by setting the
Options.property_parameter_names
option to true before calling the function and then resetting it to false afterwards.. This behaviour can also temporarily be switched by using theSensorSwitch.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – *SENSOR_SWITCH property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if SensorSwitch property ss.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if ss.GetParameter(ss.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if SensorSwitch property ss.example is a parameter by using the GetParameter method:
if ss.ViewParameters().GetParameter(ss.example): do_something..
- SensorSwitch.GetRow(row)¶
Returns the data for a row in the SENSOR_SWITCH_SHELL_TO_VENT
- Parameters:
row (integer) – The row you want the data for. Note row indices start at 0
- Returns:
A list of numbers containing the row variables SSID, FTIME and C23V
- Return type:
list
Example
To get the data for the 2nd row in sensor switch ss:
data = ss.GetRow(1)
- SensorSwitch.GetSwitch(row)¶
Returns switch ID information for *SENSOR_SWITCH_CALC-LOGIC
- Parameters:
row (integer) – The row you want the data for. Note row indices start at 0
- Returns:
Dict containing sensor switch ID information
- Return type:
dict
Example
To get the data for the 2nd switch in sensor switch ss:
data = ss.GetSwitch(1) print("Switch 2: ", data["swit"])
- SensorSwitch.Keyword()¶
Returns the keyword for this *SENSOR_SWITCH. Note that a carriage return is not added. See also
SensorSwitch.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for SensorSwitch ss:
key = ss.Keyword()
- SensorSwitch.KeywordCards()¶
Returns the keyword cards for the *SENSOR_SWITCH. Note that a carriage return is not added. See also
SensorSwitch.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for sensor switch ss:
cards = ss.KeywordCards()
- SensorSwitch.Next()¶
Returns the next *SENSOR_SWITCH in the model
- Returns:
SensorSwitch object (or None if there are no more *SENSOR_SWITCHs in the model)
- Return type:
SensorSwitch
Example
To get the *SENSOR_SWITCH in model m after *SENSOR_SWITCH ss:
ss = ss.Next()
- SensorSwitch.Previous()¶
Returns the previous *SENSOR_SWITCH in the model
- Returns:
SensorSwitch object (or None if there are no more *SENSOR_SWITCHs in the model)
- Return type:
SensorSwitch
Example
To get the *SENSOR_SWITCH in model m before *SENSOR_SWITCH ss:
ss = ss.Previous()
- SensorSwitch.RemoveRow(row)¶
Removes the data for a row in *SENSOR_SWITCH_SHELL_TO_VENT
- Parameters:
row (integer) – The row you want to remove the data for. Note that row indices start at 0
- Returns:
No return value
- Return type:
None
Example
To remove the second row of data for sensor switch ss:
ss.RemoveRow(1)
- SensorSwitch.RemoveSwitch(row)¶
Removes sensor switch ID from *SENSOR_SWITCH_CALC-LOGIC
- Parameters:
row (integer) – The sensor switch ID that you want to remove. Note that row indices start at 0
- Returns:
No return value
- Return type:
None
Example
To remove the second sensor switch ID for sensor switch ss:
ss.RemoveSwitch(1)
- SensorSwitch.SetFlag(flag)¶
Sets a flag on the *SENSOR_SWITCH
- Parameters:
flag (Flag) – Flag to set on the *SENSOR_SWITCH
- Returns:
No return value
- Return type:
None
Example
To set flag f for *SENSOR_SWITCH ss:
ss.SetFlag(f)
- SensorSwitch.SetRow(row, data)¶
Sets the data for a row in *SENSOR_SWITCH_SHELL_TO_VENT
- Parameters:
row (integer) – The row you want to set the data for. Note that row indices start at 0
data (List of data) – An list containing the row variables SSID, FTIME and C23V
- Returns:
No return value
- Return type:
None
Example
To set the second row of data for sensor switch ss to be shell set list 11, time 12.0 and vent coefficient 0.7:
list = [11, 12.0, 0.7] ss.SetRow(1, array)To append a new row of data (using the same list of values):
ss.SetRow(ss.nrow, list)
- SensorSwitch.SetSwitch(index, data)¶
Specifies a sensor switch ID for a *SENSOR_SWITCH_CALC-LOGIC
- Parameters:
index (integer) – The index of the *SENSOR_SWITCH_CALC-LOGIC data to set. Note that indices start at 0, not 1.
0 <= index <=nswit
data (dict) –
Object containing sensor swith ID data
- swit:
(integer) Positive or negative sensor switch id
- Returns:
No return value
- Return type:
None
Example
To set the value of -10 for sensor switch 5 (indices start with 0) for *SENSOR_SWITCH_CALC-LOGIC s:
data = { "swit": -10 } s.SetSwitch(4, data)To append a new line of data (using the same example values):
data2 = {"swit": -10} s.SetSwitch(b["lines"], data2)
- SensorSwitch.ViewParameters()¶
Object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. This function temporarily changes the behaviour so that if a property is a parameter the parameter name is returned instead. This can be used with ‘method chaining’ (see the example below) to make sure a property argument is correct
- Returns:
SensorSwitch object
- Return type:
dict
Example
To check if SensorSwitch property ss.example is a parameter by using the
SensorSwitch.GetParameter()
method:if ss.ViewParameters().GetParameter(ss.example): do_something..
- SensorSwitch.Xrefs()¶
Returns the cross references for this *SENSOR_SWITCH
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for *SENSOR_SWITCH ss:
xrefs = ss.Xrefs()